MCPcopy Create free account
hub / github.com/cinder/Cinder / CreateFixture

Method CreateFixture

blocks/Box2D/src/Box2D/Dynamics/b2Body.cpp:151–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149}
150
151b2Fixture* b2Body::CreateFixture(const b2FixtureDef* def)
152{
153 b2Assert(m_world->IsLocked() == false);
154 if (m_world->IsLocked() == true)
155 {
156 return NULL;
157 }
158
159 b2BlockAllocator* allocator = &m_world->m_blockAllocator;
160
161 void* memory = allocator->Allocate(sizeof(b2Fixture));
162 b2Fixture* fixture = new (memory) b2Fixture;
163 fixture->Create(allocator, this, def);
164
165 if (m_flags & e_activeFlag)
166 {
167 b2BroadPhase* broadPhase = &m_world->m_contactManager.m_broadPhase;
168 fixture->CreateProxies(broadPhase, m_xf);
169 }
170
171 fixture->m_next = m_fixtureList;
172 m_fixtureList = fixture;
173 ++m_fixtureCount;
174
175 fixture->m_body = this;
176
177 // Adjust mass properties if needed.
178 if (fixture->m_density > 0.0f)
179 {
180 ResetMassData();
181 }
182
183 // Let the world know we have a new fixture. This will cause new contacts
184 // to be created at the beginning of the next time step.
185 m_world->m_flags |= b2World::e_newFixture;
186
187 return fixture;
188}
189
190b2Fixture* b2Body::CreateFixture(const b2Shape* shape, float32 density)
191{

Callers 5

setupWallsMethod · 0.80
makeIslandMethod · 0.80
addGearMethod · 0.80
setupMethod · 0.80
addBoxMethod · 0.80

Calls 4

IsLockedMethod · 0.80
CreateProxiesMethod · 0.80
AllocateMethod · 0.45
CreateMethod · 0.45

Tested by

no test coverage detected