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

Method render

Engine/source/ts/tsLastDetail.cpp:142–189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140}
141
142void TSLastDetail::render( const TSRenderState &rdata, F32 alpha )
143{
144 // Early out if we have nothing to render.
145 if ( alpha < 0.01f ||
146 !mMatInstance ||
147 mMaterial->mImposterUVs.size() == 0 )
148 return;
149
150 const MatrixF &mat = GFX->getWorldMatrix();
151
152 // Post a render instance for this imposter... the special
153 // imposter render manager will do the magic!
154 RenderPassManager *renderPass = rdata.getSceneState()->getRenderPass();
155
156 ImposterRenderInst *ri = renderPass->allocInst<ImposterRenderInst>();
157 ri->mat = rdata.getSceneState()->getOverrideMaterial( mMatInstance );
158
159 ri->state.alpha = alpha;
160
161 // Store the up and right vectors of the rotation
162 // and we'll generate the up vector in the shader.
163 //
164 // This is faster than building a quat on the
165 // CPU and then rebuilding the matrix on the GPU.
166 //
167 // NOTE: These vector include scale.
168 //
169 mat.getColumn( 2, &ri->state.upVec );
170 mat.getColumn( 0, &ri->state.rightVec );
171
172 // We send the unscaled size and the vertex shader
173 // will use the orientation vectors above to scale it.
174 ri->state.halfSize = mRadius;
175
176 // We use the center of the object bounds for
177 // the center of the billboard quad.
178 mat.mulP( mCenter, &ri->state.center );
179
180 // We sort by the imposter type first so that RIT_Imposter and s
181 // RIT_ImposterBatches do not get mixed together.
182 //
183 // We then sort by material.
184 //
185 ri->defaultKey = 1;
186 ri->defaultKey2 = ri->mat->getStateHint();
187
188 renderPass->addInst( ri );
189}
190
191void TSLastDetail::update( bool forceUpdate )
192{

Callers

nothing calls this directly

Calls 8

getSceneStateMethod · 0.80
getOverrideMaterialMethod · 0.80
getColumnMethod · 0.80
mulPMethod · 0.80
sizeMethod · 0.45
getWorldMatrixMethod · 0.45
getRenderPassMethod · 0.45
addInstMethod · 0.45

Tested by

no test coverage detected