2
Copyright (c) 2008-2009 NetAllied Systems GmbH
4
This file is part of COLLADAMax.
6
Portions of the code are:
7
Copyright (c) 2005-2007 Feeling Software Inc.
8
Copyright (c) 2005-2007 Sony Computer Entertainment America
10
Based on the 3dsMax COLLADASW Tools:
11
Copyright (c) 2005-2006 Autodesk Media Entertainment
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
19
#ifndef __COLLADAMAX_EXTRA_H__
20
#define __COLLADAMAX_EXTRA_H__
22
#include "COLLADAMaxPrerequisites.h"
24
#include "COLLADASWStreamWriter.h"
25
#include "COLLADASWExtraTechnique.h"
26
#include "COLLADASWExtra.h"
34
class DocumentExporter;
35
class AnimationExporter;
38
/** Base class to export extra tags in max.*/
39
class Extra //: public COLLADASW::BaseExtraTechnique
46
/** Type of the parameter. One of the max types TYPE_FLOAT, TYPE_INT, TYPE_BOOL.*/
48
/** The id of the option to retrieve from the param block.*/
50
/** The name of the parameter, which is equals the elements name in the extra tag.*/
56
/** The technique profile name use for max specific extra data.*/
57
static const String TECHNIQUE_PROFILE_3DSMAX;
59
/** The technique profile name used for general extra data.*/
60
static const String TECHNIQUE_PROFILE_OPENCOLLADA;
62
/** The element name of the element to store user defined properties.*/
63
static const String USERDEFINED_PROPERTIES;
65
/** The element name of the element to store user 'Cast Shadows' object's property.*/
66
static const String CAST_SHADOWS_PROPERTY;
68
/** The element name of the element to store user 'Receive Shadows' object's property.*/
69
static const String RECEIVE_SHADOWS_PROPERTY;
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;
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;
80
COLLADASW::StreamWriter* mSW;
81
AnimationExporter * mAnimationExporter;
82
const Options& mOptions;
84
/** The extra technique to fill.*/
85
COLLADASW::BaseExtraTechnique* mExtraTechnique;
89
@param streamWriter the stream the extra tags should be written to.*/
90
Extra ( COLLADASW::StreamWriter * streamWriter, DocumentExporter * documentExporter );
99
/** Sets the extra technique to fill.*/
100
void setExtraTechnique( COLLADASW::BaseExtraTechnique* extraTechnique) { mExtraTechnique = extraTechnique; }
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 ¶mSid="" )
107
mExtraTechnique->addExtraTechniqueParameter (TECHNIQUE_PROFILE_3DSMAX , paramName, value, paramSid );
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 ¶mSid="" )
116
mExtraTechnique->addExtraTechniqueChildParameter (TECHNIQUE_PROFILE_3DSMAX, childName, paramName, value, paramSid );
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);
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);
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 );
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 );
158
/** Writes all information of the IParamBlock2 @a parameters to the file @a fileName. For development purposes
160
sample usage: if ( extendedParameters ) writeParameterBlockInfo("c:\\temp\\paramters.txt", extendedParameters);
162
void writeParameterBlockInfo(const String& fileName, IParamBlock2* parameters);
163
void writeParameterBlockInfo(const String& fileName, IParamBlock* parameters);
171
#endif //__COLLADAMAX_EXTRA_H__