Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Material Preview Renders a scene #1336

Open
wants to merge 15 commits into
base: development
Choose a base branch
from
Open
2 changes: 1 addition & 1 deletion Engine/source/T3D/aiPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1322,7 +1322,7 @@ bool AIPlayer::checkInLos(GameBase* target, bool _useMuzzle, bool _checkEnabled)
eyeMat.getColumn(3, &checkPoint );
}

bool hit = !gServerContainer.castRay(checkPoint, target->getBoxCenter(), sAIPlayerLoSMask, &ri);
bool hit = !getActiveServerContainer()->castRay(checkPoint, target->getBoxCenter(), sAIPlayerLoSMask, &ri);
enableCollision();

for (S32 i = 0; i < mountCount; i++)
Expand Down
2 changes: 1 addition & 1 deletion Engine/source/T3D/camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1540,7 +1540,7 @@ void Camera::_validateEyePoint(F32 pos, MatrixF *mat)
ItemObjectType |
VehicleObjectType;

SceneContainer* pContainer = isServerObject() ? &gServerContainer : &gClientContainer;
SceneContainer* pContainer = isServerObject() ? getActiveServerContainer() : getActiveClientContainer();
if (!pContainer->castRay(startPos, startPos - dir * 2.5 * pos, mask, &collision))
endPos = startPos - dir * pos;
else
Expand Down
2 changes: 1 addition & 1 deletion Engine/source/T3D/debris.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ bool Debris::onAdd()


// tell engine the debris exists
gClientSceneGraph->addObjectToScene(this);
getActiveClientScene()->addObjectToScene(this);

removeFromProcessList();
ClientProcessList::get()->addObject(this);
Expand Down
6 changes: 3 additions & 3 deletions Engine/source/T3D/decal/decalManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@
MODULE_INIT
{
gDecalManager = new DecalManager;
gClientSceneGraph->addObjectToScene( gDecalManager );
getActiveClientScene()->addObjectToScene( gDecalManager );
}

MODULE_SHUTDOWN
{
gClientSceneGraph->removeObjectFromScene( gDecalManager );
getActiveClientScene()->removeObjectFromScene( gDecalManager );
SAFE_DELETE( gDecalManager );
}

Expand All @@ -87,7 +87,7 @@
DecalManager *gDecalManager = NULL;

IMPLEMENT_CONOBJECT(DecalManager);
DECLARE_CATEGORY("UNLISTED");

Check warning on line 90 in Engine/source/T3D/decal/decalManager.cpp

View workflow job for this annotation

GitHub Actions / Windows Latest MSVC

'__category': unreferenced function with internal linkage has been removed [D:\a\Torque3D\Torque3D\build\Engine\source\Torque3D.vcxproj]

ConsoleDoc(
"@defgroup Decals\n"
Expand Down Expand Up @@ -660,7 +660,7 @@

RayInfo ri;
bool containsPoint = false;
if ( gServerContainer.castRayRendered( start, end, STATIC_COLLISION_TYPEMASK, &ri ) )
if ( getActiveServerContainer()->castRayRendered( start, end, STATIC_COLLISION_TYPEMASK, &ri ) )
{
Point2F poly[4];
poly[0].set( inst->mPosition.x - (inst->mSize / 2), inst->mPosition.y + (inst->mSize / 2));
Expand Down
4 changes: 2 additions & 2 deletions Engine/source/T3D/fps/guiCrossHairHud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ void GuiCrossHairHud::onRender(Point2I offset, const RectI &updateRect)
// Extend the camera vector to create an endpoint for our ray
Point3F endPos;
cam.getColumn(1, &endPos);
endPos *= gClientSceneGraph->getVisibleDistance();
endPos *= getActiveClientScene()->getVisibleDistance();
endPos += camPos;

// Collision info. We're going to be running LOS tests and we
Expand All @@ -143,7 +143,7 @@ void GuiCrossHairHud::onRender(Point2I offset, const RectI &updateRect)
control->disableCollision();

RayInfo info;
if (gClientContainer.castRay(camPos, endPos, losMask, &info)) {
if (getActiveClientContainer()->castRay(camPos, endPos, losMask, &info)) {
// Hit something... but we'll only display health for named
// ShapeBase objects. Could mask against the object type here
// and do a static cast if it's a ShapeBaseObjectType, but this
Expand Down
4 changes: 2 additions & 2 deletions Engine/source/T3D/fps/guiShapeNameHud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ void GuiShapeNameHud::onRender( Point2I, const RectI &updateRect)
camFovCos = mCos(mDegToRad(camFovCos) / 2);

// Visible distance info & name fading
F32 visDistance = gClientSceneGraph->getVisibleDistance();
F32 visDistance = getActiveClientScene()->getVisibleDistance();
F32 visDistanceSqr = visDistance * visDistance;
F32 fadeDistance = visDistance * mDistanceFade;

Expand Down Expand Up @@ -247,7 +247,7 @@ void GuiShapeNameHud::onRender( Point2I, const RectI &updateRect)
SceneObject *mount = shape->getObjectMount();
if (mount)
mount->disableCollision();
bool los = !gClientContainer.castRay(camPos, shapePos,losMask, &info);
bool los = !getActiveClientContainer()->castRay(camPos, shapePos,losMask, &info);
shape->enableCollision();
if (mount)
mount->enableCollision();
Expand Down
2 changes: 1 addition & 1 deletion Engine/source/T3D/fx/explosion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,7 @@ bool Explosion::onAdd()
}
}

gClientSceneGraph->addObjectToScene(this);
getActiveClientScene()->addObjectToScene(this);

removeFromProcessList();
ClientProcessList::get()->addObject(this);
Expand Down
4 changes: 2 additions & 2 deletions Engine/source/T3D/fx/fxFoliageReplicator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ void fxFoliageReplicator::CreateFoliage(void)
FoliageEnd.z= -2000.f;

// Perform Ray Cast Collision on Client.
CollisionResult = gClientContainer.castRay( FoliageStart, FoliageEnd, FXFOLIAGEREPLICATOR_COLLISION_MASK, &RayEvent);
CollisionResult = getActiveClientContainer()->castRay( FoliageStart, FoliageEnd, FXFOLIAGEREPLICATOR_COLLISION_MASK, &RayEvent);

// Did we hit anything?
if (CollisionResult)
Expand All @@ -655,7 +655,7 @@ void fxFoliageReplicator::CreateFoliage(void)
// If we collided with water and are not allowing on the water surface then let's find the
// terrain underneath and pass this on as the original collision else fail.
if ((CollisionType & WaterObjectType) && !mFieldData.mAllowWaterSurface &&
!gClientContainer.castRay( FoliageStart, FoliageEnd, FXFOLIAGEREPLICATOR_NOWATER_COLLISION_MASK, &RayEvent)) continue;
!getActiveClientContainer()->castRay( FoliageStart, FoliageEnd, FXFOLIAGEREPLICATOR_NOWATER_COLLISION_MASK, &RayEvent)) continue;

// We passed with flying colour so carry on.
CollisionResult = true;
Expand Down
8 changes: 4 additions & 4 deletions Engine/source/T3D/fx/fxShapeReplicator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,10 @@ void fxShapeReplicator::CreateShapes(void)
// Is this the Server?
if (isServerObject())
// Perform Ray Cast Collision on Server Terrain.
CollisionResult = gServerContainer.castRay(ShapeStart, ShapeEnd, FXREPLICATOR_COLLISION_MASK, &RayEvent);
CollisionResult = getActiveServerContainer()->castRay(ShapeStart, ShapeEnd, FXREPLICATOR_COLLISION_MASK, &RayEvent);
else
// Perform Ray Cast Collision on Client Terrain.
CollisionResult = gClientContainer.castRay( ShapeStart, ShapeEnd, FXREPLICATOR_COLLISION_MASK, &RayEvent);
CollisionResult = getActiveClientContainer()->castRay( ShapeStart, ShapeEnd, FXREPLICATOR_COLLISION_MASK, &RayEvent);

// Did we hit anything?
if (CollisionResult)
Expand All @@ -330,12 +330,12 @@ void fxShapeReplicator::CreateShapes(void)
if (isServerObject())
{
// Yes, so do it on the server container.
if (!gServerContainer.castRay( ShapeStart, ShapeEnd, FXREPLICATOR_NOWATER_COLLISION_MASK, &RayEvent)) continue;
if (!getActiveServerContainer()->castRay( ShapeStart, ShapeEnd, FXREPLICATOR_NOWATER_COLLISION_MASK, &RayEvent)) continue;
}
else
{
// No, so do it on the client container.
if (!gClientContainer.castRay( ShapeStart, ShapeEnd, FXREPLICATOR_NOWATER_COLLISION_MASK, &RayEvent)) continue;
if (!getActiveClientContainer()->castRay( ShapeStart, ShapeEnd, FXREPLICATOR_NOWATER_COLLISION_MASK, &RayEvent)) continue;
}
}

Expand Down
4 changes: 2 additions & 2 deletions Engine/source/T3D/fx/lightning.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ void Lightning::processEvent(LightningStrikeEvent* pEvent)
Point3F start = strikePoint;
start.z = mObjScale.z * 0.5f + getPosition().z;
strikePoint.z += -mObjScale.z * 0.5f;
bool rayHit = gClientContainer.castRay( start, strikePoint,
bool rayHit = getActiveClientContainer()->castRay( start, strikePoint,
((U32)STATIC_COLLISION_TYPEMASK | (U32)WaterObjectType),
&rayInfo);
if( rayHit )
Expand Down Expand Up @@ -807,7 +807,7 @@ void Lightning::strikeRandomPoint()
start.z = mObjScale.z * 0.5f + getPosition().z;
Point3F end = objectCenter;
end.z = -mObjScale.z * 0.5f + getPosition().z;
bool rayHit = gServerContainer.castRay( start, end,
bool rayHit = getActiveServerContainer()->castRay( start, end,
(0xFFFFFFFF),
&rayInfo);

Expand Down
4 changes: 2 additions & 2 deletions Engine/source/T3D/fx/particleEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1464,7 +1464,7 @@ void ParticleEmitter::emitParticles(const Point3F& start,

if( n_parts > 0 && getSceneManager() == NULL )
{
gClientSceneGraph->addObjectToScene(this);
getActiveClientScene()->addObjectToScene(this);
ClientProcessList::get()->addObject(this);
}

Expand Down Expand Up @@ -1534,7 +1534,7 @@ void ParticleEmitter::emitParticles(const Point3F& rCenter,
// Make sure we're part of the world
if( n_parts > 0 && getSceneManager() == NULL )
{
gClientSceneGraph->addObjectToScene(this);
getActiveClientScene()->addObjectToScene(this);
ClientProcessList::get()->addObject(this);
}

Expand Down
2 changes: 1 addition & 1 deletion Engine/source/T3D/fx/splash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ bool Splash::onAdd()
mObjBox.maxExtents = Point3F( 1, 1, 1 );
resetWorldBox();

gClientSceneGraph->addObjectToScene(this);
getActiveClientScene()->addObjectToScene(this);

removeFromProcessList();
ClientProcessList::get()->addObject(this);
Expand Down
14 changes: 7 additions & 7 deletions Engine/source/T3D/gameFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ DefineEngineFunction( containerFindFirst, const char*, (U32 typeMask, Point3F or

//initialize the list, and do the query
sgServerQueryList.mList.clear();
gServerContainer.findObjects(queryBox, typeMask, SimpleQueryList::insertionCallback, &sgServerQueryList);
getActiveServerContainer()->findObjects(queryBox, typeMask, SimpleQueryList::insertionCallback, &sgServerQueryList);

//return the first element
sgServerQueryIndex = 0;
Expand Down Expand Up @@ -342,12 +342,12 @@ bool GameProcessCameraQuery(CameraQuery *query)
if (connection && connection->getControlCameraTransform(0.032f, &query->cameraMatrix))
{
query->object = dynamic_cast<GameBase*>(connection->getCameraObject());
query->nearPlane = gClientSceneGraph->getNearClip();
query->nearPlane = getActiveClientScene()->getNearClip();

// Scale the normal visible distance by the performance
// tuning scale which we never let over 1.
CameraAndFOV::sVisDistanceScale = mClampF( CameraAndFOV::sVisDistanceScale, 0.01f, 1.0f );
query->farPlane = gClientSceneGraph->getVisibleDistance() * CameraAndFOV::sVisDistanceScale;
query->farPlane = getActiveClientScene()->getVisibleDistance() * CameraAndFOV::sVisDistanceScale;

// Provide some default values
query->stereoTargets[0] = 0;
Expand Down Expand Up @@ -423,7 +423,7 @@ void GameRenderWorld()
PROFILE_START(GameRenderWorld);
FrameAllocator::setWaterMark(0);

gClientSceneGraph->renderScene( SPT_Diffuse );
getActiveClientScene()->renderScene( SPT_Diffuse );

// renderScene leaves some states dirty, which causes problems if GameTSCtrl is the last Gui object rendered
GFX->updateStates();
Expand Down Expand Up @@ -563,7 +563,7 @@ void renderFrame(GFXTextureTargetRef* target, MatrixF transform, Frustum frustum
// We're going to be displaying this render at size of this control in
// pixels - let the scene know so that it can calculate e.g. reflections
// correctly for that final display result.
gClientSceneGraph->setDisplayTargetResolution(size);
getActiveClientScene()->setDisplayTargetResolution(size);

// Set the GFX world matrix to the world-to-camera transform, but don't
// change the cameraMatrix in mLastCameraQuery. This is because
Expand All @@ -590,7 +590,7 @@ void renderFrame(GFXTextureTargetRef* target, MatrixF transform, Frustum frustum

// Set the default non-clip projection as some
// objects depend on this even in non-reflect cases.
gClientSceneGraph->setNonClipProjection(mSaveProjection);
getActiveClientScene()->setNonClipProjection(mSaveProjection);

// Give the post effect manager the worldToCamera, and cameraToScreen matrices
PFXMGR->setFrameMatrices(mSaveModelview, mSaveProjection);
Expand All @@ -599,7 +599,7 @@ void renderFrame(GFXTextureTargetRef* target, MatrixF transform, Frustum frustum
PROFILE_START(GameFunctions_RenderFrame_RenderWorld);
FrameAllocator::setWaterMark(0);

gClientSceneGraph->renderScene(SPT_Reflect, typeMask);
getActiveClientScene()->renderScene(SPT_Reflect, typeMask);

// renderScene leaves some states dirty, which causes problems if GameTSCtrl is the last Gui object rendered
GFX->updateStates();
Expand Down
Loading
Loading