| 1078 | } |
| 1079 | |
| 1080 | void HeightfieldExample::stepSimulation(float deltaTime) |
| 1081 | { |
| 1082 | castRays(); |
| 1083 | |
| 1084 | raycastBar.draw(); |
| 1085 | |
| 1086 | // if dynamic and radial, go ahead and update the field |
| 1087 | if (m_rawHeightfieldData && m_isDynamic && eRadial == m_model && m_heightfieldShape) |
| 1088 | { |
| 1089 | btAlignedObjectArray<GLInstanceVertex> gfxVertices; |
| 1090 | btAlignedObjectArray<int> indices; |
| 1091 | int strideInBytes = 9 * sizeof(float); |
| 1092 | |
| 1093 | m_phase += s_deltaPhase * deltaTime; |
| 1094 | if (m_phase > 2.0 * SIMD_PI) { |
| 1095 | m_phase -= 2.0 * SIMD_PI; |
| 1096 | } |
| 1097 | int bpe = getByteSize(m_type); |
| 1098 | btAssert(bpe > 0 && "Bad bytes per element"); |
| 1099 | setRadial(m_rawHeightfieldData, bpe, m_type, m_phase); |
| 1100 | |
| 1101 | MyTriangleCollector3 col; |
| 1102 | col.m_pVerticesOut = &gfxVertices; |
| 1103 | col.m_pIndicesOut = &indices; |
| 1104 | btVector3 aabbMin, aabbMax; |
| 1105 | for (int k = 0; k < 3; k++) |
| 1106 | { |
| 1107 | aabbMin[k] = -BT_LARGE_FLOAT; |
| 1108 | aabbMax[k] = BT_LARGE_FLOAT; |
| 1109 | } |
| 1110 | m_heightfieldShape->processAllTriangles(&col, aabbMin, aabbMax); |
| 1111 | if (gfxVertices.size() && indices.size()) |
| 1112 | { |
| 1113 | m_guiHelper->getRenderInterface()->updateShape(m_heightfieldShape->getUserIndex(), &gfxVertices[0].xyzw[0], gfxVertices.size()); |
| 1114 | } |
| 1115 | } |
| 1116 | |
| 1117 | if (m_model != gHeightfieldType) |
| 1118 | { |
| 1119 | m_model = gHeightfieldType; |
| 1120 | resetPhysics(); |
| 1121 | } |
| 1122 | CommonRigidBodyMTBase::stepSimulation(deltaTime); |
| 1123 | } |
| 1124 | |
| 1125 | //////////////////////////////////////////////////////////////////////////////// |
| 1126 | // |
no test coverage detected