remove some debug to make it clearer where I left off

master
MitchellHansen 8 years ago
parent 1c750451f3
commit 4c31cfaf48

@ -27,7 +27,7 @@ float4 cast_light_rays(float3 eye_direction, float3 ray_origin, float4 voxel_col
for (int i = 0; i < *light_count; i++) { for (int i = 0; i < *light_count; i++) {
float3 light_direction = (lights[10 * i + 7], lights[10 * i + 8], lights[10 * i + 9]); float3 light_direction = (lights[10 * i + 7], lights[10 * i + 8], lights[10 * i + 9]);
float c = 1.5; float c = 1.0;
if (dot(light_direction, voxel_normal) > 0.0) { if (dot(light_direction, voxel_normal) > 0.0) {
float3 halfwayVector = normalize(light_direction + eye_direction); float3 halfwayVector = normalize(light_direction + eye_direction);
@ -37,9 +37,11 @@ float4 cast_light_rays(float3 eye_direction, float3 ray_origin, float4 voxel_col
} }
} }
/*if (get_global_id(0) == 0) //if (get_global_id(0) == 0)
printf("%f", intensity);*/ // printf("%i", *light_count);
return voxel_color * (intensity) + ambient_constant; voxel_color *= intensity;
voxel_color.w += ambient_constant;
return voxel_color;
// for every light // for every light
// //
@ -174,7 +176,7 @@ __kernel void min_kern(
float3 vox = convert_float3(voxel); float3 vox = convert_float3(voxel);
float3 norm = normalize(convert_float3(mask)); float3 norm = normalize(fabs(convert_float3(mask)));
float4 color = (float4)(0.25, 0.00, 0.25, 1.00); float4 color = (float4)(0.25, 0.00, 0.25, 1.00);

@ -142,13 +142,15 @@ int main() {
c.create_buffer("cam_dir_buffer", sizeof(float) * 4, (void*)camera.get_direction_pointer(), CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR); c.create_buffer("cam_dir_buffer", sizeof(float) * 4, (void*)camera.get_direction_pointer(), CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR);
c.create_buffer("cam_pos_buffer", sizeof(float) * 4, (void*)camera.get_position_pointer(), CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR); c.create_buffer("cam_pos_buffer", sizeof(float) * 4, (void*)camera.get_position_pointer(), CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR);
int light_count = 2;
c.create_buffer("light_count_buffer", sizeof(int), &light_count);
// {r, g, b, i, x, y, z, x', y', z'} // {r, g, b, i, x, y, z, x', y', z'}
sf::Vector3f v = Normalize(sf::Vector3f(1.0, 1.0, 0.0)); sf::Vector3f v = Normalize(sf::Vector3f(1.0, 1.0, 0.0));
float light[] = { 0.4, 0.8, 0.1, 1, 50, 50, 50, v.x, v.y, v.z}; sf::Vector3f v2 = Normalize(sf::Vector3f(1.1, 0.4, 0.7));
c.create_buffer("light_buffer", sizeof(float) * 10, light, CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR); float light[] = { 0.4, 0.8, 0.1, 1, 50, 50, 50, v.x, v.y, v.z,
0.4, 0.8, 0.1, 1, 50, 50, 50, v2.x, v2.y, v2.z};
int light_count = 1; c.create_buffer("light_buffer", sizeof(float) * 10 * light_count, light, CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR);
c.create_buffer("light_count_buffer", sizeof(int), &light_count);
// The drawing canvas // The drawing canvas
unsigned char* pixel_array = new sf::Uint8[WINDOW_X * WINDOW_Y * 4]; unsigned char* pixel_array = new sf::Uint8[WINDOW_X * WINDOW_Y * 4];

Loading…
Cancel
Save