From fafff7a4e32dcd63e5b33358414d0fa37305f458 Mon Sep 17 00:00:00 2001 From: jvech Date: Sat, 26 Nov 2022 08:40:24 -0500 Subject: feat: obj scale is now possible There is still features to add --- Makefile | 2 +- src/main.c | 6 +++++- src/main.h | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 26317a4..a676b86 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ $(OBJDIR): mkdir ${OBJDIR} $(OBJDIR)/%.o: $(SRCDIR)/%.c - ${CC} -g -c $< -o $@ ${CFLAGS} ${INCLUDE} + ${CC} -c $< -o $@ ${CFLAGS} ${INCLUDE} build: $(OBJS) ${CC} $^ -o ${BIN} ${DLIBS} diff --git a/src/main.c b/src/main.c index c270a2e..c9ffad2 100644 --- a/src/main.c +++ b/src/main.c @@ -118,6 +118,10 @@ processCameraInput(GLFWwindow *window, struct Camera *camObj, float deltaTime) camObj->position = linearVec3Add(camObj->position, tmp); } + if (glfwGetKey(window, GLFW_KEY_DOWN)) scale -= 0.1 * speed; + if (glfwGetKey(window, GLFW_KEY_UP)) scale += 0.1 * speed; + if (glfwGetKey(window, GLFW_KEY_ENTER)) scale = 1; + /* * Mouse Input */ @@ -331,7 +335,7 @@ int main(int argc, char *argv[]) proj = linearPerspective(35, (float)width / height, 0.1, 100); T = linearTranslate(0.0, 0.0, 0.0); R = linearRotate(0, 1.0, 0.0, 0.0); - S = linearScale(1, 1, 1); + S = linearScale(scale, scale, scale); model = linearMat4Muln(3, T, R, S); glUseProgram(shader); diff --git a/src/main.h b/src/main.h index 13b7b28..81f6203 100644 --- a/src/main.h +++ b/src/main.h @@ -1 +1,3 @@ #define vec3(x, y, z) linearVec3(x, y, z).vector + +static float scale = 1; -- cgit v1.2.3-70-g09d2