Commit c9e39a0c authored by Sabrina Templeton's avatar Sabrina Templeton
Browse files

pushing to test on philip's computer

parent 9488e0b7
// the version should be specified by a macro at compile time
// e.g. #version 410 or #version 330
//#version 410
#extension GL_ARB_gpu_shader_fp64 : enable
layout (points) in;
precision highp float;
......@@ -54,28 +55,30 @@ uniform usamplerBuffer nn; //ask about why this has to be u I don't really under
// render full polygon
void render_poly(vec3[MAX_VERTS] poly, vec3 center, int space){
vec3 p0;
vec3 p1;
for (int i = 0; i < space; i++){
if (i == space-1){
p0 = poly[space -1];
p1 = poly[0];
}
else{
p0 = poly[i];
p1 = poly[i+1];
}
vec3 p0 = poly[0];
//vec3 p1;
for (int i = 0; i < space -2; i++){
// if (i == space-1){
// p0 = poly[space -1];
// p1 = poly[0];
// }
// else{
// p0 = poly[i];
// p1 = poly[i+1];
// }
gl_Position = u_ModelViewProjectionMatrix*vec4(p0, 1.0);
v_Index = float(instance_ID[0]);
EmitVertex();
gl_Position = u_ModelViewProjectionMatrix*vec4(p1, 1.0);
gl_Position = u_ModelViewProjectionMatrix*vec4(poly[i+1], 1.0);
v_Index = float(instance_ID[0]);
EmitVertex();
gl_Position = u_ModelViewProjectionMatrix*vec4(center, 1.0);
gl_Position = u_ModelViewProjectionMatrix*vec4(poly[i+2], 1.0);
//gl_PrimitiveID = instance_ID[0];
v_Index = float(instance_ID[0]);
EmitVertex();
......@@ -241,6 +244,19 @@ void calc_poly(vec3 zi, vec3 zj, inout vec3[MAX_VERTS] curr_poly, inout int cspa
}
int counter = 0;
for (int i = 0; i < nspace; i++) {
bool ok = true;
for (int k = 0; k < i; k++) {
if (distance(new_poly[i],new_poly[k]) < 1e-12) {
ok = false;
break;
}
}
if (!ok) continue;
curr_poly[counter++] = new_poly[i];
}
nspace = counter;
// note to self: this is definitely outside of the loop ( and should remain to be)
curr_poly = new_poly; // does this need to be a deep copy? I don't think so.
cspace = nspace; // setting the current space to be the new space so that it is updated for the new polygon.
......@@ -348,6 +364,7 @@ main() {
furthest_pt = curr_pt;
}
}
//render_square(furthest_pt, .02);
// if (site_idx == 0){
// render_square(furthest_pt, i * .001);
......@@ -364,7 +381,7 @@ main() {
}
//if (site_idx == 0) {
render_poly(curr_poly, p0, space);
render_square(vec3(1, 1, 0), .01);
//render_square(vec3(1, 1, 0), .01);
//}
//render_square(p0, .03);
......
......@@ -83,12 +83,12 @@ UT_TEST_CASE( test1 )
int size = num_points*3;
int DEBUG = 0;
///*// uncomment this to restore to random
std::vector<graphics::gl_float> seeds;
srand (time(NULL));
if (DEBUG == 0){
for (int i = 0; i < size; i ++){
double val = double(rand()) / double(RAND_MAX);
if ((i - 2) % 3 == 0){
......@@ -104,9 +104,25 @@ UT_TEST_CASE( test1 )
};
// //std::cout << "Test Print!!!!!!!!!!!!!";
}
else{
float dx = 1 / (sqrt(num_points) + 1); //delta y is the same if we're going for a grid
std::cout << dx << std::endl;
for (int i = 1; i < sqrt(num_points) +1; i ++ ){
for (int j = 1; j < sqrt(num_points) +1; j ++ ){
float x = j * dx;
float y = i * dx;
seeds.push_back(x);
seeds.push_back(y);
seeds.push_back(0.0);
}
}
}
//here is the non random way to generate points
// //here is the non random way to generate points
// float dx = 1 / (sqrt(num_points) + 1); //delta y is the same if we're going for a grid
// std::cout << dx << std::endl;
// for (int i = 1; i < sqrt(num_points) +1; i ++ ){
......@@ -325,7 +341,7 @@ UT_TEST_CASE( test1 )
int points_remaining = num_points;
int first_point_to_draw = 0;
int call_size = 1e3;
int call_size = 1e4;
while (points_remaining > 0){
//std::cout << "one iteration" << std::endl;
std::cout << points_remaining << std::endl;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment