|
@@ -56,24 +56,24 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
namespace Assimp {
|
|
|
namespace FBX {
|
|
|
|
|
|
- class Parser;
|
|
|
- class Object;
|
|
|
- struct ImportSettings;
|
|
|
+class Parser;
|
|
|
+class Object;
|
|
|
+struct ImportSettings;
|
|
|
|
|
|
- class PropertyTable;
|
|
|
- class Document;
|
|
|
- class Material;
|
|
|
- class Geometry;
|
|
|
+class PropertyTable;
|
|
|
+class Document;
|
|
|
+class Material;
|
|
|
+class Geometry;
|
|
|
|
|
|
- class Video;
|
|
|
+class Video;
|
|
|
|
|
|
- class AnimationCurve;
|
|
|
- class AnimationCurveNode;
|
|
|
- class AnimationLayer;
|
|
|
- class AnimationStack;
|
|
|
+class AnimationCurve;
|
|
|
+class AnimationCurveNode;
|
|
|
+class AnimationLayer;
|
|
|
+class AnimationStack;
|
|
|
|
|
|
- class Skin;
|
|
|
- class Cluster;
|
|
|
+class Skin;
|
|
|
+class Cluster;
|
|
|
|
|
|
|
|
|
/** Represents a delay-parsed FBX objects. Many objects in the scene
|
|
@@ -82,7 +82,6 @@ namespace FBX {
|
|
|
class LazyObject
|
|
|
{
|
|
|
public:
|
|
|
-
|
|
|
LazyObject(uint64_t id, const Element& element, const Document& doc);
|
|
|
~LazyObject();
|
|
|
|
|
@@ -117,7 +116,6 @@ public:
|
|
|
}
|
|
|
|
|
|
private:
|
|
|
-
|
|
|
const Document& doc;
|
|
|
const Element& element;
|
|
|
boost::scoped_ptr<const Object> object;
|
|
@@ -138,11 +136,9 @@ private:
|
|
|
class Object
|
|
|
{
|
|
|
public:
|
|
|
-
|
|
|
Object(uint64_t id, const Element& element, const std::string& name);
|
|
|
- virtual ~Object();
|
|
|
|
|
|
-public:
|
|
|
+ virtual ~Object();
|
|
|
|
|
|
const Element& SourceElement() const {
|
|
|
return element;
|
|
@@ -169,19 +165,15 @@ protected:
|
|
|
class NodeAttribute : public Object
|
|
|
{
|
|
|
public:
|
|
|
-
|
|
|
NodeAttribute(uint64_t id, const Element& element, const Document& doc, const std::string& name);
|
|
|
virtual ~NodeAttribute();
|
|
|
|
|
|
-public:
|
|
|
-
|
|
|
const PropertyTable& Props() const {
|
|
|
ai_assert(props.get());
|
|
|
return *props.get();
|
|
|
}
|
|
|
|
|
|
private:
|
|
|
-
|
|
|
boost::shared_ptr<const PropertyTable> props;
|
|
|
};
|
|
|
|
|
@@ -190,12 +182,9 @@ private:
|
|
|
class CameraSwitcher : public NodeAttribute
|
|
|
{
|
|
|
public:
|
|
|
-
|
|
|
CameraSwitcher(uint64_t id, const Element& element, const Document& doc, const std::string& name);
|
|
|
virtual ~CameraSwitcher();
|
|
|
|
|
|
-public:
|
|
|
-
|
|
|
int CameraID() const {
|
|
|
return cameraId;
|
|
|
}
|
|
@@ -204,13 +193,11 @@ public:
|
|
|
return cameraName;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
const std::string& CameraIndexName() const {
|
|
|
return cameraIndexName;
|
|
|
}
|
|
|
|
|
|
private:
|
|
|
-
|
|
|
int cameraId;
|
|
|
std::string cameraName;
|
|
|
std::string cameraIndexName;
|
|
@@ -236,17 +223,14 @@ private:
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
/** DOM base class for FBX cameras attached to a node */
|
|
|
class Camera : public NodeAttribute
|
|
|
{
|
|
|
public:
|
|
|
-
|
|
|
Camera(uint64_t id, const Element& element, const Document& doc, const std::string& name);
|
|
|
virtual ~Camera();
|
|
|
|
|
|
public:
|
|
|
-
|
|
|
fbx_simple_property(Position, aiVector3D, aiVector3D(0,0,0))
|
|
|
fbx_simple_property(UpVector, aiVector3D, aiVector3D(0,1,0))
|
|
|
fbx_simple_property(InterestPosition, aiVector3D, aiVector3D(0,0,0))
|
|
@@ -261,8 +245,6 @@ public:
|
|
|
|
|
|
fbx_simple_property(FieldOfView, float, 1.0f)
|
|
|
fbx_simple_property(FocalLength, float, 1.0f)
|
|
|
-
|
|
|
-private:
|
|
|
};
|
|
|
|
|
|
|
|
@@ -270,7 +252,6 @@ private:
|
|
|
class Null : public NodeAttribute
|
|
|
{
|
|
|
public:
|
|
|
-
|
|
|
Null(uint64_t id, const Element& element, const Document& doc, const std::string& name);
|
|
|
virtual ~Null();
|
|
|
};
|
|
@@ -280,7 +261,6 @@ public:
|
|
|
class LimbNode : public NodeAttribute
|
|
|
{
|
|
|
public:
|
|
|
-
|
|
|
LimbNode(uint64_t id, const Element& element, const Document& doc, const std::string& name);
|
|
|
virtual ~LimbNode();
|
|
|
};
|
|
@@ -294,7 +274,6 @@ public:
|
|
|
virtual ~Light();
|
|
|
|
|
|
public:
|
|
|
-
|
|
|
enum Type
|
|
|
{
|
|
|
Type_Point,
|
|
@@ -317,7 +296,6 @@ public:
|
|
|
};
|
|
|
|
|
|
public:
|
|
|
-
|
|
|
fbx_simple_property(Color, aiVector3D, aiVector3D(1,1,1))
|
|
|
fbx_simple_enum_property(LightType, Type, 0)
|
|
|
fbx_simple_property(CastLightOnObject, bool, false)
|
|
@@ -349,9 +327,6 @@ public:
|
|
|
fbx_simple_property(TopBarnDoor, float, 20.0f)
|
|
|
fbx_simple_property(BottomBarnDoor, float, 20.0f)
|
|
|
fbx_simple_property(EnableBarnDoor, bool, true)
|
|
|
-
|
|
|
-
|
|
|
-private:
|
|
|
};
|
|
|
|
|
|
|
|
@@ -359,12 +334,10 @@ private:
|
|
|
class Model : public Object
|
|
|
{
|
|
|
public:
|
|
|
-
|
|
|
Model(uint64_t id, const Element& element, const Document& doc, const std::string& name);
|
|
|
virtual ~Model();
|
|
|
|
|
|
public:
|
|
|
-
|
|
|
enum RotOrder
|
|
|
{
|
|
|
RotOrder_EulerXYZ = 0,
|
|
@@ -390,7 +363,6 @@ public:
|
|
|
};
|
|
|
|
|
|
public:
|
|
|
-
|
|
|
fbx_simple_property(QuaternionInterpolate, int, 0)
|
|
|
|
|
|
fbx_simple_property(RotationOffset, aiVector3D, aiVector3D())
|
|
@@ -468,7 +440,6 @@ public:
|
|
|
fbx_simple_property(Freeze, bool, false)
|
|
|
|
|
|
public:
|
|
|
-
|
|
|
const std::string& Shading() const {
|
|
|
return shading;
|
|
|
}
|
|
@@ -499,18 +470,14 @@ public:
|
|
|
return attributes;
|
|
|
}
|
|
|
|
|
|
-public:
|
|
|
-
|
|
|
/** convenience method to check if the node has a Null node marker */
|
|
|
bool IsNull() const;
|
|
|
|
|
|
|
|
|
private:
|
|
|
-
|
|
|
void ResolveLinks(const Element& element, const Document& doc);
|
|
|
|
|
|
private:
|
|
|
-
|
|
|
std::vector<const Material*> materials;
|
|
|
std::vector<const Geometry*> geometry;
|
|
|
std::vector<const NodeAttribute*> attributes;
|
|
@@ -524,12 +491,10 @@ private:
|
|
|
class Texture : public Object
|
|
|
{
|
|
|
public:
|
|
|
-
|
|
|
Texture(uint64_t id, const Element& element, const Document& doc, const std::string& name);
|
|
|
virtual ~Texture();
|
|
|
|
|
|
public:
|
|
|
-
|
|
|
const std::string& Type() const {
|
|
|
return type;
|
|
|
}
|
|
@@ -569,7 +534,6 @@ public:
|
|
|
}
|
|
|
|
|
|
private:
|
|
|
-
|
|
|
aiVector2D uvTrans;
|
|
|
aiVector2D uvScaling;
|
|
|
|
|
@@ -588,7 +552,6 @@ private:
|
|
|
class LayeredTexture : public Object
|
|
|
{
|
|
|
public:
|
|
|
-
|
|
|
LayeredTexture(uint64_t id, const Element& element, const Document& doc, const std::string& name);
|
|
|
virtual ~LayeredTexture();
|
|
|
|
|
@@ -635,14 +598,17 @@ public:
|
|
|
{
|
|
|
return texture;
|
|
|
}
|
|
|
+
|
|
|
BlendMode GetBlendMode()
|
|
|
{
|
|
|
return blendMode;
|
|
|
}
|
|
|
+
|
|
|
float Alpha()
|
|
|
{
|
|
|
return alpha;
|
|
|
}
|
|
|
+
|
|
|
private:
|
|
|
const Texture* texture;
|
|
|
BlendMode blendMode;
|
|
@@ -657,12 +623,10 @@ typedef std::fbx_unordered_map<std::string, const LayeredTexture*> LayeredTextur
|
|
|
class Video : public Object
|
|
|
{
|
|
|
public:
|
|
|
-
|
|
|
Video(uint64_t id, const Element& element, const Document& doc, const std::string& name);
|
|
|
virtual ~Video();
|
|
|
|
|
|
public:
|
|
|
-
|
|
|
const std::string& Type() const {
|
|
|
return type;
|
|
|
}
|
|
@@ -696,7 +660,6 @@ public:
|
|
|
}
|
|
|
|
|
|
private:
|
|
|
-
|
|
|
std::string type;
|
|
|
std::string relativeFileName;
|
|
|
std::string fileName;
|
|
@@ -710,12 +673,9 @@ private:
|
|
|
class Material : public Object
|
|
|
{
|
|
|
public:
|
|
|
-
|
|
|
Material(uint64_t id, const Element& element, const Document& doc, const std::string& name);
|
|
|
virtual ~Material();
|
|
|
|
|
|
-public:
|
|
|
-
|
|
|
const std::string& GetShadingModel() const {
|
|
|
return shading;
|
|
|
}
|
|
@@ -738,7 +698,6 @@ public:
|
|
|
}
|
|
|
|
|
|
private:
|
|
|
-
|
|
|
std::string shading;
|
|
|
bool multilayer;
|
|
|
boost::shared_ptr<const PropertyTable> props;
|
|
@@ -747,191 +706,6 @@ private:
|
|
|
LayeredTextureMap layeredTextures;
|
|
|
};
|
|
|
|
|
|
-
|
|
|
-/** DOM base class for all kinds of FBX geometry */
|
|
|
-class Geometry : public Object
|
|
|
-{
|
|
|
-public:
|
|
|
-
|
|
|
- Geometry(uint64_t id, const Element& element, const std::string& name, const Document& doc);
|
|
|
- virtual ~Geometry();
|
|
|
-
|
|
|
-public:
|
|
|
-
|
|
|
- /** Get the Skin attached to this geometry or NULL */
|
|
|
- const Skin* DeformerSkin() const {
|
|
|
- return skin;
|
|
|
- }
|
|
|
-
|
|
|
-private:
|
|
|
-
|
|
|
- const Skin* skin;
|
|
|
-};
|
|
|
-
|
|
|
-
|
|
|
-typedef std::vector<int> MatIndexArray;
|
|
|
-
|
|
|
-
|
|
|
-/** DOM class for FBX geometry of type "Mesh"*/
|
|
|
-class MeshGeometry : public Geometry
|
|
|
-{
|
|
|
-
|
|
|
-public:
|
|
|
-
|
|
|
- MeshGeometry(uint64_t id, const Element& element, const std::string& name, const Document& doc);
|
|
|
- virtual ~MeshGeometry();
|
|
|
-
|
|
|
-public:
|
|
|
-
|
|
|
- /** Get a list of all vertex points, non-unique*/
|
|
|
- const std::vector<aiVector3D>& GetVertices() const {
|
|
|
- return vertices;
|
|
|
- }
|
|
|
-
|
|
|
- /** Get a list of all vertex normals or an empty array if
|
|
|
- * no normals are specified. */
|
|
|
- const std::vector<aiVector3D>& GetNormals() const {
|
|
|
- return normals;
|
|
|
- }
|
|
|
-
|
|
|
- /** Get a list of all vertex tangents or an empty array
|
|
|
- * if no tangents are specified */
|
|
|
- const std::vector<aiVector3D>& GetTangents() const {
|
|
|
- return tangents;
|
|
|
- }
|
|
|
-
|
|
|
- /** Get a list of all vertex binormals or an empty array
|
|
|
- * if no binormals are specified */
|
|
|
- const std::vector<aiVector3D>& GetBinormals() const {
|
|
|
- return binormals;
|
|
|
- }
|
|
|
-
|
|
|
- /** Return list of faces - each entry denotes a face and specifies
|
|
|
- * how many vertices it has. Vertices are taken from the
|
|
|
- * vertex data arrays in sequential order. */
|
|
|
- const std::vector<unsigned int>& GetFaceIndexCounts() const {
|
|
|
- return faces;
|
|
|
- }
|
|
|
-
|
|
|
- /** Get a UV coordinate slot, returns an empty array if
|
|
|
- * the requested slot does not exist. */
|
|
|
- const std::vector<aiVector2D>& GetTextureCoords(unsigned int index) const {
|
|
|
- static const std::vector<aiVector2D> empty;
|
|
|
- return index >= AI_MAX_NUMBER_OF_TEXTURECOORDS ? empty : uvs[index];
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /** Get a UV coordinate slot, returns an empty array if
|
|
|
- * the requested slot does not exist. */
|
|
|
- std::string GetTextureCoordChannelName(unsigned int index) const {
|
|
|
- return index >= AI_MAX_NUMBER_OF_TEXTURECOORDS ? "" : uvNames[index];
|
|
|
- }
|
|
|
-
|
|
|
- /** Get a vertex color coordinate slot, returns an empty array if
|
|
|
- * the requested slot does not exist. */
|
|
|
- const std::vector<aiColor4D>& GetVertexColors(unsigned int index) const {
|
|
|
- static const std::vector<aiColor4D> empty;
|
|
|
- return index >= AI_MAX_NUMBER_OF_COLOR_SETS ? empty : colors[index];
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /** Get per-face-vertex material assignments */
|
|
|
- const MatIndexArray& GetMaterialIndices() const {
|
|
|
- return materials;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /** Convert from a fbx file vertex index (for example from a #Cluster weight) or NULL
|
|
|
- * if the vertex index is not valid. */
|
|
|
- const unsigned int* ToOutputVertexIndex(unsigned int in_index, unsigned int& count) const {
|
|
|
- if(in_index >= mapping_counts.size()) {
|
|
|
- return NULL;
|
|
|
- }
|
|
|
-
|
|
|
- ai_assert(mapping_counts.size() == mapping_offsets.size());
|
|
|
- count = mapping_counts[in_index];
|
|
|
-
|
|
|
- ai_assert(count != 0);
|
|
|
- ai_assert(mapping_offsets[in_index] + count <= mappings.size());
|
|
|
-
|
|
|
- return &mappings[mapping_offsets[in_index]];
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /** Determine the face to which a particular output vertex index belongs.
|
|
|
- * This mapping is always unique. */
|
|
|
- unsigned int FaceForVertexIndex(unsigned int in_index) const {
|
|
|
- ai_assert(in_index < vertices.size());
|
|
|
-
|
|
|
- // in the current conversion pattern this will only be needed if
|
|
|
- // weights are present, so no need to always pre-compute this table
|
|
|
- if (facesVertexStartIndices.empty()) {
|
|
|
- facesVertexStartIndices.resize(faces.size() + 1, 0);
|
|
|
-
|
|
|
- std::partial_sum(faces.begin(), faces.end(), facesVertexStartIndices.begin() + 1);
|
|
|
- facesVertexStartIndices.pop_back();
|
|
|
- }
|
|
|
-
|
|
|
- ai_assert(facesVertexStartIndices.size() == faces.size());
|
|
|
- const std::vector<unsigned int>::iterator it = std::upper_bound(
|
|
|
- facesVertexStartIndices.begin(),
|
|
|
- facesVertexStartIndices.end(),
|
|
|
- in_index
|
|
|
- );
|
|
|
-
|
|
|
- return static_cast<unsigned int>(std::distance(facesVertexStartIndices.begin(), it - 1));
|
|
|
- }
|
|
|
-
|
|
|
-private:
|
|
|
-
|
|
|
- void ReadLayer(const Scope& layer);
|
|
|
- void ReadLayerElement(const Scope& layerElement);
|
|
|
- void ReadVertexData(const std::string& type, int index, const Scope& source);
|
|
|
-
|
|
|
- void ReadVertexDataUV(std::vector<aiVector2D>& uv_out, const Scope& source,
|
|
|
- const std::string& MappingInformationType,
|
|
|
- const std::string& ReferenceInformationType);
|
|
|
-
|
|
|
- void ReadVertexDataNormals(std::vector<aiVector3D>& normals_out, const Scope& source,
|
|
|
- const std::string& MappingInformationType,
|
|
|
- const std::string& ReferenceInformationType);
|
|
|
-
|
|
|
- void ReadVertexDataColors(std::vector<aiColor4D>& colors_out, const Scope& source,
|
|
|
- const std::string& MappingInformationType,
|
|
|
- const std::string& ReferenceInformationType);
|
|
|
-
|
|
|
- void ReadVertexDataTangents(std::vector<aiVector3D>& tangents_out, const Scope& source,
|
|
|
- const std::string& MappingInformationType,
|
|
|
- const std::string& ReferenceInformationType);
|
|
|
-
|
|
|
- void ReadVertexDataBinormals(std::vector<aiVector3D>& binormals_out, const Scope& source,
|
|
|
- const std::string& MappingInformationType,
|
|
|
- const std::string& ReferenceInformationType);
|
|
|
-
|
|
|
- void ReadVertexDataMaterials(MatIndexArray& materials_out, const Scope& source,
|
|
|
- const std::string& MappingInformationType,
|
|
|
- const std::string& ReferenceInformationType);
|
|
|
-
|
|
|
-private:
|
|
|
-
|
|
|
- // cached data arrays
|
|
|
- MatIndexArray materials;
|
|
|
- std::vector<aiVector3D> vertices;
|
|
|
- std::vector<unsigned int> faces;
|
|
|
- mutable std::vector<unsigned int> facesVertexStartIndices;
|
|
|
- std::vector<aiVector3D> tangents;
|
|
|
- std::vector<aiVector3D> binormals;
|
|
|
- std::vector<aiVector3D> normals;
|
|
|
-
|
|
|
- std::string uvNames[AI_MAX_NUMBER_OF_TEXTURECOORDS];
|
|
|
- std::vector<aiVector2D> uvs[AI_MAX_NUMBER_OF_TEXTURECOORDS];
|
|
|
- std::vector<aiColor4D> colors[AI_MAX_NUMBER_OF_COLOR_SETS];
|
|
|
-
|
|
|
- std::vector<unsigned int> mapping_counts;
|
|
|
- std::vector<unsigned int> mapping_offsets;
|
|
|
- std::vector<unsigned int> mappings;
|
|
|
-};
|
|
|
-
|
|
|
typedef std::vector<int64_t> KeyTimeList;
|
|
|
typedef std::vector<float> KeyValueList;
|
|
|
|
|
@@ -939,12 +713,9 @@ typedef std::vector<float> KeyValueList;
|
|
|
class AnimationCurve : public Object
|
|
|
{
|
|
|
public:
|
|
|
-
|
|
|
AnimationCurve(uint64_t id, const Element& element, const std::string& name, const Document& doc);
|
|
|
virtual ~AnimationCurve();
|
|
|
|
|
|
-public:
|
|
|
-
|
|
|
/** get list of keyframe positions (time).
|
|
|
* Invariant: |GetKeys()| > 0 */
|
|
|
const KeyTimeList& GetKeys() const {
|
|
@@ -968,7 +739,6 @@ public:
|
|
|
}
|
|
|
|
|
|
private:
|
|
|
-
|
|
|
KeyTimeList keys;
|
|
|
KeyValueList values;
|
|
|
std::vector<float> attributes;
|
|
@@ -983,7 +753,6 @@ typedef std::map<std::string, const AnimationCurve*> AnimationCurveMap;
|
|
|
class AnimationCurveNode : public Object
|
|
|
{
|
|
|
public:
|
|
|
-
|
|
|
/* the optional white list specifies a list of property names for which the caller
|
|
|
wants animations for. If the curve node does not match one of these, std::range_error
|
|
|
will be thrown. */
|
|
@@ -992,8 +761,6 @@ public:
|
|
|
|
|
|
virtual ~AnimationCurveNode();
|
|
|
|
|
|
-public:
|
|
|
-
|
|
|
const PropertyTable& Props() const {
|
|
|
ai_assert(props.get());
|
|
|
return *props.get();
|
|
@@ -1023,7 +790,6 @@ public:
|
|
|
}
|
|
|
|
|
|
private:
|
|
|
-
|
|
|
const Object* target;
|
|
|
boost::shared_ptr<const PropertyTable> props;
|
|
|
mutable AnimationCurveMap curves;
|
|
@@ -1039,13 +805,9 @@ typedef std::vector<const AnimationCurveNode*> AnimationCurveNodeList;
|
|
|
class AnimationLayer : public Object
|
|
|
{
|
|
|
public:
|
|
|
-
|
|
|
-
|
|
|
AnimationLayer(uint64_t id, const Element& element, const std::string& name, const Document& doc);
|
|
|
virtual ~AnimationLayer();
|
|
|
|
|
|
-public:
|
|
|
-
|
|
|
const PropertyTable& Props() const {
|
|
|
ai_assert(props.get());
|
|
|
return *props.get();
|
|
@@ -1057,7 +819,6 @@ public:
|
|
|
AnimationCurveNodeList Nodes(const char* const * target_prop_whitelist = NULL, size_t whitelist_size = 0) const;
|
|
|
|
|
|
private:
|
|
|
-
|
|
|
boost::shared_ptr<const PropertyTable> props;
|
|
|
const Document& doc;
|
|
|
};
|
|
@@ -1070,31 +831,25 @@ typedef std::vector<const AnimationLayer*> AnimationLayerList;
|
|
|
class AnimationStack : public Object
|
|
|
{
|
|
|
public:
|
|
|
-
|
|
|
AnimationStack(uint64_t id, const Element& element, const std::string& name, const Document& doc);
|
|
|
virtual ~AnimationStack();
|
|
|
|
|
|
public:
|
|
|
-
|
|
|
fbx_simple_property(LocalStart, int64_t, 0L)
|
|
|
fbx_simple_property(LocalStop, int64_t, 0L)
|
|
|
fbx_simple_property(ReferenceStart, int64_t, 0L)
|
|
|
fbx_simple_property(ReferenceStop, int64_t, 0L)
|
|
|
|
|
|
-
|
|
|
-
|
|
|
const PropertyTable& Props() const {
|
|
|
ai_assert(props.get());
|
|
|
return *props.get();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
const AnimationLayerList& Layers() const {
|
|
|
return layers;
|
|
|
}
|
|
|
|
|
|
private:
|
|
|
-
|
|
|
boost::shared_ptr<const PropertyTable> props;
|
|
|
AnimationLayerList layers;
|
|
|
};
|
|
@@ -1104,19 +859,15 @@ private:
|
|
|
class Deformer : public Object
|
|
|
{
|
|
|
public:
|
|
|
-
|
|
|
Deformer(uint64_t id, const Element& element, const Document& doc, const std::string& name);
|
|
|
virtual ~Deformer();
|
|
|
|
|
|
-public:
|
|
|
-
|
|
|
const PropertyTable& Props() const {
|
|
|
ai_assert(props.get());
|
|
|
return *props.get();
|
|
|
}
|
|
|
|
|
|
private:
|
|
|
-
|
|
|
boost::shared_ptr<const PropertyTable> props;
|
|
|
};
|
|
|
|
|
@@ -1128,11 +879,8 @@ typedef std::vector<unsigned int> WeightIndexArray;
|
|
|
class Cluster : public Deformer
|
|
|
{
|
|
|
public:
|
|
|
-
|
|
|
Cluster(uint64_t id, const Element& element, const Document& doc, const std::string& name);
|
|
|
- ~Cluster();
|
|
|
-
|
|
|
-public:
|
|
|
+ virtual ~Cluster();
|
|
|
|
|
|
/** get the list of deformer weights associated with this cluster.
|
|
|
* Use #GetIndices() to get the associated vertices. Both arrays
|
|
@@ -1162,7 +910,6 @@ public:
|
|
|
}
|
|
|
|
|
|
private:
|
|
|
-
|
|
|
WeightArray weights;
|
|
|
WeightIndexArray indices;
|
|
|
|
|
@@ -1178,34 +925,26 @@ private:
|
|
|
class Skin : public Deformer
|
|
|
{
|
|
|
public:
|
|
|
-
|
|
|
Skin(uint64_t id, const Element& element, const Document& doc, const std::string& name);
|
|
|
virtual ~Skin();
|
|
|
|
|
|
-public:
|
|
|
-
|
|
|
float DeformAccuracy() const {
|
|
|
return accuracy;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
const std::vector<const Cluster*>& Clusters() const {
|
|
|
return clusters;
|
|
|
}
|
|
|
|
|
|
private:
|
|
|
-
|
|
|
float accuracy;
|
|
|
std::vector<const Cluster*> clusters;
|
|
|
};
|
|
|
|
|
|
-
|
|
|
-
|
|
|
/** Represents a link between two FBX objects. */
|
|
|
class Connection
|
|
|
{
|
|
|
public:
|
|
|
-
|
|
|
Connection(uint64_t insertionOrder, uint64_t src, uint64_t dest, const std::string& prop, const Document& doc);
|
|
|
~Connection();
|
|
|
|
|
@@ -1231,6 +970,8 @@ public:
|
|
|
}
|
|
|
|
|
|
int CompareTo(const Connection* c) const {
|
|
|
+ ai_assert( NULL != c );
|
|
|
+
|
|
|
// note: can't subtract because this would overflow uint64_t
|
|
|
if(InsertionOrder() > c->InsertionOrder()) {
|
|
|
return 1;
|
|
@@ -1242,11 +983,12 @@ public:
|
|
|
}
|
|
|
|
|
|
bool Compare(const Connection* c) const {
|
|
|
+ ai_assert( NULL != c );
|
|
|
+
|
|
|
return InsertionOrder() < c->InsertionOrder();
|
|
|
}
|
|
|
|
|
|
public:
|
|
|
-
|
|
|
uint64_t insertionOrder;
|
|
|
const std::string prop;
|
|
|
|
|
@@ -1254,17 +996,16 @@ public:
|
|
|
const Document& doc;
|
|
|
};
|
|
|
|
|
|
+// XXX again, unique_ptr would be useful. shared_ptr is too
|
|
|
+// bloated since the objects have a well-defined single owner
|
|
|
+// during their entire lifetime (Document). FBX files have
|
|
|
+// up to many thousands of objects (most of which we never use),
|
|
|
+// so the memory overhead for them should be kept at a minimum.
|
|
|
+typedef std::map<uint64_t, LazyObject*> ObjectMap;
|
|
|
+typedef std::fbx_unordered_map<std::string, boost::shared_ptr<const PropertyTable> > PropertyTemplateMap;
|
|
|
|
|
|
- // XXX again, unique_ptr would be useful. shared_ptr is too
|
|
|
- // bloated since the objects have a well-defined single owner
|
|
|
- // during their entire lifetime (Document). FBX files have
|
|
|
- // up to many thousands of objects (most of which we never use),
|
|
|
- // so the memory overhead for them should be kept at a minimum.
|
|
|
- typedef std::map<uint64_t, LazyObject*> ObjectMap;
|
|
|
- typedef std::fbx_unordered_map<std::string, boost::shared_ptr<const PropertyTable> > PropertyTemplateMap;
|
|
|
|
|
|
-
|
|
|
- typedef std::multimap<uint64_t, const Connection*> ConnectionMap;
|
|
|
+typedef std::multimap<uint64_t, const Connection*> ConnectionMap;
|
|
|
|
|
|
|
|
|
/** DOM class for global document settings, a single instance per document can
|
|
@@ -1272,12 +1013,9 @@ public:
|
|
|
class FileGlobalSettings
|
|
|
{
|
|
|
public:
|
|
|
-
|
|
|
FileGlobalSettings(const Document& doc, boost::shared_ptr<const PropertyTable> props);
|
|
|
~FileGlobalSettings();
|
|
|
|
|
|
-public:
|
|
|
-
|
|
|
const PropertyTable& Props() const {
|
|
|
ai_assert(props.get());
|
|
|
return *props.get();
|
|
@@ -1287,7 +1025,6 @@ public:
|
|
|
return doc;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
fbx_simple_property(UpAxis, int, 1)
|
|
|
fbx_simple_property(UpAxisSign, int, 1)
|
|
|
fbx_simple_property(FrontAxis, int, 2)
|
|
@@ -1327,9 +1064,7 @@ public:
|
|
|
fbx_simple_property(TimeSpanStop, uint64_t, 0L)
|
|
|
fbx_simple_property(CustomFrameRate, float, -1.0f)
|
|
|
|
|
|
-
|
|
|
private:
|
|
|
-
|
|
|
boost::shared_ptr<const PropertyTable> props;
|
|
|
const Document& doc;
|
|
|
};
|
|
@@ -1341,12 +1076,9 @@ private:
|
|
|
class Document
|
|
|
{
|
|
|
public:
|
|
|
-
|
|
|
Document(const Parser& parser, const ImportSettings& settings);
|
|
|
~Document();
|
|
|
|
|
|
-public:
|
|
|
-
|
|
|
LazyObject* GetObject(uint64_t id) const;
|
|
|
|
|
|
bool IsBinary() const {
|
|
@@ -1361,7 +1093,7 @@ public:
|
|
|
return creator;
|
|
|
}
|
|
|
|
|
|
- // elements (in this order): Uear, Month, Day, Hour, Second, Millisecond
|
|
|
+ // elements (in this order): Year, Month, Day, Hour, Second, Millisecond
|
|
|
const unsigned int* CreationTimeStamp() const {
|
|
|
return creationTimeStamp;
|
|
|
}
|
|
@@ -1412,7 +1144,6 @@ public:
|
|
|
const std::vector<const AnimationStack*>& AnimationStacks() const;
|
|
|
|
|
|
private:
|
|
|
-
|
|
|
std::vector<const Connection*> GetConnectionsSequenced(uint64_t id, const ConnectionMap&) const;
|
|
|
std::vector<const Connection*> GetConnectionsSequenced(uint64_t id, bool is_src,
|
|
|
const ConnectionMap&,
|
|
@@ -1420,7 +1151,6 @@ private:
|
|
|
size_t count) const;
|
|
|
|
|
|
private:
|
|
|
-
|
|
|
void ReadHeader();
|
|
|
void ReadObjects();
|
|
|
void ReadPropertyTemplates();
|
|
@@ -1428,7 +1158,6 @@ private:
|
|
|
void ReadGlobalSettings();
|
|
|
|
|
|
private:
|
|
|
-
|
|
|
const ImportSettings& settings;
|
|
|
|
|
|
ObjectMap objects;
|
|
@@ -1448,7 +1177,7 @@ private:
|
|
|
boost::scoped_ptr<FileGlobalSettings> globals;
|
|
|
};
|
|
|
|
|
|
-}
|
|
|
-}
|
|
|
+} // Namespace FBX
|
|
|
+} // Namespace Assimp
|
|
|
|
|
|
-#endif
|
|
|
+#endif // INCLUDED_AI_FBX_DOCUMENT_H
|