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

Method update

Engine/source/scene/reflectionManager.cpp:121–270  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119}
120
121void ReflectionManager::update( F32 timeSlice,
122 const Point2I &resolution,
123 const CameraQuery &query )
124{
125 GFXDEBUGEVENT_SCOPE( UpdateReflections, ColorI::WHITE );
126
127 if ( mReflectors.empty() )
128 return;
129
130 PROFILE_SCOPE( ReflectionManager_Update );
131
132 // Calculate our target time from the slice.
133 U32 targetMs = timeSlice * smFrameReflectionMS;
134
135 // Setup a culler for testing the
136 // visibility of reflectors.
137 Frustum culler;
138
139 // jamesu - normally we just need a frustum which covers the current ports, however for SBS mode
140 // we need something which covers both viewports.
141 S32 stereoTarget = GFX->getCurrentStereoTarget();
142 if (stereoTarget != -1)
143 {
144 // In this case we're rendering in stereo using a specific eye
145 MathUtils::makeFovPortFrustum(&culler, false, query.nearPlane, query.farPlane, query.fovPort[stereoTarget], query.headMatrix);
146 }
147 else if (GFX->getCurrentRenderStyle() == GFXDevice::RS_StereoSideBySide)
148 {
149 // Calculate an ideal culling size here, we'll just assume double fov based on the first fovport based on
150 // the head position.
151 FovPort port = query.fovPort[0];
152 F32 upSize = query.nearPlane * port.upTan;
153 F32 downSize = query.nearPlane * port.downTan;
154
155 F32 top = upSize;
156 F32 bottom = -downSize;
157
158 F32 fovInRadians = mAtan2((top - bottom) / 2.0f, query.nearPlane) * 3.0f;
159
160 culler.set(false,
161 fovInRadians,
162 (F32)(query.stereoViewports[0].extent.x + query.stereoViewports[1].extent.x) / (F32)query.stereoViewports[0].extent.y,
163 query.nearPlane,
164 query.farPlane,
165 query.headMatrix);
166 }
167 else
168 {
169 // Normal culling
170 culler.set(false,
171 query.fov,
172 (F32)resolution.x / (F32)resolution.y,
173 query.nearPlane,
174 query.farPlane,
175 query.cameraMatrix);
176 }
177
178 // Manipulate the frustum for tiled screenshots

Callers

nothing calls this directly

Calls 15

makeFovPortFrustumFunction · 0.85
mAtan2Function · 0.85
dQsortFunction · 0.85
dSprintfFunction · 0.85
setVariableFunction · 0.85
setIntVariableFunction · 0.85
getCurrentRenderStyleMethod · 0.80
isPendingMethod · 0.80
calcScoreMethod · 0.80
emptyMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected