Created
January 18, 2013 23:23
-
-
Save wridgers/4569544 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool Tracer::loadExampleScene() | |
{ | |
// render settings | |
// lighting settings | |
Tracer::useAmbientLighting(true); | |
Tracer::setAmbientLightingColour(Colour(255, 255, 255)); | |
Tracer::setAmbientLightingIntensity(0.05); | |
// lights | |
// create a light | |
Light *light = new Light(); | |
light->setPosition(Vector3(500,500,0)); | |
light->setColour(Colour(255,255,255)); | |
// add to the scene | |
Tracer::lights.push_back(light); | |
// camera | |
Tracer::camera = new Camera(); | |
// props | |
// props need materials | |
Sphere *sphere = new Sphere(); | |
sphere->setPosition(Vector3(150,0,200)); | |
sphere->setRadius(100); | |
// give it a material | |
Material *red = new Material(); | |
red->setColour(Colour(255,0,0)); | |
// apply! | |
sphere->setMaterial(red); | |
// add it to the scene | |
Tracer::spheres.push_back(sphere); | |
// another sphere! | |
sphere = new Sphere(); | |
sphere->setPosition(Vector3(-150,0,200)); | |
sphere->setRadius(100); | |
// give it a material | |
Material *blue = new Material(); | |
blue->setColour(Colour(0,0,255)); | |
blue->setSpecularReflectionCoeff(0); | |
// apply! | |
sphere->setMaterial(blue); | |
// add it to the scene | |
Tracer::spheres.push_back(sphere); | |
// another sphere! | |
sphere = new Sphere(); | |
sphere->setPosition(Vector3(0,0,800)); | |
sphere->setRadius(100); | |
// apply! | |
sphere->setMaterial(red); | |
// add it to the scene | |
Tracer::spheres.push_back(sphere); | |
// action! | |
return true; | |
// TODO: delete scene | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment