MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / insertMaterial

Method insertMaterial

Engine/source/collision/optimizedPolyList.cpp:207–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205}
206
207U32 OptimizedPolyList::insertMaterial(BaseMatInstance* baseMat)
208{
209 S32 retIdx = -1;
210
211 if ( !baseMat )
212 return retIdx;
213
214 Material* mat = dynamic_cast<Material*>(baseMat->getMaterial());
215
216 for (U32 i = 0; i < mMaterialList.size(); i++)
217 {
218 Material* testMat = dynamic_cast<Material*>(mMaterialList[i]->getMaterial());
219
220 if (mat && testMat)
221 {
222 if (testMat == mat)
223 {
224 retIdx = i;
225 break;
226 }
227 }
228 else if (mMaterialList[i] == baseMat)
229 {
230 retIdx = i;
231 break;
232 }
233 }
234
235 if (retIdx == -1)
236 {
237 retIdx = mMaterialList.size();
238 mMaterialList.push_back(baseMat);
239 }
240
241 return (U32)retIdx;
242}
243
244U32 OptimizedPolyList::insertVertex(const Point3F& point, const Point3F& normal,
245 const Point2F& uv0, const Point2F& uv1)

Callers

nothing calls this directly

Calls 3

getMaterialMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected