clray

diff src/rt.cc @ 20:63a6b46f58a0

fixed
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 09 Aug 2010 12:55:40 +0100
parents 8baea9b66b50
children bd6c2b25f6e7
line diff
     1.1 --- a/src/rt.cc	Mon Aug 09 06:45:57 2010 +0100
     1.2 +++ b/src/rt.cc	Mon Aug 09 12:55:40 2010 +0100
     1.3 @@ -16,7 +16,6 @@
     1.4  	KARG_PRIM_RAYS,
     1.5  	KARG_XFORM,
     1.6  	KARG_INVTRANS_XFORM,
     1.7 -	KARG_OUTFACES,	/* DBG */
     1.8  
     1.9  	NUM_KERNEL_ARGS
    1.10  };
    1.11 @@ -26,7 +25,6 @@
    1.12  	int num_faces, num_lights;
    1.13  	int max_iter;
    1.14  	float ambient[4];
    1.15 -	int dbg;
    1.16  };
    1.17  
    1.18  struct Ray {
    1.19 @@ -64,7 +62,6 @@
    1.20  	rinf.num_faces = scn->get_num_faces();
    1.21  	rinf.num_lights = sizeof lightlist / sizeof *lightlist;
    1.22  	rinf.max_iter = 6;
    1.23 -	rinf.dbg = 8;
    1.24  
    1.25  	/* calculate primary rays */
    1.26  	prim_rays = new Ray[xsz * ysz];
    1.27 @@ -96,7 +93,6 @@
    1.28  	prog->set_arg_buffer(KARG_PRIM_RAYS, ARG_RD, xsz * ysz * sizeof *prim_rays, prim_rays);
    1.29  	prog->set_arg_buffer(KARG_XFORM, ARG_RD, 16 * sizeof(float));
    1.30  	prog->set_arg_buffer(KARG_INVTRANS_XFORM, ARG_RD, 16 * sizeof(float));
    1.31 -	prog->set_arg_buffer(KARG_OUTFACES, ARG_WR, rinf.num_faces * sizeof(Face));
    1.32  
    1.33  	if(prog->get_num_args() < NUM_KERNEL_ARGS) {
    1.34  		return false;
    1.35 @@ -126,19 +122,6 @@
    1.36  	}
    1.37  	printf("done\n");
    1.38  
    1.39 -	/* DEBUG */
    1.40 -	CLMemBuffer *dbgbuf = prog->get_arg_buffer(KARG_OUTFACES);
    1.41 -	Face *outfaces = (Face*)map_mem_buffer(dbgbuf, MAP_RD);
    1.42 -	for(int i=0; i<rinf.num_faces; i++) {
    1.43 -		if(!(faces[i] == outfaces[i])) {
    1.44 -			fprintf(stderr, "SKATA %d\n", i);
    1.45 -			return false;
    1.46 -		}
    1.47 -		faces[i] = outfaces[i];
    1.48 -	}
    1.49 -	printf("equality test passed\n");
    1.50 -	unmap_mem_buffer(dbgbuf);
    1.51 -
    1.52  
    1.53  	CLMemBuffer *mbuf = prog->get_arg_buffer(KARG_FRAMEBUFFER);
    1.54  	void *fb = map_mem_buffer(mbuf, MAP_RD);
    1.55 @@ -152,16 +135,6 @@
    1.56  	return true;
    1.57  }
    1.58  
    1.59 -void dbg_set_dbg(int dbg)
    1.60 -{
    1.61 -	printf("setting dbg: %d\n", dbg);
    1.62 -
    1.63 -	CLMemBuffer *mbuf = prog->get_arg_buffer(KARG_RENDER_INFO);
    1.64 -	RendInfo *rinf = (RendInfo*)map_mem_buffer(mbuf, MAP_WR);
    1.65 -	rinf->dbg = dbg;
    1.66 -	unmap_mem_buffer(mbuf);
    1.67 -}
    1.68 -
    1.69  void dbg_render_gl(Scene *scn)
    1.70  {
    1.71  	float lpos[] = {-1, 1, 10, 0};
    1.72 @@ -199,18 +172,6 @@
    1.73  			glVertex3fv(pos);
    1.74  		}
    1.75  	}
    1.76 -
    1.77 -	/*for(size_t i=0; i<scn->meshes.size(); i++) {
    1.78 -		Material *mat = &scn->matlib[scn->meshes[i]->matid];
    1.79 -
    1.80 -		glColor3f(mat->kd[0], mat->kd[1], mat->kd[2]);
    1.81 -		for(size_t j=0; j<scn->meshes[i]->faces.size(); j++) {
    1.82 -			for(int k=0; k<3; k++) {
    1.83 -				float *pos = scn->meshes[i]->faces[j].v[k].pos;
    1.84 -				glVertex3f(pos[0], pos[1], pos[2]);
    1.85 -			}
    1.86 -		}
    1.87 -	}*/
    1.88  	glEnd();
    1.89  
    1.90  	glPopMatrix();