/usr/include/opencollada/COLLADAFramework/COLLADAFWMesh.h is in opencollada-dev 0.1.0~20140703.ddf8f47+dfsg1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | /*
Copyright (c) 2008-2009 NetAllied Systems GmbH
This file is part of COLLADAFramework.
Licensed under the MIT Open Source License,
for details please see LICENSE file or the website
http://www.opensource.org/licenses/mit-license.php
*/
#ifndef __COLLADAFW_MESH_H__
#define __COLLADAFW_MESH_H__
#include "COLLADAFWPrerequisites.h"
#include "COLLADAFWGeometry.h"
#include "COLLADAFWMeshVertexData.h"
#include "COLLADAFWMeshPrimitive.h"
#include "COLLADABUUtils.h"
namespace COLLADAFW
{
/**
* Describes basic geometric meshes using vertex and primitive information.
* Meshes embody a general form of geometric description that primarily
* includes vertex and primitive information.
* Vertex information is the set of attributes associated with a point on
* the surface of the mesh. Each vertex includes data for attributes such as:
* � Vertex position
* � Vertex color
* � Vertex normal
* � Vertex texture coordinate
* The mesh also includes a description of how the vertices are organized to
* form the geometric shape of the mesh. The mesh vertices are collated into
* geometric primitives such as polygons, triangles, or lines.
*/
class Mesh : public Geometry
{
public:
private:
/**
* The positions array. Positions can be stored as float or double values.
* Positions have always a stride of three (XYZ parameters). We don't need to store
* this information.
*/
MeshVertexData mPositions;
/**
* The normals array. Normals can be stored as float or double values.
* Normals have always a stride of three (XYZ parameters). We don't need to store this
* information.
*/
MeshVertexData mNormals;
/**
* The colors array. Colors can be stored as float or double values.
* Colors can have different strides (RGB or RGBA parameters). We have to store this
* information.
*/
MeshVertexData mColors;
/**
* The uv coordinates array. UV coordinates can be stored as float or double values.
* UV corrdinates can have different strides (2d, 3d, 4d). We have to store this
* information.
*/
MeshVertexData mUVCoords;
/**
* The Tangent array
*/
MeshVertexData mTangents;
/**
* The Binormal array
*/
MeshVertexData mBinormals;
/**
* Geometric primitives, which assemble values from the inputs into vertex attribute data.
* Each primitive element holds the index arrays of the used input elements
* Can be any combination of the following in any order:
* <lines>, <linestrips>, <polygons>, <polylist>, <triangles>, <trifans>, and <tristrips>
*/
MeshPrimitiveArray mMeshPrimitives;
public:
/** Constructor. */
Mesh ( const UniqueId& uniqueId );
/** Destructor. */
virtual ~Mesh ();
/**
* The positions array.
* Positions can be stored as float or double values.
* Positions have always a stride of three (X, Y and Z parameter). So we don't need to
* store this information.
*/
const MeshVertexData& getPositions () const { return mPositions; }
/**
* The positions array.
* Positions can be stored as float or double values.
* Positions have always a stride of three (X, Y and Z parameter). So we don't need to
* store this information.
*/
MeshVertexData& getPositions () { return mPositions; }
/**
* The positions array.
* Positions can be stored as float or double values.
* Positions have always a stride of three (X, Y and Z parameter). So we don't need to
* store this information.
*/
// void setPositions ( MeshVertexData& positions ) { mPositions = positions; }
/**
* The normals array.
* Normals can be stored as float or double values.
* Normals have always a stride of three (X, Y and Z parameter). We don't need to store
* this information.
*/
const MeshVertexData& getNormals () const { return mNormals; }
/**
* The normals array.
* Normals can be stored as float or double values.
* Normals have always a stride of three (X, Y and Z parameter). We don't need to store
* this information.
*/
MeshVertexData& getNormals () { return mNormals; }
/**
* The normals array.
* Normals can be stored as float or double values.
* Normals have always a stride of three (X, Y and Z parameter). We don't need to store
* this information.
*/
// void setNormals ( MeshVertexData& Normals ) { mNormals = Normals; }
/**
* Checks, if the mesh has normals.
*/
bool hasNormals ( )const;
/*
* Counts the number of all normals in the current mesh. This is the sum of the number of
* normals of all primitive elements into the mesh object.
*/
const size_t getNormalsCount () const;
/**
* The colors array.
* Colors can be stored as float or double values.
* Colors have always a stride of three (X, Y and Z parameter). We don't need to store
* this information.
*/
const MeshVertexData& getColors () const { return mColors; }
/**
* The colors array.
* Colors can be stored as float or double values.
* Colors have always a stride of three (X, Y and Z parameter). We don't need to store
* this information.
*/
MeshVertexData& getColors () { return mColors; }
/**
* Returns the color with the name.
*/
size_t getColorIndexByName ( const String& name ) const
{
String currentName;
for ( size_t index=0; index<mColors.getValuesCount (); ++index )
{
if ( COLLADABU::Utils::equals ( name, mColors.getName ( index ) ) )
return index;
}
// std::cerr << "No color with name \"" << name << "\"!" << std::endl;
COLLADABU_ASSERT ( COLLADABU::Utils::equals ( name, name ) );
return 0;
}
/**
* The colors array.
* Colors can be stored as float or double values.
* Colors have always a stride of three (X, Y and Z parameter). We don't need to store
* this information.
*/
// void setColors ( MeshVertexData& Colors ) { mColors = Colors; }
/**
* The 2 dimensional uv coordinates array.
* UV coordinates can be stored as float or double values.
*/
const MeshVertexData& getUVCoords () const { return mUVCoords; }
/**
* The 2 dimensional uv coordinates array.
* UV coordinates can be stored as float or double values.
*/
MeshVertexData& getUVCoords () { return mUVCoords; }
/**
* Returns the uv set with the name.
*/
size_t getUVSetIndexByName ( const String& name ) const
{
for ( size_t index=0; index<mUVCoords.getValuesCount (); ++index )
{
if ( COLLADABU::Utils::equals ( name, mUVCoords.getName ( index ) ) )
return index;
}
// std::cerr << "No uv set with name \"" << name << "\"!" << std::endl;
COLLADABU_ASSERT ( true );
return 0;
}
/**
* The 3 dimensional tangent coordinates array.
* Tangent coordinates can be stored as float or double values.
*/
const MeshVertexData& getTangents () const { return mTangents; }
/**
* The 3 dimensional tangent coordinates array.
* Tangent coordinates can be stored as float or double values.
*/
MeshVertexData& getTangents () { return mTangents; }
/**
* The 3 dimensional binormal coordinates array.
* Binormal coordinates can be stored as float or double values.
*/
const MeshVertexData& getBinormals () const { return mBinormals; }
/**
* The 3 dimensional binormal coordinates array.
* Binormal coordinates can be stored as float or double values.
*/
MeshVertexData& getBinormals () { return mBinormals; }
/**
* Geometric primitives, which assemble values from the inputs into vertex attribute data.
* Can be any combination of the following in any order:
* <lines>, <linestrips>, <polygons>, <polylist>, <triangles>, <trifans>, and <tristrips>
*/
MeshPrimitiveArray& getMeshPrimitives () { return mMeshPrimitives; }
/**
* Geometric primitives, which assemble values from the inputs into vertex attribute data.
* Can be any combination of the following in any order:
* <lines>, <linestrips>, <polygons>, <polylist>, <triangles>, <trifans>, and <tristrips>
*/
const MeshPrimitiveArray& getMeshPrimitives () const { return mMeshPrimitives; }
/**
* Geometric primitives, which assemble values from the inputs into vertex attribute data.
* Can be any combination of the following in any order:
* <lines>, <linestrips>, <polygons>, <polylist>, <triangles>, <trifans>, and <tristrips>
*/
void setMeshPrimitives ( const MeshPrimitiveArray& primitiveElements ) { mMeshPrimitives = primitiveElements; }
/**
* Geometric primitives, which assemble values from the inputs into vertex attribute data.
* Can be any combination of the following in any order:
* <lines>, <linestrips>, <polygons>, <polylist>, <triangles>, <trifans>, and <tristrips>
*/
MeshPrimitive* appendPrimitive ( MeshPrimitive* primitiveElement )
{ return mMeshPrimitives.append ( primitiveElement ); }
/** Counts the number of all triangles in all Triangle primitives.*/
size_t getTrianglesTriangleCount();
/** Counts the number of all triangles in all Tristrips primitives. This is the number
of triangles one get, if the tristrips are converted to triagles.*/
size_t getTristripsTriangleCount();
/** Counts the number of all triangles in all Trifans primitives. This is the number
of triangles one get, if the tristrips are converted to triagles.*/
size_t getTrifansTriangleCount();
/** Counts the number of all polygons in all polygons primitives.*/
size_t getPolygonsPolygonCount();
size_t getPolylistPolygonCount();
/** Counts the number of all primitives in all primitives of type @a primitiveType.
@note For Triangles, polygons this is the number of faces (The primitives are faces). For
Tristrips and Trisfans this the number of strips and fans (The primitives are not faces).*/
size_t getPrimitiveCount(MeshPrimitive::PrimitiveType primitiveType);
/** Counts the number of all primitives in all primitives of type @a primitiveType.
@note For Triangles, polygons this is the number of primitives (The primitive are faces).
For Tristrips and Trisfans this the number of triangles the strips an fans consist of
(The primitives are not faces, but the triangles they consist of).*/
size_t getFaceCount(MeshPrimitive::PrimitiveType primitiveType);
/** Counts the number of all tristrips in all Tristrip primitives.
TODO not implemented */
size_t getTristripsTristripCount();
/** Counts the number of all trifans in all Trifans primitives.
TODO not implemented */
size_t getTrifansTrifanCount();
/** Counts the number of all Triangle primitives.*/
size_t getTrianglesCount();
/** Counts the number of all Tristrips primitives.*/
size_t getTristripsCount();
/** Counts the number of all Trifans primitives.*/
size_t getTrifansCount();
/** Counts the number of all Polygons primitives.*/
size_t getPolygonsCount();
/** Counts the number of all mesh primitives of type @a primitiveType in the mesh, i.e.
it counts the number of primitives of type @a primitiveType in mMeshPrimitives.*/
size_t getMeshPrimitiveCount(MeshPrimitive::PrimitiveType primitiveType);
/*
* Counts the number of all faces in all primitive elements in the current mesh.
*/
const size_t getFacesCount () const;
};
}
#endif // __COLLADA_MESH_H__
|