Torque3D/Engine/lib/assimp/code/MD4/MD4FileData.h

219 lines
6 KiB
C
Raw Normal View History

2019-02-08 22:25:43 +00:00
/*
Open Asset Import Library (ASSIMP)
----------------------------------------------------------------------
Updated Assimp Added initial behavior for ImageAssets to hold a list of GFX resources of different texture profiles to avoid mem leaks with incorrect-typed usages Added function to ImageAsset to get best-fit asset, allowing for fallbacks if the requested assetID is not found Added function to ShapeAsset to get best-fit asset, allowing for fallbacks if the requested assetID is not found Disabled fields for dynamic and static shadowmap refresh rates Moved noShape model to core/rendering/shapes to place it in a more logical module position Added an include to avoid undefined type compile error and removed unneeded semicolon from zone code Added call to reload probe textures when a reloadTextures call is made Adjusted default directional light shadowmap settings to not be as extreme Added utility function to probe manager to allow any class to request a 'best fit' list of probes that would affect a given location, allowing other classes such as fog or particles to utilize IBL. Also updated probeManager's forward rendering to utilize same function to reduce code duplication. Shifted shape loader code to utilize assimp for loader consistency and testing Changed render bin used for SSAO postfx so it runs at the right time Made Core_Rendering module scan for assets Updated loose file references to a number of assets to follow proper formatting Refactored asset import code to follow a more consistent object heirarchy structure on importing assets, allowing more reliable cross-referencing between inbound items Updated asset import logic for materials/images so that they properly utilize ImageType. Images correctly save out the assigned image type, materials reference the images' type to know what map slot they should be used in. Importer logic also updated to better find-and-add associated images based on type. Cleaned up a bunch of old, outdated code in the asset importer Added initial handling for in-place importing of files without needing to process them through the UI. Added ability to edit module script from RMB context menu if torsion path is set Updated list field code for variable inspector to utilize correct ownerObject field
2020-03-19 14:47:38 +00:00
Copyright (c) 2006-2020, ASSIMP Development Team
2019-02-08 22:25:43 +00:00
All rights reserved.
Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the
following conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
* Neither the name of the ASSIMP team, nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior
written permission of the ASSIMP Development Team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
----------------------------------------------------------------------
*/
/** @file Defines the helper data structures for importing MD4 files */
#ifndef AI_MD4FILEHELPER_H_INC
#define AI_MD4FILEHELPER_H_INC
#include <string>
#include <vector>
#include <sstream>
2019-03-05 20:39:38 +00:00
#include <assimp/types.h>
#include <assimp/mesh.h>
#include <assimp/anim.h>
2019-02-08 22:25:43 +00:00
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack(push,1)
# define PACK_STRUCT
#elif defined( __GNUC__ )
# define PACK_STRUCT __attribute__((packed))
#else
# error Compiler not supported
#endif
namespace Assimp
{
// http://gongo.quakedev.com/md4.html
namespace MD4
{
#define AI_MD4_MAGIC_NUMBER_BE 'IDP4'
#define AI_MD4_MAGIC_NUMBER_LE '4PDI'
// common limitations
#define AI_MD4_VERSION 4
#define AI_MD4_MAXQPATH 64
#define AI_MD4_MAX_FRAMES 2028
#define AI_MD4_MAX_SURFACES 32
#define AI_MD4_MAX_BONES 256
#define AI_MD4_MAX_VERTS 4096
#define AI_MD4_MAX_TRIANGLES 8192
// ---------------------------------------------------------------------------
/** \brief Data structure for the MD4 main header
*/
// ---------------------------------------------------------------------------
struct Header
{
//! magic number
int32_t magic;
//! file format version
int32_t version;
//! original name in .pak archive
unsigned char name[ AI_MD4_MAXQPATH ];
//! number of frames in the file
int32_t NUM_FRAMES;
//! number of bones in the file
int32_t NUM_BONES;
//! number of surfaces in the file
int32_t NUM_SURFACES;
//! offset of the first frame
int32_t OFS_FRAMES;
//! offset of the first bone
int32_t OFS_BONES;
//! offset of the first surface
int32_t OFS_SURFACES;
//! end of file
int32_t OFS_EOF;
} PACK_STRUCT;
// ---------------------------------------------------------------------------
/** \brief Stores the local transformation matrix of a bone
*/
// ---------------------------------------------------------------------------
struct BoneFrame
{
float matrix[3][4];
} PACK_STRUCT;
// ---------------------------------------------------------------------------
/** \brief Stores the name / parent index / flag of a node
*/
// ---------------------------------------------------------------------------
struct BoneName
{
char name[32] ;
int parent ;
int flags ;
} PACK_STRUCT;
// ---------------------------------------------------------------------------
/** \brief Data structure for a surface in a MD4 file
*/
// ---------------------------------------------------------------------------
struct Surface
{
int32_t ident;
char name[64];
char shader[64];
int32_t shaderIndex;
int32_t lodBias;
int32_t minLod;
int32_t ofsHeader;
int32_t numVerts;
int32_t ofsVerts;
int32_t numTris;
int32_t ofsTris;
int32_t numBoneRefs;
int32_t ofsBoneRefs;
int32_t ofsCollapseMap;
int32_t ofsEnd;
} PACK_STRUCT;
// ---------------------------------------------------------------------------
/** \brief Data structure for a MD4 vertex' weight
*/
// ---------------------------------------------------------------------------
struct Weight
{
int32_t boneIndex;
float boneWeight;
float offset[3];
} PACK_STRUCT;
// ---------------------------------------------------------------------------
/** \brief Data structure for a vertex in a MD4 file
*/
// ---------------------------------------------------------------------------
struct Vertex
{
float vertex[3];
float normal[3];
float texCoords[2];
int32_t numWeights;
Weight weights[1];
} PACK_STRUCT;
// ---------------------------------------------------------------------------
/** \brief Data structure for a triangle in a MD4 file
*/
// ---------------------------------------------------------------------------
struct Triangle
{
int32_t indexes[3];
} PACK_STRUCT;
// ---------------------------------------------------------------------------
/** \brief Data structure for a MD4 frame
*/
// ---------------------------------------------------------------------------
struct Frame
{
float bounds[3][2];
float localOrigin[3];
float radius;
BoneFrame bones[1];
} PACK_STRUCT;
// reset packing to the original value
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( pop )
#endif
#undef PACK_STRUCT
};
};
#endif // !! AI_MD4FILEHELPER_H_INC