Radium Engine  1.5.0
GeometryData.cpp
1 #include "Core/Geometry/StandardAttribNames.hpp"
2 #include <Core/Asset/GeometryData.hpp>
3 
4 #include <Core/Utils/Log.hpp>
5 
6 namespace Ra {
7 namespace Core {
8 namespace Asset {
9 
10 GeometryData::GeometryData( const std::string& name, const GeometryType& type ) :
11  AssetData( name ),
12  m_frame( Transform::Identity() ),
13  m_type( type ),
14  m_geometry(),
15  m_material() {}
16 
17 GeometryData::~GeometryData() {}
18 
19 void GeometryData::displayInfo() const {
20  using namespace Core::Utils; // log
21  std::string type;
22  switch ( m_type ) {
23  case POINT_CLOUD:
24  type = "POINT CLOUD";
25  break;
26  case LINE_MESH:
27  type = "LINE MESH";
28  break;
29  case TRI_MESH:
30  type = "TRIANGLE MESH";
31  break;
32  case QUAD_MESH:
33  type = "QUAD MESH";
34  break;
35  case POLY_MESH:
36  type = "POLY MESH";
37  break;
38  case TETRA_MESH:
39  type = "TETRA MESH";
40  break;
41  case HEX_MESH:
42  type = "HEX MESH";
43  break;
44  case UNKNOWN:
45  default:
46  type = "UNKNOWN";
47  break;
48  }
49 
50  auto attribSize = [this]( Geometry::MeshAttrib a ) -> size_t {
51  const auto& name = getAttribName( a );
52  return getGeometry().hasAttrib( name ) ? getGeometry().getAttribBase( name )->getSize() : 0;
53  };
54 
55  auto hasAttrib = [this]( Geometry::MeshAttrib a ) -> std::string {
56  return getGeometry().hasAttrib( getAttribName( a ) ) ? "YES" : "NO";
57  };
58 
59  using namespace Geometry;
60  LOG( logINFO ) << "======== MESH INFO ========";
61  LOG( logINFO ) << " Name : " << m_name;
62  LOG( logINFO ) << " Type : " << type;
63  LOG( logINFO ) << " Edge # : " << ( hasEdges() ? getPrimitiveCount() : 0 );
64  LOG( logINFO ) << " Face # : " << ( hasFaces() ? getPrimitiveCount() : 0 );
65  LOG( logINFO ) << " Vertex # : " << attribSize( MeshAttrib::VERTEX_POSITION );
66  LOG( logINFO ) << " Normal ? : " << hasAttrib( MeshAttrib::VERTEX_NORMAL );
67  LOG( logINFO ) << " Tangent ? : " << hasAttrib( MeshAttrib::VERTEX_TANGENT );
68  LOG( logINFO ) << " Bitangent ? : " << hasAttrib( MeshAttrib::VERTEX_BITANGENT );
69  LOG( logINFO ) << " Tex.Coord. ? : " << hasAttrib( MeshAttrib::VERTEX_TEXCOORD );
70  LOG( logINFO ) << " Color ? : " << hasAttrib( MeshAttrib::VERTEX_COLOR );
71  LOG( logINFO ) << " Material ? : " << ( ( !hasMaterial() ) ? "NO" : "YES" );
72 
73  if ( hasMaterial() ) { m_material->displayInfo(); }
74 }
75 } // namespace Asset
76 } // namespace Core
77 } // namespace Ra
Definition: Cage.cpp:3