diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/irrlicht-1.8/include/IColladaMeshWriter.h | 808 |
1 files changed, 404 insertions, 404 deletions
diff --git a/libraries/irrlicht-1.8/include/IColladaMeshWriter.h b/libraries/irrlicht-1.8/include/IColladaMeshWriter.h index 90691f5..dc2afed 100644 --- a/libraries/irrlicht-1.8/include/IColladaMeshWriter.h +++ b/libraries/irrlicht-1.8/include/IColladaMeshWriter.h | |||
@@ -1,404 +1,404 @@ | |||
1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt | 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt |
2 | // This file is part of the "Irrlicht Engine". | 2 | // This file is part of the "Irrlicht Engine". |
3 | // For conditions of distribution and use, see copyright notice in irrlicht.h | 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h |
4 | 4 | ||
5 | #ifndef __IRR_I_COLLADA_MESH_WRITER_H_INCLUDED__ | 5 | #ifndef __IRR_I_COLLADA_MESH_WRITER_H_INCLUDED__ |
6 | #define __IRR_I_COLLADA_MESH_WRITER_H_INCLUDED__ | 6 | #define __IRR_I_COLLADA_MESH_WRITER_H_INCLUDED__ |
7 | 7 | ||
8 | #include "IMeshWriter.h" | 8 | #include "IMeshWriter.h" |
9 | #include "ISceneNode.h" | 9 | #include "ISceneNode.h" |
10 | #include "IAnimatedMesh.h" | 10 | #include "IAnimatedMesh.h" |
11 | #include "SMaterial.h" | 11 | #include "SMaterial.h" |
12 | 12 | ||
13 | namespace irr | 13 | namespace irr |
14 | { | 14 | { |
15 | namespace io | 15 | namespace io |
16 | { | 16 | { |
17 | class IWriteFile; | 17 | class IWriteFile; |
18 | } // end namespace io | 18 | } // end namespace io |
19 | 19 | ||
20 | namespace scene | 20 | namespace scene |
21 | { | 21 | { |
22 | //! Lighting models - more or less the way Collada categorizes materials | 22 | //! Lighting models - more or less the way Collada categorizes materials |
23 | enum E_COLLADA_TECHNIQUE_FX | 23 | enum E_COLLADA_TECHNIQUE_FX |
24 | { | 24 | { |
25 | //! Blinn-phong which is default for opengl and dx fixed function pipelines. | 25 | //! Blinn-phong which is default for opengl and dx fixed function pipelines. |
26 | //! But several well-known renderers don't support it and prefer phong. | 26 | //! But several well-known renderers don't support it and prefer phong. |
27 | ECTF_BLINN, | 27 | ECTF_BLINN, |
28 | //! Phong shading, default in many external renderers. | 28 | //! Phong shading, default in many external renderers. |
29 | ECTF_PHONG, | 29 | ECTF_PHONG, |
30 | //! diffuse shaded surface that is independent of lighting. | 30 | //! diffuse shaded surface that is independent of lighting. |
31 | ECTF_LAMBERT, | 31 | ECTF_LAMBERT, |
32 | // constantly shaded surface that is independent of lighting. | 32 | // constantly shaded surface that is independent of lighting. |
33 | ECTF_CONSTANT | 33 | ECTF_CONSTANT |
34 | }; | 34 | }; |
35 | 35 | ||
36 | //! How to interpret the opacity in collada | 36 | //! How to interpret the opacity in collada |
37 | enum E_COLLADA_TRANSPARENT_FX | 37 | enum E_COLLADA_TRANSPARENT_FX |
38 | { | 38 | { |
39 | //! default - only alpha channel of color or texture is used. | 39 | //! default - only alpha channel of color or texture is used. |
40 | ECOF_A_ONE = 0, | 40 | ECOF_A_ONE = 0, |
41 | 41 | ||
42 | //! Alpha values for each RGB channel of color or texture are used. | 42 | //! Alpha values for each RGB channel of color or texture are used. |
43 | ECOF_RGB_ZERO = 1 | 43 | ECOF_RGB_ZERO = 1 |
44 | }; | 44 | }; |
45 | 45 | ||
46 | //! Color names collada uses in it's color samplers | 46 | //! Color names collada uses in it's color samplers |
47 | enum E_COLLADA_COLOR_SAMPLER | 47 | enum E_COLLADA_COLOR_SAMPLER |
48 | { | 48 | { |
49 | ECCS_DIFFUSE, | 49 | ECCS_DIFFUSE, |
50 | ECCS_AMBIENT, | 50 | ECCS_AMBIENT, |
51 | ECCS_EMISSIVE, | 51 | ECCS_EMISSIVE, |
52 | ECCS_SPECULAR, | 52 | ECCS_SPECULAR, |
53 | ECCS_TRANSPARENT, | 53 | ECCS_TRANSPARENT, |
54 | ECCS_REFLECTIVE | 54 | ECCS_REFLECTIVE |
55 | }; | 55 | }; |
56 | 56 | ||
57 | //! Irrlicht colors which can be mapped to E_COLLADA_COLOR_SAMPLER values | 57 | //! Irrlicht colors which can be mapped to E_COLLADA_COLOR_SAMPLER values |
58 | enum E_COLLADA_IRR_COLOR | 58 | enum E_COLLADA_IRR_COLOR |
59 | { | 59 | { |
60 | //! Don't write this element at all | 60 | //! Don't write this element at all |
61 | ECIC_NONE, | 61 | ECIC_NONE, |
62 | 62 | ||
63 | //! Check IColladaMeshWriterProperties for custom color | 63 | //! Check IColladaMeshWriterProperties for custom color |
64 | ECIC_CUSTOM, | 64 | ECIC_CUSTOM, |
65 | 65 | ||
66 | //! Use SMaterial::DiffuseColor | 66 | //! Use SMaterial::DiffuseColor |
67 | ECIC_DIFFUSE, | 67 | ECIC_DIFFUSE, |
68 | 68 | ||
69 | //! Use SMaterial::AmbientColor | 69 | //! Use SMaterial::AmbientColor |
70 | ECIC_AMBIENT, | 70 | ECIC_AMBIENT, |
71 | 71 | ||
72 | //! Use SMaterial::EmissiveColor | 72 | //! Use SMaterial::EmissiveColor |
73 | ECIC_EMISSIVE, | 73 | ECIC_EMISSIVE, |
74 | 74 | ||
75 | //! Use SMaterial::SpecularColor | 75 | //! Use SMaterial::SpecularColor |
76 | ECIC_SPECULAR | 76 | ECIC_SPECULAR |
77 | }; | 77 | }; |
78 | 78 | ||
79 | //! Control when geometry elements are created | 79 | //! Control when geometry elements are created |
80 | enum E_COLLADA_GEOMETRY_WRITING | 80 | enum E_COLLADA_GEOMETRY_WRITING |
81 | { | 81 | { |
82 | //! Default - write each mesh exactly once to collada. Optimal but will not work with many tools. | 82 | //! Default - write each mesh exactly once to collada. Optimal but will not work with many tools. |
83 | ECGI_PER_MESH, | 83 | ECGI_PER_MESH, |
84 | 84 | ||
85 | //! Write each mesh as often as it's used with different materials-names in the scene. | 85 | //! Write each mesh as often as it's used with different materials-names in the scene. |
86 | //! Material names which are used here are created on export, so using the IColladaMeshWriterNames | 86 | //! Material names which are used here are created on export, so using the IColladaMeshWriterNames |
87 | //! interface you have some control over how many geometries are written. | 87 | //! interface you have some control over how many geometries are written. |
88 | ECGI_PER_MESH_AND_MATERIAL | 88 | ECGI_PER_MESH_AND_MATERIAL |
89 | }; | 89 | }; |
90 | 90 | ||
91 | //! Callback interface for properties which can be used to influence collada writing | 91 | //! Callback interface for properties which can be used to influence collada writing |
92 | class IColladaMeshWriterProperties : public virtual IReferenceCounted | 92 | class IColladaMeshWriterProperties : public virtual IReferenceCounted |
93 | { | 93 | { |
94 | public: | 94 | public: |
95 | virtual ~IColladaMeshWriterProperties () {} | 95 | virtual ~IColladaMeshWriterProperties () {} |
96 | 96 | ||
97 | //! Which lighting model should be used in the technique (FX) section when exporting effects (materials) | 97 | //! Which lighting model should be used in the technique (FX) section when exporting effects (materials) |
98 | virtual E_COLLADA_TECHNIQUE_FX getTechniqueFx(const video::SMaterial& material) const = 0; | 98 | virtual E_COLLADA_TECHNIQUE_FX getTechniqueFx(const video::SMaterial& material) const = 0; |
99 | 99 | ||
100 | //! Which texture index should be used when writing the texture of the given sampler color. | 100 | //! Which texture index should be used when writing the texture of the given sampler color. |
101 | /** \return the index to the texture-layer or -1 if that texture should never be exported | 101 | /** \return the index to the texture-layer or -1 if that texture should never be exported |
102 | Note: for ECCS_TRANSPARENT by default the alpha channel is used, if you want to use RGB you have to set | 102 | Note: for ECCS_TRANSPARENT by default the alpha channel is used, if you want to use RGB you have to set |
103 | also the ECOF_RGB_ZERO flag in getTransparentFx. */ | 103 | also the ECOF_RGB_ZERO flag in getTransparentFx. */ |
104 | virtual s32 getTextureIdx(const video::SMaterial & material, E_COLLADA_COLOR_SAMPLER cs) const = 0; | 104 | virtual s32 getTextureIdx(const video::SMaterial & material, E_COLLADA_COLOR_SAMPLER cs) const = 0; |
105 | 105 | ||
106 | //! Return which color from Irrlicht should be used for the color requested by collada | 106 | //! Return which color from Irrlicht should be used for the color requested by collada |
107 | /** Note that collada allows exporting either texture or color, not both. | 107 | /** Note that collada allows exporting either texture or color, not both. |
108 | So color mapping is only checked if we have no valid texture already. | 108 | So color mapping is only checked if we have no valid texture already. |
109 | By default we try to return best fits when possible. For example ECCS_DIFFUSE is mapped to ECIC_DIFFUSE. | 109 | By default we try to return best fits when possible. For example ECCS_DIFFUSE is mapped to ECIC_DIFFUSE. |
110 | When ECIC_CUSTOM is returned then the result of getCustomColor will be used. */ | 110 | When ECIC_CUSTOM is returned then the result of getCustomColor will be used. */ |
111 | virtual E_COLLADA_IRR_COLOR getColorMapping(const video::SMaterial & material, E_COLLADA_COLOR_SAMPLER cs) const = 0; | 111 | virtual E_COLLADA_IRR_COLOR getColorMapping(const video::SMaterial & material, E_COLLADA_COLOR_SAMPLER cs) const = 0; |
112 | 112 | ||
113 | //! Return custom colors for certain color types requested by collada. | 113 | //! Return custom colors for certain color types requested by collada. |
114 | /** Only used when getColorMapping returns ECIC_CUSTOM for the same paramters. */ | 114 | /** Only used when getColorMapping returns ECIC_CUSTOM for the same paramters. */ |
115 | virtual video::SColor getCustomColor(const video::SMaterial & material, E_COLLADA_COLOR_SAMPLER cs) const = 0; | 115 | virtual video::SColor getCustomColor(const video::SMaterial & material, E_COLLADA_COLOR_SAMPLER cs) const = 0; |
116 | 116 | ||
117 | //! Return the transparence color interpretation. | 117 | //! Return the transparence color interpretation. |
118 | /** Not this is only about ECCS_TRANSPARENT and does not affect getTransparency. */ | 118 | /** Not this is only about ECCS_TRANSPARENT and does not affect getTransparency. */ |
119 | virtual E_COLLADA_TRANSPARENT_FX getTransparentFx(const video::SMaterial& material) const = 0; | 119 | virtual E_COLLADA_TRANSPARENT_FX getTransparentFx(const video::SMaterial& material) const = 0; |
120 | 120 | ||
121 | //! Transparency value for that material. | 121 | //! Transparency value for that material. |
122 | /** This value is additional to transparent settings, if both are set they will be multiplicated. | 122 | /** This value is additional to transparent settings, if both are set they will be multiplicated. |
123 | \return 1.0 for fully transparent, 0.0 for not transparent and not written at all when < 0.f */ | 123 | \return 1.0 for fully transparent, 0.0 for not transparent and not written at all when < 0.f */ |
124 | virtual f32 getTransparency(const video::SMaterial& material) const = 0; | 124 | virtual f32 getTransparency(const video::SMaterial& material) const = 0; |
125 | 125 | ||
126 | //! Reflectivity value for that material | 126 | //! Reflectivity value for that material |
127 | /** The amount of perfect mirror reflection to be added to the reflected light | 127 | /** The amount of perfect mirror reflection to be added to the reflected light |
128 | \return 0.0 - 1.0 for reflectivity and element is not written at all when < 0.f */ | 128 | \return 0.0 - 1.0 for reflectivity and element is not written at all when < 0.f */ |
129 | virtual f32 getReflectivity(const video::SMaterial& material) const = 0; | 129 | virtual f32 getReflectivity(const video::SMaterial& material) const = 0; |
130 | 130 | ||
131 | //! Return index of refraction for that material | 131 | //! Return index of refraction for that material |
132 | /** By default we don't write that. | 132 | /** By default we don't write that. |
133 | \return a value greater equal 0.f to write \<index_of_refraction\> when it is lesser than 0 nothing will be written */ | 133 | \return a value greater equal 0.f to write \<index_of_refraction\> when it is lesser than 0 nothing will be written */ |
134 | virtual f32 getIndexOfRefraction(const video::SMaterial& material) const = 0; | 134 | virtual f32 getIndexOfRefraction(const video::SMaterial& material) const = 0; |
135 | 135 | ||
136 | //! Should node be used in scene export? (only needed for scene-writing, ignored in mesh-writing) | 136 | //! Should node be used in scene export? (only needed for scene-writing, ignored in mesh-writing) |
137 | //! By default all visible nodes are exported. | 137 | //! By default all visible nodes are exported. |
138 | virtual bool isExportable(const irr::scene::ISceneNode * node) const = 0; | 138 | virtual bool isExportable(const irr::scene::ISceneNode * node) const = 0; |
139 | 139 | ||
140 | //! Return the mesh for the given node. If it has no mesh or shouldn't export it's mesh | 140 | //! Return the mesh for the given node. If it has no mesh or shouldn't export it's mesh |
141 | //! you can return 0 in which case only the transformation matrix of the node will be used. | 141 | //! you can return 0 in which case only the transformation matrix of the node will be used. |
142 | // Note: Function is not const because there is no const getMesh() function. | 142 | // Note: Function is not const because there is no const getMesh() function. |
143 | virtual IMesh* getMesh(irr::scene::ISceneNode * node) = 0; | 143 | virtual IMesh* getMesh(irr::scene::ISceneNode * node) = 0; |
144 | 144 | ||
145 | //! Return if the node has it's own material overwriting the mesh-materials | 145 | //! Return if the node has it's own material overwriting the mesh-materials |
146 | /** Usually true except for mesh-nodes which have isReadOnlyMaterials set. | 146 | /** Usually true except for mesh-nodes which have isReadOnlyMaterials set. |
147 | This is mostly important for naming (as ISceneNode::getMaterial() already returns the correct material). | 147 | This is mostly important for naming (as ISceneNode::getMaterial() already returns the correct material). |
148 | You have to override it when exporting custom scenenodes with own materials. | 148 | You have to override it when exporting custom scenenodes with own materials. |
149 | \return true => The node's own material is used, false => ignore node material and use the one from the mesh */ | 149 | \return true => The node's own material is used, false => ignore node material and use the one from the mesh */ |
150 | virtual bool useNodeMaterial(const scene::ISceneNode* node) const = 0; | 150 | virtual bool useNodeMaterial(const scene::ISceneNode* node) const = 0; |
151 | 151 | ||
152 | }; | 152 | }; |
153 | 153 | ||
154 | //! Callback interface to use custom names on collada writing. | 154 | //! Callback interface to use custom names on collada writing. |
155 | /** You can either modify names and id's written to collada or you can use | 155 | /** You can either modify names and id's written to collada or you can use |
156 | this interface to just find out which names are used on writing. | 156 | this interface to just find out which names are used on writing. |
157 | */ | 157 | */ |
158 | class IColladaMeshWriterNames : public virtual IReferenceCounted | 158 | class IColladaMeshWriterNames : public virtual IReferenceCounted |
159 | { | 159 | { |
160 | public: | 160 | public: |
161 | 161 | ||
162 | virtual ~IColladaMeshWriterNames () {} | 162 | virtual ~IColladaMeshWriterNames () {} |
163 | 163 | ||
164 | //! Return a unique name for the given mesh | 164 | //! Return a unique name for the given mesh |
165 | /** Note that names really must be unique here per mesh-pointer, so | 165 | /** Note that names really must be unique here per mesh-pointer, so |
166 | mostly it's a good idea to return the nameForMesh from | 166 | mostly it's a good idea to return the nameForMesh from |
167 | IColladaMeshWriter::getDefaultNameGenerator(). Also names must follow | 167 | IColladaMeshWriter::getDefaultNameGenerator(). Also names must follow |
168 | the xs::NCName standard to be valid, you can run them through | 168 | the xs::NCName standard to be valid, you can run them through |
169 | IColladaMeshWriter::toNCName to ensure that. | 169 | IColladaMeshWriter::toNCName to ensure that. |
170 | \param mesh Pointer to the mesh which needs a name | 170 | \param mesh Pointer to the mesh which needs a name |
171 | \param instance When E_COLLADA_GEOMETRY_WRITING is not ECGI_PER_MESH then | 171 | \param instance When E_COLLADA_GEOMETRY_WRITING is not ECGI_PER_MESH then |
172 | several instances of the same mesh can be written and this counts them. | 172 | several instances of the same mesh can be written and this counts them. |
173 | */ | 173 | */ |
174 | virtual irr::core::stringw nameForMesh(const scene::IMesh* mesh, int instance) = 0; | 174 | virtual irr::core::stringw nameForMesh(const scene::IMesh* mesh, int instance) = 0; |
175 | 175 | ||
176 | //! Return a unique name for the given node | 176 | //! Return a unique name for the given node |
177 | /** Note that names really must be unique here per node-pointer, so | 177 | /** Note that names really must be unique here per node-pointer, so |
178 | mostly it's a good idea to return the nameForNode from | 178 | mostly it's a good idea to return the nameForNode from |
179 | IColladaMeshWriter::getDefaultNameGenerator(). Also names must follow | 179 | IColladaMeshWriter::getDefaultNameGenerator(). Also names must follow |
180 | the xs::NCName standard to be valid, you can run them through | 180 | the xs::NCName standard to be valid, you can run them through |
181 | IColladaMeshWriter::toNCName to ensure that. | 181 | IColladaMeshWriter::toNCName to ensure that. |
182 | */ | 182 | */ |
183 | virtual irr::core::stringw nameForNode(const scene::ISceneNode* node) = 0; | 183 | virtual irr::core::stringw nameForNode(const scene::ISceneNode* node) = 0; |
184 | 184 | ||
185 | //! Return a name for the material | 185 | //! Return a name for the material |
186 | /** There is one material created in the writer for each unique name. | 186 | /** There is one material created in the writer for each unique name. |
187 | So you can use this to control the number of materials which get written. | 187 | So you can use this to control the number of materials which get written. |
188 | For example Irrlicht does by default write one material for each material | 188 | For example Irrlicht does by default write one material for each material |
189 | instanced by a node. So if you know that in your application material | 189 | instanced by a node. So if you know that in your application material |
190 | instances per node are identical between different nodes you can reduce | 190 | instances per node are identical between different nodes you can reduce |
191 | the number of exported materials using that knowledge by using identical | 191 | the number of exported materials using that knowledge by using identical |
192 | names for such shared materials. | 192 | names for such shared materials. |
193 | Names must follow the xs::NCName standard to be valid, you can run them | 193 | Names must follow the xs::NCName standard to be valid, you can run them |
194 | through IColladaMeshWriter::toNCName to ensure that. | 194 | through IColladaMeshWriter::toNCName to ensure that. |
195 | */ | 195 | */ |
196 | virtual irr::core::stringw nameForMaterial(const video::SMaterial & material, int materialId, const scene::IMesh* mesh, const scene::ISceneNode* node) = 0; | 196 | virtual irr::core::stringw nameForMaterial(const video::SMaterial & material, int materialId, const scene::IMesh* mesh, const scene::ISceneNode* node) = 0; |
197 | }; | 197 | }; |
198 | 198 | ||
199 | 199 | ||
200 | //! Interface for writing meshes | 200 | //! Interface for writing meshes |
201 | class IColladaMeshWriter : public IMeshWriter | 201 | class IColladaMeshWriter : public IMeshWriter |
202 | { | 202 | { |
203 | public: | 203 | public: |
204 | 204 | ||
205 | IColladaMeshWriter() | 205 | IColladaMeshWriter() |
206 | : Properties(0), DefaultProperties(0), NameGenerator(0), DefaultNameGenerator(0) | 206 | : Properties(0), DefaultProperties(0), NameGenerator(0), DefaultNameGenerator(0) |
207 | , WriteTextures(true), WriteDefaultScene(true), ExportSMaterialOnce(true) | 207 | , WriteTextures(true), WriteDefaultScene(true), ExportSMaterialOnce(true) |
208 | , AmbientLight(0.f, 0.f, 0.f, 1.f) | 208 | , AmbientLight(0.f, 0.f, 0.f, 1.f) |
209 | { | 209 | { |
210 | } | 210 | } |
211 | 211 | ||
212 | //! Destructor | 212 | //! Destructor |
213 | virtual ~IColladaMeshWriter() | 213 | virtual ~IColladaMeshWriter() |
214 | { | 214 | { |
215 | if ( Properties ) | 215 | if ( Properties ) |
216 | Properties->drop(); | 216 | Properties->drop(); |
217 | if ( DefaultProperties ) | 217 | if ( DefaultProperties ) |
218 | DefaultProperties->drop(); | 218 | DefaultProperties->drop(); |
219 | if ( NameGenerator ) | 219 | if ( NameGenerator ) |
220 | NameGenerator->drop(); | 220 | NameGenerator->drop(); |
221 | if ( DefaultNameGenerator ) | 221 | if ( DefaultNameGenerator ) |
222 | DefaultNameGenerator->drop(); | 222 | DefaultNameGenerator->drop(); |
223 | } | 223 | } |
224 | 224 | ||
225 | //! writes a scene starting with the given node | 225 | //! writes a scene starting with the given node |
226 | virtual bool writeScene(io::IWriteFile* file, scene::ISceneNode* root) = 0; | 226 | virtual bool writeScene(io::IWriteFile* file, scene::ISceneNode* root) = 0; |
227 | 227 | ||
228 | 228 | ||
229 | //! Set if texture information should be written | 229 | //! Set if texture information should be written |
230 | virtual void setWriteTextures(bool write) | 230 | virtual void setWriteTextures(bool write) |
231 | { | 231 | { |
232 | WriteTextures = write; | 232 | WriteTextures = write; |
233 | } | 233 | } |
234 | 234 | ||
235 | //! Get if texture information should be written | 235 | //! Get if texture information should be written |
236 | virtual bool getWriteTextures() const | 236 | virtual bool getWriteTextures() const |
237 | { | 237 | { |
238 | return WriteTextures; | 238 | return WriteTextures; |
239 | } | 239 | } |
240 | 240 | ||
241 | //! Set if a default scene should be written when writing meshes. | 241 | //! Set if a default scene should be written when writing meshes. |
242 | /** Many collada readers fail to read a mesh if the collada files doesn't contain a scene as well. | 242 | /** Many collada readers fail to read a mesh if the collada files doesn't contain a scene as well. |
243 | The scene is doing an instantiation of the mesh. | 243 | The scene is doing an instantiation of the mesh. |
244 | When using writeScene this flag is ignored (as we have scene there already) | 244 | When using writeScene this flag is ignored (as we have scene there already) |
245 | */ | 245 | */ |
246 | virtual void setWriteDefaultScene(bool write) | 246 | virtual void setWriteDefaultScene(bool write) |
247 | { | 247 | { |
248 | WriteDefaultScene = write; | 248 | WriteDefaultScene = write; |
249 | } | 249 | } |
250 | 250 | ||
251 | //! Get if a default scene should be written | 251 | //! Get if a default scene should be written |
252 | virtual bool getWriteDefaultScene() const | 252 | virtual bool getWriteDefaultScene() const |
253 | { | 253 | { |
254 | return WriteDefaultScene; | 254 | return WriteDefaultScene; |
255 | } | 255 | } |
256 | 256 | ||
257 | //! Sets ambient color of the scene to write | 257 | //! Sets ambient color of the scene to write |
258 | virtual void setAmbientLight(const video::SColorf &ambientColor) | 258 | virtual void setAmbientLight(const video::SColorf &ambientColor) |
259 | { | 259 | { |
260 | AmbientLight = ambientColor; | 260 | AmbientLight = ambientColor; |
261 | } | 261 | } |
262 | 262 | ||
263 | //! Return ambient light of the scene which is written | 263 | //! Return ambient light of the scene which is written |
264 | virtual video::SColorf getAmbientLight() const | 264 | virtual video::SColorf getAmbientLight() const |
265 | { | 265 | { |
266 | return AmbientLight; | 266 | return AmbientLight; |
267 | } | 267 | } |
268 | 268 | ||
269 | //! Control when and how often a mesh is written | 269 | //! Control when and how often a mesh is written |
270 | /** Optimally ECGI_PER_MESH would be always sufficent - writing geometry once per mesh. | 270 | /** Optimally ECGI_PER_MESH would be always sufficent - writing geometry once per mesh. |
271 | Unfortunately many tools (at the time of writing this nearly all of them) have trouble | 271 | Unfortunately many tools (at the time of writing this nearly all of them) have trouble |
272 | on import when different materials are used per node. So when you override materials | 272 | on import when different materials are used per node. So when you override materials |
273 | per node and importing the resuling collada has materials problems in other tools try | 273 | per node and importing the resuling collada has materials problems in other tools try |
274 | using other values here. | 274 | using other values here. |
275 | \param writeStyle One of the E_COLLADA_GEOMETRY_WRITING settings. | 275 | \param writeStyle One of the E_COLLADA_GEOMETRY_WRITING settings. |
276 | */ | 276 | */ |
277 | virtual void setGeometryWriting(E_COLLADA_GEOMETRY_WRITING writeStyle) | 277 | virtual void setGeometryWriting(E_COLLADA_GEOMETRY_WRITING writeStyle) |
278 | { | 278 | { |
279 | GeometryWriting = writeStyle; | 279 | GeometryWriting = writeStyle; |
280 | } | 280 | } |
281 | 281 | ||
282 | //! Get the current style of geometry writing. | 282 | //! Get the current style of geometry writing. |
283 | virtual E_COLLADA_GEOMETRY_WRITING getGeometryWriting() const | 283 | virtual E_COLLADA_GEOMETRY_WRITING getGeometryWriting() const |
284 | { | 284 | { |
285 | return GeometryWriting; | 285 | return GeometryWriting; |
286 | } | 286 | } |
287 | 287 | ||
288 | //! Make certain there is only one collada material generated per Irrlicht material | 288 | //! Make certain there is only one collada material generated per Irrlicht material |
289 | /** Checks before creating a collada material-name if an identical | 289 | /** Checks before creating a collada material-name if an identical |
290 | irr:::video::SMaterial has been exported already. If so don't export it with | 290 | irr:::video::SMaterial has been exported already. If so don't export it with |
291 | another name. This is set by default and leads to way smaller .dae files. | 291 | another name. This is set by default and leads to way smaller .dae files. |
292 | Note that if you need to disable this flag for some reason you can still | 292 | Note that if you need to disable this flag for some reason you can still |
293 | get a similar effect using the IColladaMeshWriterNames::nameForMaterial | 293 | get a similar effect using the IColladaMeshWriterNames::nameForMaterial |
294 | by returning identical names for identical materials there. | 294 | by returning identical names for identical materials there. |
295 | */ | 295 | */ |
296 | virtual void setExportSMaterialsOnlyOnce(bool exportOnce) | 296 | virtual void setExportSMaterialsOnlyOnce(bool exportOnce) |
297 | { | 297 | { |
298 | ExportSMaterialOnce = exportOnce; | 298 | ExportSMaterialOnce = exportOnce; |
299 | } | 299 | } |
300 | 300 | ||
301 | virtual bool getExportSMaterialsOnlyOnce() const | 301 | virtual bool getExportSMaterialsOnlyOnce() const |
302 | { | 302 | { |
303 | return ExportSMaterialOnce; | 303 | return ExportSMaterialOnce; |
304 | } | 304 | } |
305 | 305 | ||
306 | //! Set properties to use by the meshwriter instead of it's default properties. | 306 | //! Set properties to use by the meshwriter instead of it's default properties. |
307 | /** Overloading properties with an own class allows modifying the writing process in certain ways. | 307 | /** Overloading properties with an own class allows modifying the writing process in certain ways. |
308 | By default properties are set to the DefaultProperties. */ | 308 | By default properties are set to the DefaultProperties. */ |
309 | virtual void setProperties(IColladaMeshWriterProperties * p) | 309 | virtual void setProperties(IColladaMeshWriterProperties * p) |
310 | { | 310 | { |
311 | if ( p == Properties ) | 311 | if ( p == Properties ) |
312 | return; | 312 | return; |
313 | if ( p ) | 313 | if ( p ) |
314 | p->grab(); | 314 | p->grab(); |
315 | if ( Properties ) | 315 | if ( Properties ) |
316 | Properties->drop(); | 316 | Properties->drop(); |
317 | Properties = p; | 317 | Properties = p; |
318 | } | 318 | } |
319 | 319 | ||
320 | //! Get properties which are currently used. | 320 | //! Get properties which are currently used. |
321 | virtual IColladaMeshWriterProperties * getProperties() const | 321 | virtual IColladaMeshWriterProperties * getProperties() const |
322 | { | 322 | { |
323 | return Properties; | 323 | return Properties; |
324 | } | 324 | } |
325 | 325 | ||
326 | //! Return the original default properties of the writer. | 326 | //! Return the original default properties of the writer. |
327 | /** You can use this pointer in your own properties to access and return default values. */ | 327 | /** You can use this pointer in your own properties to access and return default values. */ |
328 | IColladaMeshWriterProperties * getDefaultProperties() const | 328 | IColladaMeshWriterProperties * getDefaultProperties() const |
329 | { | 329 | { |
330 | return DefaultProperties; | 330 | return DefaultProperties; |
331 | } | 331 | } |
332 | 332 | ||
333 | //! Install a generator to create custom names on export. | 333 | //! Install a generator to create custom names on export. |
334 | virtual void setNameGenerator(IColladaMeshWriterNames * nameGenerator) | 334 | virtual void setNameGenerator(IColladaMeshWriterNames * nameGenerator) |
335 | { | 335 | { |
336 | if ( nameGenerator == NameGenerator ) | 336 | if ( nameGenerator == NameGenerator ) |
337 | return; | 337 | return; |
338 | if ( nameGenerator ) | 338 | if ( nameGenerator ) |
339 | nameGenerator->grab(); | 339 | nameGenerator->grab(); |
340 | if ( NameGenerator ) | 340 | if ( NameGenerator ) |
341 | NameGenerator->drop(); | 341 | NameGenerator->drop(); |
342 | NameGenerator = nameGenerator; | 342 | NameGenerator = nameGenerator; |
343 | } | 343 | } |
344 | 344 | ||
345 | //! Get currently used name generator | 345 | //! Get currently used name generator |
346 | virtual IColladaMeshWriterNames * getNameGenerator() const | 346 | virtual IColladaMeshWriterNames * getNameGenerator() const |
347 | { | 347 | { |
348 | return NameGenerator; | 348 | return NameGenerator; |
349 | } | 349 | } |
350 | 350 | ||
351 | //! Return the original default name generator of the writer. | 351 | //! Return the original default name generator of the writer. |
352 | /** You can use this pointer in your own generator to access and return default values. */ | 352 | /** You can use this pointer in your own generator to access and return default values. */ |
353 | IColladaMeshWriterNames * getDefaultNameGenerator() const | 353 | IColladaMeshWriterNames * getDefaultNameGenerator() const |
354 | { | 354 | { |
355 | return DefaultNameGenerator; | 355 | return DefaultNameGenerator; |
356 | } | 356 | } |
357 | 357 | ||
358 | //! Restrict the characters of oldString a set of allowed characters in xs::NCName and add the prefix. | 358 | //! Restrict the characters of oldString a set of allowed characters in xs::NCName and add the prefix. |
359 | /** A tool function to help when using a custom name generator to generative valid names for collada names and id's. */ | 359 | /** A tool function to help when using a custom name generator to generative valid names for collada names and id's. */ |
360 | virtual irr::core::stringw toNCName(const irr::core::stringw& oldString, const irr::core::stringw& prefix=irr::core::stringw(L"_NC_")) const = 0; | 360 | virtual irr::core::stringw toNCName(const irr::core::stringw& oldString, const irr::core::stringw& prefix=irr::core::stringw(L"_NC_")) const = 0; |
361 | 361 | ||
362 | 362 | ||
363 | protected: | 363 | protected: |
364 | // NOTE: You usually should also call setProperties with the same paraemter when using setDefaultProperties | 364 | // NOTE: You usually should also call setProperties with the same paraemter when using setDefaultProperties |
365 | virtual void setDefaultProperties(IColladaMeshWriterProperties * p) | 365 | virtual void setDefaultProperties(IColladaMeshWriterProperties * p) |
366 | { | 366 | { |
367 | if ( p == DefaultProperties ) | 367 | if ( p == DefaultProperties ) |
368 | return; | 368 | return; |
369 | if ( p ) | 369 | if ( p ) |
370 | p->grab(); | 370 | p->grab(); |
371 | if ( DefaultProperties ) | 371 | if ( DefaultProperties ) |
372 | DefaultProperties->drop(); | 372 | DefaultProperties->drop(); |
373 | DefaultProperties = p; | 373 | DefaultProperties = p; |
374 | } | 374 | } |
375 | 375 | ||
376 | // NOTE: You usually should also call setNameGenerator with the same paraemter when using setDefaultProperties | 376 | // NOTE: You usually should also call setNameGenerator with the same paraemter when using setDefaultProperties |
377 | virtual void setDefaultNameGenerator(IColladaMeshWriterNames * p) | 377 | virtual void setDefaultNameGenerator(IColladaMeshWriterNames * p) |
378 | { | 378 | { |
379 | if ( p == DefaultNameGenerator ) | 379 | if ( p == DefaultNameGenerator ) |
380 | return; | 380 | return; |
381 | if ( p ) | 381 | if ( p ) |
382 | p->grab(); | 382 | p->grab(); |
383 | if ( DefaultNameGenerator ) | 383 | if ( DefaultNameGenerator ) |
384 | DefaultNameGenerator->drop(); | 384 | DefaultNameGenerator->drop(); |
385 | DefaultNameGenerator = p; | 385 | DefaultNameGenerator = p; |
386 | } | 386 | } |
387 | 387 | ||
388 | private: | 388 | private: |
389 | IColladaMeshWriterProperties * Properties; | 389 | IColladaMeshWriterProperties * Properties; |
390 | IColladaMeshWriterProperties * DefaultProperties; | 390 | IColladaMeshWriterProperties * DefaultProperties; |
391 | IColladaMeshWriterNames * NameGenerator; | 391 | IColladaMeshWriterNames * NameGenerator; |
392 | IColladaMeshWriterNames * DefaultNameGenerator; | 392 | IColladaMeshWriterNames * DefaultNameGenerator; |
393 | bool WriteTextures; | 393 | bool WriteTextures; |
394 | bool WriteDefaultScene; | 394 | bool WriteDefaultScene; |
395 | bool ExportSMaterialOnce; | 395 | bool ExportSMaterialOnce; |
396 | video::SColorf AmbientLight; | 396 | video::SColorf AmbientLight; |
397 | E_COLLADA_GEOMETRY_WRITING GeometryWriting; | 397 | E_COLLADA_GEOMETRY_WRITING GeometryWriting; |
398 | }; | 398 | }; |
399 | 399 | ||
400 | 400 | ||
401 | } // end namespace | 401 | } // end namespace |
402 | } // end namespace | 402 | } // end namespace |
403 | 403 | ||
404 | #endif | 404 | #endif |