shared_ptr<iConcept> GetConcept( const string str,const int id ) { iCerebrum *brain=iCerebrum::Instance(); if(brain==NULL) return NULL; Identity w_i(str,id); return brain->GetConcept(w_i); }
// main program int main(int argc, char *argv[]) { Spectrum blanc(1.0); FresnelOne myFresnel; IsotropicBeckmann myD(1.0); //Blinn myD(0.5); MSHAC myMSHAC(&myD); Microfacetpp myBRDF(blanc, &myFresnel, &myD, &myMSHAC); Spectrum integral(0.0); float theta_o = M_PI / 2.2f; float phi_o = 0.f; Vector w_o(cosf(phi_o) * sinf(theta_o), sinf(phi_o) * sinf(theta_o), cosf(theta_o)); Vector w_i(0.0,0.0,1.0); Vector w_g(0.0, 0.0, 1.0); //float myG = myMSHAC.G(w_o,w_i,Normalize(w_o + w_i)); //float lambda(myD.Lambda(w_o)); float deltaPhi = 0.01, deltaTheta = 0.01; /*RNG myRNG; const int n(300); const int nSamplers(n*n); float samples[nSamplers*2];*/ /*for (int i(0); i < n; i++) { float u1 = (float)i / (float)n; for (int j(0); j < n; j++) { float u2 = (float)j / (float)n; samples[i * n + j * 2] = u1; samples[i * n + j * 2 + 1] = u2; } }*/ /*for (int i(0); i < nSamplers * 2; i++) { samples[i] = myRNG.RandomFloat(); }*/ for (float phi = 0.0; phi <= 2 * M_PI; phi += deltaPhi) { for (float theta = 0.0; theta <= M_PI / 2.0; theta += deltaTheta) { w_i.x = cos(phi) * sin(theta); w_i.y = sin(phi) * sin(theta); w_i.z = cos(theta); integral += myBRDF.f(w_o, w_i) * AbsDot(w_g,w_i) * deltaPhi * deltaTheta * sin(theta); //integral += myD.D(w_i) * AbsDot(w_g, w_i) * deltaPhi * deltaTheta * sin(theta); } } integral = Spectrum(1.0) - integral; //Spectrum retour = myBRDF.rho(w_o,nSamplers, samples); /*Options options; vector<string> filenames; // Process command-line arguments for (int i = 1; i < argc; ++i) { if (!strcmp(argv[i], "--ncores")) options.nCores = atoi(argv[++i]); else if (!strcmp(argv[i], "--outfile")) options.imageFile = argv[++i]; else if (!strcmp(argv[i], "--quick")) options.quickRender = true; else if (!strcmp(argv[i], "--quiet")) options.quiet = true; else if (!strcmp(argv[i], "--verbose")) options.verbose = true; else if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) { printf("usage: pbrt [--ncores n] [--outfile filename] [--quick] [--quiet] " "[--verbose] [--help] <filename.pbrt> ...\n"); return 0; } else filenames.push_back(argv[i]); } // Print welcome banner if (!options.quiet) { printf("pbrt version %s of %s at %s [Detected %d core(s)]\n", PBRT_VERSION, __DATE__, __TIME__, NumSystemCores()); printf("Copyright (c)1998-2014 Matt Pharr and Greg Humphreys.\n"); printf("The source code to pbrt (but *not* the book contents) is covered by the BSD License.\n"); printf("See the file LICENSE.txt for the conditions of the license.\n"); fflush(stdout); } pbrtInit(options); // Process scene description PBRT_STARTED_PARSING(); if (filenames.size() == 0) { // Parse scene from standard input ParseFile("-"); } else { // Parse scene from input files for (u_int i = 0; i < filenames.size(); i++) if (!ParseFile(filenames[i])) Error("Couldn't open scene file \"%s\"", filenames[i].c_str()); } pbrtCleanup();*/ return 0; }