-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmoEffectParticlesFractal.h
More file actions
1401 lines (1105 loc) · 44 KB
/
moEffectParticlesFractal.h
File metadata and controls
1401 lines (1105 loc) · 44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*******************************************************************************
moEffectParticlesFractal.h
****************************************************************************
* *
* This source is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This code is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* General Public License for more details. *
* *
* A copy of the GNU General Public License is available on the World *
* Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
* obtain it by writing to the Free Software Foundation, *
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
****************************************************************************
Copyright(C) 2006 Fabricio Costa
Authors:
Fabricio Costa
TODO:
1) ColorIn
2) ColorOut
3) BreakIn
4) BreakOut
5) Script general
6) Script por particula ( se ejecuta por cada particula ) ( acceso a eventos [tecla presionada...] )
*) movimiento y posicionamieno de particuclas....
7) parametro desfazaje de movimiento??? que sea una opcion...
8) Improve the orientation modes... they dont work correctly
*******************************************************************************/
#ifndef __MO_EFFECT_PARTICLESFRACTAL_H__
#define __MO_EFFECT_PARTICLESFRACTAL_H__
#include "moTypes.h"
#include "moTimer.h"
#include "moTempo.h"
#include "moPlugin.h"
#include "moTimeManager.h"
#include "moFilterManager.h"
#define MO_PARTICLES_TRANSLATE_X 0
#define MO_PARTICLES_TRANSLATE_Y 1
#define MO_PARTICLES_SCALE_X 2
#define MO_PARTICLES_SCALE_Y 3
#define COSPI6 0.866025404
/// Reference to Cell Code language
/**
https://docs.google.com/spreadsheets/d/1DvcC5bnDPubQiTJFNuCGK4MrtGrVqnXdf4kV5KaEt0U/edit#gid=0
*/
///Emitter Geometry Mode
/**
* \if spanish
* <b>"geometry_mode"</b>: <em>Tipo de Geometría</em>
* Parámetro del efecto @ref moParticlesFractal
* El tipo de geometría es la configuración geométrica de la partícula en relacion a su espacio, y a las otras partículas
*
* \else
* <b>"geometry_mode"</b>: <em>Geometry (Shader) Mode</em>
* Parámetro del efecto @ref moParticlesFractal
* The geometry mode is the geometric configuration of each particle, how each particle will be drawn. The shape depends on
* specific parameters, emitter type, space, medium and the others particles.
* \endif
*/
enum moParticlesFractalGeometryMode {
/// 0: \if spanish Points \else Puntos \endif
PARTICLES_GEOMETRY_MODE_POINTS = 0,
/// 1: \if spanish Lines \else Lines \endif
PARTICLES_GEOMETRY_MODE_LINES = 1,
/// 2: \if spanish Triangles \else Triangles \endif
PARTICLES_GEOMETRY_MODE_TRIANGLES = 2,
/// 3: \if spanish Quads \else Quads \endif
PARTICLES_GEOMETRY_MODE_QUADS = 3,
/// 4: \if spanish Pluma \else Feather \endif
PARTICLES_GEOMETRY_MODE_FEATHER = 4,
/// 5: \if spanish Tetrahedro \else Tetrahedra \endif
PARTICLES_GEOMETRY_MODE_TETRA = 5,
/// 6: \if spanish Arbol \else Tree \endif
PARTICLES_GEOMETRY_MODE_TREE = 6,
/// 7: \if spanish Cono \else Cone \endif
PARTICLES_GEOMETRY_MODE_CONE = 7,
/// 8: \if spanish Célula Voronoi \else Voronoi Cell \endif
PARTICLES_GEOMETRY_MODE_VORONOI = 8,
/// 9: \if spanish Instancia \else Instance \endif
PARTICLES_GEOMETRY_MODE_INSTANCE = 9
} ;
static const char *moParticlesFractalGeometryModeStr[] = {
"Points",
"Lines",
"Triangles",
"Quads",
"Feather",
"Tetra",
"Tree",
"Cone",
"Voronoi",
"Instance",
NULL
};
///Emitter Type
/**
* \if spanish
* <b>"emittertype"</b>: <em>Tipo de emisor</em>
* Parámetro del efecto @ref moParticlesFractal
* El tipo de emisor es la configuración geométrica del espacio dónde nacen las partículas. Algo así como la incubadora de las partículas.
*
* \else
* <b>"emittertype"</b>: <em>Emitter Type is a parameter of the ParticlesSimple Effect Plugin @ref moParticlesSimple</em>
* Parameter of @ref moParticlesSimple
* The emitter type is the geometric base configuration where the particles can be born.
* \endif
*
* \if spanish <h4>Nombre del parámetro:</h4> \else <h4>Parameter name</h4> \endif @ref emittertype
* \if spanish <h4>Todos los parámetros:</h4> \else <h4>All parameters:</h4> \endif @ref ParticlesSimpleParameters
*
* @see moParticlesSimple
* @see moEffectParticlesSimple
*/
enum moParticlesSimpleEmitterType {
/// 0: \if spanish Grilla (un rectángulo de "width" x "height") 2D \else Grid shape emitter 2D \endif
PARTICLES_EMITTERTYPE_GRID = 0,
/// 1: \if spanish Esfera (una esfera de "width" longitudes y "height" latitudes) 3D \else Sphere shape emitter ( x=width, y=height, z=depth ) 3D \endif
PARTICLES_EMITTERTYPE_SPHERE = 1,
/// 2: \if spanish 2: Tubo ( un tubo de "width" facetas y "height" segmentos) 3D \else Tube shape emitter (3C) \endif
PARTICLES_EMITTERTYPE_TUBE = 2,
/// 3: \if Chorro ( colapsados en una línea ) \else Line shape emitter (3d) vector line (x,y,z) \endif
PARTICLES_EMITTERTYPE_JET = 3,
/// 4: \if spanish Punto ( colapsados en un punto ) \else point shape, position (x,y,z) \endif
PARTICLES_EMITTERTYPE_POINT = 4,
/// 5: \if spanish Trackeador ( reservado para información de sensado ) \else emitter is a connected tracker \endif
PARTICLES_EMITTERTYPE_TRACKER = 5,
/// 6: \if spanish Trackeador2 ( reservado para información de sensado ) \else emitter is a secondary connected tracker \endif
PARTICLES_EMITTERTYPE_TRACKER2 = 6,
/// 7: \if spanish Espiral ( forma de espiral, "width" ángulos que forman "height" ciclos ) \else Emitter is a spiral \endif
PARTICLES_EMITTERTYPE_SPIRAL = 7,
/// 8: \if spanish Círculo ( una ronda de "width"X"height" partículas ) \else emitter is a circle \endif
PARTICLES_EMITTERTYPE_CIRCLE = 8,
/// 9: \if spanish Crecimiento ramificado \else Tree growing cells \endif
PARTICLES_EMITTERTYPE_TREE = 9
};
///Folder Shot Type
/**
* Folder
*/
enum moParticlesSimpleFolderShotType {
/// 0: filename screenshot has a random id
PARTICLES_SHOTTYPE_FOLDER_RANDOM = 0,
/// 0: filename screenshot is date based
PARTICLES_SHOTTYPE_FOLDER_SEQUENTIAL_BY_FILEDATE = 1,
/// 0: filename screenshot is name based
PARTICLES_SHOTTYPE_FOLDER_SEQUENTIAL_BY_FILENAME = 2
};
///Attractor Type
enum moParticlesSimpleAttractorType {
/// 0: each particle attract diretly to the same point
PARTICLES_ATTRACTORTYPE_POINT = 0,
/// 1: each particle attract perp to a face of the grid
PARTICLES_ATTRACTORTYPE_GRID = 1,
/// 2: each particle attract perp to a face of the grid
PARTICLES_ATTRACTORTYPE_SPHERE = 2,
/// 3: each particle attract perp to a face of the grid
PARTICLES_ATTRACTORTYPE_TUBE = 3,
/// 4: each particle attract perpendicular to jet vector
PARTICLES_ATTRACTORTYPE_JET = 4,
/// 5: each particle attract each one to a dot of the tracker
PARTICLES_ATTRACTORTYPE_TRACKER = 5,
/// 6: each particle attract each one to a dot of the tracker
PARTICLES_ATTRACTORTYPE_VERTEX = 6
};
///Attractor Mode
enum moParticlesSimpleAttractorMode {
/// 0: accelerate with no stop
PARTICLES_ATTRACTORMODE_ACCELERATION = 0,
/// 1: accelerate, reach and stop instantly
PARTICLES_ATTRACTORMODE_STICK = 1,
/// 2: accelerate and bounce....(inverse direction)
PARTICLES_ATTRACTORMODE_BOUNCE = 2,
/// 3: accelerate and breaks (generate debris on place)
PARTICLES_ATTRACTORMODE_BREAKS = 3,
/// 4: accelerate then brake and slowdown slowly
PARTICLES_ATTRACTORMODE_BRAKE = 4,
/// 5: constant speed to attractortype
PARTICLES_ATTRACTORMODE_LINEAR = 5
};
///Behaviour Mode
enum moParticlesSimpleBehaviourMode {
/// 0: las partículas son atraídas entre ellas
PARTICLES_BEHAVIOUR_COHESION = 0,
/// 1: las partículas son libres y mantienen una distancia mínima de separación
PARTICLES_BEHAVIOUR_SEPARATION = 1,
/// 2: las partículas son repelidas entre ellas
PARTICLES_BEHAVIOUR_AVOIDANCE = 2,
/// 3: las partículas se alinean y acomodan cristalmente
PARTICLES_BEHAVIOUR_ALIGNMENT = 3
};
///Texture Mode
enum moParticlesSimpleTextureMode {
/// 0: One Same Texture Image for each Particle (taken from texture)
PARTICLES_TEXTUREMODE_UNIT = 0,
/// 1: Same Texture Image Divided In Different Fragments for each Particle (taken from texture, divided in width*height)
PARTICLES_TEXTUREMODE_PATCH = 1,
/// 2: Many Different Textures Image for each Particle ( taken from texturefolder )
PARTICLES_TEXTUREMODE_MANY = 2,
/// 3: Many textures/particle to construct a patched texture one ( taken from texturefolder, build the one defined on texture parameter, or from a folder, call to Shot(source) then ReInit to build... )
PARTICLES_TEXTUREMODE_MANY2PATCH = 3,
/// 4: Many Different Textures Image for each Particle ( taken from texturefolder in loading order! )
PARTICLES_TEXTUREMODE_MANYBYORDER = 4
};
static moTextArray TextureModeOptions;
///Creation Method
enum moParticlesCreationMethod {
/// 0: \if spanish Alineado. Los lugares de nacimientos están alineados con el orden de los vertices del emisor. \else Aligned. Particles birth position follow the emitter vertices order. \endif
PARTICLES_CREATIONMETHOD_LINEAR=0,
/// 1: \if spanish Superficial. Los lugares de nacimientos están diseminados sobre la superficie del emisor aleatoriamente. \else Surface. Particles birth position follow randomly the surface of the emitter. \endif
PARTICLES_CREATIONMETHOD_PLANAR=1,
/// 2: \if spanish Volumétrico. Los lugares de nacimientos están diseminados dentro del volumen del emisor aleatoriamente. \else Volumetric. Particles birth position are into the volume of the emitter. \endif
PARTICLES_CREATIONMETHOD_VOLUMETRIC=2,
/// 3: \if spanish Central. Los lugares de nacimiento están colapsados en el centro del emisor. \else Central. Particles birth position are collapsed into the emitter center position. \endif
PARTICLES_CREATIONMETHOD_CENTER=3
};
///Random Method
enum moParticlesRandomMethod {
/// 0: \if spanish Ruidoso. \else Noisy \endif
PARTICLES_RANDOMMETHOD_NOISY=0,
/// 1: \if spanish Co-Lineal. \else Co-Linear \endif
PARTICLES_RANDOMMETHOD_COLINEAR=1,
/// 2: \if spanish Perpendicular. \else Perpendicular. \endif
PARTICLES_RANDOMMETHOD_PERPENDICULAR=2
};
///Orientation Method
enum moParticlesOrientationMode {
/// 0: \if spanish Fijo. \else Default position. \endif
PARTICLES_ORIENTATIONMODE_FIXED=0,
/// 1: \if spanish De frente al observador. \else Facing camera. \endif
PARTICLES_ORIENTATIONMODE_CAMERA=1,
/// 2: \if spanish Según el vector velocidad. \else Following motion direction. \endif
PARTICLES_ORIENTATIONMODE_MOTION=2,
/// 3: \if spanish Según el vector aceleración. \else Following acceleration direction vector. \endif
PARTICLES_ORIENTATIONMODE_ACCELERATION=3,
/// 4: \if spanish Según la normal de la generatriz \else Following generator normal vector \endif
PARTICLES_ORIENTATIONMODE_NORMAL=4,
/// 5: \if spanish Según la normal personalizada en los parametros NORMAL_PARTICLEX|Y|Z \else Following generator normal vector defined in parameters NORMAL_PARTICLEX|Y|Z \endif
PARTICLES_ORIENTATIONMODE_CUSTOMNORMAL=5
};
enum moParticlesOrderingMode {
/// 0: \if spanish Sin reordenamiento espacial, sigue el orden de la matriz WxH. \else no reordering for drawing \endif
PARTICLES_ORDERING_MODE_NONE=0,
/// 1: \if spanish Ordenamiento por profundidad de pixel (ZBuffer) \else Ordering using depth field (ZBuffer) \endif
PARTICLES_ORDERING_MODE_ZDEPTHTEST=1,
/// 2: \if spanish Ordenamiento por coordenada Z \else Ordering using z coordinate \endif
PARTICLES_ORDERING_MODE_ZPOSITION=2,
/// 3: \if spanish Ordenamiento por distancia a la cámara \else Ordering using camera distance to particle \endif
PARTICLES_ORDERING_MODE_COMPLETE=3
};
enum moParticlesSimpleLightMode {
/// 0: \if spanish Sin luces. \else No lights \endif
PARTICLES_LIGHTMODE_NONE=0,
/// 1: point \if spanish Luz omnidireccional \else Omnidirectional light \endif
PARTICLES_LIGHTMODE_OMNI=1,
/// 1: spot \if spanish Luz direccional \else Directional light \endif
PARTICLES_LIGHTMODE_SPOT=2
};
enum moParticlesFractalParamIndex {
PARTICLES_INLET,
PARTICLES_OUTLET,
PARTICLES_SCRIPT,
PARTICLES_ALPHA,
PARTICLES_COLOR,
PARTICLES_SYNC,
PARTICLES_PHASE,
PARTICLES_GUIDES,
PARTICLES_MATURITY,
PARTICLES_LEFT_REP_ANGLE_MIN,
PARTICLES_LEFT_REP_ANGLE_MAX,
PARTICLES_RIGHT_REP_ANGLE_MIN,
PARTICLES_RIGHT_REP_ANGLE_MAX,
PARTICLES_LEFT_MOV_ANGLE_MIN,
PARTICLES_LEFT_MOV_ANGLE_MAX,
PARTICLES_RIGHT_MOV_ANGLE_MIN,
PARTICLES_RIGHT_MOV_ANGLE_MAX,
PARTICLES_PARTICLECOLOR,
PARTICLES_FONT,
PARTICLES_TEXT,
PARTICLES_ORTHO,
PARTICLES_TEXTURE,
PARTICLES_FOLDERS,
PARTICLES_TEXTURE_CODE,
PARTICLES_TEXTURE_MEMORY,
PARTICLES_TEXTURE_MEDIUM,
PARTICLES_TEXTURE_ALTITUDE,
PARTICLES_TEXTURE_VARIABILITY,
PARTICLES_TEXTURE_CONFIDENCE,
PARTICLES_TEXTUREMODE,
PARTICLES_BLENDING,
PARTICLES_WIDTH,
PARTICLES_HEIGHT,
PARTICLES_MEMORY,
PARTICLES_CODE,
PARTICLES_SIZEX,
PARTICLES_SIZEY,
PARTICLES_SIZEZ,
PARTICLES_GRAVITY,
PARTICLES_VISCOSITY,
PARTICLES_MAXAGE,
PARTICLES_EMITIONPERIOD,
PARTICLES_EMITIONRATE,
PARTICLES_DEATHPERIOD,
PARTICLES_SCRIPT2,
PARTICLES_FADEIN,
PARTICLES_FADEOUT,
PARTICLES_SIZEIN,
PARTICLES_SIZEOUT,
PARTICLES_RANDOMMETHOD,
PARTICLES_CREATIONMETHOD,
PARTICLES_ORIENTATIONMODE,
PARTICLES_RANDOMPOSITION,
PARTICLES_RANDOMPOSITION_X,
PARTICLES_RANDOMPOSITION_Y,
PARTICLES_RANDOMPOSITION_Z,
PARTICLES_RANDOMVELOCITY,
PARTICLES_RANDOMVELOCITY_X,
PARTICLES_RANDOMVELOCITY_Y,
PARTICLES_RANDOMVELOCITY_Z,
PARTICLES_RANDOMMOTION,
PARTICLES_RANDOMMOTION_X,
PARTICLES_RANDOMMOTION_Y,
PARTICLES_RANDOMMOTION_Z,
PARTICLES_EMITTERTYPE,
PARTICLES_EMITTERVECTOR_X,
PARTICLES_EMITTERVECTOR_Y,
PARTICLES_EMITTERVECTOR_Z,
PARTICLES_ATTRACTORTYPE,
PARTICLES_ATTRACTORMODE,
PARTICLES_ATTRACTORVECTOR_X,
PARTICLES_ATTRACTORVECTOR_Y,
PARTICLES_ATTRACTORVECTOR_Z,
PARTICLES_ROTATEX_PARTICLE,
PARTICLES_ROTATEY_PARTICLE,
PARTICLES_ROTATEZ_PARTICLE,
PARTICLES_SCALEX_PARTICLE,
PARTICLES_SCALEY_PARTICLE,
PARTICLES_SCALEZ_PARTICLE,
PARTICLES_TIMETOREVELATION,
PARTICLES_TIMEOFREVELATION,
PARTICLES_TIMETORESTORATION,
PARTICLES_TIMEOFRESTORATION,
PARTICLES_DRAWINGFEATURES,
PARTICLES_TRANSLATEX,
PARTICLES_TRANSLATEY,
PARTICLES_TRANSLATEZ,
PARTICLES_SCALEX,
PARTICLES_SCALEY,
PARTICLES_SCALEZ,
PARTICLES_ROTATEX,
PARTICLES_ROTATEY,
PARTICLES_ROTATEZ,
PARTICLES_EYEX,
PARTICLES_EYEY,
PARTICLES_EYEZ,
PARTICLES_VIEWX,
PARTICLES_VIEWY,
PARTICLES_VIEWZ,
PARTICLES_UPVIEWX,
PARTICLES_UPVIEWY,
PARTICLES_UPVIEWZ,
PARTICLES_RANDOMCOLORFUNCTION,
PARTICLES_SEPARATION,
PARTICLES_TEXTURE_OPACITY,
PARTICLES_TEXTURE_OFF_X,
PARTICLES_TEXTURE_OFF_Y,
PARTICLES_TEXTURE_SCALE_X,
PARTICLES_TEXTURE_SCALE_Y,
PARTICLES_TEXTURE_ROTATION,
PARTICLES_TEXTURE_2,
PARTICLES_TEXTURE_2_MODE,
PARTICLES_TEXTURE_2_OPACITY,
PARTICLES_TEXTURE_2_OFF_X,
PARTICLES_TEXTURE_2_OFF_Y,
PARTICLES_TEXTURE_2_SCALE_X,
PARTICLES_TEXTURE_2_SCALE_Y,
PARTICLES_TEXTURE_2_ROTATION,
PARTICLES_DIFFMAX,
PARTICLES_GEOMETRY_MODE,
PARTICLES_GEOMETRY_SHADER_OFF,
PARTICLES_FEATHER_SEGMENTS,
PARTICLES_FEATHER_LENGTH,
PARTICLES_FEATHER_HEAD,
PARTICLES_FEATHER_DYNAMIC,
/*
PARTICLES_ORDERING_MODE,
*/
PARTICLES_LIGHTMODE,
PARTICLES_LIGHTX,
PARTICLES_LIGHTY,
PARTICLES_LIGHTZ
/*
PARTICLES_ORDERING_MODE*/
};
class moStateFilterParams : public moTextFilterParam {
public:
moStateFilterParams() {
}
virtual ~moStateFilterParams() {}
};
class moParticlesFractal : public moAbstract {
public:
moParticlesFractal() {
Pos3d = moVector3f(0.0,0.0,0.0);
Destination = moVector3f(0.0,0.0,0.0);
Velocity = moVector3f(0.0,0.0,0.0);
Force = moVector3f(0.0,0.0,0.0);
U = moVector3f(0.0,0.0,0.0);
V = moVector3f(0.0,0.0,0.0);
W = moVector3f(0.0,0.0,0.0);
dpdt = moVector3f(0.0,0.0,0.0);
dvdt = moVector3f(0.0,0.0,0.0);
Rotation = moVector3f(0.0,0.0,0.0);
Pos = moVector2f(0.0,0.0);
TCoord = moVector2f(0.0,0.0);
TCoord2 = moVector2f(0.0,0.0);
Size = moVector2f(0.0,0.0);
TSize = moVector2f(0.0,0.0);
TSize2 = moVector2f(0.0,0.0);
Color = moVector3f(1.0,1.0,1.0);
Mass = 1.0;
Alpha = 1.0;
Scale = 1.0;
ImageProportion = 1.0;
Fixed = false;
Visible = false;
Captured = false;
/* Graphics */
GLId = -1;
GLId2 = -1;
pTextureMemory = NULL;
MOId = -1;
ActualFrame = 0;
FrameCount = 0;
FramePS = 0;
FrameForced = false;
MaxAge = 0; //depends on Physics.MaxAge first....
Age.Stop();
}
virtual ~moParticlesFractal() {}
///Position absolute
moVector3f Pos3d;
///Destination
moVector3f Destination;
///Speed or Velocity vector
moVector3f Velocity;
///Self force (propulsion) of the particle
moVector3f Force;
///Particles Vectors
///position relative to grid...
/**
Works for indexation on a grid relative geometry ( bidimentional array )
X > i [0..width]
Y > j [0..height]
*/
moVector2f Pos;//relativo a una grilla
///texture coordinate
moVector2f TCoord;
moVector2f TCoord2;
///particle size
/**
This size is dependent on particles number and Emitter size
Size.X > EmitterSize.X() / m_cols
Size.Y > EmitterSize.Y() / m_rows
*/
moVector2f Size;
///particle texture size
moVector2f TSize;
moVector2f TSize2;
///particle orientation
/**
Dependant on Orientation Mode
*/
moVector3f U,V,W;
///Differentials of position (speed) and velocity (acceleration)
moVector3f dpdt;
moVector3f dvdt;
///Mass in g of the particle
double Mass;
///No motion
bool Fixed;
///Exists but is invisible
bool Visible;
///Captured
/**
Captured by the general script, out of normal flow
*/
bool Captured;
///Transparency of the particle
double Alpha;
///Scale of the particle
double Scale;
///Angle of the particle
moVector3f Rotation;
///Unique ID of OpenGL Texture
MOint GLId;///para asociar la textura al momento de la creación
MOint GLId2;
moTextureMemory *pTextureMemory;
bool FrameForced;
int MOId;
MOuint ActualFrame;
MOuint FrameCount;
MOuint FramePS;
///Texture image proportion Width / Height ....
float ImageProportion;
moVector3f Color;
///Age of the particle
moTimer Age;
long MaxAge;
};
class moParticlesFractalPhysics : public moAbstract {
public:
moParticlesFractalPhysics() {
m_GravityCenter = moVector3f(0.0,0.0,0.0);
m_GravityVector = moVector3f(0.0,0.0,0.0);
m_GravityDisc = moVector3f(0.0,0.0,0.0);
m_Plane = moVector3f(0.0,0.0,0.0);
m_MaxAge = 0;
m_EmitionPeriod = 0;
m_EmitionRate = 0;
m_DeathPeriod = 0;
m_CreationMethod = PARTICLES_CREATIONMETHOD_LINEAR;
m_RandomMethod = PARTICLES_RANDOMMETHOD_NOISY;
m_OrientationMode = PARTICLES_ORIENTATIONMODE_FIXED;
m_OrderingMode = PARTICLES_ORDERING_MODE_NONE;
m_FadeIn = 0.0;
m_FadeOut = 0.0;
m_SizeIn = 0.0;
m_SizeOut = 0.0;
m_EmitterType = PARTICLES_EMITTERTYPE_GRID;
m_EmitterSize = moVector3f( 0.0, 0.0, 0.0 );
m_EmitterVector = moVector3f( 0.0, 0.0, 0.0 );
m_AttractorType = PARTICLES_ATTRACTORTYPE_POINT;
m_AttractorMode = PARTICLES_ATTRACTORMODE_ACCELERATION;
m_AttractorVector = moVector3f( 0.0, 0.0, 0.0 );
m_EyeVector = moVector3f( 0.0, 0.0, 0.0 );
m_RandomVelocity = 0.0;
m_VelocityVector = moVector3f( 0.0, 0.0, 0.0 );
m_RandomPosition = 0.0;
m_PositionVector = moVector3f( 0.0, 0.0, 0.0 );
m_RandomMotion = 0.0;
m_MotionVector = moVector3f( 0.0, 0.0, 0.0 );
gravitational = 0.0;
viscousdrag = 0.0;
EmitionTimer.Stop();
m_ParticleScript = moText("");
m_pLastBordParticle = NULL;
}
virtual ~moParticlesFractalPhysics() {}
moVector3f m_GravityCenter;//x,y,z,intensity
moVector3f m_GravityVector;//x,y,z,intensity
moVector3f m_GravityDisc;//normal x, normal y, normal z,intensity
moVector3f m_Plane;
long m_MaxAge;
long m_EmitionPeriod;
long m_EmitionRate;
long m_DeathPeriod;
moParticlesCreationMethod m_CreationMethod;
moParticlesRandomMethod m_RandomMethod;
moParticlesOrientationMode m_OrientationMode;
moParticlesOrderingMode m_OrderingMode;
double m_FadeIn;
double m_FadeOut;
double m_SizeIn;
double m_SizeOut;
moParticlesSimpleEmitterType m_EmitterType;
moVector3f m_EmitterVector;
moVector3f m_EmitterSize;
moParticlesSimpleAttractorType m_AttractorType;
moParticlesSimpleAttractorMode m_AttractorMode;
moVector3f m_AttractorVector;
moVector3f m_EyeVector;
moVector3f m_TargetViewVector;
moVector3f m_UpViewVector;
moVector3f m_SourceLightVector;
moParticlesSimpleLightMode m_SourceLighMode;
double m_RandomVelocity;
moVector3f m_VelocityVector;
double m_RandomPosition;
moVector3f m_PositionVector;
double m_RandomMotion;
moVector3f m_MotionVector;
double gravitational;
double viscousdrag;
moTimer EmitionTimer;
moText m_ParticleScript;
moParticlesFractal* m_pLastBordParticle;
};
enum enumRevelationStatus {
PARTICLES_FULLRESTORED = 0,
PARTICLES_REVEALING = 1,
PARTICLES_REVEALINGALL = 2,
PARTICLES_FULLREVEALED = 3,
PARTICLES_RESTORING = 4,
PARTICLES_RESTORINGALL = 5
};
moDeclareDynamicArray( moParticlesFractal*, moParticlesFractalArray );
typedef std::map< double, moParticlesFractal* > TMapDepthToParticleSimple;
/// Clase Particle Fractal
/**
*
*
* @see moEffect
*/
class moEffectParticlesFractal : public moEffect
{
public:
///Constructor
moEffectParticlesFractal();
///Destructor
virtual ~moEffectParticlesFractal();
///Inicialización
MOboolean Init();
///Dibujado
void Draw(moTempo*, moEffectState* parentstate = NULL);
///Finalizacion
MOboolean Finish();
///Reiniciar el analisis de la imagen
void ReInit();
///Foto de la cámara
void Shot( moText source = moText(""), int shot_type = 0, int shot_file=0 );
///Interacción
void Interaction( moIODeviceManager * );
///Actualización del ciclo de eventos
void Update( moEventList * p_eventlist);
///Definicion de campos
moConfigDefinition * GetDefinition( moConfigDefinition *p_configdefinition );
///Llamada de scripts
int ScriptCalling(moLuaVirtualMachine& vm, int iFunctionNumber);
void TrackParticle( int partid );
void OrderParticles();
int m_nVertexCount; // Vertex Count
moVector3f* m_pVertices;
moVector2f* m_pTexCoords;
moVector4d m_Color;
double m_Alpha;
void BuildVBOs();
// Vertex Buffer Object Names
unsigned int m_nVBOVertices; // Vertex VBO Name
unsigned int m_nVBOTexCoords; // Texture Coordinate VBO Name
bool g_fVBOSupported;
void DrawEmitions( float x, float y, float z, float dx, float dy, float dz, float sx, float sy );
void DrawCohesion( float x, float y, float z, float dx, float dy, float dz, float sx, float sy );
void DrawTexture( moTexture* p_texture, float x, float y, float z, float sx, float sy );
private:
///Actualizar el dt para iteracion de particulas
void UpdateDt();
///Actualizar los parametros de configuración
void UpdateParameters();
void UpdateRenderShader();
///Resetear el temporizador
void ResetTimers();
///Revelar
void RevealingAll();
///
void RestoringAll();
///Inicio del sistema de partículas
void InitParticlesFractal( int p_cols, int p_rows , bool p_forced = true );
///Calcular las fuerzas sobre las partículas
void CalculateForces( bool tmparray = false );
///Calcular los incrementos
void CalculateDerivatives( bool tmparray = false, double dt = 0.0 );
///Actualizar todas las particulas
/**
* Calcula la nueva posición de las partículas utilizando el diferencial de tiempo "dt"
* Llama a Regenerate() para la regeneración de partículas muertas.
*
* @see Regenerate
* @see moParticlesFractalPhysics
*
* @param dt diferencial de tiempo en milisegundos
* @param method método de cálculo de la posición, Euler o Midpoint (Punto medio)
*/
void UpdateParticles( double dt, int method );
///Regeneración de partículas
/**
* Mata aquellas que superaron su tiempo de vida
* Regenera las muertas en función del intervalo de emisión (en milisegundos)
* y la tasa de generación (cantidad de particulas por intervalo)
*
*
*
* @see Regenerate
* @see moParticlesFractalPhysics (m_EmitionPeriod, m_EmitionRate, m_CreationMethod )
* @see moEffectParticlesFractal (texture_mode)
*
*/
void Regenerate();
///Resolvedor de ecuación
double Solver1D( double h, double y0, int method, double (*fcn)(double) );
///Fija la posicion de la particula que se genera
void SetParticlePosition( moParticlesFractal* pParticle );
void ParticlesFractalInfluence( float posx, float posy, float velx, float vely, float veln );
void ParticlesFractalAnimation( moTempo* tempogral, moEffectState* parentstate );
///Dibuja la particula simple
void DrawParticlesFractal( moTempo* tempogral, moEffectState* parentstate );
void DrawParticlesFractalVBO( moTempo* tempogral, moEffectState* parentstate );
void DrawTracker();
/// Funciones para la escritura de scripts específicos de particulas
void RegisterFunctions();
int luaGetDelta(moLuaVirtualMachine& vm);
int luaGetParticleCount(moLuaVirtualMachine& vm);
int luaGetParticle(moLuaVirtualMachine& vm);
int luaGetParticlePosition(moLuaVirtualMachine& vm);
int luaGetParticleSize(moLuaVirtualMachine& vm);
int luaGetParticleScale(moLuaVirtualMachine& vm);
int luaGetParticleVelocity(moLuaVirtualMachine& vm);
int luaGetParticleRotation(moLuaVirtualMachine& vm);
int luaGetParticleGraphics(moLuaVirtualMachine& vm);
int luaGetParticleOpacity(moLuaVirtualMachine& vm);
int luaGetParticleColor(moLuaVirtualMachine& vm);
int luaUpdateParticle( moLuaVirtualMachine& vm );
int luaUpdateParticlePosition( moLuaVirtualMachine& vm );
int luaUpdateParticleSize( moLuaVirtualMachine& vm );
int luaUpdateParticleScale( moLuaVirtualMachine& vm );
int luaUpdateParticleVelocity( moLuaVirtualMachine& vm );
int luaUpdateParticleRotation( moLuaVirtualMachine& vm );
int luaUpdateParticleGraphics( moLuaVirtualMachine& vm );
int luaUpdateParticleOpacity( moLuaVirtualMachine& vm );
int luaUpdateParticleColor( moLuaVirtualMachine& vm );
int luaUpdateForce( moLuaVirtualMachine& vm );
int luaShot(moLuaVirtualMachine& vm);
int luaReInit(moLuaVirtualMachine& vm);
int luaDrawPoint(moLuaVirtualMachine& vm);
int luaGetParticleIntersection(moLuaVirtualMachine& vm);
int lua_id_cell;
int luaCellBeginProgram(moLuaVirtualMachine& vm);
int luaCellAge(moLuaVirtualMachine& vm);
int luaCellDuplicate(moLuaVirtualMachine& vm);
int luaCellElongate(moLuaVirtualMachine& vm);
int luaCellBranch(moLuaVirtualMachine& vm);
int luaCellMutate(moLuaVirtualMachine& vm);
int luaCellCrossover(moLuaVirtualMachine& vm);
int luaCellDie(moLuaVirtualMachine& vm);
int luaCmpMemory(moLuaVirtualMachine& vm);
int luaReadMemory(moLuaVirtualMachine& vm);
int luaWriteMemory(moLuaVirtualMachine& vm);
int luaLoadMemory(moLuaVirtualMachine& vm);
int luaDumpMemory(moLuaVirtualMachine& vm);
int luaCellRotate(moLuaVirtualMachine& vm);
int luaCellGrow(moLuaVirtualMachine& vm);
//int luaCell(moLuaVirtualMachine& vm);
int luaCellUpdateProgram(moLuaVirtualMachine& vm);
int luaCellLink(moLuaVirtualMachine& vm);
int luaCellUnlink(moLuaVirtualMachine& vm);
int luaCellEndProgram(moLuaVirtualMachine& vm);
int luaCellDumpProgram(moLuaVirtualMachine& vm);
int luaCellLoadProgram(moLuaVirtualMachine& vm);
int luaCellSaveProgram(moLuaVirtualMachine& vm);
int luaGetMemory(moLuaVirtualMachine& vm);
///end script functions
moInlet* m_pParticleTime;
moParticlesFractalArray m_ParticlesFractalArray;
moParticlesFractalArray m_ParticlesFractalArrayTmp;
moParticlesFractalPhysics m_Physics;
bool m_bTrackerInit;
moTrackerSystemData* m_pTrackerData;
MOint m_InletTrackerSystemIndex;
#ifdef USE_TUIO
moTUIOSystemData* m_pTUIOData;
MOint m_InletTuioSystemIndex;
#endif
moVector2f m_TrackerBarycenter;
void setUpLighting();
int m_rows,m_cols;
int m_cellmem,m_cellcode;
float normalf; ///width of full floor usually 100.0f
long time_tofull_revelation;