mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 16:44:36 +00:00
Makes point and spot lights be correctly culled with zoning like other objects.
This commit is contained in:
parent
ca4e4fe86d
commit
dfb8f4f5e5
5 changed files with 23 additions and 2 deletions
|
|
@ -68,7 +68,7 @@ LightBase::LightBase()
|
||||||
mFlareScale( 1.0f )
|
mFlareScale( 1.0f )
|
||||||
{
|
{
|
||||||
mNetFlags.set( Ghostable | ScopeAlways );
|
mNetFlags.set( Ghostable | ScopeAlways );
|
||||||
mTypeMask = EnvironmentObjectType | LightObjectType;
|
mTypeMask = LightObjectType;
|
||||||
|
|
||||||
mLight = LightManager::createLightInfo();
|
mLight = LightManager::createLightInfo();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -177,7 +177,8 @@ enum SceneObjectTypeMasks
|
||||||
StaticShapeObjectType |
|
StaticShapeObjectType |
|
||||||
DynamicShapeObjectType |
|
DynamicShapeObjectType |
|
||||||
EntityObjectType |
|
EntityObjectType |
|
||||||
ZoneObjectType ), // This improves the result of zone traversals.
|
ZoneObjectType |
|
||||||
|
LightObjectType ), // This improves the result of zone traversals.
|
||||||
|
|
||||||
/// Mask for objects that should be specifically excluded from zone culling.
|
/// Mask for objects that should be specifically excluded from zone culling.
|
||||||
CULLING_EXCLUDE_TYPEMASK = ( TerrainObjectType |
|
CULLING_EXCLUDE_TYPEMASK = ( TerrainObjectType |
|
||||||
|
|
|
||||||
|
|
@ -227,6 +227,15 @@ void LightManager::registerGlobalLights( const Frustum *frustum, bool staticLigh
|
||||||
// Cull the lights using the frustum.
|
// Cull the lights using the frustum.
|
||||||
getSceneManager()->getContainer()->findObjectList( *frustum, lightMask, &activeLights );
|
getSceneManager()->getContainer()->findObjectList( *frustum, lightMask, &activeLights );
|
||||||
|
|
||||||
|
for (U32 i = 0; i < activeLights.size(); ++i)
|
||||||
|
{
|
||||||
|
if (!getSceneManager()->mRenderedObjectsList.contains(activeLights[i]))
|
||||||
|
{
|
||||||
|
activeLights.erase(i);
|
||||||
|
--i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Store the culling position for sun placement
|
// Store the culling position for sun placement
|
||||||
// later... see setSpecialLight.
|
// later... see setSpecialLight.
|
||||||
mCullPos = frustum->getPosition();
|
mCullPos = frustum->getPosition();
|
||||||
|
|
|
||||||
|
|
@ -451,6 +451,13 @@ void SceneManager::_renderScene( SceneRenderState* state, U32 objectMask, SceneZ
|
||||||
|
|
||||||
PROFILE_END();
|
PROFILE_END();
|
||||||
|
|
||||||
|
//store our rendered objects into a list we can easily look up against later if required
|
||||||
|
mRenderedObjectsList.clear();
|
||||||
|
for (U32 i = 0; i < numRenderObjects; ++i)
|
||||||
|
{
|
||||||
|
mRenderedObjectsList.push_back(mBatchQueryList[i]);
|
||||||
|
}
|
||||||
|
|
||||||
// Render the remaining objects.
|
// Render the remaining objects.
|
||||||
|
|
||||||
PROFILE_START( Scene_renderObjects );
|
PROFILE_START( Scene_renderObjects );
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,10 @@ class SceneManager
|
||||||
/// If true, render the AABBs of objects for debugging.
|
/// If true, render the AABBs of objects for debugging.
|
||||||
static bool smRenderBoundingBoxes;
|
static bool smRenderBoundingBoxes;
|
||||||
|
|
||||||
|
//A cache list of objects that made it through culling, so we don't have to attempt to re-test
|
||||||
|
//visibility of objects later.
|
||||||
|
Vector< SceneObject* > mRenderedObjectsList;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/// Whether this is the client-side scene.
|
/// Whether this is the client-side scene.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue