Добавление MeshLoader, он умеет загружать геометрию и нормали из .obj файлов

This commit is contained in:
2023-03-23 18:34:14 +03:00
parent 1b623c947a
commit bd12a62be1
10 changed files with 243 additions and 14 deletions

BIN
lab2/res/cube.blend Normal file

Binary file not shown.

12
lab2/res/cube.mtl Normal file
View File

@@ -0,0 +1,12 @@
# Blender MTL File: 'cube.blend'
# Material Count: 1
newmtl Material
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.800000 0.800000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

32
lab2/res/cube.obj Normal file
View File

@@ -0,0 +1,32 @@
# Blender v3.4.1 OBJ File: 'cube.blend'
# www.blender.org
mtllib cube.mtl
o Cube
v 1.000000 1.000000 -1.000000
v 1.000000 -1.000000 -1.000000
v 1.000000 1.000000 1.000000
v 1.000000 -1.000000 1.000000
v -1.000000 1.000000 -1.000000
v -1.000000 -1.000000 -1.000000
v -1.000000 1.000000 1.000000
v -1.000000 -1.000000 1.000000
vn 0.0000 1.0000 0.0000
vn 0.0000 0.0000 1.0000
vn -1.0000 0.0000 0.0000
vn 0.0000 -1.0000 0.0000
vn 1.0000 0.0000 0.0000
vn 0.0000 0.0000 -1.0000
usemtl Material
s off
f 5//1 3//1 1//1
f 3//2 8//2 4//2
f 7//3 6//3 8//3
f 2//4 8//4 6//4
f 1//5 4//5 2//5
f 5//6 2//6 6//6
f 5//1 7//1 3//1
f 3//2 7//2 8//2
f 7//3 5//3 6//3
f 2//4 4//4 8//4
f 1//5 3//5 4//5
f 5//6 1//6 2//6

View File

@@ -1,7 +1,7 @@
#version 330 core
layout (location = 0) in vec3 v_position;
layout (location = 1) in float light;
layout (location = 1) in vec3 v_normal;
out vec4 a_color;
uniform mat4 projview;
@@ -9,6 +9,6 @@ uniform mat4 projview;
void main(){
// gl_Position = vec4(v_position, 1) * projview;
gl_Position = projview * vec4(v_position, 1);
a_color = vec4(0.5, 0, 1, 1) * light;
a_color = vec4(0.5, 0, 1, 1);
}