Merge branch 'master' into new_license_dates
commit
bd29fe73fa
|
@ -495,17 +495,16 @@ struct Material
|
||||||
/** Helper structure to represent a 3ds file mesh */
|
/** Helper structure to represent a 3ds file mesh */
|
||||||
struct Mesh : public MeshWithSmoothingGroups<D3DS::Face>
|
struct Mesh : public MeshWithSmoothingGroups<D3DS::Face>
|
||||||
{
|
{
|
||||||
//! Default constructor
|
//! Default constructor has been deleted
|
||||||
Mesh()
|
Mesh() = delete;
|
||||||
{
|
|
||||||
static int iCnt = 0;
|
|
||||||
|
|
||||||
// Generate a default name for the mesh
|
//! Constructor with explicit name
|
||||||
char szTemp[128];
|
explicit Mesh(const std::string &name)
|
||||||
ai_snprintf(szTemp, 128, "UNNAMED_%i",iCnt++);
|
: mName(name)
|
||||||
mName = szTemp;
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Name of the mesh
|
//! Name of the mesh
|
||||||
std::string mName;
|
std::string mName;
|
||||||
|
|
||||||
|
@ -551,25 +550,22 @@ struct aiFloatKey
|
||||||
/** Helper structure to represent a 3ds file node */
|
/** Helper structure to represent a 3ds file node */
|
||||||
struct Node
|
struct Node
|
||||||
{
|
{
|
||||||
Node():
|
Node() = delete;
|
||||||
mParent(NULL)
|
|
||||||
|
explicit Node(const std::string &name)
|
||||||
|
: mParent(NULL)
|
||||||
|
, mName(name)
|
||||||
, mInstanceNumber(0)
|
, mInstanceNumber(0)
|
||||||
, mHierarchyPos (0)
|
, mHierarchyPos (0)
|
||||||
, mHierarchyIndex (0)
|
, mHierarchyIndex (0)
|
||||||
, mInstanceCount (1)
|
, mInstanceCount (1)
|
||||||
{
|
{
|
||||||
static int iCnt = 0;
|
|
||||||
|
|
||||||
// Generate a default name for the node
|
|
||||||
char szTemp[128];
|
|
||||||
::ai_snprintf(szTemp, 128, "UNNAMED_%i",iCnt++);
|
|
||||||
mName = szTemp;
|
|
||||||
|
|
||||||
aRotationKeys.reserve (20);
|
aRotationKeys.reserve (20);
|
||||||
aPositionKeys.reserve (20);
|
aPositionKeys.reserve (20);
|
||||||
aScalingKeys.reserve (20);
|
aScalingKeys.reserve (20);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
~Node()
|
~Node()
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < mChildren.size();++i)
|
for (unsigned int i = 0; i < mChildren.size();++i)
|
||||||
|
|
|
@ -171,7 +171,7 @@ void Discreet3DSImporter::InternReadFile( const std::string& pFile,
|
||||||
|
|
||||||
// Initialize members
|
// Initialize members
|
||||||
mLastNodeIndex = -1;
|
mLastNodeIndex = -1;
|
||||||
mCurrentNode = new D3DS::Node();
|
mCurrentNode = new D3DS::Node("UNNAMED");
|
||||||
mRootNode = mCurrentNode;
|
mRootNode = mCurrentNode;
|
||||||
mRootNode->mHierarchyPos = -1;
|
mRootNode->mHierarchyPos = -1;
|
||||||
mRootNode->mHierarchyIndex = -1;
|
mRootNode->mHierarchyIndex = -1;
|
||||||
|
@ -403,11 +403,7 @@ void Discreet3DSImporter::ParseChunk(const char* name, unsigned int num)
|
||||||
case Discreet3DS::CHUNK_TRIMESH:
|
case Discreet3DS::CHUNK_TRIMESH:
|
||||||
{
|
{
|
||||||
// this starts a new triangle mesh
|
// this starts a new triangle mesh
|
||||||
mScene->mMeshes.push_back(D3DS::Mesh());
|
mScene->mMeshes.push_back(D3DS::Mesh(std::string(name, num)));
|
||||||
D3DS::Mesh& m = mScene->mMeshes.back();
|
|
||||||
|
|
||||||
// Setup the name of the mesh
|
|
||||||
m.mName = std::string(name, num);
|
|
||||||
|
|
||||||
// Read mesh chunks
|
// Read mesh chunks
|
||||||
ParseMeshChunk();
|
ParseMeshChunk();
|
||||||
|
@ -691,8 +687,7 @@ void Discreet3DSImporter::ParseHierarchyChunk(uint16_t parent)
|
||||||
pcNode->mInstanceCount++;
|
pcNode->mInstanceCount++;
|
||||||
instanceNumber = pcNode->mInstanceCount;
|
instanceNumber = pcNode->mInstanceCount;
|
||||||
}
|
}
|
||||||
pcNode = new D3DS::Node();
|
pcNode = new D3DS::Node(name);
|
||||||
pcNode->mName = name;
|
|
||||||
pcNode->mInstanceNumber = instanceNumber;
|
pcNode->mInstanceNumber = instanceNumber;
|
||||||
|
|
||||||
// There are two unknown values which we can safely ignore
|
// There are two unknown values which we can safely ignore
|
||||||
|
|
|
@ -293,7 +293,7 @@ void Parser::Parse()
|
||||||
if (TokenMatch(filePtr,"GEOMOBJECT",10))
|
if (TokenMatch(filePtr,"GEOMOBJECT",10))
|
||||||
|
|
||||||
{
|
{
|
||||||
m_vMeshes.push_back(Mesh());
|
m_vMeshes.push_back(Mesh("UNNAMED"));
|
||||||
ParseLV1ObjectBlock(m_vMeshes.back());
|
ParseLV1ObjectBlock(m_vMeshes.back());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -309,14 +309,14 @@ void Parser::Parse()
|
||||||
if (TokenMatch(filePtr,"LIGHTOBJECT",11))
|
if (TokenMatch(filePtr,"LIGHTOBJECT",11))
|
||||||
|
|
||||||
{
|
{
|
||||||
m_vLights.push_back(Light());
|
m_vLights.push_back(Light("UNNAMED"));
|
||||||
ParseLV1ObjectBlock(m_vLights.back());
|
ParseLV1ObjectBlock(m_vLights.back());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// camera object
|
// camera object
|
||||||
if (TokenMatch(filePtr,"CAMERAOBJECT",12))
|
if (TokenMatch(filePtr,"CAMERAOBJECT",12))
|
||||||
{
|
{
|
||||||
m_vCameras.push_back(Camera());
|
m_vCameras.push_back(Camera("UNNAMED"));
|
||||||
ParseLV1ObjectBlock(m_vCameras.back());
|
ParseLV1ObjectBlock(m_vCameras.back());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1554,7 +1554,7 @@ void Parser::ParseLV3MeshWeightsBlock(ASE::Mesh& mesh)
|
||||||
void Parser::ParseLV4MeshBones(unsigned int iNumBones,ASE::Mesh& mesh)
|
void Parser::ParseLV4MeshBones(unsigned int iNumBones,ASE::Mesh& mesh)
|
||||||
{
|
{
|
||||||
AI_ASE_PARSER_INIT();
|
AI_ASE_PARSER_INIT();
|
||||||
mesh.mBones.resize(iNumBones);
|
mesh.mBones.resize(iNumBones, Bone("UNNAMED"));
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if ('*' == *filePtr)
|
if ('*' == *filePtr)
|
||||||
|
|
|
@ -169,15 +169,7 @@ struct Face : public FaceWithSmoothingGroup
|
||||||
struct Bone
|
struct Bone
|
||||||
{
|
{
|
||||||
//! Constructor
|
//! Constructor
|
||||||
Bone()
|
Bone() = delete;
|
||||||
{
|
|
||||||
static int iCnt = 0;
|
|
||||||
|
|
||||||
// Generate a default name for the bone
|
|
||||||
char szTemp[128];
|
|
||||||
::ai_snprintf(szTemp, 128, "UNNAMED_%i",iCnt++);
|
|
||||||
mName = szTemp;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Construction from an existing name
|
//! Construction from an existing name
|
||||||
explicit Bone( const std::string& name)
|
explicit Bone( const std::string& name)
|
||||||
|
@ -257,22 +249,19 @@ struct BaseNode
|
||||||
{
|
{
|
||||||
enum Type {Light, Camera, Mesh, Dummy} mType;
|
enum Type {Light, Camera, Mesh, Dummy} mType;
|
||||||
|
|
||||||
//! Constructor. Creates a default name for the node
|
|
||||||
explicit BaseNode(Type _mType)
|
//! Construction from an existing name
|
||||||
|
BaseNode(Type _mType, const std::string &name)
|
||||||
: mType (_mType)
|
: mType (_mType)
|
||||||
|
, mName (name)
|
||||||
, mProcessed (false)
|
, mProcessed (false)
|
||||||
{
|
{
|
||||||
// generate a default name for the node
|
|
||||||
static int iCnt = 0;
|
|
||||||
char szTemp[128]; // should be sufficiently large
|
|
||||||
::ai_snprintf(szTemp, 128, "UNNAMED_%i",iCnt++);
|
|
||||||
mName = szTemp;
|
|
||||||
|
|
||||||
// Set mTargetPosition to qnan
|
// Set mTargetPosition to qnan
|
||||||
const ai_real qnan = get_qnan();
|
const ai_real qnan = get_qnan();
|
||||||
mTargetPosition.x = qnan;
|
mTargetPosition.x = qnan;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Name of the mesh
|
//! Name of the mesh
|
||||||
std::string mName;
|
std::string mName;
|
||||||
|
|
||||||
|
@ -304,19 +293,22 @@ struct BaseNode
|
||||||
/** Helper structure to represent an ASE file mesh */
|
/** Helper structure to represent an ASE file mesh */
|
||||||
struct Mesh : public MeshWithSmoothingGroups<ASE::Face>, public BaseNode
|
struct Mesh : public MeshWithSmoothingGroups<ASE::Face>, public BaseNode
|
||||||
{
|
{
|
||||||
//! Constructor.
|
//! Default constructor has been deleted
|
||||||
Mesh()
|
Mesh() = delete;
|
||||||
: BaseNode (BaseNode::Mesh)
|
|
||||||
|
|
||||||
|
//! Construction from an existing name
|
||||||
|
explicit Mesh(const std::string &name)
|
||||||
|
: BaseNode (BaseNode::Mesh, name)
|
||||||
|
, iMaterialIndex(Face::DEFAULT_MATINDEX)
|
||||||
, bSkip (false)
|
, bSkip (false)
|
||||||
{
|
{
|
||||||
// use 2 texture vertex components by default
|
// use 2 texture vertex components by default
|
||||||
for (unsigned int c = 0; c < AI_MAX_NUMBER_OF_TEXTURECOORDS;++c)
|
for (unsigned int c = 0; c < AI_MAX_NUMBER_OF_TEXTURECOORDS;++c)
|
||||||
this->mNumUVComponents[c] = 2;
|
this->mNumUVComponents[c] = 2;
|
||||||
|
|
||||||
// setup the default material index by default
|
|
||||||
iMaterialIndex = Face::DEFAULT_MATINDEX;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! List of all texture coordinate sets
|
//! List of all texture coordinate sets
|
||||||
std::vector<aiVector3D> amTexCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS];
|
std::vector<aiVector3D> amTexCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS];
|
||||||
|
|
||||||
|
@ -351,9 +343,12 @@ struct Light : public BaseNode
|
||||||
DIRECTIONAL
|
DIRECTIONAL
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Constructor.
|
//! Default constructor has been deleted
|
||||||
Light()
|
Light() = delete;
|
||||||
: BaseNode (BaseNode::Light)
|
|
||||||
|
//! Construction from an existing name
|
||||||
|
explicit Light(const std::string &name)
|
||||||
|
: BaseNode (BaseNode::Light, name)
|
||||||
, mLightType (OMNI)
|
, mLightType (OMNI)
|
||||||
, mColor (1.f,1.f,1.f)
|
, mColor (1.f,1.f,1.f)
|
||||||
, mIntensity (1.f) // light is white by default
|
, mIntensity (1.f) // light is white by default
|
||||||
|
@ -362,6 +357,7 @@ struct Light : public BaseNode
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LightType mLightType;
|
LightType mLightType;
|
||||||
aiColor3D mColor;
|
aiColor3D mColor;
|
||||||
ai_real mIntensity;
|
ai_real mIntensity;
|
||||||
|
@ -379,9 +375,13 @@ struct Camera : public BaseNode
|
||||||
TARGET
|
TARGET
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Constructor
|
//! Default constructor has been deleted
|
||||||
Camera()
|
Camera() = delete;
|
||||||
: BaseNode (BaseNode::Camera)
|
|
||||||
|
|
||||||
|
//! Construction from an existing name
|
||||||
|
explicit Camera(const std::string &name)
|
||||||
|
: BaseNode (BaseNode::Camera, name)
|
||||||
, mFOV (0.75f) // in radians
|
, mFOV (0.75f) // in radians
|
||||||
, mNear (0.1f)
|
, mNear (0.1f)
|
||||||
, mFar (1000.f) // could be zero
|
, mFar (1000.f) // could be zero
|
||||||
|
@ -389,6 +389,7 @@ struct Camera : public BaseNode
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ai_real mFOV, mNear, mFar;
|
ai_real mFOV, mNear, mFar;
|
||||||
CameraType mCameraType;
|
CameraType mCameraType;
|
||||||
};
|
};
|
||||||
|
@ -399,7 +400,7 @@ struct Dummy : public BaseNode
|
||||||
{
|
{
|
||||||
//! Constructor
|
//! Constructor
|
||||||
Dummy()
|
Dummy()
|
||||||
: BaseNode (BaseNode::Dummy)
|
: BaseNode (BaseNode::Dummy, "DUMMY")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue