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:
Marc Chapman 2017-07-26 22:05:04 +01:00
parent 64e742f053
commit 4ab89f637e
7 changed files with 149 additions and 1330 deletions

View file

@ -20,6 +20,11 @@
// IN THE SOFTWARE. // 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 "platform/platform.h"
#include "T3D/groundPlane.h" #include "T3D/groundPlane.h"
@ -40,6 +45,7 @@
#include "T3D/physics/physicsBody.h" #include "T3D/physics/physicsBody.h"
#include "T3D/physics/physicsCollision.h" #include "T3D/physics/physicsCollision.h"
#include "afx/ce/afxZodiacMgr.h"
/// Minimum square size allowed. This is a cheap way to limit the amount /// Minimum square size allowed. This is a cheap way to limit the amount
/// of geometry possibly generated by the GroundPlane (vertex buffers have a /// of geometry possibly generated by the GroundPlane (vertex buffers have a
@ -77,6 +83,7 @@ GroundPlane::GroundPlane()
mNetFlags.set( Ghostable | ScopeAlways ); mNetFlags.set( Ghostable | ScopeAlways );
mConvexList = new Convex; mConvexList = new Convex;
mTypeMask |= TerrainLikeObjectType;
} }
GroundPlane::~GroundPlane() GroundPlane::~GroundPlane()
@ -356,6 +363,7 @@ void GroundPlane::prepRenderImage( SceneRenderState* state )
if( mVertexBuffer.isNull() ) if( mVertexBuffer.isNull() )
return; return;
afxZodiacMgr::renderGroundPlaneZodiacs(state, this);
// Add a render instance. // Add a render instance.
RenderPassManager* pass = state->getRenderPass(); RenderPassManager* pass = state->getRenderPass();

View file

@ -20,6 +20,10 @@
// IN THE SOFTWARE. // IN THE SOFTWARE.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames
// Copyright (C) 2015 Faust Logic, Inc.
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
#ifndef _OBJECTTYPES_H_ #ifndef _OBJECTTYPES_H_
#define _OBJECTTYPES_H_ #define _OBJECTTYPES_H_
@ -149,6 +153,8 @@ enum SceneObjectTypes
EntityObjectType = BIT(23), EntityObjectType = BIT(23),
/// @} /// @}
InteriorLikeObjectType = BIT(24),
TerrainLikeObjectType = BIT(25),
}; };
enum SceneObjectTypeMasks : U32 enum SceneObjectTypeMasks : U32

View file

@ -20,6 +20,11 @@
// IN THE SOFTWARE. // 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 "platform/platform.h"
#include "T3D/tsStatic.h" #include "T3D/tsStatic.h"
@ -54,6 +59,8 @@ using namespace Torque;
extern bool gEditingMission; extern bool gEditingMission;
#include "afx/ce/afxZodiacMgr.h"
IMPLEMENT_CO_NETOBJECT_V1(TSStatic); IMPLEMENT_CO_NETOBJECT_V1(TSStatic);
ConsoleDocClass( TSStatic, ConsoleDocClass( TSStatic,
@ -124,6 +131,12 @@ TSStatic::TSStatic()
mCollisionType = CollisionMesh; mCollisionType = CollisionMesh;
mDecalType = CollisionMesh; mDecalType = CollisionMesh;
mIgnoreZodiacs = false;
mHasGradients = false;
mInvertGradientRange = false;
mGradientRangeUser.set(0.0f, 180.0f);
afxZodiacData::convertGradientRangeFromDegrees(mGradientRange, mGradientRangeUser);
} }
TSStatic::~TSStatic() TSStatic::~TSStatic()
@ -222,6 +235,12 @@ void TSStatic::initPersistFields()
endGroup("Debug"); 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(); Parent::initPersistFields();
} }
@ -323,6 +342,8 @@ bool TSStatic::_createShape()
{ {
// Cleanup before we create. // Cleanup before we create.
mCollisionDetails.clear(); mCollisionDetails.clear();
mDecalDetails.clear();
mDecalDetailsPtr = 0;
mLOSDetails.clear(); mLOSDetails.clear();
SAFE_DELETE( mPhysicsRep ); SAFE_DELETE( mPhysicsRep );
SAFE_DELETE( mShapeInstance ); SAFE_DELETE( mShapeInstance );
@ -396,11 +417,29 @@ void TSStatic::prepCollision()
// Cleanup any old collision data // Cleanup any old collision data
mCollisionDetails.clear(); mCollisionDetails.clear();
mDecalDetails.clear();
mDecalDetailsPtr = 0;
mLOSDetails.clear(); mLOSDetails.clear();
mConvexList->nukeList(); mConvexList->nukeList();
if ( mCollisionType == CollisionMesh || mCollisionType == VisibleMesh ) if ( mCollisionType == CollisionMesh || mCollisionType == VisibleMesh )
{
mShape->findColDetails( mCollisionType == VisibleMesh, &mCollisionDetails, &mLOSDetails ); 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(); _updatePhysics();
} }
@ -681,6 +720,8 @@ void TSStatic::prepRenderImage( SceneRenderState* state )
} }
mShapeInstance->render( rdata ); mShapeInstance->render( rdata );
if (!mIgnoreZodiacs && mDecalDetailsPtr != 0)
afxZodiacMgr::renderPolysoupZodiacs(state, this);
if ( mRenderNormalScalar > 0 ) if ( mRenderNormalScalar > 0 )
{ {
ObjectRenderInst *ri = state->getRenderPass()->allocInst<ObjectRenderInst>(); ObjectRenderInst *ri = state->getRenderPass()->allocInst<ObjectRenderInst>();
@ -786,6 +827,13 @@ U32 TSStatic::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
stream->write(mInvertAlphaFade); stream->write(mInvertAlphaFade);
} }
stream->writeFlag(mIgnoreZodiacs);
if (stream->writeFlag(mHasGradients))
{
stream->writeFlag(mInvertGradientRange);
stream->write(mGradientRange.x);
stream->write(mGradientRange.y);
}
if ( mLightPlugin ) if ( mLightPlugin )
retMask |= mLightPlugin->packUpdate(this, AdvancedStaticOptionsMask, con, mask, stream); retMask |= mLightPlugin->packUpdate(this, AdvancedStaticOptionsMask, con, mask, stream);
@ -870,6 +918,14 @@ void TSStatic::unpackUpdate(NetConnection *con, BitStream *stream)
stream->read(&mInvertAlphaFade); stream->read(&mInvertAlphaFade);
} }
mIgnoreZodiacs = stream->readFlag();
mHasGradients = stream->readFlag();
if (mHasGradients)
{
mInvertGradientRange = stream->readFlag();
stream->read(&mGradientRange.x);
stream->read(&mGradientRange.y);
}
if ( mLightPlugin ) if ( mLightPlugin )
{ {
mLightPlugin->unpackUpdate(this, con, stream); mLightPlugin->unpackUpdate(this, con, stream);
@ -882,6 +938,7 @@ void TSStatic::unpackUpdate(NetConnection *con, BitStream *stream)
if ( isProperlyAdded() ) if ( isProperlyAdded() )
_updateShouldTick(); _updateShouldTick();
set_special_typing();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -992,6 +1049,11 @@ bool TSStatic::buildPolyList(PolyListContext context, AbstractPolyList* polyList
polyList->addBox( mObjBox ); polyList->addBox( mObjBox );
else if ( meshType == VisibleMesh ) else if ( meshType == VisibleMesh )
mShapeInstance->buildPolyList( polyList, 0 ); 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 else
{ {
// Everything else is done from the collision meshes // Everything else is done from the collision meshes
@ -1324,3 +1386,22 @@ DefineEngineMethod( TSStatic, getModelFile, const char *, (),,
{ {
return object->getShapeFileName(); 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();
}

File diff suppressed because it is too large Load diff

View file

@ -20,6 +20,11 @@
// IN THE SOFTWARE. // IN THE SOFTWARE.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames
// Copyright (C) 2015 Faust Logic, Inc.
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
#ifndef _TSSTATIC_H_ #ifndef _TSSTATIC_H_
#define _TSSTATIC_H_ #define _TSSTATIC_H_
@ -236,6 +241,19 @@ public:
const Vector<S32>& getLOSDetails() const { return mLOSDetails; } const Vector<S32>& getLOSDetails() const { return mLOSDetails; }
private:
virtual void onStaticModified(const char* slotName, const char*newValue = NULL);
protected:
Vector<S32> mDecalDetails;
Vector<S32>* mDecalDetailsPtr;
public:
bool mIgnoreZodiacs;
bool mHasGradients;
bool mInvertGradientRange;
Point2F mGradientRangeUser;
Point2F mGradientRange;
private:
void set_special_typing();
}; };
typedef TSStatic::MeshType TSMeshType; typedef TSStatic::MeshType TSMeshType;

View file

@ -20,6 +20,11 @@
// IN THE SOFTWARE. // 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 "platform/platform.h"
#include "environment/meshRoad.h" #include "environment/meshRoad.h"
@ -52,6 +57,8 @@
#include "T3D/physics/physicsCollision.h" #include "T3D/physics/physicsCollision.h"
#include "environment/nodeListManager.h" #include "environment/nodeListManager.h"
#include "afx/ce/afxZodiacMgr.h"
#define MIN_METERS_PER_SEGMENT 1.0f #define MIN_METERS_PER_SEGMENT 1.0f
#define MIN_NODE_DEPTH 0.25f #define MIN_NODE_DEPTH 0.25f
#define MAX_NODE_DEPTH 50.0f #define MAX_NODE_DEPTH 50.0f
@ -620,6 +627,7 @@ MeshRoad::MeshRoad()
mMatInst[Top] = NULL; mMatInst[Top] = NULL;
mMatInst[Bottom] = NULL; mMatInst[Bottom] = NULL;
mMatInst[Side] = NULL; mMatInst[Side] = NULL;
mTypeMask |= TerrainLikeObjectType;
} }
MeshRoad::~MeshRoad() MeshRoad::~MeshRoad()
@ -821,6 +829,7 @@ void MeshRoad::prepRenderImage( SceneRenderState* state )
// otherwise obey the smShowRoad flag // otherwise obey the smShowRoad flag
if ( smShowRoad || !smEditorOpen ) if ( smShowRoad || !smEditorOpen )
{ {
afxZodiacMgr::renderMeshRoadZodiacs(state, this);
MeshRenderInst coreRI; MeshRenderInst coreRI;
coreRI.clear(); coreRI.clear();
coreRI.objectToWorld = &MatrixF::Identity; coreRI.objectToWorld = &MatrixF::Identity;
@ -1379,6 +1388,11 @@ bool MeshRoad::buildSegmentPolyList( AbstractPolyList* polyList, U32 startSegIdx
ddraw->setLastTTL( 0 ); ddraw->setLastTTL( 0 );
} }
if (buildPolyList_TopSurfaceOnly)
{
offset += 4;
continue;
}
// Left Face // Left Face
polyList->begin( 0,0 ); polyList->begin( 0,0 );
@ -2454,3 +2468,16 @@ DefineEngineMethod( MeshRoad, postApply, void, (),,
{ {
object->inspectPostApply(); object->inspectPostApply();
} }
bool MeshRoad::buildPolyList_TopSurfaceOnly = false;
bool MeshRoad::buildTopPolyList(PolyListContext plc, AbstractPolyList* polyList)
{
static Box3F box_prox; static SphereF ball_prox;
buildPolyList_TopSurfaceOnly = true;
bool result = buildPolyList(plc, polyList, box_prox, ball_prox);
buildPolyList_TopSurfaceOnly = false;
return result;
}

View file

@ -20,6 +20,11 @@
// IN THE SOFTWARE. // IN THE SOFTWARE.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames
// Copyright (C) 2015 Faust Logic, Inc.
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
#ifndef _MESHROAD_H_ #ifndef _MESHROAD_H_
#define _MESHROAD_H_ #define _MESHROAD_H_
@ -560,6 +565,10 @@ protected:
Convex* mConvexList; Convex* mConvexList;
Vector<MeshRoadConvex*> mDebugConvex; Vector<MeshRoadConvex*> mDebugConvex;
PhysicsBody *mPhysicsRep; PhysicsBody *mPhysicsRep;
private:
static bool buildPolyList_TopSurfaceOnly;
public:
bool buildTopPolyList(PolyListContext, AbstractPolyList*);
}; };