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

Method _renderObject

Engine/source/environment/skySphere.cpp:191–246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

189}
190
191void SkySphere::_renderObject(ObjectRenderInst* ri, SceneRenderState* state, BaseMatInstance* mi)
192{
193 GFXDEBUGEVENT_SCOPE(SkySphere_RenderObject, ColorI::WHITE);
194
195 GFXTransformSaver saver;
196 GFX->setVertexBuffer(mVB);
197
198 MatrixF worldMat = MatrixF::Identity;
199 worldMat.setPosition(Point3F(
200 state->getCameraPosition().x,
201 state->getCameraPosition().y,
202 state->getCameraPosition().z));
203
204 SceneData sgData;
205 sgData.init(state);
206 sgData.objTrans = &worldMat;
207
208 mMatrixSet->restoreSceneViewProjection();
209 mMatrixSet->setWorld(worldMat);
210 if (state->isReflectPass())
211 mMatrixSet->setProjection(state->getSceneManager()->getNonClipProjection());
212
213 while (mMatInstance->setupPass(state, sgData))
214 {
215 mMatInstance->setTransforms(*mMatrixSet, state);
216 mMatInstance->setSceneInfo(state, sgData);
217
218 GFX->drawPrimitive(GFXTriangleList, 0, mPrimCount);
219 }
220
221 // Draw render band.
222 if (mFogBandHeight > 0 && mFogBandMatInst)
223 {
224 const FogData& fog = state->getSceneManager()->getFogData();
225 if (mLastFogColor != fog.color)
226 {
227 mLastFogColor = fog.color;
228 _initRender();
229 }
230
231 // Just need it to follow the camera... no rotation.
232 MatrixF camPosMat(MatrixF::Identity);
233 camPosMat.setPosition(worldMat.getPosition());
234 sgData.objTrans = &camPosMat;
235 mMatrixSet->setWorld(*sgData.objTrans);
236
237 while (mFogBandMatInst->setupPass(state, sgData))
238 {
239 mFogBandMatInst->setTransforms(*mMatrixSet, state);
240 mFogBandMatInst->setSceneInfo(state, sgData);
241
242 GFX->setVertexBuffer(mFogBandVB);
243 GFX->drawPrimitive(GFXTriangleList, 0, mFogPrimCount);
244 }
245 }
246}
247
248void SkySphere::clearVectors()

Callers

nothing calls this directly

Calls 11

setVertexBufferMethod · 0.80
isReflectPassMethod · 0.80
Point3FClass · 0.50
setPositionMethod · 0.45
initMethod · 0.45
getSceneManagerMethod · 0.45
setupPassMethod · 0.45
setTransformsMethod · 0.45
setSceneInfoMethod · 0.45
drawPrimitiveMethod · 0.45
getPositionMethod · 0.45

Tested by

no test coverage detected