| 67 | } |
| 68 | |
| 69 | void b2Fixture::Destroy(b2BlockAllocator* allocator) |
| 70 | { |
| 71 | // The proxies must be destroyed before calling this. |
| 72 | b2Assert(m_proxyCount == 0); |
| 73 | |
| 74 | // Free the proxy array. |
| 75 | int32 childCount = m_shape->GetChildCount(); |
| 76 | allocator->Free(m_proxies, childCount * sizeof(b2FixtureProxy)); |
| 77 | m_proxies = NULL; |
| 78 | |
| 79 | // Free the child shape. |
| 80 | switch (m_shape->m_type) |
| 81 | { |
| 82 | case b2Shape::e_circle: |
| 83 | { |
| 84 | b2CircleShape* s = (b2CircleShape*)m_shape; |
| 85 | s->~b2CircleShape(); |
| 86 | allocator->Free(s, sizeof(b2CircleShape)); |
| 87 | } |
| 88 | break; |
| 89 | |
| 90 | case b2Shape::e_edge: |
| 91 | { |
| 92 | b2EdgeShape* s = (b2EdgeShape*)m_shape; |
| 93 | s->~b2EdgeShape(); |
| 94 | allocator->Free(s, sizeof(b2EdgeShape)); |
| 95 | } |
| 96 | break; |
| 97 | |
| 98 | case b2Shape::e_polygon: |
| 99 | { |
| 100 | b2PolygonShape* s = (b2PolygonShape*)m_shape; |
| 101 | s->~b2PolygonShape(); |
| 102 | allocator->Free(s, sizeof(b2PolygonShape)); |
| 103 | } |
| 104 | break; |
| 105 | |
| 106 | case b2Shape::e_chain: |
| 107 | { |
| 108 | b2ChainShape* s = (b2ChainShape*)m_shape; |
| 109 | s->~b2ChainShape(); |
| 110 | allocator->Free(s, sizeof(b2ChainShape)); |
| 111 | } |
| 112 | break; |
| 113 | |
| 114 | default: |
| 115 | b2Assert(false); |
| 116 | break; |
| 117 | } |
| 118 | |
| 119 | m_shape = NULL; |
| 120 | } |
| 121 | |
| 122 | void b2Fixture::CreateProxies(b2BroadPhase* broadPhase, const b2Transform& xf) |
| 123 | { |
no test coverage detected