Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
grapa_alisa
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Alisa Jung
grapa_alisa
Commits
f000cfdd
Commit
f000cfdd
authored
Nov 21, 2015
by
Alisa Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tesselate with 2^t
parent
767b1f89
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
9 deletions
+19
-9
controller.cpp
helloqube/controller.cpp
+2
-2
controller.h
helloqube/controller.h
+2
-0
mainwindow.cpp
helloqube/mainwindow.cpp
+2
-2
scenegraph.cpp
helloqube/scenegraph.cpp
+13
-5
No files found.
helloqube/controller.cpp
View file @
f000cfdd
...
...
@@ -80,8 +80,8 @@ void Controller::showQuadView(){
void
Controller
::
setTessellation
(
int
t
){
qDebug
()
<<
"Tesselation: "
<<
t
;
tesselation
=
t
;
tesselation
=
pow
(
2
,
t
)
;
qDebug
()
<<
"Tesselation: "
<<
t
<<
", tess: "
<<
tesselation
;
}
...
...
helloqube/controller.h
View file @
f000cfdd
...
...
@@ -17,6 +17,8 @@
#include <QGridLayout>
#include <rigidbodytransformation.h>
#include <math.h>
class
MyGLWidget
;
class
SceneGraph
;
...
...
helloqube/mainwindow.cpp
View file @
f000cfdd
...
...
@@ -113,8 +113,8 @@ MainWindow::MainWindow(QWidget *parent)
tesselationSlider
->
setTickPosition
(
QSlider
::
TicksBelow
);
tesselationSlider
->
setTickInterval
(
2
);
tesselationSlider
->
setSizePolicy
(
QSizePolicy
::
Fixed
,
QSizePolicy
::
Fixed
);
tesselationSlider
->
setMinimum
(
1
);
tesselationSlider
->
setMaximum
(
1
6
);
tesselationSlider
->
setMinimum
(
0
);
tesselationSlider
->
setMaximum
(
1
0
);
tesselationSlider
->
setValue
(
1
);
toolBar
->
addWidget
(
tesselationSlider
);
connect
(
tesselationSlider
,
SIGNAL
(
valueChanged
(
int
)),
controller
,
SLOT
(
setTessellation
(
int
)));
...
...
helloqube/scenegraph.cpp
View file @
f000cfdd
...
...
@@ -22,8 +22,10 @@ void SceneGraph::registerView(MyGLWidget* view){
//add primitives to sceneGraph
RigidBodyTransformation
*
SceneGraph
::
addSphere
(
int
tesselation
){
nextSphereName
=
"Sphere "
+
sphereIndex
;
//tesselation < 3 makes no sense.
Primitive
*
p
=
new
Primitive
(
idCounter
,
nextSphereName
,
tesselation
+
2
,
Primitive
::
Type
::
SPHERE
);
//tesselation < 3 makes no sense (except for box)
int
t
=
tesselation
;
if
(
t
<
3
)
t
=
3
;
Primitive
*
p
=
new
Primitive
(
idCounter
,
nextSphereName
,
t
,
Primitive
::
Type
::
SPHERE
);
idCounter
++
;
sphereIndex
++
;
...
...
@@ -46,7 +48,9 @@ RigidBodyTransformation* SceneGraph::addBox(int tesselation){
RigidBodyTransformation
*
SceneGraph
::
addCylinder
(
int
tesselation
){
nextCylName
=
"Cylinder "
+
cylIndex
;
Primitive
*
p
=
new
Primitive
(
idCounter
,
nextCylName
,
tesselation
+
2
,
Primitive
::
Type
::
CYLINDER
);
int
t
=
tesselation
;
if
(
t
<
3
)
t
=
3
;
Primitive
*
p
=
new
Primitive
(
idCounter
,
nextCylName
,
t
,
Primitive
::
Type
::
CYLINDER
);
idCounter
++
;
cylIndex
++
;
qDebug
(
"added Cylinder to scenegraph"
);
...
...
@@ -56,7 +60,9 @@ RigidBodyTransformation* SceneGraph::addCylinder(int tesselation){
RigidBodyTransformation
*
SceneGraph
::
addCone
(
int
tesselation
){
nextConeName
=
"Cone "
+
coneIndex
;
Primitive
*
p
=
new
Primitive
(
idCounter
,
nextConeName
,
tesselation
+
2
,
Primitive
::
Type
::
CONE
);
int
t
=
tesselation
;
if
(
t
<
3
)
t
=
3
;
Primitive
*
p
=
new
Primitive
(
idCounter
,
nextConeName
,
t
,
Primitive
::
Type
::
CONE
);
idCounter
++
;
coneIndex
++
;
return
addPrimitive
(
p
);
...
...
@@ -65,7 +71,9 @@ RigidBodyTransformation* SceneGraph::addCone(int tesselation){
RigidBodyTransformation
*
SceneGraph
::
addTorus
(
int
tesselation
){
nextTorusName
=
"Torus "
+
torusIndex
;
Primitive
*
p
=
new
Primitive
(
idCounter
,
nextTorusName
,
tesselation
+
2
,
Primitive
::
Type
::
TORUS
);
int
t
=
tesselation
;
if
(
t
<
3
)
t
=
3
;
Primitive
*
p
=
new
Primitive
(
idCounter
,
nextTorusName
,
t
,
Primitive
::
Type
::
TORUS
);
idCounter
++
;
torusIndex
++
;
return
addPrimitive
(
p
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment