Fix: rotations on R4
This commit is contained in:
3
Makefile
3
Makefile
@@ -76,7 +76,8 @@ cocoa: $(OBJ)
|
|||||||
$(CC) -framework OpenGL -o $(BIN) $(OBJ) -L. -lGLEW -lGL -lglfw
|
$(CC) -framework OpenGL -o $(BIN) $(OBJ) -L. -lGLEW -lGL -lglfw
|
||||||
|
|
||||||
wasm: $(OBJ)
|
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:
|
libglfw.so:
|
||||||
$(CC) -fPIC -shared $(DFLAGS) -D_GLFW_BUILD_DLL -Iext/glfw/deps/wayland ./ext/glfw/src/*.c -o $@
|
$(CC) -fPIC -shared $(DFLAGS) -D_GLFW_BUILD_DLL -Iext/glfw/deps/wayland ./ext/glfw/src/*.c -o $@
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ const char * vs =
|
|||||||
" vec3 aNormal = vec3(aNormal_x,aNormal_y,aNormal_z);"
|
" vec3 aNormal = vec3(aNormal_x,aNormal_y,aNormal_z);"
|
||||||
" vec3 aPos = vec3(aPos_x,aPos_y,aPos_z);"
|
" vec3 aPos = vec3(aPos_x,aPos_y,aPos_z);"
|
||||||
|
|
||||||
" aNormal[i] = (vec2(aNormal_w, aNormal[i]) * rotate2d(angle))[0];"
|
" aNormal[i] = (vec2(aNormal[i], aNormal_w) * rotate2d(angle))[0];"
|
||||||
" aPos[i] = (vec2(aPos_w, aPos[i]) * rotate2d(angle))[0];"
|
" aPos[i] = (vec2(aPos[i], aPos_w) * rotate2d(angle))[0];"
|
||||||
|
|
||||||
" Normal = mat3(transpose(inverse(rot*mdl))) * aNormal;"
|
" Normal = mat3(transpose(inverse(rot*mdl))) * aNormal;"
|
||||||
" gl_Position = fix * rot * mdl * vec4( aPos, 1.0 );\n"
|
" gl_Position = fix * rot * mdl * vec4( aPos, 1.0 );\n"
|
||||||
|
|||||||
@@ -73,7 +73,6 @@ void __key_callback_input(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
set_projection_mesh(projection);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
30
src/main.c
30
src/main.c
@@ -58,26 +58,29 @@ void main_loop(void)
|
|||||||
{
|
{
|
||||||
static float angle = 0;
|
static float angle = 0;
|
||||||
|
|
||||||
|
if( angle > M_PI/2 )
|
||||||
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 )
|
|
||||||
{
|
{
|
||||||
animate_index=0;
|
animate_index=0;
|
||||||
angle = 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();
|
clean_context();
|
||||||
|
|
||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
@@ -166,7 +169,6 @@ int main(void)
|
|||||||
|
|
||||||
projection.m = m;
|
projection.m = m;
|
||||||
projection.mesh = m_surface;
|
projection.mesh = m_surface;
|
||||||
|
|
||||||
set_projection_mesh( projection );
|
set_projection_mesh( projection );
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* #define DEBUG */
|
/* #define DEBUG */
|
||||||
#define GLAD
|
/* #define GLAD */
|
||||||
|
|
||||||
typedef const void * window_t;
|
typedef const void * window_t;
|
||||||
typedef unsigned int id_t;
|
typedef unsigned int id_t;
|
||||||
|
|||||||
Reference in New Issue
Block a user