Commit eb135b3ccf2780c20b8d7679c3196ef933f500e6
1 parent
1b78fd76
fixed compatibility with stim::vec3
Showing
1 changed file
with
10 additions
and
9 deletions
Show diff stats
main.cpp
... | ... | @@ -28,8 +28,8 @@ stim::gl_network<float> T; //test network |
28 | 28 | |
29 | 29 | //hard-coded parameters |
30 | 30 | float resample_rate = 0.5; //sample rate for the network (fraction of sigma used as the maximum sample rate) |
31 | -float camera_factor = 1.2; //start point of the camera as a function of X and Y size | |
32 | -float orbit_factor = 0.01; //degrees per pixel used to orbit the camera | |
31 | +float camera_factor = 1.2f; //start point of the camera as a function of X and Y size | |
32 | +float orbit_factor = 0.01f; //degrees per pixel used to orbit the camera | |
33 | 33 | |
34 | 34 | //mouse position tracking |
35 | 35 | int mouse_x; |
... | ... | @@ -78,9 +78,9 @@ void glut_render_modelview(){ |
78 | 78 | |
79 | 79 | glMatrixMode(GL_MODELVIEW); //load the modelview matrix for editing |
80 | 80 | glLoadIdentity(); //start with the identity matrix |
81 | - stim::vec<float> eye = cam.getPosition(); //get the camera position (eye point) | |
82 | - stim::vec<float> focus = cam.getLookAt(); //get the camera focal point | |
83 | - stim::vec<float> up = cam.getUp(); //get the camera "up" orientation | |
81 | + stim::vec3<float> eye = cam.getPosition(); //get the camera position (eye point) | |
82 | + stim::vec3<float> focus = cam.getLookAt(); //get the camera focal point | |
83 | + stim::vec3<float> up = cam.getUp(); //get the camera "up" orientation | |
84 | 84 | |
85 | 85 | gluLookAt(eye[0], eye[1], eye[2], focus[0], focus[1], focus[2], up[0], up[1], up[2]); //set up the OpenGL camera |
86 | 86 | } |
... | ... | @@ -170,7 +170,8 @@ void glut_initialize(){ |
170 | 170 | |
171 | 171 | int myargc = 1; //GLUT requires arguments, so create some bogus ones |
172 | 172 | char* myargv[1]; |
173 | - myargv [0]=strdup ("netmets"); | |
173 | + myargv[0] = (char*)malloc(1); | |
174 | + myargv[0][0] = 'h'; | |
174 | 175 | |
175 | 176 | glutInit(&myargc, myargv); //pass bogus arguments to glutInit() |
176 | 177 | glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA); //generate a color buffer, depth buffer, and enable double buffering |
... | ... | @@ -186,10 +187,10 @@ void glut_initialize(){ |
186 | 187 | |
187 | 188 | texture_initialize(); //set up texture mapping (create texture maps, enable features) |
188 | 189 | |
189 | - stim::vec<float> c = bb.center(); //get the center of the network bounding box | |
190 | + stim::vec3<float> c = bb.center(); //get the center of the network bounding box | |
190 | 191 | |
191 | 192 | //place the camera along the z-axis at a distance determined by the network size along x and y |
192 | - cam.setPosition(c + stim::vec<float>(0, 0, camera_factor * std::max(bb.size()[0], bb.size()[1]))); | |
193 | + cam.setPosition(c + stim::vec3<float>(0, 0, camera_factor * std::max(bb.size()[0], bb.size()[1]))); | |
193 | 194 | cam.LookAt(c[0], c[1], c[2]); //look at the center of the network |
194 | 195 | } |
195 | 196 | |
... | ... | @@ -247,7 +248,7 @@ int main(int argc, char* argv[]) |
247 | 248 | |
248 | 249 | if(args.nargs() == 2){ //if two files are specified, they will be displayed in neighboring viewports and compared |
249 | 250 | num_nets = 2; //set the number of networks to two |
250 | - float sigma = args["sigma"].as_float(); //get the sigma value from the user | |
251 | + float sigma = (float)args["sigma"].as_float(); //get the sigma value from the user | |
251 | 252 | T.load_obj(args.arg(1)); //load the second (test) network |
252 | 253 | |
253 | 254 | GT = GT.resample(resample_rate * sigma); //resample both networks based on the sigma value | ... | ... |