Fix: rotations on R4

This commit is contained in:
PedroEdiaz
2024-11-28 16:23:39 -06:00
parent 1e009d5bdf
commit 6c7c22ce50
5 changed files with 21 additions and 19 deletions

View File

@@ -76,7 +76,8 @@ cocoa: $(OBJ)
$(CC) -framework OpenGL -o $(BIN) $(OBJ) -L. -lGLEW -lGL -lglfw
wasm: $(OBJ)
$(CC) -sUSE_WEBGL2=1 -sUSE_GLFW=3 -o mani.html $(OBJ)
$(CC) -sUSE_WEBGL2=1 -sUSE_GLFW=3 -o $(BIN).js $(OBJ)
chmod -x $(BIN).wasm
libglfw.so:
$(CC) -fPIC -shared $(DFLAGS) -D_GLFW_BUILD_DLL -Iext/glfw/deps/wayland ./ext/glfw/src/*.c -o $@

View File

@@ -40,8 +40,8 @@ const char * vs =
" vec3 aNormal = vec3(aNormal_x,aNormal_y,aNormal_z);"
" vec3 aPos = vec3(aPos_x,aPos_y,aPos_z);"
" aNormal[i] = (vec2(aNormal_w, aNormal[i]) * rotate2d(angle))[0];"
" aPos[i] = (vec2(aPos_w, aPos[i]) * rotate2d(angle))[0];"
" aNormal[i] = (vec2(aNormal[i], aNormal_w) * rotate2d(angle))[0];"
" aPos[i] = (vec2(aPos[i], aPos_w) * rotate2d(angle))[0];"
" Normal = mat3(transpose(inverse(rot*mdl))) * aNormal;"
" gl_Position = fix * rot * mdl * vec4( aPos, 1.0 );\n"

View File

@@ -73,7 +73,6 @@ void __key_callback_input(
}
set_projection_mesh(projection);
return;
}

View File

@@ -58,26 +58,29 @@ void main_loop(void)
{
static float angle = 0;
if( animate_index )
{
angle+=0.01;
load_uint_to_shader( shader, "i", animate_index-1 );
load_uint_to_shader( shader_plain, "i", animate_index-1 );
load_float_to_shader( shader, "angle", angle);
load_float_to_shader( shader_plain, "angle", angle);
}
if( angle > M_PI/2 && angle )
if( angle > M_PI/2 )
{
animate_index=0;
angle = 0;
load_float_to_shader( shader, "angle", angle);
load_float_to_shader( shader_plain, "angle", angle);
set_projection_mesh( projection );
}
if( animate_index )
{
load_uint_to_shader( shader, "i", animate_index-1 );
load_uint_to_shader( shader_plain, "i", animate_index-1 );
angle+=0.01;
load_float_to_shader( shader, "angle", angle);
load_float_to_shader( shader_plain, "angle", angle);
}
}
clean_context();
#ifndef DEBUG
@@ -166,7 +169,6 @@ int main(void)
projection.m = m;
projection.mesh = m_surface;
set_projection_mesh( projection );

View File

@@ -5,7 +5,7 @@
*/
/* #define DEBUG */
#define GLAD
/* #define GLAD */
typedef const void * window_t;
typedef unsigned int id_t;