OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009, Google Inc. | 2 * Copyright 2009, Google Inc. |
3 * All rights reserved. | 3 * All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 class FCDImage; | 59 class FCDImage; |
60 class FCDTMatrix; | 60 class FCDTMatrix; |
61 class FCDTTranslation; | 61 class FCDTTranslation; |
62 class FCDTRotation; | 62 class FCDTRotation; |
63 class FCDTScale; | 63 class FCDTScale; |
64 | 64 |
65 class FilePath; | 65 class FilePath; |
66 | 66 |
67 namespace o3d { | 67 namespace o3d { |
68 | 68 |
| 69 class ClassManager; |
69 class ColladaZipArchive; | 70 class ColladaZipArchive; |
70 class Effect; | 71 class Effect; |
71 class IErrorStatus; | 72 class IErrorStatus; |
72 class Material; | 73 class Material; |
73 class Pack; | 74 class Pack; |
74 class ParamObject; | 75 class ParamObject; |
75 class Sampler; | 76 class Sampler; |
76 class ShaderBuilderHelper; | 77 class ShaderBuilderHelper; |
77 class Shape; | 78 class Shape; |
78 class State; | 79 class State; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 bool ImportFile(const FilePath& filename, Transform* parent, | 215 bool ImportFile(const FilePath& filename, Transform* parent, |
215 ParamFloat* animation_input); | 216 ParamFloat* animation_input); |
216 | 217 |
217 // Access to the filenames of the original data for texture and | 218 // Access to the filenames of the original data for texture and |
218 // sound assets imported when ImportFile was called. These will | 219 // sound assets imported when ImportFile was called. These will |
219 // only return results after an import if the keep_original_data | 220 // only return results after an import if the keep_original_data |
220 // option was set to true when the Collada object was created. | 221 // option was set to true when the Collada object was created. |
221 std::vector<FilePath> GetOriginalDataFilenames() const; | 222 std::vector<FilePath> GetOriginalDataFilenames() const; |
222 const std::string& GetOriginalData(const FilePath& filename) const; | 223 const std::string& GetOriginalData(const FilePath& filename) const; |
223 | 224 |
| 225 // Init the Collada Importer. |
| 226 static void Init(ServiceLocator* service_locator); |
| 227 |
224 private: | 228 private: |
225 // Imports the given ZIP file into the given pack. | 229 // Imports the given ZIP file into the given pack. |
226 bool ImportZIP(const FilePath& filename, Transform* parent, | 230 bool ImportZIP(const FilePath& filename, Transform* parent, |
227 ParamFloat* animation_input); | 231 ParamFloat* animation_input); |
228 | 232 |
229 // Imports the given COLLADA file (.DAE) into the current pack. | 233 // Imports the given COLLADA file (.DAE) into the current pack. |
230 bool ImportDAE(const FilePath& filename, | 234 bool ImportDAE(const FilePath& filename, |
231 Transform* parent, | 235 Transform* parent, |
232 ParamFloat* animation_input); | 236 ParamFloat* animation_input); |
233 | 237 |
234 // Imports the given FCDocument (already loaded) into the current pack. | 238 // Imports the given FCDocument (already loaded) into the current pack. |
235 bool ImportDAEDocument(FCDocument* doc, | 239 bool ImportDAEDocument(FCDocument* doc, |
236 bool fc_status, | 240 bool fc_status, |
237 Transform* parent, | 241 Transform* parent, |
238 ParamFloat* animation_input); | 242 ParamFloat* animation_input); |
239 | 243 |
240 // Creates the instance tree corresponding to the collada scene node DAG. | 244 // Creates the instance tree corresponding to the collada scene node DAG. |
241 // A separate NodeInstance is created every time a particular node is | 245 // A separate NodeInstance is created every time a particular node is |
242 // traversed. The caller must destroy the returned NodeInstance. | 246 // traversed. The caller must destroy the returned NodeInstance. |
243 static NodeInstance *CreateInstanceTree(FCDSceneNode *node); | 247 static NodeInstance *CreateInstanceTree(FCDSceneNode *node); |
244 | 248 |
245 // Recursively imports a tree of nodes from FCollada, rooted at the | 249 // Recursively imports a tree of nodes from FCollada, rooted at the |
246 // given node, into the O3D scene. | 250 // given node, into the O3D scene. |
247 void ImportTree(NodeInstance *instance, | 251 bool ImportTree(NodeInstance *instance, |
248 Transform* parent, | 252 Transform* parent, |
249 ParamFloat* animation_input); | 253 ParamFloat* animation_input); |
250 | 254 |
251 // Recursively imports a tree of instances (shapes, etc..) from FCollada, | 255 // Recursively imports a tree of instances (shapes, etc..) from FCollada, |
252 // rooted at the given node, into the O3D scene. This is a separate step | 256 // rooted at the given node, into the O3D scene. This is a separate step |
253 // from ImportTree because various kinds of instances can reference other | 257 // from ImportTree because various kinds of instances can reference other |
254 // parts of the tree. | 258 // parts of the tree. |
255 void ImportTreeInstances(FCDocument* doc, | 259 bool ImportTreeInstances(FCDocument* doc, |
256 NodeInstance* instance); | 260 NodeInstance* instance); |
257 | 261 |
258 bool BuildFloatAnimation(ParamFloat* result, | 262 bool BuildFloatAnimation(ParamFloat* result, |
259 FCDAnimated* animated, | 263 FCDAnimated* animated, |
260 const char* qualifier, | 264 const char* qualifier, |
261 ParamFloat* animation_input, | 265 ParamFloat* animation_input, |
262 float output_scale, | 266 float output_scale, |
263 float default_value); | 267 float default_value); |
264 | 268 |
265 bool BuildFloat3Animation(ParamFloat3* result, FCDAnimated* animated, | 269 bool BuildFloat3Animation(ParamFloat3* result, FCDAnimated* animated, |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 bool cull_enabled_; | 458 bool cull_enabled_; |
455 bool cull_front_; | 459 bool cull_front_; |
456 bool front_cw_; | 460 bool front_cw_; |
457 | 461 |
458 int unique_filename_counter_; | 462 int unique_filename_counter_; |
459 | 463 |
460 DISALLOW_COPY_AND_ASSIGN(Collada); | 464 DISALLOW_COPY_AND_ASSIGN(Collada); |
461 }; | 465 }; |
462 } | 466 } |
463 #endif // O3D_IMPORT_CROSS_COLLADA_H_ | 467 #endif // O3D_IMPORT_CROSS_COLLADA_H_ |
OLD | NEW |