diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:17:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:21:24 +0300 |
commit | e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch) | |
tree | 8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/collada/MeshImporter.h | |
parent | b3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff) |
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.
For details on usage and instructions for migrating branches
without conflicts, see:
https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/collada/MeshImporter.h')
-rw-r--r-- | source/blender/collada/MeshImporter.h | 197 |
1 files changed, 96 insertions, 101 deletions
diff --git a/source/blender/collada/MeshImporter.h b/source/blender/collada/MeshImporter.h index 08b7edd2a3b..68ab6e73732 100644 --- a/source/blender/collada/MeshImporter.h +++ b/source/blender/collada/MeshImporter.h @@ -45,141 +45,136 @@ extern "C" { #include "DNA_meshdata_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" - } // only for ArmatureImporter to "see" MeshImporter::get_object_by_geom_uid -class MeshImporterBase -{ -public: - virtual Object *get_object_by_geom_uid(const COLLADAFW::UniqueId& geom_uid) = 0; - virtual Mesh *get_mesh_by_geom_uid(const COLLADAFW::UniqueId& mesh_uid) = 0; - virtual std::string *get_geometry_name(const std::string &mesh_name) = 0; +class MeshImporterBase { + public: + virtual Object *get_object_by_geom_uid(const COLLADAFW::UniqueId &geom_uid) = 0; + virtual Mesh *get_mesh_by_geom_uid(const COLLADAFW::UniqueId &mesh_uid) = 0; + virtual std::string *get_geometry_name(const std::string &mesh_name) = 0; }; -class UVDataWrapper -{ - COLLADAFW::MeshVertexData *mVData; -public: - UVDataWrapper(COLLADAFW::MeshVertexData& vdata); +class UVDataWrapper { + COLLADAFW::MeshVertexData *mVData; + + public: + UVDataWrapper(COLLADAFW::MeshVertexData &vdata); #ifdef COLLADA_DEBUG - void print(); + void print(); #endif - void getUV(int uv_index, float *uv); + void getUV(int uv_index, float *uv); }; -class VCOLDataWrapper -{ - COLLADAFW::MeshVertexData *mVData; -public: - VCOLDataWrapper(COLLADAFW::MeshVertexData& vdata); - void get_vcol(int v_index, MLoopCol *mloopcol); +class VCOLDataWrapper { + COLLADAFW::MeshVertexData *mVData; + + public: + VCOLDataWrapper(COLLADAFW::MeshVertexData &vdata); + void get_vcol(int v_index, MLoopCol *mloopcol); }; -class MeshImporter : public MeshImporterBase -{ -private: - - UnitConverter *unitconverter; - - Main *m_bmain; - Scene *scene; - ViewLayer *view_layer; - - ArmatureImporter *armature_importer; - - std::map<std::string, std::string> mesh_geom_map; // needed for correct shape key naming - std::map<COLLADAFW::UniqueId, Mesh*> uid_mesh_map; // geometry unique id-to-mesh map - std::map<COLLADAFW::UniqueId, Object*> uid_object_map; // geom uid-to-object - std::vector<Object*> imported_objects; // list of imported objects - - // this structure is used to assign material indices to polygons - // it holds a portion of Mesh faces and corresponds to a DAE primitive list (<triangles>, <polylist>, etc.) - struct Primitive { - MPoly *mpoly; - unsigned int totpoly; - }; - typedef std::map<COLLADAFW::MaterialId, std::vector<Primitive> > MaterialIdPrimitiveArrayMap; - std::map<COLLADAFW::UniqueId, MaterialIdPrimitiveArrayMap> geom_uid_mat_mapping_map; // crazy name! - std::multimap<COLLADAFW::UniqueId, COLLADAFW::UniqueId> materials_mapped_to_geom; //< materials that have already been mapped to a geometry. A pair of geom uid and mat uid, one geometry can have several materials - - bool set_poly_indices( - MPoly *mpoly, - MLoop *mloop, - int loop_index, - unsigned int *indices, - int loop_count); - - void set_face_uv( - MLoopUV *mloopuv, - UVDataWrapper &uvs, - int loop_index, - COLLADAFW::IndexList& index_list, - int count); - - void set_vcol( - MLoopCol *mloopcol, - VCOLDataWrapper &vob, - int loop_index, - COLLADAFW::IndexList& index_list, - int count); +class MeshImporter : public MeshImporterBase { + private: + UnitConverter *unitconverter; + + Main *m_bmain; + Scene *scene; + ViewLayer *view_layer; + + ArmatureImporter *armature_importer; + + std::map<std::string, std::string> mesh_geom_map; // needed for correct shape key naming + std::map<COLLADAFW::UniqueId, Mesh *> uid_mesh_map; // geometry unique id-to-mesh map + std::map<COLLADAFW::UniqueId, Object *> uid_object_map; // geom uid-to-object + std::vector<Object *> imported_objects; // list of imported objects + + // this structure is used to assign material indices to polygons + // it holds a portion of Mesh faces and corresponds to a DAE primitive list (<triangles>, <polylist>, etc.) + struct Primitive { + MPoly *mpoly; + unsigned int totpoly; + }; + typedef std::map<COLLADAFW::MaterialId, std::vector<Primitive>> MaterialIdPrimitiveArrayMap; + std::map<COLLADAFW::UniqueId, MaterialIdPrimitiveArrayMap> + geom_uid_mat_mapping_map; // crazy name! + std::multimap<COLLADAFW::UniqueId, COLLADAFW::UniqueId> + materials_mapped_to_geom; //< materials that have already been mapped to a geometry. A pair of geom uid and mat uid, one geometry can have several materials + + bool set_poly_indices( + MPoly *mpoly, MLoop *mloop, int loop_index, unsigned int *indices, int loop_count); + + void set_face_uv(MLoopUV *mloopuv, + UVDataWrapper &uvs, + int loop_index, + COLLADAFW::IndexList &index_list, + int count); + + void set_vcol(MLoopCol *mloopcol, + VCOLDataWrapper &vob, + int loop_index, + COLLADAFW::IndexList &index_list, + int count); #ifdef COLLADA_DEBUG - void print_index_list(COLLADAFW::IndexList& index_list); + void print_index_list(COLLADAFW::IndexList &index_list); #endif - bool is_nice_mesh(COLLADAFW::Mesh *mesh); - - void read_vertices(COLLADAFW::Mesh *mesh, Mesh *me); - - bool primitive_has_useable_normals(COLLADAFW::MeshPrimitive *mp); - bool primitive_has_faces(COLLADAFW::MeshPrimitive *mp); + bool is_nice_mesh(COLLADAFW::Mesh *mesh); - static void mesh_add_edges(Mesh *mesh, int len); + void read_vertices(COLLADAFW::Mesh *mesh, Mesh *me); - unsigned int get_loose_edge_count(COLLADAFW::Mesh *mesh); + bool primitive_has_useable_normals(COLLADAFW::MeshPrimitive *mp); + bool primitive_has_faces(COLLADAFW::MeshPrimitive *mp); - CustomData create_edge_custom_data(EdgeHash *eh); + static void mesh_add_edges(Mesh *mesh, int len); - void allocate_poly_data(COLLADAFW::Mesh *collada_mesh, Mesh *me); + unsigned int get_loose_edge_count(COLLADAFW::Mesh *mesh); - // TODO: import uv set names - void read_polys(COLLADAFW::Mesh *mesh, Mesh *me); - void read_lines(COLLADAFW::Mesh *mesh, Mesh *me); - unsigned int get_vertex_count(COLLADAFW::Polygons *mp, int index); + CustomData create_edge_custom_data(EdgeHash *eh); - void get_vector(float v[3], COLLADAFW::MeshVertexData& arr, int i, int stride); + void allocate_poly_data(COLLADAFW::Mesh *collada_mesh, Mesh *me); - bool is_flat_face(unsigned int *nind, COLLADAFW::MeshVertexData& nor, int count); + // TODO: import uv set names + void read_polys(COLLADAFW::Mesh *mesh, Mesh *me); + void read_lines(COLLADAFW::Mesh *mesh, Mesh *me); + unsigned int get_vertex_count(COLLADAFW::Polygons *mp, int index); - std::vector<Object *> get_all_users_of(Mesh *reference_mesh); + void get_vector(float v[3], COLLADAFW::MeshVertexData &arr, int i, int stride); -public: + bool is_flat_face(unsigned int *nind, COLLADAFW::MeshVertexData &nor, int count); - MeshImporter(UnitConverter *unitconv, ArmatureImporter *arm, Main *bmain, Scene *sce, ViewLayer *view_layer); + std::vector<Object *> get_all_users_of(Mesh *reference_mesh); - virtual Object *get_object_by_geom_uid(const COLLADAFW::UniqueId& geom_uid); + public: + MeshImporter(UnitConverter *unitconv, + ArmatureImporter *arm, + Main *bmain, + Scene *sce, + ViewLayer *view_layer); - virtual Mesh *get_mesh_by_geom_uid(const COLLADAFW::UniqueId& geom_uid); + virtual Object *get_object_by_geom_uid(const COLLADAFW::UniqueId &geom_uid); - void optimize_material_assignements(); + virtual Mesh *get_mesh_by_geom_uid(const COLLADAFW::UniqueId &geom_uid); - void assign_material_to_geom( - COLLADAFW::MaterialBinding cmaterial, - std::map<COLLADAFW::UniqueId, Material*>& uid_material_map, - Object *ob, const COLLADAFW::UniqueId *geom_uid, - short mat_index); + void optimize_material_assignements(); + void assign_material_to_geom(COLLADAFW::MaterialBinding cmaterial, + std::map<COLLADAFW::UniqueId, Material *> &uid_material_map, + Object *ob, + const COLLADAFW::UniqueId *geom_uid, + short mat_index); - Object *create_mesh_object(COLLADAFW::Node *node, COLLADAFW::InstanceGeometry *geom, - bool isController, - std::map<COLLADAFW::UniqueId, Material*>& uid_material_map); + Object *create_mesh_object(COLLADAFW::Node *node, + COLLADAFW::InstanceGeometry *geom, + bool isController, + std::map<COLLADAFW::UniqueId, Material *> &uid_material_map); - // create a mesh storing a pointer in a map so it can be retrieved later by geometry UID - bool write_geometry(const COLLADAFW::Geometry* geom); - std::string *get_geometry_name(const std::string &mesh_name); + // create a mesh storing a pointer in a map so it can be retrieved later by geometry UID + bool write_geometry(const COLLADAFW::Geometry *geom); + std::string *get_geometry_name(const std::string &mesh_name); }; #endif |