70 if ( p_type ==
moText(
"ALPHA") ) {
73 if ( p_type ==
moText(
"COLOR") ) {
76 if ( p_type ==
moText(
"BLENDING") ) {
79 if ( p_type ==
moText(
"POLYGONMODE") ) {
82 if ( p_type ==
moText(
"SYNC") ) {
85 if ( p_type ==
moText(
"PHASE") ) {
88 if ( p_type ==
moText(
"TEXT") ) {
91 if ( p_type ==
moText(
"TEXTURE") ) {
94 if ( p_type ==
moText(
"TEXTUREFOLDER") ) {
97 if ( p_type ==
moText(
"FONT") ) {
100 if ( p_type ==
moText(
"3DMODEL") ) {
103 if ( p_type ==
moText(
"MOLDEOOBJECT") ) {
106 if ( p_type ==
moText(
"OBJECT") ) {
109 if ( p_type ==
moText(
"VIDEO") ) {
112 if ( p_type ==
moText(
"FILTER") ) {
115 if ( p_type ==
moText(
"SOUND") ) {
118 if ( p_type ==
moText(
"NUM") ) {
121 if ( p_type ==
moText(
"FUNCTION") ) {
124 if ( p_type ==
moText(
"TRANSLATEX") ) {
127 if ( p_type ==
moText(
"TRANSLATEY") ) {
130 if ( p_type ==
moText(
"TRANSLATEZ") ) {
133 if ( p_type ==
moText(
"SCALEX") ) {
136 if ( p_type ==
moText(
"SCALEY") ) {
139 if ( p_type ==
moText(
"SCALEZ") ) {
142 if ( p_type ==
moText(
"ROTATEX") ) {
145 if ( p_type ==
moText(
"ROTATEY") ) {
148 if ( p_type ==
moText(
"ROTATEZ") ) {
151 if ( p_type ==
moText(
"SCRIPT") ) {
154 if ( p_type ==
moText(
"COMPOSE") ) {
157 if ( p_type ==
moText(
"VECTOR") ) {
160 if ( p_type ==
moText(
"INLET") ) {
163 if ( p_type ==
moText(
"OUTLET") ) {
166 if ( p_type ==
moText(
"UNDEFINED") ) {
199 const moText& p_interpolation,
201 const moText& p_optionsstr ) {
205 m_Property = p_property;
208 bool valid_interpolation =
false;
209 if ( p_type ==
moText(
"ALPHA") ) {
211 valid_interpolation =
true;
213 if ( p_type ==
moText(
"COLOR") ) {
215 valid_interpolation =
false;
217 if ( p_type ==
moText(
"BLENDING") ) {
220 if ( p_type ==
moText(
"POLYGONMODE") ) {
223 if ( p_type ==
moText(
"SYNC") ) {
225 valid_interpolation =
true;
227 if ( p_type ==
moText(
"PHASE") ) {
229 valid_interpolation =
true;
231 if ( p_type ==
moText(
"TEXT") ) {
234 if ( p_type ==
moText(
"TEXTURE") ) {
237 if ( p_type ==
moText(
"TEXTUREFOLDER") ) {
240 if ( p_type ==
moText(
"FONT") ) {
243 if ( p_type ==
moText(
"3DMODEL") ) {
246 if ( p_type ==
moText(
"MOLDEOOBJECT") ) {
249 if ( p_type ==
moText(
"OBJECT") ) {
252 if ( p_type ==
moText(
"VIDEO") ) {
255 if ( p_type ==
moText(
"FILTER") ) {
258 if ( p_type ==
moText(
"SOUND") ) {
261 if ( p_type ==
moText(
"NUM") ) {
263 valid_interpolation =
true;
265 if ( p_type ==
moText(
"FUNCTION") ) {
267 valid_interpolation =
true;
269 if ( p_type ==
moText(
"TRANSLATEX") ) {
271 valid_interpolation =
true;
273 if ( p_type ==
moText(
"TRANSLATEY") ) {
275 valid_interpolation =
true;
277 if ( p_type ==
moText(
"TRANSLATEZ") ) {
279 valid_interpolation =
true;
281 if ( p_type ==
moText(
"SCALEX") ) {
283 valid_interpolation =
true;
285 if ( p_type ==
moText(
"SCALEY") ) {
287 valid_interpolation =
true;
289 if ( p_type ==
moText(
"SCALEZ") ) {
291 valid_interpolation =
true;
293 if ( p_type ==
moText(
"ROTATEX") ) {
295 valid_interpolation =
true;
297 if ( p_type ==
moText(
"ROTATEY") ) {
299 valid_interpolation =
true;
301 if ( p_type ==
moText(
"ROTATEZ") ) {
303 valid_interpolation =
true;
305 if ( p_type ==
moText(
"SCRIPT") ) {
308 if ( p_type ==
moText(
"COMPOSE") ) {
311 if ( p_type ==
moText(
"VECTOR") ) {
314 if ( p_type ==
moText(
"INLET") ) {
317 if ( p_type ==
moText(
"OUTLET") ) {
320 if ( p_type ==
moText(
"UNDEFINED") ) {
327 if (valid_interpolation) {
329 if ( p_interpolation ==
"linear" ) {
333 m_Interpolation = paraminter;
334 }
else if (p_interpolation==
moText(
"easeinoutquad") ) {
336 m_Interpolation = paraminter;
337 }
else if (p_interpolation==
moText(
"easeinoutsin") ) {
339 m_Interpolation = paraminter;
343 m_Interpolation = paraminter;
348 if ( p_optionsstr.
Length() > 0 ) {
349 m_OptionsStr = p_optionsstr;
359 const moText& p_interpolation,
361 const moTextArray& p_Options ) {
362 (*this) =
moParamDefinition(p_name,p_type,p_property,p_group,p_interpolation,p_duration);
363 m_Options = p_Options;
374 m_Index = src.m_Index;
375 m_DefaultValue = src.m_DefaultValue;
376 m_Interpolation = src.m_Interpolation;
377 m_Property = src.m_Property;
378 m_Group = src.m_Group;
379 m_OptionsStr = src.m_OptionsStr;
380 m_Options = src.m_Options;
389 return moText(
"UNDEFINED");
398 return moText(
"BLENDING");
401 return moText(
"POLYGONMODE");
416 return moText(
"TEXTUREFOLDER");
425 return moText(
"MOLDEOOBJECT");
437 return moText(
"FUNCTION");
440 return moText(
"TRANSLATEX");
443 return moText(
"TRANSLATEY");
446 return moText(
"TRANSLATEZ");
493 return moText(
"UNDEFINED");
500 m_Type = p_ParamType;
507 moValue Default = p_defaultvalue;
508 m_DefaultValue = p_defaultvalue;
523 m_DefaultValue =
moValue(
"",
"TXT" );
532 m_DefaultValue =
moValue(
"VARIABLE1",
"TXT",
"NUMERIC",
"TXT" );
536 m_DefaultValue =
moValue(
"",
"TXT",
"",
"TXT",
"",
"TXT" );
547 m_DefaultValue =
moValue(
"0.0",
"FUNCTION" ).
Ref();
555 m_DefaultValue =
moValue(
"1.0",
"FUNCTION" ).
Ref();
560 m_DefaultValue =
moValue(
"0",
"INT" );
563 m_DefaultValue =
moValue(
"1.0",
"FUNCTION",
"1.0",
"FUNCTION",
"1.0",
"FUNCTION",
"1.0",
"FUNCTION" );
566 m_DefaultValue =
moValue(
"composed by",
"TXT",
"1.0",
"FUNCTION",
"<nada></nada>",
"XML",
"12345",
"INT" );
569 m_DefaultValue =
moValue(
"1.0",
"FUNCTION",
"2.0",
"FUNCTION",
"3.0",
"FUNCTION",
"4.0",
"FUNCTION" );
572 m_DefaultValue =
moValue(
"0",
"NUM" );
587 m_Options = p_options;
590 for(
int i=0; i<(int)m_Options.Count(); i++ ) {
591 m_OptionsStr+= comma + m_Options[i];
598 m_OptionsStr = p_OptionsStr;
606 moText fieldseparation =
",";
609 m_FullJSON+=
"'name': '"+
GetName()+
"'";
610 m_FullJSON+= fieldseparation +
"'t': '"+
GetTypeStr()+
"'";
612 m_FullJSON+= fieldseparation +
"'pr': '"+
GetProperty()+
"'";
613 m_FullJSON+= fieldseparation +
"'gr': '"+
GetGroup()+
"'";
615 m_FullJSON+= fieldseparation +
"'op': [";
616 fieldseparation =
"";
617 for(
int i=0; i<(int)m_Options.Count(); i++ ) {
618 moText ostr( m_Options[ i ] );
624 m_FullJSON+= fieldseparation +
"'"+ostr+
"'";
625 fieldseparation =
",";
636 moText fieldseparation =
" ";
638 m_FullXML =
"<moParamDefinition ";
639 m_FullXML+=
"name='"+
GetName()+
"'";
640 m_FullXML+= fieldseparation +
"type='"+
GetTypeStr()+
"'";
642 m_FullXML+= fieldseparation +
"property='"+
GetProperty()+
"'";
643 m_FullXML+= fieldseparation +
"options='"+
GetOptionsStr()+
"'";
644 m_FullXML+= fieldseparation +
"group='"+
GetGroup()+
"'";
647 m_FullXML+=
"</moParamDefinition>";
654 TiXmlDocument m_XMLDoc;
656 TiXmlEncoding xencoding = TIXML_ENCODING_LEGACY;
658 m_XMLDoc.Parse((
const char*) p_XmlText, 0, xencoding );
661 TiXmlElement* definitionNode = m_XMLDoc.FirstChildElement(
"moParamDefinition");
666 if (definitionNode) {
667 m_Name =
moText( definitionNode->Attribute(
"name") );
669 m_Index = atoi(
moText( definitionNode->Attribute(
"index") ));
670 m_Property =
moText( definitionNode->Attribute(
"property") );
671 m_OptionsStr =
moText( definitionNode->Attribute(
"options") );
672 m_Group =
moText( definitionNode->Attribute(
"group") );
673 m_Interpolation.
SetInterpolation(
moText( definitionNode->Attribute(
"interpolation")),
moText( definitionNode->Attribute(
"duration")) );
701 m_bIsOn = src.m_bIsOn;
702 m_DataIn = src.m_DataIn;
703 m_DataOut = src.m_DataOut;
704 m_DataInterpolated = src.m_DataInterpolated;
706 m_Timer = (
moTimer&)src.m_Timer;
707 m_Duration = src.m_Duration;
708 m_Function = src.m_Function;
715 m_DataIn = p_data_in;
716 m_DataOut = p_data_out;
719 m_DataInterpolated = p_data_in;
725 m_ValueIn = p_value_in;
726 m_ValueOut = p_value_out;
729 m_ValueInterpolated = m_ValueIn;
735 m_Duration = p_fun_duration;
756 const moText& p_fun_duration,
757 const moText& p_fun_expression) {
758 if ( p_interpol_fun ==
"linear" ) {
761 }
else if (p_interpol_fun==
moText(
"ease") ) {
764 }
else if (p_interpol_fun==
moText(
"easein") ) {
767 }
else if (p_interpol_fun==
moText(
"easeout") ) {
770 }
else if (p_interpol_fun==
moText(
"easeinout") ) {
773 }
else if (p_interpol_fun==
moText(
"stepstart") ) {
776 }
else if (p_interpol_fun==
moText(
"stepend") ) {
779 }
else if (p_interpol_fun==
moText(
"expression") ) {
782 }
else if (p_interpol_fun==
moText(
"easeinoutquad") ) {
785 }
else if (p_interpol_fun==
moText(
"easeinoutsin") ) {
788 }
else if (p_interpol_fun==
moText(
"easeinoutcubic") ) {
817 return moText(
"easeinout");
820 return moText(
"cubicbezer");
823 return moText(
"easeinoutcubic");
826 return moText(
"stepstart");
832 return moText(
"easeinoutquad");
835 return moText(
"expression");
838 return moText(
"easeinoutsin");
850 const moText& p_fun_duration,
851 const moText& p_fun_expression) {
853 if (p_fun_expression!=
moText(
"")) {
854 cout <<
"p_fun_expression: " << p_fun_expression << endl;
857 if (p_fun_duration!=
"") {
859 mp_dur.
Init( p_fun_duration );
860 m_Duration = mp_dur.
Eval();
866 m_Function = p_interpol_fun;
900 return t * (Cx + t * (Bx + t * Ax));
904 return t * (Cy + t * (By + t * Ay));
908 return Cx + t * (2*Bx + 3*Ax * t);
918 if ( fabs(z) < 0.001)
break;
930 double Bx = 3 * (p3 - p1) - Cx;
931 double Ax = 1 - Cx - Bx;
934 double By = 3 * (p4 - p2) - Cy;
935 double Ay = 1 - Cy - By;
973 double t = (double) m_Timer.
Duration();
974 double d = (double) m_Duration;
975 double b = (double) m_DataIn.
LastEval();
979 if (d>=0.0f && t<=d && t>=0.0f) {
985 RDouble = c * t/d + b;
989 RDouble = c*
cubic_bezier( t/d, 0.42, 0.0, 0.58, 1.0 ) + b;
998 cout <<
"moParamInterpolation::InterpolateData > nterpolation function doesn't exists for " << m_Function << endl;
1008 return &m_DataInterpolated;
1017 return &m_ValueInterpolated;
1029 m_CurrentIndexValue = 0;
1030 m_bExternDataUpdated =
false;
1031 m_pExternData = NULL;
1039 m_CurrentIndexValue = 0;
1040 m_bExternDataUpdated =
false;
1041 m_pExternData = NULL;
1042 m_ParamDefinition = p_paramdefinition;
1051 m_bExternDataUpdated = src.m_bExternDataUpdated;
1052 m_pExternData = src.m_pExternData;
1053 m_ParamDefinition = src.m_ParamDefinition;
1054 m_Values = src.m_Values;
1055 m_CurrentIndexValue = src.m_CurrentIndexValue;
1066 return m_Values.Count();
1072 m_Values.Add( value );
1088 switch( (
int)m_ParamDefinition.
GetType() ) {
1128 valuebase.
SetText(
"default" );
1160 valuebase.
SetText(
"fonts/Tuffy.ttf" );
1207 i = m_CurrentIndexValue;
1209 if (0<=i && i<(
MOint)m_Values.Count() )
1212 return m_Values[m_CurrentIndexValue];
1218 if (0<=indexvalue && indexvalue<(
MOint)m_Values.Count() ) {
1219 m_CurrentIndexValue = indexvalue;
1220 m_bExternDataUpdated =
false;
1229 return m_CurrentIndexValue;
1235 if ( m_Values.Count() > 0 ) {
1236 m_bExternDataUpdated =
false;
1237 if ( m_CurrentIndexValue < ((
MOint)m_Values.Count()-1) ) {
1238 m_CurrentIndexValue++;
1240 }
else m_CurrentIndexValue = -1;
1245 if ( m_Values.Count() > 0 ) {
1246 m_bExternDataUpdated =
false;
1247 if ( m_CurrentIndexValue > 0 ) {
1248 m_CurrentIndexValue--;
1250 }
else m_CurrentIndexValue = -1;
1255 if (m_Values.Count() > 0) {
1256 m_bExternDataUpdated =
false;
1257 m_CurrentIndexValue = 0;
1258 }
else m_CurrentIndexValue = -1;
1263 m_ParamDefinition = p_paramdefinition;
1270 return m_ParamDefinition;
1282 m_bExternDataUpdated =
true;
1288 moData* pReturnData = NULL;
1291 if (m_pExternData && m_bExternDataUpdated) {
1292 pReturnData = m_pExternData;
1306 pReturnData->
Eval();
1316 m_pExternData = p_pExternData;
1321 unsigned int v = 0, s = 0;
1333 switch( m_ParamDefinition.
GetType() ) {
1336 m_ParamDefinition.
SetType(p_NewType);
1338 for( v = 0; v<this->m_Values.Count() ; v++ ) {
1340 moValue& pValue( this->m_Values.GetRef( v ) );
1341 for( s = 0; s< pValue.GetSubValueCount(); s++ ) {
1362 m_ParamDefinition.
SetOptions( p_NewOptions );
1363 return m_ParamDefinition.
GetOptions().Count()==p_NewOptions.Count();
1370 moText fieldSeparation =
",";
1374 m_fullJSON+= fieldSeparation +
"'pvals': [";
1376 fieldSeparation =
"";
1377 for(
int vi = 0; vi < (int)m_Values.Count(); vi++ ) {
1378 m_fullJSON+= fieldSeparation + m_Values[vi].ToJSON();
1379 fieldSeparation =
",";
double bezier_y(double t, double Ay, double By, double Cy)
bool FixType(moParamType m_NewType=MO_PARAM_UNDEFINED)
moParamInterpolationFunction
void SetText(moText ptext)
moTextArray & GetOptions()
void SetOptions(const moTextArray &p_options)
value type: NUM or FUNCTION
double cubic_bezier(double t, double p1, double p2, double p3, double p4)
moTextArray Explode(char *separator) const
virtual void Start()
Inicia el temporizador.
void SetIndexValue(int indexvalue)
moValueBase & GetSubValue(MOint p_indexsubvalue=0)
virtual long Duration()
Devuelve el valor del reloj del temporizador.
value type: NUM or FUNCTION
value type: NUM or FUNCTION
void SetDouble(MOdouble pdouble)
value type: NUM or FUNCTION
MOdouble LastEval() const
const moText & GetProperty() const
value type: NUM or FUNCTION
void SetParamDefinition(moParamDefinition &p_paramdefinition)
value type: NUM or FUNCTION
value type: NUM or FUNCTION
void StartInterpolation(const moData &p_data_in, const moData &p_data_out)
void SetInterpolation(const moText &p_interpol_fun, const moText &p_fun_duration=moText(1000), const moText &p_fun_expression=moText())
const moText & GetGroup() const
void Replace(const moText0 &target, const moText0 &replacement)
value type: NUM or FUNCTION
void SetType(moParamType p_paramType)
value type: TXT or LNK, or XML
virtual ~moParamDefinition()
void AddSubValue(const moText &strvalue, moValueType p_valuetype)
virtual ~moParamInterpolation()
int Set(const moText &p_XmlText)
void SetExternData(moData *p_pExternData)
const moText & GetName() const
void SetDuration(MOlong p_fun_duration)
value type: TXT or LNK, or XML
clase de para manejar textos
moValue * InterpolateValue(moValue &pParamValue)
bool FixType(moValueType p_ValueType)
void Stop()
Detiene el temporizador.
int GetIndexValue() const
void SetInterpolationFunction(const moText &p_interpol_fun)
virtual MOboolean Init(const moText &p_Expression, moMoldeoObject *p_pMOB=NULL)
double find_x_for(double t, double Ax, double Bx, double Cx)
static void Log(moText p_text)
Escribe un mensaje en el archivo de registro (log)
void SetType(moValueType p_type)
Fija el tipo de valor, esta función se implementa sólo como atajo a ciertos datos de la definición ...
value type: NUM[4] or FUNCTION[4] or
double bezier_x_der(double t, double Ax, double Bx, double Cx)
static moParamType ParamTypeFromStr(const moText &p_type)
void DeleteValue(MOint i)
void RemoveSubValues(bool leavefirstone=true)
moParam & operator=(const moParam &src)
moParamInterpolation & operator=(const moParamInterpolation &src)
moParamInterpolation & GetInterpolation()
bool FixOptions(moTextArray &m_NewOptions)
moParamType GetType() const
moData * InterpolateData(moData &pParamData)
const moTimer & GetTimer() const
value type: NUM or FUNCTION
static double Cos(doublefValue)
value type: NUM or FUNCTION
value type: NUM or FUNCTION
void AddValue(moValue &value)
moValue & GetValue(MOint i=-1)
value type: NUM or FUNCTION
moDefineDynamicArray(moParamDefinitions) moDefineDynamicArray(moParams) moDefineDynamicArray(moParamIndexes) moParamDefinition
value type: NUM or TEXT ( 0:FILL 1:LINE 2:POINT)
Clase para el control de un temporizador (relativo) con identificación
moText GetFunctionToText()
moText GetTypeStr() const
moParamDefinition & GetParamDefinition()
void SetDefault(const moValue &p_defaultvalue)
LIBMOLDEO_API moText0 IntToStr(int a)
MOuint GetValuesCount() const
double bezier_x(double t, double Ax, double Bx, double Cx)
moValueType GetType() const
Devuelve el tipo de valor ,esta función se implementa sólo como atajo a ciertos datos de la definición ...
const moText & GetOptionsStr()
value type: NUM or FUNCTION
value type: NUM or TEXT (to script or shader for chroma???)
moParamDefinition & operator=(const moParamDefinition &src)