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

Method prepRenderImage

Engine/source/T3D/fx/particleEmitter.cpp:1169–1239  ·  view source on GitHub ↗

----------------------------------------------------------------------------- prepRenderImage -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1167// prepRenderImage
1168//-----------------------------------------------------------------------------
1169void ParticleEmitter::prepRenderImage(SceneRenderState* state)
1170{
1171#if defined(AFX_CAP_PARTICLE_POOLS)
1172 if (pool)
1173 return;
1174#endif
1175
1176 if( state->isReflectPass() && !getDataBlock()->renderReflection )
1177 return;
1178
1179 // Never render into shadows.
1180 if (state->isShadowPass())
1181 return;
1182
1183 PROFILE_SCOPE(ParticleEmitter_prepRenderImage);
1184
1185 if ( mDead ||
1186 n_parts == 0 ||
1187 part_list_head.next == NULL )
1188 return;
1189
1190 RenderPassManager *renderManager = state->getRenderPass();
1191 const Point3F &camPos = state->getCameraPosition();
1192 copyToVB( camPos, state->getAmbientLightColor() );
1193
1194 if (!mVertBuff.isValid())
1195 return;
1196
1197 ParticleRenderInst *ri = renderManager->allocInst<ParticleRenderInst>();
1198
1199 ri->vertBuff = &mVertBuff;
1200 ri->primBuff = &getDataBlock()->primBuff;
1201 ri->translucentSort = true;
1202 ri->type = RenderPassManager::RIT_Particle;
1203 ri->sortDistSq = getRenderWorldBox().getSqDistanceToPoint( camPos );
1204 ri->defaultKey = (-sort_priority*100);
1205
1206 // Draw the system offscreen unless the highResOnly flag is set on the datablock
1207 ri->systemState = ( getDataBlock()->highResOnly ? PSS_AwaitingHighResDraw : PSS_AwaitingOffscreenDraw );
1208
1209 ri->modelViewProj = renderManager->allocUniqueXform( GFX->getProjectionMatrix() *
1210 GFX->getViewMatrix() *
1211 GFX->getWorldMatrix() );
1212
1213 // Update position on the matrix before multiplying it
1214 mBBObjToWorld.setPosition(mLastPosition);
1215
1216 ri->bbModelViewProj = renderManager->allocUniqueXform( *ri->modelViewProj * mBBObjToWorld );
1217
1218 ri->wsPosition = getWorldTransform().getPosition();
1219
1220 ri->count = n_parts;
1221
1222 ri->blendStyle = mDataBlock->blendStyle;
1223
1224 ri->glow = mDataBlock->glow;
1225
1226 // use first particle's texture unless there is an emitter texture to override it

Callers

nothing calls this directly

Calls 13

getWorldTransformFunction · 0.85
isReflectPassMethod · 0.80
isShadowPassMethod · 0.80
allocUniqueXformMethod · 0.80
getProjectionMatrixMethod · 0.80
getRenderPassMethod · 0.45
getAmbientLightColorMethod · 0.45
isValidMethod · 0.45
getSqDistanceToPointMethod · 0.45
getWorldMatrixMethod · 0.45
setPositionMethod · 0.45
getPositionMethod · 0.45

Tested by

no test coverage detected