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

Method addDecal

Engine/source/T3D/decal/decalDataFile.cpp:271–315  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

269//-----------------------------------------------------------------------------
270
271DecalInstance* DecalDataFile::addDecal( const Point3F& pos, const Point3F& normal, const Point3F& tangent,
272 DecalData* decalData, F32 decalScale, S32 decalTexIndex, U8 flags )
273{
274 DecalInstance* newDecal = _allocateInstance();
275
276 newDecal->mRenderPriority = 0;
277 newDecal->mCustomTex = NULL;
278 newDecal->mId = -1;
279
280 newDecal->mPosition = pos;
281 newDecal->mNormal = normal;
282 newDecal->mTangent = tangent;
283
284 newDecal->mSize = decalData->size * decalScale;
285
286 newDecal->mDataBlock = decalData;
287
288 S32 frame = newDecal->mDataBlock->frame;
289 // randomize the frame if the flag is set. this number is used directly below us
290 // when calculating render coords
291 if ( decalData->randomize )
292 frame = gRandGen.randI();
293
294 frame %= getMax( decalData->texCoordCount, 0 ) + 1;
295
296 newDecal->mTextureRectIdx = frame;
297
298 newDecal->mVisibility = 1.0f;
299
300 newDecal->mLastAlpha = -1.0f;
301
302 newDecal->mCreateTime = Sim::getCurrentTime();
303
304 newDecal->mVerts = NULL;
305 newDecal->mIndices = NULL;
306 newDecal->mVertCount = 0;
307 newDecal->mIndxCount = 0;
308
309 newDecal->mFlags = flags;
310 newDecal->mFlags |= ClipDecal;
311
312 _addDecalToSpheres( newDecal );
313
314 return newDecal;
315}
316
317//-----------------------------------------------------------------------------
318

Callers

nothing calls this directly

Calls 3

getMaxFunction · 0.85
randIMethod · 0.60
getCurrentTimeFunction · 0.50

Tested by

no test coverage detected