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/groundPlane.h"
|
||||
|
||||
|
|
@ -40,6 +45,7 @@
|
|||
#include "T3D/physics/physicsBody.h"
|
||||
#include "T3D/physics/physicsCollision.h"
|
||||
|
||||
#include "afx/ce/afxZodiacMgr.h"
|
||||
|
||||
/// Minimum square size allowed. This is a cheap way to limit the amount
|
||||
/// of geometry possibly generated by the GroundPlane (vertex buffers have a
|
||||
|
|
@ -77,6 +83,7 @@ GroundPlane::GroundPlane()
|
|||
mNetFlags.set( Ghostable | ScopeAlways );
|
||||
|
||||
mConvexList = new Convex;
|
||||
mTypeMask |= TerrainLikeObjectType;
|
||||
}
|
||||
|
||||
GroundPlane::~GroundPlane()
|
||||
|
|
@ -356,6 +363,7 @@ void GroundPlane::prepRenderImage( SceneRenderState* state )
|
|||
if( mVertexBuffer.isNull() )
|
||||
return;
|
||||
|
||||
afxZodiacMgr::renderGroundPlaneZodiacs(state, this);
|
||||
// Add a render instance.
|
||||
|
||||
RenderPassManager* pass = state->getRenderPass();
|
||||
|
|
|
|||
|
|
@ -20,6 +20,10 @@
|
|||
// 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_
|
||||
#define _OBJECTTYPES_H_
|
||||
|
||||
|
|
@ -149,6 +153,8 @@ enum SceneObjectTypes
|
|||
|
||||
EntityObjectType = BIT(23),
|
||||
/// @}
|
||||
InteriorLikeObjectType = BIT(24),
|
||||
TerrainLikeObjectType = BIT(25),
|
||||
};
|
||||
|
||||
enum SceneObjectTypeMasks : U32
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -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.
|
||||
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
|
||||
|
||||
#ifndef _TSSTATIC_H_
|
||||
#define _TSSTATIC_H_
|
||||
|
||||
|
|
@ -236,6 +241,19 @@ public:
|
|||
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -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 "environment/meshRoad.h"
|
||||
|
||||
|
|
@ -52,6 +57,8 @@
|
|||
#include "T3D/physics/physicsCollision.h"
|
||||
#include "environment/nodeListManager.h"
|
||||
|
||||
#include "afx/ce/afxZodiacMgr.h"
|
||||
|
||||
#define MIN_METERS_PER_SEGMENT 1.0f
|
||||
#define MIN_NODE_DEPTH 0.25f
|
||||
#define MAX_NODE_DEPTH 50.0f
|
||||
|
|
@ -620,6 +627,7 @@ MeshRoad::MeshRoad()
|
|||
mMatInst[Top] = NULL;
|
||||
mMatInst[Bottom] = NULL;
|
||||
mMatInst[Side] = NULL;
|
||||
mTypeMask |= TerrainLikeObjectType;
|
||||
}
|
||||
|
||||
MeshRoad::~MeshRoad()
|
||||
|
|
@ -821,6 +829,7 @@ void MeshRoad::prepRenderImage( SceneRenderState* state )
|
|||
// otherwise obey the smShowRoad flag
|
||||
if ( smShowRoad || !smEditorOpen )
|
||||
{
|
||||
afxZodiacMgr::renderMeshRoadZodiacs(state, this);
|
||||
MeshRenderInst coreRI;
|
||||
coreRI.clear();
|
||||
coreRI.objectToWorld = &MatrixF::Identity;
|
||||
|
|
@ -1379,6 +1388,11 @@ bool MeshRoad::buildSegmentPolyList( AbstractPolyList* polyList, U32 startSegIdx
|
|||
ddraw->setLastTTL( 0 );
|
||||
}
|
||||
|
||||
if (buildPolyList_TopSurfaceOnly)
|
||||
{
|
||||
offset += 4;
|
||||
continue;
|
||||
}
|
||||
// Left Face
|
||||
|
||||
polyList->begin( 0,0 );
|
||||
|
|
@ -2454,3 +2468,16 @@ DefineEngineMethod( MeshRoad, postApply, void, (),,
|
|||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
|
||||
|
||||
#ifndef _MESHROAD_H_
|
||||
#define _MESHROAD_H_
|
||||
|
||||
|
|
@ -560,6 +565,10 @@ protected:
|
|||
Convex* mConvexList;
|
||||
Vector<MeshRoadConvex*> mDebugConvex;
|
||||
PhysicsBody *mPhysicsRep;
|
||||
private:
|
||||
static bool buildPolyList_TopSurfaceOnly;
|
||||
public:
|
||||
bool buildTopPolyList(PolyListContext, AbstractPolyList*);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue