vrshoot

diff libs/assimp/ASEParser.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/ASEParser.h	Sat Feb 01 19:58:19 2014 +0200
     1.3 @@ -0,0 +1,669 @@
     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 +
    1.45 +/** @file Defines the helper data structures for importing ASE files  */
    1.46 +#ifndef AI_ASEFILEHELPER_H_INC
    1.47 +#define AI_ASEFILEHELPER_H_INC
    1.48 +
    1.49 +// STL/CRT headers
    1.50 +#include <string>
    1.51 +#include <vector>
    1.52 +#include <list>
    1.53 +
    1.54 +// public ASSIMP headers
    1.55 +#include "assimp/types.h"
    1.56 +#include "assimp/mesh.h"
    1.57 +#include "assimp/anim.h"
    1.58 +
    1.59 +// for some helper routines like IsSpace()
    1.60 +#include "ParsingUtils.h"
    1.61 +#include "qnan.h"
    1.62 +
    1.63 +// ASE is quite similar to 3ds. We can reuse some structures
    1.64 +#include "3DSLoader.h"
    1.65 +
    1.66 +namespace Assimp	{
    1.67 +namespace ASE	{
    1.68 +
    1.69 +using namespace D3DS;
    1.70 +
    1.71 +// ---------------------------------------------------------------------------
    1.72 +/** Helper structure representing an ASE material */
    1.73 +struct Material : public D3DS::Material
    1.74 +{
    1.75 +	//! Default constructor
    1.76 +	Material() : pcInstance(NULL), bNeed (false)
    1.77 +	{}
    1.78 +
    1.79 +	//! Contains all sub materials of this material
    1.80 +	std::vector<Material> avSubMaterials;
    1.81 +
    1.82 +	//! aiMaterial object
    1.83 +	aiMaterial* pcInstance;
    1.84 +
    1.85 +	//! Can we remove this material?
    1.86 +	bool bNeed;
    1.87 +};
    1.88 +
    1.89 +// ---------------------------------------------------------------------------
    1.90 +/** Helper structure to represent an ASE file face */
    1.91 +struct Face : public FaceWithSmoothingGroup
    1.92 +{
    1.93 +	//! Default constructor. Initializes everything with 0
    1.94 +	Face()
    1.95 +	{
    1.96 +		mColorIndices[0] = mColorIndices[1] = mColorIndices[2] = 0;
    1.97 +		for (unsigned int i = 0; i < AI_MAX_NUMBER_OF_TEXTURECOORDS;++i)
    1.98 +		{
    1.99 +			amUVIndices[i][0] = amUVIndices[i][1] = amUVIndices[i][2] = 0;
   1.100 +		}
   1.101 +
   1.102 +		iMaterial = DEFAULT_MATINDEX;
   1.103 +		iFace = 0;
   1.104 +	}
   1.105 +
   1.106 +	//! special value to indicate that no material index has
   1.107 +	//! been assigned to a face. The default material index
   1.108 +	//! will replace this value later.
   1.109 +	static const unsigned int DEFAULT_MATINDEX = 0xFFFFFFFF;
   1.110 +
   1.111 +
   1.112 +
   1.113 +	//! Indices into each list of texture coordinates
   1.114 +	unsigned int amUVIndices[AI_MAX_NUMBER_OF_TEXTURECOORDS][3];
   1.115 +
   1.116 +	//! Index into the list of vertex colors
   1.117 +	unsigned int mColorIndices[3];
   1.118 +
   1.119 +	//! (Sub)Material index to be assigned to this face
   1.120 +	unsigned int iMaterial;
   1.121 +
   1.122 +	//! Index of the face. It is not specified whether it is
   1.123 +	//! a requirement of the file format that all faces are
   1.124 +	//! written in sequential order, so we have to expect this case
   1.125 +	unsigned int iFace;
   1.126 +};
   1.127 +
   1.128 +// ---------------------------------------------------------------------------
   1.129 +/** Helper structure to represent an ASE file bone */
   1.130 +struct Bone
   1.131 +{
   1.132 +	//! Constructor
   1.133 +	Bone()
   1.134 +	{
   1.135 +		static int iCnt = 0;
   1.136 +		
   1.137 +		// Generate a default name for the bone
   1.138 +		char szTemp[128];
   1.139 +		::sprintf(szTemp,"UNNAMED_%i",iCnt++);
   1.140 +		mName = szTemp;
   1.141 +	}
   1.142 +
   1.143 +	//! Construction from an existing name
   1.144 +	Bone( const std::string& name)
   1.145 +		:	mName	(name)
   1.146 +	{}
   1.147 +
   1.148 +	//! Name of the bone
   1.149 +	std::string mName;
   1.150 +};
   1.151 +
   1.152 +// ---------------------------------------------------------------------------
   1.153 +/** Helper structure to represent an ASE file bone vertex */
   1.154 +struct BoneVertex
   1.155 +{
   1.156 +	//! Bone and corresponding vertex weight.
   1.157 +	//! -1 for unrequired bones ....
   1.158 +	std::vector<std::pair<int,float> > mBoneWeights;
   1.159 +
   1.160 +	//! Position of the bone vertex.
   1.161 +	//! MUST be identical to the vertex position
   1.162 +	//aiVector3D mPosition;
   1.163 +};
   1.164 +
   1.165 +// ---------------------------------------------------------------------------
   1.166 +/** Helper structure to represent an ASE file animation */
   1.167 +struct Animation
   1.168 +{
   1.169 +	enum Type
   1.170 +	{
   1.171 +		TRACK   = 0x0,
   1.172 +		BEZIER  = 0x1,
   1.173 +		TCB		= 0x2
   1.174 +	} mRotationType, mScalingType, mPositionType;
   1.175 +
   1.176 +	Animation()
   1.177 +		:	mRotationType	(TRACK)
   1.178 +		,	mScalingType	(TRACK)
   1.179 +		,	mPositionType	(TRACK)
   1.180 +	{}
   1.181 +
   1.182 +	//! List of track rotation keyframes
   1.183 +	std::vector< aiQuatKey > akeyRotations;
   1.184 +
   1.185 +	//! List of track position keyframes
   1.186 +	std::vector< aiVectorKey > akeyPositions;
   1.187 +
   1.188 +	//! List of track scaling keyframes
   1.189 +	std::vector< aiVectorKey > akeyScaling;
   1.190 +
   1.191 +};
   1.192 +
   1.193 +// ---------------------------------------------------------------------------
   1.194 +/** Helper structure to represent the inheritance information of an ASE node */
   1.195 +struct InheritanceInfo
   1.196 +{
   1.197 +	//! Default constructor
   1.198 +	InheritanceInfo()
   1.199 +	{
   1.200 +		// set the inheritance flag for all axes by default to true
   1.201 +		for (unsigned int i = 0; i < 3;++i)
   1.202 +			abInheritPosition[i] = abInheritRotation[i] = abInheritScaling[i] = true;
   1.203 +	}
   1.204 +
   1.205 +	//! Inherit the parent's position?, axis order is x,y,z
   1.206 +	bool abInheritPosition[3];
   1.207 +
   1.208 +	//! Inherit the parent's rotation?, axis order is x,y,z
   1.209 +	bool abInheritRotation[3];
   1.210 +
   1.211 +	//! Inherit the parent's scaling?, axis order is x,y,z
   1.212 +	bool abInheritScaling[3];
   1.213 +};
   1.214 +
   1.215 +// ---------------------------------------------------------------------------
   1.216 +/** Represents an ASE file node. Base class for mesh, light and cameras */
   1.217 +struct BaseNode
   1.218 +{
   1.219 +	enum Type {Light, Camera, Mesh, Dummy} mType;
   1.220 +
   1.221 +	//! Constructor. Creates a default name for the node
   1.222 +	BaseNode(Type _mType)
   1.223 +		: mType			(_mType)
   1.224 +		, mProcessed	(false)
   1.225 +	{
   1.226 +		// generate a default name for the  node
   1.227 +		static int iCnt = 0;
   1.228 +		char szTemp[128]; // should be sufficiently large
   1.229 +		::sprintf(szTemp,"UNNAMED_%i",iCnt++);
   1.230 +		mName = szTemp;
   1.231 +
   1.232 +		// Set mTargetPosition to qnan
   1.233 +		const float qnan = get_qnan();
   1.234 +		mTargetPosition.x = qnan;
   1.235 +	}
   1.236 +
   1.237 +	//! Name of the mesh
   1.238 +	std::string mName;
   1.239 +
   1.240 +	//! Name of the parent of the node
   1.241 +	//! "" if there is no parent ...
   1.242 +	std::string mParent;
   1.243 +
   1.244 +	//! Transformation matrix of the node
   1.245 +	aiMatrix4x4 mTransform;
   1.246 +
   1.247 +	//! Target position (target lights and cameras)
   1.248 +	aiVector3D mTargetPosition;
   1.249 +
   1.250 +	//! Specifies which axes transformations a node inherits
   1.251 +	//! from its parent ...
   1.252 +	InheritanceInfo inherit;
   1.253 +
   1.254 +	//! Animation channels for the node
   1.255 +	Animation mAnim;
   1.256 +
   1.257 +	//! Needed for lights and cameras: target animation channel
   1.258 +	//! Should contain position keys only.
   1.259 +	Animation mTargetAnim;
   1.260 +
   1.261 +	bool mProcessed;
   1.262 +};
   1.263 +
   1.264 +// ---------------------------------------------------------------------------
   1.265 +/** Helper structure to represent an ASE file mesh */
   1.266 +struct Mesh : public MeshWithSmoothingGroups<ASE::Face>, public BaseNode
   1.267 +{
   1.268 +	//! Constructor.
   1.269 +	Mesh() 
   1.270 +		: BaseNode	(BaseNode::Mesh)
   1.271 +		, bSkip		(false)
   1.272 +	{
   1.273 +		// use 2 texture vertex components by default
   1.274 +		for (unsigned int c = 0; c < AI_MAX_NUMBER_OF_TEXTURECOORDS;++c)
   1.275 +			this->mNumUVComponents[c] = 2;
   1.276 +
   1.277 +		// setup the default material index by default
   1.278 +		iMaterialIndex = Face::DEFAULT_MATINDEX;
   1.279 +	}
   1.280 +
   1.281 +	//! List of all texture coordinate sets
   1.282 +	std::vector<aiVector3D> amTexCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS];
   1.283 +
   1.284 +	//! List of all vertex color sets.
   1.285 +	std::vector<aiColor4D> mVertexColors;
   1.286 +
   1.287 +	//! List of all bone vertices
   1.288 +	std::vector<BoneVertex> mBoneVertices;
   1.289 +
   1.290 +	//! List of all bones
   1.291 +	std::vector<Bone> mBones;
   1.292 +
   1.293 +	//! Material index of the mesh
   1.294 +	unsigned int iMaterialIndex;
   1.295 +
   1.296 +	//! Number of vertex components for each UVW set
   1.297 +	unsigned int mNumUVComponents[AI_MAX_NUMBER_OF_TEXTURECOORDS];
   1.298 +
   1.299 +	//! used internally
   1.300 +	bool bSkip;
   1.301 +};
   1.302 +
   1.303 +// ---------------------------------------------------------------------------
   1.304 +/** Helper structure to represent an ASE light source */
   1.305 +struct Light : public BaseNode
   1.306 +{
   1.307 +	enum LightType
   1.308 +	{
   1.309 +		OMNI,
   1.310 +		TARGET,
   1.311 +		FREE,
   1.312 +		DIRECTIONAL
   1.313 +	};
   1.314 +
   1.315 +	//! Constructor. 
   1.316 +	Light() 
   1.317 +		: BaseNode	 (BaseNode::Light)
   1.318 +		, mLightType (OMNI)
   1.319 +		, mColor	 (1.f,1.f,1.f)
   1.320 +		, mIntensity (1.f) // light is white by default
   1.321 +		, mAngle	 (45.f)
   1.322 +		, mFalloff	 (0.f)
   1.323 +	{	
   1.324 +	}
   1.325 +
   1.326 +	LightType mLightType;
   1.327 +	aiColor3D mColor;
   1.328 +	float mIntensity;
   1.329 +	float mAngle; // in degrees
   1.330 +	float mFalloff;
   1.331 +};
   1.332 +
   1.333 +// ---------------------------------------------------------------------------
   1.334 +/** Helper structure to represent an ASE camera */
   1.335 +struct Camera : public BaseNode
   1.336 +{
   1.337 +	enum CameraType
   1.338 +	{
   1.339 +		FREE,
   1.340 +		TARGET
   1.341 +	};
   1.342 +
   1.343 +	//! Constructor
   1.344 +	Camera() 
   1.345 +		: BaseNode	  (BaseNode::Camera)
   1.346 +		, mFOV        (0.75f)   // in radians
   1.347 +		, mNear       (0.1f) 
   1.348 +		, mFar        (1000.f)  // could be zero
   1.349 +		, mCameraType (FREE)
   1.350 +	{
   1.351 +	}
   1.352 +
   1.353 +	float mFOV, mNear, mFar;
   1.354 +	CameraType mCameraType;
   1.355 +};
   1.356 +
   1.357 +// ---------------------------------------------------------------------------
   1.358 +/** Helper structure to represent an ASE helper object (dummy) */
   1.359 +struct Dummy : public BaseNode
   1.360 +{
   1.361 +	//! Constructor
   1.362 +	Dummy() 
   1.363 +		: BaseNode	(BaseNode::Dummy)
   1.364 +	{
   1.365 +	}
   1.366 +};
   1.367 +
   1.368 +// Parameters to Parser::Parse()
   1.369 +#define AI_ASE_NEW_FILE_FORMAT 200
   1.370 +#define AI_ASE_OLD_FILE_FORMAT 110
   1.371 +
   1.372 +// Internally we're a little bit more tolerant
   1.373 +#define AI_ASE_IS_NEW_FILE_FORMAT()	(iFileFormat >= 200)
   1.374 +#define AI_ASE_IS_OLD_FILE_FORMAT()	(iFileFormat < 200)
   1.375 +
   1.376 +// -------------------------------------------------------------------------------
   1.377 +/** \brief Class to parse ASE files
   1.378 + */
   1.379 +class Parser
   1.380 +{
   1.381 +
   1.382 +private:
   1.383 +
   1.384 +	Parser() {}
   1.385 +
   1.386 +public:
   1.387 +
   1.388 +	// -------------------------------------------------------------------
   1.389 +	//! Construct a parser from a given input file which is
   1.390 +	//! guaranted to be terminated with zero.
   1.391 +	//! @param szFile Input file
   1.392 +	//! @param fileFormatDefault Assumed file format version. If the
   1.393 +	//!   file format is specified in the file the new value replaces
   1.394 +	//!   the default value.
   1.395 +	Parser (const char* szFile, unsigned int fileFormatDefault);
   1.396 +
   1.397 +	// -------------------------------------------------------------------
   1.398 +	//! Parses the file into the parsers internal representation
   1.399 +	void Parse();
   1.400 +
   1.401 +
   1.402 +private:
   1.403 +
   1.404 +	// -------------------------------------------------------------------
   1.405 +	//! Parse the *SCENE block in a file
   1.406 +	void ParseLV1SceneBlock();
   1.407 +
   1.408 +	// -------------------------------------------------------------------
   1.409 +	//! Parse the *MESH_SOFTSKINVERTS block in a file
   1.410 +	void ParseLV1SoftSkinBlock();
   1.411 +
   1.412 +	// -------------------------------------------------------------------
   1.413 +	//! Parse the *MATERIAL_LIST block in a file
   1.414 +	void ParseLV1MaterialListBlock();
   1.415 +
   1.416 +	// -------------------------------------------------------------------
   1.417 +	//! Parse a *<xxx>OBJECT block in a file
   1.418 +	//! \param mesh Node to be filled
   1.419 +	void ParseLV1ObjectBlock(BaseNode& mesh);
   1.420 +
   1.421 +	// -------------------------------------------------------------------
   1.422 +	//! Parse a *MATERIAL blocks in a material list
   1.423 +	//! \param mat Material structure to be filled
   1.424 +	void ParseLV2MaterialBlock(Material& mat);
   1.425 +
   1.426 +	// -------------------------------------------------------------------
   1.427 +	//! Parse a *NODE_TM block in a file
   1.428 +	//! \param mesh Node (!) object to be filled
   1.429 +	void ParseLV2NodeTransformBlock(BaseNode& mesh);
   1.430 +
   1.431 +	// -------------------------------------------------------------------
   1.432 +	//! Parse a *TM_ANIMATION block in a file
   1.433 +	//! \param mesh Mesh object to be filled
   1.434 +	void ParseLV2AnimationBlock(BaseNode& mesh);
   1.435 +	void ParseLV3PosAnimationBlock(ASE::Animation& anim);
   1.436 +	void ParseLV3ScaleAnimationBlock(ASE::Animation& anim);
   1.437 +	void ParseLV3RotAnimationBlock(ASE::Animation& anim);
   1.438 +
   1.439 +	// -------------------------------------------------------------------
   1.440 +	//! Parse a *MESH block in a file
   1.441 +	//! \param mesh Mesh object to be filled
   1.442 +	void ParseLV2MeshBlock(Mesh& mesh);
   1.443 +
   1.444 +	// -------------------------------------------------------------------
   1.445 +	//! Parse a *LIGHT_SETTINGS block in a file
   1.446 +	//! \param light Light object to be filled
   1.447 +	void ParseLV2LightSettingsBlock(Light& light);
   1.448 +
   1.449 +	// -------------------------------------------------------------------
   1.450 +	//! Parse a *CAMERA_SETTINGS block in a file
   1.451 +	//! \param cam Camera object to be filled
   1.452 +	void ParseLV2CameraSettingsBlock(Camera& cam);
   1.453 +
   1.454 +	// -------------------------------------------------------------------
   1.455 +	//! Parse the *MAP_XXXXXX blocks in a material
   1.456 +	//! \param map Texture structure to be filled
   1.457 +	void ParseLV3MapBlock(Texture& map);
   1.458 +
   1.459 +	// -------------------------------------------------------------------
   1.460 +	//! Parse a *MESH_VERTEX_LIST block in a file
   1.461 +	//! \param iNumVertices Value of *MESH_NUMVERTEX, if present.
   1.462 +	//! Otherwise zero. This is used to check the consistency of the file.
   1.463 +	//! A warning is sent to the logger if the validations fails.
   1.464 +	//! \param mesh Mesh object to be filled
   1.465 +	void ParseLV3MeshVertexListBlock(
   1.466 +		unsigned int iNumVertices,Mesh& mesh);
   1.467 +
   1.468 +	// -------------------------------------------------------------------
   1.469 +	//! Parse a *MESH_FACE_LIST block in a file
   1.470 +	//! \param iNumFaces Value of *MESH_NUMFACES, if present.
   1.471 +	//! Otherwise zero. This is used to check the consistency of the file.
   1.472 +	//! A warning is sent to the logger if the validations fails.
   1.473 +	//! \param mesh Mesh object to be filled
   1.474 +	void ParseLV3MeshFaceListBlock(
   1.475 +		unsigned int iNumFaces,Mesh& mesh);
   1.476 +
   1.477 +	// -------------------------------------------------------------------
   1.478 +	//! Parse a *MESH_TVERT_LIST block in a file
   1.479 +	//! \param iNumVertices Value of *MESH_NUMTVERTEX, if present.
   1.480 +	//! Otherwise zero. This is used to check the consistency of the file.
   1.481 +	//! A warning is sent to the logger if the validations fails.
   1.482 +	//! \param mesh Mesh object to be filled
   1.483 +	//! \param iChannel Output UVW channel
   1.484 +	void ParseLV3MeshTListBlock(
   1.485 +		unsigned int iNumVertices,Mesh& mesh, unsigned int iChannel = 0);
   1.486 +
   1.487 +	// -------------------------------------------------------------------
   1.488 +	//! Parse a *MESH_TFACELIST block in a file
   1.489 +	//! \param iNumFaces Value of *MESH_NUMTVFACES, if present.
   1.490 +	//! Otherwise zero. This is used to check the consistency of the file.
   1.491 +	//! A warning is sent to the logger if the validations fails.
   1.492 +	//! \param mesh Mesh object to be filled
   1.493 +	//! \param iChannel Output UVW channel
   1.494 +	void ParseLV3MeshTFaceListBlock(
   1.495 +		unsigned int iNumFaces,Mesh& mesh, unsigned int iChannel = 0);
   1.496 +
   1.497 +	// -------------------------------------------------------------------
   1.498 +	//! Parse an additional mapping channel 
   1.499 +	//! (specified via *MESH_MAPPINGCHANNEL)
   1.500 +	//! \param iChannel Channel index to be filled
   1.501 +	//! \param mesh Mesh object to be filled
   1.502 +	void ParseLV3MappingChannel(
   1.503 +		unsigned int iChannel, Mesh& mesh);
   1.504 +
   1.505 +	// -------------------------------------------------------------------
   1.506 +	//! Parse a *MESH_CVERTLIST block in a file
   1.507 +	//! \param iNumVertices Value of *MESH_NUMCVERTEX, if present.
   1.508 +	//! Otherwise zero. This is used to check the consistency of the file.
   1.509 +	//! A warning is sent to the logger if the validations fails.
   1.510 +	//! \param mesh Mesh object to be filled
   1.511 +	void ParseLV3MeshCListBlock(
   1.512 +		unsigned int iNumVertices, Mesh& mesh);
   1.513 +
   1.514 +	// -------------------------------------------------------------------
   1.515 +	//! Parse a *MESH_CFACELIST block in a file
   1.516 +	//! \param iNumFaces Value of *MESH_NUMCVFACES, if present.
   1.517 +	//! Otherwise zero. This is used to check the consistency of the file.
   1.518 +	//! A warning is sent to the logger if the validations fails.
   1.519 +	//! \param mesh Mesh object to be filled
   1.520 +	void ParseLV3MeshCFaceListBlock(
   1.521 +		unsigned int iNumFaces, Mesh& mesh);
   1.522 +
   1.523 +	// -------------------------------------------------------------------
   1.524 +	//! Parse a *MESH_NORMALS block in a file
   1.525 +	//! \param mesh Mesh object to be filled
   1.526 +	void ParseLV3MeshNormalListBlock(Mesh& mesh);
   1.527 +
   1.528 +	// -------------------------------------------------------------------
   1.529 +	//! Parse a *MESH_WEIGHTSblock in a file
   1.530 +	//! \param mesh Mesh object to be filled
   1.531 +	void ParseLV3MeshWeightsBlock(Mesh& mesh);
   1.532 +
   1.533 +	// -------------------------------------------------------------------
   1.534 +	//! Parse the bone list of a file
   1.535 +	//! \param mesh Mesh object to be filled
   1.536 +	//! \param iNumBones Number of bones in the mesh
   1.537 +	void ParseLV4MeshBones(unsigned int iNumBones,Mesh& mesh);
   1.538 +
   1.539 +	// -------------------------------------------------------------------
   1.540 +	//! Parse the bone vertices list of a file
   1.541 +	//! \param mesh Mesh object to be filled
   1.542 +	//! \param iNumVertices Number of vertices to be parsed
   1.543 +	void ParseLV4MeshBonesVertices(unsigned int iNumVertices,Mesh& mesh);
   1.544 +
   1.545 +	// -------------------------------------------------------------------
   1.546 +	//! Parse a *MESH_FACE block in a file
   1.547 +	//! \param out receive the face data
   1.548 +	void ParseLV4MeshFace(ASE::Face& out);
   1.549 +
   1.550 +	// -------------------------------------------------------------------
   1.551 +	//! Parse a *MESH_VERT block in a file
   1.552 +	//! (also works for MESH_TVERT, MESH_CFACE, MESH_VERTCOL  ...)
   1.553 +	//! \param apOut Output buffer (3 floats)
   1.554 +	//! \param rIndexOut Output index
   1.555 +	void ParseLV4MeshFloatTriple(float* apOut, unsigned int& rIndexOut);
   1.556 +
   1.557 +	// -------------------------------------------------------------------
   1.558 +	//! Parse a *MESH_VERT block in a file
   1.559 +	//! (also works for MESH_TVERT, MESH_CFACE, MESH_VERTCOL  ...)
   1.560 +	//! \param apOut Output buffer (3 floats)
   1.561 +	void ParseLV4MeshFloatTriple(float* apOut);
   1.562 +
   1.563 +	// -------------------------------------------------------------------
   1.564 +	//! Parse a *MESH_TFACE block in a file
   1.565 +	//! (also works for MESH_CFACE)
   1.566 +	//! \param apOut Output buffer (3 ints)
   1.567 +	//! \param rIndexOut Output index
   1.568 +	void ParseLV4MeshLongTriple(unsigned int* apOut, unsigned int& rIndexOut);
   1.569 +
   1.570 +	// -------------------------------------------------------------------
   1.571 +	//! Parse a *MESH_TFACE block in a file
   1.572 +	//! (also works for MESH_CFACE)
   1.573 +	//! \param apOut Output buffer (3 ints)
   1.574 +	void ParseLV4MeshLongTriple(unsigned int* apOut);
   1.575 +
   1.576 +	// -------------------------------------------------------------------
   1.577 +	//! Parse a single float element 
   1.578 +	//! \param fOut Output float
   1.579 +	void ParseLV4MeshFloat(float& fOut);
   1.580 +
   1.581 +	// -------------------------------------------------------------------
   1.582 +	//! Parse a single int element 
   1.583 +	//! \param iOut Output integer
   1.584 +	void ParseLV4MeshLong(unsigned int& iOut);
   1.585 +
   1.586 +	// -------------------------------------------------------------------
   1.587 +	//! Skip everything to the next: '*' or '\0'
   1.588 +	bool SkipToNextToken();
   1.589 +
   1.590 +	// -------------------------------------------------------------------
   1.591 +	//! Skip the current section until the token after the closing }.
   1.592 +	//! This function handles embedded subsections correctly
   1.593 +	bool SkipSection();
   1.594 +
   1.595 +	// -------------------------------------------------------------------
   1.596 +	//! Output a warning to the logger
   1.597 +	//! \param szWarn Warn message
   1.598 +	void LogWarning(const char* szWarn);
   1.599 +
   1.600 +	// -------------------------------------------------------------------
   1.601 +	//! Output a message to the logger
   1.602 +	//! \param szWarn Message
   1.603 +	void LogInfo(const char* szWarn);
   1.604 +
   1.605 +	// -------------------------------------------------------------------
   1.606 +	//! Output an error to the logger
   1.607 +	//! \param szWarn Error message
   1.608 +	void LogError(const char* szWarn);
   1.609 +
   1.610 +	// -------------------------------------------------------------------
   1.611 +	//! Parse a string, enclosed in double quotation marks
   1.612 +	//! \param out Output string
   1.613 +	//! \param szName Name of the enclosing element -> used in error
   1.614 +	//! messages.
   1.615 +	//! \return false if an error occured
   1.616 +	bool ParseString(std::string& out,const char* szName);
   1.617 +
   1.618 +public:
   1.619 +
   1.620 +	//! Pointer to current data
   1.621 +	const char* filePtr;
   1.622 +
   1.623 +	//! background color to be passed to the viewer
   1.624 +	//! QNAN if none was found
   1.625 +	aiColor3D m_clrBackground;
   1.626 +
   1.627 +	//! Base ambient color to be passed to all materials
   1.628 +	//! QNAN if none was found
   1.629 +	aiColor3D m_clrAmbient;
   1.630 +
   1.631 +	//! List of all materials found in the file
   1.632 +	std::vector<Material> m_vMaterials;
   1.633 +
   1.634 +	//! List of all meshes found in the file
   1.635 +	std::vector<Mesh> m_vMeshes;
   1.636 +
   1.637 +	//! List of all dummies found in the file
   1.638 +	std::vector<Dummy> m_vDummies;
   1.639 +
   1.640 +	//! List of all lights found in the file
   1.641 +	std::vector<Light> m_vLights;
   1.642 +
   1.643 +	//! List of all cameras found in the file
   1.644 +	std::vector<Camera> m_vCameras;
   1.645 +
   1.646 +	//! Current line in the file
   1.647 +	unsigned int iLineNumber;
   1.648 +
   1.649 +	//! First frame
   1.650 +	unsigned int iFirstFrame;
   1.651 +
   1.652 +	//! Last frame
   1.653 +	unsigned int iLastFrame;
   1.654 +
   1.655 +	//! Frame speed - frames per second
   1.656 +	unsigned int iFrameSpeed;
   1.657 +
   1.658 +	//! Ticks per frame
   1.659 +	unsigned int iTicksPerFrame;
   1.660 +
   1.661 +	//! true if the last character read was an end-line character
   1.662 +	bool bLastWasEndLine;
   1.663 +
   1.664 +	//! File format version
   1.665 +	unsigned int iFileFormat;
   1.666 +};
   1.667 +
   1.668 +
   1.669 +} // Namespace ASE
   1.670 +} // Namespace ASSIMP
   1.671 +
   1.672 +#endif // !! include guard