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

Method update

Engine/source/scene/reflectionManager.cpp:122–271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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