Commit 688ec5b8 authored by hybrid's avatar hybrid

Fix Meshbuffer interface of md3 files. At least for some situations these...

Fix Meshbuffer interface of md3 files. At least for some situations these should return the proper buffers now, and hence allow for stencil shadows and other things. We might need an animation update check, though, to handle multiple meshes.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3968 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 594ed817
This diff is collapsed.
...@@ -24,52 +24,40 @@ namespace scene ...@@ -24,52 +24,40 @@ namespace scene
public: public:
//! constructor //! constructor
CAnimatedMeshMD3( ); CAnimatedMeshMD3();
//! destructor //! destructor
virtual ~CAnimatedMeshMD3(); virtual ~CAnimatedMeshMD3();
//! loads a quake3 md3 file //! loads a quake3 md3 file
virtual bool loadModelFile( u32 modelIndex, io::IReadFile* file, virtual bool loadModelFile(u32 modelIndex, io::IReadFile* file,
io::IFileSystem* fs, video::IVideoDriver * driver io::IFileSystem* fs, video::IVideoDriver* driver);
);
// IAnimatedMeshMD3 // IAnimatedMeshMD3
virtual void setInterpolationShift ( u32 shift, u32 loopMode ); virtual void setInterpolationShift(u32 shift, u32 loopMode);
virtual SMD3Mesh * getOriginalMesh (); virtual SMD3Mesh* getOriginalMesh();
virtual SMD3QuaternionTagList *getTagList(s32 frame, s32 detailLevel, s32 startFrameLoop, s32 endFrameLoop); virtual SMD3QuaternionTagList* getTagList(s32 frame, s32 detailLevel, s32 startFrameLoop, s32 endFrameLoop);
//IAnimatedMesh //IAnimatedMesh
virtual u32 getFrameCount() const; virtual u32 getFrameCount() const;
virtual IMesh* getMesh(s32 frame, s32 detailLevel, s32 startFrameLoop, s32 endFrameLoop); virtual IMesh* getMesh(s32 frame, s32 detailLevel,
s32 startFrameLoop, s32 endFrameLoop);
virtual const core::aabbox3d<f32>& getBoundingBox() const; virtual const core::aabbox3d<f32>& getBoundingBox() const;
virtual E_ANIMATED_MESH_TYPE getMeshType() const; virtual E_ANIMATED_MESH_TYPE getMeshType() const;
//! returns amount of mesh buffers. //! returns amount of mesh buffers.
virtual u32 getMeshBufferCount() const virtual u32 getMeshBufferCount() const;
{
return 0;
}
//! returns pointer to a mesh buffer //! returns pointer to a mesh buffer
virtual IMeshBuffer* getMeshBuffer(u32 nr) const virtual IMeshBuffer* getMeshBuffer(u32 nr) const;
{
return 0;
}
//! Returns pointer to a mesh buffer which fits a material //! Returns pointer to a mesh buffer which fits a material
/** \param material: material to search for virtual IMeshBuffer* getMeshBuffer(const video::SMaterial &material) const;
\return Returns the pointer to the mesh buffer or
NULL if there is no such mesh buffer. */
virtual IMeshBuffer* getMeshBuffer( const video::SMaterial &material) const
{
return 0;
}
virtual void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue) virtual void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue);
{
return; //! set user axis aligned bounding box
} virtual void setBoundingBox(const core::aabbox3df& box);
//! set the hardware mapping hint, for driver //! set the hardware mapping hint, for driver
virtual void setHardwareMappingHint(E_HARDWARE_MAPPING newMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX); virtual void setHardwareMappingHint(E_HARDWARE_MAPPING newMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX);
...@@ -77,16 +65,9 @@ namespace scene ...@@ -77,16 +65,9 @@ namespace scene
//! flags the meshbuffer as changed, reloads hardware buffers //! flags the meshbuffer as changed, reloads hardware buffers
virtual void setDirty(E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX); virtual void setDirty(E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX);
//! set user axis aligned bounding box
virtual void setBoundingBox(const core::aabbox3df& box)
{
return;
}
private: private:
//! animates one frame //! animates one frame
inline void Animate (u32 frame); inline void Animate(u32 frame);
video::SMaterial Material; video::SMaterial Material;
...@@ -100,9 +81,10 @@ namespace scene ...@@ -100,9 +81,10 @@ namespace scene
//! Cache Info //! Cache Info
struct SCacheInfo struct SCacheInfo
{ {
SCacheInfo ( s32 frame = -1, s32 start = -1, s32 end = -1 ) SCacheInfo(s32 frame=-1, s32 start=-1, s32 end=-1 ) :
: Frame ( frame ), startFrameLoop ( start ), Frame(frame), startFrameLoop(start),
endFrameLoop ( end ) {} endFrameLoop(end)
{}
bool operator == ( const SCacheInfo &other ) const bool operator == ( const SCacheInfo &other ) const
{ {
...@@ -115,17 +97,17 @@ namespace scene ...@@ -115,17 +97,17 @@ namespace scene
SCacheInfo Current; SCacheInfo Current;
//! return a Mesh per frame //! return a Mesh per frame
SMesh MeshIPol; SMesh* MeshIPol;
SMD3QuaternionTagList TagListIPol; SMD3QuaternionTagList TagListIPol;
IMeshBuffer * createMeshBuffer ( const SMD3MeshBuffer *source, io::IFileSystem* fs, video::IVideoDriver * driver ); IMeshBuffer* createMeshBuffer(const SMD3MeshBuffer* source,
io::IFileSystem* fs, video::IVideoDriver* driver);
void buildVertexArray ( u32 frameA, u32 frameB, f32 interpolate, void buildVertexArray(u32 frameA, u32 frameB, f32 interpolate,
const SMD3MeshBuffer * source, const SMD3MeshBuffer* source,
SMeshBufferLightMap * dest SMeshBufferLightMap* dest);
);
void buildTagArray ( u32 frameA, u32 frameB, f32 interpolate ); void buildTagArray(u32 frameA, u32 frameB, f32 interpolate);
}; };
...@@ -133,3 +115,4 @@ namespace scene ...@@ -133,3 +115,4 @@ namespace scene
} // end namespace irr } // end namespace irr
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment