~ubuntu-branches/ubuntu/wily/opencollada/wily-proposed

« back to all changes in this revision

Viewing changes to COLLADASaxFrameworkLoader/include/COLLADASaxFWLPrimitiveBase.h

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2015-05-14 17:23:27 UTC
  • Revision ID: package-import@ubuntu.com-20150514172327-f862u8envms01fra
Tags: upstream-0.1.0~20140703.ddf8f47+dfsg1
ImportĀ upstreamĀ versionĀ 0.1.0~20140703.ddf8f47+dfsg1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    Copyright (c) 2008-2009 NetAllied Systems GmbH
 
3
 
 
4
    This file is part of COLLADASaxFrameworkLoader.
 
5
 
 
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
 
9
*/
 
10
 
 
11
#ifndef __COLLADASAXFWL_PRIMITIVE_BASE_H__
 
12
#define __COLLADASAXFWL_PRIMITIVE_BASE_H__
 
13
 
 
14
#include "COLLADASaxFWLPrerequisites.h"
 
15
 
 
16
// TODO
 
17
#include "COLLADAFWTypes.h"
 
18
 
 
19
 
 
20
namespace COLLADASaxFWL
 
21
{
 
22
 
 
23
    /** 
 
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.
 
33
     */
 
34
    class PrimitiveBase
 
35
    {
 
36
 
 
37
    private:
 
38
 
 
39
        /**
 
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.
 
42
         */
 
43
        COLLADAFW::UIntValuesArray mUIntValuesArray;
 
44
 
 
45
        /**
 
46
         * The face index of the current primitive indices. 
 
47
         */
 
48
        size_t mFaceIndex;
 
49
 
 
50
    public:
 
51
 
 
52
        /** Constructor. */
 
53
        PrimitiveBase () {}
 
54
 
 
55
        /** Destructor. */
 
56
        virtual ~PrimitiveBase () {}
 
57
 
 
58
        /**
 
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.
 
62
         */
 
63
        const COLLADAFW::UIntValuesArray& getUIntValuesArray () const 
 
64
        { 
 
65
            return mUIntValuesArray; 
 
66
        }
 
67
 
 
68
        /**
 
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.
 
73
         */
 
74
        COLLADAFW::UIntValuesArray& getUIntValuesArray () 
 
75
        { 
 
76
            return mUIntValuesArray; 
 
77
        }
 
78
 
 
79
        /**
 
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.
 
85
         */
 
86
        void setUIntValuesArray ( 
 
87
            const COLLADAFW::UIntValuesArray& valuesArray, 
 
88
            const size_t faceIndex ) 
 
89
        {
 
90
            mUIntValuesArray = valuesArray; 
 
91
            mFaceIndex = faceIndex;
 
92
        }
 
93
 
 
94
        /**
 
95
         * Get the face index of the current primitive indices. 
 
96
         * @return The const value of the current face index.
 
97
         */
 
98
        size_t getFaceIndex () { return mFaceIndex; }
 
99
 
 
100
        /**
 
101
         * Get the face index of the current primitive indices. 
 
102
         * @return The current face index.
 
103
         */
 
104
        const size_t getFaceIndex () const { return mFaceIndex; }
 
105
 
 
106
        /**
 
107
         * Set the face index of the current primitive indices. 
 
108
         * @param The current face index.
 
109
         */
 
110
        void setFaceIndex ( const size_t faceIndex ) { mFaceIndex = faceIndex; }
 
111
 
 
112
    };
 
113
 
 
114
 
 
115
    /**
 
116
     * The p element for the polygon vertex attribute indices.
 
117
     */
 
118
    typedef COLLADAFW::UIntValuesArray PElement;
 
119
    typedef COLLADAFW::ArrayPrimitiveType<PElement*> PArray;
 
120
 
 
121
    /**
 
122
    * The h element for the polygons hole vertex attribute indices.
 
123
    */
 
124
    typedef COLLADAFW::UIntValuesArray HElement;
 
125
    typedef COLLADAFW::ArrayPrimitiveType<HElement*> HArray;
 
126
 
 
127
}
 
128
 
 
129
#endif // __COLLADASAXFWL_PRIMITIVE_BASE_H__