Material::Material()
		{
			//Set default lighting and shadows
			SetLightingEnabled(false);
			SetLightingMode(ePhong);
			SetBlendMode(eAdditive);
			SetReceiveShadows(false);

#if defined ION_RENDERER_SHADER
			m_vertexShader = NULL;
			m_pixelShader = NULL;
#endif
		}
Exemple #2
0
bool World::Load()
{
	conf.ParseConfigFile("Data/ConfigFile.txt"); // load configuration file
	
	// Order of loading: Lights -> Textures -> Shaders -> Geometry -> Particles -> Seasons

	LoadLights();
	LoadTextures();
	LoadSounds();
	LoadShaders();
	LoadGeometry();
	LoadParticles();
	
	SetupSeasons();
	
	//glLightModelfv(GL_LIGHT_MODEL_AMBIENT, Color::BLACK.GetVec());
	glLightModelfv(GL_LIGHT_MODEL_AMBIENT, Color::WHITE.GetVec());

	SetLightingMode(Spotlights);

	return true;
};
Exemple #3
0
bool World::LoadGeometry()
{
	// Load house model
	{
		vector<GraphicsObject> objVec;
		OBJLoader::LoadOBJFile("Data/House/Haus20.obj", objVec);
		houseModel = objVec[0];
		houseModel.SetScale(float3(.05f,.05f,.05f));
		houseModel.SetPosition(float3(-5.5,0,0.5));
		houseModel.AddTexture(houseTexture);
		houseModel.AddTexture(houseNormalMap);
	}

	// Load globe base
	{
		vector<GraphicsObject> objVec;
		OBJLoader::LoadOBJFile("Data/base2.obj", objVec);
		baseModel = objVec[0];
		baseModel.AddTexture(baseTexture);
		baseModel.SetPosition(float3(0, 0.2f, 0));
		baseModel.SetScale(float3(2.0f, 0.45f, 2.0f));
	}

	// Load bolt model
	{
		vector<GraphicsObject> objVec;
		OBJLoader::LoadOBJFile("Data/bolt.obj", objVec);
		boltModel = objVec[0];
		
		boltModel.GetMaterial().SetAmbientDiffuseSpecularEmissive(color(0.0f), color(1.0f, 0.8f, 0.0f, 0.0f), color(1.0f));
		boltModel.GetMaterial().SetShininess(20);
	}

	// Load globe
	f32 radius = conf.Read("GlobeRadius", 11.3f);
	//globeSphere.Create(radius, 40, 40);
	globeSphere.SetOrientation(float3(270,0,0));
	globeSphere.Create(radius, 40, 40, true);
	globeSphere.SetPosition(float3(0.3f,0,0));

	// Load terrain
	terrain.Load("Data/Textures/ground_heightmap.bmp");
	terrain.AddTexture(grassTexture);
	terrain.AddTexture(displacementTexture);
	terrain.AddTexture(snowTexture);
	terrain.AddTexture(terrainNormalMapFull);
	terrain.SetXRotation(-90);
	terrain.SetZRotation(-90);
	terrain.SetScale(float3(5.48f,5.48f,5.48f));

	terrain.GetMaterial().SetAmbientDiffuseSpecularEmissive(color(0.5f), color(0.95f), color(0.3f));
	terrain.GetMaterial().SetShininess(50);

	// Load tree
	tree = new FractalTree();
	tree->SetPosition(float3(2.5f, 0, 0.2f));
	tree->SetTexture(barkTexture);
	tree->SetNormalMap(barkNormalMap);
	tree->SetBranchLength(0.6f);
	tree->SetBranchRotationAngles(30);
	//tree->SetInitialString("FFF[A][^^^^^^A]");
	tree->SetInitialString("A");
	tree->AddProductionRule('A', "F[^B][^^^^^^^B]");
	tree->AddProductionRule('B', "F^[L-BL]^B");
	i32 gen = conf.Read("LSystemGenerations", 8);
	tree->SetGenerations(gen);
	tree->BuildTree();
	tree->SetActive(false);

	SetLightingMode(Spotlights); // default to directional lights

	globeSphere.SetShader(globeShader);

	// light sphere
	lightSphere.Create(0.5,20,20);
	lightSphere.AddTexture(barkTexture);

	// spotlight cone (cylinder)
	spotCone.Create(0.1f, 0.3f, 0.45f, 10, 10);
	spotCone.AddTexture(baseTexture);
	spotCone.SetPosition(spotlights[0].GetPosition().ToFloat3());

	SetTreeShadeMode(SmoothTextured);

	return true;
};