Ajout de l'ensemble du workspace.
[GPU.git] / WCudaMSE / Tuto_Image / src / cpp / core / 02_Damier_Zoomable / a_image / DamierImage.cpp
1 #include <iostream>
2 #include <math.h>
3
4 #include "DamierImage.h"
5 #include "StringTools.h"
6 #include "OmpTools.h"
7 #include "MathTools.h"
8 #include "IndiceTools.h"
9 #include "ColorTools.h"
10
11 using std::cout;
12 using std::endl;
13 using std::string;
14
15 /*----------------------------------------------------------------------*\
16 |* Declaration *|
17 \*---------------------------------------------------------------------*/
18
19 /*--------------------------------------*\
20 |* Public *|
21 \*-------------------------------------*/
22
23 /*--------------------------------------*\
24 |* Private *|
25 \*-------------------------------------*/
26
27 /*----------------------------------------------------------------------*\
28 |* Implementation *|
29 \*---------------------------------------------------------------------*/
30
31 /*--------------------------------------*\
32 |* Public *|
33 \*-------------------------------------*/
34
35 /**
36 * DomaineMaths(0, 0, 2 * PI, 2 * PI) : par exemple, why not celui là!
37 */
38 DamierImage::DamierImage(unsigned int w, unsigned int h, float dt, int n) :
39 ImageFonctionelMOOs_A(w, h, DomaineMath(0, 0, 2 * PI, 2 * PI))
40 {
41 //Tools
42 this->ptrDamierMOO=new DamierMOO(w,h,dt,n);
43
44 setEnableDomaineOverlay(true);
45 }
46
47 DamierImage::~DamierImage(void)
48 {
49 delete ptrDamierMOO;
50 }
51
52 /*--------------------------------------*\
53 |* Override *|
54 \*-------------------------------------*/
55
56 /**
57 * Override
58 * Called automatically by the API
59 */
60 void DamierImage::fillImageGL(uchar4* ptrTabPixels, int w, int h, const DomaineMath& domaineMath)
61 {
62 ptrDamierMOO->process(ptrTabPixels, w, h,domaineMath);
63 }
64
65 /**
66 * Override
67 * call periodicly by the api
68 */
69 void DamierImage::animationStep(bool& isNeedUpdateView)
70 {
71 ptrDamierMOO->animationStep();
72 }
73
74 /**
75 * Override
76 * call periodicly by the api
77 */
78 void DamierImage::paintPrimitives(Graphic2Ds& graphic2D)
79 {
80 const Font_A* ptrFont = graphic2D.getFont(TIMES_ROMAN_24);
81
82 float r = 0;
83 float g = 0;
84 float b = 0;
85 graphic2D.setColorRGB(r, g, b);
86
87 // Top
88 {
89 float t=ptrDamierMOO->getT();
90 int n=ptrDamierMOO->getN();
91
92 string message = "t = " + StringTools::toString(t) + " n = " + StringTools::toString(n);
93 graphic2D.drawTitleTop(message, ptrFont);
94 }
95
96 // Bottom
97 {
98 graphic2D.drawTitleBottom("[API Image Fonctionelle] : Damier zoomable OMP", ptrFont);
99 }
100 }
101
102 /*--------------------------------------*\
103 |* Private *|
104 \*-------------------------------------*/
105
106
107 /*----------------------------------------------------------------------*\
108 |* End *|
109 \*---------------------------------------------------------------------*/
110