diff options
Diffstat (limited to 'src/3rdparty/assimp/code/MD3FileData.h')
-rw-r--r-- | src/3rdparty/assimp/code/MD3FileData.h | 61 |
1 files changed, 29 insertions, 32 deletions
diff --git a/src/3rdparty/assimp/code/MD3FileData.h b/src/3rdparty/assimp/code/MD3FileData.h index 88a40f230..19740c30e 100644 --- a/src/3rdparty/assimp/code/MD3FileData.h +++ b/src/3rdparty/assimp/code/MD3FileData.h @@ -2,7 +2,8 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. Redistribution and use of this software in source and binary forms, @@ -136,34 +137,33 @@ struct Frame aiVector3D origin; //! radius of bounding sphere - float radius; + ai_real radius; //! name of frame char name[ AI_MD3_MAXFRAME ]; -} PACK_STRUCT; +} /* PACK_STRUCT */; // ------------------------------------------------------------------------------- -/** @brief Data structure for the tag header +/** + * @brief Data structure for the tag header */ -struct Tag -{ +struct Tag { //! name of the tag char NAME[ AI_MD3_MAXQPATH ]; //! Local tag origin and orientation aiVector3D origin; - float orientation[3][3]; + ai_real orientation[3][3]; -} PACK_STRUCT; +} /* PACK_STRUCT */; // ------------------------------------------------------------------------------- /** @brief Data structure for the surface header */ -struct Surface -{ +struct Surface { //! magic number int32_t IDENT; @@ -185,7 +185,6 @@ struct Surface //! number of triangles in the surface uint32_t NUM_TRIANGLES; - //! offset to the triangle data uint32_t OFS_TRIANGLES; @@ -200,19 +199,18 @@ struct Surface //! offset to the end of the Surface object int32_t OFS_END; -} PACK_STRUCT; +} /*PACK_STRUCT*/; // ------------------------------------------------------------------------------- /** @brief Data structure for a shader defined in there */ -struct Shader -{ +struct Shader { //! filename of the shader char NAME[ AI_MD3_MAXQPATH ]; //! index of the shader uint32_t SHADER_INDEX; -} PACK_STRUCT; +} /*PACK_STRUCT*/; // ------------------------------------------------------------------------------- @@ -222,7 +220,7 @@ struct Triangle { //! triangle indices uint32_t INDEXES[3]; -} PACK_STRUCT; +} /*PACK_STRUCT*/; // ------------------------------------------------------------------------------- @@ -231,8 +229,8 @@ struct Triangle struct TexCoord { //! UV coordinates - float U,V; -} PACK_STRUCT; + ai_real U,V; +} /*PACK_STRUCT*/; // ------------------------------------------------------------------------------- @@ -245,7 +243,7 @@ struct Vertex //! encoded normal vector uint16_t NORMAL; -} PACK_STRUCT; +} /*PACK_STRUCT*/; #include "./../include/assimp/Compiler/poppack1.h" @@ -257,17 +255,17 @@ struct Vertex * * @note This has been taken from q3 source (misc_model.c) */ -inline void LatLngNormalToVec3(uint16_t p_iNormal, float* p_afOut) +inline void LatLngNormalToVec3(uint16_t p_iNormal, ai_real* p_afOut) { - float lat = (float)(( p_iNormal >> 8u ) & 0xff); - float lng = (float)(( p_iNormal & 0xff )); - lat *= 3.141926f/128.0f; - lng *= 3.141926f/128.0f; - - p_afOut[0] = std::cos(lat) * std::sin(lng); - p_afOut[1] = std::sin(lat) * std::sin(lng); - p_afOut[2] = std::cos(lng); - return; + ai_real lat = (ai_real)(( p_iNormal >> 8u ) & 0xff); + ai_real lng = (ai_real)(( p_iNormal & 0xff )); + const ai_real invVal( ai_real( 1.0 ) / ai_real( 128.0 ) ); + lat *= ai_real( 3.141926 ) * invVal; + lng *= ai_real( 3.141926 ) * invVal; + + p_afOut[ 0 ] = std::cos(lat) * std::sin(lng); + p_afOut[ 1 ] = std::sin(lat) * std::sin(lng); + p_afOut[ 2 ] = std::cos(lng); } @@ -298,10 +296,10 @@ inline void Vec3NormalToLatLng( const aiVector3D& p_vIn, uint16_t& p_iOut ) { int a, b; - a = int(57.2957795f * ( atan2f( p_vIn[1], p_vIn[0] ) ) * (255.0f / 360.0f )); + a = int(57.2957795f * ( std::atan2( p_vIn[1], p_vIn[0] ) ) * (255.0f / 360.0f )); a &= 0xff; - b = int(57.2957795f * ( acosf( p_vIn[2] ) ) * ( 255.0f / 360.0f )); + b = int(57.2957795f * ( std::acos( p_vIn[2] ) ) * ( 255.0f / 360.0f )); b &= 0xff; ((unsigned char*)&p_iOut)[0] = b; // longitude @@ -313,4 +311,3 @@ inline void Vec3NormalToLatLng( const aiVector3D& p_vIn, uint16_t& p_iOut ) } #endif // !! AI_MD3FILEHELPER_H_INC - |