Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef LoadWriterDae_INCLUDE_ONCE
00033 #define LoadWriterDae_INCLUDE_ONCE
00034
00035 #include <vlGraphics/link_config.hpp>
00036 #include <vlCore/VirtualFile.hpp>
00037 #include <vlCore/ResourceLoadWriter.hpp>
00038 #include <vlCore/ResourceDatabase.hpp>
00039
00040 namespace vl
00041 {
00042
00043
00044
00048 class LoadWriterDae: public ResourceLoadWriter
00049 {
00050 VL_INSTRUMENT_CLASS(vl::LoadWriterDae, ResourceLoadWriter)
00051
00052 public:
00054 class LoadOptions: public Object
00055 {
00056 public:
00057 enum TransparencyOption
00058 {
00059 TransparencyKeep,
00060 TransparencyInvert,
00061 TransparencyAuto
00062 };
00063
00064 public:
00065 LoadOptions()
00066 {
00067 mInvertTransparency = TransparencyAuto;
00068 mUseAlwaysMipmapping = true;
00069 mFlattenTransformHierarchy = true;
00070 mComputeMissingNormals = true;
00071 mFixBadNormals = true;
00072 mMergeDrawCalls = true;
00073 mExtractSkins = false;
00074 mLightMeshSize = 0;
00075 mExportLights = false;
00076 }
00077
00079 void setFlattenTransformHierarchy(bool flatten) { mFlattenTransformHierarchy = flatten; }
00080
00082 bool flattenTransformHierarchy() const { return mFlattenTransformHierarchy; }
00083
00085 void setUseAlwaysMipmapping(bool use) { mUseAlwaysMipmapping = use; }
00086
00088 bool useAlwaysMipmapping() const { return mUseAlwaysMipmapping; }
00089
00091 void setInvertTransparency(TransparencyOption invert) { mInvertTransparency = invert; }
00092
00094 TransparencyOption invertTransparency() const { return mInvertTransparency; }
00095
00097 void setComputeMissingNormals(bool compute) { mComputeMissingNormals = compute; }
00098
00100 bool computeMissingNormals() const { return mComputeMissingNormals; }
00101
00103 void setFixBadNormals(bool fix) { mFixBadNormals = fix; }
00104
00106 bool fixBadNormals() const { return mFixBadNormals; }
00107
00109 void setExtractSkins(bool extract) { mExtractSkins = extract; }
00110
00112 bool extractSkins() const { return mExtractSkins; }
00113
00115 void setMergeDrawCalls(bool merge) { mMergeDrawCalls = merge; }
00116
00118 bool mergeDrawCalls() const { return mMergeDrawCalls; }
00119
00123 void setLightMeshSize(float size) { mLightMeshSize = size; }
00124
00128 float lightMeshSize() const { return mLightMeshSize; }
00129
00131 void setExportLights(bool exp_lights) { mExportLights = exp_lights; }
00132
00134 bool exportLights() const { return mExportLights; }
00135
00136 protected:
00137 TransparencyOption mInvertTransparency;
00138 bool mFlattenTransformHierarchy;
00139 bool mUseAlwaysMipmapping;
00140 bool mComputeMissingNormals;
00141 bool mFixBadNormals;
00142 bool mExtractSkins;
00143 bool mMergeDrawCalls;
00144 float mLightMeshSize;
00145 bool mExportLights;
00146 };
00147
00148 public:
00149 static VLGRAPHICS_EXPORT ref<ResourceDatabase> load(const String& path, const LoadOptions* options);
00150
00151 static VLGRAPHICS_EXPORT ref<ResourceDatabase> load(VirtualFile* file, const LoadOptions* options);
00152
00153 LoadWriterDae(): ResourceLoadWriter("|dae|", "|dae|")
00154 {
00155 mLoadOptions = new LoadOptions;
00156 }
00157
00158 ref<ResourceDatabase> loadResource(const String& path) const
00159 {
00160 return load(path, loadOptions());
00161 }
00162
00163 ref<ResourceDatabase> loadResource(VirtualFile* file) const
00164 {
00165 return load(file, loadOptions());
00166 }
00167
00169 bool writeResource(const String& , ResourceDatabase* ) const
00170 {
00171 return false;
00172 }
00173
00175 bool writeResource(VirtualFile* , ResourceDatabase* ) const
00176 {
00177 return false;
00178 }
00179
00180
00181
00182 const LoadOptions* loadOptions() const { return mLoadOptions.get(); }
00183
00184 LoadOptions* loadOptions() { return mLoadOptions.get(); }
00185
00186 protected:
00187 ref<LoadOptions> mLoadOptions;
00188 };
00189
00190 }
00191
00192 #endif