Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
imt2531_assignment2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Andreas Blakli
imt2531_assignment2
Commits
7fe2ddb4
Commit
7fe2ddb4
authored
5 years ago
by
Vegardoa
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of
https://git.gvk.idi.ntnu.no/andrbl/imt2531_assignment2
parents
2aab8f78
3d1b7208
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
resources/shaders/fragment.frag
+1
-1
1 addition, 1 deletion
resources/shaders/fragment.frag
src/constants.cpp
+88
-85
88 additions, 85 deletions
src/constants.cpp
src/game.cpp
+6
-0
6 additions, 0 deletions
src/game.cpp
with
95 additions
and
86 deletions
resources/shaders/fragment.frag
+
1
−
1
View file @
7fe2ddb4
...
...
@@ -31,7 +31,7 @@ vec3 PointLight(
// Diffussion Decides intensity of scattered light.
vec3
N
=
normalize
(
norm
);
vec3
light_dir
=
normalize
(
position
-
vec3
(
model
*
vert_position
));
float
diffusion
=
max
(
0
.
0
,
dot
(
N
,
light_dir
));
float
diffusion
=
max
(
0
.
5
,
dot
(
N
,
light_dir
));
vec3
diffuse
=
diffusion
*
intensities
;
// Specularity Adds a strong lightspot in middle of light.
...
...
This diff is collapsed.
Click to expand it.
src/constants.cpp
+
88
−
85
View file @
7fe2ddb4
...
...
@@ -8,93 +8,96 @@
// HARDCODED VALUES IN CODE - POSSIBLY MAKE THEM READ FROM FILE IN THE FUTURE.
// Just short term solution so that we can easily print something to screen.
// Declared globally in "constants.h"
GLfloat
vertices
[]
=
{
-
0.5f
,
-
0.5f
,
-
0.5f
,
GLfloat
vertices
[]
=
{
// Vert. coords
-
0.5f
,
-
0.5f
,
-
0.5f
,
//Back Face
0.5f
,
-
0.5f
,
-
0.5f
,
0.5f
,
0.5f
,
-
0.5f
,
0.5f
,
0.5f
,
-
0.5f
,
-
0.5f
,
0.5f
,
-
0.5f
,
-
0.5f
,
-
0.5f
,
-
0.5f
,
-
0.5f
,
-
0.5f
,
0.5f
,
-
0.5f
,
-
0.5f
,
0.5f
,
//Front Face
0.5f
,
-
0.5f
,
0.5f
,
0.5f
,
0.5f
,
0.5f
,
0.5f
,
0.5f
,
0.5f
,
-
0.5f
,
0.5f
,
0.5f
,
-
0.5f
,
-
0.5f
,
0.5f
,
-
0.5f
,
0.5f
,
0.5f
,
-
0.5f
,
0.5f
,
0.5f
,
//Left Face
-
0.5f
,
0.5f
,
-
0.5f
,
-
0.5f
,
-
0.5f
,
-
0.5f
,
-
0.5f
,
-
0.5f
,
-
0.5f
,
-
0.5f
,
-
0.5f
,
0.5f
,
-
0.5f
,
0.5f
,
0.5f
,
0.5f
,
0.5f
,
0.5f
,
0.5f
,
0.5f
,
0.5f
,
//Right Face
0.5f
,
0.5f
,
-
0.5f
,
0.5f
,
-
0.5f
,
-
0.5f
,
0.5f
,
-
0.5f
,
-
0.5f
,
0.5f
,
-
0.5f
,
0.5f
,
0.5f
,
0.5f
,
0.5f
,
-
0.5f
,
-
0.5f
,
-
0.5f
,
-
0.5f
,
-
0.5f
,
-
0.5f
,
//Bottom Face
0.5f
,
-
0.5f
,
-
0.5f
,
0.5f
,
-
0.5f
,
0.5f
,
0.5f
,
-
0.5f
,
0.5f
,
-
0.5f
,
-
0.5f
,
0.5f
,
-
0.5f
,
-
0.5f
,
-
0.5f
,
-
0.5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0.0f
,
1.0f
,
-
1.0f
,
0.0f
,
0.0f
,
-
1.0f
,
0.0f
,
0.0f
,
-
1.0f
,
0.0f
,
0.0f
,
-
1.0f
,
0.0f
,
0.0f
,
-
1.0f
,
0.0f
,
0.0f
,
-
1.0f
,
0.0f
,
0.0f
,
1.0f
,
0.0f
,
0.0f
,
1.0f
,
0.0f
,
0.0f
,
1.0f
,
0.0f
,
0.0f
,
1.0f
,
0.0f
,
0.0f
,
1.0f
,
0.0f
,
0.0f
,
1.0f
,
0.0f
,
0.0f
,
0.0f
,
-
1.0f
,
0.0f
,
0.0f
,
-
1.0f
,
0.0f
,
0.0f
,
-
1.0f
,
0.0f
,
0.0f
,
-
1.0f
,
0.0f
,
0.0f
,
-
1.0f
,
0.0f
,
0.0f
,
-
1.0f
,
0.0f
,
0.0f
,
1.0f
,
0.0f
,
0.0f
,
1.0f
,
0.0f
,
0.0f
,
1.0f
,
0.0f
,
0.0f
,
1.0f
,
0.0f
,
0.0f
,
1.0f
,
0.0f
,
0.0f
,
1.0f
,
0.0f
,
};
-
0.5f
,
-
0.5f
,
-
0.5f
,
0.5f
,
-
0.5f
,
-
0.5f
,
0.5f
,
-
0.5f
,
0.5f
,
0.5f
,
-
0.5f
,
0.5f
,
-
0.5f
,
-
0.5f
,
0.5f
,
-
0.5f
,
-
0.5f
,
-
0.5f
,
-
0.5f
,
0.5f
,
-
0.5f
,
0.5f
,
0.5f
,
-
0.5f
,
0.5f
,
0.5f
,
0.5f
,
0.5f
,
0.5f
,
0.5f
,
-
0.5f
,
0.5f
,
0.5f
,
-
0.5f
,
0.5f
,
-
0.5f
,
};
GLfloat
uvCoordinates
[]
=
{
GLfloat
uvCoordinates
[]
=
{
//Tex. coords
0.0f
,
0.0f
,
1.0f
,
0.0f
,
1.0f
,
1.0f
,
...
...
This diff is collapsed.
Click to expand it.
src/game.cpp
+
6
−
0
View file @
7fe2ddb4
...
...
@@ -75,6 +75,12 @@ void game::run() {
* Following section runs the game code
* pacman.move is before renderer.loadMap because the pacman object contains the "view" camera angle DATA and renderer.loadMap() uses it to portray the actual angle in shader
*/
// model.draw({});
pacman
.
move
(
myWindow
.
window
,
deltaTime
,
&
loader
);
pacman
.
mouseMove
(
xoffset1
,
yoffset1
,
deltaTime
);
renderer
.
loadMap
(
loader
.
mapObjects
,
pacman
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment