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
Hide 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(){
...
@@ -80,8 +80,8 @@ void Controller::showQuadView(){
void
Controller
::
setTessellation
(
int
t
){
void
Controller
::
setTessellation
(
int
t
){
qDebug
()
<<
"Tesselation: "
<<
t
;
tesselation
=
pow
(
2
,
t
)
;
tesselation
=
t
;
qDebug
()
<<
"Tesselation: "
<<
t
<<
", tess: "
<<
tesselation
;
}
}
...
...
helloqube/controller.h
View file @
f000cfdd
...
@@ -17,6 +17,8 @@
...
@@ -17,6 +17,8 @@
#include <QGridLayout>
#include <QGridLayout>
#include <rigidbodytransformation.h>
#include <rigidbodytransformation.h>
#include <math.h>
class
MyGLWidget
;
class
MyGLWidget
;
class
SceneGraph
;
class
SceneGraph
;
...
...
helloqube/mainwindow.cpp
View file @
f000cfdd
...
@@ -113,8 +113,8 @@ MainWindow::MainWindow(QWidget *parent)
...
@@ -113,8 +113,8 @@ MainWindow::MainWindow(QWidget *parent)
tesselationSlider
->
setTickPosition
(
QSlider
::
TicksBelow
);
tesselationSlider
->
setTickPosition
(
QSlider
::
TicksBelow
);
tesselationSlider
->
setTickInterval
(
2
);
tesselationSlider
->
setTickInterval
(
2
);
tesselationSlider
->
setSizePolicy
(
QSizePolicy
::
Fixed
,
QSizePolicy
::
Fixed
);
tesselationSlider
->
setSizePolicy
(
QSizePolicy
::
Fixed
,
QSizePolicy
::
Fixed
);
tesselationSlider
->
setMinimum
(
1
);
tesselationSlider
->
setMinimum
(
0
);
tesselationSlider
->
setMaximum
(
1
6
);
tesselationSlider
->
setMaximum
(
1
0
);
tesselationSlider
->
setValue
(
1
);
tesselationSlider
->
setValue
(
1
);
toolBar
->
addWidget
(
tesselationSlider
);
toolBar
->
addWidget
(
tesselationSlider
);
connect
(
tesselationSlider
,
SIGNAL
(
valueChanged
(
int
)),
controller
,
SLOT
(
setTessellation
(
int
)));
connect
(
tesselationSlider
,
SIGNAL
(
valueChanged
(
int
)),
controller
,
SLOT
(
setTessellation
(
int
)));
...
...
helloqube/scenegraph.cpp
View file @
f000cfdd
...
@@ -22,8 +22,10 @@ void SceneGraph::registerView(MyGLWidget* view){
...
@@ -22,8 +22,10 @@ void SceneGraph::registerView(MyGLWidget* view){
//add primitives to sceneGraph
//add primitives to sceneGraph
RigidBodyTransformation
*
SceneGraph
::
addSphere
(
int
tesselation
){
RigidBodyTransformation
*
SceneGraph
::
addSphere
(
int
tesselation
){
nextSphereName
=
"Sphere "
+
sphereIndex
;
nextSphereName
=
"Sphere "
+
sphereIndex
;
//tesselation < 3 makes no sense.
//tesselation < 3 makes no sense (except for box)
Primitive
*
p
=
new
Primitive
(
idCounter
,
nextSphereName
,
tesselation
+
2
,
Primitive
::
Type
::
SPHERE
);
int
t
=
tesselation
;
if
(
t
<
3
)
t
=
3
;
Primitive
*
p
=
new
Primitive
(
idCounter
,
nextSphereName
,
t
,
Primitive
::
Type
::
SPHERE
);
idCounter
++
;
idCounter
++
;
sphereIndex
++
;
sphereIndex
++
;
...
@@ -46,7 +48,9 @@ RigidBodyTransformation* SceneGraph::addBox(int tesselation){
...
@@ -46,7 +48,9 @@ RigidBodyTransformation* SceneGraph::addBox(int tesselation){
RigidBodyTransformation
*
SceneGraph
::
addCylinder
(
int
tesselation
){
RigidBodyTransformation
*
SceneGraph
::
addCylinder
(
int
tesselation
){
nextCylName
=
"Cylinder "
+
cylIndex
;
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
++
;
idCounter
++
;
cylIndex
++
;
cylIndex
++
;
qDebug
(
"added Cylinder to scenegraph"
);
qDebug
(
"added Cylinder to scenegraph"
);
...
@@ -56,7 +60,9 @@ RigidBodyTransformation* SceneGraph::addCylinder(int tesselation){
...
@@ -56,7 +60,9 @@ RigidBodyTransformation* SceneGraph::addCylinder(int tesselation){
RigidBodyTransformation
*
SceneGraph
::
addCone
(
int
tesselation
){
RigidBodyTransformation
*
SceneGraph
::
addCone
(
int
tesselation
){
nextConeName
=
"Cone "
+
coneIndex
;
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
++
;
idCounter
++
;
coneIndex
++
;
coneIndex
++
;
return
addPrimitive
(
p
);
return
addPrimitive
(
p
);
...
@@ -65,7 +71,9 @@ RigidBodyTransformation* SceneGraph::addCone(int tesselation){
...
@@ -65,7 +71,9 @@ RigidBodyTransformation* SceneGraph::addCone(int tesselation){
RigidBodyTransformation
*
SceneGraph
::
addTorus
(
int
tesselation
){
RigidBodyTransformation
*
SceneGraph
::
addTorus
(
int
tesselation
){
nextTorusName
=
"Torus "
+
torusIndex
;
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
++
;
idCounter
++
;
torusIndex
++
;
torusIndex
++
;
return
addPrimitive
(
p
);
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