VoroNode::VoroNode(ofVboMesh _mesh, VoroNode& vnParent) { counter++; isSplit = false; bDraw = true; level = vnParent.level+1; // make the mesh vertices local for the node // move th relative position to the nodes position // transformations on the unit are around the centroid of the mesh not the centroid of the parent mesh = _mesh; setPosition(mesh.getCentroid()); for(int i=0; i<_mesh.getNumVertices(); i++) { mesh.setVertex(i, _mesh.getVertex(i)-_mesh.getCentroid()); } mesh.setupIndicesAuto(); mesh.getVbo(); calculateBoundingBox(); setParent(vnParent); };
//-------------------------------------------------------------- void testApp::setup(){ ofBackground(0); ofSetFrameRate(30); ofEnableAlphaBlending(); // glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // glEnable(GL_DEPTH_TEST); glPointSize(1.0); drawFBO = false; autoRotate = true; drawEQ = false; //not really needed // glEnable(GL_ALPHA_TEST); // glAlphaFunc(GL_GREATER, 0.10f); //generate the mesh points buildSphereMesh(rad, res, vm); cout << "nverts: " << vm.getNumVertices() << endl; cout << "arb: " << ofGetUsingArbTex() << ", norm: " << ofGetUsingNormalizedTexCoords() << endl; //load the texture shader shader.load("tex.vert", "tex.frag"); //fft init fftSmoothed = new float[8192]; memset(fftSmoothed, 0x00, sizeof(float) * 8192); //map the frequencies to bark bands float freq_spc = FREQ_MAX / (float)SPECTRAL_BANDS; for (int i = 0; i < SPECTRAL_BANDS; i++) { int bidx = bark(i * freq_spc); barkmap[i] = bidx; } //load the position updating frag shader pos_shader.load("", "position.frag"); //for the sphere we set this to the resolution which = #of verts along each axis fbo_res = res; //init the fbo's with blank data vector<ofVec3f> fbo_init_data; fbo_init_data.assign(fbo_res * fbo_res, ofVec3f(0.0, 0.0, 0.0)); posbuf.allocate(fbo_res, fbo_res, GL_RGB32F); posbuf.src->getTextureReference().loadData((float *)&fbo_init_data[0], fbo_res, fbo_res, GL_RGB); posbuf.dst->getTextureReference().loadData((float *)&fbo_init_data[0], fbo_res, fbo_res, GL_RGB); //reuse fbo_init_data for no real reason, it just needs to be blank eq_tex.allocate(fbo_res, 1, GL_RGB32F_ARB); eq_tex.loadData((float *)&fbo_init_data[0], fbo_res, 1, GL_RGB); axis_loc = fbo_res; angincr = 180.0/(float)fbo_res; player.loadSound("jhfd.mp3"); player.play(); //go }