CCPUScriptTranslator.h 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348
  1. /****************************************************************************
  2. Copyright (C) 2013 Henry van Merode. All rights reserved.
  3. Copyright (c) 2015-2016 Chukong Technologies Inc.
  4. Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
  5. http://www.cocos2d-x.org
  6. Permission is hereby granted, free of charge, to any person obtaining a copy
  7. of this software and associated documentation files (the "Software"), to deal
  8. in the Software without restriction, including without limitation the rights
  9. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10. copies of the Software, and to permit persons to whom the Software is
  11. furnished to do so, subject to the following conditions:
  12. The above copyright notice and this permission notice shall be included in
  13. all copies or substantial portions of the Software.
  14. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. THE SOFTWARE.
  21. ****************************************************************************/
  22. #ifndef __CC_PU_SCRIPT_TRANSLATOR_H__
  23. #define __CC_PU_SCRIPT_TRANSLATOR_H__
  24. #include <iostream>
  25. #include "base/CCRef.h"
  26. #include "math/CCMath.h"
  27. #include "extensions/Particle3D/PU/CCPUScriptCompiler.h"
  28. NS_CC_BEGIN
  29. // Define static tokens
  30. enum eDefineStaticToken
  31. {
  32. // Generic
  33. TOKEN_GROUP_MASK,
  34. TOKEN_ACCELERATION,
  35. TOKEN_MAX_INCREMENT,
  36. TOKEN_MIN_INCREMENT,
  37. TOKEN_ITERATIONS,
  38. TOKEN_COLOUR_CHANGE,
  39. TOKEN_INITIAL_COLOUR,
  40. TOKEN_RANDOM_INITIAL_COLOUR,
  41. TOKEN_USE_VERTEX_COLOURS,
  42. TOKEN_USE_OWN_ROTATION,
  43. TOKEN_MAX_DEVIATION,
  44. TOKEN_TIME_STEP,
  45. TOKEN_BOX_WIDTH,
  46. TOKEN_BOX_HEIGHT,
  47. TOKEN_BOX_DEPTH,
  48. TOKEN_VELOCITY,
  49. TOKEN_SPEED,
  50. TOKEN_ROTATION_SPEED,
  51. TOKEN_ROTATION,
  52. TOKEN_ROTATION_AXIS,
  53. TOKEN_NORMAL,
  54. TOKEN_STEP,
  55. TOKEN_NUMBER_OF_SEGMENTS,
  56. TOKEN_MAX_ELEMENTS,
  57. TOKEN_UPDATE_INTERVAL,
  58. TOKEN_DISTANCE_THRESHOLD,
  59. TOKEN_MATERIAL,
  60. TOKEN_MESH_NAME,
  61. TOKEN_RADIUS,
  62. TOKEN_ENABLED,
  63. TOKEN_POSITION,
  64. TOKEN_KEEP_LOCAL,
  65. TOKEN_LESS_THAN,
  66. TOKEN_GREATER_THAN,
  67. TOKEN_EQUALS,
  68. TOKEN_VISUAL_PARTICLE,
  69. TOKEN_EMITTER_PARTICLE,
  70. TOKEN_AFFECTOR_PARTICLE,
  71. TOKEN_TECHNIQUE_PARTICLE,
  72. TOKEN_SYSTEM_PARTICLE,
  73. TOKEN_POINT,
  74. TOKEN_VERTEX,
  75. TOKEN_INCREASE,
  76. TOKEN_ALIAS,
  77. TOKEN_USE_ALIAS,
  78. TOKEN_SINCE_START_SYSTEM,
  79. // Particle System
  80. TOKEN_SYSTEM,
  81. TOKEN_PS_ITERATION_INTERVAL,
  82. TOKEN_PS_NONVIS_UPDATE_TIMEOUT,
  83. TOKEN_PS_FIXED_TIMEOUT,
  84. TOKEN_PS_LOD_DISTANCES,
  85. TOKEN_PS_MAIN_CAMERA_NAME,
  86. TOKEN_PS_SMOOTH_LOD,
  87. TOKEN_PS_FAST_FORWARD,
  88. TOKEN_PS_SCALE,
  89. TOKEN_PS_SCALE_VELOCITY,
  90. TOKEN_PS_SCALE_TIME,
  91. TOKEN_PS_TIGHT_BOUNDING_BOX,
  92. TOKEN_PS_CATEGORY,
  93. // Particle Technique
  94. TOKEN_TECHNIQUE,
  95. TOKEN_TECH_VISUAL_PARTICLE_QUOTA,
  96. TOKEN_TECH_EMITTED_EMITTER_QUOTA,
  97. TOKEN_TECH_EMITTED_AFFECTOR_QUOTA,
  98. TOKEN_TECH_EMITTED_TECHNIQUE_QUOTA,
  99. TOKEN_TECH_EMITTED_SYSTEM_QUOTA,
  100. TOKEN_TECH_LOD_INDEX,
  101. TOKEN_TECH_DEFAULT_PARTICLE_WIDTH,
  102. TOKEN_TECH_DEFAULT_PARTICLE_HEIGHT,
  103. TOKEN_TECH_DEFAULT_PARTICLE_DEPTH,
  104. TOKEN_TECH_SPHASHING_CELL_DIMENSION,
  105. TOKEN_TECH_SPHASHING_CELL_OVERLAP,
  106. TOKEN_TECH_SPHASHING_SIZE,
  107. TOKEN_TECH_SPHASHING_UPDATE_INTERVAL,
  108. TOKEN_TECH_MAX_VELOCITY,
  109. // Particle Renderer
  110. TOKEN_RENDERER,
  111. TOKEN_RENDERER_Q_GROUP,
  112. TOKEN_RENDERER_SORTING,
  113. TOKEN_RENDERER_TEXCOORDS_DEFINE,
  114. TOKEN_RENDERER_TEXCOORDS_ROWS,
  115. TOKEN_RENDERER_TEXCOORDS_SET,
  116. TOKEN_RENDERER_TEXCOORDS_COLUMNS,
  117. TOKEN_RENDERER_USE_SOFT_PARTICLES,
  118. TOKEN_RENDERER_SOFT_PARTICLES_CONTRAST_POWER,
  119. TOKEN_RENDERER_SOFT_PARTICLES_SCALE,
  120. TOKEN_RENDERER_SOFT_PARTICLES_DELTA,
  121. // Particle Emitter
  122. TOKEN_EMITTER,
  123. TOKEN_EMITTER_DIRECTION,
  124. TOKEN_EMITTER_ORIENTATION,
  125. TOKEN_EMITTER_ORIENTATION_RANGE_START,
  126. TOKEN_EMITTER_ORIENTATION_RANGE_END,
  127. TOKEN_EMITTER_START_ORIENTATION_RANGE,
  128. TOKEN_EMITTER_END_ORIENTATION_RANGE,
  129. TOKEN_EMITTER_DURATION,
  130. TOKEN_EMITTER_REPEAT_DELAY,
  131. TOKEN_EMITTER_EMITS,
  132. TOKEN_ANGLE,
  133. TOKEN_EMITTER_EMISSION_RATE,
  134. TOKEN_TIME_TO_LIVE,
  135. TOKEN_EMITTER_MASS,
  136. TOKEN_EMITTER_START_TEXCOORDS,
  137. TOKEN_EMITTER_END_TEXCOORDS,
  138. TOKEN_EMITTER_START_TEXCOORDS_RANGE,
  139. TOKEN_EMITTER_END_TEXCOORDS_RANGE,
  140. TOKEN_EMITTER_TEXCOORDS,
  141. TOKEN_EMITTER_START_COLOUR_RANGE,
  142. TOKEN_EMITTER_END_COLOUR_RANGE,
  143. TOKEN_EMITTER_COLOUR,
  144. TOKEN_EMITTER_ALL_PARTICLE_DIM,
  145. TOKEN_EMITTER_PARTICLE_WIDTH,
  146. TOKEN_EMITTER_PARTICLE_HEIGHT,
  147. TOKEN_EMITTER_PARTICLE_DEPTH,
  148. TOKEN_EMITTER_AUTO_DIRECTION,
  149. TOKEN_EMITTER_FORCE_EMISSION,
  150. // Particle Affector
  151. TOKEN_AFFECTOR,
  152. TOKEN_AFFECTOR_MASS,
  153. TOKEN_AFFECTOR_EXCLUDE_EMITTER,
  154. TOKEN_AFFECTOR_SPECIALISATION,
  155. TOKEN_AFFECTOR_SPEC_DEFAULT,
  156. TOKEN_AFFECTOR_SPEC_TTL_INCREASE,
  157. TOKEN_AFFECTOR_SPEC_TTL_DECREASE,
  158. // Particle Observer
  159. TOKEN_OBSERVER,
  160. TOKEN_OBSERVE_PARTICLE_TYPE,
  161. TOKEN_OBSERVE_INTERVAL,
  162. TOKEN_OBSERVE_UNTIL_EVENT,
  163. // Particle Event Handler
  164. TOKEN_HANDLER,
  165. // Particle Behaviour
  166. TOKEN_BEHAVIOUR,
  167. // Extern
  168. TOKEN_EXTERN,
  169. TOKEN_EXTERN_DISTANCE_THRESHOLD,
  170. // Dynamic Attribute
  171. TOKEN_DYN_CONTROL_POINT,
  172. TOKEN_DYN_MIN,
  173. TOKEN_DYN_MAX,
  174. TOKEN_DYN_OSCILLATE_FREQUENCY,
  175. TOKEN_DYN_OSCILLATE_PHASE,
  176. TOKEN_DYN_OSCILLATE_BASE,
  177. TOKEN_DYN_OSCILLATE_AMPLITUDE,
  178. TOKEN_DYN_OSCILLATE_TYPE,
  179. TOKEN_DYN_OSCILLATE,
  180. TOKEN_DYN_RANDOM,
  181. TOKEN_DYN_CURVED_LINEAR,
  182. TOKEN_DYN_CURVED_SPLINE,
  183. TOKEN_DYN_SINE,
  184. TOKEN_DYN_SQUARE,
  185. // CameraDependency (unused)
  186. TOKEN_CAMERA_DEPENDENCY,
  187. // BeamRenderer
  188. TOKEN_BEAMRENDERER_UPDATE_INTERVAL,
  189. TOKEN_BEAMRENDERER_MAX_ELEMENTS,
  190. TOKEN_BEAMRENDERER_DEVIATION,
  191. TOKEN_BEAMRENDERER_NUMBER_OF_SEGMENTS,
  192. TOKEN_BEAMRENDERER_JUMP,
  193. TOKEN_BEAMRENDERER_TEXCOORD_DIRECTION,
  194. TOKEN_BEAMRENDERER_VERTEX_COLOURS,
  195. TOKEN_BEAMRENDERER_TCD_U,
  196. TOKEN_BEAMRENDERER_TCD_V,
  197. // BillboardRenderer
  198. TOKEN_BILLBOARD_TYPE,
  199. TOKEN_BILLBOARD_ORIGIN,
  200. TOKEN_BILLBOARD_ROTATION_TYPE,
  201. TOKEN_BILLBOARD_COMMON_DIRECTION,
  202. TOKEN_BILLBOARD_COMMON_UP_VECTOR,
  203. TOKEN_BILLBOARD_POINT_RENDERING,
  204. TOKEN_BILLBOARD_ACCURATE_FACING,
  205. TOKEN_BILLBOARD_ORIENTED_COMMON,
  206. TOKEN_BILLBOARD_ORIENTED_SELF,
  207. TOKEN_BILLBOARD_ORIENTED_SHAPE,
  208. TOKEN_BILLBOARD_PERPENDICULAR_COMMON,
  209. TOKEN_BILLBOARD_PERPENDICULAR_SELF,
  210. TOKEN_BILLBOARD_TOP_LEFT,
  211. TOKEN_BILLBOARD_TOP_CENTER,
  212. TOKEN_BILLBOARD_TOP_RIGHT,
  213. TOKEN_BILLBOARD_CENTER_LEFT,
  214. TOKEN_BILLBOARD_CENTER_RIGHT,
  215. TOKEN_BILLBOARD_CENTER,
  216. TOKEN_BILLBOARD_BOTTON_LEFT,
  217. TOKEN_BILLBOARD_BOTTOM_CENTER,
  218. TOKEN_BILLBOARD_BOTTOM_RIGHT,
  219. TOKEN_BILLBOARD_TEXCOORD,
  220. // EntityRenderer
  221. TOKEN_ENT_MESH_NAME,
  222. TOKEN_ENT_ORIENTATION_TYPE,
  223. TOKEN_ENT_ORIENTED_SELF,
  224. TOKEN_ENT_ORIENTED_SELF_MIRRORED,
  225. TOKEN_ENT_ORIENTED_SHAPE,
  226. // LightRenderer
  227. TOKEN_LIGHT_TYPE,
  228. TOKEN_LIGHT_RENDER_QUEUE,
  229. TOKEN_LIGHT_SPECULAR,
  230. TOKEN_LIGHT_ATT_RANGE,
  231. TOKEN_LIGHT_ATT_CONSTANT,
  232. TOKEN_LIGHT_ATT_LINEAR,
  233. TOKEN_LIGHT_ATT_QUADRATIC,
  234. TOKEN_LIGHT_SPOT_INNER,
  235. TOKEN_LIGHT_SPOT_OUTER,
  236. TOKEN_LIGHT_FALLOFF,
  237. TOKEN_LIGHT_POWERSCALE,
  238. TOKEN_LIGHT_SPOT,
  239. TOKEN_FLASH_FREQUENCY,
  240. TOKEN_FLASH_LENGTH,
  241. TOKEN_FLASH_RANDOM,
  242. // RibbonTrailRenderer
  243. TOKEN_RIBBONTRAIL_VERTEX_COLOURS,
  244. TOKEN_RIBBONTRAIL_MAX_ELEMENTS,
  245. TOKEN_RIBBONTRAIL_LENGTH,
  246. TOKEN_RIBBONTRAIL_WIDTH,
  247. TOKEN_RIBBONTRAIL_RANDOM_INITIAL_COLOUR,
  248. TOKEN_RIBBONTRAIL_INITIAL_COLOUR,
  249. TOKEN_RIBBONTRAIL_COLOUR_CHANGE,
  250. // BoxEmitter
  251. TOKEN_EMITTER_BOX_WIDTH,
  252. TOKEN_EMITTER_BOX_HEIGHT,
  253. TOKEN_EMITTER_BOX_DEPTH,
  254. // CircleEmitter
  255. TOKEN_CIRCLE_RADIUS,
  256. TOKEN_CIRCLE_STEP,
  257. TOKEN_CIRCLE_ANGLE,
  258. TOKEN_CIRCLE_RANDOM,
  259. TOKEN_EMIT_RANDOM,
  260. TOKEN_CIRCLE_NORMAL,
  261. // LineEmitter
  262. TOKEN_LINE_EMIT_END,
  263. TOKEN_LINE_EMIT_MAX_INCREMENT,
  264. TOKEN_LINE_EMIT_MIN_INCREMENT,
  265. TOKEN_LINE_EMIT_MAX_DEVIATION,
  266. // MeshSurfaceEmitter
  267. TOKEN_MESH_SURFACE_NAME,
  268. TOKEN_MESH_SURFACE_DISTRIBUTION,
  269. TOKEN_MESH_SURFACE_MESH_SCALE,
  270. TOKEN_MESH_SURFACE_EDGE,
  271. TOKEN_MESH_SURFACE_HETEROGENEOUS_1,
  272. TOKEN_MESH_SURFACE_HETEROGENEOUS_2,
  273. TOKEN_MESH_SURFACE_HOMOGENEOUS,
  274. // PositionEmitter
  275. TOKEN_POS_ADD_POSITION,
  276. TOKEN_POS_RANDOMIZE,
  277. // SlaveEmitter
  278. TOKEN_MASTER_TECHNIQUE,
  279. TOKEN_MASTER_EMITTER,
  280. // SphereSurfaceEmitter
  281. TOKEN_SPHERE_RADIUS,
  282. // VertexEmitter
  283. TOKEN_VERTEX_STEP,
  284. TOKEN_VERTEX_SEGMENTS,
  285. TOKEN_VERTEX_ITERATIONS,
  286. TOKEN_VERTEX_MESH_NAME,
  287. // AlignAffector
  288. TOKEN_ALIGN_RESIZE,
  289. TOKEN_RESIZE,
  290. // BoxCollider
  291. TOKEN_BOXCOLL_WIDTH,
  292. TOKEN_BOXCOLL_HEIGHT,
  293. TOKEN_BOXCOLL_DEPTH,
  294. // BaseCollider
  295. TOKEN_FRICTION,
  296. TOKEN_BOUNCYNESS,
  297. TOKEN_INTERSECTION,
  298. TOKEN_COLLIDER_FRICTION,
  299. TOKEN_COLLIDER_BOUNCYNESS,
  300. TOKEN_COLLIDER_INTERSECTION,
  301. TOKEN_COLLIDER_COLLISION_TYPE,
  302. TOKEN_COLLIDER_BOUNCE,
  303. TOKEN_COLLIDER_FLOW,
  304. TOKEN_COLLIDER_NONE,
  305. TOKEN_COLLIDER_INTERSECTION_POINT,
  306. TOKEN_COLLIDER_INTERSECTION_BOX,
  307. TOKEN_INNER_COLLISION,
  308. // CollisionAvoidanceAffector
  309. TOKEN_AVOIDANCE_RADIUS,
  310. // ColourAffector
  311. TOKEN_TIME_COLOUR,
  312. TOKEN_COLOUR_TIME_COLOUR,
  313. TOKEN_COLOUR_OPERATION,
  314. TOKEN_COLOUR_MULTIPLY,
  315. TOKEN_COLOUR_SET,
  316. // BaseForceAffector
  317. TOKEN_FORCE_VECTOR,
  318. TOKEN_FORCE_APPLICATION,
  319. TOKEN_FORCE_AFF_VECTOR,
  320. TOKEN_FORCE_AFF_APPLICATION,
  321. TOKEN_FORCE_ADD,
  322. TOKEN_FORCE_AVERAGE,
  323. // ForceFieldAffector
  324. TOKEN_FORCEFIELD_TYPE,
  325. TOKEN_REALTIME,
  326. TOKEN_MATRIX,
  327. TOKEN_DELTA,
  328. TOKEN_FORCE,
  329. TOKEN_OCTAVES,
  330. TOKEN_FREQUENCY,
  331. TOKEN_AMPLITUDE,
  332. TOKEN_PERSISTENCE,
  333. TOKEN_FORCEFIELDSIZE,
  334. TOKEN_WORLDSIZE,
  335. TOKEN_IGNORE_NEGATIVE_X,
  336. TOKEN_IGNORE_NEGATIVE_Y,
  337. TOKEN_IGNORE_NEGATIVE_Z,
  338. TOKEN_MOVEMENT,
  339. TOKEN_MOVEMENT_FREQUENCY,
  340. // GeometryRotator
  341. TOKEN_GEOMROT_USE_OWN_ROTATION,
  342. TOKEN_GEOMROT_ROTATION_SPEED,
  343. TOKEN_GEOMROT_ROTATION_AXIS,
  344. // GravityAffector
  345. TOKEN_GRAVITY,
  346. // InterParticleCollider
  347. TOKEN_ADJUSTMENT,
  348. TOKEN_COLLISION_RESPONSE,
  349. TOKEN_IPC_ADJUSTMENT,
  350. TOKEN_IPC_COLLISION_RESPONSE,
  351. TOKEN_IPC_AVERAGE_VELOCITY,
  352. TOKEN_IPC_ANGLE_BASED_VELOCITY,
  353. // JetAffector
  354. TOKEN_JET_ACCELERATION,
  355. // LineAffector
  356. TOKEN_END,
  357. TOKEN_DRIFT,
  358. TOKEN_LINE_AFF_MAX_DEVIATION,
  359. TOKEN_LINE_AFF_TIME_STEP,
  360. TOKEN_LINE_AFF_END,
  361. TOKEN_LINE_AFF_DRIFT,
  362. // ParticleFollower
  363. TOKEN_FOLLOW_MAX_DISTANCE,
  364. TOKEN_FOLLOW_MIN_DISTANCE,
  365. TOKEN_MAX_DISTANCE,
  366. TOKEN_MIN_DISTANCE,
  367. // PathFollower
  368. TOKEN_PATH_POINT,
  369. // PlaneCollider
  370. TOKEN_PLANECOLL_NORMAL,
  371. // Randomiser
  372. TOKEN_RND_MAX_DEVIATION_X,
  373. TOKEN_RND_MAX_DEVIATION_Y,
  374. TOKEN_RND_MAX_DEVIATION_Z,
  375. TOKEN_MAX_DEVIATION_X,
  376. TOKEN_MAX_DEVIATION_Y,
  377. TOKEN_MAX_DEVIATION_Z,
  378. TOKEN_RND_TIME_STEP,
  379. TOKEN_RND_DIRECTION,
  380. TOKEN_USE_DIRECTION,
  381. // ScaleAffector
  382. TOKEN_SCALE_XYZ_SCALE,
  383. TOKEN_SCALE_X_SCALE,
  384. TOKEN_SCALE_Y_SCALE,
  385. TOKEN_SCALE_Z_SCALE,
  386. // ScaleVelocityAffector
  387. TOKEN_SCALE_VELOCITY_SCALE,
  388. TOKEN_STOP_AT_FLIP,
  389. // SineForceAffector
  390. TOKEN_SINE_MIN_FREQUENCY,
  391. TOKEN_SINE_MAX_FREQUENCY,
  392. TOKEN_MIN_FREQUENCY,
  393. TOKEN_MAX_FREQUENCY,
  394. // SphereCollider
  395. TOKEN_SPHERE_COLLIDER_RADIUS,
  396. // TextureAnimator
  397. TOKEN_TEXANIM_TIME_STEP,
  398. TOKEN_TEXANIM_TEXCOORDS_START,
  399. TOKEN_TEXANIM_TEXCOORDS_END,
  400. TOKEN_START_TEXANIM_TEXCOORDS_RANGE,
  401. TOKEN_END_TEXANIM_TEXCOORDS_RANGE,
  402. TOKEN_TEXANIM_ANIMATION_TYPE,
  403. TOKEN_TEXANIM_START_RANDOM,
  404. TOKEN_TEXANIM_LOOP,
  405. TOKEN_TEXANIM_UP_DOWN,
  406. TOKEN_TEXANIM_RANDOM,
  407. // TextureRotator
  408. TOKEN_TEXROT_USE_OWN_ROTATION,
  409. TOKEN_TEXROT_ROTATION_SPEED,
  410. TOKEN_TEXROT_ROTATION,
  411. // VelocityMatchingAffector
  412. TOKEN_VELO_MATCHING_RADIUS,
  413. // VortexAffector
  414. TOKEN_VORTEX_ROTATION_VECTOR,
  415. TOKEN_VORTEX_ROTATION_SPEED,
  416. // OnCountObserver
  417. TOKEN_ONCOUNT_THRESHOLD,
  418. // OnEventFlagObserver
  419. TOKEN_ONEVENT_FLAG,
  420. // OnPositionObserver
  421. TOKEN_ONPOSITION_X,
  422. TOKEN_ONPOSITION_Y,
  423. TOKEN_ONPOSITION_Z,
  424. // OnRandomObserver
  425. TOKEN_ONRANDOM_THRESHOLD,
  426. // OnTimeObserver
  427. TOKEN_ONTIME,
  428. // OnVelocityObserver
  429. TOKEN_ONVELOCITY_THRESHOLD,
  430. // DoAffectorEventHandler
  431. TOKEN_FORCE_AFFECTOR,
  432. TOKEN_FORCE_AFFECTOR_PRE_POST,
  433. // DoEnableComponentEventHandler
  434. TOKEN_DOENABLE_COMPONENT,
  435. TOKEN_DOENABLE_EMITTER_COMPONENT,
  436. TOKEN_DOENABLE_AFFECTOR_COMPONENT,
  437. TOKEN_DOENABLE_TECHNIQUE_COMPONENT,
  438. TOKEN_DOENABLE_OBSERVER_COMPONENT,
  439. // DoPlacementParticleEventHandler
  440. TOKEN_DOPLACE_FORCE_EMITTER,
  441. TOKEN_DOPLACE_NUMBER_OF_PARTICLES,
  442. TOKEN_INHERIT_POSITION,
  443. TOKEN_INHERIT_DIRECTION,
  444. TOKEN_INHERIT_ORIENTATION,
  445. TOKEN_INHERIT_TIME_TO_LIVE,
  446. TOKEN_INHERIT_MASS,
  447. TOKEN_INHERIT_TEXTURE_COORDINATE,
  448. TOKEN_INHERIT_COLOUR,
  449. TOKEN_INHERIT_WIDTH,
  450. TOKEN_INHERIT_HEIGHT,
  451. TOKEN_INHERIT_DEPTH,
  452. // DoScaleEventHandler
  453. TOKEN_DOSCALE_FRACTION,
  454. TOKEN_DOSCALE_TYPE,
  455. TOKEN_DOSCALE_TIME_TO_LIVE,
  456. TOKEN_DOSCALE_VELOCITY,
  457. // SlaveBehaviour
  458. // PhysXActorExtern
  459. TOKEN_PHYSX_SHAPE_TYPE,
  460. TOKEN_PHYSX_ACTOR_COLLISION_GROUP,
  461. TOKEN_PHYSX_SHAPE_COLLISION_GROUP,
  462. TOKEN_PHYSX_GROUP_MASK,
  463. TOKEN_PHYSX_ANGULAR_VELOCITY,
  464. TOKEN_PHYSX_ANGULAR_DAMPING,
  465. TOKEN_PHYSX_MATERIAL_INDEX,
  466. TOKEN_SHAPE_TYPE,
  467. TOKEN_ACTOR_COLLISION_GROUP,
  468. TOKEN_SHAPE_COLLISION_GROUP,
  469. TOKEN_ANGULAR_VELOCITY,
  470. TOKEN_ANGULAR_DAMPING,
  471. TOKEN_MATERIAL_INDEX,
  472. TOKEN_PHYSX_BOX,
  473. TOKEN_PHYSX_SPHERE,
  474. TOKEN_PHYSX_CAPSULE,
  475. // PhysXFluidExtern
  476. TOKEN_REST_PARTICLE_PER_METER,
  477. TOKEN_REST_DENSITY,
  478. TOKEN_KERNEL_RADIUS_MULTIPLIER,
  479. TOKEN_MOTION_LIMIT_MULTIPLIER,
  480. TOKEN_COLLISION_DISTANCE_MULTIPLIER,
  481. TOKEN_PACKET_SIZE_MULTIPLIER,
  482. TOKEN_STIFFNESS,
  483. TOKEN_VISCOSITY,
  484. TOKEN_SURFACE_TENSION,
  485. TOKEN_DAMPING,
  486. TOKEN_EXTERNAL_ACCELERATION,
  487. TOKEN_RESTITUTION_FOR_STATIC_SHAPES,
  488. TOKEN_DYNAMIC_FRICTION_FOR_STATIC_SHAPES,
  489. TOKEN_STATIC_FRICTION_FOR_STATIC_SHAPES,
  490. TOKEN_ATTRACTION_FOR_STATIC_SHAPES,
  491. TOKEN_RESTITUTION_FOR_DYNAMIC_SHAPES,
  492. TOKEN_DYNAMIC_FRICTION_FOR_DYNAMIC_SHAPES,
  493. TOKEN_STATIC_FRICTION_FOR_DYNAMIC_SHAPES,
  494. TOKEN_ATTRACTION_FOR_DYNAMIC_SHAPES,
  495. TOKEN_COLLISION_RESPONSE_COEFFICIENT,
  496. TOKEN_COLLISION_GROUP,
  497. TOKEN_SIMULATION_METHOD,
  498. TOKEN_COLLISION_METHOD,
  499. TOKEN_FLAGS,
  500. TOKEN_FLAG_VISUALIZATION,
  501. TOKEN_FLAG_DISABLE_GRAVITY,
  502. TOKEN_FLAG_COLLISION_TWOWAY,
  503. TOKEN_FLAG_FLUID_ENABLED,
  504. TOKEN_FLAG_HARDWARE,
  505. TOKEN_FLAG_PRIORITY_MODE,
  506. TOKEN_FLAG_PROJECT_TO_PLANE,
  507. TOKEN_FLAG_STRICT_COOKING_FORMAT,
  508. TOKEN_INTERCOLLISION,
  509. TOKEN_NOINTERCOLLISION,
  510. TOKEN_MIX_INTERCOLLISION,
  511. TOKEN_STATIC,
  512. TOKEN_DYNAMIC,
  513. // SceneDecoratorExtern
  514. TOKEN_SCENE_MESH_NAME,
  515. TOKEN_SCENE_MATERIAL_NAME,
  516. TOKEN_SCENE_SCALE,
  517. TOKEN_SCENE_POSITION
  518. };
  519. // Static tokens: Note, that the order must be the same as the enum
  520. static const std::string token[1000] =
  521. {
  522. // Generic
  523. "group_mask",
  524. "acceleration",
  525. "max_increment",
  526. "min_increment",
  527. "number_of_iterations",
  528. "colour_change",
  529. "initial_colour",
  530. "random_initial_colour",
  531. "use_vertex_colours",
  532. "use_own_rotation",
  533. "max_deviation",
  534. "time_step",
  535. "box_width",
  536. "box_height",
  537. "box_depth",
  538. "velocity",
  539. "speed",
  540. "rotation_speed",
  541. "rotation",
  542. "rotation_axis",
  543. "normal",
  544. "step",
  545. "number_of_segments",
  546. "max_elements",
  547. "update_interval",
  548. "distance_threshold",
  549. "material",
  550. "mesh_name",
  551. "radius",
  552. "enabled",
  553. "position",
  554. "keep_local",
  555. "less_than",
  556. "greater_than",
  557. "equals",
  558. "visual_particle",
  559. "emitter_particle",
  560. "affector_particle",
  561. "technique_particle",
  562. "system_particle",
  563. "point",
  564. "vertex",
  565. "increase",
  566. "alias",
  567. "use_alias",
  568. "since_start_system",
  569. // Particle System
  570. "system",
  571. "iteration_interval",
  572. "nonvisible_update_timeout",
  573. "fixed_timeout",
  574. "lod_distances",
  575. "main_camera_name",
  576. "smooth_lod",
  577. "fast_forward",
  578. "scale",
  579. "scale_velocity",
  580. "scale_time",
  581. "tight_bounding_box",
  582. "category",
  583. // Particle Technique
  584. "technique",
  585. "visual_particle_quota",
  586. "emitted_emitter_quota",
  587. "emitted_affector_quota",
  588. "emitted_technique_quota",
  589. "emitted_system_quota",
  590. "lod_index",
  591. "default_particle_width",
  592. "default_particle_height",
  593. "default_particle_depth",
  594. "spatial_hashing_cell_dimension",
  595. "spatial_hashing_cell_overlap",
  596. "spatial_hashtable_size",
  597. "spatial_hashing_update_interval",
  598. "max_velocity",
  599. // Particle Renderer
  600. "renderer",
  601. "render_queue_group",
  602. "sorting",
  603. "texture_coords_define",
  604. "texture_coords_rows",
  605. "texture_coords_set",
  606. "texture_coords_columns",
  607. "use_soft_particles",
  608. "soft_particles_contrast_power",
  609. "soft_particles_scale",
  610. "soft_particles_delta",
  611. // Particle Emitter
  612. "emitter",
  613. "direction",
  614. "orientation",
  615. "range_start_orientation",
  616. "range_end_orientation",
  617. "start_orientation_range",
  618. "end_orientation_range",
  619. "duration",
  620. "repeat_delay",
  621. "emits",
  622. "angle",
  623. "emission_rate",
  624. "time_to_live",
  625. "mass",
  626. "start_texture_coords",
  627. "end_texture_coords",
  628. "start_texture_coords_range",
  629. "end_texture_coords_range",
  630. "texture_coords",
  631. "start_colour_range",
  632. "end_colour_range",
  633. "colour",
  634. "all_particle_dimensions",
  635. "particle_width",
  636. "particle_height",
  637. "particle_depth",
  638. "auto_direction",
  639. "force_emission",
  640. // Particle Affector
  641. "affector",
  642. "mass_affector",
  643. "exclude_emitter",
  644. "affect_specialisation",
  645. "special_default",
  646. "special_ttl_increase",
  647. "special_ttl_decrease",
  648. // Particle Observer
  649. "observer",
  650. "observe_particle_type",
  651. "observe_interval",
  652. "observe_until_event",
  653. // Particle Event Handler
  654. "handler",
  655. // Particle Behaviour
  656. "behaviour",
  657. // Extern
  658. "extern",
  659. "attachable_distance_threshold",
  660. // Dynamic Attribute
  661. "control_point",
  662. "min",
  663. "max",
  664. "oscillate_frequency",
  665. "oscillate_phase",
  666. "oscillate_base",
  667. "oscillate_amplitude",
  668. "oscillate_type",
  669. "dyn_oscillate",
  670. "dyn_random",
  671. "dyn_curved_linear",
  672. "dyn_curved_spline",
  673. "sine",
  674. "square",
  675. // CameraDependency (unused)
  676. "camera_dependency",
  677. // ------------------------- Renderers -------------------------
  678. // BeamRenderer
  679. "beam_update_interval",
  680. "beam_max_elements",
  681. "beam_deviation",
  682. "beam_number_segments",
  683. "beam_jump_segments",
  684. "beam_texcoord_direction",
  685. "beam_vertex_colours",
  686. "tcd_u",
  687. "tcd_v",
  688. // BillboardRenderer
  689. "billboard_type",
  690. "billboard_origin",
  691. "billboard_rotation_type",
  692. "common_direction",
  693. "common_up_vector",
  694. "point_rendering",
  695. "accurate_facing",
  696. "oriented_common",
  697. "oriented_self",
  698. "oriented_shape",
  699. "perpendicular_common",
  700. "perpendicular_self",
  701. "top_left",
  702. "top_center",
  703. "top_right",
  704. "center_left",
  705. "center_right",
  706. "center",
  707. "bottom_left",
  708. "bottom_center",
  709. "bottom_right",
  710. "texcoord",
  711. // BoxRenderer: No properties itself
  712. // EntityRenderer
  713. "entity_renderer_mesh_name",
  714. "entity_orientation_type",
  715. "ent_oriented_self",
  716. "ent_oriented_self_mirrored",
  717. "ent_oriented_shape",
  718. // LightRenderer
  719. "light_renderer_light_type",
  720. "light_renderer_queue_group",
  721. "light_renderer_specular",
  722. "light_renderer_att_range",
  723. "light_renderer_att_constant",
  724. "light_renderer_att_linear",
  725. "light_renderer_att_quadratic",
  726. "light_renderer_spot_inner",
  727. "light_renderer_spot_outer",
  728. "light_renderer_falloff",
  729. "light_renderer_powerscale",
  730. "spot",
  731. "flash_frequency",
  732. "flash_length",
  733. "flash_random",
  734. // RibbonTrailRenderer
  735. "ribbontrail_vertex_colours",
  736. "ribbontrail_max_elements",
  737. "ribbontrail_length",
  738. "ribbontrail_width",
  739. "ribbontrail_random_initial_colour",
  740. "ribbontrail_initial_colour",
  741. "ribbontrail_colour_change",
  742. // SphereRenderer: No properties itself
  743. // ------------------------- Emitters -------------------------
  744. // BoxEmitter
  745. "box_em_width",
  746. "box_em_height",
  747. "box_em_depth",
  748. // CircleEmitter
  749. "circle_em_radius",
  750. "circle_em_step",
  751. "circle_em_angle",
  752. "circle_em_random",
  753. "emit_random",
  754. "circle_em_normal",
  755. // LineEmitter
  756. "line_em_end",
  757. "line_em_max_increment",
  758. "line_em_min_increment",
  759. "line_em_max_deviation",
  760. // MeshSurfaceEmitter
  761. "mesh_surface_mesh_name",
  762. "mesh_surface_distribution",
  763. "mesh_surface_scale",
  764. "edge",
  765. "heterogeneous_1",
  766. "heterogeneous_2",
  767. "homogeneous",
  768. // PointEmitter: No properties itself
  769. // PositionEmitter
  770. "add_position",
  771. "random_position",
  772. // SlaveEmitter
  773. "master_technique_name",
  774. "master_emitter_name",
  775. // SphereSurfaceEmitter
  776. "sphere_surface_em_radius",
  777. // VertexEmitter
  778. "vertex_em_step",
  779. "vertex_em_segments",
  780. "vertex_em_iterations",
  781. "vertex_em_mesh_name",
  782. // ------------------------- Affectors -------------------------
  783. // AlignAffector
  784. "align_aff_resize",
  785. "resize",
  786. // BoxCollider
  787. "box_collider_width",
  788. "box_collider_height",
  789. "box_collider_depth",
  790. // BaseCollider
  791. "friction",
  792. "bouncyness",
  793. "intersection",
  794. "collision_friction",
  795. "collision_bouncyness",
  796. "collision_intersection",
  797. "collision_type",
  798. "bounce",
  799. "flow",
  800. "none",
  801. "point",
  802. "box",
  803. "inner_collision",
  804. // CollisionAvoidanceAffector
  805. "avoidance_radius",
  806. // ColourAffector
  807. "time_colour",
  808. "colour_aff_time_colour",
  809. "colour_operation",
  810. "multiply",
  811. "set",
  812. // FlockCenteringAffector: No properties itself
  813. // BaseForceAffector
  814. "force_vector",
  815. "force_application",
  816. "force_aff_vector",
  817. "force_aff_application",
  818. "add",
  819. "average",
  820. // ForceFieldAffector
  821. "forcefield_type",
  822. "realtime",
  823. "matrix",
  824. "delta",
  825. "force",
  826. "octaves",
  827. "frequency",
  828. "amplitude",
  829. "persistence",
  830. "forcefield_size",
  831. "worldsize",
  832. "ignore_negative_x",
  833. "ignore_negative_y",
  834. "ignore_negative_z",
  835. "movement",
  836. "movement_frequency",
  837. // GeometryRotator
  838. "geom_rot_use_own_rotation",
  839. "geom_rot_rotation_speed",
  840. "geom_rot_axis",
  841. // GravityAffector
  842. "gravity",
  843. // InterParticleCollider
  844. "adjustment",
  845. "collision_response",
  846. "ip_adjustment",
  847. "ip_collision_response",
  848. "average_velocity",
  849. "angle_based_velocity",
  850. // JetAffector
  851. "jet_aff_accel",
  852. // LineAffector
  853. "end",
  854. "drift",
  855. "line_aff_max_deviation",
  856. "line_aff_time_step",
  857. "line_aff_end",
  858. "line_aff_drift",
  859. // LinearForceAffector: No properties itself
  860. // ParticleFollower
  861. "follower_max_distance",
  862. "follower_min_distance",
  863. "max_distance",
  864. "min_distance",
  865. // PathFollower
  866. "path_follower_point",
  867. // PlaneCollider
  868. "plane_collider_normal",
  869. // Randomiser
  870. "rand_aff_max_deviation_x",
  871. "rand_aff_max_deviation_y",
  872. "rand_aff_max_deviation_z",
  873. "max_deviation_x",
  874. "max_deviation_y",
  875. "max_deviation_z",
  876. "rand_aff_time_step",
  877. "rand_aff_direction",
  878. "use_direction",
  879. // ScaleAffector
  880. "xyz_scale",
  881. "x_scale",
  882. "y_scale",
  883. "z_scale",
  884. // ScaleVelocityAffector
  885. "velocity_scale",
  886. "stop_at_flip",
  887. // SineForceAffector
  888. "sinef_aff_frequency_min",
  889. "sinef_aff_frequency_max",
  890. "min_frequency",
  891. "max_frequency",
  892. // SphereCollider
  893. "sphere_collider_radius",
  894. // TextureAnimator
  895. "time_step_animation",
  896. "texture_coords_start",
  897. "texture_coords_end",
  898. "start_texture_coords_range",
  899. "end_texture_coords_range",
  900. "texture_animation_type",
  901. "texture_start_random",
  902. "loop",
  903. "up_down",
  904. "random",
  905. // TextureRotator
  906. "tex_rot_use_own_rotation",
  907. "tex_rot_speed",
  908. "tex_rot_rotation",
  909. // VelocityMatchingAffector
  910. "velocity_matching_radius",
  911. // VortexAffector
  912. "vortex_aff_vector",
  913. "vortex_aff_speed",
  914. // ------------------------- Observers -------------------------
  915. // OnClearObserver: No properties itself
  916. // OnCollisionObserver: No properties itself
  917. // OnCountObserver
  918. "count_threshold",
  919. // OnEmissionObserver: No properties itself
  920. // OnEventFlagObserver
  921. "event_flag",
  922. // OnExpireObserver: No properties itself
  923. // OnPositionObserver
  924. "position_x",
  925. "position_y",
  926. "position_z",
  927. // OnQuotaObserver: No properties itself
  928. // OnRandomObserver
  929. "random_threshold",
  930. // OnTimeObserver
  931. "on_time",
  932. // OnVelocityObserver
  933. "velocity_threshold",
  934. // ------------------------- Event Handlers -------------------------
  935. // DoAffectorEventHandler
  936. "force_affector",
  937. "pre_post",
  938. // DoEnableComponentEventHandler
  939. "enable_component",
  940. "emitter_component",
  941. "affector_component",
  942. "technique_component",
  943. "observer_component",
  944. // DoExpireEventHandler: No properties itself
  945. // DoFreezeEventHandler: No properties itself
  946. // DoPlacementParticleEventHandler
  947. "force_emitter",
  948. "number_of_particles",
  949. "inherit_position",
  950. "inherit_direction",
  951. "inherit_orientation",
  952. "inherit_time_to_live",
  953. "inherit_mass",
  954. "inherit_texture_coord",
  955. "inherit_colour",
  956. "inherit_width",
  957. "inherit_height",
  958. "inherit_depth",
  959. // DoScaleEventHandler
  960. "scale_fraction",
  961. "scale_type",
  962. "st_time_to_live",
  963. "st_velocity",
  964. // DoStopSystemEventHandler: No properties itself
  965. // ------------------------- Behaviours -------------------------
  966. // SlaveBehaviour: No properties itself
  967. // ------------------------- Externs -------------------------
  968. // BoxColliderExtern: Defined in BoxCollider
  969. // GravityExtern: Defined in GravityAffector
  970. // PhysXActorExtern
  971. "physx_shape",
  972. "physx_actor_group",
  973. "physx_shape_group",
  974. "physx_group_mask",
  975. "physx_angular_velocity",
  976. "physx_angular_damping",
  977. "physx_material_index",
  978. "shape",
  979. "actor_group",
  980. "shape_group",
  981. "angular_velocity",
  982. "angular_damping",
  983. "material_index",
  984. "Box",
  985. "Sphere",
  986. "Capsule",
  987. // PhysXFluidExtern
  988. "rest_particles_per_meter",
  989. "rest_density",
  990. "kernel_radius_multiplier",
  991. "motion_limit_multiplier",
  992. "collision_distance_multiplier",
  993. "packet_size_multiplier",
  994. "stiffness",
  995. "viscosity",
  996. "surface_tension",
  997. "damping",
  998. "external_acceleration",
  999. "restitution_for_static_shapes",
  1000. "dynamic_friction_for_static_shapes",
  1001. "static_friction_for_static_shapes",
  1002. "attraction_for_static_shapes",
  1003. "restitution_for_dynamic_shapes",
  1004. "dynamic_friction_for_dynamic_shapes",
  1005. "static_friction_for_dynamic_shapes",
  1006. "attraction_for_dynamic_shapes",
  1007. "collision_response_coefficient",
  1008. "collision_group",
  1009. "simulation_method",
  1010. "collision_method",
  1011. "flags",
  1012. "visualization",
  1013. "disable_gravity",
  1014. "collision_twoway",
  1015. "fluid_enabled",
  1016. "hardware",
  1017. "priority_mode",
  1018. "project_to_plane",
  1019. "strict_cooking_format",
  1020. "intercollision",
  1021. "no_intercollision",
  1022. "mix_intercollision",
  1023. "static",
  1024. "dynamic",
  1025. // SceneDecoratorExtern
  1026. "scene_mesh_name",
  1027. "scene_material_name",
  1028. "scene_node_scale",
  1029. "scene_node_position",
  1030. // SphereColliderExtern: Defined in SphereCollider
  1031. // VortexExtern: Defined in VortexAffector
  1032. };
  1033. /**script translator*/
  1034. class PUScriptTranslator
  1035. {
  1036. public:
  1037. PUScriptTranslator();
  1038. virtual ~PUScriptTranslator();
  1039. public:
  1040. static bool getFloat(const PUAbstractNode &node, float *result);
  1041. static bool getInt(const PUAbstractNode &node, int *result);
  1042. static bool getUInt(const PUAbstractNode &node, unsigned int *result);
  1043. static bool getBoolean(const PUAbstractNode &node, bool *result);
  1044. static bool getString(const PUAbstractNode &node, std::string *result);
  1045. //protected:
  1046. // virtual void translate(PUScriptCompiler *compiler, const PUConcreteNode &node) = 0;
  1047. public:
  1048. // Define validation types
  1049. enum ValidationType
  1050. {
  1051. VAL_REAL,
  1052. VAL_BOOL,
  1053. VAL_UINT,
  1054. VAL_INT,
  1055. VAL_STRING,
  1056. VAL_VECTOR2,
  1057. VAL_VECTOR3,
  1058. VAL_VECTOR4,
  1059. VAL_COLOURVALUE,
  1060. VAL_QUATERNION
  1061. };
  1062. /** @See ScriptTranslator
  1063. */
  1064. virtual void translate(PUScriptCompiler* /*compiler*/, PUAbstractNode* /*node*/)
  1065. {
  1066. // No own implementation
  1067. }
  1068. /** Only parses a certain child property
  1069. */
  1070. virtual bool translateChildProperty(PUScriptCompiler* /*compiler*/, PUAbstractNode* /*node*/)
  1071. {
  1072. // No own implementation
  1073. return false;
  1074. }
  1075. /** Only parses a certain child objec
  1076. */
  1077. virtual bool translateChildObject(PUScriptCompiler* /*compiler*/, PUAbstractNode* /*node*/)
  1078. {
  1079. // No own implementation
  1080. return false;
  1081. }
  1082. /** Parse Vector2
  1083. */
  1084. bool getVector2(PUAbstractNodeList::const_iterator i,
  1085. PUAbstractNodeList::const_iterator end,
  1086. Vec2* result,
  1087. int maxEntries = 2);
  1088. /** Parse Vector3
  1089. */
  1090. bool getVector3(PUAbstractNodeList::const_iterator i,
  1091. PUAbstractNodeList::const_iterator end,
  1092. Vec3* result,
  1093. int maxEntries = 3);
  1094. /** Parse Vector4
  1095. */
  1096. bool getVector4(PUAbstractNodeList::const_iterator i,
  1097. PUAbstractNodeList::const_iterator end,
  1098. Vec4* result,
  1099. int maxEntries = 4);
  1100. /** Parse Quaternion
  1101. */
  1102. bool getQuaternion(PUAbstractNodeList::const_iterator i,
  1103. PUAbstractNodeList::const_iterator end,
  1104. Quaternion* result,
  1105. int maxEntries = 4);
  1106. /** Validate a property.
  1107. */
  1108. bool passValidateProperty(PUScriptCompiler* compiler,
  1109. PUPropertyAbstractNode* prop,
  1110. const std::string& token,
  1111. ValidationType validationType);
  1112. /** Validate whether a property has values.
  1113. */
  1114. bool passValidatePropertyNoValues(PUScriptCompiler* compiler,
  1115. PUPropertyAbstractNode* prop,
  1116. const std::string& token);
  1117. /** Validate whether the number of values is correct.
  1118. */
  1119. bool passValidatePropertyNumberOfValues(PUScriptCompiler* compiler,
  1120. PUPropertyAbstractNode* prop,
  1121. const std::string& token,
  1122. unsigned short numberOfValues);
  1123. /** Validate whether the number of values is between a range.
  1124. */
  1125. bool passValidatePropertyNumberOfValuesRange(PUScriptCompiler* compiler,
  1126. PUPropertyAbstractNode* prop,
  1127. const std::string& token,
  1128. unsigned short minNumberOfValues,
  1129. unsigned short maxNumberOfValues);
  1130. /** Validate whether the value is a correct Real.
  1131. */
  1132. bool passValidatePropertyValidReal(PUScriptCompiler* compiler, PUPropertyAbstractNode* prop);
  1133. /** Validate whether the value is a correct int.
  1134. */
  1135. bool passValidatePropertyValidInt(PUScriptCompiler* compiler, PUPropertyAbstractNode* prop);
  1136. /** Validate whether the value is a correct uint.
  1137. */
  1138. bool passValidatePropertyValidUint(PUScriptCompiler* compiler, PUPropertyAbstractNode* prop);
  1139. /** Validate whether the value is a correct bool.
  1140. */
  1141. bool passValidatePropertyValidBool(PUScriptCompiler* compiler, PUPropertyAbstractNode* prop);
  1142. /** Validate whether the value is a correct Vector2.
  1143. */
  1144. bool passValidatePropertyValidVector2(PUScriptCompiler* compiler, PUPropertyAbstractNode* prop);
  1145. /** Validate whether the value is a correct Vector3.
  1146. */
  1147. bool passValidatePropertyValidVector3(PUScriptCompiler* compiler, PUPropertyAbstractNode* prop);
  1148. /** Validate whether the value is a correct Vector4.
  1149. */
  1150. bool passValidatePropertyValidVector4(PUScriptCompiler* compiler, PUPropertyAbstractNode* prop);
  1151. /** Validate whether the value is a correct Quaternion.
  1152. */
  1153. bool passValidatePropertyValidQuaternion(PUScriptCompiler* compiler, PUPropertyAbstractNode* prop);
  1154. /** Adds an error to the compiler: An unknown token is read.
  1155. */
  1156. void errorUnexpectedToken(PUScriptCompiler* compiler, PUAbstractNode* node);
  1157. /** Adds an error to the compiler: An unknown property is read.
  1158. */
  1159. void errorUnexpectedProperty(PUScriptCompiler* compiler, PUPropertyAbstractNode* prop);
  1160. void processNode(PUScriptCompiler *compiler, PUAbstractNode *node);
  1161. virtual bool isParticleSystemTranslator() const { return false; }
  1162. };
  1163. NS_CC_END
  1164. #endif /* defined(__ssaafsdf__CCScriptTranslator__) */