Ajout de l'ensemble du workspace.
[GPU.git] / WCudaMSE / BilatTools_Cuda_Image / src / core / cudaImageTools / fonctionel / cpp / ImageFonctionel.cpp
1 #include <iostream>
2 #include <assert.h>
3 #include <math.h>
4
5 #include "ImageFonctionel.h"
6 #include "StringTools.h"
7 #include "MathTools.h"
8
9 using std::cout;
10 using std::endl;
11
12 /*----------------------------------------------------------------------*\
13 |* Declaration *|
14 \*---------------------------------------------------------------------*/
15
16 /*--------------------------------------*\
17 |* Imported *|
18 \*-------------------------------------*/
19
20 /*--------------------------------------*\
21 |* Public *|
22 \*-------------------------------------*/
23
24 /*--------------------------------------*\
25 |* Private *|
26 \*-------------------------------------*/
27
28 /*----------------------------------------------------------------------*\
29 |* Implementation *|
30 \*---------------------------------------------------------------------*/
31
32 /*--------------------------------------*\
33 |* Public *|
34 \*-------------------------------------*/
35
36 ImageFonctionel::ImageFonctionel(AnimableFonctionel_I* ptrAnimable, ColorRGB_01* ptrColorTitreRGB) :
37 ImageFonctionelMOOs_A(ptrAnimable->getW(), ptrAnimable->getH(), *ptrAnimable->getDomaineMathInit())
38 {
39 this->ptrAnimable = ptrAnimable;
40 this->ptrColorTitreRGB = ptrColorTitreRGB;
41
42 setEnableDomaineOverlay(true);
43 }
44
45 ImageFonctionel::~ImageFonctionel(void)
46 {
47 delete ptrAnimable;
48 }
49
50 /**
51 * Override
52 */
53 void ImageFonctionel::animationStep(bool& isNeedUpdateView)
54 {
55 // cout << "[CBI] : Image : animationStep" <<endl;
56
57 ptrAnimable->animationStep();
58 isNeedUpdateView = true; // true par default
59 }
60
61 /**
62 * Override
63 */
64 void ImageFonctionel::fillImageGL(uchar4* ptrDevImageGL, int w, int h, const DomaineMath& domaineMath) // override
65 {
66 // cout << "[CBI] : Image : fillImageGL" <<endl;
67
68 ptrAnimable->runGPU(ptrDevImageGL, domaineMath);
69 }
70
71 /**
72 * Override
73 */
74 void ImageFonctionel::paintPrimitives(Graphic2Ds& graphic2D) // redefinition
75 {
76 const Font_A* ptrfont = graphic2D.getFont(TIMES_ROMAN_24);
77
78 float r = ptrColorTitreRGB->r;
79 float g = ptrColorTitreRGB->g;
80 float b = ptrColorTitreRGB->b;
81 graphic2D.setColorRGB(r, g, b);
82
83 // top
84 {
85 float t = ptrAnimable->getT();
86 string message = "t = " + StringTools::toString(t);
87 graphic2D.drawTitleTop(message, ptrfont);
88 }
89
90 // bottom
91 {
92 string title = ptrAnimable->getTitle();
93 graphic2D.drawTitleBottom(title, ptrfont);
94 }
95 }
96
97 /*--------------------------------------*\
98 |* Private *|
99 \*-------------------------------------*/
100
101 /*----------------------------------------------------------------------*\
102 |* End *|
103 \*---------------------------------------------------------------------*/