mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 11:43:49 +00:00
meshroad-zodiacs -- MeshRoad customizations for rendering zodiacs on them.
enhanced-meshroad -- adds option for building top-surface-only PolyList. polysoup-zodiacs -- Changes made for rendering zodiacs on polysoup objects. groundplane-zodiacs -- groundPlane customizations for rendering zodiacs on them. special-types -- defines type bits for interior-like and terrain-like types. special-types -- defines a type bit for polysoup objects.
This commit is contained in:
parent
64e742f053
commit
4ab89f637e
7 changed files with 149 additions and 1330 deletions
|
|
@ -20,6 +20,11 @@
|
|||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
|
||||
// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames
|
||||
// Copyright (C) 2015 Faust Logic, Inc.
|
||||
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
|
||||
|
||||
#include "platform/platform.h"
|
||||
#include "T3D/tsStatic.h"
|
||||
|
||||
|
|
@ -54,6 +59,8 @@ using namespace Torque;
|
|||
|
||||
extern bool gEditingMission;
|
||||
|
||||
#include "afx/ce/afxZodiacMgr.h"
|
||||
|
||||
IMPLEMENT_CO_NETOBJECT_V1(TSStatic);
|
||||
|
||||
ConsoleDocClass( TSStatic,
|
||||
|
|
@ -124,6 +131,12 @@ TSStatic::TSStatic()
|
|||
|
||||
mCollisionType = CollisionMesh;
|
||||
mDecalType = CollisionMesh;
|
||||
|
||||
mIgnoreZodiacs = false;
|
||||
mHasGradients = false;
|
||||
mInvertGradientRange = false;
|
||||
mGradientRangeUser.set(0.0f, 180.0f);
|
||||
afxZodiacData::convertGradientRangeFromDegrees(mGradientRange, mGradientRangeUser);
|
||||
}
|
||||
|
||||
TSStatic::~TSStatic()
|
||||
|
|
@ -222,6 +235,12 @@ void TSStatic::initPersistFields()
|
|||
|
||||
endGroup("Debug");
|
||||
|
||||
addGroup("AFX");
|
||||
addField("ignoreZodiacs", TypeBool, Offset(mIgnoreZodiacs, TSStatic));
|
||||
addField("useGradientRange", TypeBool, Offset(mHasGradients, TSStatic));
|
||||
addField("gradientRange", TypePoint2F, Offset(mGradientRangeUser, TSStatic));
|
||||
addField("invertGradientRange", TypeBool, Offset(mInvertGradientRange, TSStatic));
|
||||
endGroup("AFX");
|
||||
Parent::initPersistFields();
|
||||
}
|
||||
|
||||
|
|
@ -323,6 +342,8 @@ bool TSStatic::_createShape()
|
|||
{
|
||||
// Cleanup before we create.
|
||||
mCollisionDetails.clear();
|
||||
mDecalDetails.clear();
|
||||
mDecalDetailsPtr = 0;
|
||||
mLOSDetails.clear();
|
||||
SAFE_DELETE( mPhysicsRep );
|
||||
SAFE_DELETE( mShapeInstance );
|
||||
|
|
@ -396,11 +417,29 @@ void TSStatic::prepCollision()
|
|||
|
||||
// Cleanup any old collision data
|
||||
mCollisionDetails.clear();
|
||||
mDecalDetails.clear();
|
||||
mDecalDetailsPtr = 0;
|
||||
mLOSDetails.clear();
|
||||
mConvexList->nukeList();
|
||||
|
||||
if ( mCollisionType == CollisionMesh || mCollisionType == VisibleMesh )
|
||||
{
|
||||
mShape->findColDetails( mCollisionType == VisibleMesh, &mCollisionDetails, &mLOSDetails );
|
||||
if ( mDecalType == mCollisionType )
|
||||
{
|
||||
mDecalDetailsPtr = &mCollisionDetails;
|
||||
}
|
||||
else if ( mDecalType == CollisionMesh || mDecalType == VisibleMesh )
|
||||
{
|
||||
mShape->findColDetails( mDecalType == VisibleMesh, &mDecalDetails, 0 );
|
||||
mDecalDetailsPtr = &mDecalDetails;
|
||||
}
|
||||
}
|
||||
else if ( mDecalType == CollisionMesh || mDecalType == VisibleMesh )
|
||||
{
|
||||
mShape->findColDetails( mDecalType == VisibleMesh, &mDecalDetails, 0 );
|
||||
mDecalDetailsPtr = &mDecalDetails;
|
||||
}
|
||||
|
||||
_updatePhysics();
|
||||
}
|
||||
|
|
@ -681,6 +720,8 @@ void TSStatic::prepRenderImage( SceneRenderState* state )
|
|||
}
|
||||
mShapeInstance->render( rdata );
|
||||
|
||||
if (!mIgnoreZodiacs && mDecalDetailsPtr != 0)
|
||||
afxZodiacMgr::renderPolysoupZodiacs(state, this);
|
||||
if ( mRenderNormalScalar > 0 )
|
||||
{
|
||||
ObjectRenderInst *ri = state->getRenderPass()->allocInst<ObjectRenderInst>();
|
||||
|
|
@ -786,6 +827,13 @@ U32 TSStatic::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
|
|||
stream->write(mInvertAlphaFade);
|
||||
}
|
||||
|
||||
stream->writeFlag(mIgnoreZodiacs);
|
||||
if (stream->writeFlag(mHasGradients))
|
||||
{
|
||||
stream->writeFlag(mInvertGradientRange);
|
||||
stream->write(mGradientRange.x);
|
||||
stream->write(mGradientRange.y);
|
||||
}
|
||||
if ( mLightPlugin )
|
||||
retMask |= mLightPlugin->packUpdate(this, AdvancedStaticOptionsMask, con, mask, stream);
|
||||
|
||||
|
|
@ -870,6 +918,14 @@ void TSStatic::unpackUpdate(NetConnection *con, BitStream *stream)
|
|||
stream->read(&mInvertAlphaFade);
|
||||
}
|
||||
|
||||
mIgnoreZodiacs = stream->readFlag();
|
||||
mHasGradients = stream->readFlag();
|
||||
if (mHasGradients)
|
||||
{
|
||||
mInvertGradientRange = stream->readFlag();
|
||||
stream->read(&mGradientRange.x);
|
||||
stream->read(&mGradientRange.y);
|
||||
}
|
||||
if ( mLightPlugin )
|
||||
{
|
||||
mLightPlugin->unpackUpdate(this, con, stream);
|
||||
|
|
@ -882,6 +938,7 @@ void TSStatic::unpackUpdate(NetConnection *con, BitStream *stream)
|
|||
|
||||
if ( isProperlyAdded() )
|
||||
_updateShouldTick();
|
||||
set_special_typing();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
|
@ -992,6 +1049,11 @@ bool TSStatic::buildPolyList(PolyListContext context, AbstractPolyList* polyList
|
|||
polyList->addBox( mObjBox );
|
||||
else if ( meshType == VisibleMesh )
|
||||
mShapeInstance->buildPolyList( polyList, 0 );
|
||||
else if (context == PLC_Decal && mDecalDetailsPtr != 0)
|
||||
{
|
||||
for ( U32 i = 0; i < mDecalDetailsPtr->size(); i++ )
|
||||
mShapeInstance->buildPolyListOpcode( (*mDecalDetailsPtr)[i], polyList, box );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Everything else is done from the collision meshes
|
||||
|
|
@ -1324,3 +1386,22 @@ DefineEngineMethod( TSStatic, getModelFile, const char *, (),,
|
|||
{
|
||||
return object->getShapeFileName();
|
||||
}
|
||||
|
||||
void TSStatic::set_special_typing()
|
||||
{
|
||||
if (mCollisionType == VisibleMesh || mCollisionType == CollisionMesh)
|
||||
mTypeMask |= InteriorLikeObjectType;
|
||||
else
|
||||
mTypeMask &= ~InteriorLikeObjectType;
|
||||
}
|
||||
|
||||
void TSStatic::onStaticModified(const char* slotName, const char*newValue)
|
||||
{
|
||||
if (slotName == afxZodiacData::GradientRangeSlot)
|
||||
{
|
||||
afxZodiacData::convertGradientRangeFromDegrees(mGradientRange, mGradientRangeUser);
|
||||
return;
|
||||
}
|
||||
|
||||
set_special_typing();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue