From 59c564d8a2077ce90e7c83fdb276b80c9bfa238c Mon Sep 17 00:00:00 2001 From: John Tsiombikas Date: Wed, 25 Dec 2019 13:41:54 +0200 Subject: [PATCH 1/1] ropesim tool minor progr. --- tools/ropesim/Makefile | 1 + tools/ropesim/src/main.c | 27 +++++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/tools/ropesim/Makefile b/tools/ropesim/Makefile index 9270553..c1ff4ae 100644 --- a/tools/ropesim/Makefile +++ b/tools/ropesim/Makefile @@ -3,6 +3,7 @@ obj = $(src:.c=.o) bin = ropesim def = -DUSE_ASSIMP +inc = -I../../src warn = -pedantic -Wall -Wno-int-to-pointer-cast CFLAGS = $(warn) -g $(def) diff --git a/tools/ropesim/src/main.c b/tools/ropesim/src/main.c index dcabef5..bb5e5c5 100644 --- a/tools/ropesim/src/main.c +++ b/tools/ropesim/src/main.c @@ -2,6 +2,7 @@ #include #include #include "cmesh.h" +#include "cgmath/cgmath.h" int init(void); void cleanup(void); @@ -20,11 +21,13 @@ int prev_mx, prev_my; int bnstate[8]; struct cmesh *scn; +struct cmesh *mesh_gout, *mesh_gin, *mesh_suz; +cgm_vec3 ganchor[4]; int main(int argc, char **argv) { glutInit(&argc, argv); - glutInitWindowSize(800, 600); + glutInitWindowSize(1280, 800); glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); glutCreateWindow("ropesim"); @@ -50,7 +53,10 @@ int main(int argc, char **argv) int init(void) { - float amb[] = {0.05, 0.05, 0.08, 1}; + static const char *meshnames[] = {"suzanne", "gimbal_outer", "gimbal_inner"}; + static struct cmesh **meshes[] = {&mesh_suz, &mesh_gout, &mesh_gin}; + static const float amb[] = {0.05, 0.05, 0.08, 1}; + int i; glEnable(GL_CULL_FACE); glEnable(GL_DEPTH_TEST); @@ -65,11 +71,28 @@ int init(void) fprintf(stderr, "failed to load scene file\n"); return -1; } + + for(i=0; i