vrshoot
diff libs/assimp/FBXDocument.h @ 0:b2f14e535253
initial commit
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 01 Feb 2014 19:58:19 +0200 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/libs/assimp/FBXDocument.h Sat Feb 01 19:58:19 2014 +0200 1.3 @@ -0,0 +1,1325 @@ 1.4 +/* 1.5 +Open Asset Import Library (assimp) 1.6 +---------------------------------------------------------------------- 1.7 + 1.8 +Copyright (c) 2006-2012, assimp team 1.9 +All rights reserved. 1.10 + 1.11 +Redistribution and use of this software in source and binary forms, 1.12 +with or without modification, are permitted provided that the 1.13 +following conditions are met: 1.14 + 1.15 +* Redistributions of source code must retain the above 1.16 + copyright notice, this list of conditions and the 1.17 + following disclaimer. 1.18 + 1.19 +* Redistributions in binary form must reproduce the above 1.20 + copyright notice, this list of conditions and the 1.21 + following disclaimer in the documentation and/or other 1.22 + materials provided with the distribution. 1.23 + 1.24 +* Neither the name of the assimp team, nor the names of its 1.25 + contributors may be used to endorse or promote products 1.26 + derived from this software without specific prior 1.27 + written permission of the assimp team. 1.28 + 1.29 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1.30 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1.31 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1.32 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 1.33 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 1.34 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 1.35 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 1.36 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 1.37 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 1.38 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 1.39 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 1.40 + 1.41 +---------------------------------------------------------------------- 1.42 +*/ 1.43 + 1.44 +/** @file FBXDocument.h 1.45 + * @brief FBX DOM 1.46 + */ 1.47 +#ifndef INCLUDED_AI_FBX_DOCUMENT_H 1.48 +#define INCLUDED_AI_FBX_DOCUMENT_H 1.49 + 1.50 +#include <vector> 1.51 +#include <map> 1.52 +#include <string> 1.53 + 1.54 +#include "FBXProperties.h" 1.55 + 1.56 +namespace Assimp { 1.57 +namespace FBX { 1.58 + 1.59 + class Parser; 1.60 + class Object; 1.61 + struct ImportSettings; 1.62 + 1.63 + class PropertyTable; 1.64 + class Document; 1.65 + class Material; 1.66 + class Geometry; 1.67 + 1.68 + class AnimationCurve; 1.69 + class AnimationCurveNode; 1.70 + class AnimationLayer; 1.71 + class AnimationStack; 1.72 + 1.73 + class Skin; 1.74 + class Cluster; 1.75 + 1.76 + 1.77 +/** Represents a delay-parsed FBX objects. Many objects in the scene 1.78 + * are not needed by assimp, so it makes no sense to parse them 1.79 + * upfront. */ 1.80 +class LazyObject 1.81 +{ 1.82 +public: 1.83 + 1.84 + LazyObject(uint64_t id, const Element& element, const Document& doc); 1.85 + ~LazyObject(); 1.86 + 1.87 +public: 1.88 + 1.89 + const Object* Get(bool dieOnError = false); 1.90 + 1.91 + template <typename T> 1.92 + const T* Get(bool dieOnError = false) { 1.93 + const Object* const ob = Get(dieOnError); 1.94 + return ob ? dynamic_cast<const T*>(ob) : NULL; 1.95 + } 1.96 + 1.97 + uint64_t ID() const { 1.98 + return id; 1.99 + } 1.100 + 1.101 + bool IsBeingConstructed() const { 1.102 + return (flags & BEING_CONSTRUCTED) != 0; 1.103 + } 1.104 + 1.105 + bool FailedToConstruct() const { 1.106 + return (flags & FAILED_TO_CONSTRUCT) != 0; 1.107 + } 1.108 + 1.109 + const Element& GetElement() const { 1.110 + return element; 1.111 + } 1.112 + 1.113 + const Document& GetDocument() const { 1.114 + return doc; 1.115 + } 1.116 + 1.117 +private: 1.118 + 1.119 + const Document& doc; 1.120 + const Element& element; 1.121 + boost::scoped_ptr<const Object> object; 1.122 + 1.123 + const uint64_t id; 1.124 + 1.125 + enum Flags { 1.126 + BEING_CONSTRUCTED = 0x1, 1.127 + FAILED_TO_CONSTRUCT = 0x2 1.128 + }; 1.129 + 1.130 + unsigned int flags; 1.131 +}; 1.132 + 1.133 + 1.134 + 1.135 +/** Base class for in-memory (DOM) representations of FBX objects */ 1.136 +class Object 1.137 +{ 1.138 +public: 1.139 + 1.140 + Object(uint64_t id, const Element& element, const std::string& name); 1.141 + virtual ~Object(); 1.142 + 1.143 +public: 1.144 + 1.145 + const Element& SourceElement() const { 1.146 + return element; 1.147 + } 1.148 + 1.149 + const std::string& Name() const { 1.150 + return name; 1.151 + } 1.152 + 1.153 + uint64_t ID() const { 1.154 + return id; 1.155 + } 1.156 + 1.157 +protected: 1.158 + const Element& element; 1.159 + const std::string name; 1.160 + const uint64_t id; 1.161 +}; 1.162 + 1.163 + 1.164 + 1.165 +/** DOM class for generic FBX NoteAttribute blocks. NoteAttribute's just hold a property table, 1.166 + * fixed members are added by deriving classes. */ 1.167 +class NodeAttribute : public Object 1.168 +{ 1.169 +public: 1.170 + 1.171 + NodeAttribute(uint64_t id, const Element& element, const Document& doc, const std::string& name); 1.172 + ~NodeAttribute(); 1.173 + 1.174 +public: 1.175 + 1.176 + const PropertyTable& Props() const { 1.177 + ai_assert(props.get()); 1.178 + return *props.get(); 1.179 + } 1.180 + 1.181 +private: 1.182 + 1.183 + boost::shared_ptr<const PropertyTable> props; 1.184 +}; 1.185 + 1.186 + 1.187 +/** DOM base class for FBX camera settings attached to a node */ 1.188 +class CameraSwitcher : public NodeAttribute 1.189 +{ 1.190 +public: 1.191 + 1.192 + CameraSwitcher(uint64_t id, const Element& element, const Document& doc, const std::string& name); 1.193 + ~CameraSwitcher(); 1.194 + 1.195 +public: 1.196 + 1.197 + int CameraID() const { 1.198 + return cameraId; 1.199 + } 1.200 + 1.201 + const std::string& CameraName() const { 1.202 + return cameraName; 1.203 + } 1.204 + 1.205 + 1.206 + const std::string& CameraIndexName() const { 1.207 + return cameraIndexName; 1.208 + } 1.209 + 1.210 +private: 1.211 + 1.212 + int cameraId; 1.213 + std::string cameraName; 1.214 + std::string cameraIndexName; 1.215 +}; 1.216 + 1.217 + 1.218 +#define fbx_stringize(a) #a 1.219 + 1.220 +#define fbx_simple_property(name, type, default_value) \ 1.221 + type name() const { \ 1.222 + return PropertyGet<type>(Props(), fbx_stringize(name), (default_value)); \ 1.223 + } 1.224 + 1.225 +// XXX improve logging 1.226 +#define fbx_simple_enum_property(name, type, default_value) \ 1.227 + type name() const { \ 1.228 + const int ival = PropertyGet<int>(Props(), fbx_stringize(name), static_cast<int>(default_value)); \ 1.229 + if (ival < 0 || ival >= AI_CONCAT(type, _MAX)) { \ 1.230 + ai_assert(static_cast<int>(default_value) >= 0 && static_cast<int>(default_value) < AI_CONCAT(type, _MAX)); \ 1.231 + return static_cast<type>(default_value); \ 1.232 + } \ 1.233 + return static_cast<type>(ival); \ 1.234 +} 1.235 + 1.236 + 1.237 + 1.238 +/** DOM base class for FBX cameras attached to a node */ 1.239 +class Camera : public NodeAttribute 1.240 +{ 1.241 +public: 1.242 + 1.243 + Camera(uint64_t id, const Element& element, const Document& doc, const std::string& name); 1.244 + ~Camera(); 1.245 + 1.246 +public: 1.247 + 1.248 + fbx_simple_property(Position, aiVector3D, aiVector3D(0,0,0)); 1.249 + fbx_simple_property(UpVector, aiVector3D, aiVector3D(0,1,0)); 1.250 + fbx_simple_property(InterestPosition, aiVector3D, aiVector3D(0,0,0)); 1.251 + 1.252 + fbx_simple_property(AspectWidth, float, 1.0f); 1.253 + fbx_simple_property(AspectHeight, float, 1.0f); 1.254 + fbx_simple_property(FilmWidth, float, 1.0f); 1.255 + fbx_simple_property(FilmHeight, float, 1.0f); 1.256 + 1.257 + fbx_simple_property(FilmAspectRatio, float, 1.0f); 1.258 + fbx_simple_property(ApertureMode, int, 0); 1.259 + 1.260 + fbx_simple_property(FieldOfView, float, 1.0f); 1.261 + fbx_simple_property(FocalLength, float, 1.0f); 1.262 + 1.263 +private: 1.264 +}; 1.265 + 1.266 + 1.267 +/** DOM base class for FBX null markers attached to a node */ 1.268 +class Null : public NodeAttribute 1.269 +{ 1.270 +public: 1.271 + 1.272 + Null(uint64_t id, const Element& element, const Document& doc, const std::string& name); 1.273 + ~Null(); 1.274 +}; 1.275 + 1.276 + 1.277 +/** DOM base class for FBX limb node markers attached to a node */ 1.278 +class LimbNode : public NodeAttribute 1.279 +{ 1.280 +public: 1.281 + 1.282 + LimbNode(uint64_t id, const Element& element, const Document& doc, const std::string& name); 1.283 + ~LimbNode(); 1.284 +}; 1.285 + 1.286 + 1.287 +/** DOM base class for FBX lights attached to a node */ 1.288 +class Light : public NodeAttribute 1.289 +{ 1.290 +public: 1.291 + 1.292 + Light(uint64_t id, const Element& element, const Document& doc, const std::string& name); 1.293 + ~Light(); 1.294 + 1.295 +public: 1.296 + 1.297 + enum Type 1.298 + { 1.299 + Type_Point, 1.300 + Type_Directional, 1.301 + Type_Spot, 1.302 + Type_Area, 1.303 + Type_Volume, 1.304 + 1.305 + Type_MAX // end-of-enum sentinel 1.306 + }; 1.307 + 1.308 + enum Decay 1.309 + { 1.310 + Decay_None, 1.311 + Decay_Linear, 1.312 + Decay_Quadratic, 1.313 + Decay_Cubic, 1.314 + 1.315 + Decay_MAX // end-of-enum sentinel 1.316 + }; 1.317 + 1.318 +public: 1.319 + 1.320 + fbx_simple_property(Color, aiVector3D, aiVector3D(1,1,1)); 1.321 + fbx_simple_enum_property(LightType, Type, 0); 1.322 + fbx_simple_property(CastLightOnObject, bool, false); 1.323 + fbx_simple_property(DrawVolumetricLight, bool, true); 1.324 + fbx_simple_property(DrawGroundProjection, bool, true); 1.325 + fbx_simple_property(DrawFrontFacingVolumetricLight, bool, false); 1.326 + fbx_simple_property(Intensity, float, 1.0f); 1.327 + fbx_simple_property(InnerAngle, float, 0.0f); 1.328 + fbx_simple_property(OuterAngle, float, 45.0f); 1.329 + fbx_simple_property(Fog, int, 50); 1.330 + fbx_simple_enum_property(DecayType, Decay, 0); 1.331 + fbx_simple_property(DecayStart, int, 0); 1.332 + fbx_simple_property(FileName, std::string, ""); 1.333 + 1.334 + fbx_simple_property(EnableNearAttenuation, bool, false); 1.335 + fbx_simple_property(NearAttenuationStart, float, 0.0f); 1.336 + fbx_simple_property(NearAttenuationEnd, float, 0.0f); 1.337 + fbx_simple_property(EnableFarAttenuation, bool, false); 1.338 + fbx_simple_property(FarAttenuationStart, float, 0.0f); 1.339 + fbx_simple_property(FarAttenuationEnd, float, 0.0f); 1.340 + 1.341 + fbx_simple_property(CastShadows, bool, true); 1.342 + fbx_simple_property(ShadowColor, aiVector3D, aiVector3D(0,0,0)); 1.343 + 1.344 + fbx_simple_property(AreaLightShape, int, 0); 1.345 + 1.346 + fbx_simple_property(LeftBarnDoor, float, 20.0f); 1.347 + fbx_simple_property(RightBarnDoor, float, 20.0f); 1.348 + fbx_simple_property(TopBarnDoor, float, 20.0f); 1.349 + fbx_simple_property(BottomBarnDoor, float, 20.0f); 1.350 + fbx_simple_property(EnableBarnDoor, bool, true); 1.351 + 1.352 + 1.353 +private: 1.354 +}; 1.355 + 1.356 + 1.357 +/** DOM base class for FBX models (even though its semantics are more "node" than "model" */ 1.358 +class Model : public Object 1.359 +{ 1.360 +public: 1.361 + 1.362 + Model(uint64_t id, const Element& element, const Document& doc, const std::string& name); 1.363 + ~Model(); 1.364 + 1.365 +public: 1.366 + 1.367 + enum RotOrder 1.368 + { 1.369 + RotOrder_EulerXYZ = 0, 1.370 + RotOrder_EulerXZY, 1.371 + RotOrder_EulerYZX, 1.372 + RotOrder_EulerYXZ, 1.373 + RotOrder_EulerZXY, 1.374 + RotOrder_EulerZYX, 1.375 + 1.376 + RotOrder_SphericXYZ, 1.377 + 1.378 + RotOrder_MAX // end-of-enum sentinel 1.379 + }; 1.380 + 1.381 + 1.382 + enum TransformInheritance 1.383 + { 1.384 + TransformInheritance_RrSs = 0, 1.385 + TransformInheritance_RSrs, 1.386 + TransformInheritance_Rrs, 1.387 + 1.388 + TransformInheritance_MAX // end-of-enum sentinel 1.389 + }; 1.390 + 1.391 +public: 1.392 + 1.393 + fbx_simple_property(QuaternionInterpolate, int, 0); 1.394 + 1.395 + fbx_simple_property(RotationOffset, aiVector3D, aiVector3D()); 1.396 + fbx_simple_property(RotationPivot, aiVector3D, aiVector3D()); 1.397 + fbx_simple_property(ScalingOffset, aiVector3D, aiVector3D()); 1.398 + fbx_simple_property(ScalingPivot, aiVector3D, aiVector3D()); 1.399 + fbx_simple_property(TranslationActive, bool, false); 1.400 + 1.401 + fbx_simple_property(TranslationMin, aiVector3D, aiVector3D()); 1.402 + fbx_simple_property(TranslationMax, aiVector3D, aiVector3D()); 1.403 + 1.404 + fbx_simple_property(TranslationMinX, bool, false); 1.405 + fbx_simple_property(TranslationMaxX, bool, false); 1.406 + fbx_simple_property(TranslationMinY, bool, false); 1.407 + fbx_simple_property(TranslationMaxY, bool, false); 1.408 + fbx_simple_property(TranslationMinZ, bool, false); 1.409 + fbx_simple_property(TranslationMaxZ, bool, false); 1.410 + 1.411 + fbx_simple_enum_property(RotationOrder, RotOrder, 0); 1.412 + fbx_simple_property(RotationSpaceForLimitOnly, bool, false); 1.413 + fbx_simple_property(RotationStiffnessX, float, 0.0f); 1.414 + fbx_simple_property(RotationStiffnessY, float, 0.0f); 1.415 + fbx_simple_property(RotationStiffnessZ, float, 0.0f); 1.416 + fbx_simple_property(AxisLen, float, 0.0f); 1.417 + 1.418 + fbx_simple_property(PreRotation, aiVector3D, aiVector3D()); 1.419 + fbx_simple_property(PostRotation, aiVector3D, aiVector3D()); 1.420 + fbx_simple_property(RotationActive, bool, false); 1.421 + 1.422 + fbx_simple_property(RotationMin, aiVector3D, aiVector3D()); 1.423 + fbx_simple_property(RotationMax, aiVector3D, aiVector3D()); 1.424 + 1.425 + fbx_simple_property(RotationMinX, bool, false); 1.426 + fbx_simple_property(RotationMaxX, bool, false); 1.427 + fbx_simple_property(RotationMinY, bool, false); 1.428 + fbx_simple_property(RotationMaxY, bool, false); 1.429 + fbx_simple_property(RotationMinZ, bool, false); 1.430 + fbx_simple_property(RotationMaxZ, bool, false); 1.431 + fbx_simple_enum_property(InheritType, TransformInheritance, 0); 1.432 + 1.433 + fbx_simple_property(ScalingActive, bool, false); 1.434 + fbx_simple_property(ScalingMin, aiVector3D, aiVector3D()); 1.435 + fbx_simple_property(ScalingMax, aiVector3D, aiVector3D(1.f,1.f,1.f)); 1.436 + fbx_simple_property(ScalingMinX, bool, false); 1.437 + fbx_simple_property(ScalingMaxX, bool, false); 1.438 + fbx_simple_property(ScalingMinY, bool, false); 1.439 + fbx_simple_property(ScalingMaxY, bool, false); 1.440 + fbx_simple_property(ScalingMinZ, bool, false); 1.441 + fbx_simple_property(ScalingMaxZ, bool, false); 1.442 + 1.443 + fbx_simple_property(GeometricTranslation, aiVector3D, aiVector3D()); 1.444 + fbx_simple_property(GeometricRotation, aiVector3D, aiVector3D()); 1.445 + fbx_simple_property(GeometricScaling, aiVector3D, aiVector3D(1.f, 1.f, 1.f)); 1.446 + 1.447 + fbx_simple_property(MinDampRangeX, float, 0.0f); 1.448 + fbx_simple_property(MinDampRangeY, float, 0.0f); 1.449 + fbx_simple_property(MinDampRangeZ, float, 0.0f); 1.450 + fbx_simple_property(MaxDampRangeX, float, 0.0f); 1.451 + fbx_simple_property(MaxDampRangeY, float, 0.0f); 1.452 + fbx_simple_property(MaxDampRangeZ, float, 0.0f); 1.453 + 1.454 + fbx_simple_property(MinDampStrengthX, float, 0.0f); 1.455 + fbx_simple_property(MinDampStrengthY, float, 0.0f); 1.456 + fbx_simple_property(MinDampStrengthZ, float, 0.0f); 1.457 + fbx_simple_property(MaxDampStrengthX, float, 0.0f); 1.458 + fbx_simple_property(MaxDampStrengthY, float, 0.0f); 1.459 + fbx_simple_property(MaxDampStrengthZ, float, 0.0f); 1.460 + 1.461 + fbx_simple_property(PreferredAngleX, float, 0.0f); 1.462 + fbx_simple_property(PreferredAngleY, float, 0.0f); 1.463 + fbx_simple_property(PreferredAngleZ, float, 0.0f); 1.464 + 1.465 + fbx_simple_property(Show, bool, true); 1.466 + fbx_simple_property(LODBox, bool, false); 1.467 + fbx_simple_property(Freeze, bool, false); 1.468 + 1.469 +public: 1.470 + 1.471 + const std::string& Shading() const { 1.472 + return shading; 1.473 + } 1.474 + 1.475 + const std::string& Culling() const { 1.476 + return culling; 1.477 + } 1.478 + 1.479 + const PropertyTable& Props() const { 1.480 + ai_assert(props.get()); 1.481 + return *props.get(); 1.482 + } 1.483 + 1.484 + /** Get material links */ 1.485 + const std::vector<const Material*>& GetMaterials() const { 1.486 + return materials; 1.487 + } 1.488 + 1.489 + 1.490 + /** Get geometry links */ 1.491 + const std::vector<const Geometry*>& GetGeometry() const { 1.492 + return geometry; 1.493 + } 1.494 + 1.495 + 1.496 + /** Get node attachments */ 1.497 + const std::vector<const NodeAttribute*>& GetAttributes() const { 1.498 + return attributes; 1.499 + } 1.500 + 1.501 +public: 1.502 + 1.503 + /** convenience method to check if the node has a Null node marker */ 1.504 + bool IsNull() const; 1.505 + 1.506 + 1.507 +private: 1.508 + 1.509 + void ResolveLinks(const Element& element, const Document& doc); 1.510 + 1.511 +private: 1.512 + 1.513 + std::vector<const Material*> materials; 1.514 + std::vector<const Geometry*> geometry; 1.515 + std::vector<const NodeAttribute*> attributes; 1.516 + 1.517 + std::string shading; 1.518 + std::string culling; 1.519 + boost::shared_ptr<const PropertyTable> props; 1.520 +}; 1.521 + 1.522 + 1.523 + 1.524 +/** DOM class for generic FBX textures */ 1.525 +class Texture : public Object 1.526 +{ 1.527 +public: 1.528 + 1.529 + Texture(uint64_t id, const Element& element, const Document& doc, const std::string& name); 1.530 + ~Texture(); 1.531 + 1.532 +public: 1.533 + 1.534 + const std::string& Type() const { 1.535 + return type; 1.536 + } 1.537 + 1.538 + const std::string& FileName() const { 1.539 + return fileName; 1.540 + } 1.541 + 1.542 + const std::string& RelativeFilename() const { 1.543 + return relativeFileName; 1.544 + } 1.545 + 1.546 + const std::string& AlphaSource() const { 1.547 + return alphaSource; 1.548 + } 1.549 + 1.550 + const aiVector2D& UVTranslation() const { 1.551 + return uvTrans; 1.552 + } 1.553 + 1.554 + const aiVector2D& UVScaling() const { 1.555 + return uvScaling; 1.556 + } 1.557 + 1.558 + const PropertyTable& Props() const { 1.559 + ai_assert(props.get()); 1.560 + return *props.get(); 1.561 + } 1.562 + 1.563 + // return a 4-tuple 1.564 + const unsigned int* Crop() const { 1.565 + return crop; 1.566 + } 1.567 + 1.568 +private: 1.569 + 1.570 + aiVector2D uvTrans; 1.571 + aiVector2D uvScaling; 1.572 + 1.573 + std::string type; 1.574 + std::string relativeFileName; 1.575 + std::string fileName; 1.576 + std::string alphaSource; 1.577 + boost::shared_ptr<const PropertyTable> props; 1.578 + 1.579 + unsigned int crop[4]; 1.580 +}; 1.581 + 1.582 + 1.583 +typedef std::fbx_unordered_map<std::string, const Texture*> TextureMap; 1.584 + 1.585 + 1.586 +/** DOM class for generic FBX materials */ 1.587 +class Material : public Object 1.588 +{ 1.589 +public: 1.590 + 1.591 + Material(uint64_t id, const Element& element, const Document& doc, const std::string& name); 1.592 + ~Material(); 1.593 + 1.594 +public: 1.595 + 1.596 + const std::string& GetShadingModel() const { 1.597 + return shading; 1.598 + } 1.599 + 1.600 + bool IsMultilayer() const { 1.601 + return multilayer; 1.602 + } 1.603 + 1.604 + const PropertyTable& Props() const { 1.605 + ai_assert(props.get()); 1.606 + return *props.get(); 1.607 + } 1.608 + 1.609 + const TextureMap& Textures() const { 1.610 + return textures; 1.611 + } 1.612 + 1.613 +private: 1.614 + 1.615 + std::string shading; 1.616 + bool multilayer; 1.617 + boost::shared_ptr<const PropertyTable> props; 1.618 + 1.619 + TextureMap textures; 1.620 +}; 1.621 + 1.622 + 1.623 +/** DOM base class for all kinds of FBX geometry */ 1.624 +class Geometry : public Object 1.625 +{ 1.626 +public: 1.627 + 1.628 + Geometry(uint64_t id, const Element& element, const std::string& name, const Document& doc); 1.629 + ~Geometry(); 1.630 + 1.631 +public: 1.632 + 1.633 + /** Get the Skin attached to this geometry or NULL */ 1.634 + const Skin* const DeformerSkin() const { 1.635 + return skin; 1.636 + } 1.637 + 1.638 +private: 1.639 + 1.640 + const Skin* skin; 1.641 +}; 1.642 + 1.643 + 1.644 +typedef std::vector<int> MatIndexArray; 1.645 + 1.646 + 1.647 +/** DOM class for FBX geometry of type "Mesh"*/ 1.648 +class MeshGeometry : public Geometry 1.649 +{ 1.650 + 1.651 +public: 1.652 + 1.653 + MeshGeometry(uint64_t id, const Element& element, const std::string& name, const Document& doc); 1.654 + ~MeshGeometry(); 1.655 + 1.656 +public: 1.657 + 1.658 + /** Get a list of all vertex points, non-unique*/ 1.659 + const std::vector<aiVector3D>& GetVertices() const { 1.660 + return vertices; 1.661 + } 1.662 + 1.663 + /** Get a list of all vertex normals or an empty array if 1.664 + * no normals are specified. */ 1.665 + const std::vector<aiVector3D>& GetNormals() const { 1.666 + return normals; 1.667 + } 1.668 + 1.669 + /** Get a list of all vertex tangents or an empty array 1.670 + * if no tangents are specified */ 1.671 + const std::vector<aiVector3D>& GetTangents() const { 1.672 + return tangents; 1.673 + } 1.674 + 1.675 + /** Get a list of all vertex binormals or an empty array 1.676 + * if no binormals are specified */ 1.677 + const std::vector<aiVector3D>& GetBinormals() const { 1.678 + return binormals; 1.679 + } 1.680 + 1.681 + /** Return list of faces - each entry denotes a face and specifies 1.682 + * how many vertices it has. Vertices are taken from the 1.683 + * vertex data arrays in sequential order. */ 1.684 + const std::vector<unsigned int>& GetFaceIndexCounts() const { 1.685 + return faces; 1.686 + } 1.687 + 1.688 + /** Get a UV coordinate slot, returns an empty array if 1.689 + * the requested slot does not exist. */ 1.690 + const std::vector<aiVector2D>& GetTextureCoords(unsigned int index) const { 1.691 + static const std::vector<aiVector2D> empty; 1.692 + return index >= AI_MAX_NUMBER_OF_TEXTURECOORDS ? empty : uvs[index]; 1.693 + } 1.694 + 1.695 + 1.696 + /** Get a UV coordinate slot, returns an empty array if 1.697 + * the requested slot does not exist. */ 1.698 + std::string GetTextureCoordChannelName(unsigned int index) const { 1.699 + return index >= AI_MAX_NUMBER_OF_TEXTURECOORDS ? "" : uvNames[index]; 1.700 + } 1.701 + 1.702 + /** Get a vertex color coordinate slot, returns an empty array if 1.703 + * the requested slot does not exist. */ 1.704 + const std::vector<aiColor4D>& GetVertexColors(unsigned int index) const { 1.705 + static const std::vector<aiColor4D> empty; 1.706 + return index >= AI_MAX_NUMBER_OF_COLOR_SETS ? empty : colors[index]; 1.707 + } 1.708 + 1.709 + 1.710 + /** Get per-face-vertex material assignments */ 1.711 + const MatIndexArray& GetMaterialIndices() const { 1.712 + return materials; 1.713 + } 1.714 + 1.715 + 1.716 + /** Convert from a fbx file vertex index (for example from a #Cluster weight) or NULL 1.717 + * if the vertex index is not valid. */ 1.718 + const unsigned int* ToOutputVertexIndex(unsigned int in_index, unsigned int& count) const { 1.719 + if(in_index >= mapping_counts.size()) { 1.720 + return NULL; 1.721 + } 1.722 + 1.723 + ai_assert(mapping_counts.size() == mapping_offsets.size()); 1.724 + count = mapping_counts[in_index]; 1.725 + 1.726 + ai_assert(count != 0); 1.727 + ai_assert(mapping_offsets[in_index] + count <= mappings.size()); 1.728 + 1.729 + return &mappings[mapping_offsets[in_index]]; 1.730 + } 1.731 + 1.732 + 1.733 + /** Determine the face to which a particular output vertex index belongs. 1.734 + * This mapping is always unique. */ 1.735 + unsigned int FaceForVertexIndex(unsigned int in_index) const { 1.736 + ai_assert(in_index < vertices.size()); 1.737 + 1.738 + // in the current conversion pattern this will only be needed if 1.739 + // weights are present, so no need to always pre-compute this table 1.740 + if (facesVertexStartIndices.empty()) { 1.741 + facesVertexStartIndices.resize(faces.size() + 1, 0); 1.742 + 1.743 + std::partial_sum(faces.begin(), faces.end(), facesVertexStartIndices.begin() + 1); 1.744 + facesVertexStartIndices.pop_back(); 1.745 + } 1.746 + 1.747 + ai_assert(facesVertexStartIndices.size() == faces.size()); 1.748 + const std::vector<unsigned int>::iterator it = std::upper_bound( 1.749 + facesVertexStartIndices.begin(), 1.750 + facesVertexStartIndices.end(), 1.751 + in_index 1.752 + ); 1.753 + 1.754 + return static_cast<unsigned int>(std::distance(facesVertexStartIndices.begin(), it - 1)); 1.755 + } 1.756 + 1.757 +public: 1.758 + 1.759 +private: 1.760 + 1.761 + void ReadLayer(const Scope& layer); 1.762 + void ReadLayerElement(const Scope& layerElement); 1.763 + void ReadVertexData(const std::string& type, int index, const Scope& source); 1.764 + 1.765 + void ReadVertexDataUV(std::vector<aiVector2D>& uv_out, const Scope& source, 1.766 + const std::string& MappingInformationType, 1.767 + const std::string& ReferenceInformationType); 1.768 + 1.769 + void ReadVertexDataNormals(std::vector<aiVector3D>& normals_out, const Scope& source, 1.770 + const std::string& MappingInformationType, 1.771 + const std::string& ReferenceInformationType); 1.772 + 1.773 + void ReadVertexDataColors(std::vector<aiColor4D>& colors_out, const Scope& source, 1.774 + const std::string& MappingInformationType, 1.775 + const std::string& ReferenceInformationType); 1.776 + 1.777 + void ReadVertexDataTangents(std::vector<aiVector3D>& tangents_out, const Scope& source, 1.778 + const std::string& MappingInformationType, 1.779 + const std::string& ReferenceInformationType); 1.780 + 1.781 + void ReadVertexDataBinormals(std::vector<aiVector3D>& binormals_out, const Scope& source, 1.782 + const std::string& MappingInformationType, 1.783 + const std::string& ReferenceInformationType); 1.784 + 1.785 + void ReadVertexDataMaterials(MatIndexArray& materials_out, const Scope& source, 1.786 + const std::string& MappingInformationType, 1.787 + const std::string& ReferenceInformationType); 1.788 + 1.789 +private: 1.790 + 1.791 + // cached data arrays 1.792 + MatIndexArray materials; 1.793 + std::vector<aiVector3D> vertices; 1.794 + std::vector<unsigned int> faces; 1.795 + mutable std::vector<unsigned int> facesVertexStartIndices; 1.796 + std::vector<aiVector3D> tangents; 1.797 + std::vector<aiVector3D> binormals; 1.798 + std::vector<aiVector3D> normals; 1.799 + 1.800 + std::string uvNames[AI_MAX_NUMBER_OF_TEXTURECOORDS]; 1.801 + std::vector<aiVector2D> uvs[AI_MAX_NUMBER_OF_TEXTURECOORDS]; 1.802 + std::vector<aiColor4D> colors[AI_MAX_NUMBER_OF_COLOR_SETS]; 1.803 + 1.804 + std::vector<unsigned int> mapping_counts; 1.805 + std::vector<unsigned int> mapping_offsets; 1.806 + std::vector<unsigned int> mappings; 1.807 +}; 1.808 + 1.809 +typedef std::vector<uint64_t> KeyTimeList; 1.810 +typedef std::vector<float> KeyValueList; 1.811 + 1.812 +/** Represents a FBX animation curve (i.e. a 1-dimensional set of keyframes and values therefor) */ 1.813 +class AnimationCurve : public Object 1.814 +{ 1.815 +public: 1.816 + 1.817 + AnimationCurve(uint64_t id, const Element& element, const std::string& name, const Document& doc); 1.818 + ~AnimationCurve(); 1.819 + 1.820 +public: 1.821 + 1.822 + /** get list of keyframe positions (time). 1.823 + * Invariant: |GetKeys()| > 0 */ 1.824 + const KeyTimeList& GetKeys() const { 1.825 + return keys; 1.826 + } 1.827 + 1.828 + 1.829 + /** get list of keyframe values. 1.830 + * Invariant: |GetKeys()| == |GetValues()| && |GetKeys()| > 0*/ 1.831 + const KeyValueList& GetValues() const { 1.832 + return values; 1.833 + } 1.834 + 1.835 + 1.836 + const std::vector<float>& GetAttributes() const { 1.837 + return attributes; 1.838 + } 1.839 + 1.840 + const std::vector<unsigned int>& GetFlags() const { 1.841 + return flags; 1.842 + } 1.843 + 1.844 +private: 1.845 + 1.846 + KeyTimeList keys; 1.847 + KeyValueList values; 1.848 + std::vector<float> attributes; 1.849 + std::vector<unsigned int> flags; 1.850 +}; 1.851 + 1.852 +// property-name -> animation curve 1.853 +typedef std::map<std::string, const AnimationCurve*> AnimationCurveMap; 1.854 + 1.855 + 1.856 +/** Represents a FBX animation curve (i.e. a mapping from single animation curves to nodes) */ 1.857 +class AnimationCurveNode : public Object 1.858 +{ 1.859 +public: 1.860 + 1.861 + /* the optional whitelist specifies a list of property names for which the caller 1.862 + wants animations for. If the curve node does not match one of these, std::range_error 1.863 + will be thrown. */ 1.864 + AnimationCurveNode(uint64_t id, const Element& element, const std::string& name, const Document& doc, 1.865 + const char* const * target_prop_whitelist = NULL, size_t whitelist_size = 0); 1.866 + 1.867 + ~AnimationCurveNode(); 1.868 + 1.869 +public: 1.870 + 1.871 + const PropertyTable& Props() const { 1.872 + ai_assert(props.get()); 1.873 + return *props.get(); 1.874 + } 1.875 + 1.876 + 1.877 + const AnimationCurveMap& Curves() const; 1.878 + 1.879 + /** Object the curve is assigned to, this can be NULL if the 1.880 + * target object has no DOM representation or could not 1.881 + * be read for other reasons.*/ 1.882 + const Object* Target() const { 1.883 + return target; 1.884 + } 1.885 + 1.886 + const Model* TargetAsModel() const { 1.887 + return dynamic_cast<const Model*>(target); 1.888 + } 1.889 + 1.890 + const NodeAttribute* TargetAsNodeAttribute() const { 1.891 + return dynamic_cast<const NodeAttribute*>(target); 1.892 + } 1.893 + 1.894 + /** Property of Target() that is being animated*/ 1.895 + const std::string& TargetProperty() const { 1.896 + return prop; 1.897 + } 1.898 + 1.899 +private: 1.900 + 1.901 + const Object* target; 1.902 + boost::shared_ptr<const PropertyTable> props; 1.903 + mutable AnimationCurveMap curves; 1.904 + 1.905 + std::string prop; 1.906 + const Document& doc; 1.907 +}; 1.908 + 1.909 +typedef std::vector<const AnimationCurveNode*> AnimationCurveNodeList; 1.910 + 1.911 + 1.912 +/** Represents a FBX animation layer (i.e. a list of node animations) */ 1.913 +class AnimationLayer : public Object 1.914 +{ 1.915 +public: 1.916 + 1.917 + 1.918 + AnimationLayer(uint64_t id, const Element& element, const std::string& name, const Document& doc); 1.919 + ~AnimationLayer(); 1.920 + 1.921 +public: 1.922 + 1.923 + const PropertyTable& Props() const { 1.924 + ai_assert(props.get()); 1.925 + return *props.get(); 1.926 + } 1.927 + 1.928 + /* the optional whitelist specifies a list of property names for which the caller 1.929 + wants animations for. Curves not matching this list will not be added to the 1.930 + animation layer. */ 1.931 + AnimationCurveNodeList Nodes(const char* const * target_prop_whitelist = NULL, size_t whitelist_size = 0) const; 1.932 + 1.933 +private: 1.934 + 1.935 + boost::shared_ptr<const PropertyTable> props; 1.936 + const Document& doc; 1.937 +}; 1.938 + 1.939 + 1.940 +typedef std::vector<const AnimationLayer*> AnimationLayerList; 1.941 + 1.942 + 1.943 +/** Represents a FBX animation stack (i.e. a list of animation layers) */ 1.944 +class AnimationStack : public Object 1.945 +{ 1.946 +public: 1.947 + 1.948 + AnimationStack(uint64_t id, const Element& element, const std::string& name, const Document& doc); 1.949 + ~AnimationStack(); 1.950 + 1.951 +public: 1.952 + 1.953 + fbx_simple_property(LocalStart, uint64_t, 0L); 1.954 + fbx_simple_property(LocalStop, uint64_t, 0L); 1.955 + fbx_simple_property(ReferenceStart, uint64_t, 0L); 1.956 + fbx_simple_property(ReferenceStop, uint64_t, 0L); 1.957 + 1.958 + 1.959 + 1.960 + const PropertyTable& Props() const { 1.961 + ai_assert(props.get()); 1.962 + return *props.get(); 1.963 + } 1.964 + 1.965 + 1.966 + const AnimationLayerList& Layers() const { 1.967 + return layers; 1.968 + } 1.969 + 1.970 +private: 1.971 + 1.972 + boost::shared_ptr<const PropertyTable> props; 1.973 + AnimationLayerList layers; 1.974 +}; 1.975 + 1.976 + 1.977 +/** DOM class for deformers */ 1.978 +class Deformer : public Object 1.979 +{ 1.980 +public: 1.981 + 1.982 + Deformer(uint64_t id, const Element& element, const Document& doc, const std::string& name); 1.983 + ~Deformer(); 1.984 + 1.985 +public: 1.986 + 1.987 + const PropertyTable& Props() const { 1.988 + ai_assert(props.get()); 1.989 + return *props.get(); 1.990 + } 1.991 + 1.992 +private: 1.993 + 1.994 + boost::shared_ptr<const PropertyTable> props; 1.995 +}; 1.996 + 1.997 +typedef std::vector<float> WeightArray; 1.998 +typedef std::vector<unsigned int> WeightIndexArray; 1.999 + 1.1000 + 1.1001 +/** DOM class for skin deformer clusters (aka subdeformers) */ 1.1002 +class Cluster : public Deformer 1.1003 +{ 1.1004 +public: 1.1005 + 1.1006 + Cluster(uint64_t id, const Element& element, const Document& doc, const std::string& name); 1.1007 + ~Cluster(); 1.1008 + 1.1009 +public: 1.1010 + 1.1011 + /** get the list of deformer weights associated with this cluster. 1.1012 + * Use #GetIndices() to get the associated vertices. Both arrays 1.1013 + * have the same size (and may also be empty). */ 1.1014 + const WeightArray& GetWeights() const { 1.1015 + return weights; 1.1016 + } 1.1017 + 1.1018 + /** get indices into the vertex data of the geometry associated 1.1019 + * with this cluster. Use #GetWeights() to get the associated weights. 1.1020 + * Both arrays have the same size (and may also be empty). */ 1.1021 + const WeightIndexArray& GetIndices() const { 1.1022 + return indices; 1.1023 + } 1.1024 + 1.1025 + /** */ 1.1026 + const aiMatrix4x4& Transform() const { 1.1027 + return transform; 1.1028 + } 1.1029 + 1.1030 + const aiMatrix4x4& TransformLink() const { 1.1031 + return transformLink; 1.1032 + } 1.1033 + 1.1034 + const Model* const TargetNode() const { 1.1035 + return node; 1.1036 + } 1.1037 + 1.1038 +private: 1.1039 + 1.1040 + WeightArray weights; 1.1041 + WeightIndexArray indices; 1.1042 + 1.1043 + aiMatrix4x4 transform; 1.1044 + aiMatrix4x4 transformLink; 1.1045 + 1.1046 + const Model* node; 1.1047 +}; 1.1048 + 1.1049 + 1.1050 + 1.1051 +/** DOM class for skin deformers */ 1.1052 +class Skin : public Deformer 1.1053 +{ 1.1054 +public: 1.1055 + 1.1056 + Skin(uint64_t id, const Element& element, const Document& doc, const std::string& name); 1.1057 + ~Skin(); 1.1058 + 1.1059 +public: 1.1060 + 1.1061 + float DeformAccuracy() const { 1.1062 + return accuracy; 1.1063 + } 1.1064 + 1.1065 + 1.1066 + const std::vector<const Cluster*>& Clusters() const { 1.1067 + return clusters; 1.1068 + } 1.1069 + 1.1070 +private: 1.1071 + 1.1072 + float accuracy; 1.1073 + std::vector<const Cluster*> clusters; 1.1074 +}; 1.1075 + 1.1076 + 1.1077 + 1.1078 +/** Represents a link between two FBX objects. */ 1.1079 +class Connection 1.1080 +{ 1.1081 +public: 1.1082 + 1.1083 + Connection(uint64_t insertionOrder, uint64_t src, uint64_t dest, const std::string& prop, const Document& doc); 1.1084 + ~Connection(); 1.1085 + 1.1086 + // note: a connection ensures that the source and dest objects exist, but 1.1087 + // not that they have DOM representations, so the return value of one of 1.1088 + // these functions can still be NULL. 1.1089 + const Object* SourceObject() const; 1.1090 + const Object* DestinationObject() const; 1.1091 + 1.1092 + // these, however, are always guaranteed to be valid 1.1093 + LazyObject& LazySourceObject() const; 1.1094 + LazyObject& LazyDestinationObject() const; 1.1095 + 1.1096 + 1.1097 + /** return the name of the property the connection is attached to. 1.1098 + * this is an empty string for object to object (OO) connections. */ 1.1099 + const std::string& PropertyName() const { 1.1100 + return prop; 1.1101 + } 1.1102 + 1.1103 + uint64_t InsertionOrder() const { 1.1104 + return insertionOrder; 1.1105 + } 1.1106 + 1.1107 + int CompareTo(const Connection* c) const { 1.1108 + // note: can't subtract because this would overflow uint64_t 1.1109 + if(InsertionOrder() > c->InsertionOrder()) { 1.1110 + return 1; 1.1111 + } 1.1112 + else if(InsertionOrder() < c->InsertionOrder()) { 1.1113 + return -1; 1.1114 + } 1.1115 + return 0; 1.1116 + } 1.1117 + 1.1118 + bool Compare(const Connection* c) const { 1.1119 + return InsertionOrder() < c->InsertionOrder(); 1.1120 + } 1.1121 + 1.1122 +public: 1.1123 + 1.1124 + uint64_t insertionOrder; 1.1125 + const std::string prop; 1.1126 + 1.1127 + uint64_t src, dest; 1.1128 + const Document& doc; 1.1129 +}; 1.1130 + 1.1131 + 1.1132 + // XXX again, unique_ptr would be useful. shared_ptr is too 1.1133 + // bloated since the objects have a well-defined single owner 1.1134 + // during their entire lifetime (Document). FBX files have 1.1135 + // up to many thousands of objects (most of which we never use), 1.1136 + // so the memory overhead for them should be kept at a minimum. 1.1137 + typedef std::map<uint64_t, LazyObject*> ObjectMap; 1.1138 + typedef std::fbx_unordered_map<std::string, boost::shared_ptr<const PropertyTable> > PropertyTemplateMap; 1.1139 + 1.1140 + 1.1141 + typedef std::multimap<uint64_t, const Connection*> ConnectionMap; 1.1142 + 1.1143 + 1.1144 +/** DOM class for global document settings, a single instance per document can 1.1145 + * be accessed via Document.Globals(). */ 1.1146 +class FileGlobalSettings 1.1147 +{ 1.1148 +public: 1.1149 + 1.1150 + FileGlobalSettings(const Document& doc, boost::shared_ptr<const PropertyTable> props); 1.1151 + ~FileGlobalSettings(); 1.1152 + 1.1153 +public: 1.1154 + 1.1155 + const PropertyTable& Props() const { 1.1156 + ai_assert(props.get()); 1.1157 + return *props.get(); 1.1158 + } 1.1159 + 1.1160 + const Document& GetDocument() const { 1.1161 + return doc; 1.1162 + } 1.1163 + 1.1164 + 1.1165 + fbx_simple_property(UpAxis, int, 1); 1.1166 + fbx_simple_property(UpAxisSign, int, 1); 1.1167 + fbx_simple_property(FrontAxis, int, 2); 1.1168 + fbx_simple_property(FrontAxisSign, int, 1); 1.1169 + fbx_simple_property(CoordAxis, int, 0); 1.1170 + fbx_simple_property(CoordAxisSign, int, 1); 1.1171 + fbx_simple_property(OriginalUpAxis, int, 0); 1.1172 + fbx_simple_property(OriginalUpAxisSign, int, 1); 1.1173 + fbx_simple_property(UnitScaleFactor, double, 1); 1.1174 + fbx_simple_property(OriginalUnitScaleFactor, double, 1); 1.1175 + fbx_simple_property(AmbientColor, aiVector3D, aiVector3D(0,0,0)); 1.1176 + fbx_simple_property(DefaultCamera, std::string, ""); 1.1177 + 1.1178 + 1.1179 + enum FrameRate { 1.1180 + FrameRate_DEFAULT = 0, 1.1181 + FrameRate_120 = 1, 1.1182 + FrameRate_100 = 2, 1.1183 + FrameRate_60 = 3, 1.1184 + FrameRate_50 = 4, 1.1185 + FrameRate_48 = 5, 1.1186 + FrameRate_30 = 6, 1.1187 + FrameRate_30_DROP = 7, 1.1188 + FrameRate_NTSC_DROP_FRAME = 8, 1.1189 + FrameRate_NTSC_FULL_FRAME = 9, 1.1190 + FrameRate_PAL = 10, 1.1191 + FrameRate_CINEMA = 11, 1.1192 + FrameRate_1000 = 12, 1.1193 + FrameRate_CINEMA_ND = 13, 1.1194 + FrameRate_CUSTOM = 14, 1.1195 + 1.1196 + FrameRate_MAX// end-of-enum sentinel 1.1197 + }; 1.1198 + 1.1199 + fbx_simple_enum_property(TimeMode, FrameRate, FrameRate_DEFAULT); 1.1200 + fbx_simple_property(TimeSpanStart, uint64_t, 0L); 1.1201 + fbx_simple_property(TimeSpanStop, uint64_t, 0L); 1.1202 + fbx_simple_property(CustomFrameRate, float, -1.0f); 1.1203 + 1.1204 + 1.1205 +private: 1.1206 + 1.1207 + boost::shared_ptr<const PropertyTable> props; 1.1208 + const Document& doc; 1.1209 +}; 1.1210 + 1.1211 + 1.1212 + 1.1213 + 1.1214 +/** DOM root for a FBX file */ 1.1215 +class Document 1.1216 +{ 1.1217 +public: 1.1218 + 1.1219 + Document(const Parser& parser, const ImportSettings& settings); 1.1220 + ~Document(); 1.1221 + 1.1222 +public: 1.1223 + 1.1224 + LazyObject* GetObject(uint64_t id) const; 1.1225 + 1.1226 + bool IsBinary() const { 1.1227 + return parser.IsBinary(); 1.1228 + } 1.1229 + 1.1230 + unsigned int FBXVersion() const { 1.1231 + return fbxVersion; 1.1232 + } 1.1233 + 1.1234 + const std::string& Creator() const { 1.1235 + return creator; 1.1236 + } 1.1237 + 1.1238 + // elements (in this order): Uear, Month, Day, Hour, Second, Millisecond 1.1239 + const unsigned int* CreationTimeStamp() const { 1.1240 + return creationTimeStamp; 1.1241 + } 1.1242 + 1.1243 + const FileGlobalSettings& GlobalSettings() const { 1.1244 + ai_assert(globals.get()); 1.1245 + return *globals.get(); 1.1246 + } 1.1247 + 1.1248 + const PropertyTemplateMap& Templates() const { 1.1249 + return templates; 1.1250 + } 1.1251 + 1.1252 + const ObjectMap& Objects() const { 1.1253 + return objects; 1.1254 + } 1.1255 + 1.1256 + const ImportSettings& Settings() const { 1.1257 + return settings; 1.1258 + } 1.1259 + 1.1260 + const ConnectionMap& ConnectionsBySource() const { 1.1261 + return src_connections; 1.1262 + } 1.1263 + 1.1264 + const ConnectionMap& ConnectionsByDestination() const { 1.1265 + return dest_connections; 1.1266 + } 1.1267 + 1.1268 + // note: the implicit rule in all DOM classes is to always resolve 1.1269 + // from destination to source (since the FBX object hierarchy is, 1.1270 + // with very few exceptions, a DAG, this avoids cycles). In all 1.1271 + // cases that may involve back-facing edges in the object graph, 1.1272 + // use LazyObject::IsBeingConstructed() to check. 1.1273 + 1.1274 + std::vector<const Connection*> GetConnectionsBySourceSequenced(uint64_t source) const; 1.1275 + std::vector<const Connection*> GetConnectionsByDestinationSequenced(uint64_t dest) const; 1.1276 + 1.1277 + std::vector<const Connection*> GetConnectionsBySourceSequenced(uint64_t source, const char* classname) const; 1.1278 + std::vector<const Connection*> GetConnectionsByDestinationSequenced(uint64_t dest, const char* classname) const; 1.1279 + 1.1280 + std::vector<const Connection*> GetConnectionsBySourceSequenced(uint64_t source, 1.1281 + const char* const* classnames, size_t count) const; 1.1282 + std::vector<const Connection*> GetConnectionsByDestinationSequenced(uint64_t dest, 1.1283 + const char* const* classnames, 1.1284 + size_t count) const; 1.1285 + 1.1286 + const std::vector<const AnimationStack*>& AnimationStacks() const; 1.1287 + 1.1288 +private: 1.1289 + 1.1290 + std::vector<const Connection*> GetConnectionsSequenced(uint64_t id, const ConnectionMap&) const; 1.1291 + std::vector<const Connection*> GetConnectionsSequenced(uint64_t id, bool is_src, 1.1292 + const ConnectionMap&, 1.1293 + const char* const* classnames, 1.1294 + size_t count) const; 1.1295 + 1.1296 +private: 1.1297 + 1.1298 + void ReadHeader(); 1.1299 + void ReadObjects(); 1.1300 + void ReadPropertyTemplates(); 1.1301 + void ReadConnections(); 1.1302 + void ReadGlobalSettings(); 1.1303 + 1.1304 +private: 1.1305 + 1.1306 + const ImportSettings& settings; 1.1307 + 1.1308 + ObjectMap objects; 1.1309 + const Parser& parser; 1.1310 + 1.1311 + PropertyTemplateMap templates; 1.1312 + ConnectionMap src_connections; 1.1313 + ConnectionMap dest_connections; 1.1314 + 1.1315 + unsigned int fbxVersion; 1.1316 + std::string creator; 1.1317 + unsigned int creationTimeStamp[7]; 1.1318 + 1.1319 + std::vector<uint64_t> animationStacks; 1.1320 + mutable std::vector<const AnimationStack*> animationStacksResolved; 1.1321 + 1.1322 + boost::scoped_ptr<FileGlobalSettings> globals; 1.1323 +}; 1.1324 + 1.1325 +} 1.1326 +} 1.1327 + 1.1328 +#endif