Merge branch 'master' into new_license_dates

pull/1748/head
Kim Kulling 2018-01-28 20:16:17 +01:00
commit bd29fe73fa
4 changed files with 67 additions and 75 deletions

View File

@ -495,17 +495,16 @@ struct Material
/** Helper structure to represent a 3ds file mesh */
struct Mesh : public MeshWithSmoothingGroups<D3DS::Face>
{
//! Default constructor
Mesh()
{
static int iCnt = 0;
//! Default constructor has been deleted
Mesh() = delete;
// Generate a default name for the mesh
char szTemp[128];
ai_snprintf(szTemp, 128, "UNNAMED_%i",iCnt++);
mName = szTemp;
//! Constructor with explicit name
explicit Mesh(const std::string &name)
: mName(name)
{
}
//! Name of the mesh
std::string mName;
@ -551,25 +550,22 @@ struct aiFloatKey
/** Helper structure to represent a 3ds file node */
struct Node
{
Node():
mParent(NULL)
, mInstanceNumber(0)
, mHierarchyPos (0)
, mHierarchyIndex (0)
, mInstanceCount (1)
Node() = delete;
explicit Node(const std::string &name)
: mParent(NULL)
, mName(name)
, mInstanceNumber(0)
, mHierarchyPos (0)
, mHierarchyIndex (0)
, 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);
aPositionKeys.reserve (20);
aScalingKeys.reserve (20);
}
~Node()
{
for (unsigned int i = 0; i < mChildren.size();++i)

View File

@ -171,7 +171,7 @@ void Discreet3DSImporter::InternReadFile( const std::string& pFile,
// Initialize members
mLastNodeIndex = -1;
mCurrentNode = new D3DS::Node();
mCurrentNode = new D3DS::Node("UNNAMED");
mRootNode = mCurrentNode;
mRootNode->mHierarchyPos = -1;
mRootNode->mHierarchyIndex = -1;
@ -403,11 +403,7 @@ void Discreet3DSImporter::ParseChunk(const char* name, unsigned int num)
case Discreet3DS::CHUNK_TRIMESH:
{
// this starts a new triangle mesh
mScene->mMeshes.push_back(D3DS::Mesh());
D3DS::Mesh& m = mScene->mMeshes.back();
// Setup the name of the mesh
m.mName = std::string(name, num);
mScene->mMeshes.push_back(D3DS::Mesh(std::string(name, num)));
// Read mesh chunks
ParseMeshChunk();
@ -691,8 +687,7 @@ void Discreet3DSImporter::ParseHierarchyChunk(uint16_t parent)
pcNode->mInstanceCount++;
instanceNumber = pcNode->mInstanceCount;
}
pcNode = new D3DS::Node();
pcNode->mName = name;
pcNode = new D3DS::Node(name);
pcNode->mInstanceNumber = instanceNumber;
// There are two unknown values which we can safely ignore

View File

@ -293,7 +293,7 @@ void Parser::Parse()
if (TokenMatch(filePtr,"GEOMOBJECT",10))
{
m_vMeshes.push_back(Mesh());
m_vMeshes.push_back(Mesh("UNNAMED"));
ParseLV1ObjectBlock(m_vMeshes.back());
continue;
}
@ -309,14 +309,14 @@ void Parser::Parse()
if (TokenMatch(filePtr,"LIGHTOBJECT",11))
{
m_vLights.push_back(Light());
m_vLights.push_back(Light("UNNAMED"));
ParseLV1ObjectBlock(m_vLights.back());
continue;
}
// camera object
if (TokenMatch(filePtr,"CAMERAOBJECT",12))
{
m_vCameras.push_back(Camera());
m_vCameras.push_back(Camera("UNNAMED"));
ParseLV1ObjectBlock(m_vCameras.back());
continue;
}
@ -1554,7 +1554,7 @@ void Parser::ParseLV3MeshWeightsBlock(ASE::Mesh& mesh)
void Parser::ParseLV4MeshBones(unsigned int iNumBones,ASE::Mesh& mesh)
{
AI_ASE_PARSER_INIT();
mesh.mBones.resize(iNumBones);
mesh.mBones.resize(iNumBones, Bone("UNNAMED"));
while (true)
{
if ('*' == *filePtr)

View File

@ -169,15 +169,7 @@ struct Face : public FaceWithSmoothingGroup
struct Bone
{
//! Constructor
Bone()
{
static int iCnt = 0;
// Generate a default name for the bone
char szTemp[128];
::ai_snprintf(szTemp, 128, "UNNAMED_%i",iCnt++);
mName = szTemp;
}
Bone() = delete;
//! Construction from an existing name
explicit Bone( const std::string& name)
@ -257,22 +249,19 @@ struct BaseNode
{
enum Type {Light, Camera, Mesh, Dummy} mType;
//! Constructor. Creates a default name for the node
explicit BaseNode(Type _mType)
: mType (_mType)
, 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;
//! Construction from an existing name
BaseNode(Type _mType, const std::string &name)
: mType (_mType)
, mName (name)
, mProcessed (false)
{
// Set mTargetPosition to qnan
const ai_real qnan = get_qnan();
mTargetPosition.x = qnan;
}
//! Name of the mesh
std::string mName;
@ -304,19 +293,22 @@ struct BaseNode
/** Helper structure to represent an ASE file mesh */
struct Mesh : public MeshWithSmoothingGroups<ASE::Face>, public BaseNode
{
//! Constructor.
Mesh()
: BaseNode (BaseNode::Mesh)
, bSkip (false)
//! Default constructor has been deleted
Mesh() = delete;
//! Construction from an existing name
explicit Mesh(const std::string &name)
: BaseNode (BaseNode::Mesh, name)
, iMaterialIndex(Face::DEFAULT_MATINDEX)
, bSkip (false)
{
// use 2 texture vertex components by default
for (unsigned int c = 0; c < AI_MAX_NUMBER_OF_TEXTURECOORDS;++c)
this->mNumUVComponents[c] = 2;
// setup the default material index by default
iMaterialIndex = Face::DEFAULT_MATINDEX;
}
//! List of all texture coordinate sets
std::vector<aiVector3D> amTexCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS];
@ -351,17 +343,21 @@ struct Light : public BaseNode
DIRECTIONAL
};
//! Constructor.
Light()
: BaseNode (BaseNode::Light)
, mLightType (OMNI)
, mColor (1.f,1.f,1.f)
, mIntensity (1.f) // light is white by default
, mAngle (45.f)
, mFalloff (0.f)
//! Default constructor has been deleted
Light() = delete;
//! Construction from an existing name
explicit Light(const std::string &name)
: BaseNode (BaseNode::Light, name)
, mLightType (OMNI)
, mColor (1.f,1.f,1.f)
, mIntensity (1.f) // light is white by default
, mAngle (45.f)
, mFalloff (0.f)
{
}
LightType mLightType;
aiColor3D mColor;
ai_real mIntensity;
@ -379,16 +375,21 @@ struct Camera : public BaseNode
TARGET
};
//! Constructor
Camera()
: BaseNode (BaseNode::Camera)
, mFOV (0.75f) // in radians
, mNear (0.1f)
, mFar (1000.f) // could be zero
, mCameraType (FREE)
//! Default constructor has been deleted
Camera() = delete;
//! Construction from an existing name
explicit Camera(const std::string &name)
: BaseNode (BaseNode::Camera, name)
, mFOV (0.75f) // in radians
, mNear (0.1f)
, mFar (1000.f) // could be zero
, mCameraType (FREE)
{
}
ai_real mFOV, mNear, mFar;
CameraType mCameraType;
};
@ -399,7 +400,7 @@ struct Dummy : public BaseNode
{
//! Constructor
Dummy()
: BaseNode (BaseNode::Dummy)
: BaseNode (BaseNode::Dummy, "DUMMY")
{
}
};