"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "ui_modules/mathmod.h" between
mathmod-10.1-source.zip and mathmod-11.0-source.zip

About: MathMod is a mathematical modeling software that visualize and animate implicit and parametric surfaces.

mathmod.h  (mathmod-10.1-source):mathmod.h  (mathmod-11.0-source)
/*************************************************************************** /***************************************************************************
* Copyright (C) 2020 by Abderrahman Taha * * Copyright (C) 2021 by Abderrahman Taha *
* * * *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or * * the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. * * (at your option) any later version. *
* * * *
* This program is distributed in the hope that it will be useful, * * This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of * * but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. * * GNU General Public License for more details. *
* * * *
* You should have received a copy of the GNU General Public License * * You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the * * along with this program; if not, write to the *
* Free Software Foundation, Inc., * * Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/ ***************************************************************************/
#ifndef mathmod_H #ifndef mathmod_H
#define mathmod_H #define mathmod_H
#include "../pariso/isosurface/Iso3D.h"
#include "../pariso/parametric/Model3D.h"
#include <QFileDialog>
#include <QOpenGLWidget>
#include <QMessageBox>
#include <QMouseEvent>
#include <QResizeEvent>
#include <QTextStream>
#include <QTimer>
#include <iostream>
#include <math.h>
#include <qpixmap.h>
#include <qthread.h>
#include <stdlib.h>
#include <string>
#include "../json_parser/parisodef.h" #include "../json_parser/parisodef.h"
#include "../ui_modules/ParisoMathObject.h" #include "../ui_modules/ParisoMathObject.h"
#include "ui_mathmod.h" #include <QMessageBox>
#include <qmessagebox.h> #include <QOpenGLWidget>
class MathMod : public QWidget #include <QOpenGLFunctions>
#include <QLabel>
#include <QVector3D>
#include <QQuaternion>
#include <QMatrix4x4>
#include <QPainter>
class MathMod : public QOpenGLWidget, protected QOpenGLFunctions
{ {
Q_OBJECT Q_OBJECT
public:
uint Ugrid, Vgrid, CutV, CutU;
int btgauche, btdroit, btmilieu, latence;
int Xgrid, Ygrid, Zgrid, CutX, CutY, CutZ, TypeTriangle;
QBasicTimer *timer;
double factx=1.0, facty=1.0, factz=1.0;
ObjectProperties LocalScene;
QString FramesDir;
Iso3D *IsoObjet;
Par3D *ParObjet;
int TypeFormule;
QMessageBox message;
ErrorMessage stError;
ImprovedNoise *PerlinNoise;
int xyzactivated, isomesh, uvactivated, uvactivated4D;
ParisoMathObject RootObjet;
jcollection collection;
QWidget *Parent;
QLabel LabelInfos;
QString labelinfos;
int FistTimecalibrate = -1;
double hauteur_fenetre,difMaximum,decalage_xo,decalage_yo,decalage_zo;
GLfloat minx, miny, minz,maxx, maxy, maxz;
GLfloat oldminx, oldminy, oldminz,oldmaxx,oldmaxy,oldmaxz;
GLfloat difX, difY, difZ;
uint CubeStartIndex=0, PlanStartIndex=0, AxesStartIndex=0;
uint XStartIndex=0, YStartIndex=0, ZStartIndex=0,
XletterIndex=0,YletterIndex=0,ZletterIndex=0;
float wh=0.57;
GLfloat AxeArray[3*36]={5.0f*wh/4.0f, 0.0, 0.0,0.0, 0.0, 0.0,
0.0, 5.0f*wh/4.0f, 0.0,0.0, 0.0, 0.0,
0.0, 0.0, 5.0f*wh/4.0f,0.0, 0.0, 0.0,
5.0f*wh/4.0f, 0.0, 0.0, 95.0f*wh/80.0f, 95.0f*
wh/4000.0f, 0.0,
95.0f*wh/80.0f, 0.0, 95.0f*wh/4000.0f,95.0f*w
h/80.0f, -95.0f*wh/4000.0f, 0.0,
95.0f*wh/80.0f, 0.0, -95.0f*wh/4000.0f,95.0f*
wh/80.0f, 95.0f*wh/4000.0f, 0.0,
0.0, 5.0f*wh/4.0f, 0.0,95.0f*wh/4000.0f, 95.0
f*wh/80.0f, 0.0,
0.0, 95.0f*wh/80.0f, 95.0f*wh/4000.0f,-95.0f*
wh/4000.0f, 95.0f*wh/80.0f, 0.0,
0.0, 95.0f*wh/80.0f, -95.0f*wh/4000.0f,95.0f*
wh/4000.0f, 95.0f*wh/80.0f, 0.0,
0.0, 0.0, 5.0f*wh/4.0f,95.0f*wh/4000.0f, 0.0,
95.0f*wh/80.0f,
0.0, 95.0f*wh/4000.0f, 95.0f*wh/80.0f,-95.0f*
wh/4000.0f, 0.0, 95.0f*wh/80.0f,
0.0, -95.0f*wh/4000.0f, 95.0f*wh/80.0f,95.0f*
wh/4000.0f, 0.0, 95.0f*wh/80.0f,
5.0f*wh/4.0f + (2.5f)*95.0f*wh/4000.0f, 0.0f,
-95.0f*wh/4000.0f, 5.0f*wh/4.0f + (1.5f)*95.0f*wh/4000.0f, 0.0f, 95.0f*wh/4000.
0f,
5.0f*wh/4.0f + (2.5f)*95.0f*wh/4000.0f, 0.0f,
95.0f*wh/4000.0f, 5.0f*wh/4.0f + (1.5f)*95.0f*wh/4000.0f, 0.0f, -95.0f*wh/4000.
0f,
0.0f, 5.0f*wh/4.0f + (2.5f)*95.0f*wh/4000.0f,
95.0f*wh/4000.0f, 0.0f, 5.0f*wh/4.0f + (1.5f)*95.0f*wh/4000.0f, -95.0f*wh/4000.
0f,
0.0f, 5.0f*wh/4.0f + (2.0f)*95.0f*wh/4000.0f,
0.0f, 0.0f, 5.0f*wh/4.0f + (1.5f)*95.0f*wh/4000.0f, 95.0f*wh/4000.0f,
60.0f*wh/4000.0f, -60.0f*wh/4000.0f, 5.0f*wh/
4.0f + (2.5f)*95.0f*wh/4000.0f, -60.0f*wh/4000.0f, 60.0f*wh/4000.0f, 5.0f*wh/4.0
f + (2.5f)*95.0f*wh/4000.0f,
60.0f*wh/4000.0f, -60.0f*wh/4000.0f, 5.0f*wh/
4.0f + (1.5f)*95.0f*wh/4000.0f, -60.0f*wh/4000.0f, 60.0f*wh/4000.0f, 5.0f*wh/4.0
f + (1.5f)*95.0f*wh/4000.0f
};
GLfloat PlanArray[3*60]=
{
-(4*wh/3)/4, (4*wh/3), -(5*wh/4),
-(4*wh/3)/4, -(4*wh/3), -(5*wh/4),
0.0, (4*wh/3), -(5*wh/4),
0.0, -(4*wh/3), -(5*wh/4),
(4*wh/3)/4, (4*wh/3), -(5*wh/4),
(4*wh/3)/4, -(4*wh/3), -(5*wh/4),
(4*wh/3), -(4*wh/3)/4, -(5*wh/4),
-(4*wh/3), -(4*wh/3)/4, -(5*wh/4),
(4*wh/3), 0.0, -(5*wh/4),
-(4*wh/3), 0.0, -(5*wh/4),
(4*wh/3), (4*wh/3)/4, -(5*wh/4),
-(4*wh/3), (4*wh/3)/4, -(5*wh/4),
-(4*wh/3)/8, (4*wh/3), -(5*wh/4),
-(4*wh/3)/8, -(4*wh/3), -(5*wh/4),
-3*(4*wh/3)/8, (4*wh/3), -(5*wh/4),
-3*(4*wh/3)/8, -(4*wh/3), -(5*wh/4),
-(4*wh/3)/2, (4*wh/3), -(5*wh/4),
-(4*wh/3)/2, -(4*wh/3), -(5*wh/4),
-5*(4*wh/3)/8, (4*wh/3), -(5*wh/4),
-5*(4*wh/3)/8, -(4*wh/3), -(5*wh/4),
-3*(4*wh/3)/4, (4*wh/3), -(5*wh/4),
-3*(4*wh/3)/4, -(4*wh/3), -(5*wh/4),
-7*(4*wh/3)/8, (4*wh/3), -(5*wh/4),
-7*(4*wh/3)/8, -(4*wh/3), -(5*wh/4),
(4*wh/3)/8, (4*wh/3), -(5*wh/4),
(4*wh/3)/8, -(4*wh/3), -(5*wh/4),
3*(4*wh/3)/8, (4*wh/3), -(5*wh/4),
3*(4*wh/3)/8, -(4*wh/3), -(5*wh/4),
(4*wh/3)/2, (4*wh/3), -(5*wh/4),
(4*wh/3)/2, -(4*wh/3), -(5*wh/4),
5*(4*wh/3)/8, (4*wh/3), -(5*wh/4),
5*(4*wh/3)/8, -(4*wh/3), -(5*wh/4),
3*(4*wh/3)/4, (4*wh/3), -(5*wh/4),
3*(4*wh/3)/4, -(4*wh/3), -(5*wh/4),
7*(4*wh/3)/8, (4*wh/3), -(5*wh/4),
7*(4*wh/3)/8, -(4*wh/3), -(5*wh/4),
(4*wh/3), -(4*wh/3)/8, -(5*wh/4),
-(4*wh/3), -(4*wh/3)/8, -(5*wh/4),
(4*wh/3), -3*(4*wh/3)/8, -(5*wh/4),
-(4*wh/3), -3*(4*wh/3)/8, -(5*wh/4),
(4*wh/3), -(4*wh/3)/2, -(5*wh/4),
-(4*wh/3), -(4*wh/3)/2, -(5*wh/4),
(4*wh/3), -5*(4*wh/3)/8, -(5*wh/4),
-(4*wh/3), -5*(4*wh/3)/8, -(5*wh/4),
(4*wh/3), -3*(4*wh/3)/4, -(5*wh/4),
-(4*wh/3), -3*(4*wh/3)/4, -(5*wh/4),
(4*wh/3), -7*(4*wh/3)/8, -(5*wh/4),
-(4*wh/3), -7*(4*wh/3)/8, -(5*wh/4),
(4*wh/3), (4*wh/3)/8, -(5*wh/4),
-(4*wh/3), (4*wh/3)/8, -(5*wh/4),
(4*wh/3), 3*(4*wh/3)/8, -(5*wh/4),
-(4*wh/3), 3*(4*wh/3)/8, -(5*wh/4),
(4*wh/3), (4*wh/3)/2, -(5*wh/4),
-(4*wh/3), (4*wh/3)/2, -(5*wh/4),
(4*wh/3), 5*(4*wh/3)/8, -(5*wh/4),
-(4*wh/3), 5*(4*wh/3)/8, -(5*wh/4),
(4*wh/3), 3*(4*wh/3)/4, -(5*wh/4),
-(4*wh/3), 3*(4*wh/3)/4, -(5*wh/4),
(4*wh/3), 7*(4*wh/3)/8, -(5*wh/4),
-(4*wh/3), 7*(4*wh/3)/8, -(5*wh/4)
};
bool PutObjectInsideCubeOk=false;
GLuint vbo[2];
float gridcol[4] ={0.4f, 0.4f, 0.4f, 0.9f};
float lightPosition[4] = {0, 0, 10, 0};
float lightAmbient[4] = {0.5f, 0.5f, 0.5f, 1.0f};//{0.4f, 0.4f, 0.4f, 0.1};
float lightDiffuse[4] = {0.8f, 0.8f, 0.8f, 1.0};
float lightSpecular[4] = {0.5f, 0.5f, 0.5f, 0.1f};//{0.4f, 0.4f, 0.4f, 0.1};
float frontColor[4] = {0.72f, 0.5f, 0.1, 1};
float backColor[4] = {0.1f, 0.7f, 0.2f, 1};
int shininessVal=20;
int screenWidth=100;
int screenHeight=100;
bool mouseLeftDown=false;
bool mouseRightDown=false;
float mouseY=0;
float cameraDistance=1.4f;
bool vboSupported, vboUsed;
QMatrix4x4 matrixProjectionx;
GLuint shaderprogramId = 0;
bool glslSupported;
GLint uniformFrontColor;
GLint uniformBackColor;
GLint uniformGridColor;
GLint uniformThereisRGBA;
GLfloat uniformShininess;
GLint uniformdrawgridColor;
GLint uniformMatrixModelView;
GLint uniformMatrixModelViewProjection;
GLint uniformMatrixNormal;
GLint uniformLightPosition;
GLint uniformLightAmbient;
GLint uniformLightDiffuse;
GLint uniformLightSpecular;
GLint attribVertexPosition;
GLint attribVertexNormal;
GLint attribVertexColor;
GLint attribVertexTexCoord;
QVector2D mousePressPosition;
qreal angularSpeed = 0;
QMatrix4x4 matrixViewx;
QQuaternion rotation= QQuaternion::fromAxisAndAngle(QVector3D(1.0,0.0,0.0),
270)*
QQuaternion::fromAxisAndAngle(QVector3D(0.0,0.0,1.0), 225)*
QQuaternion::fromAxisAndAngle(QVector3D(1.0,-1.0,0.0), -29);
QQuaternion rotationx;
QQuaternion rotationy;
QQuaternion rotationz;
QQuaternion oldRotation= rotation;
QMatrix4x4 matrixModelViewProjectionx;
QMatrix4x4 matrixNormalx;
qreal acc;
QVector3D n;
public: public:
MathMod(QWidget *, uint, uint initpargrid = 50, uint initisogrid = 40, MathMod(QWidget *, uint, uint initpargrid = 50, uint initisogrid = 40,
uint factx = 4, uint facty = 4, uint factz = 4); uint factx = 4, uint facty = 4, uint factz = 4);
~MathMod(); ~MathMod();
void keyPressEvent(QKeyEvent *);
void resizeEvent(QResizeEvent *);
void ParametricSurfaceProcess(int type = 1); void ParametricSurfaceProcess(int type = 1);
void ParisoObjectProcess(); void ParisoObjectProcess();
void Initparametricpage(); void Initparametricpage();
void updateGL(); void updateGL();
void updateGLspectrale(float *);
void updateThreads(int *);
void updateGLshininess(int);
public slots: public slots:
void fill(); void fill();
void iso_infos(); void iso_infos();
void attachinfos();
void draw_norm_clicked(); void draw_norm_clicked();
void linecolumn_valueChanged(int, ModelType type=PAR_TYPE); void linecolumn_valueChanged(int, ModelType type=PAR_TYPE);
void line_valueChanged(int); void line_valueChanged(int);
void column_valueChanged(int); void column_valueChanged(int);
void linecolumn_valueChanged_2(int); void linecolumn_valueChanged_2(int);
void linecolumn_valueupdate(int); void linecolumn_valueupdate(int);
void line_valueupdate(int); void line_valueupdate(int);
void column_valueupdate(int); void column_valueupdate(int);
void ProcessNewIsoSurface(); void ProcessNewIsoSurface();
void xyzg_valueChanged(int, ModelType); void xyzg_valueChanged(int, ModelType);
void xyzg_valueupdate(int); void xyzg_valueupdate(int);
void slot_checkBox73_clicked(ModelType type=ISO_TYPE); void slot_checkBox73_clicked(ModelType type=ISO_TYPE);
void slot_uv_clicked(ModelType type=PAR_TYPE); void slot_uv_clicked(ModelType type=PAR_TYPE);
void slot_uv4D_clicked(); void slot_uv4D_clicked();
void smoothline();
void Mesh(); void Mesh();
void slot_triangles_clicked(); void slot_triangles_clicked();
int ParseIso(); int ParseIso();
int ParsePar(); int ParsePar();
void ShowErrormessage(); void ShowErrormessage();
void frames_clicked(); void frames_clicked();
void CreateShaderProgram();
public: void draw(ObjectProperties *);
Ui::MathMod ui; void plan();
int xyzactivated, isomesh, uvactivated, uvactivated4D; void CopyData(ObjectProperties *);
ParisoMathObject RootObjet; void DrawMinimalTopology(ObjectProperties *);
jcollection collection; void DrawMeshIso(ObjectProperties *);
QWidget *Parent; void DrawParisoCND(ObjectProperties *, uint);
QMessageBox message; void DrawNormals(ObjectProperties *);
ErrorMessage stError; void DrawAxe();
void proj();
void DrawPariso(ObjectProperties *, uint);
void drawCube();
void initializeGL() override;
void Winitialize_GL();
void resizeGL(int, int) override;
void paintGL() override;
void timerEvent(QTimerEvent *) override;
void mousePressEvent(QMouseEvent *) override;
void mouseMoveEvent(QMouseEvent *) override;
void mouseReleaseEvent(QMouseEvent *) override;
void keyPressEvent(QKeyEvent *) override;
virtual void run();
void InitSpecularParameters();
void Shininess(int);
int memoryallocation(uint, uint initpargrid = 50, uint initgrid = 40,
uint factx = 4, uint facty = 4, uint factz = 4);
void PutObjectInsideCube();
void screenshot();
void FramesShot();
void FramesSave();
QImage Copyscreenshot();
void moveEvent(QMoveEvent *) override;
void closeEvent(QCloseEvent *) override;
public slots:
void anim();
void morph();
void starttimer();
void stoptimer();
bool timeractif();
void restarttimer(int);
void FillOk();
void normOk();
void boundingboxOk();
void transparency(int, int currentposition = 0);
void red(int, int currentposition = 0);
void green(int, int currentposition = 0);
void blue(int, int currentposition = 0);
void redSpec(int);
void greenSpec(int);
void blueSpec(int);
void transSpec(int);
void redAmb(int);
void greenAmb(int);
void blueAmb(int);
void transAmb(int);
void redDiff(int);
void greenDiff(int);
void blueDiff(int);
void transDiff(int);
void quality(int);
void bmp();
void jpg();
void png();
void colorstype(int);
void colorstypeParIso(int);
void colorstypeParam(int);
void SaveSceneAsObjPoly(int n = 0);
void SaveSceneAsObjTrian(int n = 0);
void CalculateTexturePoints(int type);
void CalculatePigmentPoints(int type);
void LoadShadersFiles();
void UpdateGL();
}; };
#endif #endif
 End of changes. 10 change blocks. 
21 lines changed or deleted 282 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)