clray

diff src/rt.cc @ 16:9e4a28063394

cl compiler segfaults...
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 09 Aug 2010 04:18:21 +0100
parents 754faf15ba36
children 4b1604f9798a
line diff
     1.1 --- a/src/rt.cc	Sun Aug 08 09:51:45 2010 +0100
     1.2 +++ b/src/rt.cc	Mon Aug 09 04:18:21 2010 +0100
     1.3 @@ -25,11 +25,13 @@
     1.4  	int xsz, ysz;
     1.5  	int num_faces, num_lights;
     1.6  	int max_iter;
     1.7 +	float ambient[4];
     1.8  	int dbg;
     1.9  };
    1.10  
    1.11  struct Ray {
    1.12  	float origin[4], dir[4];
    1.13 +	float energy;
    1.14  };
    1.15  
    1.16  struct Light {
    1.17 @@ -45,7 +47,7 @@
    1.18  static int global_size;
    1.19  
    1.20  static Light lightlist[] = {
    1.21 -	{{-10, 10, -20, 0}, {1, 1, 1, 1}}
    1.22 +	{{-10, 13, -20, 0}, {1, 1, 1, 1}}
    1.23  };
    1.24  
    1.25  
    1.26 @@ -55,6 +57,9 @@
    1.27  bool init_renderer(int xsz, int ysz, Scene *scn)
    1.28  {
    1.29  	// render info
    1.30 +	rinf.ambient[0] = rinf.ambient[1] = rinf.ambient[2] = 0.075;
    1.31 +	rinf.ambient[3] = 0.0;
    1.32 +
    1.33  	rinf.xsz = xsz;
    1.34  	rinf.ysz = ysz;
    1.35  	rinf.num_faces = scn->get_num_faces();
    1.36 @@ -98,6 +103,10 @@
    1.37  		return false;
    1.38  	}
    1.39  
    1.40 +	if(!prog->build()) {
    1.41 +		return false;
    1.42 +	}
    1.43 +
    1.44  	delete [] prim_rays;
    1.45  
    1.46  	global_size = xsz * ysz;
    1.47 @@ -250,7 +259,7 @@
    1.48  	py *= 100.0;
    1.49  	pz *= 100.0;
    1.50  
    1.51 -	Ray ray = {{0, 0, 0, 1}, {px, py, -pz, 1}};
    1.52 +	Ray ray = {{0, 0, 0, 1}, {px, py, -pz, 1}, 1.0};
    1.53  	return ray;
    1.54  }
    1.55