MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / _setNumSplits

Method _setNumSplits

Engine/source/lighting/shadowMap/pssmLightShadowMap.cpp:72–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72void PSSMLightShadowMap::_setNumSplits( U32 numSplits, U32 texSize )
73{
74 AssertFatal(numSplits > 0 && numSplits <= MAX_SPLITS,
75 avar("PSSMLightShadowMap::_setNumSplits() - Splits must be between 1 and %d!", MAX_SPLITS));
76
77 releaseTextures();
78
79 mNumSplits = numSplits;
80 mTexSize = texSize;
81 F32 texWidth, texHeight;
82
83 // If the split count is less than 4 then do a
84 // 1xN layout of shadow maps...
85 if ( mNumSplits < 4 )
86 {
87 texHeight = texSize;
88 texWidth = texSize * mNumSplits;
89
90 for ( U32 i = 0; i < 4; i++ )
91 {
92 mViewports[i].extent.set(texSize, texSize);
93 mViewports[i].point.set(texSize*i, 0);
94 }
95 }
96 else
97 {
98 // ... with 4 splits do a 2x2.
99 texWidth = texHeight = texSize * 2;
100
101 for ( U32 i = 0; i < 4; i++ )
102 {
103 F32 xOff = (i == 1 || i == 3) ? 0.5f : 0.0f;
104 F32 yOff = (i > 1) ? 0.5f : 0.0f;
105 mViewports[i].extent.set( texSize, texSize );
106 mViewports[i].point.set( xOff * texWidth, yOff * texHeight );
107 }
108 }
109
110 mShadowMapTex.set( texWidth, texHeight,
111 ShadowMapFormat, &ShadowMapProfile,
112 "PSSMLightShadowMap" );
113}
114
115void PSSMLightShadowMap::_calcSplitPos(const Frustum& currFrustum)
116{

Callers

nothing calls this directly

Calls 2

avarFunction · 0.85
setMethod · 0.45

Tested by

no test coverage detected