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  {
210  }
211 
214  {
215  if ( Properties )
216  Properties->drop();
217  if ( DefaultProperties )
218  DefaultProperties->drop();
219  if ( NameGenerator )
220  NameGenerator->drop();
221  if ( DefaultNameGenerator )
222  DefaultNameGenerator->drop();
223  }
224 
226  virtual bool writeScene(io::IWriteFile* file, scene::ISceneNode* root) = 0;
227 
228 
230  virtual void setWriteTextures(bool write)
231  {
232  WriteTextures = write;
233  }
234 
236  virtual bool getWriteTextures() const
237  {
238  return WriteTextures;
239  }
240 
242 
246  virtual void setWriteDefaultScene(bool write)
247  {
248  WriteDefaultScene = write;
249  }
250 
252  virtual bool getWriteDefaultScene() const
253  {
254  return WriteDefaultScene;
255  }
256 
258  virtual void setAmbientLight(const video::SColorf &ambientColor)
259  {
260  AmbientLight = ambientColor;
261  }
262 
265  {
266  return AmbientLight;
267  }
268 
270 
278  {
279  GeometryWriting = writeStyle;
280  }
281 
284  {
285  return GeometryWriting;
286  }
287 
289 
296  virtual void setExportSMaterialsOnlyOnce(bool exportOnce)
297  {
298  ExportSMaterialOnce = exportOnce;
299  }
300 
301  virtual bool getExportSMaterialsOnlyOnce() const
302  {
303  return ExportSMaterialOnce;
304  }
305 
307 
310  {
311  if ( p == Properties )
312  return;
313  if ( p )
314  p->grab();
315  if ( Properties )
316  Properties->drop();
317  Properties = p;
318  }
319 
322  {
323  return Properties;
324  }
325 
327 
329  {
330  return DefaultProperties;
331  }
332 
334  virtual void setNameGenerator(IColladaMeshWriterNames * nameGenerator)
335  {
336  if ( nameGenerator == NameGenerator )
337  return;
338  if ( nameGenerator )
339  nameGenerator->grab();
340  if ( NameGenerator )
341  NameGenerator->drop();
342  NameGenerator = nameGenerator;
343  }
344 
347  {
348  return NameGenerator;
349  }
350 
352 
354  {
355  return DefaultNameGenerator;
356  }
357 
359 
360  virtual irr::core::stringw toNCName(const irr::core::stringw& oldString, const irr::core::stringw& prefix=irr::core::stringw(L"_NC_")) const = 0;
361 
362 
363  protected:
364  // NOTE: You usually should also call setProperties with the same paraemter when using setDefaultProperties
366  {
367  if ( p == DefaultProperties )
368  return;
369  if ( p )
370  p->grab();
371  if ( DefaultProperties )
372  DefaultProperties->drop();
373  DefaultProperties = p;
374  }
375 
376  // NOTE: You usually should also call setNameGenerator with the same paraemter when using setDefaultProperties
378  {
379  if ( p == DefaultNameGenerator )
380  return;
381  if ( p )
382  p->grab();
383  if ( DefaultNameGenerator )
384  DefaultNameGenerator->drop();
385  DefaultNameGenerator = p;
386  }
387 
388  private:
389  IColladaMeshWriterProperties * Properties;
390  IColladaMeshWriterProperties * DefaultProperties;
391  IColladaMeshWriterNames * NameGenerator;
392  IColladaMeshWriterNames * DefaultNameGenerator;
393  bool WriteTextures;
394  bool WriteDefaultScene;
395  bool ExportSMaterialOnce;
396  video::SColorf AmbientLight;
397  E_COLLADA_GEOMETRY_WRITING GeometryWriting;
398  };
399 
400 
401 } // end namespace
402 } // end namespace
403 
404 #endif

The Irrlicht Engine
The Irrlicht Engine Documentation © 2003-2010 by Nikolaus Gebhardt. Generated on Mon May 6 2013 17:41:01 by Doxygen (1.8.3.1)