Added an updated version of the LWO loader. Many material settings are still missing.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1193 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
d80773ade6
commit
fcc37ae566
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,72 @@
|
||||||
|
#ifndef __C_LWO_MESH_FILE_LOADER_H_INCLUDED__
|
||||||
|
#define __C_LWO_MESH_FILE_LOADER_H_INCLUDED__
|
||||||
|
|
||||||
|
#include "IMeshLoader.h"
|
||||||
|
#include "IVideoDriver.h"
|
||||||
|
#include "irrString.h"
|
||||||
|
#include "SMeshBuffer.h"
|
||||||
|
|
||||||
|
namespace irr
|
||||||
|
{
|
||||||
|
namespace io
|
||||||
|
{
|
||||||
|
class IReadFile;
|
||||||
|
} // end namespace io
|
||||||
|
namespace scene
|
||||||
|
{
|
||||||
|
|
||||||
|
struct SMesh;
|
||||||
|
|
||||||
|
//! Meshloader capable of loading Lightwave 3D meshes.
|
||||||
|
class CLWOMeshFileLoader : public IMeshLoader
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Constructor
|
||||||
|
CLWOMeshFileLoader(video::IVideoDriver* driver);
|
||||||
|
|
||||||
|
//! destructor
|
||||||
|
virtual ~CLWOMeshFileLoader();
|
||||||
|
|
||||||
|
//! returns true if the file maybe is able to be loaded by this class
|
||||||
|
//! based on the file extension (e.g. ".bsp")
|
||||||
|
virtual bool isALoadableFileExtension(const c8* fileName) const;
|
||||||
|
|
||||||
|
//! creates/loads an animated mesh from the file.
|
||||||
|
//! \return Pointer to the created mesh. Returns 0 if loading failed.
|
||||||
|
//! If you no longer need the mesh, you should call IAnimatedMesh::drop().
|
||||||
|
//! See IUnknown::drop() for more information.
|
||||||
|
virtual IAnimatedMesh* createMesh(io::IReadFile* file);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
struct tLWOMaterial;
|
||||||
|
|
||||||
|
bool readFileHeader();
|
||||||
|
bool readChunks();
|
||||||
|
void readObj1(u32 size);
|
||||||
|
void readTagMapping(u32 size);
|
||||||
|
void readVertexMapping(u32 size);
|
||||||
|
void readObj2(u32 size);
|
||||||
|
void readMat(u32 size);
|
||||||
|
u32 readString(core::stringc& name);
|
||||||
|
u32 readVec(core::vector3df& vec);
|
||||||
|
u32 readVX(u32& num);
|
||||||
|
u32 readColor(video::SColor& color);
|
||||||
|
|
||||||
|
video::IVideoDriver* Driver;
|
||||||
|
io::IReadFile* File;
|
||||||
|
SMesh* Mesh;
|
||||||
|
|
||||||
|
core::array<core::vector3df> Points;
|
||||||
|
core::array<core::array<u32> > Polygons;
|
||||||
|
core::array<core::vector2df> TCoords;
|
||||||
|
core::array<tLWOMaterial*> Materials;
|
||||||
|
core::array<core::stringc> Images;
|
||||||
|
u8 FormatVersion;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // end namespace scene
|
||||||
|
} // end namespace irr
|
||||||
|
|
||||||
|
#endif
|
|
@ -82,6 +82,10 @@
|
||||||
#include "CB3DMeshFileLoader.h"
|
#include "CB3DMeshFileLoader.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _IRR_COMPILE_WITH_LWO_LOADER_
|
||||||
|
#include "CLWOMeshFileLoader.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _IRR_COMPILE_WITH_STL_LOADER_
|
#ifdef _IRR_COMPILE_WITH_STL_LOADER_
|
||||||
#include "CSTLMeshFileLoader.h"
|
#include "CSTLMeshFileLoader.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -235,6 +239,9 @@ CSceneManager::CSceneManager(video::IVideoDriver* driver, io::IFileSystem* fs,
|
||||||
#ifdef _IRR_COMPILE_WITH_B3D_LOADER_
|
#ifdef _IRR_COMPILE_WITH_B3D_LOADER_
|
||||||
MeshLoaderList.push_back(new CB3DMeshFileLoader(this));
|
MeshLoaderList.push_back(new CB3DMeshFileLoader(this));
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef _IRR_COMPILE_WITH_LWO_LOADER_
|
||||||
|
MeshLoaderList.push_back(new CLWOMeshFileLoader(Driver));
|
||||||
|
#endif
|
||||||
#ifdef _IRR_COMPILE_WITH_STL_LOADER_
|
#ifdef _IRR_COMPILE_WITH_STL_LOADER_
|
||||||
MeshLoaderList.push_back(new CSTLMeshFileLoader());
|
MeshLoaderList.push_back(new CSTLMeshFileLoader());
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -19,7 +19,7 @@ VERSION = 1.4
|
||||||
#
|
#
|
||||||
|
|
||||||
#List of object files, separated based on engine architecture
|
#List of object files, separated based on engine architecture
|
||||||
IRRMESHLOADER = CBSPMeshFileLoader.o CMD2MeshFileLoader.o CMD3MeshFileLoader.o CMS3DMeshFileLoader.o CB3DMeshFileLoader.o CBSPMeshFileLoader.o C3DSMeshFileLoader.o COgreMeshFileLoader.o COBJMeshFileLoader.o CMD3MeshFileLoader.o CColladaFileLoader.o CCSMLoader.o CDMFLoader.o CLMTSMeshFileLoader.o CMY3DMeshFileLoader.o COCTLoader.o CXMeshFileLoader.o CIrrMeshFileLoader.o CSTLMeshFileLoader.o
|
IRRMESHLOADER = CBSPMeshFileLoader.o CMD2MeshFileLoader.o CMD3MeshFileLoader.o CMS3DMeshFileLoader.o CB3DMeshFileLoader.o CBSPMeshFileLoader.o C3DSMeshFileLoader.o COgreMeshFileLoader.o COBJMeshFileLoader.o CMD3MeshFileLoader.o CColladaFileLoader.o CCSMLoader.o CDMFLoader.o CLMTSMeshFileLoader.o CMY3DMeshFileLoader.o COCTLoader.o CXMeshFileLoader.o CIrrMeshFileLoader.o CSTLMeshFileLoader.o CLWOMeshFileLoader.o
|
||||||
IRRMESHWRITER = CColladaMeshWriter.o CIrrMeshWriter.o CSTLMeshWriter.o
|
IRRMESHWRITER = CColladaMeshWriter.o CIrrMeshWriter.o CSTLMeshWriter.o
|
||||||
IRRMESHOBJ = $(IRRMESHLOADER) $(IRRMESHWRITER) \
|
IRRMESHOBJ = $(IRRMESHLOADER) $(IRRMESHWRITER) \
|
||||||
CSkinnedMesh.o CBoneSceneNode.o CMeshSceneNode.o \
|
CSkinnedMesh.o CBoneSceneNode.o CMeshSceneNode.o \
|
||||||
|
|
Loading…
Reference in New Issue