Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
GraPa
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kai Westerkamp
GraPa
Commits
026bab16
Commit
026bab16
authored
Oct 29, 2015
by
Kai Westerkamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
laptop support
parent
859a3df7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
8 deletions
+3
-8
cubewidget.cpp
A1/hellocube/cubewidget.cpp
+2
-2
cubewidget.h
A1/hellocube/cubewidget.h
+0
-1
phong.frag
A1/hellocube/phong.frag
+1
-5
No files found.
A1/hellocube/cubewidget.cpp
View file @
026bab16
...
...
@@ -31,7 +31,7 @@ void CubeWidget::initializeGL ()
glEnable
(
GL_LIGHT0
);
static
GLfloat
lightPosition
[
4
]
=
{
0.5
,
0.0
,
2.0
,
1.0
};
glLightfv
(
GL_LIGHT0
,
GL_POSITION
,
lightPosition
);
GLfloat
white
[]
=
{
1.0
,
1.0
,
1.0
};
//
GLfloat white[] = {1.0,1.0,1.0};
//glLightfv(GL_LIGHT0, GL_DIFFUSE, white);
//glLightfv(GL_LIGHT0, GL_SPECULAR, white);
//glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 2.0f);
...
...
@@ -283,7 +283,7 @@ void CubeWidget::move(QVector3D *newPos )
QVector3D
axis
=
QVector3D
::
crossProduct
(
*
lastPos
,
*
newPos
);
//warum so besser
float
angle
=
180
/
M_PI
*
std
::
asin
(
std
::
sqrt
(
QVector3D
::
dotProduct
(
axis
,
axis
)));
float
angle
=
180
/
M_PI
*
asin
(
sqrt
(
QVector3D
::
dotProduct
(
axis
,
axis
)));
axis
.
normalize
();
//axis = rotation->conjugate().rotatedVector(axis);
...
...
A1/hellocube/cubewidget.h
View file @
026bab16
...
...
@@ -44,7 +44,6 @@ private:
int
zoom
;
QQuaternion
*
rotation
;
QVector3D
*
lastPos
;
bool
mousDown
=
false
;
QGLShaderProgram
*
shader
;
...
...
A1/hellocube/phong.frag
View file @
026bab16
uniform
gl_LightSourceParameters
gl_LightSource
[
gl_MaxLights
];
uniform
gl_MaterialParameters
gl_FrontMaterial
;
uniform
gl_LightModelProducts
gl_FrontLightModelProduct
;
varying
vec3
position
;
varying
vec3
normal
;
void
main
(
void
)
{
vec3
N
=
normalize
(
normal
);
vec3
L
=
normalize
(
gl_LightSource
[
0
].
position
-
position
);
vec3
L
=
normalize
(
gl_LightSource
[
0
].
position
.
xyz
-
position
);
vec4
diffuse
=
vec4
(
max
(
dot
(
L
,
N
),
0
.
0
));
...
...
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