arsa  2.7
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
irr::scene::IColladaMeshWriter Class Referenceabstract

Interface for writing meshes. More...

#include <IColladaMeshWriter.h>

Inheritance diagram for irr::scene::IColladaMeshWriter:
irr::scene::IMeshWriter irr::IReferenceCounted

Public Member Functions

 IColladaMeshWriter ()
 
virtual ~IColladaMeshWriter ()
 Destructor. More...
 
virtual bool writeScene (io::IWriteFile *file, scene::ISceneNode *root, int writeRoot=1)=0
 writes a scene starting with the given node More...
 
virtual void setWriteTextures (bool write)
 Set if texture information should be written. More...
 
virtual bool getWriteTextures () const
 Get if texture information should be written. More...
 
virtual void setWriteDefaultScene (bool write)
 Set if a default scene should be written when writing meshes. More...
 
virtual bool getWriteDefaultScene () const
 Get if a default scene should be written. More...
 
virtual void setAmbientLight (const video::SColorf &ambientColor)
 Sets ambient color of the scene to write. More...
 
virtual video::SColorf getAmbientLight () const
 Return ambient light of the scene which is written. More...
 
virtual void setUnit (irr::f32 meter, const irr::core::stringc &name)
 Set the unit distances for all elements and objects. More...
 
virtual irr::f32 getUnitMeter () const
 Return real world meters to use per unit for all elements and objects. More...
 
virtual irr::core::stringc getUnitName () const
 Return name to use for distance units. Like p.E. "meter". More...
 
virtual void setGeometryWriting (E_COLLADA_GEOMETRY_WRITING writeStyle)
 Control when and how often a mesh is written. More...
 
virtual E_COLLADA_GEOMETRY_WRITING getGeometryWriting () const
 Get the current style of geometry writing. More...
 
virtual void setExportSMaterialsOnlyOnce (bool exportOnce)
 Make certain there is only one collada material generated per Irrlicht material. More...
 
virtual bool getExportSMaterialsOnlyOnce () const
 
virtual void setProperties (IColladaMeshWriterProperties *p)
 Set properties to use by the meshwriter instead of it's default properties. More...
 
virtual IColladaMeshWriterPropertiesgetProperties () const
 Get properties which are currently used. More...
 
IColladaMeshWriterPropertiesgetDefaultProperties () const
 Return the original default properties of the writer. More...
 
virtual void setNameGenerator (IColladaMeshWriterNames *nameGenerator)
 Install a generator to create custom names on export. More...
 
virtual IColladaMeshWriterNamesgetNameGenerator () const
 Get currently used name generator. More...
 
IColladaMeshWriterNamesgetDefaultNameGenerator () const
 Return the original default name generator of the writer. More...
 
virtual irr::core::stringc toNCName (const irr::core::stringc &oldString, const irr::core::stringc &prefix=irr::core::stringc("_NC_")) const =0
 Restrict the characters of oldString a set of allowed characters in xs:NCName and add the prefix. More...
 
virtual const irr::core::stringcfindGeometryNameForNode (ISceneNode *node)=0
 After export you can find out which name had been used for writing the geometry for this node. More...
 
void SetParamNamesUV (const core::stringc &u, const core::stringc &v)
 Change param name used for UV's. More...
 
- Public Member Functions inherited from irr::scene::IMeshWriter
virtual ~IMeshWriter ()
 Destructor. More...
 
virtual EMESH_WRITER_TYPE getType () const =0
 Get the type of the mesh writer. More...
 
virtual bool writeMesh (io::IWriteFile *file, scene::IMesh *mesh, s32 flags=EMWF_NONE)=0
 Write a static mesh. More...
 
- Public Member Functions inherited from irr::IReferenceCounted
 IReferenceCounted ()
 Constructor. More...
 
virtual ~IReferenceCounted ()
 Destructor. More...
 
void grab () const
 Grabs the object. Increments the reference counter by one. More...
 
bool drop () const
 Drops the object. Decrements the reference counter by one. More...
 
s32 getReferenceCount () const
 Get the reference count. More...
 
const c8getDebugName () const
 Returns the debug name of the object. More...
 

Protected Member Functions

virtual void setDefaultProperties (IColladaMeshWriterProperties *p)
 
virtual void setDefaultNameGenerator (IColladaMeshWriterNames *p)
 
- Protected Member Functions inherited from irr::IReferenceCounted
void setDebugName (const c8 *newName)
 Sets the debug name of the object. More...
 

Protected Attributes

irr::core::stringc ParamNamesUV [2]
 

Detailed Description

Interface for writing meshes.

Definition at line 202 of file IColladaMeshWriter.h.

Constructor & Destructor Documentation

◆ IColladaMeshWriter()

irr::scene::IColladaMeshWriter::IColladaMeshWriter ( )
inline

Definition at line 206 of file IColladaMeshWriter.h.

207  : Properties(0), DefaultProperties(0), NameGenerator(0), DefaultNameGenerator(0)
208  , WriteTextures(true), WriteDefaultScene(true), ExportSMaterialOnce(true)
209  , AmbientLight(0.f, 0.f, 0.f, 1.f)
210  , UnitMeter(1.f), UnitName("meter")
211  , GeometryWriting(ECGI_PER_MESH)
212  {
213  ParamNamesUV[0] = "U";
214  ParamNamesUV[1] = "V";
215  }
irr::core::stringc ParamNamesUV[2]
Default - write each mesh exactly once to collada. Optimal but will not work with many tools.
GLfloat f

◆ ~IColladaMeshWriter()

virtual irr::scene::IColladaMeshWriter::~IColladaMeshWriter ( )
inlinevirtual

Destructor.

Definition at line 218 of file IColladaMeshWriter.h.

219  {
220  if ( Properties )
221  Properties->drop();
222  if ( DefaultProperties )
223  DefaultProperties->drop();
224  if ( NameGenerator )
225  NameGenerator->drop();
226  if ( DefaultNameGenerator )
227  DefaultNameGenerator->drop();
228  }
bool drop() const
Drops the object. Decrements the reference counter by one.

Member Function Documentation

◆ findGeometryNameForNode()

virtual const irr::core::stringc* irr::scene::IColladaMeshWriter::findGeometryNameForNode ( ISceneNode node)
pure virtual

After export you can find out which name had been used for writing the geometry for this node.

The name comes from IColladaMeshWriterNames::nameForMesh, but you can't access the node there.

Returns
Either a pointer to the name or NULL

◆ getAmbientLight()

virtual video::SColorf irr::scene::IColladaMeshWriter::getAmbientLight ( ) const
inlinevirtual

Return ambient light of the scene which is written.

Definition at line 270 of file IColladaMeshWriter.h.

271  {
272  return AmbientLight;
273  }

◆ getDefaultNameGenerator()

IColladaMeshWriterNames* irr::scene::IColladaMeshWriter::getDefaultNameGenerator ( ) const
inline

Return the original default name generator of the writer.

You can use this pointer in your own generator to access and return default values.

Definition at line 381 of file IColladaMeshWriter.h.

382  {
383  return DefaultNameGenerator;
384  }

◆ getDefaultProperties()

IColladaMeshWriterProperties* irr::scene::IColladaMeshWriter::getDefaultProperties ( ) const
inline

Return the original default properties of the writer.

You can use this pointer in your own properties to access and return default values.

Definition at line 356 of file IColladaMeshWriter.h.

357  {
358  return DefaultProperties;
359  }

◆ getExportSMaterialsOnlyOnce()

virtual bool irr::scene::IColladaMeshWriter::getExportSMaterialsOnlyOnce ( ) const
inlinevirtual

Definition at line 329 of file IColladaMeshWriter.h.

330  {
331  return ExportSMaterialOnce;
332  }

◆ getGeometryWriting()

virtual E_COLLADA_GEOMETRY_WRITING irr::scene::IColladaMeshWriter::getGeometryWriting ( ) const
inlinevirtual

Get the current style of geometry writing.

Definition at line 311 of file IColladaMeshWriter.h.

312  {
313  return GeometryWriting;
314  }

◆ getNameGenerator()

virtual IColladaMeshWriterNames* irr::scene::IColladaMeshWriter::getNameGenerator ( ) const
inlinevirtual

Get currently used name generator.

Definition at line 374 of file IColladaMeshWriter.h.

375  {
376  return NameGenerator;
377  }

◆ getProperties()

virtual IColladaMeshWriterProperties* irr::scene::IColladaMeshWriter::getProperties ( ) const
inlinevirtual

Get properties which are currently used.

Definition at line 349 of file IColladaMeshWriter.h.

350  {
351  return Properties;
352  }

◆ getUnitMeter()

virtual irr::f32 irr::scene::IColladaMeshWriter::getUnitMeter ( ) const
inlinevirtual

Return real world meters to use per unit for all elements and objects.

Definition at line 286 of file IColladaMeshWriter.h.

287  {
288  return UnitMeter;
289  }

◆ getUnitName()

virtual irr::core::stringc irr::scene::IColladaMeshWriter::getUnitName ( ) const
inlinevirtual

Return name to use for distance units. Like p.E. "meter".

Definition at line 292 of file IColladaMeshWriter.h.

293  {
294  return UnitName;
295  }

◆ getWriteDefaultScene()

virtual bool irr::scene::IColladaMeshWriter::getWriteDefaultScene ( ) const
inlinevirtual

Get if a default scene should be written.

Definition at line 258 of file IColladaMeshWriter.h.

259  {
260  return WriteDefaultScene;
261  }

◆ getWriteTextures()

virtual bool irr::scene::IColladaMeshWriter::getWriteTextures ( ) const
inlinevirtual

Get if texture information should be written.

Definition at line 242 of file IColladaMeshWriter.h.

243  {
244  return WriteTextures;
245  }

◆ setAmbientLight()

virtual void irr::scene::IColladaMeshWriter::setAmbientLight ( const video::SColorf ambientColor)
inlinevirtual

Sets ambient color of the scene to write.

Definition at line 264 of file IColladaMeshWriter.h.

265  {
266  AmbientLight = ambientColor;
267  }

◆ setDefaultNameGenerator()

virtual void irr::scene::IColladaMeshWriter::setDefaultNameGenerator ( IColladaMeshWriterNames p)
inlineprotectedvirtual

Definition at line 424 of file IColladaMeshWriter.h.

425  {
426  if ( p == DefaultNameGenerator )
427  return;
428  if ( p )
429  p->grab();
430  if ( DefaultNameGenerator )
431  DefaultNameGenerator->drop();
432  DefaultNameGenerator = p;
433  }
bool drop() const
Drops the object. Decrements the reference counter by one.
GLfloat GLfloat p

◆ setDefaultProperties()

virtual void irr::scene::IColladaMeshWriter::setDefaultProperties ( IColladaMeshWriterProperties p)
inlineprotectedvirtual

Definition at line 412 of file IColladaMeshWriter.h.

413  {
414  if ( p == DefaultProperties )
415  return;
416  if ( p )
417  p->grab();
418  if ( DefaultProperties )
419  DefaultProperties->drop();
420  DefaultProperties = p;
421  }
bool drop() const
Drops the object. Decrements the reference counter by one.
GLfloat GLfloat p

◆ setExportSMaterialsOnlyOnce()

virtual void irr::scene::IColladaMeshWriter::setExportSMaterialsOnlyOnce ( bool  exportOnce)
inlinevirtual

Make certain there is only one collada material generated per Irrlicht material.

Checks before creating a collada material-name if an identical irr:::video::SMaterial has been exported already. If so don't export it with another name. This is set by default and leads to way smaller .dae files. Note that if you need to disable this flag for some reason you can still get a similar effect using the IColladaMeshWriterNames::nameForMaterial by returning identical names for identical materials there.

Definition at line 324 of file IColladaMeshWriter.h.

325  {
326  ExportSMaterialOnce = exportOnce;
327  }

◆ setGeometryWriting()

virtual void irr::scene::IColladaMeshWriter::setGeometryWriting ( E_COLLADA_GEOMETRY_WRITING  writeStyle)
inlinevirtual

Control when and how often a mesh is written.

Optimally ECGI_PER_MESH would be always sufficient - writing geometry once per mesh. Unfortunately many tools (at the time of writing this nearly all of them) have trouble on import when different materials are used per node. So when you override materials per node and importing the resulting collada has materials problems in other tools try using other values here.

Parameters
writeStyleOne of the E_COLLADA_GEOMETRY_WRITING settings.

Definition at line 305 of file IColladaMeshWriter.h.

306  {
307  GeometryWriting = writeStyle;
308  }

◆ setNameGenerator()

virtual void irr::scene::IColladaMeshWriter::setNameGenerator ( IColladaMeshWriterNames nameGenerator)
inlinevirtual

Install a generator to create custom names on export.

Definition at line 362 of file IColladaMeshWriter.h.

363  {
364  if ( nameGenerator == NameGenerator )
365  return;
366  if ( nameGenerator )
367  nameGenerator->grab();
368  if ( NameGenerator )
369  NameGenerator->drop();
370  NameGenerator = nameGenerator;
371  }
bool drop() const
Drops the object. Decrements the reference counter by one.

◆ SetParamNamesUV()

void irr::scene::IColladaMeshWriter::SetParamNamesUV ( const core::stringc u,
const core::stringc v 
)
inline

Change param name used for UV's.

Param names for UV's have a name. By default it's "U" and "V". Usually it doesn't matter as names are optional in Collada anyway. But unfortunately some tools insist on specific names. So if "U", "V" does not work then try to export by setting this to "S", "T". One tool which insists on "S", "T" is for example SketchUp.

Definition at line 403 of file IColladaMeshWriter.h.

404  {
405  ParamNamesUV[0] = u;
406  ParamNamesUV[1] = v;
407  }
irr::core::stringc ParamNamesUV[2]
const GLdouble * v
Definition: SDL_opengl.h:2064

◆ setProperties()

virtual void irr::scene::IColladaMeshWriter::setProperties ( IColladaMeshWriterProperties p)
inlinevirtual

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. By default properties are set to the DefaultProperties.

Definition at line 337 of file IColladaMeshWriter.h.

338  {
339  if ( p == Properties )
340  return;
341  if ( p )
342  p->grab();
343  if ( Properties )
344  Properties->drop();
345  Properties = p;
346  }
bool drop() const
Drops the object. Decrements the reference counter by one.
GLfloat GLfloat p

◆ setUnit()

virtual void irr::scene::IColladaMeshWriter::setUnit ( irr::f32  meter,
const irr::core::stringc name 
)
inlinevirtual

Set the unit distances for all elements and objects.

Parameters
meterReal-world meters to use per unit. Default 1 unit = 1 meter. For 1 unit = 1cm you would set to 0.01
nameName to use for distance unit. Default is "meter".

Definition at line 279 of file IColladaMeshWriter.h.

280  {
281  UnitMeter = meter;
282  UnitName = name;
283  }
GLuint const GLchar * name

◆ setWriteDefaultScene()

virtual void irr::scene::IColladaMeshWriter::setWriteDefaultScene ( bool  write)
inlinevirtual

Set if a default scene should be written when writing meshes.

Many collada readers fail to read a mesh if the collada files doesn't contain a scene as well. The scene is doing an instantiation of the mesh. When using writeScene this flag is ignored (as we have scene there already)

Definition at line 252 of file IColladaMeshWriter.h.

253  {
254  WriteDefaultScene = write;
255  }

◆ setWriteTextures()

virtual void irr::scene::IColladaMeshWriter::setWriteTextures ( bool  write)
inlinevirtual

Set if texture information should be written.

Definition at line 236 of file IColladaMeshWriter.h.

237  {
238  WriteTextures = write;
239  }

◆ toNCName()

virtual irr::core::stringc irr::scene::IColladaMeshWriter::toNCName ( const irr::core::stringc oldString,
const irr::core::stringc prefix = irr::core::stringc("_NC_") 
) const
pure virtual

Restrict the characters of oldString a set of allowed characters in xs:NCName and add the prefix.

A tool function to help when using a custom name generator to generative valid names for collada names and id's.

◆ writeScene()

virtual bool irr::scene::IColladaMeshWriter::writeScene ( io::IWriteFile file,
scene::ISceneNode root,
int  writeRoot = 1 
)
pure virtual

writes a scene starting with the given node

Member Data Documentation

◆ ParamNamesUV

irr::core::stringc irr::scene::IColladaMeshWriter::ParamNamesUV[2]
protected

Definition at line 436 of file IColladaMeshWriter.h.


The documentation for this class was generated from the following file: