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