First commit
This commit is contained in:
commit
58c64ab472
62 changed files with 29291 additions and 0 deletions
BIN
res/audio/test.ogg
Normal file
BIN
res/audio/test.ogg
Normal file
Binary file not shown.
BIN
res/audio/test.wav
Normal file
BIN
res/audio/test.wav
Normal file
Binary file not shown.
25743
res/models/monkey3.obj
Normal file
25743
res/models/monkey3.obj
Normal file
File diff suppressed because it is too large
Load diff
30
res/models/plane3.obj
Normal file
30
res/models/plane3.obj
Normal file
|
@ -0,0 +1,30 @@
|
|||
# Blender v2.66 (sub 1) OBJ File: ''
|
||||
# www.blender.org
|
||||
mtllib plane3.mtl
|
||||
o Cube
|
||||
v 8.045116 -0.023363 -8.045115
|
||||
v 8.045116 -0.023363 8.045116
|
||||
v -8.045117 -0.023363 8.045115
|
||||
v -8.045114 -0.023363 -8.045119
|
||||
v 8.045120 0.023363 -8.045112
|
||||
v 8.045111 0.023363 8.045121
|
||||
v -8.045119 0.023363 8.045114
|
||||
v -8.045115 0.023363 -8.045116
|
||||
vt 0.000000 0.000000
|
||||
vt 1.000000 0.000000
|
||||
vt 1.000000 1.000000
|
||||
vt 0.000000 1.000000
|
||||
vn 0.000000 -1.000000 0.000000
|
||||
vn 0.000000 1.000000 0.000000
|
||||
vn 1.000000 0.000020 0.000000
|
||||
vn -0.000000 -0.000041 1.000000
|
||||
vn -1.000000 -0.000041 -0.000000
|
||||
vn 0.000000 0.000071 -1.000000
|
||||
usemtl Material
|
||||
s off
|
||||
f 1/1/1 2/2/1 3/3/1 4/4/1
|
||||
f 5/1/2 8/2/2 7/3/2 6/4/2
|
||||
f 1/1/3 5/2/3 6/3/3 2/4/3
|
||||
f 2/1/4 6/2/4 7/3/4 3/4/4
|
||||
f 3/1/5 7/2/5 8/3/5 4/4/5
|
||||
f 5/1/6 1/2/6 4/3/6 8/4/6
|
5
res/shaders/light.frag
Normal file
5
res/shaders/light.frag
Normal file
|
@ -0,0 +1,5 @@
|
|||
#version 330
|
||||
|
||||
void main(){
|
||||
|
||||
}
|
1
res/shaders/light.vert
Normal file
1
res/shaders/light.vert
Normal file
|
@ -0,0 +1 @@
|
|||
#version 330
|
2
res/shaders/light_ambient.frag
Normal file
2
res/shaders/light_ambient.frag
Normal file
|
@ -0,0 +1,2 @@
|
|||
#version 330
|
||||
#include "main.frag"
|
1
res/shaders/light_ambient.vert
Normal file
1
res/shaders/light_ambient.vert
Normal file
|
@ -0,0 +1 @@
|
|||
#version 330
|
38
res/shaders/main.frag
Normal file
38
res/shaders/main.frag
Normal file
|
@ -0,0 +1,38 @@
|
|||
#version 330
|
||||
|
||||
in vec4 color;
|
||||
in vec3 normal;
|
||||
in vec2 out_coord_texture;
|
||||
uniform sampler2D myTexture;
|
||||
|
||||
uniform vec3 light_direction;
|
||||
uniform vec4 diffuse_light_color;
|
||||
uniform vec4 ambient_light;
|
||||
|
||||
|
||||
out vec4 frag_color;
|
||||
|
||||
void main(){
|
||||
vec3 lightDir;
|
||||
float lightIntensity;
|
||||
|
||||
// Set the default output color to the ambient light value for all pixels.
|
||||
vec4 color1 = color * ambient_light;
|
||||
|
||||
// Invert the light direction for calculations.
|
||||
lightDir = -light_direction;
|
||||
|
||||
// Calculate the amount of light on this pixel.
|
||||
lightIntensity = clamp(dot(normal, lightDir), 0.0f, 1.0f);
|
||||
|
||||
if(lightIntensity > 0.0f)
|
||||
{
|
||||
// Determine the final diffuse color based on the diffuse color and the amount of light intensity.
|
||||
color1 += (diffuse_light_color * lightIntensity);
|
||||
}
|
||||
|
||||
// Clamp the final light color.
|
||||
color1 = clamp(color1, 0.0f, 1.0f);
|
||||
|
||||
frag_color = color1 * texture2D(myTexture,out_coord_texture);
|
||||
}
|
23
res/shaders/main.vert
Normal file
23
res/shaders/main.vert
Normal file
|
@ -0,0 +1,23 @@
|
|||
#version 330
|
||||
#include "light.vert"
|
||||
layout (location = 0) in vec3 in_position;
|
||||
layout (location = 1) in vec4 in_color;
|
||||
layout (location = 2) in vec2 in_coord_texture;
|
||||
layout (location = 3) in vec3 in_normal;
|
||||
|
||||
uniform mat4 transform;
|
||||
uniform mat4 projection;
|
||||
uniform mat4 camera;
|
||||
|
||||
|
||||
out vec4 color;
|
||||
out vec3 normal;
|
||||
out vec2 out_coord_texture;
|
||||
|
||||
void main(){
|
||||
color = in_color;
|
||||
out_coord_texture = in_coord_texture;
|
||||
normal = mat3(transform) * in_normal;
|
||||
normal = normalize(normal);
|
||||
gl_Position = projection * camera * transform * vec4(in_position,1.0f);
|
||||
}
|
BIN
res/textures/floor.jpg
Normal file
BIN
res/textures/floor.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 268 KiB |
BIN
res/textures/wood.jpg
Normal file
BIN
res/textures/wood.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 159 KiB |
Reference in a new issue