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

Method prepRenderImage

Engine/source/T3D/lighting/skylight.cpp:157–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155}
156
157void Skylight::prepRenderImage(SceneRenderState *state)
158{
159 if (!mEnabled || !Skylight::smRenderSkylights)
160 return;
161
162 //special hook-in for skylights
163 Point3F camPos = state->getCameraPosition();
164 mProbeInfo.mBounds.setCenter(camPos);
165
166 mProbeInfo.setPosition(camPos);
167
168 //Submit our probe to actually do the probe action
169 // Get a handy pointer to our RenderPassmanager
170 //RenderPassManager *renderPass = state->getRenderPass();
171
172 PROBEMGR->submitProbe(&mProbeInfo);
173
174#ifdef TORQUE_TOOLS
175 if (Skylight::smRenderPreviewProbes && gEditingMission && mEditorShapeInst && mPrefilterMap != nullptr)
176 {
177 GFXTransformSaver saver;
178
179 // Calculate the distance of this object from the camera
180 Point3F cameraOffset;
181 getRenderTransform().getColumn(3, &cameraOffset);
182 cameraOffset -= state->getDiffuseCameraPosition();
183 F32 dist = cameraOffset.len();
184 if (dist < 0.01f)
185 dist = 0.01f;
186
187 // Set up the LOD for the shape
188 F32 invScale = (1.0f / getMax(getMax(mObjScale.x, mObjScale.y), mObjScale.z));
189
190 mEditorShapeInst->setDetailFromDistance(state, dist * invScale);
191
192 // Make sure we have a valid level of detail
193 if (mEditorShapeInst->getCurrentDetail() < 0)
194 return;
195
196 BaseMatInstance* probePrevMat = mEditorShapeInst->getMaterialList()->getMaterialInst(0);
197
198 setPreviewMatParameters(state, probePrevMat);
199
200 // GFXTransformSaver is a handy helper class that restores
201 // the current GFX matrices to their original values when
202 // it goes out of scope at the end of the function
203
204 // Set up our TS render state
205 TSRenderState rdata;
206 rdata.setSceneState(state);
207 rdata.setFadeOverride(1.0f);
208
209 // We might have some forward lit materials
210 // so pass down a query to gather lights.
211 LightQuery query;
212 query.init(getWorldSphere());
213 rdata.setLightQuery(&query);
214

Callers

nothing calls this directly

Calls 15

getMaxFunction · 0.85
isSelectedFunction · 0.85
setCenterMethod · 0.80
submitProbeMethod · 0.80
getColumnMethod · 0.80
setDetailFromDistanceMethod · 0.80
getCurrentDetailMethod · 0.80
getMaterialInstMethod · 0.80
getMaterialListMethod · 0.80
setSceneStateMethod · 0.80
setFadeOverrideMethod · 0.80

Tested by

no test coverage detected