main.cpp

This is a simple to-start-with example on how to construct a simple Scene. It contains just the necessary parts to render a red sphere.

main.jpg

#include <3D/Scene.hpp>
#include <3D/Material.hpp>
#include <3D/objects/Sphere.hpp>
#include <3D/Lights.hpp>
#include <3D/Camera.hpp>
#include <wb/Parameters.hpp>

int main(int argc,const char*argv[])
{
        using namespace wb; 
Parameters Param(argc,argv);

        // Construct the World scene
Lux::Scene   World; 

        // Construct a red sphere
Lux::Material Red ( rgb_real(1,0,0) );

Lux::Sphere  Centralsphere( Red, vector3(0,0,0), 0.3 );
        World.add(Centralsphere); 


        // Switch on an infinite light source
Lux::InfiniteLight   Lsinf( 5*rgb_real(1.,1.,1.), vector3(0,0,1));
        Lsinf.On(World); 


        // Setup observer parameters
vector3 Observer(1,-1,0);
vector3 Viewpoint(0,0,0); 

        // Define Camera & Lens
Lux::Camera  Kamera(Observer, Viewpoint); 

Lux::Standardobjektiv  Stdlens(40);

        Kamera.use(Stdlens); 

        // Raytrace it! (standard options may be specified via command line)
        Kamera.action(World,Param["Camera::"],argc,argv);

        return 0;
}

Generated on Wed Jun 17 20:00:14 2009 for Light++ by  doxygen 1.5.6