TSShape loader refactor

final setup for assimp

Added assimp importers and exporters, removed defaulting to all
Added compression to tshape
added dts version to tshape and cmake

Update assimpShapeLoader.cpp

quick fix

fix previewing dsq ground work

automatically export dsq files for animations

Groundwork

Adds the same sort of model for registering loaders and exporters as is set out on gbitmap
Added a bit more safety around the assimp matrix fix to convert incoming models to torques coordinate system.
This commit is contained in:
marauder2k7 2026-05-01 16:43:58 +01:00
parent fdecae153d
commit 2895e98cbb
16 changed files with 466 additions and 414 deletions

View file

@ -83,18 +83,47 @@ struct TSShapeVertexArray
/// @see TSShapeInstance for a further discussion of the 3space system.
class TSShape
{
public:
enum
public:
enum
{
UniformScale = BIT(0),
AlignedScale = BIT(1),
ArbitraryScale = BIT(2),
Blend = BIT(3),
Cyclic = BIT(4),
MakePath = BIT(5),
HasTranslucency= BIT(6),
AnyScale = UniformScale | AlignedScale | ArbitraryScale
};
struct ShapeFormat
{
String mName;
String mExtension;
};
struct ShapeRegistration
{
typedef bool(*ReadShape)(const Torque::Path& path, TSShape*& shape);
typedef bool(*WriteShape)(const Torque::Path& path, TSShape* shape);
Vector<ShapeFormat> extensions; ///< the list of file extensions for this Loader [these should be lower case]
Vector<ShapeFormat> export_extensions; ///< the list of file extensions for this Loader [these should be lower case]
ReadShape readFunc; ///< the read function to read from a file.
WriteShape writeFunc; ///< the write function to write to a file.
ShapeRegistration()
{
UniformScale = BIT(0),
AlignedScale = BIT(1),
ArbitraryScale = BIT(2),
Blend = BIT(3),
Cyclic = BIT(4),
MakePath = BIT(5),
HasTranslucency= BIT(6),
AnyScale = UniformScale | AlignedScale | ArbitraryScale
};
readFunc = NULL;
writeFunc = NULL;
VECTOR_SET_ASSOCIATION(extensions);
VECTOR_SET_ASSOCIATION(export_extensions);
}
};
static void sRegisterFormat(const ShapeRegistration& reg);
static const ShapeRegistration* sFindRegInfo(const String& extension, bool exporting = false);
static Vector<ShapeRegistration> sRegistrations;
/// Nodes hold the transforms in the shape's tree. They are the bones of the skeleton.
struct Node
@ -422,6 +451,8 @@ class TSShape
// constructor/destructor
TSShape();
~TSShape();
void compressionKey(U8* keyOut, U32 keyLen);
void xorBufferAtOffset(void* data, U32 byteCount, U32 startOffset, const U8* key, U32 keyLen);
void init();
void initMaterialList(); ///< you can swap in a new material list, but call this if you do
void finalizeEditable();