src/gl/partrenderer.cpp

Wed, 01 Jan 2020 17:45:56 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Wed, 01 Jan 2020 17:45:56 +0200
changeset 21
0133e565e072
parent 18
918b6c0f8b5b
child 22
6da867fa5429
permissions
-rw-r--r--

things

17
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
1 #include <QMouseEvent>
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
2 #include <GL/glut.h> // teapot
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
3 #include "partrenderer.h"
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
4
21
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
5 PartRenderer::PartRenderer(Model* model, DocumentManager* documents, QWidget* parent) :
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
6 QOpenGLWidget{parent},
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
7 model{model},
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
8 documents{documents},
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
9 compiler{new gl::Compiler{this}}
17
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
10 {
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
11 this->setMouseTracking(true);
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
12 }
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
13
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
14 void PartRenderer::initializeGL()
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
15 {
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
16 this->initializeOpenGLFunctions();
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
17 if (this->glGetError() != GL_NO_ERROR)
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
18 {
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
19 abort();
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
20 }
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
21 this->initializeLighting();
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
22 this->initialized = true;
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
23 this->rotation = QQuaternion::fromAxisAndAngle({1, 0, 0}, 30);
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
24 this->rotation *= QQuaternion::fromAxisAndAngle({0, 1, 0}, 330);
21
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
25 this->compiler->build(this->model, this->documents);
17
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
26 }
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
27
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
28 /*
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
29 * Pads a 3×3 matrix into a 4×4 one by adding cells from the identity matrix.
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
30 */
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
31 static QMatrix4x4 padMatrix(const QMatrix3x3& stub)
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
32 {
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
33 return {
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
34 stub(0, 0), stub(0, 1), stub(0, 2), 0,
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
35 stub(1, 0), stub(1, 1), stub(1, 2), 0,
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
36 stub(2, 0), stub(2, 1), stub(2, 2), 0,
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
37 0, 0, 0, 1
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
38 };
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
39 }
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
40
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
41
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
42 void PartRenderer::initializeLighting()
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
43 {
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
44 GLfloat materialShininess[] = {5.0};
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
45 GLfloat lightPosition[] = {1.0, 1.0, 1.0, 0.0};
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
46 GLfloat ambientLightingLevel[] = {0.5, 0.5, 0.5, 1.0};
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
47 glShadeModel(GL_SMOOTH);
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
48 glMaterialfv(GL_FRONT, GL_SHININESS, materialShininess);
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
49 glLightfv(GL_LIGHT0, GL_AMBIENT, ambientLightingLevel);
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
50 glLightfv(GL_LIGHT0, GL_DIFFUSE, ambientLightingLevel);
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
51 glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
52 glEnable(GL_LIGHTING);
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
53 glEnable(GL_LIGHT0);
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
54 glEnable(GL_COLOR_MATERIAL);
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
55 glEnable(GL_DEPTH_TEST);
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
56 }
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
57
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
58 void PartRenderer::resizeGL(int width, int height)
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
59 {
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
60 constexpr GLfloat near = 1.0f;
18
Teemu Piippo <teemu@hecknology.net>
parents: 17
diff changeset
61 constexpr GLfloat far = 1e+05f;
17
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
62 glViewport (0, 0, width, height);
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
63 glMatrixMode(GL_PROJECTION);
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
64 glLoadIdentity();
18
Teemu Piippo <teemu@hecknology.net>
parents: 17
diff changeset
65 gluPerspective(45.0f, static_cast<double>(width) / static_cast<double>(height), near, far);
17
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
66 glMatrixMode(GL_MODELVIEW);
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
67 }
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
68
21
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
69 static int getGlTypeForVboClass(const gl::VboClass vboClass)
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
70 {
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
71 switch (vboClass)
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
72 {
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
73 case gl::VboClass::Lines:
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
74 case gl::VboClass::ConditionalLines:
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
75 return GL_LINES;
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
76 case gl::VboClass::Triangles:
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
77 return GL_TRIANGLES;
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
78 case gl::VboClass::Quads:
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
79 return GL_QUADS;
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
80 }
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
81 throw std::runtime_error{"Bad vbo class passed to getGlTypeForVboClass"};
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
82 }
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
83
17
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
84 // https://www.codemiles.com/c-opengl-examples/drawing-teapot-using-opengl-t9010.html?mobile=on
21
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
85 #include <QMessageBox>
17
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
86 void PartRenderer::paintGL()
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
87 {
18
Teemu Piippo <teemu@hecknology.net>
parents: 17
diff changeset
88 switch (this->renderStyle)
Teemu Piippo <teemu@hecknology.net>
parents: 17
diff changeset
89 {
Teemu Piippo <teemu@hecknology.net>
parents: 17
diff changeset
90 case gl::RenderStyle::Normal:
Teemu Piippo <teemu@hecknology.net>
parents: 17
diff changeset
91 case gl::RenderStyle::BfcRedGreen:
Teemu Piippo <teemu@hecknology.net>
parents: 17
diff changeset
92 case gl::RenderStyle::RandomColors:
Teemu Piippo <teemu@hecknology.net>
parents: 17
diff changeset
93 break;
Teemu Piippo <teemu@hecknology.net>
parents: 17
diff changeset
94 case gl::RenderStyle::Wireframe:
Teemu Piippo <teemu@hecknology.net>
parents: 17
diff changeset
95 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
Teemu Piippo <teemu@hecknology.net>
parents: 17
diff changeset
96 break;
Teemu Piippo <teemu@hecknology.net>
parents: 17
diff changeset
97 }
17
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
98 glMatrixMode(GL_MODELVIEW);
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
99 // clear the drawing buffer.
21
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
100 glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
101 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
102 glEnable(GL_DEPTH_TEST);
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
103 glEnable(GL_LIGHTING);
17
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
104 // clear the identity matrix.
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
105 glLoadIdentity();
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
106 // traslate the draw by z = -4.0
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
107 // Note this when you decrease z like -8.0 the drawing will looks far , or smaller.
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
108 glTranslatef(0.0,0.0,-4.5);
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
109 // Red color used to draw.
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
110 glColor3f(0.8, 0.2, 0.1);
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
111 glMultMatrixf(padMatrix(this->rotation.toRotationMatrix()).constData());
21
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
112 //glutSolidTeapot(1.0);
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
113 glEnableClientState(GL_VERTEX_ARRAY);
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
114 glEnableClientState(GL_COLOR_ARRAY);
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
115 for (const gl::VboClass vboClass : {gl::VboClass::Lines, gl::VboClass::Triangles, gl::VboClass::Quads})
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
116 {
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
117 const int vboSurfaces = this->compiler->vbo({vboClass, gl::VboSubclass::Surfaces});
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
118 const int vboColors = this->compiler->vbo({vboClass, gl::VboSubclass::RegularColors});
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
119 const int vboNormals = this->compiler->vbo({vboClass, gl::VboSubclass::Normals});
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
120 const int count = this->compiler->vboSize({vboClass, gl::VboSubclass::Surfaces}) / 3;
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
121 glBindBuffer(GL_ARRAY_BUFFER, vboSurfaces);
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
122 glVertexPointer(3, GL_FLOAT, 0, nullptr);
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
123 glBindBuffer(GL_ARRAY_BUFFER, vboColors);
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
124 glColorPointer(4, GL_FLOAT, 0, nullptr);
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
125 //glBindBuffer(GL_ARRAY_BUFFER, vboNormals);
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
126 //glNormalPointer(GL_FLOAT, 0, nullptr);
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
127 glDrawArrays(getGlTypeForVboClass(vboClass), 0, count);
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
128 }
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
129 glBindBuffer(GL_ARRAY_BUFFER, 0);
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
130 glDisableClientState(GL_VERTEX_ARRAY);
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
131 glDisableClientState(GL_COLOR_ARRAY);
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
132
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
133 //glFlush();
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
134 const int glError = this->glGetError();
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
135 if (glError != GL_NO_ERROR)
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
136 {
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
137 const QString glErrorString = QString::fromLatin1(reinterpret_cast<const char*>(::gluErrorString(glError)));
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
138 QMessageBox::critical(
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
139 this,
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
140 tr("Rendering error"),
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
141 QString{"Failed to render: %1"}.arg(glErrorString));
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
142 }
17
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
143 }
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
144
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
145 static QPointF pointToPointF(const QPoint& point)
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
146 {
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
147 return {static_cast<qreal>(point.x()), static_cast<qreal>(point.y())};
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
148 }
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
149
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
150 /*
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
151 static QPoint pointFToPoint(const QPointF& point)
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
152 {
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
153 return {static_cast<int>(std::round(point.x())), static_cast<int>(std::round(point.y()))};
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
154 }
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
155 */
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
156
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
157 void PartRenderer::mouseMoveEvent(QMouseEvent* event)
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
158 {
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
159 const bool left = event->buttons() & Qt::LeftButton;
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
160 const QPointF move = pointToPointF(event->pos()) - this->lastMousePosition;
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
161 if (left and not move.isNull())
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
162 {
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
163 const QQuaternion versor = QQuaternion::fromAxisAndAngle(
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
164 QVector3D{static_cast<float>(move.y()), static_cast<float>(move.x()), 0.0f},
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
165 0.6 * std::hypot(move.x(), move.y())
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
166 );
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
167 this->rotation = versor * this->rotation;
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
168 this->update();
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
169 }
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
170 this->lastMousePosition = pointToPointF(event->pos());
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
171 }
18
Teemu Piippo <teemu@hecknology.net>
parents: 17
diff changeset
172
21
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
173 void PartRenderer::setCompiler(gl::Compiler* compiler)
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
174 {
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
175 this->compiler = compiler;
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
176 }
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
177
18
Teemu Piippo <teemu@hecknology.net>
parents: 17
diff changeset
178 void PartRenderer::setRenderStyle(const gl::RenderStyle newStyle)
Teemu Piippo <teemu@hecknology.net>
parents: 17
diff changeset
179 {
Teemu Piippo <teemu@hecknology.net>
parents: 17
diff changeset
180 this->renderStyle = newStyle;
Teemu Piippo <teemu@hecknology.net>
parents: 17
diff changeset
181 this->update();
Teemu Piippo <teemu@hecknology.net>
parents: 17
diff changeset
182 }
Teemu Piippo <teemu@hecknology.net>
parents: 17
diff changeset
183

mercurial