mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +00:00
SceneCullingState with culling and camera frustum
- Fix for issue https://github.com/GarageGames/Torque3D/issues/525 This fix takes into account the skewed view into the world when you have a projection offset and the ability to see further into the scene at the edges opposite to the offset. - SceneCullingState now has two frustum rather than one: a culling frustum and camera frustum. - The camera frustum should be referenced when you need the projection matrix or don't want a skewed frustum. - The culling frustum should be referenced during any scene culling or when determining what dynamic geometry to render. It currently skews itself to take into account any projection offset (automatically calculated in SceneCullingState constructor). - When there is no projection offset, the camera frustum and culling frustum are the same. This usually means any time when not using the Oculus Rift.
This commit is contained in:
parent
9af13248cf
commit
91e542b8ec
22 changed files with 161 additions and 47 deletions
|
|
@ -279,7 +279,7 @@ bool LightFlareData::_testVisibility(const SceneRenderState *state, LightFlareSt
|
|||
const Point3F &lightPos = flareState->lightMat.getPosition();
|
||||
const RectI &viewport = GFX->getViewport();
|
||||
MatrixF projMatrix;
|
||||
state->getFrustum().getProjectionMatrix(&projMatrix);
|
||||
state->getCameraFrustum().getProjectionMatrix(&projMatrix);
|
||||
if( state->isReflectPass() )
|
||||
projMatrix = state->getSceneManager()->getNonClipProjection();
|
||||
bool onScreen = MathUtils::mProjectWorldToScreen( lightPos, outLightPosSS, viewport, GFX->getWorldMatrix(), projMatrix );
|
||||
|
|
@ -465,7 +465,7 @@ void LightFlareData::prepRender( SceneRenderState *state, LightFlareState *flare
|
|||
|
||||
// Take any projection offset into account so that the point where the flare's
|
||||
// elements converge is at the 'eye' point rather than the center of the viewport.
|
||||
const Point2F& projOffset = state->getFrustum().getProjectionOffset();
|
||||
const Point2F& projOffset = state->getCameraFrustum().getProjectionOffset();
|
||||
Point3F flareVec( -lightPosSS + Point3F(projOffset.x, projOffset.y, 0.0f) );
|
||||
const F32 flareLength = flareVec.len();
|
||||
if ( flareLength > 0.0f )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue