4 void Animation::DrMessage(
const char * s, ...)
9 vfprintf(stderr, s, args);
10 fprintf(stderr,
"\n");
19 void ParticleRealTime(){
22 void reshape(
int w,
int h){
28 void MouseMove(
int x,
int y){
31 void mouse(
int button,
int state,
int x,
int y){
32 DrE->
Dmouse(button,state,x,y);
34 void special(
int k,
int x,
int y){
38 void DrawParticles(){}
40 void keyboard(
unsigned char key,
int x,
int y){
51 Animation::Animation(QWidget *parent): QGLWidget(parent){
52 FileName =
new char[160];
55 sprintf(FileName,
"RadDistrNanoR3.8H0.5.tif");
65 void Animation::initializeGL(){
66 DrMessage(
"Animation.InitialiezeGL");
70 glClearColor(.0,.0,.0,.0);
71 glShadeModel(GL_SMOOTH);
73 glEnable(GL_DEPTH_TEST);
76 glDepthFunc(GL_LEQUAL);
77 glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
78 glEnable(GL_CULL_FACE);
80 void Animation::NomeFile(
const QString &S){
81 DrMessage(
"Animation.NomeFile");
82 sprintf(FileName,
"%s",S.ascii());
84 void Animation::NomeFile(
char *ExtName){
85 DrMessage(
"Animation.NomeFile");
86 sprintf(FileName,
"%s",ExtName);
89 void Animation::Open(){
90 DrMessage(
"Animation.Open");
95 void Animation::Filter(){
96 DrMessage(
"Animation.Filter");
102 void Animation::Motion(){
103 DrMessage(
"Animation.Motion");
108 void Animation::FilterContrast(){
109 DrMessage(
"Animation.FilterContrast");
114 void Animation::FilterIncrease(){
115 DrMessage(
"Animation.FilterIncrease");
120 void Animation::FilterMC(){
121 DrMessage(
"Animation.FilterMC");
126 void Animation::IncrSlide(){
127 DrMessage(
"Animation.IncrSlide");
132 void Animation::FilterCoarseGrain(){
133 DrMessage(
"Animation.FilterCoarseGrain");
138 void Animation::Run(){
139 DrMessage(
"Animation.Run");
142 void Animation::ImpGrana(
int ExtGrana){
143 if(Grana < 0 || Grana > 32)
return;
146 void Animation::resizeGL(
int width,
int height){
147 DrMessage(
"Animation.resizeGL");
149 int side = qMin(width, height);
150 glViewport((width - side) / 2, (height - side) / 2, side, side);
151 glMatrixMode(GL_PROJECTION);
153 gluPerspective(60,(GLfloat) width/(GLfloat) height,.1,200.);
155 glMatrixMode(GL_MODELVIEW);
157 void Animation::paintGL(){
158 DrMessage(
"Animation.paintGL");
159 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
162 glTranslatef(0.,0.,-.6);
163 glRotated(xRot / 16.0, 1.0, 0.0, 0.0);
164 glRotated(yRot / 16.0, 0.0, 1.0, 0.0);
165 glRotated(zRot / 16.0, 0.0, 0.0, 1.0);
166 glColor4f(.0,1.0,.0,1.);
173 void Animation::paintEvent(QPaintEvent (event)){
174 DrMessage(
"Animation.paintEvent");
178 void Animation::mousePressEvent(QMouseEvent *event)
180 lastPos =
event->pos();
182 void Animation::mouseMoveEvent(QMouseEvent *event){
184 int dx =
event->x() - lastPos.x();
185 int dy =
event->y() - lastPos.y();
187 if (event->buttons() & Qt::LeftButton) {
188 setXRotation(xRot + 8 * dy);
189 setYRotation(yRot + 8 * dx);
190 }
else if (event->buttons() & Qt::RightButton) {
191 setXRotation(xRot + 8 * dy);
192 setZRotation(zRot + 8 * dx);
194 lastPos =
event->pos();
196 void Animation::setXRotation(
int angle)
201 emit xRotationChanged(angle);
205 void Animation::setYRotation(
int angle)
210 emit yRotationChanged(angle);
214 void Animation::setZRotation(
int angle)
219 emit zRotationChanged(angle);
223 void Animation::Histo(){
224 DrMessage(
"Animation.Histo");
236 void Animation::NablaPhi(){
237 DrMessage(
"Animation.NablaPhi");
240 NMass = DrE->BuffSize();
249 void Animation::Punta(){
252 DrMessage(
"Animation.Punta");
253 emit PuntaCoord(st,NMass,NVar,Valori);
256 void Animation::BlackWhite(){
257 DrMessage(
"Animation.BlackWhite");
261 void Animation::Binary(){
262 DrMessage(
"Animation.Binary");
void DMouseMove(int x, int y)
How the scene rotate (Camera view should be implemented)
void Dreshape(int w, int h)
Principal reshape function.
void Run()
Create an animation.
void EffectCoarseGrain(int Grana)
Defocus the images in blocks.
void Dspecial(int k, int x, int y)
Boh.
void EffectMotion()
Shifting of pixels.
void keyboardDraw(unsigned char key)
Combines the key with the functions.
void DTimer(int v)
Not working.
void EffectMC()
Applies a random disposition of blocks.
int OpenImage(const char *FileName)
Open a image to be store in pixel.
void EffectFilter()
Applies a filter to pixel.
void Draw1(void)
A scene for debugging.
Reads and stores a data file to be elaborated via Matematica.
void EffectIncrease()
Increase the resolution.
void ShowImage()
Displays the data stored in pixel.
void Window(int argc, char **argv)
Initial definition of the window.
int NLevel
Levels of the images data (usually 4=RGBA)
VarDatFile * v1
Class for the file handle.
void Dmouse(int button, int state, int x, int y)
To launch the menu.
void ScriviTutto(char *file, int LogLog, int NVisMin, int NVisMax)
Writes all the content in memory.