Exemple #1
0
void Picture::render(Pixel* px)
{
	Color *ambient = new Color(1, 1, 1);
	Vertex *eye = new Vertex(0,0,0);
	Light *light = new Light();
	double attenuation = 0;
//while(true)
//{

   char* fileName = "sphere.txt";
   //cout<<"calling read object"<<endl;
   BasicObject* sphere = readObject(fileName);
   sphere->computeSandT();
   //sphere->printFaces();
   //cout<<"called it bitches"<<endl;
   //delete[] fileName;  //mingw appears to delete this automatically

   fileName = "trs.txt";
   InstanceObject* sphereInstance = buildInstanceObject(fileName, sphere);
   //delete[] fileName;

   //obtaining the window transform
   int widthPixels = px->getWidth();  //the dimensions of the panel on which the drawing will occur
   int heightPixels = px->getHeight();

   getShaderInfo(eye, ambient, light, &attenuation);
   Scene* scene = new Scene(light, ambient);
   scene->buildTransform(getCameraTransform("camera.txt"));
   scene->buildTransform(getPerspectiveTransform("fov.txt", widthPixels, heightPixels));
   scene->buildTransform(AffineTransforms::window(widthPixels, heightPixels));


   TransformNode* tn = new TransformNode();
   tn->addChild(sphereInstance);
   scene->addTransformNode(tn);

   //for(;;)
   //{
   scene->render(px, eye, attenuation);
   //}
   delete scene;
//}
}