123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- #include "CCPULineEmitterTranslator.h"
- #include "extensions/Particle3D/PU/CCPUParticleSystem3D.h"
- #include "extensions/Particle3D/PU/CCPUDynamicAttribute.h"
- #include "extensions/Particle3D/PU/CCPUDynamicAttributeTranslator.h"
- NS_CC_BEGIN
- PULineEmitterTranslator::PULineEmitterTranslator()
- {
- }
- bool PULineEmitterTranslator::translateChildProperty( PUScriptCompiler* compiler, PUAbstractNode *node )
- {
- PUPropertyAbstractNode* prop = reinterpret_cast<PUPropertyAbstractNode*>(node);
- PUEmitter* em = static_cast<PUEmitter*>(prop->parent->context);
- PULineEmitter* emitter = static_cast<PULineEmitter*>(em);
- if (prop->name == token[TOKEN_END])
- {
-
- if (passValidateProperty(compiler, prop, token[TOKEN_END], VAL_VECTOR3))
- {
- Vec3 val;
- if(getVector3(prop->values.begin(), prop->values.end(), &val))
- {
- emitter->setEnd(val);
- return true;
- }
- }
- }
- else if (prop->name == token[TOKEN_LINE_EMIT_END])
- {
-
- if (passValidateProperty(compiler, prop, token[TOKEN_LINE_EMIT_END], VAL_VECTOR3))
- {
- Vec3 val;
- if(getVector3(prop->values.begin(), prop->values.end(), &val))
- {
- emitter->setEnd(val);
- return true;
- }
- }
- }
- else if (prop->name == token[TOKEN_MAX_INCREMENT])
- {
-
- if (passValidateProperty(compiler, prop, token[TOKEN_MAX_INCREMENT], VAL_REAL))
- {
- float val = 0.0f;
- if(getFloat(*prop->values.front(), &val))
- {
- emitter->setMaxIncrement(val);
- return true;
- }
- }
- }
- else if (prop->name == token[TOKEN_LINE_EMIT_MAX_INCREMENT])
- {
-
- if (passValidateProperty(compiler, prop, token[TOKEN_LINE_EMIT_MAX_INCREMENT], VAL_REAL))
- {
- float val = 0.0f;
- if(getFloat(*prop->values.front(), &val))
- {
- emitter->setMaxIncrement(val);
- return true;
- }
- }
- }
- else if (prop->name == token[TOKEN_MIN_INCREMENT])
- {
-
- if (passValidateProperty(compiler, prop, token[TOKEN_MIN_INCREMENT], VAL_REAL))
- {
- float val = 0.0f;
- if(getFloat(*prop->values.front(), &val))
- {
- emitter->setMinIncrement(val);
- return true;
- }
- }
- }
- else if (prop->name == token[TOKEN_LINE_EMIT_MIN_INCREMENT])
- {
-
- if (passValidateProperty(compiler, prop, token[TOKEN_LINE_EMIT_MIN_INCREMENT], VAL_REAL))
- {
- float val = 0.0f;
- if(getFloat(*prop->values.front(), &val))
- {
- emitter->setMinIncrement(val);
- return true;
- }
- }
- }
- else if (prop->name == token[TOKEN_MAX_DEVIATION])
- {
-
- if (passValidateProperty(compiler, prop, token[TOKEN_MAX_DEVIATION], VAL_REAL))
- {
- float val = 0.0f;
- if(getFloat(*prop->values.front(), &val))
- {
- emitter->setMaxDeviation(val);
- return true;
- }
- }
- }
- else if (prop->name == token[TOKEN_LINE_EMIT_MAX_DEVIATION])
- {
-
- if (passValidateProperty(compiler, prop, token[TOKEN_LINE_EMIT_MAX_DEVIATION], VAL_REAL))
- {
- float val = 0.0f;
- if(getFloat(*prop->values.front(), &val))
- {
- emitter->setMaxDeviation(val);
- return true;
- }
- }
- }
- return false;
- }
- bool PULineEmitterTranslator::translateChildObject( PUScriptCompiler* , PUAbstractNode* )
- {
-
- return false;
- }
- NS_CC_END
|