Loading...
Searching...
No Matches
IColladaMeshWriter.h
Go to the documentation of this file.
// Copyright (C) 2002-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __IRR_I_COLLADA_MESH_WRITER_H_INCLUDED__
#define __IRR_I_COLLADA_MESH_WRITER_H_INCLUDED__
#include "IMeshWriter.h"
#include "ISceneNode.h"
#include "IAnimatedMesh.h"
#include "SMaterial.h"
namespace irr
{
namespace io
{
class IWriteFile;
} // end namespace io
namespace scene
{
enum E_COLLADA_TECHNIQUE_FX
{
ECTF_BLINN,
ECTF_PHONG,
ECTF_LAMBERT,
// constantly shaded surface that is independent of lighting.
ECTF_CONSTANT
};
enum E_COLLADA_TRANSPARENT_FX
{
ECOF_A_ONE = 0,
ECOF_RGB_ZERO = 1
};
enum E_COLLADA_COLOR_SAMPLER
{
ECCS_DIFFUSE,
ECCS_AMBIENT,
ECCS_EMISSIVE,
ECCS_SPECULAR,
ECCS_TRANSPARENT,
ECCS_REFLECTIVE
};
enum E_COLLADA_IRR_COLOR
{
ECIC_NONE,
ECIC_CUSTOM,
ECIC_DIFFUSE,
ECIC_AMBIENT,
ECIC_EMISSIVE,
ECIC_SPECULAR
};
enum E_COLLADA_GEOMETRY_WRITING
{
ECGI_PER_MESH,
ECGI_PER_MESH_AND_MATERIAL
};
class IColladaMeshWriterProperties : public virtual IReferenceCounted
{
public:
virtual ~IColladaMeshWriterProperties () {}
virtual E_COLLADA_TECHNIQUE_FX getTechniqueFx(const video::SMaterial& material) const = 0;
virtual s32 getTextureIdx(const video::SMaterial & material, E_COLLADA_COLOR_SAMPLER cs) const = 0;
virtual E_COLLADA_IRR_COLOR getColorMapping(const video::SMaterial & material, E_COLLADA_COLOR_SAMPLER cs) const = 0;
virtual video::SColor getCustomColor(const video::SMaterial & material, E_COLLADA_COLOR_SAMPLER cs) const = 0;
virtual E_COLLADA_TRANSPARENT_FX getTransparentFx(const video::SMaterial& material) const = 0;
virtual f32 getTransparency(const video::SMaterial& material) const = 0;
virtual f32 getReflectivity(const video::SMaterial& material) const = 0;
virtual f32 getIndexOfRefraction(const video::SMaterial& material) const = 0;
virtual bool isExportable(const irr::scene::ISceneNode * node) const = 0;
// Note: Function is not const because there is no const getMesh() function.
virtual IMesh* getMesh(irr::scene::ISceneNode * node) = 0;
virtual bool useNodeMaterial(const scene::ISceneNode* node) const = 0;
};
class IColladaMeshWriterNames : public virtual IReferenceCounted
{
public:
virtual ~IColladaMeshWriterNames () {}
virtual irr::core::stringw nameForMesh(const scene::IMesh* mesh, int instance) = 0;
virtual irr::core::stringw nameForNode(const scene::ISceneNode* node) = 0;
virtual irr::core::stringw nameForMaterial(const video::SMaterial & material, int materialId, const scene::IMesh* mesh, const scene::ISceneNode* node) = 0;
};
class IColladaMeshWriter : public IMeshWriter
{
public:
IColladaMeshWriter()
: Properties(0), DefaultProperties(0), NameGenerator(0), DefaultNameGenerator(0)
, WriteTextures(true), WriteDefaultScene(true), ExportSMaterialOnce(true)
, AmbientLight(0.f, 0.f, 0.f, 1.f)
, GeometryWriting(ECGI_PER_MESH)
{
}
virtual ~IColladaMeshWriter()
{
if ( Properties )
Properties->drop();
if ( DefaultProperties )
DefaultProperties->drop();
if ( NameGenerator )
NameGenerator->drop();
if ( DefaultNameGenerator )
DefaultNameGenerator->drop();
}
virtual bool writeScene(io::IWriteFile* file, scene::ISceneNode* root) = 0;
virtual void setWriteTextures(bool write)
{
WriteTextures = write;
}
virtual bool getWriteTextures() const
{
return WriteTextures;
}
virtual void setWriteDefaultScene(bool write)
{
WriteDefaultScene = write;
}
virtual bool getWriteDefaultScene() const
{
return WriteDefaultScene;
}
virtual void setAmbientLight(const video::SColorf &ambientColor)
{
AmbientLight = ambientColor;
}
virtual video::SColorf getAmbientLight() const
{
return AmbientLight;
}
virtual void setGeometryWriting(E_COLLADA_GEOMETRY_WRITING writeStyle)
{
GeometryWriting = writeStyle;
}
virtual E_COLLADA_GEOMETRY_WRITING getGeometryWriting() const
{
return GeometryWriting;
}
virtual void setExportSMaterialsOnlyOnce(bool exportOnce)
{
ExportSMaterialOnce = exportOnce;
}
virtual bool getExportSMaterialsOnlyOnce() const
{
return ExportSMaterialOnce;
}
virtual void setProperties(IColladaMeshWriterProperties * p)
{
if ( p == Properties )
return;
if ( p )
p->grab();
if ( Properties )
Properties->drop();
Properties = p;
}
virtual IColladaMeshWriterProperties * getProperties() const
{
return Properties;
}
IColladaMeshWriterProperties * getDefaultProperties() const
{
return DefaultProperties;
}
virtual void setNameGenerator(IColladaMeshWriterNames * nameGenerator)
{
if ( nameGenerator == NameGenerator )
return;
if ( nameGenerator )
nameGenerator->grab();
if ( NameGenerator )
NameGenerator->drop();
NameGenerator = nameGenerator;
}
virtual IColladaMeshWriterNames * getNameGenerator() const
{
return NameGenerator;
}
IColladaMeshWriterNames * getDefaultNameGenerator() const
{
return DefaultNameGenerator;
}
virtual irr::core::stringw toNCName(const irr::core::stringw& oldString, const irr::core::stringw& prefix=irr::core::stringw(L"_NC_")) const = 0;
protected:
// NOTE: You usually should also call setProperties with the same paraemter when using setDefaultProperties
virtual void setDefaultProperties(IColladaMeshWriterProperties * p)
{
if ( p == DefaultProperties )
return;
if ( p )
p->grab();
if ( DefaultProperties )
DefaultProperties->drop();
DefaultProperties = p;
}
// NOTE: You usually should also call setNameGenerator with the same paraemter when using setDefaultProperties
virtual void setDefaultNameGenerator(IColladaMeshWriterNames * p)
{
if ( p == DefaultNameGenerator )
return;
if ( p )
p->grab();
if ( DefaultNameGenerator )
DefaultNameGenerator->drop();
DefaultNameGenerator = p;
}
private:
IColladaMeshWriterProperties * Properties;
IColladaMeshWriterProperties * DefaultProperties;
IColladaMeshWriterNames * NameGenerator;
IColladaMeshWriterNames * DefaultNameGenerator;
bool WriteTextures;
bool WriteDefaultScene;
bool ExportSMaterialOnce;
video::SColorf AmbientLight;
E_COLLADA_GEOMETRY_WRITING GeometryWriting;
};
} // end namespace
} // end namespace
#endif
IAnimatedMesh.h
IMeshWriter.h
ISceneNode.h
SMaterial.h
irr::IReferenceCounted::grab
void grab() const
Grabs the object. Increments the reference counter by one.
Definition IReferenceCounted.h:86
irr::IReferenceCounted::IReferenceCounted
IReferenceCounted()
Constructor.
Definition IReferenceCounted.h:46
irr::io::IWriteFile
Interface providing write access to a file.
Definition IWriteFile.h:18
irr::scene::IColladaMeshWriter::getDefaultProperties
IColladaMeshWriterProperties * getDefaultProperties() const
Return the original default properties of the writer.
Definition IColladaMeshWriter.h:329
irr::scene::IColladaMeshWriter::getNameGenerator
virtual IColladaMeshWriterNames * getNameGenerator() const
Get currently used name generator.
Definition IColladaMeshWriter.h:347
irr::scene::IColladaMeshWriter::IColladaMeshWriter
IColladaMeshWriter()
Definition IColladaMeshWriter.h:205
irr::scene::IColladaMeshWriter::setGeometryWriting
virtual void setGeometryWriting(E_COLLADA_GEOMETRY_WRITING writeStyle)
Control when and how often a mesh is written.
Definition IColladaMeshWriter.h:278
irr::scene::IColladaMeshWriter::setWriteTextures
virtual void setWriteTextures(bool write)
Set if texture information should be written.
Definition IColladaMeshWriter.h:231
irr::scene::IColladaMeshWriter::getWriteDefaultScene
virtual bool getWriteDefaultScene() const
Get if a default scene should be written.
Definition IColladaMeshWriter.h:253
irr::scene::IColladaMeshWriter::setAmbientLight
virtual void setAmbientLight(const video::SColorf &ambientColor)
Sets ambient color of the scene to write.
Definition IColladaMeshWriter.h:259
irr::scene::IColladaMeshWriter::getWriteTextures
virtual bool getWriteTextures() const
Get if texture information should be written.
Definition IColladaMeshWriter.h:237
irr::scene::IColladaMeshWriter::getDefaultNameGenerator
IColladaMeshWriterNames * getDefaultNameGenerator() const
Return the original default name generator of the writer.
Definition IColladaMeshWriter.h:354
irr::scene::IColladaMeshWriter::getProperties
virtual IColladaMeshWriterProperties * getProperties() const
Get properties which are currently used.
Definition IColladaMeshWriter.h:322
irr::scene::IColladaMeshWriter::setNameGenerator
virtual void setNameGenerator(IColladaMeshWriterNames *nameGenerator)
Install a generator to create custom names on export.
Definition IColladaMeshWriter.h:335
irr::scene::IColladaMeshWriter::~IColladaMeshWriter
virtual ~IColladaMeshWriter()
Destructor.
Definition IColladaMeshWriter.h:214
irr::scene::IColladaMeshWriter::setDefaultProperties
virtual void setDefaultProperties(IColladaMeshWriterProperties *p)
Definition IColladaMeshWriter.h:366
irr::scene::IColladaMeshWriter::getGeometryWriting
virtual E_COLLADA_GEOMETRY_WRITING getGeometryWriting() const
Get the current style of geometry writing.
Definition IColladaMeshWriter.h:284
irr::scene::IColladaMeshWriter::toNCName
virtual irr::core::stringw toNCName(const irr::core::stringw &oldString, const irr::core::stringw &prefix=irr::core::stringw(L"_NC_")) const =0
Restrict the characters of oldString a set of allowed characters in xs::NCName and add the prefix.
irr::scene::IColladaMeshWriter::setWriteDefaultScene
virtual void setWriteDefaultScene(bool write)
Set if a default scene should be written when writing meshes.
Definition IColladaMeshWriter.h:247
irr::scene::IColladaMeshWriter::setProperties
virtual void setProperties(IColladaMeshWriterProperties *p)
Set properties to use by the meshwriter instead of it's default properties.
Definition IColladaMeshWriter.h:310
irr::scene::IColladaMeshWriter::writeScene
virtual bool writeScene(io::IWriteFile *file, scene::ISceneNode *root)=0
writes a scene starting with the given node
irr::scene::IColladaMeshWriter::getExportSMaterialsOnlyOnce
virtual bool getExportSMaterialsOnlyOnce() const
Definition IColladaMeshWriter.h:302
irr::scene::IColladaMeshWriter::getAmbientLight
virtual video::SColorf getAmbientLight() const
Return ambient light of the scene which is written.
Definition IColladaMeshWriter.h:265
irr::scene::IColladaMeshWriter::setDefaultNameGenerator
virtual void setDefaultNameGenerator(IColladaMeshWriterNames *p)
Definition IColladaMeshWriter.h:378
irr::scene::IColladaMeshWriter::setExportSMaterialsOnlyOnce
virtual void setExportSMaterialsOnlyOnce(bool exportOnce)
Make certain there is only one collada material generated per Irrlicht material.
Definition IColladaMeshWriter.h:297
irr::scene::IColladaMeshWriterNames
Callback interface to use custom names on collada writing.
Definition IColladaMeshWriter.h:159
irr::scene::IColladaMeshWriterNames::nameForMesh
virtual irr::core::stringw nameForMesh(const scene::IMesh *mesh, int instance)=0
Return a unique name for the given mesh.
irr::scene::IColladaMeshWriterNames::~IColladaMeshWriterNames
virtual ~IColladaMeshWriterNames()
Definition IColladaMeshWriter.h:162
irr::scene::IColladaMeshWriterNames::nameForNode
virtual irr::core::stringw nameForNode(const scene::ISceneNode *node)=0
Return a unique name for the given node.
irr::scene::IColladaMeshWriterNames::nameForMaterial
virtual irr::core::stringw nameForMaterial(const video::SMaterial &material, int materialId, const scene::IMesh *mesh, const scene::ISceneNode *node)=0
Return a name for the material.
irr::scene::IColladaMeshWriterProperties
Callback interface for properties which can be used to influence collada writing.
Definition IColladaMeshWriter.h:93
irr::scene::IColladaMeshWriterProperties::getTransparentFx
virtual E_COLLADA_TRANSPARENT_FX getTransparentFx(const video::SMaterial &material) const =0
Return the transparence color interpretation.
irr::scene::IColladaMeshWriterProperties::getTextureIdx
virtual s32 getTextureIdx(const video::SMaterial &material, E_COLLADA_COLOR_SAMPLER cs) const =0
Which texture index should be used when writing the texture of the given sampler color.
irr::scene::IColladaMeshWriterProperties::getMesh
virtual IMesh * getMesh(irr::scene::ISceneNode *node)=0
irr::scene::IColladaMeshWriterProperties::getCustomColor
virtual video::SColor getCustomColor(const video::SMaterial &material, E_COLLADA_COLOR_SAMPLER cs) const =0
Return custom colors for certain color types requested by collada.
irr::scene::IColladaMeshWriterProperties::~IColladaMeshWriterProperties
virtual ~IColladaMeshWriterProperties()
Definition IColladaMeshWriter.h:95
irr::scene::IColladaMeshWriterProperties::useNodeMaterial
virtual bool useNodeMaterial(const scene::ISceneNode *node) const =0
Return if the node has it's own material overwriting the mesh-materials.
irr::scene::IColladaMeshWriterProperties::getColorMapping
virtual E_COLLADA_IRR_COLOR getColorMapping(const video::SMaterial &material, E_COLLADA_COLOR_SAMPLER cs) const =0
Return which color from Irrlicht should be used for the color requested by collada.
irr::scene::IColladaMeshWriterProperties::getIndexOfRefraction
virtual f32 getIndexOfRefraction(const video::SMaterial &material) const =0
Return index of refraction for that material.
irr::scene::IColladaMeshWriterProperties::getTechniqueFx
virtual E_COLLADA_TECHNIQUE_FX getTechniqueFx(const video::SMaterial &material) const =0
Which lighting model should be used in the technique (FX) section when exporting effects (materials).
irr::scene::IColladaMeshWriterProperties::getTransparency
virtual f32 getTransparency(const video::SMaterial &material) const =0
Transparency value for that material.
irr::scene::IColladaMeshWriterProperties::getReflectivity
virtual f32 getReflectivity(const video::SMaterial &material) const =0
Reflectivity value for that material.
irr::scene::IColladaMeshWriterProperties::isExportable
virtual bool isExportable(const irr::scene::ISceneNode *node) const =0
irr::scene::IMesh
Class which holds the geometry of an object.
Definition IMesh.h:24
irr::scene::IMeshWriter
Interface for writing meshes.
Definition IMeshWriter.h:24
irr::scene::ISceneNode
Scene node interface.
Definition ISceneNode.h:41
irr::video::SColor
Class representing a 32 bit ARGB color.
Definition SColor.h:202
irr::video::SColorf
Class representing a color with four floats.
Definition SColor.h:459
irr::video::SMaterial
Struct for holding parameters for a material renderer.
Definition SMaterial.h:227
irr::core::stringw
string< wchar_t > stringw
Typedef for wide character strings.
Definition irrString.h:1361
irr::io
This namespace provides interfaces for input/output: Reading and writing files, accessing zip archive...
Definition EAttributes.h:11
irr::scene
All scene management can be found in this namespace: Mesh loading, special scene nodes like octrees a...
Definition CDynamicMeshBuffer.h:16
irr::scene::E_COLLADA_GEOMETRY_WRITING
E_COLLADA_GEOMETRY_WRITING
Control when geometry elements are created.
Definition IColladaMeshWriter.h:81
irr::scene::ECGI_PER_MESH
@ ECGI_PER_MESH
Default - write each mesh exactly once to collada. Optimal but will not work with many tools.
Definition IColladaMeshWriter.h:83
irr::scene::ECGI_PER_MESH_AND_MATERIAL
@ ECGI_PER_MESH_AND_MATERIAL
Definition IColladaMeshWriter.h:88
irr::scene::E_COLLADA_IRR_COLOR
E_COLLADA_IRR_COLOR
Irrlicht colors which can be mapped to E_COLLADA_COLOR_SAMPLER values.
Definition IColladaMeshWriter.h:59
irr::scene::ECIC_AMBIENT
@ ECIC_AMBIENT
Use SMaterial::AmbientColor.
Definition IColladaMeshWriter.h:70
irr::scene::ECIC_EMISSIVE
@ ECIC_EMISSIVE
Use SMaterial::EmissiveColor.
Definition IColladaMeshWriter.h:73
irr::scene::ECIC_NONE
@ ECIC_NONE
Don't write this element at all.
Definition IColladaMeshWriter.h:61
irr::scene::ECIC_DIFFUSE
@ ECIC_DIFFUSE
Use SMaterial::DiffuseColor.
Definition IColladaMeshWriter.h:67
irr::scene::ECIC_CUSTOM
@ ECIC_CUSTOM
Check IColladaMeshWriterProperties for custom color.
Definition IColladaMeshWriter.h:64
irr::scene::ECIC_SPECULAR
@ ECIC_SPECULAR
Use SMaterial::SpecularColor.
Definition IColladaMeshWriter.h:76
irr::scene::E_COLLADA_COLOR_SAMPLER
E_COLLADA_COLOR_SAMPLER
Color names collada uses in it's color samplers.
Definition IColladaMeshWriter.h:48
irr::scene::ECCS_AMBIENT
@ ECCS_AMBIENT
Definition IColladaMeshWriter.h:50
irr::scene::ECCS_DIFFUSE
@ ECCS_DIFFUSE
Definition IColladaMeshWriter.h:49
irr::scene::ECCS_REFLECTIVE
@ ECCS_REFLECTIVE
Definition IColladaMeshWriter.h:54
irr::scene::ECCS_SPECULAR
@ ECCS_SPECULAR
Definition IColladaMeshWriter.h:52
irr::scene::ECCS_EMISSIVE
@ ECCS_EMISSIVE
Definition IColladaMeshWriter.h:51
irr::scene::ECCS_TRANSPARENT
@ ECCS_TRANSPARENT
Definition IColladaMeshWriter.h:53
irr::scene::E_COLLADA_TECHNIQUE_FX
E_COLLADA_TECHNIQUE_FX
Lighting models - more or less the way Collada categorizes materials.
Definition IColladaMeshWriter.h:24
irr::scene::ECTF_PHONG
@ ECTF_PHONG
Phong shading, default in many external renderers.
Definition IColladaMeshWriter.h:29
irr::scene::ECTF_BLINN
@ ECTF_BLINN
Definition IColladaMeshWriter.h:27
irr::scene::ECTF_LAMBERT
@ ECTF_LAMBERT
diffuse shaded surface that is independent of lighting.
Definition IColladaMeshWriter.h:31
irr::scene::ECTF_CONSTANT
@ ECTF_CONSTANT
Definition IColladaMeshWriter.h:33
irr::scene::E_COLLADA_TRANSPARENT_FX
E_COLLADA_TRANSPARENT_FX
How to interpret the opacity in collada.
Definition IColladaMeshWriter.h:38
irr::scene::ECOF_A_ONE
@ ECOF_A_ONE
default - only alpha channel of color or texture is used.
Definition IColladaMeshWriter.h:40
irr::scene::ECOF_RGB_ZERO
@ ECOF_RGB_ZERO
Alpha values for each RGB channel of color or texture are used.
Definition IColladaMeshWriter.h:43
irr
Everything in the Irrlicht Engine can be found in this namespace.
Definition aabbox3d.h:13
irr::f32
float f32
32 bit floating point variable.
Definition irrTypes.h:104
irr::s32
signed int s32
32 bit signed variable.
Definition irrTypes.h:66
- Irrlicht Engine Documentation © 2003-2012 by Nikolaus Gebhardt. Generated on for Irrlicht 3D Engine by Doxygen 1.15.0