Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members | Tutorials
IColladaMeshWriter.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2012 Nikolaus Gebhardt
2 // This file is part of the "Irrlicht Engine".
3 // For conditions of distribution and use, see copyright notice in irrlicht.h
4 
5 #ifndef __IRR_I_COLLADA_MESH_WRITER_H_INCLUDED__
6 #define __IRR_I_COLLADA_MESH_WRITER_H_INCLUDED__
7 
8 #include "IMeshWriter.h"
9 #include "ISceneNode.h"
10 #include "IAnimatedMesh.h"
11 #include "SMaterial.h"
12 
13 namespace irr
14 {
15 namespace io
16 {
17  class IWriteFile;
18 } // end namespace io
19 
20 namespace scene
21 {
24  {
32  // constantly shaded surface that is independent of lighting.
34  };
35 
38  {
41 
44  };
45 
48  {
55  };
56 
59  {
62 
65 
68 
71 
74 
77  };
78 
81  {
84 
89  };
90 
93  {
94  public:
96 
98  virtual E_COLLADA_TECHNIQUE_FX getTechniqueFx(const video::SMaterial& material) const = 0;
99 
101 
104  virtual s32 getTextureIdx(const video::SMaterial & material, E_COLLADA_COLOR_SAMPLER cs) const = 0;
105 
107 
111  virtual E_COLLADA_IRR_COLOR getColorMapping(const video::SMaterial & material, E_COLLADA_COLOR_SAMPLER cs) const = 0;
112 
114 
115  virtual video::SColor getCustomColor(const video::SMaterial & material, E_COLLADA_COLOR_SAMPLER cs) const = 0;
116 
118 
119  virtual E_COLLADA_TRANSPARENT_FX getTransparentFx(const video::SMaterial& material) const = 0;
120 
122 
124  virtual f32 getTransparency(const video::SMaterial& material) const = 0;
125 
127 
129  virtual f32 getReflectivity(const video::SMaterial& material) const = 0;
130 
132 
134  virtual f32 getIndexOfRefraction(const video::SMaterial& material) const = 0;
135 
138  virtual bool isExportable(const irr::scene::ISceneNode * node) const = 0;
139 
142  // Note: Function is not const because there is no const getMesh() function.
143  virtual IMesh* getMesh(irr::scene::ISceneNode * node) = 0;
144 
146 
150  virtual bool useNodeMaterial(const scene::ISceneNode* node) const = 0;
151 
152  };
153 
155 
159  {
160  public:
161 
163 
165 
174  virtual irr::core::stringw nameForMesh(const scene::IMesh* mesh, int instance) = 0;
175 
177 
183  virtual irr::core::stringw nameForNode(const scene::ISceneNode* node) = 0;
184 
186 
196  virtual irr::core::stringw nameForMaterial(const video::SMaterial & material, int materialId, const scene::IMesh* mesh, const scene::ISceneNode* node) = 0;
197  };
198 
199 
202  {
203  public:
204 
206  : Properties(0), DefaultProperties(0), NameGenerator(0), DefaultNameGenerator(0)
207  , WriteTextures(true), WriteDefaultScene(true), ExportSMaterialOnce(true)
208  , AmbientLight(0.f, 0.f, 0.f, 1.f)
209  , GeometryWriting(ECGI_PER_MESH)
210  {
211  }
212 
215  {
216  if ( Properties )
217  Properties->drop();
218  if ( DefaultProperties )
219  DefaultProperties->drop();
220  if ( NameGenerator )
221  NameGenerator->drop();
222  if ( DefaultNameGenerator )
223  DefaultNameGenerator->drop();
224  }
225 
227  virtual bool writeScene(io::IWriteFile* file, scene::ISceneNode* root) = 0;
228 
229 
231  virtual void setWriteTextures(bool write)
232  {
233  WriteTextures = write;
234  }
235 
237  virtual bool getWriteTextures() const
238  {
239  return WriteTextures;
240  }
241 
243 
247  virtual void setWriteDefaultScene(bool write)
248  {
249  WriteDefaultScene = write;
250  }
251 
253  virtual bool getWriteDefaultScene() const
254  {
255  return WriteDefaultScene;
256  }
257 
259  virtual void setAmbientLight(const video::SColorf &ambientColor)
260  {
261  AmbientLight = ambientColor;
262  }
263 
266  {
267  return AmbientLight;
268  }
269 
271 
279  {
280  GeometryWriting = writeStyle;
281  }
282 
285  {
286  return GeometryWriting;
287  }
288 
290 
297  virtual void setExportSMaterialsOnlyOnce(bool exportOnce)
298  {
299  ExportSMaterialOnce = exportOnce;
300  }
301 
302  virtual bool getExportSMaterialsOnlyOnce() const
303  {
304  return ExportSMaterialOnce;
305  }
306 
308 
311  {
312  if ( p == Properties )
313  return;
314  if ( p )
315  p->grab();
316  if ( Properties )
317  Properties->drop();
318  Properties = p;
319  }
320 
323  {
324  return Properties;
325  }
326 
328 
330  {
331  return DefaultProperties;
332  }
333 
335  virtual void setNameGenerator(IColladaMeshWriterNames * nameGenerator)
336  {
337  if ( nameGenerator == NameGenerator )
338  return;
339  if ( nameGenerator )
340  nameGenerator->grab();
341  if ( NameGenerator )
342  NameGenerator->drop();
343  NameGenerator = nameGenerator;
344  }
345 
348  {
349  return NameGenerator;
350  }
351 
353 
355  {
356  return DefaultNameGenerator;
357  }
358 
360 
361  virtual irr::core::stringw toNCName(const irr::core::stringw& oldString, const irr::core::stringw& prefix=irr::core::stringw(L"_NC_")) const = 0;
362 
363 
364  protected:
365  // NOTE: You usually should also call setProperties with the same paraemter when using setDefaultProperties
367  {
368  if ( p == DefaultProperties )
369  return;
370  if ( p )
371  p->grab();
372  if ( DefaultProperties )
373  DefaultProperties->drop();
374  DefaultProperties = p;
375  }
376 
377  // NOTE: You usually should also call setNameGenerator with the same paraemter when using setDefaultProperties
379  {
380  if ( p == DefaultNameGenerator )
381  return;
382  if ( p )
383  p->grab();
384  if ( DefaultNameGenerator )
385  DefaultNameGenerator->drop();
386  DefaultNameGenerator = p;
387  }
388 
389  private:
390  IColladaMeshWriterProperties * Properties;
391  IColladaMeshWriterProperties * DefaultProperties;
392  IColladaMeshWriterNames * NameGenerator;
393  IColladaMeshWriterNames * DefaultNameGenerator;
394  bool WriteTextures;
395  bool WriteDefaultScene;
396  bool ExportSMaterialOnce;
397  video::SColorf AmbientLight;
398  E_COLLADA_GEOMETRY_WRITING GeometryWriting;
399  };
400 
401 
402 } // end namespace
403 } // end namespace
404 
405 #endif
Use SMaterial::EmissiveColor.
Use SMaterial::DiffuseColor.
default - only alpha channel of color or texture is used.
E_COLLADA_GEOMETRY_WRITING
Control when geometry elements are created.
virtual bool getWriteDefaultScene() const
Get if a default scene should be written.
virtual bool getExportSMaterialsOnlyOnce() const
virtual IColladaMeshWriterNames * getNameGenerator() const
Get currently used name generator.
float f32
32 bit floating point variable.
Definition: irrTypes.h:104
virtual f32 getIndexOfRefraction(const video::SMaterial &material) const =0
Return index of refraction for that material.
virtual void setDefaultNameGenerator(IColladaMeshWriterNames *p)
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.
virtual video::SColorf getAmbientLight() const
Return ambient light of the scene which is written.
Don't write this element at all.
Scene node interface.
Definition: ISceneNode.h:40
Alpha values for each RGB channel of color or texture are used.
virtual E_COLLADA_TRANSPARENT_FX getTransparentFx(const video::SMaterial &material) const =0
Return the transparence color interpretation.
virtual bool getWriteTextures() const
Get if texture information should be written.
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.
Everything in the Irrlicht Engine can be found in this namespace.
Definition: aabbox3d.h:12
Use SMaterial::SpecularColor.
virtual ~IColladaMeshWriter()
Destructor.
Interface providing write access to a file.
Definition: IWriteFile.h:17
virtual void setGeometryWriting(E_COLLADA_GEOMETRY_WRITING writeStyle)
Control when and how often a mesh is written.
Interface for writing meshes.
Definition: IMeshWriter.h:23
Class which holds the geometry of an object.
Definition: IMesh.h:23
Default - write each mesh exactly once to collada. Optimal but will not work with many tools...
Interface for writing meshes.
bool drop() const
Drops the object. Decrements the reference counter by one.
virtual void setNameGenerator(IColladaMeshWriterNames *nameGenerator)
Install a generator to create custom names on export.
E_COLLADA_TECHNIQUE_FX
Lighting models - more or less the way Collada categorizes materials.
signed int s32
32 bit signed variable.
Definition: irrTypes.h:66
virtual irr::core::stringw nameForNode(const scene::ISceneNode *node)=0
Return a unique name for the given node.
virtual void setWriteTextures(bool write)
Set if texture information should be written.
virtual void setWriteDefaultScene(bool write)
Set if a default scene should be written when writing meshes.
virtual IColladaMeshWriterProperties * getProperties() const
Get properties which are currently used.
E_COLLADA_TRANSPARENT_FX
How to interpret the opacity in collada.
diffuse shaded surface that is independent of lighting.
Callback interface for properties which can be used to influence collada writing. ...
virtual bool writeScene(io::IWriteFile *file, scene::ISceneNode *root)=0
writes a scene starting with the given node
Callback interface to use custom names on collada writing.
virtual bool isExportable(const irr::scene::ISceneNode *node) const =0
virtual void setProperties(IColladaMeshWriterProperties *p)
Set properties to use by the meshwriter instead of it's default properties.
IColladaMeshWriterNames * getDefaultNameGenerator() const
Return the original default name generator of the writer.
E_COLLADA_IRR_COLOR
Irrlicht colors which can be mapped to E_COLLADA_COLOR_SAMPLER values.
virtual void setExportSMaterialsOnlyOnce(bool exportOnce)
Make certain there is only one collada material generated per Irrlicht material.
virtual E_COLLADA_GEOMETRY_WRITING getGeometryWriting() const
Get the current style of geometry writing.
Class representing a 32 bit ARGB color.
Definition: SColor.h:201
IColladaMeshWriterProperties * getDefaultProperties() const
Return the original default properties of the writer.
virtual f32 getTransparency(const video::SMaterial &material) const =0
Transparency value for that material.
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.
virtual void setAmbientLight(const video::SColorf &ambientColor)
Sets ambient color of the scene to write.
virtual bool useNodeMaterial(const scene::ISceneNode *node) const =0
Return if the node has it's own material overwriting the mesh-materials.
Phong shading, default in many external renderers.
Base class of most objects of the Irrlicht Engine.
E_COLLADA_COLOR_SAMPLER
Color names collada uses in it's color samplers.
void grab() const
Grabs the object. Increments the reference counter by one.
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.
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) ...
Class representing a color with four floats.
Definition: SColor.h:458
Check IColladaMeshWriterProperties for custom color.
Struct for holding parameters for a material renderer.
Definition: SMaterial.h:226
virtual f32 getReflectivity(const video::SMaterial &material) const =0
Reflectivity value for that material.
virtual irr::core::stringw nameForMesh(const scene::IMesh *mesh, int instance)=0
Return a unique name for the given mesh.
Use SMaterial::AmbientColor.
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...
virtual void setDefaultProperties(IColladaMeshWriterProperties *p)
virtual IMesh * getMesh(irr::scene::ISceneNode *node)=0

The Irrlicht Engine
The Irrlicht Engine Documentation © 2003-2010 by Nikolaus Gebhardt. Generated by Doxygen (1.8.9.1)