Commit 4533956f authored by cutealien's avatar cutealien

ColladaMeshWriter: Add light export. Meshname handling cleaned up.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3868 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 98b7d10e
...@@ -18,6 +18,7 @@ namespace scene ...@@ -18,6 +18,7 @@ namespace scene
name clashes with external scene nodes.*/ name clashes with external scene nodes.*/
enum ESCENE_NODE_TYPE enum ESCENE_NODE_TYPE
{ {
//! of type CSceneManager (note that ISceneManager is not(!) an ISceneNode)
ESNT_SCENE_MANAGER = MAKE_IRR_ID('s','m','n','g'), ESNT_SCENE_MANAGER = MAKE_IRR_ID('s','m','n','g'),
//! simple cube scene node //! simple cube scene node
......
...@@ -137,7 +137,7 @@ namespace scene ...@@ -137,7 +137,7 @@ namespace scene
{ {
public: public:
IColladaMeshWriter() : Properties(0), DefaultProperties(0), WriteTextures(true), WriteDefaultScene(false) IColladaMeshWriter() : Properties(0), DefaultProperties(0), WriteTextures(true), WriteDefaultScene(false), AmbientLight(0.f, 0.f, 0.f, 1.f)
{ {
} }
...@@ -182,6 +182,18 @@ namespace scene ...@@ -182,6 +182,18 @@ namespace scene
return WriteDefaultScene; return WriteDefaultScene;
} }
//! Sets ambient color of the scene to write
virtual void setAmbientLight(const video::SColorf &ambientColor)
{
AmbientLight = ambientColor;
}
//! Return ambient light of the scene which is written
virtual video::SColorf getAmbientLight() const
{
return AmbientLight;
}
//! Set properties to use by the meshwriter instead of it's default properties. //! Set properties to use by the meshwriter instead of it's default properties.
/** Overloading properties with an own class allows modifying the writing process in certain ways. /** Overloading properties with an own class allows modifying the writing process in certain ways.
By default properties are set to the DefaultProperties. */ By default properties are set to the DefaultProperties. */
...@@ -227,6 +239,7 @@ namespace scene ...@@ -227,6 +239,7 @@ namespace scene
IColladaMeshWriterProperties * DefaultProperties; IColladaMeshWriterProperties * DefaultProperties;
bool WriteTextures; bool WriteTextures;
bool WriteDefaultScene; bool WriteDefaultScene;
video::SColorf AmbientLight;
}; };
......
This diff is collapsed.
...@@ -64,7 +64,7 @@ class CColladaMeshWriter : public IColladaMeshWriter ...@@ -64,7 +64,7 @@ class CColladaMeshWriter : public IColladaMeshWriter
{ {
public: public:
CColladaMeshWriter(video::IVideoDriver* driver, io::IFileSystem* fs); CColladaMeshWriter(ISceneManager * smgr, video::IVideoDriver* driver, io::IFileSystem* fs);
virtual ~CColladaMeshWriter(); virtual ~CColladaMeshWriter();
//! Returns the type of the mesh writer //! Returns the type of the mesh writer
...@@ -82,12 +82,13 @@ protected: ...@@ -82,12 +82,13 @@ protected:
bool hasSecondTextureCoordinates(video::E_VERTEX_TYPE type) const; bool hasSecondTextureCoordinates(video::E_VERTEX_TYPE type) const;
inline irr::core::stringw toString(const irr::core::vector3df& vec) const; inline irr::core::stringw toString(const irr::core::vector3df& vec) const;
inline irr::core::stringw toString(const irr::core::vector2df& vec) const; inline irr::core::stringw toString(const irr::core::vector2df& vec) const;
inline irr::core::stringw toString(const irr::video::SColorf& colorf) const; inline irr::core::stringw toString(const irr::video::SColorf& colorf, bool writeAlpha=true) const;
inline irr::core::stringw toString(const irr::video::ECOLOR_FORMAT format) const; inline irr::core::stringw toString(const irr::video::ECOLOR_FORMAT format) const;
inline irr::core::stringw toString(const irr::video::E_TEXTURE_CLAMP clamp) const; inline irr::core::stringw toString(const irr::video::E_TEXTURE_CLAMP clamp) const;
inline irr::core::stringw toString(const irr::scene::E_COLLADA_TRANSPARENT_FX opaque) const; inline irr::core::stringw toString(const irr::scene::E_COLLADA_TRANSPARENT_FX opaque) const;
inline irr::core::stringw toRef(const irr::core::stringw& source) const; inline irr::core::stringw toRef(const irr::core::stringw& source) const;
irr::core::stringw uniqueNameForMesh(const scene::IMesh* mesh) const; irr::core::stringw uniqueNameForMesh(const scene::IMesh* mesh) const;
irr::core::stringw uniqueNameForLight(const scene::ISceneNode* lightNode) const;
irr::core::stringw uniqueNameForNode(const scene::ISceneNode* node) const; irr::core::stringw uniqueNameForNode(const scene::ISceneNode* node) const;
irr::core::stringw minTexfilterToString(bool bilinear, bool trilinear) const; irr::core::stringw minTexfilterToString(bool bilinear, bool trilinear) const;
irr::core::stringw magTexfilterToString(bool bilinear, bool trilinear) const; irr::core::stringw magTexfilterToString(bool bilinear, bool trilinear) const;
...@@ -101,6 +102,7 @@ protected: ...@@ -101,6 +102,7 @@ protected:
void makeMeshNames(irr::scene::ISceneNode * node); void makeMeshNames(irr::scene::ISceneNode * node);
void writeNodeMaterials(irr::scene::ISceneNode * node); void writeNodeMaterials(irr::scene::ISceneNode * node);
void writeNodeEffects(irr::scene::ISceneNode * node); void writeNodeEffects(irr::scene::ISceneNode * node);
void writeNodeLights(irr::scene::ISceneNode * node);
void writeNodeGeometries(irr::scene::ISceneNode * node); void writeNodeGeometries(irr::scene::ISceneNode * node);
void writeSceneNode(irr::scene::ISceneNode * node); void writeSceneNode(irr::scene::ISceneNode * node);
void writeMeshMaterials(const irr::core::stringw& meshname, scene::IMesh* mesh); void writeMeshMaterials(const irr::core::stringw& meshname, scene::IMesh* mesh);
...@@ -108,9 +110,12 @@ protected: ...@@ -108,9 +110,12 @@ protected:
void writeMaterialEffect(const irr::core::stringw& meshname, const irr::core::stringw& materialname, const video::SMaterial & material); void writeMaterialEffect(const irr::core::stringw& meshname, const irr::core::stringw& materialname, const video::SMaterial & material);
void writeMeshGeometry(const irr::core::stringw& meshname, scene::IMesh* mesh); void writeMeshGeometry(const irr::core::stringw& meshname, scene::IMesh* mesh);
void writeMeshInstanceGeometry(const irr::core::stringw& meshname, scene::IMesh* mesh); void writeMeshInstanceGeometry(const irr::core::stringw& meshname, scene::IMesh* mesh);
void writeLightInstance(const irr::core::stringw& lightName);
void writeLibraryImages(); void writeLibraryImages();
void writeColorFx(const irr::core::stringw& meshname, const video::SMaterial & material, const wchar_t * colorname, E_COLLADA_COLOR_SAMPLER cs, const wchar_t* attr1Name=0, const wchar_t* attr1Value=0); void writeColorFx(const irr::core::stringw& meshname, const video::SMaterial & material, const wchar_t * colorname, E_COLLADA_COLOR_SAMPLER cs, const wchar_t* attr1Name=0, const wchar_t* attr1Value=0);
void writeColorElement(const video::SColor & col); void writeAmbientLightElement(const video::SColorf & col);
void writeColorElement(const video::SColor & col, bool writeAlpha=true);
void writeColorElement(const video::SColorf & col, bool writeAlpha=true);
void writeTextureSampler(const irr::core::stringw& meshname, s32 textureIdx); void writeTextureSampler(const irr::core::stringw& meshname, s32 textureIdx);
void writeFxElement(const irr::core::stringw& meshname, const video::SMaterial & material, E_COLLADA_TECHNIQUE_FX techFx); void writeFxElement(const irr::core::stringw& meshname, const video::SMaterial & material, E_COLLADA_TECHNIQUE_FX techFx);
void writeFloatElement(irr::f32 value); void writeFloatElement(irr::f32 value);
...@@ -158,6 +163,14 @@ protected: ...@@ -158,6 +163,14 @@ protected:
}; };
typedef core::map<IMesh*, ColladaMesh>::Node MeshNode; typedef core::map<IMesh*, ColladaMesh>::Node MeshNode;
core::map<IMesh*, ColladaMesh> Meshes; core::map<IMesh*, ColladaMesh> Meshes;
struct ColladaLight
{
ColladaLight() {}
irr::core::stringw Name;
};
typedef core::map<ISceneNode*, ColladaLight>::Node LightNode;
core::map<ISceneNode*, ColladaLight> LightNodes;
}; };
......
...@@ -2475,7 +2475,7 @@ IMeshWriter* CSceneManager::createMeshWriter(EMESH_WRITER_TYPE type) ...@@ -2475,7 +2475,7 @@ IMeshWriter* CSceneManager::createMeshWriter(EMESH_WRITER_TYPE type)
#endif #endif
case EMWT_COLLADA: case EMWT_COLLADA:
#ifdef _IRR_COMPILE_WITH_COLLADA_WRITER_ #ifdef _IRR_COMPILE_WITH_COLLADA_WRITER_
return new CColladaMeshWriter(Driver, FileSystem); return new CColladaMeshWriter(this, Driver, FileSystem);
#else #else
return 0; return 0;
#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