mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-06 14:00:39 +00:00
Removed hard coded directory paths
- Removed references to core directory. - Switch some references to tools directory - Added preferences variables where appropriate
This commit is contained in:
parent
853b70255b
commit
4b1334db9f
25 changed files with 75 additions and 18 deletions
|
|
@ -402,7 +402,7 @@ F32 MeshFit::maxDot( const VectorF& v ) const
|
|||
// Best-fit oriented bounding box
|
||||
void MeshFit::addBox( const Point3F& sides, const MatrixF& mat )
|
||||
{
|
||||
TSMesh* mesh = initMeshFromFile( "core/art/shapes/unit_cube.dts" );
|
||||
TSMesh* mesh = initMeshFromFile( TSShapeConstructor::getCubeShapePath() );
|
||||
if ( !mesh )
|
||||
return;
|
||||
|
||||
|
|
@ -431,7 +431,7 @@ void MeshFit::fitOBB()
|
|||
// Best-fit sphere
|
||||
void MeshFit::addSphere( F32 radius, const Point3F& center )
|
||||
{
|
||||
TSMesh* mesh = initMeshFromFile( "core/art/shapes/unit_sphere.dts" );
|
||||
TSMesh* mesh = initMeshFromFile( TSShapeConstructor::getSphereShapePath() );
|
||||
if ( !mesh )
|
||||
return;
|
||||
|
||||
|
|
@ -460,7 +460,7 @@ void MeshFit::fitSphere()
|
|||
// Best-fit capsule
|
||||
void MeshFit::addCapsule( F32 radius, F32 height, const MatrixF& mat )
|
||||
{
|
||||
TSMesh* mesh = initMeshFromFile( "core/art/shapes/unit_capsule.dts" );
|
||||
TSMesh* mesh = initMeshFromFile( TSShapeConstructor::getCapsuleShapePath() );
|
||||
if ( !mesh )
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -74,6 +74,10 @@ EndImplementEnumType;
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
String TSShapeConstructor::smCapsuleShapePath("core/art/shapes/unit_capsule.dts");
|
||||
String TSShapeConstructor::smCubeShapePath("core/art/shapes/unit_cube.dts");
|
||||
String TSShapeConstructor::smSphereShapePath("core/art/shapes/unit_sphere.dts");
|
||||
|
||||
ResourceRegisterPostLoadSignal< TSShape > TSShapeConstructor::_smAutoLoad( &TSShapeConstructor::_onTSShapeLoaded );
|
||||
ResourceRegisterUnloadSignal< TSShape > TSShapeConstructor::_smAutoUnload( &TSShapeConstructor::_onTSShapeUnloaded );
|
||||
|
||||
|
|
@ -280,6 +284,23 @@ void TSShapeConstructor::initPersistFields()
|
|||
Parent::initPersistFields();
|
||||
}
|
||||
|
||||
void TSShapeConstructor::consoleInit()
|
||||
{
|
||||
Parent::consoleInit();
|
||||
|
||||
Con::addVariable( "$pref::TSShapeConstructor::CapsuleShapePath", TypeString, &TSShapeConstructor::smCapsuleShapePath,
|
||||
"The file path to the capsule shape used by tsMeshFit.\n\n"
|
||||
"@ingroup MeshFit\n" );
|
||||
|
||||
Con::addVariable( "$pref::TSShapeConstructor::CubeShapePath", TypeString, &TSShapeConstructor::smCubeShapePath,
|
||||
"The file path to the cube shape used by tsMeshFit.\n\n"
|
||||
"@ingroup MeshFit\n" );
|
||||
|
||||
Con::addVariable( "$pref::TSShapeConstructor::SphereShapePath", TypeString, &TSShapeConstructor::smSphereShapePath,
|
||||
"The file path to the sphere shape used by tsMeshFit.\n\n"
|
||||
"@ingroup MeshFit\n" );
|
||||
}
|
||||
|
||||
TSShapeConstructor* TSShapeConstructor::findShapeConstructor(const FileName& path)
|
||||
{
|
||||
SimGroup *group;
|
||||
|
|
|
|||
|
|
@ -220,6 +220,11 @@ protected:
|
|||
Vector<FileName> mSequences;
|
||||
ChangeSet mChangeSet;
|
||||
|
||||
// Paths to shapes used by MeshFit
|
||||
static String smCapsuleShapePath;
|
||||
static String smCubeShapePath;
|
||||
static String smSphereShapePath;
|
||||
|
||||
static bool addSequenceFromField( void *obj, const char *index, const char *data );
|
||||
|
||||
static void _onTSShapeLoaded( Resource< TSShape >& shape );
|
||||
|
|
@ -250,6 +255,7 @@ public:
|
|||
|
||||
DECLARE_CONOBJECT(TSShapeConstructor);
|
||||
static void initPersistFields();
|
||||
static void consoleInit();
|
||||
static TSShapeConstructor* findShapeConstructor(const FileName& path);
|
||||
|
||||
bool onAdd();
|
||||
|
|
@ -261,6 +267,13 @@ public:
|
|||
|
||||
void notifyShapeChanged();
|
||||
|
||||
/// @name Shape paths for MeshFit
|
||||
///@{
|
||||
static const String& getCapsuleShapePath() { return smCapsuleShapePath; }
|
||||
static const String& getCubeShapePath() { return smCubeShapePath; }
|
||||
static const String& getSphereShapePath() { return smSphereShapePath; }
|
||||
///@}
|
||||
|
||||
TSShape* getShape() const { return mShape; }
|
||||
const String& getShapePath() const { return mShapePath; }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue