Пример #1
0
void CreateScene(Scene& scene)
{
	scene.Clear();

	scene.EnableLighting = true;
	scene.EnableFlatShading = false;

	float r = 0.5;
	float count = 12;

	scene.SetAmbient(Color(0.2, 0.2, 0.2));
	scene.AddLight(Point3D(100,0,30), Color(0.8, 0.8, 0.8));
	scene.AddLight(Point3D(0,100,80), Color(0.5, 0.5, 0.5));

	// Red octant: Moderate specular, moderate shininess
	scene.modeling.Push();
	scene.SetColor(HSVColor(0.00, 1.0, 0.7), HSVColor(0.0, 0.0, 0.8), 30);
	scene.modeling.Translate( 0.5, -0.5, 0);
	CreateSphereOctant(scene, r, count);
	scene.modeling.Pop();

	// Blue octant: High specular, high shininess
	scene.modeling.Push();
	scene.SetColor(HSVColor(0.66, 1.0, 0.9), HSVColor(0.0, 0.0, 1.5), 120);
	scene.modeling.Translate(-0.5,  0.5, 0);
	CreateSphereOctant(scene, r, count);
	scene.modeling.Pop();

	// Green octant:  No specular
	scene.modeling.Push();
	scene.SetColor(HSVColor(0.33, 1.0, 0.7), HSVColor(0.0, 0.0, 0.0), 0);
	scene.modeling.Translate(-0.5, -0.5, 0);
	CreateSphereOctant(scene, r, count);
	scene.modeling.Pop();
}
Пример #2
0
////////////////////////////////////////////////////////////////////////
// Called by GLut when there are keyboard messages.
void KeyboardInput(unsigned char key, int, int)
{

	switch(key) {
	case '1':
	case '2':
	case '3':
	case '4':
	case '5':
	case '6':
	case '7':
	case '8':
	case '9':
		sceneID = key - '0';
		scene.Clear();
	    CreateScene(scene);
	    PreprocessScene(scene);
		glutIdleFunc(&Update);
	    break;
	case 'g':
		scene.UseOpenGLRendering = !scene.UseOpenGLRendering;
		glutIdleFunc(&Update);
		break;
	case 'a':
		scene.UseAntiAliasing = !scene.UseAntiAliasing;
		glutIdleFunc(&Update);
		break;
	case 27:					// Escape key
	case 'q':
		exit(EXIT_SUCCESS);
	}
}
Пример #3
0
void CreateScene(Scene& scene)
{
	scene.Clear();

	scene.EnableLighting = false;
	scene.EnableFlatShading = false;

	TileTexture* tile = new TileTexture(256,256);
	WoodTexture* wood = new WoodTexture(256,256);

	scene.SetAmbient(Color(0.4, 0.4, 0.4));
	scene.AddLight(Point3D(100,80,50), Color(0.8, 0.8, 0.8));
	scene.AddLight(Point3D(-100,-80,-50), Color(0.8, 0.8, 0.8));

	scene.SetTexture(tile, NULL);
	scene.modeling.Push();
	scene.modeling.Translate(-0.6, 0.0, 0);
	scene.SetColor(HSVColor(0.083, 0.75, 0.8), HSVColor(0.0, 0.0, 0.0), 0);
	CreateRect(scene, 1.0, 1.0);
	scene.modeling.Pop();

	scene.SetTexture(wood, NULL);
	scene.modeling.Push();
	scene.modeling.Translate(0.6, 0.0, 0);
	scene.SetColor(HSVColor(0.125, 0.7, 0.8), HSVColor(0.0, 0.0, 0.0), 0);
	CreateRect(scene, 1.0, 1.0);
	scene.modeling.Pop();
}
Пример #4
0
void CreateScene(Scene& scene)
{
	scene.Clear();

	scene.EnableLighting = false;
	scene.EnableFlatShading = false;

	ReflTexture* refl = new ReflTexture();

	scene.SetAmbient(Color(0.4, 0.4, 0.4));
	scene.AddLight(Point3D(0,-100,80), Color(0.8, 0.8, 0.8));

	scene.SetTexture(NULL, NULL, refl);
	scene.modeling.Push();
	scene.SetColor(HSVColor(0.66, 1.0, 0.9), HSVColor(0.0, 0.0, 1.5), 120);
	Reflector(scene, 12*4, 12*4);
	scene.modeling.Pop();
}