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

Method _render

Engine/source/lighting/shadowMap/cubeLightShadowMap.cpp:86–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86void CubeLightShadowMap::_render( RenderPassManager* renderPass,
87 const SceneRenderState *diffuseState )
88{
89 PROFILE_SCOPE( CubeLightShadowMap_Render );
90
91 const LightMapParams *lmParams = mLight->getExtended<LightMapParams>();
92 const bool bUseLightmappedGeometry = lmParams ? !lmParams->representedInLightmap || lmParams->includeLightmappedGeometryInShadow : true;
93
94 const U32 texSize = getBestTexSize();
95
96 if ( mCubemap.isNull() ||
97 mTexSize != texSize )
98 {
99 mTexSize = texSize;
100 mCubemap = GFX->createCubemap();
101 mCubemap->initDynamic( mTexSize, LightShadowMap::ShadowMapFormat );
102 }
103
104 // Setup the world to light projection which is used
105 // in the shader to transform the light vector for the
106 // shadow lookup.
107 mWorldToLightProj = mLight->getTransform();
108 mWorldToLightProj.inverse();
109
110 // Set up frustum and visible distance
111 GFXFrustumSaver fsaver;
112 GFXTransformSaver saver;
113 {
114 F32 left, right, top, bottom;
115 MathUtils::makeFrustum( &left, &right, &top, &bottom, M_HALFPI_F, 1.0f, 0.1f );
116 GFX->setFrustum( left, right, bottom, top, 0.1f, mLight->getRange().x );
117 }
118
119 // Render the shadowmap!
120 GFX->pushActiveRenderTarget();
121
122 for( U32 i = 0; i < 6; i++ )
123 {
124 // Standard view that will be overridden below.
125 VectorF vLookatPt(0.0f, 0.0f, 0.0f), vUpVec(0.0f, 0.0f, 0.0f), vRight(0.0f, 0.0f, 0.0f);
126
127 switch( i )
128 {
129 case 0 : // D3DCUBEMAP_FACE_POSITIVE_X:
130 vLookatPt = VectorF(1.0f, 0.0f, 0.0f);
131 vUpVec = VectorF(0.0f, 1.0f, 0.0f);
132 break;
133 case 1 : // D3DCUBEMAP_FACE_NEGATIVE_X:
134 vLookatPt = VectorF(-1.0f, 0.0f, 0.0f);
135 vUpVec = VectorF(0.0f, 1.0f, 0.0f);
136 break;
137 case 2 : // D3DCUBEMAP_FACE_POSITIVE_Y:
138 vLookatPt = VectorF(0.0f, 1.0f, 0.0f);
139 vUpVec = VectorF(0.0f, 0.0f,-1.0f);
140 break;
141 case 3 : // D3DCUBEMAP_FACE_NEGATIVE_Y:
142 vLookatPt = VectorF(0.0f, -1.0f, 0.0f);
143 vUpVec = VectorF(0.0f, 0.0f, 1.0f);

Callers

nothing calls this directly

Calls 15

makeFrustumFunction · 0.85
setFrustumMethod · 0.80
setColumnMethod · 0.80
setActiveRenderTargetMethod · 0.80
setWorldToScreenScaleMethod · 0.80
getWorldToScreenScaleMethod · 0.80
renderSceneNoLightsMethod · 0.80
popActiveRenderTargetMethod · 0.80

Tested by

no test coverage detected