MyCaveGeneratorTestLoop(Window *w) : SDLLoop(w) { cout << "Initializing glew\n"; glewInit(); cout << "Binding program\n"; program.addShader(Shader(GL_VERTEX_SHADER, "functional/phong/shader.vp")); program.addShader(Shader(GL_FRAGMENT_SHADER, "functional/phong/shader.fp")); program.link(); program.bind(); cout << "Getting locations of shader parameters\n"; vertexLocation = program.getAttributeLocation("vPosition"); texCoordLocation = program.getAttributeLocation("uv"); vertexColorLocation = program.getAttributeLocation("vColor"); samplerLocation = program.getUniformLocation("image"); modelLocation = program.getUniformLocation("model"); perspectiveLocation= program.getUniformLocation("perspective"); normalLocation = program.getAttributeLocation("Normal"); ambientProductLocation = program.getUniformLocation("ambientProduct"); diffuseProductLocation = program.getUniformLocation("diffuseProduct"); specularProductLocation = program.getUniformLocation("specularProduct"); lightPositionLocation = program.getUniformLocation("LightPosition"); shininessLocation = program.getUniformLocation("shininess"); program.enableAttributeArray(vertexLocation); program.enableAttributeArray(texCoordLocation); program.enableAttributeArray(vertexColorLocation); program.enableAttributeArray(normalLocation); signal = new PerlinSignal; signal->addFrequency(2, 0.2); signal->addFrequency(16, 0.01); }
MyArray3DLayeredHeightfieldTestLoop(Window *w) : SDLLoop(w) { cout << "Initializing glew\n"; glewInit(); cout << "Binding program\n"; program.addShader(Shader(GL_VERTEX_SHADER, "functional/phong/shader.vp")); program.addShader(Shader(GL_FRAGMENT_SHADER, "functional/phong/shader.fp")); program.link(); program.bind(); cout << "Getting locations of shader parameters\n"; vertexLocation = program.getAttributeLocation("vPosition"); texCoordLocation = program.getAttributeLocation("uv"); vertexColorLocation = program.getAttributeLocation("vColor"); samplerLocation = program.getUniformLocation("image"); modelLocation = program.getUniformLocation("model"); perspectiveLocation= program.getUniformLocation("perspective"); normalLocation = program.getAttributeLocation("Normal"); ambientProductLocation = program.getUniformLocation("ambientProduct"); diffuseProductLocation = program.getUniformLocation("diffuseProduct"); specularProductLocation = program.getUniformLocation("specularProduct"); lightPositionLocation = program.getUniformLocation("LightPosition"); shininessLocation = program.getUniformLocation("shininess"); program.enableAttributeArray(vertexLocation); program.enableAttributeArray(texCoordLocation); program.enableAttributeArray(vertexColorLocation); program.enableAttributeArray(normalLocation); signal = new PerlinSignal; signal->addFrequency(2, 0.5); signal->addFrequency(16, 0.01); generator = new MyLayeredVoxeledHeightfield(signal); voxels = new Array3D<bool>(128, 128, 128); generator->populateArray(voxels, 128); for (int j = 0; j<5; j++) make_hole(*voxels); for (int i =0; i<10; i++) (*voxels).copy(erode(*voxels)); adapter = new Array3DLayeredHeightfieldAdapter(*voxels); adapter->generate(); h = adapter->getField(); cout << "Number of levels " << h->levelCount() << endl; }
MyVoxeledTerrainTestLoop(Window *w) : SDLLoop(w) { cout << "Initializing glew\n"; glewInit(); cout << "Binding program\n"; program.addShader(Shader(GL_VERTEX_SHADER, "functional/scene/shader.vp")); program.addShader(Shader(GL_FRAGMENT_SHADER, "functional/scene/shader.fp")); program.link(); program.bind(); cout << "Getting locations of shader parameters\n"; vertexLocation = program.getAttributeLocation("vPosition"); texCoordLocation = program.getAttributeLocation("uv"); vertexColorLocation = program.getAttributeLocation("vColor"); samplerLocation = program.getUniformLocation("image"); modelLocation = program.getUniformLocation("model"); perspectiveLocation= program.getUniformLocation("perspective"); normalLocation = program.getAttributeLocation("Normal"); ambientProductLocation = program.getUniformLocation("ambientProduct"); diffuseProductLocation = program.getUniformLocation("diffuseProduct"); specularProductLocation = program.getUniformLocation("specularProduct"); lightPositionLocation = program.getUniformLocation("LightPosition"); shininessLocation = program.getUniformLocation("shininess"); cout << program.getAttributeLocation("vPosition")<< endl; cout << program.getAttributeLocation("uv")<< endl; cout << program.getAttributeLocation("vColor")<< endl; cout << program.getUniformLocation("image")<< endl; cout << program.getUniformLocation("model")<< endl; cout << program.getUniformLocation("perspective")<< endl; cout << program.getAttributeLocation("Normal")<< endl; cout << program.getUniformLocation("ambientProduct")<< endl; cout << program.getUniformLocation("diffuseProduct")<< endl; cout << program.getUniformLocation("specularProduct")<< endl; cout << program.getUniformLocation("LightPosition")<< endl; cout << program.getUniformLocation("shininess")<< endl; cout << "Normal location: " << normalLocation << endl; program.enableAttributeArray(vertexLocation); program.enableAttributeArray(texCoordLocation); program.enableAttributeArray(vertexColorLocation); program.enableAttributeArray(normalLocation); }