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_INPUTLIST_H__
12
#define __COLLADASAXFWL_INPUTLIST_H__
14
#include "COLLADASaxFWLPrimitiveBase.h"
15
#include "COLLADASaxFWLInputShared.h"
17
#include "COLLADAFWMeshPrimitive.h"
20
namespace COLLADASaxFWL
28
Geometric primitives, which assemble values from the inputs into vertex attribute data.
29
Can be any combination of any primitive types in any order.
31
To describe geometric primitives that are formed from the vertex data, the <mesh> element may
32
contain zero or more of the primitive elements <lines>, <linestrips>, <polygons>, <polylist>,
33
<triangles>, <trifans>, and <tristrips>.
34
The <vertices> element under <mesh> is used to describe mesh-vertices. Polygons, triangles, and
35
so forth index mesh-vertices, not positions directly. Mesh-vertices must have at least one
36
<input> (unshared) element with a semantic attribute whose value is POSITION.
37
For texture coordinates, COLLADA�s right-handed coordinate system applies; therefore, an ST
38
texture coordinate of [0,0] maps to the lower-left texel of a texture image, when loaded in a
39
professional 2-D texture viewer/editor.
41
class MeshPrimitiveInputList
46
* The input element may occur any number of times. This input is a local
47
* input with the offset and set attributes.
49
InputSharedArray mInputArray;
52
* The maximal offset value in the input element.
54
unsigned long long mInputArrayMaxOffset;
57
* To convert the vertex input elements.
66
MeshPrimitiveInputList ( Vertices& vertices )
67
: mInputArray(InputSharedArray::OWNER)
68
, mInputArrayMaxOffset (0)
75
virtual ~MeshPrimitiveInputList()
80
/** Clears the inputs related contents but keeps the vertices.*/
84
* The input element may occur any number of times. This input is a
85
* local input with the offset and set attributes.
86
* @return const InputArray The array with the input elements.
88
const InputSharedArray& getInputArray () const
94
* Appends an input element in the list of input elements.
95
* Handle with care, new memory will be allocated!
97
const InputShared* appendInputElement ( InputShared* inputShared );
100
* The input element may occur any number of times. This input is a
101
* local input with the offset and set attributes.
102
* @return const InputArray The array with the input elements.
104
const unsigned long long getInputArrayMaxOffset () const
106
return mInputArrayMaxOffset;
111
* Returns the input element with the given semantic or 0 if it not exist.
112
* @param semantic The semantic of the searched input element.
113
* @param parent True, if the vertex element of the parent mesh should also searched.
114
* @return InputShared* Pointer to the searched input element or 0 if it not exist.
116
const InputShared* getInputBySemantic ( const InputSemantic::Semantic& semantic ) const;
119
* Returns the positions input element or 0 if it not exist.
120
* @param parent True, if the vertex element of the parent mesh should also searched.
121
* @return InputShared* Pointer to the searched input element or 0 if it not exist.
123
const InputShared* getPositionInput () const
125
return getInputBySemantic ( InputSemantic::POSITION );
129
* Returns the normals input element or 0 if it not exist.
130
* @param parent True, if the vertex element of the parent mesh should also searched.
131
* @return InputShared* Pointer to the searched input element or 0 if it not exist.
133
const InputShared* getNormalInput () const
135
return getInputBySemantic ( InputSemantic::NORMAL );
138
const InputShared* getTangentInput () const
140
return getInputBySemantic ( InputSemantic::TEXTANGENT );
143
const InputShared* getBinormalInput () const
145
return getInputBySemantic ( InputSemantic::TEXBINORMAL );
151
typedef COLLADAFW::ArrayPrimitiveType<MeshPrimitiveInputList*> PolyBaseArray;
155
#endif // __COLLADASAXFWL_INPUTLIST_H__