rayfract

diff src/rayfract.cc @ 10:1496aae2e7d4

- simplified build by including dependences in the source tree - added make dep tracking - added mingw cross-build rules - added readme & licence
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 31 Jul 2023 18:58:56 +0300
parents 628e7084a482
children
line diff
     1.1 --- a/src/rayfract.cc	Thu Nov 03 13:41:33 2011 +0200
     1.2 +++ b/src/rayfract.cc	Mon Jul 31 18:58:56 2023 +0300
     1.3 @@ -3,7 +3,7 @@
     1.4  #include <string.h>
     1.5  #include <math.h>
     1.6  #include <assert.h>
     1.7 -#include <GL/glew.h>
     1.8 +#include "GL/glew.h"
     1.9  #include <GL/glut.h>
    1.10  #include "sdr.h"
    1.11  #include "gui.h"
    1.12 @@ -13,6 +13,7 @@
    1.13  
    1.14  void disp();
    1.15  void render();
    1.16 +void idle();
    1.17  void reshape(int x, int y);
    1.18  void keyb(unsigned char key, int x, int y);
    1.19  void keyb_up(unsigned char key, int x, int y);
    1.20 @@ -39,12 +40,12 @@
    1.21  unsigned int ray_tex;
    1.22  Vector2 tex_scale;
    1.23  Vector4 seed;
    1.24 -float err_thres = 0.0075;
    1.25 +float err_thres = 0.005;
    1.26  int iter = 10;
    1.27  float reflectivity = 0.2;
    1.28  Vector3 color(0.75, 0.75, 0.75);
    1.29  
    1.30 -int use_stereo;
    1.31 +int use_stereo, benchmark_mode;
    1.32  float eye_sep = 0.5;
    1.33  
    1.34  int main(int argc, char **argv)
    1.35 @@ -75,6 +76,9 @@
    1.36  	glutSpaceballMotionFunc(sball_motion);
    1.37  	glutSpaceballRotateFunc(sball_rot);
    1.38  	glutSpaceballButtonFunc(sball_button);
    1.39 +	if(benchmark_mode) {
    1.40 +		glutIdleFunc(idle);
    1.41 +	}
    1.42  
    1.43  	glewInit();
    1.44  
    1.45 @@ -152,6 +156,11 @@
    1.46  	assert(glGetError() == GL_NO_ERROR);
    1.47  }
    1.48  
    1.49 +void idle()
    1.50 +{
    1.51 +	glutPostRedisplay();
    1.52 +}
    1.53 +
    1.54  void render()
    1.55  {
    1.56  	glMatrixMode(GL_TEXTURE);
    1.57 @@ -290,9 +299,7 @@
    1.58  int prev_x = -1, prev_y;
    1.59  void mouse(int bn, int state, int x, int y)
    1.60  {
    1.61 -	int mod;
    1.62 -
    1.63 -	mod = glutGetModifiers();
    1.64 +	int mod = glutGetModifiers();
    1.65  
    1.66  	if(mod) {
    1.67  		bnstate[bn] = state == GLUT_DOWN ? 1 : 0;
    1.68 @@ -470,6 +477,10 @@
    1.69  				use_stereo = !use_stereo;
    1.70  				break;
    1.71  
    1.72 +			case 'b':
    1.73 +				benchmark_mode = 1;
    1.74 +				break;
    1.75 +
    1.76  			default:
    1.77  				goto invalid;
    1.78  			}