mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 11:43:49 +00:00
Updates to various components, added a few new ones.
This commit is contained in:
parent
775ca57047
commit
34d05ff16f
52 changed files with 4566 additions and 1799 deletions
|
|
@ -38,12 +38,7 @@ public:
|
|||
Vector<matMap> mChangingMaterials;
|
||||
Vector<matMap> mMaterials;
|
||||
|
||||
//Static geometry stuff
|
||||
bool mStatic;
|
||||
|
||||
OptimizedPolyList mGeometry;
|
||||
|
||||
MeshRenderSystemInterface() : SystemInterface(), mShapeInstance(nullptr), mTransform(MatrixF::Identity), mScale(Point3F::One), mIsClient(false), mStatic(false)
|
||||
MeshRenderSystemInterface() : SystemInterface(), mShapeInstance(nullptr), mTransform(MatrixF::Identity), mScale(Point3F::One), mIsClient(false)
|
||||
{
|
||||
mBounds = Box3F(1);
|
||||
mSphere = SphereF();
|
||||
|
|
@ -58,150 +53,10 @@ public:
|
|||
|
||||
class MeshRenderSystem
|
||||
{
|
||||
protected:
|
||||
/*struct StaticBatchElement
|
||||
{
|
||||
SimObject* owner;
|
||||
OptimizedPolyList geometry;
|
||||
String batchName;
|
||||
};
|
||||
|
||||
static Vector<StaticBatchElement> mStaticElements;*/
|
||||
|
||||
//We retain the pushed geometry data for rendering here. It's static(unless forced to change through editing or whatnot)
|
||||
//so rendering the batches is real fast
|
||||
struct BufferMaterials
|
||||
{
|
||||
// The name of the Material we will use for rendering
|
||||
String mMaterialName;
|
||||
// The actual Material instance
|
||||
BaseMatInstance* mMaterialInst;
|
||||
|
||||
BufferMaterials()
|
||||
{
|
||||
mMaterialName = "";
|
||||
mMaterialInst = NULL;
|
||||
}
|
||||
};
|
||||
|
||||
static Vector<BufferMaterials> mBufferMaterials;
|
||||
|
||||
struct BufferSet
|
||||
{
|
||||
U32 surfaceMaterialId;
|
||||
|
||||
U32 vertCount;
|
||||
U32 primCount;
|
||||
|
||||
Point3F center;
|
||||
|
||||
struct Buffers
|
||||
{
|
||||
U32 vertStart;
|
||||
U32 primStart;
|
||||
U32 vertCount;
|
||||
U32 primCount;
|
||||
|
||||
Vector<GFXVertexPNTT> vertData;
|
||||
Vector<U32> primData;
|
||||
|
||||
GFXVertexBufferHandle< GFXVertexPNTT > vertexBuffer;
|
||||
GFXPrimitiveBufferHandle primitiveBuffer;
|
||||
|
||||
Buffers()
|
||||
{
|
||||
vertStart = 0;
|
||||
primStart = 0;
|
||||
vertCount = 0;
|
||||
primCount = 0;
|
||||
|
||||
vertexBuffer = NULL;
|
||||
primitiveBuffer = NULL;
|
||||
}
|
||||
};
|
||||
|
||||
Vector<Buffers> buffers;
|
||||
|
||||
BufferSet()
|
||||
{
|
||||
Buffers newBuffer;
|
||||
buffers.push_back(newBuffer);
|
||||
|
||||
surfaceMaterialId = 0;
|
||||
|
||||
vertCount = 0;
|
||||
primCount = 0;
|
||||
|
||||
center = Point3F::Zero;
|
||||
}
|
||||
};
|
||||
|
||||
static Vector<BufferSet> mStaticBuffers;
|
||||
|
||||
public:
|
||||
/*virtual void prepRenderImage(SceneRenderState *state);
|
||||
|
||||
bool setMeshAsset(const char* assetName);
|
||||
|
||||
virtual TSShape* getShape() { if (mMeshAsset) return mMeshAsset->getShape(); else return NULL; }
|
||||
virtual TSShapeInstance* getShapeInstance() { return mShapeInstance; }
|
||||
|
||||
Resource<TSShape> getShapeResource() { return mMeshAsset->getShapeResource(); }
|
||||
|
||||
void _onResourceChanged(const Torque::Path &path);
|
||||
|
||||
virtual bool castRayRendered(const Point3F &start, const Point3F &end, RayInfo *info);
|
||||
|
||||
void mountObjectToNode(SceneObject* objB, String node, MatrixF txfm);
|
||||
|
||||
virtual void onDynamicModified(const char* slotName, const char* newValue);
|
||||
|
||||
void changeMaterial(U32 slot, MaterialAsset* newMat);
|
||||
bool setMatInstField(U32 slot, const char* field, const char* value);
|
||||
|
||||
virtual void onInspect();
|
||||
virtual void onEndInspect();
|
||||
|
||||
virtual Vector<MatrixF> getNodeTransforms()
|
||||
{
|
||||
Vector<MatrixF> bob;
|
||||
return bob;
|
||||
}
|
||||
|
||||
virtual void setNodeTransforms(Vector<MatrixF> transforms)
|
||||
{
|
||||
return;
|
||||
}*/
|
||||
|
||||
/*MeshRenderSystem()
|
||||
{
|
||||
|
||||
}
|
||||
virtual ~MeshRenderSystem()
|
||||
{
|
||||
smInterfaceList.clear();
|
||||
}
|
||||
|
||||
static MeshComponentInterface* GetNewInterface()
|
||||
{
|
||||
smInterfaceList.increment();
|
||||
|
||||
return &smInterfaceList.last();
|
||||
}
|
||||
|
||||
static void RemoveInterface(T* q)
|
||||
{
|
||||
smInterfaceList.erase(q);
|
||||
}*/
|
||||
|
||||
//Core render function, which does all the real work
|
||||
static void render(SceneManager *sceneManager, SceneRenderState* state);
|
||||
|
||||
//Render our particular interface's data
|
||||
static void renderInterface(U32 interfaceIndex, SceneRenderState* state);
|
||||
|
||||
//Static Batch rendering
|
||||
static void rebuildBuffers();
|
||||
|
||||
static U32 findBufferSetByMaterial(U32 matId);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue