0.2 Draw axis

This commit is contained in:
PedroEdiaz
2024-09-05 14:48:51 +00:00
parent a2f49afbf4
commit 06e8e9074b
11 changed files with 213 additions and 53 deletions

45
src/data/axis.h Normal file
View File

@@ -0,0 +1,45 @@
#undef A
#undef B
#undef C
#undef D
#undef E
#undef F
#undef G
#undef H
const float X = 2.0;
const float Y = 0.1;
const float Z = 0.1;
#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,
float axis[] =
{
3*3*2*6,
A C E
C E G
E G F
G F H
F H B
H B D
B D A
D A C
C D G
D G H
A B E
B E F
};

View File

@@ -1,15 +1,15 @@
#define A -1,-1,-1,0,
#define B -1,-1, 1,0,
#define C -1, 1,-1,0,
#define D -1, 1, 1,0,
#define E 1,-1,-1,0,
#define F 1,-1, 1,0,
#define G 1, 1,-1,0,
#define H 1, 1, 1,0,
#define A -1,-1,-1,
#define B -1,-1, 1,
#define C -1, 1,-1,
#define D -1, 1, 1,
#define E 1,-1,-1,
#define F 1,-1, 1,
#define G 1, 1,-1,
#define H 1, 1, 1,
int cube[] =
float cube[] =
{
4*3*2*6,
3*3*2*6,
A C E
C E G

View File

@@ -3,21 +3,28 @@ const char * vs =
"layout (location = 0) in vec3 aPos;"
"uniform mat4 cam;"
"uniform mat4 pry;"
"uniform mat4 rotx;"
"uniform mat4 roty;"
"uniform mat4 rotz;"
"uniform float idx;"
"uniform mat4 fix;"
"uniform mat4 rot;"
"uniform mat4 mdl;"
"out float index;"
"void main()"
"{"
" gl_Position = pry * cam * rotx * roty * rotz * vec4( aPos, 1.0 );\n"
" index=idx;"
" gl_Position = fix * rot * mdl * vec4( aPos, 1.0 );\n"
"}";
const char * fs =
"#version 330 core\n"
"uniform sampler2DArray palette;"
"in float index;"
"out vec4 FragColor;"
"void main()"
"{"
" FragColor = vec4( 1.0, 0.5, 0.2, 1.0 );"
" FragColor = texture( palette, vec3( 0, 0, index ) ).rgba;"
"}";