Obj: apply clang format.
This commit is contained in:
@@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||
|
||||
Copyright (c) 2006-2020, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
@@ -44,10 +43,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#ifndef OBJ_FILEDATA_H_INC
|
||||
#define OBJ_FILEDATA_H_INC
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <assimp/types.h>
|
||||
#include <assimp/mesh.h>
|
||||
#include <assimp/types.h>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
namespace Assimp {
|
||||
namespace ObjFile {
|
||||
@@ -75,12 +74,8 @@ struct Face {
|
||||
Material *m_pMaterial;
|
||||
|
||||
//! \brief Default constructor
|
||||
Face( aiPrimitiveType pt = aiPrimitiveType_POLYGON)
|
||||
: m_PrimitiveType( pt )
|
||||
, m_vertices()
|
||||
, m_normals()
|
||||
, m_texturCoords()
|
||||
, m_pMaterial( 0L ) {
|
||||
Face(aiPrimitiveType pt = aiPrimitiveType_POLYGON) :
|
||||
m_PrimitiveType(pt), m_vertices(), m_normals(), m_texturCoords(), m_pMaterial(0L) {
|
||||
// empty
|
||||
}
|
||||
|
||||
@@ -105,19 +100,19 @@ struct Object {
|
||||
//! Transformation matrix, stored in OpenGL format
|
||||
aiMatrix4x4 m_Transformation;
|
||||
//! All sub-objects referenced by this object
|
||||
std::vector<Object*> m_SubObjects;
|
||||
std::vector<Object *> m_SubObjects;
|
||||
/// Assigned meshes
|
||||
std::vector<unsigned int> m_Meshes;
|
||||
|
||||
//! \brief Default constructor
|
||||
Object()
|
||||
: m_strObjName("") {
|
||||
Object() :
|
||||
m_strObjName("") {
|
||||
// empty
|
||||
}
|
||||
|
||||
//! \brief Destructor
|
||||
~Object() {
|
||||
for ( std::vector<Object*>::iterator it = m_SubObjects.begin(); it != m_SubObjects.end(); ++it) {
|
||||
for (std::vector<Object *>::iterator it = m_SubObjects.begin(); it != m_SubObjects.end(); ++it) {
|
||||
delete *it;
|
||||
}
|
||||
}
|
||||
@@ -184,16 +179,11 @@ struct Material {
|
||||
aiColor3D transparent;
|
||||
|
||||
//! Constructor
|
||||
Material()
|
||||
: diffuse ( ai_real( 0.6 ), ai_real( 0.6 ), ai_real( 0.6 ) )
|
||||
, alpha (ai_real( 1.0 ) )
|
||||
, shineness ( ai_real( 0.0) )
|
||||
, illumination_model (1)
|
||||
, ior ( ai_real( 1.0 ) )
|
||||
, transparent( ai_real( 1.0), ai_real (1.0), ai_real(1.0)) {
|
||||
Material() :
|
||||
diffuse(ai_real(0.6), ai_real(0.6), ai_real(0.6)), alpha(ai_real(1.0)), shineness(ai_real(0.0)), illumination_model(1), ior(ai_real(1.0)), transparent(ai_real(1.0), ai_real(1.0), ai_real(1.0)) {
|
||||
// empty
|
||||
for (size_t i = 0; i < TextureTypeCount; ++i) {
|
||||
clamp[ i ] = false;
|
||||
clamp[i] = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,13 +202,13 @@ struct Mesh {
|
||||
/// The name for the mesh
|
||||
std::string m_name;
|
||||
/// Array with pointer to all stored faces
|
||||
std::vector<Face*> m_Faces;
|
||||
std::vector<Face *> m_Faces;
|
||||
/// Assigned material
|
||||
Material *m_pMaterial;
|
||||
/// Number of stored indices.
|
||||
unsigned int m_uiNumIndices;
|
||||
/// Number of UV
|
||||
unsigned int m_uiUVCoordinates[ AI_MAX_NUMBER_OF_TEXTURECOORDS ];
|
||||
unsigned int m_uiUVCoordinates[AI_MAX_NUMBER_OF_TEXTURECOORDS];
|
||||
/// Material index.
|
||||
unsigned int m_uiMaterialIndex;
|
||||
/// True, if normals are stored.
|
||||
@@ -227,20 +217,15 @@ struct Mesh {
|
||||
bool m_hasVertexColors;
|
||||
|
||||
/// Constructor
|
||||
explicit Mesh( const std::string &name )
|
||||
: m_name( name )
|
||||
, m_pMaterial(NULL)
|
||||
, m_uiNumIndices(0)
|
||||
, m_uiMaterialIndex( NoMaterial )
|
||||
, m_hasNormals(false) {
|
||||
memset(m_uiUVCoordinates, 0, sizeof( unsigned int ) * AI_MAX_NUMBER_OF_TEXTURECOORDS);
|
||||
explicit Mesh(const std::string &name) :
|
||||
m_name(name), m_pMaterial(NULL), m_uiNumIndices(0), m_uiMaterialIndex(NoMaterial), m_hasNormals(false) {
|
||||
memset(m_uiUVCoordinates, 0, sizeof(unsigned int) * AI_MAX_NUMBER_OF_TEXTURECOORDS);
|
||||
}
|
||||
|
||||
/// Destructor
|
||||
~Mesh() {
|
||||
for (std::vector<Face*>::iterator it = m_Faces.begin();
|
||||
it != m_Faces.end(); ++it)
|
||||
{
|
||||
for (std::vector<Face *>::iterator it = m_Faces.begin();
|
||||
it != m_Faces.end(); ++it) {
|
||||
delete *it;
|
||||
}
|
||||
}
|
||||
@@ -251,14 +236,14 @@ struct Mesh {
|
||||
//! \brief Data structure to store all obj-specific model datas
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
struct Model {
|
||||
typedef std::map<std::string, std::vector<unsigned int>* > GroupMap;
|
||||
typedef std::map<std::string, std::vector<unsigned int>* >::iterator GroupMapIt;
|
||||
typedef std::map<std::string, std::vector<unsigned int>* >::const_iterator ConstGroupMapIt;
|
||||
typedef std::map<std::string, std::vector<unsigned int> *> GroupMap;
|
||||
typedef std::map<std::string, std::vector<unsigned int> *>::iterator GroupMapIt;
|
||||
typedef std::map<std::string, std::vector<unsigned int> *>::const_iterator ConstGroupMapIt;
|
||||
|
||||
//! Model name
|
||||
std::string m_ModelName;
|
||||
//! List ob assigned objects
|
||||
std::vector<Object*> m_Objects;
|
||||
std::vector<Object *> m_Objects;
|
||||
//! Pointer to current object
|
||||
ObjFile::Object *m_pCurrent;
|
||||
//! Pointer to current material
|
||||
@@ -286,46 +271,45 @@ struct Model {
|
||||
//! Current mesh instance
|
||||
Mesh *m_pCurrentMesh;
|
||||
//! Vector with stored meshes
|
||||
std::vector<Mesh*> m_Meshes;
|
||||
std::vector<Mesh *> m_Meshes;
|
||||
//! Material map
|
||||
std::map<std::string, Material*> m_MaterialMap;
|
||||
std::map<std::string, Material *> m_MaterialMap;
|
||||
|
||||
//! \brief The default class constructor
|
||||
Model() :
|
||||
m_ModelName(""),
|
||||
m_pCurrent(NULL),
|
||||
m_pCurrentMaterial(NULL),
|
||||
m_pDefaultMaterial(NULL),
|
||||
m_pGroupFaceIDs(NULL),
|
||||
m_strActiveGroup(""),
|
||||
m_TextureCoordDim(0),
|
||||
m_pCurrentMesh(NULL)
|
||||
{
|
||||
m_ModelName(""),
|
||||
m_pCurrent(NULL),
|
||||
m_pCurrentMaterial(NULL),
|
||||
m_pDefaultMaterial(NULL),
|
||||
m_pGroupFaceIDs(NULL),
|
||||
m_strActiveGroup(""),
|
||||
m_TextureCoordDim(0),
|
||||
m_pCurrentMesh(NULL) {
|
||||
// empty
|
||||
}
|
||||
|
||||
//! \brief The class destructor
|
||||
~Model() {
|
||||
// Clear all stored object instances
|
||||
for (std::vector<Object*>::iterator it = m_Objects.begin();
|
||||
it != m_Objects.end(); ++it) {
|
||||
for (std::vector<Object *>::iterator it = m_Objects.begin();
|
||||
it != m_Objects.end(); ++it) {
|
||||
delete *it;
|
||||
}
|
||||
m_Objects.clear();
|
||||
|
||||
// Clear all stored mesh instances
|
||||
for (std::vector<Mesh*>::iterator it = m_Meshes.begin();
|
||||
it != m_Meshes.end(); ++it) {
|
||||
for (std::vector<Mesh *>::iterator it = m_Meshes.begin();
|
||||
it != m_Meshes.end(); ++it) {
|
||||
delete *it;
|
||||
}
|
||||
m_Meshes.clear();
|
||||
|
||||
for(GroupMapIt it = m_Groups.begin(); it != m_Groups.end(); ++it) {
|
||||
for (GroupMapIt it = m_Groups.begin(); it != m_Groups.end(); ++it) {
|
||||
delete it->second;
|
||||
}
|
||||
m_Groups.clear();
|
||||
|
||||
for ( std::map<std::string, Material*>::iterator it = m_MaterialMap.begin(); it != m_MaterialMap.end(); ++it ) {
|
||||
for (std::map<std::string, Material *>::iterator it = m_MaterialMap.begin(); it != m_MaterialMap.end(); ++it) {
|
||||
delete it->second;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user