Commit 20de2bce authored by paps's avatar paps

--no commit message

--no commit message
parent dc7417ed
#if defined HAVE_CONFIG_H
#include "config.h"
#endif
......@@ -20,10 +19,10 @@
#include "LrPertNormalPerlin.h"
#include "LrPertColorBasic.h"
#include "LrPertColorTxtPrc3DPerlin.h"
#include "LrPertColorTextProcBois.h"
#include "LrPertColorTextProcTurbulence.h"
#include "LrPertColorTextProcDamier.h"
#include "LrPertColorTextProcMarbre.h"
#include "LrPertColor3DPBois.h"
#include "LrPertColor3DPTurbulence.h"
#include "LrPertColor3DDamier.h"
#include "LrPertColor3DPMarbre.h"
#include "LrEntityLightPoint.h"
#include "LrEntityLightPlane.h"
#include "LrAntiAliasingCentre.h"
......@@ -41,49 +40,73 @@ int main(int argc, char** argv)
/*##################### LES OBJETS de LA SCENE #############################*/
/* Entite A : Sphere */
LrMatrix A_Mat = LrMatrix::translate(LrVector(-1, 15, 0)) * LrMatrix::scale(3);
LrMatrix A_Mat = LrMatrix::scale(2);
LrGeometrySphere A_Geo;
LrPertNormalBasic A_Pn;
LrColor c_bois1((uint8_t)140,(uint8_t)73,(uint8_t)15);
LrColor c_bois2((uint8_t)109,(uint8_t)60,(uint8_t)0);
LrColor c_bois3((uint8_t)67,(uint8_t)40,(uint8_t)0);
LrPertColorTextProcBois A_Pc(c_bois1, c_bois2, c_bois3, 1.0, 1);
LrOpticPhong A_Opt(0.4, 0.6, 0, &A_Pc, &A_Pn, 10);
LrPertNormalPerlin A_Pn2(50);
LrColor c_bois1((uint8_t)140,(uint8_t)73,(uint8_t)0);
LrColor c_bois2((uint8_t)178,(uint8_t)92,(uint8_t)0);
LrColor c_bois3((uint8_t)74,(uint8_t)38,(uint8_t)0);
LrPertColor3DPBois A_Pc(c_bois1, c_bois2, c_bois3, 1.0, 1, 1, COS, false);
LrOpticPhong A_Opt(0, 0.8, 0, 1, &A_Pc, &A_Pn2, 0);
LrEntityElementary A(A_Mat, &A_Geo, &A_Opt);
/**************************************************************************/
/* Entite B : Sphere */
LrMatrix B_Mat = LrMatrix::translate(LrVector(15, 25, 15)) * LrMatrix::scale(2);
LrMatrix B_Mat = LrMatrix::scale(2);
LrColor c_1((uint8_t)175,(uint8_t)17,(uint8_t)17);
LrColor c_2((uint8_t)0,(uint8_t)100,(uint8_t)100);
LrColor c_3((uint8_t)215,(uint8_t)21,(uint8_t)21);
LrPertColorTextProcTurbulence B_Pc(c_2, LrColor::YELLOW, c_3, 1.0, 2);
LrOpticPhong B_Opt(0.5, 0.5, 0, &B_Pc, &A_Pn, 50);
LrColor c_3(LrColor::WHITE);
//LrPertNormalPerlin B_Pn(0.5);
LrPertNormalBasic B_Pn;
LrPertColor3DPTurbulence B_Pc(c_2, c_3, c_3, 1, 6, 1, COS, false);
LrOpticPhong B_Opt(0.5, 0.5, 0, 1, &B_Pc, &B_Pn, 50);
LrEntityElementary B(B_Mat, &A_Geo, &B_Opt);
/**************************************************************************/
/* Entite C : Sphere */
LrMatrix C_Mat = LrMatrix::translate(LrVector(-12, 15, -3)) * LrMatrix::scale(3);
LrPertColorTextProcMarbre C_Pc(LrColor::BLACK, LrColor::WHITE, LrColor::GREY, 1, 4);
LrOpticPhong C_Opt(0.5, 0.5, 0, &C_Pc, &A_Pn, 50);
LrMatrix C_Mat = LrMatrix::scale(2);
LrPertColor3DPMarbre C_Pc(LrColor::BLACK, LrColor::WHITE, LrColor::GREY, 1, 4, 1, LIN, false);
LrOpticPhong C_Opt(0.4, 0.6, 0, 1, &C_Pc, &A_Pn, 50);
LrEntityElementary C(C_Mat, &A_Geo, &C_Opt);
/**************************************************************************/
/* Entite D : Cube*/
LrMatrix D_Mat = LrMatrix::translate(LrVector(5, -2, -2)) * LrMatrix::rotateY(M_PI/4) * LrMatrix::rotateZ(M_PI/4) * LrMatrix::scale(2);
LrMatrix D_Mat = LrMatrix::translate(LrVector(0, 0, -2)) * LrMatrix::scale(2);;
LrGeometryCube D_Geo(false);
LrPertColorBasic D_Pc(LrColor::YELLOW);
LrOpticPhong D_Opt(0, 0.8, 0, &D_Pc, &A_Pn, 25);
//LrPertColorBasic D_Pc(LrColor::YELLOW);
LrColor cb_bois1((uint8_t)140,(uint8_t)73,(uint8_t)0);
LrColor cb_bois2((uint8_t)178,(uint8_t)92,(uint8_t)0);
LrColor cb_bois3((uint8_t)74,(uint8_t)38,(uint8_t)0);
LrPertColor3DPBois D_Pc(cb_bois3, cb_bois1, cb_bois2, 1, 1, 1, COS, false);
LrOpticPhong D_Opt(0, 0.5, 0, 1, &D_Pc, &A_Pn, 25);
LrEntityElementary D(D_Mat, &D_Geo, &D_Opt);
/**************************************************************************/
/*Entite E : Plan*/
LrMatrix E_Mat = LrMatrix::translate(LrVector(0, 0, -6));
LrVector normale(0, 0, 1);
LrGeometryPlan E_Geo(normale);
LrPertColorTextProcDamier E_Pc(LrColor::WHITE, LrColor::BLACK, 1.0f);
LrOpticPhong E_Opt(0.7, 0.3, 0, &E_Pc, &A_Pn, 25);
LrMatrix E_Mat = LrMatrix::translate(LrVector(0, 0, -2));
LrVector normaleP1(0, 0, 1);
LrGeometryPlan E_Geo(normaleP1);
LrPertColor3DDamier E_Pc(LrColor::WHITE, LrColor::BLACK, 1.0f);
LrOpticPhong E_Opt(0.5, 0.3, 0, 1, &E_Pc, &A_Pn, 50);
LrEntityElementary E(E_Mat, &E_Geo, &E_Opt);
LrMatrix ciel_Mat = LrMatrix::translate(LrVector(0, 0, 100));
LrVector normaleP2(0, 0, -1);
LrGeometryPlan ciel_Geo(normaleP2);
LrColor c_ciel((uint8_t)0,(uint8_t)125,(uint8_t)100);
LrPertColor3DPTurbulence ciel_Pc(c_ciel, LrColor::WHITE, LrColor::WHITE, 1, 6, 0.01, COS, true);
LrOpticPhong ciel_Opt(0.0, 0.5, 0, 1, &ciel_Pc, &A_Pn, 0);
LrEntityElementary ciel(ciel_Mat, &ciel_Geo, &ciel_Opt);
LrMatrix ciel_Mat2 = LrMatrix::translate(LrVector(0, 100, 0));
LrVector normaleP3(0, -1, 0);
LrGeometryPlan ciel_Geo2(normaleP3);
LrColor c_ciel2((uint8_t)0,(uint8_t)125,(uint8_t)100);
LrPertColor3DPTurbulence ciel_Pc2(c_ciel, LrColor::WHITE, LrColor::WHITE, 1, 6, 0.005, COS, false);
LrOpticPhong ciel_Opt2(0.0, 0.5, 0, 1, &ciel_Pc2, &A_Pn, 0);
LrEntityElementary ciel2(ciel_Mat2, &ciel_Geo2, &ciel_Opt2);
/**************************************************************************/
/*############################################################################*/
......@@ -92,8 +115,8 @@ int main(int argc, char** argv)
/*##################### LES LUMIERES de LA SCENE ###########################*/
//Entite X
LrMatrix X_Mat = LrMatrix::translate(LrVector(-5, -15, 5));
LrEntityLightPoint X(X_Mat, LrColor(0.8f,0.8f,0.8f));
LrMatrix X_Mat = LrMatrix::translate(LrVector(-50, 0, 50));
LrEntityLightPoint X(X_Mat, LrColor(0.4f,0.4f,0.4f));
//LrEntityLightPlane X(X_Mat, LrColor(0.6f,0.6f,0.6f),10);
/**************************************************************************/
......@@ -104,8 +127,8 @@ int main(int argc, char** argv)
/**************************************************************************/
//Entite Z
LrMatrix Z_Mat = LrMatrix::translate(LrVector(5, -15, 5));
LrEntityLightPoint Z(Z_Mat, LrColor(0.8f,0.8f,0.8f));
LrMatrix Z_Mat = LrMatrix::translate(LrVector(50, 0, 50));
LrEntityLightPoint Z(Z_Mat, LrColor(0.4f,0.4f,0.4f));
//LrEntityLightPlane Z(Z_Mat, LrColor(0.6f,0.6f,0.6f),10);
/**************************************************************************/
......@@ -118,17 +141,20 @@ int main(int argc, char** argv)
//entites-lumieres dans cette liste
LrScene::LrEntityList list_lights;
list_lights.push_back(&X);
list_lights.push_back(&Y);
//list_lights.push_back(&Y);
list_lights.push_back(&Z);
/**************************************************************************/
//Creation de la Liste des entites et ajout des entites dans cette liste
LrScene::LrEntityList list_entities;
list_entities.push_back(&A);
list_entities.push_back(&B);
//list_entities.push_back(&A);
//list_entities.push_back(&B);
list_entities.push_back(&C);
list_entities.push_back(&D);
//list_entities.push_back(&D);
list_entities.push_back(&E);
list_entities.push_back(&ciel2);
list_entities.push_back(&ciel);
/**************************************************************************/
......@@ -144,26 +170,31 @@ int main(int argc, char** argv)
LrImage image(600,600);
//Camera
LrPoint position_camera(0, -25, 0);
LrPoint position_camera(0, -12, 0);
LrCameraPlane camera(position_camera,LrVector::K,LrVector::J,M_PI/4,M_PI/4);
//AntiAliasing
LrAntiAliasingCentre aa(1);
//LrAntiAliasingCentre aa(1);
//LrAntiAliasingRandom aa(1);
//LrAntiAliasingCentre aa(2);
LrAntiAliasingCentre aa(1);
//LrAntiAliasingRandom aa(2);
//LrAntiAliasingCentre aa(4);
//LrAntiAliasingRandom aa(4);
//La SCENE
LrSceneRayTracing scene(list_entities, list_lights,&binder, &image, &camera, &aa, 10);
LrSceneRayTracing scene(list_entities, list_lights,&binder, &image, &camera, &aa, 2);
cout<<"RayTracing Start..."<< endl;
//Lancement de l'algorithme de lancer de rayons (parametre : nb de threads)
scene.generateImage(8);
scene.generateImage(1);
//scene.generateImagePart(0,600);
//Sauvegarde de l'image
file = fopen("./test21.ppm","wb");
//file = fopen("./testTurbulenceLin.ppm","wb");
//file = fopen("./testTurbulenceCos.ppm","wb");
//file = fopen("./testPerlinLin.ppm","wb");
//file = fopen("./testPerlinCos.ppm","wb");
file = fopen("./testNuage2.ppm","wb");
image.savePPM(file);
fclose(file);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment