MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / getFeatures

Method getFeatures

Engine/source/forest/forestCollision.cpp:124–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122}
123
124void ForestConvex::getFeatures( const MatrixF &mat, const VectorF &n, ConvexFeature *cf )
125{
126 cf->material = 0;
127 cf->object = mObject;
128
129 TSShapeInstance *si = mData->getShapeInstance();
130
131 TSShape::ConvexHullAccelerator* pAccel =
132 si->getShape()->getAccelerator(mData->getCollisionDetails()[hullId]);
133 AssertFatal(pAccel != NULL, "Error, no accel!");
134
135 F32 currMaxDP = mDot(pAccel->vertexList[0], n);
136 U32 index = 0;
137 U32 i;
138 for (i = 1; i < pAccel->numVerts; i++)
139 {
140 F32 dp = mDot(pAccel->vertexList[i], n);
141 if (dp > currMaxDP)
142 {
143 currMaxDP = dp;
144 index = i;
145 }
146 }
147
148 const U8* emitString = pAccel->emitStrings[index];
149 U32 currPos = 0;
150 U32 numVerts = emitString[currPos++];
151 for (i = 0; i < numVerts; i++)
152 {
153 cf->mVertexList.increment();
154 U32 index = emitString[currPos++];
155 mat.mulP(pAccel->vertexList[index], &cf->mVertexList.last());
156 }
157
158 U32 numEdges = emitString[currPos++];
159 for (i = 0; i < numEdges; i++)
160 {
161 U32 ev0 = emitString[currPos++];
162 U32 ev1 = emitString[currPos++];
163 cf->mEdgeList.increment();
164 cf->mEdgeList.last().vertex[0] = ev0;
165 cf->mEdgeList.last().vertex[1] = ev1;
166 }
167
168 U32 numFaces = emitString[currPos++];
169 for (i = 0; i < numFaces; i++)
170 {
171 cf->mFaceList.increment();
172 U32 plane = emitString[currPos++];
173 mat.mulV(pAccel->normalList[plane], &cf->mFaceList.last().normal);
174 for (U32 j = 0; j < 3; j++)
175 cf->mFaceList.last().vertex[j] = emitString[currPos++];
176 }
177}
178
179void ForestConvex::getPolyList(AbstractPolyList* list)
180{

Callers

nothing calls this directly

Calls 8

getAcceleratorMethod · 0.80
incrementMethod · 0.80
mulPMethod · 0.80
lastMethod · 0.80
mulVMethod · 0.80
mDotFunction · 0.50
getShapeInstanceMethod · 0.45
getShapeMethod · 0.45

Tested by

no test coverage detected