- #pragma warning(disable : 4345) //warning C4345: behavior change: an object of POD type constructed with an initializer of the form () will be default-initialized
- inline int FBXSDK_sprintf(char* dst, size_t dstsize, const char* format, ...){ va_list vl; va_start(vl, format); int ret = vsprintf(dst, format, vl); va_end(vl); return ret; }
- inline int FBXSDK_snprintf(char* dst, size_t dstsize, const char* format, ...){ va_list vl; va_start(vl, format); int ret = vsnprintf(dst, dstsize, format, vl); va_end(vl); return ret; }
- inline int FBXSDK_vsprintf(char* dst, size_t dstsize, const char* format, va_list vl){ return vsprintf(dst, format, vl); }
- inline int FBXSDK_vsnprintf(char* dst, size_t dstsize, const char* format, va_list vl){ return vsnprintf(dst, dstsize, format, vl); }
- /** Append an element at the end of the array, growing the array by one element if capacity is not sufficient.
- * \param pElement Element to append to the array.
- * \return -1 if add failed, otherwise the position of the added element in the array. */
- inline int AddCompact(const T& pElement)
- {
- return InsertAt(mSize, pElement, true);
- }
-
- /** Retrieve the number of element contained in the array. To increase the capacity without increasing the size, please use Reserve().
- * \return The number of element in the array.
- * \remark The size of the array cannot exceed its capacity. */
- inline int Size() const { return mSize; }
-
- /** Retrieve the current allocated memory capacity of the array.
- * \return The capacity of the array in number of element.
- * \remark The capacity will always be greater or equal to its size. */
- inline int Capacity() const { return mCapacity; }
-
- /** Retrieve a reference of the element at given index position in the array.
- * \param pIndex Position of element in the array.
- * \return A reference to the element at the specified position in the array.
- * \remark No error will be thrown if the index is out of bounds. */
- inline T& operator[](const int pIndex) const
- {
- #ifdef _DEBUG
- FBX_ASSERT_MSG(pIndex >= 0, "Index is out of range!");
- if( pIndex >= mSize )
- {
- if( pIndex < mCapacity )
- {
- FBX_ASSERT_NOW("Index is out of range, but not outside of capacity! Call SetAt() to use reserved memory.");
- }
- else FBX_ASSERT_NOW("Index is out of range!");
- }
- #endif
- return (T&)mArray[pIndex];
- }
-
- /** Retrieve a copy of the element at given index position in the array.
- * \param pIndex Position of element in the array.
- * \return The value of the element at the specified position in the array.
- * \remark No error will be thrown if the index is out of bounds. */
- inline T GetAt(const int pIndex) const
- {
- return operator[](pIndex);
- }
-
- /** Retrieve a copy of the first element.
- * \return Copy of the first element.
- * \remark The array should have at least one element and no error will be thrown if the array is empty. */
- inline T GetFirst() const
- {
- return GetAt(0);
- }
-
- /** Retrieve a copy of the last element.
- * \return Copy of the last element.
- * \remark The array should have at least one element and no error will be thrown if the array is empty. */
- inline T GetLast() const
- {
- return GetAt(mSize-1);
- }
-
- /** Find first matching element, from first to last.
- * \param pElement The element to be compared to each of the elements.
- * \param pStartIndex The position to start searching from.
- * \return Position of first matching element or -1 if there is no matching element. */
- inline int Find(const T& pElement, const int pStartIndex=0) const
- {
- FBX_ASSERT_RETURN_VALUE(pStartIndex >= 0, -1);
- for( int i = pStartIndex; i < mSize; ++i )
- {
- if( operator[](i) == pElement ) return i;
- }
- return -1;
- }
-
- /** Find first matching element, from last to first.
- * \param pElement The element to be compared to each of the elements.
- * \param pStartIndex The position to start searching from.
- * \return Position of first matching element or -1 if there is no matching element. */
- inline int FindReverse(const T& pElement, const int pStartIndex=FBXSDK_INT_MAX) const
- {
- for( int i = FbxMin(pStartIndex, mSize-1); i >= 0; --i )
- {
- if( operator[](i) == pElement ) return i;
- }
- return -1;
- }
-
- /** Request for allocation of additional memory without inserting new elements. After the memory has been reserved, please use SetAt() to initialize elements.
- * \param pCapacity The number of additional element memory allocation requested.
- * \return \c true if the memory allocation succeeded or if the capacity is unchanged, \c false otherwise.
- * \remark If the requested capacity is less than or equal to the current capacity, this call has no effect. In either case, Size() is unchanged. */
- /** Inserts or erases elements at the end such that Size() becomes pSize, increasing capacity if needed. Please use SetAt() to initialize any new elements.
- * \param pSize The new count of elements to set the array to. Must be greater or equal to zero.
- * \return \c true if the memory (re)allocation succeeded, \c false otherwise.
- * \remark If the requested element count is less than or equal to the current count, elements are freed from memory. Otherwise, the array grows and elements are unchanged. */
- /** Memory pool destructor. Upon destruction, all memory blocks of the pool will be de-allocated. */
- ~FbxMemoryPool();
-
- /** Free memory of all memory blocks from this memory pool, also effectively resetting the block count to zero.
- * \remark The block size and alignment/resize/concurrent support will remain unchanged. */
- void Reset();
-
- /** Allocate or lock a memory block for usage.
- * \return An memory block pointer that can be NULL if the memory pool cannot grow in size and no blocks are available. */
- void* Allocate();
-
- /** Dispose or unlock a memory block.
- * \param pMemBlock A pointer to the memory block to release. This will not free the block's memory, instead simply putting it back in the available stack. */
- * \return The class identification string name. */
- const char* GetName() const;
-
- /** Retrieve the parent ClassId.
- * \return The parent ClassId. */
- FbxClassId GetParent() const;
-
- /** Create an instance of this class.
- * \param pManager The FBX SDK Manager to be used to instantiate this object. This allow the object to use the same memory manager as the provided manager.
- * \param pName The name to assign to this new object instance.
- * \param pFrom An object to clone if it matches the same ClassId. This is an optional parameter.
- * \return The newly created instance of this class. */
- /** Test if this class is a hierarchical children of the specified class type. This is the standard method to differentiate object classes.
- * \param pId The class type to test against self.
- * \return True if the object is a hierarchical children of the type specified.
- * \remark This function will perform a complete search until it reaches the top level class, but it will stop as soon as one ClassId matches the test. */
- bool Is(const FbxClassId& pId) const;
-
- /** Equivalence operator.
- * \param pClassId The class type to test against self.
- * \return \c true if the ClassId is exactly the same, \c false otherwise.
- * \remark This function only perform direct equality test, and doesn't test hierarchic children. */
-/** Frees the loaded module and, if necessary, decrements its reference count.
- * \param pModuleHandle A valid module handle.
- * \return \c true on success, \c false otherwise.
- * \remark When the reference count reaches zero, the module is unloaded from the address space of the calling process and the handle is no longer valid.
- /** Virtual function called once after the FBX SDK read an FBX file. Users can re-implement it in their plug-in if they need
- * to perform tasks at that moment. The scene provided in parameter can be altered. If not re-implemented, this function does nothing.
- * \param pScene The scene that was read in the FBX file.
- */
- virtual void ReadEnd(FbxScene& pScene);
-
- /** Accessor to the plug-in definition structure that contains basic information on the plug-in like its name or version. This is
- * the only method available to differentiate plug-ins.
- * \return The definition structure for this plug-in.
- */
- const FbxPluginDef& GetDefinition() const;
-
- /** Retrieve the module address pointer for this plug-in. With this module instance handle, for example someone can query procedures addresses,
- * allowing more complex interactions, as well as other operating system module specific functions.
- */
- FbxModule GetModuleHdl();
-
-protected:
- /** Use the Create() and Destroy() methods declared and implemented in the FBXSDK_PLUGIN_DECLARE and FBXSDK_PLUGIN_IMPLEMENT macros to construct and destroy FbxPlugin objects.
- * \param pDefinition The definition associated with this plug-in. Each plug-in must have its own definition to differentiate it with other plug-ins.
- * \param pModuleHandle A pointer to the plug-in module address.
- /** This compares whether two FbxQuery are the same, NOT whether the query matches or not. It's strictly the equivalent of an operator==, but virtual.
-//! A plug-in loading strategy that loads all DLLs with a specific extension from a specific directory. When this class is destroyed all of the plug-ins are unloaded.
-class FBXSDK_DLL FbxScopedLoadingDirectory : public FbxLoadingStrategy
-{
-public:
- /** Constructor, which also load plug-ins in the folder specified.
- * \param pDirectoryPath The directory path.
- * \param pPluginExtension The plug-in extension. */
- * Matrices are defined using the Column Major scheme. When a FbxAMatrix represents a transformation (translation, rotation and scale),
- * the last row of the matrix represents the translation part of the transformation.
- *
- * \remarks It is important to realize that an affine matrix must respect a certain structure. To be sure the structure is respected,
- * use SetT, SetR, SetS, SetQ, SetTRS or SetTQS. If by mistake bad data is entered in this affine matrix, some functions such as
- * Inverse() will yield wrong results. If a matrix is needed to hold values that aren't associate with an affine matrix, please use FbxMatrix instead.
- */
-class FBXSDK_DLL FbxAMatrix : public FbxDouble4x4
-#define FBXSDK_EULER_DEGENERATE FbxEuler::DegenerateThreshold() //!< Euler degenerate threshold can be changed with a call to FbxEuler::SetDegenerateThreshold.
-
-class FBXSDK_DLL FbxEuler
-{
-public:
- enum EAxis {eAxisX=0, eAxisY=1, eAxisZ=2};
-
- enum EOrder
- {
- eOrderXYZ,
- eOrderXZY,
- eOrderYZX,
- eOrderYXZ,
- eOrderZXY,
- eOrderZYX,
- eOrderSphericXYZ
- };
-
- static bool IsParityOdd(EOrder pOrder);
- static bool IsRepeat(EOrder pOrder);
-
- static const int AxisTableSize;
- static const int AxisTable[][3];
-
- // Used to detect Euler gimbal locks when extracting the rotation vector from
- // the FbxAMatrix. This value should only be changed when the user system stores
- // single floating point values into the FbxAMatrix with a very low precision.
- // In this case, the default threshold value would be too small for a proper detection
- // and the extracted values can quickly become off target by a huge amount.
- * The source string is made up with many groups and each group contains pSourceGroupSize units separated by spaces;
- * The destination array is also made up with many groups and each unit contains pDestGroupSize units.
- * The valid unit range in each source group is [pSourceUnitOffset, pSourceUnitOffset + pSourceValidUnitCount).
- * The valid unit range in each destination unit is [pDestUnitOffset, pDestUnitOffset + pDestValidUnitCount).
- * The units in invalid range of destination is set to a default value.
- */
-template <typename TYPE> int FromStringToArray(const char * pString, TYPE * pArray, int pSourceUnitOffset, int pSourceValidUnitCount, int pSourceGroupSize, int pDestUnitOffset, int pDestValidUnitCount, int pDestGroupSize, TYPE pDefaultValue = TYPE())
- /** Export FBX node attributes, create different libraries according to different node attribute type.
- * \param pXmlNode Pointer to XML Node.
- * \param pNode Pointer to FBX node.
- * \return Return true if FBX node attributes is exported successfully, false otherwise.
- * \remarks According to different FBX node attribute type, different libraries will be created, such as:
- * light, camera, geometry. See more details in CreateMeshLibrary(FbxNode* pNode), CreateCameraLibrary(FbxNode* pNode), CreateLightLibrary(FbxNode* pNode).
- /** Create geometry library for the given FBX node.
- * \param pNode Pointer to FBX node, its node attribute type should be FbxNodeAttribute::eMesh, or FbxNodeAttribute::eNurbs, or FbxNodeAttribute::ePatch.
- * \return Return pointer to XML mesh library node.
- * \remarks The returned XML node will be added to the geometry library,
- * the geometry library will be added to the Collada document by ExportLibraries(xmlNode* pXmlNode).
- /** Check whether the first three elements of the given vector are both zero.
- * \param pV the FBX vector4 to check.
- * \return Return true if one of the first three elements of pV is not zero, return false if all of the three elements are both zero.
- * \remarks If the absolute value of element is less than a tolerance, the element will be considered as zero.
- */
- bool NotZero(FbxVector4 pV);
-
- /** Check whether the first three elements of the given vector are both equal to the given value.
- * \param pV the FBX vector4 to check.
- * \param pValue the value to check.
- * \return Return true if one of the first three elements of pV is NOT equal to pValue, return false if all of the three elements are both equal to pValue.
- */
- bool NotValue(FbxVector4 pV, double pValue);
-
- /** Check whether the given value is zero.
- * \param pD the value to check.
- * \return Return true if pD is NOT zero, return false if pD is zero.
- * \remarks If the absolute value of pD is less than a tolerance, pD is considered as zero.
- */
- bool NotZero(double pD);
-
- /** Check whether the given node's translation is animated.
- * \param pNode the FBX node to check.
- * \return Return true if one of Translation X/Y/Z is animated, return false if both of Translation X/Y/Z are not animated.
- * \remarks If there is no key on one property, this property is not animated.
- * \param pInBuffer the input buffer containing Base64 data.
- * \param pInSize the size of the input data in bytes (must be a multiple of 4)
- * \param pOutBuffer the destination buffer.
- * \param pOutSize the capacity of the output buffer in bytes.
- * \return the number of bytes put in the output buffer, or -1 if the output buffer is too small, or contains invalid characters */
- int Decode(const void* pInBuffer, int pInSize, void* pOutBuffer, int pOutSize);
-
- /** Decodes the input buffer.
- * \param pInBuffer the input buffer containing Base64 data; its length is computed using strlen().
- * \param pOutBuffer the destination buffer.
- * \param pOutSize the capacity of the output buffer in bytes.
- * \return the number of bytes put in the output buffer. */
- int Decode(const char* pInBuffer, void* pOutBuffer, int pOutSize);
-};
-
-/** This class encodes data in the Base64 format. */
-class FBXSDK_DLL FbxBase64Encoder
-{
-public:
- /** Encodes the input buffer.
- * \param pInBuffer the input buffer containing data.
- * \param pInSize the size of the input data in bytes.
- * \param pOutBuffer the destination buffer, receives data encoded in Base64.
- * \param pOutSize the capacity of the output buffer in bytes, which should be at least 33% larger than the input buffer size, or 4 bytes whichever is more.
- * \return the number of bytes put in the output buffer, or -1 if we ran out of room. */
- int Encode(const void* pInBuffer, int pInSize, void* pOutBuffer, int pOutSize);
-
- /** Encodes the input buffer.
- * \param pInBuffer the input buffer containing data.
- * \param pInSize the size of the input data in bytes.
- * \param pOutBuffer the destination buffer; data is set, not appended.
- * \return the number of bytes put in the output buffer. */
- int Encode(const void* pInBuffer, int pInSize, FbxString& pOutBuffer);
-/** This class contains the global camera settings.
- * \nosubgrouping
- * \remarks This class exists for FBX version 6.x and earlier. The new FBX v7.x file format
- * that is now the default no longer uses it. The relevant data (a subset of this class) has
- * been moved to the FbxGlobalSettings object and should be used instead.
- */
-class FBXSDK_DLL FbxGlobalCameraSettings
-{
- FBXSDK_FRIEND_NEW();
-
-public:
- /** \name Default Camera Settings */
- //@{
- /** \enum EViewingMode Viewing modes. */
- enum EViewingMode
- {
- eStandard, //<! Standard view mode.
- eXRay, //<! X ray view mode.
- eModelsOnly //<! Model only view mode.
- };
-
- /** Sets the default camera.
- * \param pCameraName Name of the default camera.
- * \param pStatus The FbxStatus object to hold error codes.
- * \return \c True if camera name is valid, returns \c false if it is not valid.
- * \remark A valid camera name must be either one of the defined tokens (FBXSDK_CAMERA_PERSPECTIVE, FBXSDK_CAMERA_TOP, FBXSDK_CAMERA_BOTTOM, FBXSDK_CAMERA_FRONT, FBXSDK_CAMERA_BACK,
- * FBXSDK_CAMERA_RIGHT, FBXSDK_CAMERA_LEFT and FBXSDK_CAMERA_SWITCHER) or the name of a camera that is inserted in the node tree under the scene's root node. */
- /** Returns a reference to the Producer front camera.
- * \return The reference to the internal Front camera. */
- FbxCamera* GetCameraProducerFront() const;
-
- /** Returns a reference to the Producer back camera.
- * \return The reference to the internal Back camera. */
- FbxCamera* GetCameraProducerBack() const;
-
- /** Returns a reference to the Producer left camera.
- * \return The reference to the internal Left camera. */
- FbxCamera* GetCameraProducerLeft() const;
-
- /** Returns a reference to the Producer right camera.
- * \return The reference to the internal Right camera. */
- FbxCamera* GetCameraProducerRight() const;
-
- /** Returns a reference to the Producer top camera.
- * \return The reference to the internal Top camera. */
- FbxCamera* GetCameraProducerTop() const;
-
- /** Returns a reference to the Producer bottom camera.
- * \return The reference to the internal Bottom camera. */
- FbxCamera* GetCameraProducerBottom() const;
-
- /** Returns the Camera Switcher.
- * \return A pointer to the Camera Switcher.
- * \remark This node has a \c FbxNodeAttribute::eCameraSwitcher node attribute type. This node is not saved when there is no camera in the scene. Nodes inserted below are never saved.
- * Camera indices start at 1. Out of range indices are clamped between 1 and the number of cameras in the scene. The index of a camera refers to its order of appearance when searching
- * the node tree depth first. If a camera is added or removed after camera indices have been set, the camera indices must be updated. It is easier to set camera indices once every camera
- * have been set. Camera index keys must be set using constant interpolation to ensure that camera switches occur exactly at key time. */
- FbxCameraSwitcher* GetCameraSwitcher() const;
-
- /** Sets the Camera Switcher.
- * \param pSwitcher The Camera Switcher to be set. */
- * \brief A gobo is a filter placed over a spot light to project light patterns through fog on a surface.
- * You can also use an image file as a gobo, which cause the light to project an image, much like a projector.
- */
-class FbxGobo
-{
-public:
- FbxGobo(char* pName) :
- mName(pName)
- {
- }
-
- //! Gobo name.
- FbxString mName;
- //! path and file name of the image file.
- FbxString mFileName;
- //! Flag that if shows the light projected on the ground.
- bool mDrawGroundProjection;
- //! Flag that lets you create a volumetric lighting effect by making the light stream visible.
- bool mVolumetricLightProjection;
- //! Flag that front facing light occurs when the camera view is looking down or up the light stream of a Spot light, which makes the light stream look three-dimensional.