Beispiel #1
0
void init(void)
{
    glClearColor(0.0, 0.0, 0.0, 1.0);
	// Yeah.. so.. we need an global array with all the avaliable textures to be used with keystrokes for texture selection... 
	std::string texture_array[] = {"0.125", "0.5", "2", "8", "32", "128", "512", "2048"};
	globals.textures = std::vector<std::string>(texture_array,end(texture_array));

	globals.cubemap_0 = loadCubeMap(cubemapDir() + "RomeChurch/prefiltered/"+globals.textures[0]);
	globals.cubemap_1 = loadCubeMap(cubemapDir() + "RomeChurch/prefiltered/"+globals.textures[1]);
	globals.cubemap_2 = loadCubeMap(cubemapDir() + "RomeChurch/prefiltered/"+globals.textures[2]);
	globals.cubemap_3 = loadCubeMap(cubemapDir() + "RomeChurch/prefiltered/"+globals.textures[3]);
	globals.cubemap_4 = loadCubeMap(cubemapDir() + "RomeChurch/prefiltered/"+globals.textures[4]);
	globals.cubemap_5 = loadCubeMap(cubemapDir() + "RomeChurch/prefiltered/"+globals.textures[5]);
	globals.cubemap_6 = loadCubeMap(cubemapDir() + "RomeChurch/prefiltered/"+globals.textures[6]);
    globals.cubemap_7 = loadCubeMap(cubemapDir() + "RomeChurch/prefiltered/"+globals.textures[7]);
	globals.cubemap_sky_box = loadCubeMap(cubemapDir() + "RomeChurch");
	std::string dir = shaderDir();

    loadProgram(shaderDir() + "environment_mapping.vert",
                shaderDir() + "environment_mapping.frag",
                &globals.program);
	
	loadProgram(shaderDir() + "skybox.vert",
				shaderDir() + "skybox.frag",
				&globals.program_sky_box);
		
	

    loadMesh((modelDir() + "gargo.obj"), &globals.mesh);
    createMeshVAO(globals.mesh, &globals.meshVAO);
	createBoxVAO();

    initializeTrackball();
}
Beispiel #2
0
void init(Context &ctx)
{
    ctx.program = loadShaderProgram(shaderDir() + "mesh.vert", shaderDir() + "mesh.frag");

	ctx.skyboxProgram = loadShaderProgram(shaderDir() + "skybox.vert", shaderDir() + "skybox.frag");

    loadMesh((modelDir() + "gargo.obj"), &ctx.mesh);
    createMeshVAO(ctx, ctx.mesh, &ctx.meshVAO);

	createSkyboxVAO(ctx, &ctx.skyboxVAO);

    // Load cubemap texture(s)
    // ...
	const std::string cubemap_path = cubemapDir() + "/Forrest/";
	ctx.cubemap = loadCubemap(cubemap_path);
	const std::string levels[] = { "2048", "512", "128", "32", "8", "2", "0.5", "0.125" };
	for (int i=0; i < NUM_CUBEMAP_LEVELS; i++) {
		ctx.cubemap_prefiltered_levels[i] = loadCubemap(cubemap_path + "prefiltered/" + levels[i]);
	}
	//ctx.cubemap_prefiltered_mipmap = loadCubemapMipmap(cubemap_path + "prefiltered/");
	ctx.cubemap_index = 0;

	ctx.zoom = 1.0f;
	ctx.lensType = LensType::PERSPECTIVE;

    initializeTrackball(ctx);

	ctx.background_color = glm::vec3(0.2f);

	ctx.ambient_light = glm::vec3(0.04f);

	ctx.light_position = glm::vec3(1.0, 1.0, 1.0);
	ctx.light_color = glm::vec3(1.0, 1.0, 1.0);

	ctx.diffuse_color = glm::vec3(0.1, 1.0, 0.1);
	ctx.specular_color = glm::vec3(0.04);
	ctx.specular_power = 60.0f;

	ctx.ambient_weight = 1.0f;
	ctx.diffuse_weight = 1.0f;
	ctx.specular_weight = 1.0f;

	ctx.color_mode = ColorMode::NORMAL_AS_RGB;
	ctx.use_gamma_correction = 1;
	ctx.use_color_inversion = 0;
}