Merge: roberto -> main

This commit is contained in:
PedroEdiaz
2024-10-17 22:30:55 -06:00
parent 252aab3dd2
commit 7c1f691b46
9 changed files with 133 additions and 59 deletions

View File

@@ -1,45 +1,39 @@
#undef A
#undef B
#undef C
#undef B
#undef C
#undef D
#undef E
#undef F
#undef G
#undef G
#undef H
#define A -2.0,-0.05,-0.05,
#define B -2.0,-0.05, 0.05,
#define C -2.0, 0.05,-0.05,
#define D -2.0, 0.05, 0.05,
#define E 2.0,-0.05,-0.05,
#define F 2.0,-0.05, 0.05,
#define G 2.0, 0.05,-0.05,
#define H 2.0, 0.05, 0.05,
const float X = 2.0;
const float Y = 0.05;
const float Z = 0.05;
#define A -X,-Y,-Z,
#define B -X,-Y, Z,
#define C -X, Y,-Z,
#define D -X, Y, Z,
#define E X,-Y,-Z,
#define F X,-Y, Z,
#define G X, Y,-Z,
#define H X, Y, Z,
narray_float_t d_axis =
float d_axis[] =
{
3*3*2*6,
A C E
C E G
G E C
E G F
G F H
H F G
F H B
H B D
D B H
B D A
D A C
C A D
C D G
D G H
H G D
A B E
E B A
B E F
};

View File

@@ -7,26 +7,25 @@
#define G 1, 1,-1,
#define H 1, 1, 1,
narray_float_t d_cube =
float d_cube[] =
{
3*3*2*6,
A C E
C E G
G E C
E G F
G F H
H F G
F H B
H B D
D B H
B D A
D A C
C A D
C D G
D G H
H G D
A B E
E B A
B E F
};

View File

@@ -2,6 +2,7 @@ const char * vs =
"#version 330 core\n"
"layout (location = 0) in vec3 aPos;"
"layout (location = 1) in vec3 aNormal;"
"uniform float idx;"
"uniform mat4 fix;"
@@ -9,13 +10,19 @@ const char * vs =
"uniform mat4 mdl;"
"out float index;"
"out vec3 Normal;"
"out vec3 FragPos;"
"void main()"
"{"
" index=idx;"
" Normal = mat3(transpose(inverse(rot*mdl))) * aNormal;"
" gl_Position = fix * rot * mdl * vec4( aPos, 1.0 );\n"
" FragPos = vec3( rot * mdl * vec4(aPos, 1.0));"
"}";
const char * fs =
"#version 330 core\n"
@@ -23,8 +30,19 @@ const char * fs =
"in float index;"
"out vec4 FragColor;"
"in vec3 Normal;"
"in vec3 FragPos;"
"void main()"
"{"
" FragColor = texture( palette, vec3( 0, 0, index ) ).rgba;"
" vec4 color = texture( palette, vec3( 0, 0, index ) ).rgba;"
" vec3 lightPos = vec3(0,0,-15);"
" vec3 lightDir = normalize(lightPos - FragPos);"
" float diffuse = max(dot(Normal, lightDir), 0.0);"
" float ambient = 0.5;"
" FragColor = (ambient + diffuse)*color;"
"}";