SamplerFactory::SamplerFactory(const Parms& parms) : numSamples1D(0), numSamples2D(0), numLightSamples(0), samplesPerPixel(1), sampleSets(64), samples(NULL) { samplesPerPixel = parms.getInt("sampler.spp",1); sampleSets = parms.getInt("sampler.sets",64); }
Value next() { if (parms_.endf(i_)) return parms_.end_state(); Value temp = parms_.deref(i_); ++i_; return temp; }
lcRenderer::lcRenderer(const Parms& parms) : iteration(0) { /*! create integrator to use */ std::string _integrator = parms.getString("integrator","lcintegrator"); if (_integrator == "lcintegrator") integrator = new lcIntegrator(parms); else throw std::runtime_error("unknown integrator type: "+_integrator); /*! create sampler to use */ std::string _samplers = parms.getString("sampler","multijittered"); if (_samplers == "multijittered" ) samplers = new SamplerFactory(parms); else throw std::runtime_error("unknown sampler type: "+_samplers); /*! create pixel filter to use */ std::string _filter = parms.getString("filter","none"); if (_filter == "none" ) filter = NULL; else if (_filter == "box" ) filter = new BoxFilter; else if (_filter == "bspline") filter = new BSplineFilter; else throw std::runtime_error("unknown filter type: "+_filter); /*! get framebuffer configuration */ gamma = parms.getFloat("gamma",1.0f); /*! show progress to the user */ showProgress = parms.getInt("showprogress",0); }
vplIntegrator::vplIntegrator(const Parms& parms) : lightSampleID(-1), firstScatterSampleID(-1), firstScatterTypeSampleID(-1) { maxDepth = parms.getInt ("maxDepth" ,10 ); minContribution = parms.getFloat("minContribution",0.01f ); epsilon = parms.getFloat("epsilon" ,32.0f)*float(ulp); backplate = parms.getImage("backplate"); }
PathTraceIntegrator::PathTraceIntegrator(const Parms& parms) : lightSampleID(-1), firstScatterSampleID(-1), firstScatterTypeSampleID(-1), sampleLightForGlossy(false) { maxDepth = parms.getInt ("maxDepth" ,10 ); minContribution = parms.getFloat("minContribution",0.01f ); epsilon = parms.getFloat("epsilon" ,32.0f)*float(ulp); backplate = parms.getImage("backplate"); sampleLightForGlossy = parms.getInt ("sampleLightForGlossy",0); }
HDRILight::HDRILight(const Parms& parms) : width(0), height(0), pixels(null) { local2world = parms.getTransform("local2world",one); world2local = rcp(local2world); L = parms.getColor("L",one); pixels = parms.getImage("image"); if (pixels == null) pixels = new Image3f(5,5,one); width = (unsigned) pixels->width; height = (unsigned) pixels->height; Array2D<float> importance(height,width); for (size_t y = 0; y < height; y++) for (size_t x = 0; x < width; x++) importance.set(y, x, sinf(float(pi)*(y+0.5f)*rcp(float(height))) * reduce_add(pixels->get(x,y))); distribution = new Distribution2D(importance,width,height); }
TriangleMeshWithNormals::TriangleMeshWithNormals(const Parms& parms) : Shape(parms) { if (Variant v = parms.getData("positions")) { if (!v.data || v.type != Variant::FLOAT3) throw std::runtime_error("wrong position format"); vertices.resize(v.data->size()); for (size_t i=0; i<v.data->size(); i++) vertices[i].p = v.data->getVector3f(i); } if (Variant v = parms.getData("normals")) { if (!v.data || v.type != Variant::FLOAT3) throw std::runtime_error("wrong normal format"); vertices.resize(v.data->size()); for (size_t i=0; i<v.data->size(); i++) vertices[i].n = v.data->getVector3f(i); } if (Variant v = parms.getData("indices")) { if (!v.data || v.type != Variant::INT3) throw std::runtime_error("wrong triangle format"); triangles.resize(v.data->size()); for (size_t i=0; i<v.data->size(); i++) triangles[i] = v.data->getVector3i(i); } }
VectorHashTable<Parms>::VectorHashTable(size_type i, const Parms & p) : parms_(p), size_(0) { if (i <= 19) { i = 19; } else { size_type j = ((i - 3)/4)*4 + 3; if (j == i) i = j; else i = j + 4; Primes p(static_cast<size_type>(sqrt(static_cast<double>(i))+2)); for (;;) { if (i > p.max_num()) p.resize(static_cast<size_type>(sqrt(static_cast<double>(i))+2)); if (p.is_prime(i) && p.is_prime(i-2)) break; i += 4; } } vector_.resize(i); nonexistent_vector(); }
TriangleMeshFull::TriangleMeshFull (const Parms& parms) : Shape(parms) { if (Variant v = parms.getData("positions")) { if (!v.data || v.type != Variant::FLOAT3) throw std::runtime_error("wrong position format"); position.resize(v.data->size()); for (size_t i=0; i<v.data->size(); i++) position[i] = v.data->getVector3f(i); } if (Variant v = parms.getData("motions")) { if (!v.data || v.type != Variant::FLOAT3) throw std::runtime_error("wrong motion vector format"); motion.resize(v.data->size()); for (size_t i=0; i<v.data->size(); i++) motion[i] = v.data->getVector3f(i); } if (Variant v = parms.getData("normals")) { if (!v.data || v.type != Variant::FLOAT3) throw std::runtime_error("wrong normal format"); normal.resize(v.data->size()); for (size_t i=0; i<v.data->size(); i++) normal[i] = v.data->getVector3f(i); } if (Variant v = parms.getData("tangent_x")) { if (!v.data || v.type != Variant::FLOAT3) throw std::runtime_error("wrong tangent format"); tangent_x.resize(v.data->size()); for (size_t i=0; i<v.data->size(); i++) tangent_x[i] = v.data->getVector3f(i); } if (Variant v = parms.getData("tangent_y")) { if (!v.data || v.type != Variant::FLOAT3) throw std::runtime_error("wrong tangent format"); tangent_y.resize(v.data->size()); for (size_t i=0; i<v.data->size(); i++) tangent_y[i] = v.data->getVector3f(i); } if (Variant v = parms.getData("texcoords")) { if (!v.data || v.type != Variant::FLOAT2) throw std::runtime_error("wrong texcoords0 format"); texcoord.resize(v.data->size()); for (size_t i=0; i<v.data->size(); i++) texcoord[i] = v.data->getVec2f(i); } if (Variant v = parms.getData("texcoords0")) { if (!v.data || v.type != Variant::FLOAT2) throw std::runtime_error("wrong texcoords0 format"); texcoord.resize(v.data->size()); for (size_t i=0; i<v.data->size(); i++) texcoord[i] = v.data->getVec2f(i); } if (Variant v = parms.getData("indices")) { if (!v.data || v.type != Variant::INT3) throw std::runtime_error("wrong triangle format"); triangles.resize(v.data->size()); for (size_t i=0; i<v.data->size(); i++) triangles[i] = v.data->getVector3i(i); } }
MaterialRenderer::MaterialRenderer(const Parms& parms) { maxDepth = parms.getInt("maxDepth",1); // NOT USED FOR THE MOMENT... }
OpenGLRenderer::OpenGLRenderer(const Parms& parms) { OpenGLRenderer::fb_size_w = parms.getInt("width",128); OpenGLRenderer::fb_size_h = parms.getInt("height",128); linedrawing = parms.getBool("linedraw",true); }
bool at_end() const { return parms_.endf(i_); }
DebugRenderer::DebugRenderer(const Parms& parms) { maxDepth = parms.getInt("maxDepth",1); spp = parms.getInt("sampler.spp",1); }
DebugRenderer::DebugRenderer(const Parms& parms) : accumulate(false) { maxDepth = parms.getInt("maxDepth",1); spp = parms.getInt("sampler.spp",1); }