Apply clang-format to files
parent
6f3bfb5b60
commit
537b445a59
|
@ -239,7 +239,7 @@ void IRRImporter::CopyMaterial(std::vector<aiMaterial *> &materials,
|
||||||
// Do we have a default material? If not we need to create one
|
// Do we have a default material? If not we need to create one
|
||||||
if (UINT_MAX == defMatIdx) {
|
if (UINT_MAX == defMatIdx) {
|
||||||
defMatIdx = (unsigned int)materials.size();
|
defMatIdx = (unsigned int)materials.size();
|
||||||
//TODO: add this materials to someone?
|
// TODO: add this materials to someone?
|
||||||
/*aiMaterial* mat = new aiMaterial();
|
/*aiMaterial* mat = new aiMaterial();
|
||||||
|
|
||||||
aiString s;
|
aiString s;
|
||||||
|
@ -380,7 +380,6 @@ void IRRImporter::ComputeAnimations(Node *root, aiNode *real, std::vector<aiNode
|
||||||
if (360 == lcm)
|
if (360 == lcm)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
// find out how many time units we'll need for the finest
|
// find out how many time units we'll need for the finest
|
||||||
// track (in seconds) - this defines the number of output
|
// track (in seconds) - this defines the number of output
|
||||||
// keys (fps * seconds)
|
// keys (fps * seconds)
|
||||||
|
@ -609,7 +608,7 @@ void IRRImporter::GenerateGraph(Node *root, aiNode *rootOut, aiScene *scene,
|
||||||
std::vector<aiMaterial *> &materials,
|
std::vector<aiMaterial *> &materials,
|
||||||
unsigned int &defMatIdx) {
|
unsigned int &defMatIdx) {
|
||||||
unsigned int oldMeshSize = (unsigned int)meshes.size();
|
unsigned int oldMeshSize = (unsigned int)meshes.size();
|
||||||
//unsigned int meshTrafoAssign = 0;
|
// unsigned int meshTrafoAssign = 0;
|
||||||
|
|
||||||
// Now determine the type of the node
|
// Now determine the type of the node
|
||||||
switch (root->type) {
|
switch (root->type) {
|
||||||
|
@ -797,7 +796,7 @@ void IRRImporter::GenerateGraph(Node *root, aiNode *rootOut, aiScene *scene,
|
||||||
// Now compute the final local transformation matrix of the
|
// Now compute the final local transformation matrix of the
|
||||||
// node from the given translation, rotation and scaling values.
|
// node from the given translation, rotation and scaling values.
|
||||||
// (the rotation is given in Euler angles, XYZ order)
|
// (the rotation is given in Euler angles, XYZ order)
|
||||||
//std::swap((float&)root->rotation.z,(float&)root->rotation.y);
|
// std::swap((float&)root->rotation.z,(float&)root->rotation.y);
|
||||||
rootOut->mTransformation.FromEulerAnglesXYZ(AI_DEG_TO_RAD(root->rotation));
|
rootOut->mTransformation.FromEulerAnglesXYZ(AI_DEG_TO_RAD(root->rotation));
|
||||||
|
|
||||||
// apply scaling
|
// apply scaling
|
||||||
|
@ -848,7 +847,7 @@ void IRRImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
|
||||||
|
|
||||||
// Construct the irrXML parser
|
// Construct the irrXML parser
|
||||||
XmlParser st;
|
XmlParser st;
|
||||||
if (!st.parse( file.get() )) {
|
if (!st.parse(file.get())) {
|
||||||
throw DeadlyImportError("XML parse error while loading IRR file ", pFile);
|
throw DeadlyImportError("XML parse error while loading IRR file ", pFile);
|
||||||
}
|
}
|
||||||
pugi::xml_node rootElement = st.getRootNode();
|
pugi::xml_node rootElement = st.getRootNode();
|
||||||
|
@ -872,7 +871,7 @@ void IRRImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
|
||||||
|
|
||||||
// Batch loader used to load external models
|
// Batch loader used to load external models
|
||||||
BatchLoader batch(pIOHandler);
|
BatchLoader batch(pIOHandler);
|
||||||
//batch.SetBasePath(pFile);
|
// batch.SetBasePath(pFile);
|
||||||
|
|
||||||
cameras.reserve(5);
|
cameras.reserve(5);
|
||||||
lights.reserve(5);
|
lights.reserve(5);
|
||||||
|
@ -882,7 +881,7 @@ void IRRImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
|
||||||
|
|
||||||
// Parse the XML file
|
// Parse the XML file
|
||||||
|
|
||||||
//while (reader->read()) {
|
// while (reader->read()) {
|
||||||
for (pugi::xml_node child : rootElement.children())
|
for (pugi::xml_node child : rootElement.children())
|
||||||
switch (child.type()) {
|
switch (child.type()) {
|
||||||
case pugi::node_element:
|
case pugi::node_element:
|
||||||
|
@ -907,7 +906,7 @@ void IRRImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
|
||||||
* materials assigned (except lights, cameras and dummies, of course).
|
* materials assigned (except lights, cameras and dummies, of course).
|
||||||
*/
|
*/
|
||||||
// ***********************************************************************
|
// ***********************************************************************
|
||||||
//const char *sz = reader->getAttributeValueSafe("type");
|
// const char *sz = reader->getAttributeValueSafe("type");
|
||||||
pugi::xml_attribute attrib = child.attribute("type");
|
pugi::xml_attribute attrib = child.attribute("type");
|
||||||
Node *nd;
|
Node *nd;
|
||||||
if (!ASSIMP_stricmp(attrib.name(), "mesh") || !ASSIMP_stricmp(attrib.name(), "octTree")) {
|
if (!ASSIMP_stricmp(attrib.name(), "mesh") || !ASSIMP_stricmp(attrib.name(), "octTree")) {
|
||||||
|
@ -998,8 +997,8 @@ void IRRImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
|
||||||
// while (reader->read()) {
|
// while (reader->read()) {
|
||||||
for (pugi::xml_node attrib : child.children()) {
|
for (pugi::xml_node attrib : child.children()) {
|
||||||
if (attrib.type() == pugi::node_element) {
|
if (attrib.type() == pugi::node_element) {
|
||||||
//if (reader->getNodeType() == EXN_ELEMENT) {
|
// if (reader->getNodeType() == EXN_ELEMENT) {
|
||||||
//if (!ASSIMP_stricmp(reader->getNodeName(), "vector3d")) {
|
// if (!ASSIMP_stricmp(reader->getNodeName(), "vector3d")) {
|
||||||
if (!ASSIMP_stricmp(attrib.name(), "vector3d")) {
|
if (!ASSIMP_stricmp(attrib.name(), "vector3d")) {
|
||||||
VectorProperty prop;
|
VectorProperty prop;
|
||||||
ReadVectorProperty(prop);
|
ReadVectorProperty(prop);
|
||||||
|
|
|
@ -71,13 +71,13 @@ public:
|
||||||
/** Returns whether the class can handle the format of the given file.
|
/** Returns whether the class can handle the format of the given file.
|
||||||
* See BaseImporter::CanRead() for details.
|
* See BaseImporter::CanRead() for details.
|
||||||
*/
|
*/
|
||||||
bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
|
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
||||||
bool checkSig) const override;
|
bool checkSig) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const aiImporterDesc* GetInfo () const override;
|
const aiImporterDesc *GetInfo() const override;
|
||||||
void InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler) override;
|
void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) override;
|
||||||
void SetupProperties(const Importer* pImp) override;
|
void SetupProperties(const Importer *pImp) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** Data structure for a scene-graph node animator
|
/** Data structure for a scene-graph node animator
|
||||||
|
@ -94,18 +94,10 @@ private:
|
||||||
|
|
||||||
} type;
|
} type;
|
||||||
|
|
||||||
explicit Animator(AT t = UNKNOWN)
|
explicit Animator(AT t = UNKNOWN) :
|
||||||
: type (t)
|
type(t), speed(ai_real(0.001)), direction(ai_real(0.0), ai_real(1.0), ai_real(0.0)), circleRadius(ai_real(1.0)), tightness(ai_real(0.5)), loop(true), timeForWay(100) {
|
||||||
, speed ( ai_real( 0.001 ) )
|
|
||||||
, direction ( ai_real( 0.0 ), ai_real( 1.0 ), ai_real( 0.0 ) )
|
|
||||||
, circleRadius ( ai_real( 1.0) )
|
|
||||||
, tightness ( ai_real( 0.5 ) )
|
|
||||||
, loop (true)
|
|
||||||
, timeForWay (100)
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// common parameters
|
// common parameters
|
||||||
ai_real speed;
|
ai_real speed;
|
||||||
aiVector3D direction;
|
aiVector3D direction;
|
||||||
|
@ -128,11 +120,9 @@ private:
|
||||||
|
|
||||||
/** Data structure for a scene-graph node in an IRR file
|
/** Data structure for a scene-graph node in an IRR file
|
||||||
*/
|
*/
|
||||||
struct Node
|
struct Node {
|
||||||
{
|
|
||||||
// Type of the node
|
// Type of the node
|
||||||
enum ET
|
enum ET {
|
||||||
{
|
|
||||||
LIGHT,
|
LIGHT,
|
||||||
CUBE,
|
CUBE,
|
||||||
MESH,
|
MESH,
|
||||||
|
@ -144,21 +134,20 @@ private:
|
||||||
ANIMMESH
|
ANIMMESH
|
||||||
} type;
|
} type;
|
||||||
|
|
||||||
explicit Node(ET t)
|
explicit Node(ET t) :
|
||||||
: type (t)
|
type(t), scaling(1.0, 1.0, 1.0) // assume uniform scaling by default
|
||||||
, scaling (1.0,1.0,1.0) // assume uniform scaling by default
|
,
|
||||||
, parent()
|
parent(),
|
||||||
, framesPerSecond (0.0)
|
framesPerSecond(0.0),
|
||||||
, id()
|
id(),
|
||||||
, sphereRadius (1.0)
|
sphereRadius(1.0),
|
||||||
, spherePolyCountX (100)
|
spherePolyCountX(100),
|
||||||
, spherePolyCountY (100)
|
spherePolyCountY(100) {
|
||||||
{
|
|
||||||
|
|
||||||
// Generate a default name for the node
|
// Generate a default name for the node
|
||||||
char buffer[128];
|
char buffer[128];
|
||||||
static int cnt;
|
static int cnt;
|
||||||
ai_snprintf(buffer, 128, "IrrNode_%i",cnt++);
|
ai_snprintf(buffer, 128, "IrrNode_%i", cnt++);
|
||||||
name = std::string(buffer);
|
name = std::string(buffer);
|
||||||
|
|
||||||
// reserve space for up to 5 materials
|
// reserve space for up to 5 materials
|
||||||
|
@ -175,10 +164,10 @@ private:
|
||||||
std::string name;
|
std::string name;
|
||||||
|
|
||||||
// List of all child nodes
|
// List of all child nodes
|
||||||
std::vector<Node*> children;
|
std::vector<Node *> children;
|
||||||
|
|
||||||
// Parent node
|
// Parent node
|
||||||
Node* parent;
|
Node *parent;
|
||||||
|
|
||||||
// Animated meshes: frames per second
|
// Animated meshes: frames per second
|
||||||
// 0.f if not specified
|
// 0.f if not specified
|
||||||
|
@ -190,13 +179,13 @@ private:
|
||||||
|
|
||||||
// Meshes: List of materials to be assigned
|
// Meshes: List of materials to be assigned
|
||||||
// along with their corresponding material flags
|
// along with their corresponding material flags
|
||||||
std::vector< std::pair<aiMaterial*, unsigned int> > materials;
|
std::vector<std::pair<aiMaterial *, unsigned int>> materials;
|
||||||
|
|
||||||
// Spheres: radius of the sphere to be generates
|
// Spheres: radius of the sphere to be generates
|
||||||
ai_real sphereRadius;
|
ai_real sphereRadius;
|
||||||
|
|
||||||
// Spheres: Number of polygons in the x,y direction
|
// Spheres: Number of polygons in the x,y direction
|
||||||
unsigned int spherePolyCountX,spherePolyCountY;
|
unsigned int spherePolyCountX, spherePolyCountY;
|
||||||
|
|
||||||
// List of all animators assigned to the node
|
// List of all animators assigned to the node
|
||||||
std::list<Animator> animators;
|
std::list<Animator> animators;
|
||||||
|
@ -204,8 +193,7 @@ private:
|
||||||
|
|
||||||
/** Data structure for a vertex in an IRR skybox
|
/** Data structure for a vertex in an IRR skybox
|
||||||
*/
|
*/
|
||||||
struct SkyboxVertex
|
struct SkyboxVertex {
|
||||||
{
|
|
||||||
SkyboxVertex() = default;
|
SkyboxVertex() = default;
|
||||||
|
|
||||||
//! Construction from single vertex components
|
//! Construction from single vertex components
|
||||||
|
@ -213,31 +201,28 @@ private:
|
||||||
ai_real nx, ai_real ny, ai_real nz,
|
ai_real nx, ai_real ny, ai_real nz,
|
||||||
ai_real uvx, ai_real uvy)
|
ai_real uvx, ai_real uvy)
|
||||||
|
|
||||||
: position (px,py,pz)
|
:
|
||||||
, normal (nx,ny,nz)
|
position(px, py, pz), normal(nx, ny, nz), uv(uvx, uvy, 0.0) {}
|
||||||
, uv (uvx,uvy,0.0)
|
|
||||||
{}
|
|
||||||
|
|
||||||
aiVector3D position, normal, uv;
|
aiVector3D position, normal, uv;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/// Fill the scene-graph recursively
|
/// Fill the scene-graph recursively
|
||||||
void GenerateGraph(Node* root,aiNode* rootOut ,aiScene* scene,
|
void GenerateGraph(Node *root, aiNode *rootOut, aiScene *scene,
|
||||||
BatchLoader& batch,
|
BatchLoader &batch,
|
||||||
std::vector<aiMesh*>& meshes,
|
std::vector<aiMesh *> &meshes,
|
||||||
std::vector<aiNodeAnim*>& anims,
|
std::vector<aiNodeAnim *> &anims,
|
||||||
std::vector<AttachmentInfo>& attach,
|
std::vector<AttachmentInfo> &attach,
|
||||||
std::vector<aiMaterial*>& materials,
|
std::vector<aiMaterial *> &materials,
|
||||||
unsigned int& defaultMatIdx);
|
unsigned int &defaultMatIdx);
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/// Generate a mesh that consists of just a single quad
|
/// Generate a mesh that consists of just a single quad
|
||||||
aiMesh* BuildSingleQuadMesh(const SkyboxVertex& v1,
|
aiMesh *BuildSingleQuadMesh(const SkyboxVertex &v1,
|
||||||
const SkyboxVertex& v2,
|
const SkyboxVertex &v2,
|
||||||
const SkyboxVertex& v3,
|
const SkyboxVertex &v3,
|
||||||
const SkyboxVertex& v4);
|
const SkyboxVertex &v4);
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/// Build a sky-box
|
/// Build a sky-box
|
||||||
|
@ -245,8 +230,8 @@ private:
|
||||||
/// @param meshes Receives 6 output meshes
|
/// @param meshes Receives 6 output meshes
|
||||||
/// @param materials The last 6 materials are assigned to the newly
|
/// @param materials The last 6 materials are assigned to the newly
|
||||||
/// created meshes. The names of the materials are adjusted.
|
/// created meshes. The names of the materials are adjusted.
|
||||||
void BuildSkybox(std::vector<aiMesh*>& meshes,
|
void BuildSkybox(std::vector<aiMesh *> &meshes,
|
||||||
std::vector<aiMaterial*> materials);
|
std::vector<aiMaterial *> materials);
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Copy a material for a mesh to the output material list
|
/** Copy a material for a mesh to the output material list
|
||||||
|
@ -256,10 +241,10 @@ private:
|
||||||
* @param defMatIdx Default material index - UINT_MAX if not present
|
* @param defMatIdx Default material index - UINT_MAX if not present
|
||||||
* @param mesh Mesh to work on
|
* @param mesh Mesh to work on
|
||||||
*/
|
*/
|
||||||
void CopyMaterial(std::vector<aiMaterial*>& materials,
|
void CopyMaterial(std::vector<aiMaterial *> &materials,
|
||||||
std::vector< std::pair<aiMaterial*, unsigned int> >& inmaterials,
|
std::vector<std::pair<aiMaterial *, unsigned int>> &inmaterials,
|
||||||
unsigned int& defMatIdx,
|
unsigned int &defMatIdx,
|
||||||
aiMesh* mesh);
|
aiMesh *mesh);
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Compute animations for a specific node
|
/** Compute animations for a specific node
|
||||||
|
@ -267,8 +252,8 @@ private:
|
||||||
* @param root Node to be processed
|
* @param root Node to be processed
|
||||||
* @param anims The list of output animations
|
* @param anims The list of output animations
|
||||||
*/
|
*/
|
||||||
void ComputeAnimations(Node* root, aiNode* real,
|
void ComputeAnimations(Node *root, aiNode *real,
|
||||||
std::vector<aiNodeAnim*>& anims);
|
std::vector<aiNodeAnim *> &anims);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Configuration option: desired output FPS
|
/// Configuration option: desired output FPS
|
||||||
|
|
|
@ -121,7 +121,7 @@ void IRRMeshImporter::InternReadFile(const std::string &pFile,
|
||||||
|
|
||||||
// Construct the irrXML parser
|
// Construct the irrXML parser
|
||||||
XmlParser parser;
|
XmlParser parser;
|
||||||
if (!parser.parse( file.get() )) {
|
if (!parser.parse(file.get())) {
|
||||||
throw DeadlyImportError("XML parse error while loading IRRMESH file ", pFile);
|
throw DeadlyImportError("XML parse error while loading IRRMESH file ", pFile);
|
||||||
}
|
}
|
||||||
XmlNode root = parser.getRootNode();
|
XmlNode root = parser.getRootNode();
|
||||||
|
@ -181,7 +181,7 @@ void IRRMeshImporter::InternReadFile(const std::string &pFile,
|
||||||
/* no else here! */ if (!ASSIMP_stricmp(child.name(), "vertices")) {
|
/* no else here! */ if (!ASSIMP_stricmp(child.name(), "vertices")) {
|
||||||
pugi::xml_attribute attr = child.attribute("vertexCount");
|
pugi::xml_attribute attr = child.attribute("vertexCount");
|
||||||
int num = attr.as_int();
|
int num = attr.as_int();
|
||||||
//int num = reader->getAttributeValueAsInt("vertexCount");
|
// int num = reader->getAttributeValueAsInt("vertexCount");
|
||||||
|
|
||||||
if (!num) {
|
if (!num) {
|
||||||
// This is possible ... remove the mesh from the list and skip further reading
|
// This is possible ... remove the mesh from the list and skip further reading
|
||||||
|
@ -199,7 +199,7 @@ void IRRMeshImporter::InternReadFile(const std::string &pFile,
|
||||||
curUVs.reserve(num);
|
curUVs.reserve(num);
|
||||||
|
|
||||||
// Determine the file format
|
// Determine the file format
|
||||||
//const char *t = reader->getAttributeValueSafe("type");
|
// const char *t = reader->getAttributeValueSafe("type");
|
||||||
pugi::xml_attribute t = child.attribute("type");
|
pugi::xml_attribute t = child.attribute("type");
|
||||||
if (!ASSIMP_stricmp("2tcoords", t.name())) {
|
if (!ASSIMP_stricmp("2tcoords", t.name())) {
|
||||||
curUV2s.reserve(num);
|
curUV2s.reserve(num);
|
||||||
|
@ -294,9 +294,9 @@ void IRRMeshImporter::InternReadFile(const std::string &pFile,
|
||||||
curMesh->mTextureCoords[1] = new aiVector3D[curMesh->mNumVertices];
|
curMesh->mTextureCoords[1] = new aiVector3D[curMesh->mNumVertices];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//break;
|
// break;
|
||||||
|
|
||||||
//case EXN_TEXT: {
|
// case EXN_TEXT: {
|
||||||
const char *sz = child.child_value();
|
const char *sz = child.child_value();
|
||||||
if (textMeaning == 1) {
|
if (textMeaning == 1) {
|
||||||
textMeaning = 0;
|
textMeaning = 0;
|
||||||
|
|
|
@ -43,19 +43,19 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
* @brief Shared utilities for the IRR and IRRMESH loaders
|
* @brief Shared utilities for the IRR and IRRMESH loaders
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//This section should be excluded only if both the Irrlicht AND the Irrlicht Mesh importers were omitted.
|
// This section should be excluded only if both the Irrlicht AND the Irrlicht Mesh importers were omitted.
|
||||||
#if !(defined(ASSIMP_BUILD_NO_IRR_IMPORTER) && defined(ASSIMP_BUILD_NO_IRRMESH_IMPORTER))
|
#if !(defined(ASSIMP_BUILD_NO_IRR_IMPORTER) && defined(ASSIMP_BUILD_NO_IRRMESH_IMPORTER))
|
||||||
|
|
||||||
#include "IRRShared.h"
|
#include "IRRShared.h"
|
||||||
#include <assimp/ParsingUtils.h>
|
#include <assimp/ParsingUtils.h>
|
||||||
#include <assimp/fast_atof.h>
|
#include <assimp/fast_atof.h>
|
||||||
#include <assimp/DefaultLogger.hpp>
|
|
||||||
#include <assimp/material.h>
|
#include <assimp/material.h>
|
||||||
|
#include <assimp/DefaultLogger.hpp>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
// Transformation matrix to convert from Assimp to IRR space
|
// Transformation matrix to convert from Assimp to IRR space
|
||||||
const aiMatrix4x4 Assimp::AI_TO_IRR_MATRIX = aiMatrix4x4 (
|
const aiMatrix4x4 Assimp::AI_TO_IRR_MATRIX = aiMatrix4x4(
|
||||||
1.0f, 0.0f, 0.0f, 0.0f,
|
1.0f, 0.0f, 0.0f, 0.0f,
|
||||||
0.0f, 0.0f, 1.0f, 0.0f,
|
0.0f, 0.0f, 1.0f, 0.0f,
|
||||||
0.0f, 1.0f, 0.0f, 0.0f,
|
0.0f, 1.0f, 0.0f, 0.0f,
|
||||||
|
@ -63,11 +63,11 @@ const aiMatrix4x4 Assimp::AI_TO_IRR_MATRIX = aiMatrix4x4 (
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// read a property in hexadecimal format (i.e. ffffffff)
|
// read a property in hexadecimal format (i.e. ffffffff)
|
||||||
void IrrlichtBase::ReadHexProperty(HexProperty &out ) {
|
void IrrlichtBase::ReadHexProperty(HexProperty &out) {
|
||||||
for (pugi::xml_attribute attrib : mNode->attributes()) {
|
for (pugi::xml_attribute attrib : mNode->attributes()) {
|
||||||
if (!ASSIMP_stricmp(attrib.name(), "name")) {
|
if (!ASSIMP_stricmp(attrib.name(), "name")) {
|
||||||
out.name = std::string( attrib.value() );
|
out.name = std::string(attrib.value());
|
||||||
} else if (!ASSIMP_stricmp(attrib.name(),"value")) {
|
} else if (!ASSIMP_stricmp(attrib.name(), "value")) {
|
||||||
// parse the hexadecimal value
|
// parse the hexadecimal value
|
||||||
out.value = strtoul16(attrib.name());
|
out.value = strtoul16(attrib.name());
|
||||||
}
|
}
|
||||||
|
@ -76,11 +76,11 @@ void IrrlichtBase::ReadHexProperty(HexProperty &out ) {
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// read a decimal property
|
// read a decimal property
|
||||||
void IrrlichtBase::ReadIntProperty(IntProperty & out) {
|
void IrrlichtBase::ReadIntProperty(IntProperty &out) {
|
||||||
for (pugi::xml_attribute attrib : mNode->attributes()) {
|
for (pugi::xml_attribute attrib : mNode->attributes()) {
|
||||||
if (!ASSIMP_stricmp(attrib.name(), "name")) {
|
if (!ASSIMP_stricmp(attrib.name(), "name")) {
|
||||||
out.name = std::string(attrib.value());
|
out.name = std::string(attrib.value());
|
||||||
} else if (!ASSIMP_stricmp(attrib.value(),"value")) {
|
} else if (!ASSIMP_stricmp(attrib.value(), "value")) {
|
||||||
// parse the int value
|
// parse the int value
|
||||||
out.value = strtol10(attrib.name());
|
out.value = strtol10(attrib.name());
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ void IrrlichtBase::ReadIntProperty(IntProperty & out) {
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// read a string property
|
// read a string property
|
||||||
void IrrlichtBase::ReadStringProperty( StringProperty& out) {
|
void IrrlichtBase::ReadStringProperty(StringProperty &out) {
|
||||||
for (pugi::xml_attribute attrib : mNode->attributes()) {
|
for (pugi::xml_attribute attrib : mNode->attributes()) {
|
||||||
if (!ASSIMP_stricmp(attrib.name(), "name")) {
|
if (!ASSIMP_stricmp(attrib.name(), "name")) {
|
||||||
out.name = std::string(attrib.value());
|
out.name = std::string(attrib.value());
|
||||||
|
@ -104,7 +104,7 @@ void IrrlichtBase::ReadStringProperty( StringProperty& out) {
|
||||||
// read a boolean property
|
// read a boolean property
|
||||||
void IrrlichtBase::ReadBoolProperty(BoolProperty &out) {
|
void IrrlichtBase::ReadBoolProperty(BoolProperty &out) {
|
||||||
for (pugi::xml_attribute attrib : mNode->attributes()) {
|
for (pugi::xml_attribute attrib : mNode->attributes()) {
|
||||||
if (!ASSIMP_stricmp(attrib.name(), "name")){
|
if (!ASSIMP_stricmp(attrib.name(), "name")) {
|
||||||
out.name = std::string(attrib.value());
|
out.name = std::string(attrib.value());
|
||||||
} else if (!ASSIMP_stricmp(attrib.name(), "value")) {
|
} else if (!ASSIMP_stricmp(attrib.name(), "value")) {
|
||||||
// true or false, case insensitive
|
// true or false, case insensitive
|
||||||
|
@ -128,7 +128,7 @@ void IrrlichtBase::ReadFloatProperty(FloatProperty &out) {
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// read a vector property
|
// read a vector property
|
||||||
void IrrlichtBase::ReadVectorProperty( VectorProperty &out ) {
|
void IrrlichtBase::ReadVectorProperty(VectorProperty &out) {
|
||||||
for (pugi::xml_attribute attrib : mNode->attributes()) {
|
for (pugi::xml_attribute attrib : mNode->attributes()) {
|
||||||
if (!ASSIMP_stricmp(attrib.name(), "name")) {
|
if (!ASSIMP_stricmp(attrib.name(), "name")) {
|
||||||
out.name = std::string(attrib.value());
|
out.name = std::string(attrib.value());
|
||||||
|
@ -137,28 +137,28 @@ void IrrlichtBase::ReadVectorProperty( VectorProperty &out ) {
|
||||||
const char *ptr = attrib.value();
|
const char *ptr = attrib.value();
|
||||||
|
|
||||||
SkipSpaces(&ptr);
|
SkipSpaces(&ptr);
|
||||||
ptr = fast_atoreal_move<float>( ptr,(float&)out.value.x );
|
ptr = fast_atoreal_move<float>(ptr, (float &)out.value.x);
|
||||||
SkipSpaces(&ptr);
|
SkipSpaces(&ptr);
|
||||||
if (',' != *ptr) {
|
if (',' != *ptr) {
|
||||||
ASSIMP_LOG_ERROR("IRR(MESH): Expected comma in vector definition");
|
ASSIMP_LOG_ERROR("IRR(MESH): Expected comma in vector definition");
|
||||||
} else {
|
} else {
|
||||||
SkipSpaces(ptr + 1, &ptr);
|
SkipSpaces(ptr + 1, &ptr);
|
||||||
}
|
}
|
||||||
ptr = fast_atoreal_move<float>( ptr,(float&)out.value.y );
|
ptr = fast_atoreal_move<float>(ptr, (float &)out.value.y);
|
||||||
SkipSpaces(&ptr);
|
SkipSpaces(&ptr);
|
||||||
if (',' != *ptr) {
|
if (',' != *ptr) {
|
||||||
ASSIMP_LOG_ERROR("IRR(MESH): Expected comma in vector definition");
|
ASSIMP_LOG_ERROR("IRR(MESH): Expected comma in vector definition");
|
||||||
} else {
|
} else {
|
||||||
SkipSpaces(ptr + 1, &ptr);
|
SkipSpaces(ptr + 1, &ptr);
|
||||||
}
|
}
|
||||||
ptr = fast_atoreal_move<float>( ptr,(float&)out.value.z );
|
ptr = fast_atoreal_move<float>(ptr, (float &)out.value.z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Convert a string to a proper aiMappingMode
|
// Convert a string to a proper aiMappingMode
|
||||||
int ConvertMappingMode(const std::string& mode) {
|
int ConvertMappingMode(const std::string &mode) {
|
||||||
if (mode == "texture_clamp_repeat") {
|
if (mode == "texture_clamp_repeat") {
|
||||||
return aiTextureMapMode_Wrap;
|
return aiTextureMapMode_Wrap;
|
||||||
} else if (mode == "texture_clamp_mirror") {
|
} else if (mode == "texture_clamp_mirror") {
|
||||||
|
@ -170,8 +170,8 @@ int ConvertMappingMode(const std::string& mode) {
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Parse a material from the XML file
|
// Parse a material from the XML file
|
||||||
aiMaterial* IrrlichtBase::ParseMaterial(unsigned int& matFlags) {
|
aiMaterial *IrrlichtBase::ParseMaterial(unsigned int &matFlags) {
|
||||||
aiMaterial* mat = new aiMaterial();
|
aiMaterial *mat = new aiMaterial();
|
||||||
aiColor4D clr;
|
aiColor4D clr;
|
||||||
aiString s;
|
aiString s;
|
||||||
|
|
||||||
|
@ -337,7 +337,7 @@ aiMaterial* IrrlichtBase::ParseMaterial(unsigned int& matFlags) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//break;
|
// break;
|
||||||
/*case EXN_ELEMENT_END:
|
/*case EXN_ELEMENT_END:
|
||||||
|
|
||||||
// Assume there are no further nested nodes in <material> elements
|
// Assume there are no further nested nodes in <material> elements
|
||||||
|
|
Loading…
Reference in New Issue