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

« back to all changes in this revision

Viewing changes to COLLADAMax/include/COLLADAMaxExtra.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 COLLADAMax.
 
5
 
 
6
    Portions of the code are:
 
7
    Copyright (c) 2005-2007 Feeling Software Inc.
 
8
    Copyright (c) 2005-2007 Sony Computer Entertainment America
 
9
    
 
10
    Based on the 3dsMax COLLADASW Tools:
 
11
    Copyright (c) 2005-2006 Autodesk Media Entertainment
 
12
        
 
13
    Licensed under the MIT Open Source License, 
 
14
    for details please see LICENSE file or the website
 
15
    http://www.opensource.org/licenses/mit-license.php
 
16
*/
 
17
 
 
18
 
 
19
#ifndef __COLLADAMAX_EXTRA_H__
 
20
#define __COLLADAMAX_EXTRA_H__
 
21
 
 
22
#include "COLLADAMaxPrerequisites.h"
 
23
 
 
24
#include "COLLADASWStreamWriter.h"
 
25
#include "COLLADASWExtraTechnique.h"
 
26
#include "COLLADASWExtra.h"
 
27
 
 
28
 
 
29
class Object;
 
30
 
 
31
namespace COLLADAMax
 
32
{
 
33
 
 
34
        class DocumentExporter;
 
35
        class AnimationExporter;
 
36
        class Options;
 
37
 
 
38
        /** Base class to export extra tags in max.*/
 
39
    class Extra //: public COLLADASW::BaseExtraTechnique
 
40
    {
 
41
 
 
42
        protected:
 
43
 
 
44
                struct ExtraParameter
 
45
                {
 
46
                        /** Type of the parameter. One of the max types TYPE_FLOAT, TYPE_INT, TYPE_BOOL.*/
 
47
                        int type;
 
48
                        /** The id of the option to retrieve from the param block.*/
 
49
                        int paramId;
 
50
                        /** The name of the parameter, which is equals the elements name in the extra tag.*/
 
51
                        String paramName;
 
52
                };
 
53
 
 
54
 
 
55
    public:
 
56
                /** The technique profile name use for max specific extra data.*/
 
57
                static const String TECHNIQUE_PROFILE_3DSMAX;
 
58
 
 
59
                /** The technique profile name used for general extra data.*/
 
60
                static const String TECHNIQUE_PROFILE_OPENCOLLADA;
 
61
 
 
62
                /** The element name of the element to store user defined properties.*/
 
63
                static const String USERDEFINED_PROPERTIES;
 
64
 
 
65
                /** The element name of the element to store user 'Cast Shadows' object's property.*/
 
66
                static const String CAST_SHADOWS_PROPERTY;
 
67
 
 
68
                /** The element name of the element to store user 'Receive Shadows' object's property.*/
 
69
                static const String RECEIVE_SHADOWS_PROPERTY;
 
70
 
 
71
                /** The on/off state of the primary visibility to determine whether or not the node is 
 
72
                visible to the camera. */
 
73
                static const String PRIMARY_VISIBILITY_PROPERTY;
 
74
 
 
75
                /** The on/off state of the secondary visibility to determine whether or not the node is
 
76
                visible to reflections and refractions. */
 
77
                static const String SECONDARY_VISIBILITY_PROPERTY;
 
78
 
 
79
    private:
 
80
                COLLADASW::StreamWriter* mSW;
 
81
                AnimationExporter * mAnimationExporter;
 
82
                const Options& mOptions;
 
83
 
 
84
                /** The extra technique to fill.*/
 
85
                COLLADASW::BaseExtraTechnique* mExtraTechnique;
 
86
 
 
87
    public:
 
88
        /** Constructor
 
89
         @param streamWriter the stream the extra tags should be written to.*/
 
90
        Extra ( COLLADASW::StreamWriter * streamWriter, DocumentExporter * documentExporter  );
 
91
 
 
92
        /** Destructor*/
 
93
        virtual ~Extra()
 
94
        {}
 
95
 
 
96
 
 
97
    protected:
 
98
 
 
99
                /** Sets the extra technique to fill.*/
 
100
                void setExtraTechnique( COLLADASW::BaseExtraTechnique* extraTechnique) { mExtraTechnique = extraTechnique; }
 
101
 
 
102
                /** Adds a parameter with name @a paramName, value @a value and optional sid @a paramSid to the list 
 
103
                of parameters in the max profile.*/
 
104
                template<class ValueType> 
 
105
                void addExtraParameter ( const String& paramName, const ValueType &value, const String &paramSid="" )
 
106
                {
 
107
                        mExtraTechnique->addExtraTechniqueParameter (TECHNIQUE_PROFILE_3DSMAX , paramName, value, paramSid );
 
108
                }
 
109
 
 
110
 
 
111
                /** Adds a parameter with name @a paramName, value @a value and optional sid @a paramSid to the list 
 
112
                of parameters in the max profile.*/
 
113
                template<class ValueType> 
 
114
                void addExtraChildParameter ( const String& childName, const String& paramName, const ValueType &value, const String &paramSid="" )
 
115
                {
 
116
                        mExtraTechnique->addExtraTechniqueChildParameter (TECHNIQUE_PROFILE_3DSMAX, childName, paramName, value, paramSid );
 
117
                }
 
118
 
 
119
 
 
120
                /** Adds an animatable parameter to the list of parameters in the max profile.
 
121
                @param parameterName Name of the parameter element. If the parameter is animated, this is also used as sid.
 
122
                @param childName The name of the element (child element of the technique element) this parameter should be added to.
 
123
                @param parameters The IParamBlock2  that hold all the parameter.
 
124
                @param parameterIndex The index of the parameter in the IParamBlock2.
 
125
                @param baseId The id of element this extra tag is written to. It is used to reference the parameter and to generate 
 
126
                ids for the animation.*/
 
127
                void addAnimatedExtraParameter(const String & parameterName, const String& childName, IParamBlock2* parameters, int parameterIndex, const String& baseId);
 
128
 
 
129
                /** Adds an animatable parameter to the list of parameters in the max profile.
 
130
                @param parameterName Name of the parameter element. If the parameter is animated, this is also used as sid.
 
131
                @param childName The name of the element (child element of the technique element) this parameter should be added to.
 
132
                @param parameters The IParamBlock  that hold all the parameter.
 
133
                @param parameterIndex The index of the parameter in the IParamBlock.
 
134
                @param baseId The id of element this extra tag is written to. It is used to reference the parameter and to generate 
 
135
                ids for the animation.*/
 
136
                void addAnimatedExtraParameter(const String & parameterName, const String& childName, IParamBlock* parameters, int parameterIndex, const String& baseId);
 
137
 
 
138
                /** Adds animatable parameters, contained in an IParamBlock, to the max profile of the extra tag. The names of the 
 
139
                parameters and and there ids in the IParamBlock must be specified in an array of ExtraParameters.
 
140
                @param childElementName The name of the element (child element of the technique element) this parameter should be added to.
 
141
                @param extraParameters Pointer to the array of ExtraParameters that hold information for each parameter.
 
142
                @param extraParametersCount Number of elements in extraParameters.
 
143
                @param paramBlock The IParamBlock  that hold all the parameter.
 
144
                @param baseId The id of element this extra tag is written to. It is used to reference the parameter and to generate 
 
145
                ids for the animation.*/
 
146
                void addParamBlockAnimatedExtraParameters ( const String & childElementName, const ExtraParameter extraParameters[], int extraParametersCount, IParamBlock * paramBlock, const String& baseId );
 
147
 
 
148
                /** Adds animatable parameters, contained in an IParamBlock2, to the max profile of the extra tag. The names of the 
 
149
                parameters and and there ids in the IParamBlock2 must be specified in an array of ExtraParameters.
 
150
                @param childElementName The name of the element (child element of the technique element) this parameter should be added to.
 
151
                @param extraParameters Pointer to the array of ExtraParameters that hold information for each parameter.
 
152
                @param extraParametersCount Number of elements in extraParameters.
 
153
                @param paramBlock The IParamBlock2  that hold all the parameter.
 
154
                @param baseId The id of element this extra tag is written to. It is used to reference the parameter and to generate 
 
155
                ids for the animation.*/
 
156
                void addParamBlockAnimatedExtraParameters ( const String & childElementName, const ExtraParameter extraParameters[], int extraParametersCount, IParamBlock2 * paramBlock, const String& baseId );
 
157
 
 
158
                /** Writes all information of the IParamBlock2 @a parameters to the file @a fileName. For development purposes
 
159
                only.
 
160
                sample usage: if ( extendedParameters ) writeParameterBlockInfo("c:\\temp\\paramters.txt", extendedParameters);
 
161
                */
 
162
                void writeParameterBlockInfo(const String& fileName, IParamBlock2* parameters);
 
163
                void writeParameterBlockInfo(const String& fileName, IParamBlock* parameters);
 
164
 
 
165
    };
 
166
 
 
167
 
 
168
}
 
169
 
 
170
 
 
171
#endif //__COLLADAMAX_EXTRA_H__
 
172