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

Method updateImageAnimation

Engine/source/T3D/shapeImage.cpp:3160–3216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3158//----------------------------------------------------------------------------
3159
3160void ShapeBase::updateImageAnimation(U32 imageSlot, F32 dt)
3161{
3162 if (!mMountedImageList[imageSlot].dataBlock)
3163 return;
3164 MountedImage& image = mMountedImageList[imageSlot];
3165 U32 imageShapeIndex = getImageShapeIndex(image);
3166
3167 // Advance animation threads
3168 for (U32 i=0; i<ShapeBaseImageData::MaxShapes; ++i)
3169 {
3170 if (!image.dataBlock->shapeIsValid[i] || (i != imageShapeIndex && !image.doAnimateAllShapes))
3171 continue;
3172
3173 if (image.ambientThread[i])
3174 image.shapeInstance[i]->advanceTime(dt,image.ambientThread[i]);
3175 if (image.animThread[i])
3176 image.shapeInstance[i]->advanceTime(dt,image.animThread[i]);
3177 if (image.spinThread[i])
3178 image.shapeInstance[i]->advanceTime(dt,image.spinThread[i]);
3179 if (image.flashThread[i])
3180 image.shapeInstance[i]->advanceTime(dt,image.flashThread[i]);
3181 }
3182
3183 // Broadcast the update
3184 onImageAnimThreadUpdate(imageSlot, imageShapeIndex, dt);
3185
3186 image.updateSoundSources(getRenderTransform());
3187
3188 // Particle emission
3189 for (S32 i = 0; i < MaxImageEmitters; i++) {
3190 MountedImage::ImageEmitter& em = image.emitter[i];
3191 if (bool(em.emitter)) {
3192 if (em.time > 0) {
3193 em.time -= dt;
3194
3195 // Do we need to update the emitter's node due to the current shape changing?
3196 if (imageShapeIndex != image.lastShapeIndex)
3197 {
3198 em.node = image.state->emitterNode[imageShapeIndex];
3199 }
3200
3201 MatrixF mat;
3202 getRenderImageTransform(imageSlot,em.node,&mat);
3203 Point3F pos,axis;
3204 mat.getColumn(3,&pos);
3205 mat.getColumn(1,&axis);
3206 em.emitter->emitParticles(pos,true,axis,getVelocity(),(U32) (dt * 1000));
3207 }
3208 else {
3209 em.emitter->deleteWhenEmpty();
3210 em.emitter = 0;
3211 }
3212 }
3213 }
3214
3215 image.lastShapeIndex = imageShapeIndex;
3216}
3217

Callers

nothing calls this directly

Calls 6

getVelocityFunction · 0.85
updateSoundSourcesMethod · 0.80
getColumnMethod · 0.80
deleteWhenEmptyMethod · 0.80
advanceTimeMethod · 0.45
emitParticlesMethod · 0.45

Tested by

no test coverage detected