Nirtcpp 2.1.0
Nirtcpp is a high-performance c++ graphics engine.
Loading...
Searching...
No Matches
nirt::scene::IColladaMeshWriter Class Referenceabstract

Interface for writing meshes. More...

#include <nirtcpp/core/engine/IColladaMeshWriter.hpp>

Inheritance diagram for nirt::scene::IColladaMeshWriter:
Inheritance graph
Collaboration diagram for nirt::scene::IColladaMeshWriter:
Collaboration graph

Public Member Functions

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

Protected Member Functions

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

Protected Attributes

nirt::core::stringc ParamNamesUV [2]
 

Detailed Description

Interface for writing meshes.

Member Function Documentation

◆ findGeometryNameForNode()

virtual const nirt::core::stringc * nirt::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

◆ getDefaultNameGenerator()

IColladaMeshWriterNames * nirt::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.

◆ getDefaultProperties()

IColladaMeshWriterProperties * nirt::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.

◆ setExportSMaterialsOnlyOnce()

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

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

Checks before creating a collada material-name if an identical nirt:::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.

◆ setGeometryWriting()

virtual void nirt::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.

◆ SetParamNamesUV()

void nirt::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.

◆ setProperties()

virtual void nirt::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.

◆ setUnit()

virtual void nirt::scene::IColladaMeshWriter::setUnit ( nirt::f32  meter,
const nirt::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".

◆ setWriteDefaultScene()

virtual void nirt::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)

◆ toNCName()

virtual nirt::core::stringc nirt::scene::IColladaMeshWriter::toNCName ( const nirt::core::stringc oldString,
const nirt::core::stringc prefix = nirt::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.


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

Nirtcpp    @cppfx.xyz

Utxcpp    utx::print