Visualization Library 2.1.0

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
ioDae.hpp
Go to the documentation of this file.
1 /**************************************************************************************/
2 /* */
3 /* Visualization Library */
4 /* http://visualizationlibrary.org */
5 /* */
6 /* Copyright (c) 2005-2020, Michele Bosi */
7 /* All rights reserved. */
8 /* */
9 /* Redistribution and use in source and binary forms, with or without modification, */
10 /* are permitted provided that the following conditions are met: */
11 /* */
12 /* - Redistributions of source code must retain the above copyright notice, this */
13 /* list of conditions and the following disclaimer. */
14 /* */
15 /* - Redistributions in binary form must reproduce the above copyright notice, this */
16 /* list of conditions and the following disclaimer in the documentation and/or */
17 /* other materials provided with the distribution. */
18 /* */
19 /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND */
20 /* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED */
21 /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
22 /* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR */
23 /* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
24 /* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
25 /* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
26 /* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
27 /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
28 /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
29 /* */
30 /**************************************************************************************/
31 
32 #ifndef LoadWriterDae_INCLUDE_ONCE
33 #define LoadWriterDae_INCLUDE_ONCE
34 
36 #include <vlCore/VirtualFile.hpp>
39 
40 namespace vl
41 {
42 //---------------------------------------------------------------------------
43 // LoadWriterDae
44 //---------------------------------------------------------------------------
49  {
51 
52  public:
54  class LoadOptions: public Object
55  {
56  public:
58  {
62  };
63 
64  public:
66  {
68  mUseAlwaysMipmapping = true;
71  mFixBadNormals = true;
72  mMergeDrawCalls = true;
73  mExtractSkins = false;
74  mLightMeshSize = 0;
75  mExportLights = false;
76  }
77 
79  void setFlattenTransformHierarchy(bool flatten) { mFlattenTransformHierarchy = flatten; }
80 
83 
85  void setUseAlwaysMipmapping(bool use) { mUseAlwaysMipmapping = use; }
86 
88  bool useAlwaysMipmapping() const { return mUseAlwaysMipmapping; }
89 
92 
95 
97  void setComputeMissingNormals(bool compute) { mComputeMissingNormals = compute; }
98 
101 
103  void setFixBadNormals(bool fix) { mFixBadNormals = fix; }
104 
106  bool fixBadNormals() const { return mFixBadNormals; }
107 
109  void setExtractSkins(bool extract) { mExtractSkins = extract; }
110 
112  bool extractSkins() const { return mExtractSkins; }
113 
115  void setMergeDrawCalls(bool merge) { mMergeDrawCalls = merge; }
116 
118  bool mergeDrawCalls() const { return mMergeDrawCalls; }
119 
123  void setLightMeshSize(float size) { mLightMeshSize = size; }
124 
128  float lightMeshSize() const { return mLightMeshSize; }
129 
131  void setExportLights(bool exp_lights) { mExportLights = exp_lights; }
132 
134  bool exportLights() const { return mExportLights; }
135 
136  protected:
146  };
147 
148  public:
149  static VLGRAPHICS_EXPORT ref<ResourceDatabase> load(const String& path, const LoadOptions* options);
150 
152 
153  LoadWriterDae(): ResourceLoadWriter("|dae|", "|dae|")
154  {
156  }
157 
159  {
160  return load(path, loadOptions());
161  }
162 
164  {
165  return load(file, loadOptions());
166  }
167 
169  bool writeResource(const String& /*path*/, ResourceDatabase* /*resource*/) const
170  {
171  return false;
172  }
173 
175  bool writeResource(VirtualFile* /*file*/, ResourceDatabase* /*resource*/) const
176  {
177  return false;
178  }
179 
180  // --- options ---
181 
182  const LoadOptions* loadOptions() const { return mLoadOptions.get(); }
183 
184  LoadOptions* loadOptions() { return mLoadOptions.get(); }
185 
186  protected:
188  };
189 //---------------------------------------------------------------------------
190 }
191 
192 #endif
bool extractSkins() const
If set to true the skinned geometries will be also exported. Enabled by default.
Definition: ioDae.hpp:112
TransparencyOption mInvertTransparency
Definition: ioDae.hpp:137
bool useAlwaysMipmapping() const
If true then TPF_LINEAR_MIPMAP_NEAREST filtering is used when a non-mipmapped filter is specified...
Definition: ioDae.hpp:88
void setExtractSkins(bool extract)
If set to true the skinned geometries will be also exported. Enabled by default.
Definition: ioDae.hpp:109
void setFixBadNormals(bool fix)
Fix normals that are flipped compared to the polygon winding order. Enabled by default.
Definition: ioDae.hpp:103
An abstract class representing a file.
Definition: VirtualFile.hpp:60
< Transparency becomes 1.0 - <transparency>.
Definition: ioDae.hpp:60
void setExportLights(bool exp_lights)
If true the lights contained in the COLLADA file will be exported otherwise one single dummy light wi...
Definition: ioDae.hpp:131
bool flattenTransformHierarchy() const
If true the <node>&#39;s transform hierachy is flattened and baked inside the Actor::transform(), otherwise the full transform tree is exported. Enabled by default.
Definition: ioDae.hpp:82
void setFlattenTransformHierarchy(bool flatten)
If true the <node>&#39;s transform hierachy is flattened and baked inside the Actor::transform(), otherwise the full transform tree is exported. Enabled by default.
Definition: ioDae.hpp:79
The String class implements an advanced UTF16 (Unicode BMP) string manipulation engine.
Definition: String.hpp:62
LoadOptions * loadOptions()
Definition: ioDae.hpp:184
bool writeResource(VirtualFile *, ResourceDatabase *) const
Not supported yet.
Definition: ioDae.hpp:175
void setComputeMissingNormals(bool compute)
Compute normals for those objects that don&#39;t have. Enabled by default.
Definition: ioDae.hpp:97
< Transparency is inverted if <authoring_tool> contains the string "Google" or reports ColladaMax or ...
Definition: ioDae.hpp:61
const LoadOptions * loadOptions() const
Definition: ioDae.hpp:182
#define VL_INSTRUMENT_CLASS(ClassName, BaseClass)
Definition: TypeInfo.hpp:122
bool exportLights() const
If true the lights contained in the COLLADA file will be exported otherwise one single dummy light wi...
Definition: ioDae.hpp:134
static VLGRAPHICS_EXPORT ref< ResourceDatabase > load(const String &path, const LoadOptions *options)
Definition: ioDae.cpp:38
Visualization Library main namespace.
The LoadWriterDae class is a ResourceLoadWriter capable of reading COLLADA files. ...
Definition: ioDae.hpp:48
ref< ResourceDatabase > loadResource(const String &path) const
Definition: ioDae.hpp:158
bool computeMissingNormals() const
Compute normals for those objects that don&#39;t have. Enabled by default.
Definition: ioDae.hpp:100
TransparencyOption invertTransparency() const
Invert the value of the <transparency> tag. Set to TransparencyAuto by default.
Definition: ioDae.hpp:94
bool mergeDrawCalls() const
If set to true merges all the draw calls of each Geometry into one triangle and/or one triangle strip...
Definition: ioDae.hpp:118
void setUseAlwaysMipmapping(bool use)
If true then TPF_LINEAR_MIPMAP_NEAREST filtering is used when a non-mipmapped filter is specified...
Definition: ioDae.hpp:85
void setMergeDrawCalls(bool merge)
If set to true merges all the draw calls of each Geometry into one triangle and/or one triangle strip...
Definition: ioDae.hpp:115
The base class for all the reference counted objects.
Definition: Object.hpp:158
void setLightMeshSize(float size)
If size != 0 a mesh will be generated and exported for each light source.
Definition: ioDae.hpp:123
Loading options used by LoadWriterDae and DaeLoader.
Definition: ioDae.hpp:54
ref< LoadOptions > mLoadOptions
Definition: ioDae.hpp:187
< Keep the <transparency> value as it is.
Definition: ioDae.hpp:59
bool fixBadNormals() const
Fix normals that are flipped compared to the polygon winding order. Enabled by default.
Definition: ioDae.hpp:106
ref< ResourceDatabase > loadResource(VirtualFile *file) const
Definition: ioDae.hpp:163
The ref<> class is used to reference-count an Object.
Definition: Object.hpp:55
void setInvertTransparency(TransparencyOption invert)
Invert the value of the <transparency> tag. Set to TransparencyAuto by default.
Definition: ioDae.hpp:91
bool writeResource(const String &, ResourceDatabase *) const
Not supported yet.
Definition: ioDae.hpp:169
The ResourceLoadWriter class is an abstract class used to implement read/write support for one or mor...
float lightMeshSize() const
If size != 0 a mesh will be generated and exported for each light source.
Definition: ioDae.hpp:128
The ResourceDatabase class contains and manipulates a set of resources.