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

« back to all changes in this revision

Viewing changes to COLLADAFramework/include/COLLADAFWSkinControllerData.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 COLLADAFramework.
 
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 __COLLADAFW_SKINCONTROLLERDATA_H__
 
12
#define __COLLADAFW_SKINCONTROLLERDATA_H__
 
13
 
 
14
#include "COLLADAFWPrerequisites.h"
 
15
#include "COLLADAFWObject.h"
 
16
#include "COLLADAFWTypes.h"
 
17
#include "COLLADAFWUniqueId.h"
 
18
#include "COLLADAFWFloatOrDoubleArray.h"
 
19
 
 
20
#include "Math/COLLADABUMathMatrix4.h"
 
21
 
 
22
 
 
23
namespace COLLADAFW
 
24
{
 
25
 
 
26
    /** Holds the data of a skin controller, i.e. the weights per vertex per joint */
 
27
        class SkinControllerData : public ObjectTemplate<COLLADA_TYPE::SKIN_DATA>
 
28
        {
 
29
        private:
 
30
 
 
31
        /**
 
32
        * The original object id, if it in the original file format exist. 
 
33
        */
 
34
        String mOriginalId;
 
35
 
 
36
        /** The name of the skin controller.*/
 
37
        String mName;
 
38
 
 
39
                /** The number of joints this controller can use.*/
 
40
                size_t mJointsCount;
 
41
 
 
42
                /** Provides extra information about the position and orientation of the base mesh before binding.*/
 
43
                COLLADABU::Math::Matrix4 mBindShapeMatrix;
 
44
 
 
45
                /** Array of the inverse bind matrices. One for each joint.*/
 
46
                Matrix4Array mInverseBindMatrices;
 
47
 
 
48
                /** The weights of the skin controller. */
 
49
                FloatOrDoubleArray mWeights;
 
50
 
 
51
                /** Defines how many joints are connected to a vertex. The length must be equal to mVertexCount.
 
52
                The i'th index corresponds to the i'th vertex of the source.*/
 
53
                UIntValuesArray mJointsPerVertex;
 
54
 
 
55
                /** Indices of weights assigned to a joint/vertex pair. The number of pairs for the i'th vertex is 
 
56
                given by the i'th value in mJointsPerVertex.*/
 
57
                UIntValuesArray mWeightIndices;
 
58
 
 
59
                /** Indices of joints assigned to a joint/vertex pair. The number of pairs for the i'th vertex is 
 
60
                given by the i'th value in mJointsPerVertex.*/
 
61
                IntValuesArray mJointIndices;
 
62
 
 
63
        public:
 
64
 
 
65
        /** Constructor. */
 
66
                SkinControllerData( const UniqueId& uniqueId );
 
67
 
 
68
        /** Destructor. */
 
69
                virtual ~SkinControllerData();
 
70
 
 
71
        /**
 
72
        * The original object id, if it in the original file format exist. 
 
73
        */
 
74
        const String& getOriginalId () const { return mOriginalId; }
 
75
 
 
76
        /**
 
77
        * The original object id, if it in the original file format exist. 
 
78
        */
 
79
        void setOriginalId ( const String& val ) { mOriginalId = val; }
 
80
 
 
81
        /** Returns name of the controller.*/
 
82
        const String& getName() const { return mName; }
 
83
 
 
84
        /** Sets name of the controller.*/
 
85
        void setName(const String& name) { mName = name; }
 
86
 
 
87
                /** Provides extra information about the position and orientation of the base mesh before binding.*/
 
88
                const COLLADABU::Math::Matrix4& getBindShapeMatrix() const { return mBindShapeMatrix; }
 
89
 
 
90
                /** Provides extra information about the position and orientation of the base mesh before binding.*/
 
91
                void setBindShapeMatrix( const COLLADABU::Math::Matrix4& bindShapeMatrix) { mBindShapeMatrix = bindShapeMatrix; }
 
92
 
 
93
                /** Array of the inverse bind matrices. One for each joint.*/
 
94
                Matrix4Array& getInverseBindMatrices() { return mInverseBindMatrices; }
 
95
 
 
96
                /** Array of the inverse bind matrices. One for each joint.*/
 
97
                const Matrix4Array& getInverseBindMatrices() const { return mInverseBindMatrices; }
 
98
 
 
99
                /** Returns the number of joints this controller can use.*/
 
100
                size_t getJointsCount() const { return mJointsCount; }
 
101
 
 
102
                /** Sets the number of joints this controller can use.*/
 
103
                void setJointsCount(size_t jointsCount) { mJointsCount = jointsCount; }
 
104
 
 
105
                /** Returns the number of vertices of the mesh modified by this controller.*/
 
106
                size_t getVertexCount() const { return mJointsPerVertex.getCount(); }
 
107
 
 
108
                /** Returns the weights of the skin controller. */
 
109
                const FloatOrDoubleArray& getWeights() const { return mWeights; }
 
110
                FloatOrDoubleArray& getWeights() { return mWeights; }
 
111
 
 
112
                /** Returns the array defining how many joints are connected to a vertex. The length must be equal to mVertexCount.
 
113
                The i'th index corresponds to the i'th vertex of the source.*/
 
114
                const UIntValuesArray& getJointsPerVertex() const { return mJointsPerVertex; }
 
115
                UIntValuesArray& getJointsPerVertex() { return mJointsPerVertex; }
 
116
 
 
117
                /** Returns the indices of weights assigned to a joint/vertex pair. The number of pairs for the i'th vertex is 
 
118
                given by the i'th value in mJointsPerVertex.*/
 
119
                const UIntValuesArray& getWeightIndices() const { return mWeightIndices; }
 
120
                UIntValuesArray& getWeightIndices() { return mWeightIndices; }
 
121
 
 
122
                /** Returns the indices of joints assigned to a joint/vertex pair. The number of pairs for the i'th vertex is 
 
123
                given by the i'th value in mJointsPerVertex.*/
 
124
                const IntValuesArray& getJointIndices() const { return mJointIndices; }
 
125
                IntValuesArray& getJointIndices() { return mJointIndices; }
 
126
 
 
127
        private:
 
128
 
 
129
        /** Disable default copy ctor. */
 
130
                SkinControllerData( const SkinControllerData& pre );
 
131
 
 
132
        /** Disable default assignment operator. */
 
133
                const SkinControllerData& operator= ( const SkinControllerData& pre );
 
134
 
 
135
        };
 
136
 
 
137
} // namespace COLLADAFW
 
138
 
 
139
#endif // __COLLADAFW_SKINCONTROLLERDATA_H__