2
Copyright (c) 2008-2009 NetAllied Systems GmbH
4
This file is part of COLLADASaxFrameworkLoader.
6
Licensed under the MIT Open Source License,
7
for details please see LICENSE file or the website
8
http://www.opensource.org/licenses/mit-license.php
11
#ifndef __COLLADASAXFWL_PRIMITIVE_BASE_H__
12
#define __COLLADASAXFWL_PRIMITIVE_BASE_H__
14
#include "COLLADASaxFWLPrerequisites.h"
17
#include "COLLADAFWTypes.h"
20
namespace COLLADASaxFWL
24
* Base class for the primitives. This are the p and h elements.
25
* The indices in a <p> ("primitive") (or <h>) element refer to different inputs depending on
26
* their order. The first index in a <p> element refers to all inputs with an offset of 0. The
27
* second index refers to all inputs with an offset of 1. Each vertex of the polygon is made
28
* up of one index into each input. After each input is used, the next index again refers to
29
* the inputs with offset of 0 and begins a new vertex.
30
* The winding order of vertices produced is counter-clockwise and describes the front side of
31
* each polygon. If the primitives are assembled without vertex normals then the application
32
* may generate per-primitive normals to enable lighting.
40
* Contains a list of unsigned ints that specifies the vertex attributes (indices) for an
41
* individual polygon or for a hole in a polygon.
43
COLLADAFW::UIntValuesArray mUIntValuesArray;
46
* The face index of the current primitive indices.
56
virtual ~PrimitiveBase () {}
59
* Contains a list of unsigned ints that specifies the vertex attributes (indices) for an
60
* individual polygon or for a hole in a polygon.
61
* @return const PrimitiveBase::ValuesArray& Reference to the values array.
63
const COLLADAFW::UIntValuesArray& getUIntValuesArray () const
65
return mUIntValuesArray;
69
* Contains a list of unsigned ints that specifies the vertex attributes (indices) for an
70
* individual polygon or for a hole in a polygon.
71
* @param valuesArraySize The size parameter of the returned array.
72
* @return const PrimitiveBase::ValuesArray& Reference to the values array.
74
COLLADAFW::UIntValuesArray& getUIntValuesArray ()
76
return mUIntValuesArray;
80
* Contains a list of unsigned ints that specifies the vertex attributes (indices) for an
81
* individual polygon or for a hole in a polygon.
82
* @param valuesArray Reference to the values array.
83
* @param valuesArraySize The size parameter of the values array.
84
* @param The current face index.
86
void setUIntValuesArray (
87
const COLLADAFW::UIntValuesArray& valuesArray,
88
const size_t faceIndex )
90
mUIntValuesArray = valuesArray;
91
mFaceIndex = faceIndex;
95
* Get the face index of the current primitive indices.
96
* @return The const value of the current face index.
98
size_t getFaceIndex () { return mFaceIndex; }
101
* Get the face index of the current primitive indices.
102
* @return The current face index.
104
const size_t getFaceIndex () const { return mFaceIndex; }
107
* Set the face index of the current primitive indices.
108
* @param The current face index.
110
void setFaceIndex ( const size_t faceIndex ) { mFaceIndex = faceIndex; }
116
* The p element for the polygon vertex attribute indices.
118
typedef COLLADAFW::UIntValuesArray PElement;
119
typedef COLLADAFW::ArrayPrimitiveType<PElement*> PArray;
122
* The h element for the polygons hole vertex attribute indices.
124
typedef COLLADAFW::UIntValuesArray HElement;
125
typedef COLLADAFW::ArrayPrimitiveType<HElement*> HArray;
129
#endif // __COLLADASAXFWL_PRIMITIVE_BASE_H__