本文整理汇总了C++中Film类的典型用法代码示例。如果您正苦于以下问题:C++ Film类的具体用法?C++ Film怎么用?C++ Film使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Film类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* argv[]) {
FreeImage_Initialise();
Camera camera;
Sample sample;
Ray ray;
Color* color = new Color(0.f, 0.f, 0.f);
initColor();
readfile(argv[1], &camera);
const float pi = 3.14159265 ;
float fovx = 2 * atan( tan(camera.fovy * pi/180/2.f) * ((float) w) / ((float) h) ) * 180/pi;
Film film = Film::Film(w, h);
while (Sample::getSample(&sample, w, h)) {
if (sample.x % 700 == 0) printf("Sample: %d, %d\n", sample.x, sample.y);
if (sample.y < 200) continue;
camera.generateRay(sample, &ray, w, h, fovx, camera.fovy);
RayTracer::trace(ray, 0, color, maxdepth, numprimitives, geometricPrimitives, numused, lights, attenuation);
film.commit(sample, *color);
if (sample.y > 250) break;
}
film.writeImage(outputFilename);
FreeImage_DeInitialise();
return 0;
}
示例2: Spectrum
void PathHybridState::Init(const PathHybridRenderThread *thread) {
PathHybridRenderEngine *renderEngine = (PathHybridRenderEngine *)thread->renderEngine;
Scene *scene = renderEngine->renderConfig->scene;
depth = 1;
lastPdfW = 1.f;
throuput = Spectrum(1.f);
directLightRadiance = Spectrum();
// Initialize eye ray
PerspectiveCamera *camera = scene->camera;
Film *film = thread->threadFilm;
const u_int filmWidth = film->GetWidth();
const u_int filmHeight = film->GetHeight();
sampleResults[0].screenX = std::min(sampler->GetSample(0) * filmWidth, (float)(filmWidth - 1));
sampleResults[0].screenY = std::min(sampler->GetSample(1) * filmHeight, (float)(filmHeight - 1));
camera->GenerateRay(sampleResults[0].screenX, sampleResults[0].screenY, &nextPathVertexRay,
sampler->GetSample(2), sampler->GetSample(3));
sampleResults[0].alpha = 1.f;
sampleResults[0].radiance = Spectrum(0.f);
lastSpecular = true;
}
示例3: Apply
void BloomFilterPlugin::Apply(Film &film, const u_int index) {
//const double t1 = WallClockTime();
Spectrum *pixels = (Spectrum *)film.channel_IMAGEPIPELINEs[index]->GetPixels();
const u_int width = film.GetWidth();
const u_int height = film.GetHeight();
// Allocate the temporary buffer if required
if ((!bloomBuffer) || (width * height != bloomBufferSize)) {
delete[] bloomBuffer;
delete[] bloomBufferTmp;
bloomBufferSize = width * height;
bloomBuffer = new Spectrum[bloomBufferSize];
bloomBufferTmp = new Spectrum[bloomBufferSize];
InitFilterTable(film);
}
// Apply separable filter
BloomFilter(film, pixels);
for (u_int i = 0; i < bloomBufferSize; ++i) {
if (*(film.channel_FRAMEBUFFER_MASK->GetPixel(i)))
pixels[i] = Lerp(weight, pixels[i], bloomBuffer[i]);
}
//const double t2 = WallClockTime();
//SLG_LOG("Bloom time: " << int((t2 - t1) * 1000.0) << "ms");
}
示例4: InitFilterTable
void BloomFilterPlugin::InitFilterTable(const Film &film) {
const u_int width = film.GetWidth();
const u_int height = film.GetHeight();
// Compute image-space extent of bloom effect
const u_int bloomSupport = Float2UInt(radius * Max(width, height));
bloomWidth = bloomSupport / 2;
// Initialize bloom filter table
delete[] bloomFilter;
bloomFilterSize = 2 * bloomWidth * bloomWidth + 1;
bloomFilter = new float[bloomFilterSize];
for (u_int i = 0; i < bloomFilterSize; ++i)
bloomFilter[i] = 0.f;
for (u_int i = 0; i < bloomWidth * bloomWidth; ++i) {
const float z0 = 3.8317f;
const float dist = z0 * sqrtf(i) / bloomWidth;
if (dist == 0.f)
bloomFilter[i] = 1.f;
else if (dist >= z0)
bloomFilter[i] = 0.f;
else {
// Airy function
//const float b = boost::math::cyl_bessel_j(1, dist);
//bloomFilter[i] = powf(2*b/dist, 2.f);
// Gaussian approximation
// best-fit sigma^2 for above airy function, based on RMSE
// depends on choice of zero
const float sigma2 = 1.698022698724f;
bloomFilter[i] = expf(-dist * dist / sigma2);
}
}
}
示例5: main
int main() {
Karyawan kasir;
Film film;
Studio studio;
Transaksi transaksi;
menu();
cout<<endl<<"Input Data"<<endl;
cout<<"-------------------"<<endl;
kasir.addKaryawan();
do{studio.addStudio();}
while((studio.getStudio()!="1")&&(studio.getStudio()!="2"));
do{film.addFilm();}
while((film.getFilm()!="A")&&(film.getFilm()!="B"));
transaksi.addTransaksi();
system("cls");
menu();
cout<<endl<<"----- Faktur Transaksi Anda -----"<<endl<<endl;
transaksi.generateKode();
film.showFilm();
studio.showStudio();
transaksi.showTransaksi();
kasir.showKaryawan();
cout<<endl<<endl<<" ----- TERIMA KASIH -----"<<endl<<endl;
system("pause");
return 0;
}
示例6: UpdateFilmImageMap
void BackgroundImgPlugin::UpdateFilmImageMap(const Film &film) {
const u_int width = film.GetWidth();
const u_int height = film.GetHeight();
// Check if I have to resample the image map
if ((!filmImageMap) ||
(filmImageMap->GetWidth() != width) || (filmImageMap->GetHeight() != height)) {
delete filmImageMap;
filmImageMap = NULL;
filmImageMap = imgMap->Copy();
filmImageMap->Resize(width, height);
}
}
示例7: AccumulateContributionToFilm
void PSSMLTSplats::AccumulateContributionToFilm( Film& film, const Math::Float& weight ) const
{
for (auto& splat : splats)
{
film.AccumulateContribution(splat.rasterPos, splat.L * weight);
}
}
示例8: render_tile
void SampleRenderer::render_tile(CtxG&, Recti tile_rect,
Recti tile_film_rect, Film& tile_film, Sampler& sampler) const
{
StatTimer t(TIMER_RENDER_TILE);
Vec2 film_res(float(this->film->x_res), float(this->film->y_res));
for(int32_t y = tile_rect.p_min.y; y < tile_rect.p_max.y; ++y) {
for(int32_t x = tile_rect.p_min.x; x < tile_rect.p_max.x; ++x) {
sampler.start_pixel();
for(uint32_t s = 0; s < sampler.samples_per_pixel; ++s) {
sampler.start_pixel_sample();
Vec2 pixel_pos = sampler.get_sample_2d(this->pixel_pos_idx);
Vec2 film_pos = Vec2(float(x), float(y)) + pixel_pos;
Ray ray(this->scene->camera->cast_ray(film_res, film_pos));
Spectrum radiance = this->get_radiance(*this->scene, ray, 0, sampler);
assert(is_finite(radiance));
assert(is_nonnegative(radiance));
if(is_finite(radiance) && is_nonnegative(radiance)) {
Vec2 tile_film_pos = film_pos -
Vec2(float(tile_film_rect.p_min.x), float(tile_film_rect.p_min.y));
tile_film.add_sample(tile_film_pos, radiance);
}
}
}
}
}
示例9: main
int main(int argc, char ** argv) {
Film * film = new Film();
Index * i1 = new FixedIndex(1.5);
Index * i2 = new FixedIndex(2.2);
double thick;
if( argc == 2 ) {
sscanf(argv[1], "%lf", &thick);
} else {
printf("Usage: model <thickness>\n");
return -1;
}
/*
for( int i=0; i<10; i++ ) {
double q = 1.0 + ((i-5.0)/10.0);
q /= 4.0;
fprintf(stderr, "%05.3lf %03.0lf\n", q, thick);
film->addLayer(Layer(q*thick/1.5, i1));
film->addLayer(Layer(q*2*thick/2.2, i2));
film->addLayer(Layer(q*thick/1.5, i1));
}
*/
/*
film->addLayer(Layer(thick/2/1.5, i1));
film->addLayer(Layer(thick/2/2.2, i2));
film->addLayer(Layer(thick/2/1.5, i1));
*/
film = new FakeFilm();
//film->print();
//return 0;
Spectrum * s;
s = new FileSource("color/illuminants/CIE-C.txt");
s = film->reflect(s, 0);
Spectrum::const_iterator itr;
for( itr = s->begin(); itr != s->end(); ++itr ) {
printf("%09lf %09lf\n", *itr, f(s->get(*itr)));
}
sRGB color = s->tosRGB();
//printf("RGB: %d %d %d\n", color.r, color.g, color.b);
return 0;
}
示例10: BloomFilterY
void BloomFilterPlugin::BloomFilterY(const Film &film) {
const u_int width = film.GetWidth();
const u_int height = film.GetHeight();
// Apply bloom filter to image pixels
#pragma omp parallel for
for (
// Visual C++ 2013 supports only OpenMP 2.5
#if _OPENMP >= 200805
unsigned
#endif
int x = 0; x < width; ++x) {
for (u_int y = 0; y < height; ++y) {
if (*(film.channel_FRAMEBUFFER_MASK->GetPixel(x, y))) {
// Compute bloom for pixel (x, y)
// Compute extent of pixels contributing bloom
const u_int y0 = Max<u_int>(y, bloomWidth) - bloomWidth;
const u_int y1 = Min<u_int>(y + bloomWidth, height - 1);
float sumWt = 0.f;
const u_int bx = x;
Spectrum &pixel(bloomBuffer[x + y * width]);
pixel = Spectrum();
for (u_int by = y0; by <= y1; ++by) {
if (*(film.channel_FRAMEBUFFER_MASK->GetPixel(bx, by))) {
// Accumulate bloom from pixel (bx, by)
const u_int dist2 = (x - bx) * (x - bx) + (y - by) * (y - by);
const float wt = bloomFilter[dist2];
if (wt == 0.f)
continue;
const u_int bloomOffset = bx + by * width;
sumWt += wt;
pixel += wt * bloomBufferTmp[bloomOffset];
}
}
if (sumWt > 0.f)
pixel /= sumWt;
}
}
}
}
示例11: UpdateMaxPixelValue
void TileRepository::Tile::AddPass(const Film &tileFilm) {
// Increase the pass count
++pass;
// Update the done flag
if (tileRepository->enableMultipassRendering) {
// Check if convergence test is enable
if (tileRepository->convergenceTestThreshold > 0.f) {
// Add the tile to the all pass film
allPassFilm->AddFilm(tileFilm,
0, 0,
tileFilm.GetWidth(),
tileFilm.GetHeight(),
0, 0);
if (pass % 2 == 1) {
// If it is an odd pass, add also to the even pass film
evenPassFilm->AddFilm(tileFilm,
0, 0,
tileFilm.GetWidth(),
tileFilm.GetHeight(),
0, 0);
} else {
// Update tileRepository->tileMaxPixelValue before to check the
// convergence
UpdateMaxPixelValue();
// Update linear tone mapping plugin
LinearToneMap *allLT = (LinearToneMap *)allPassFilm->GetImagePipeline()->GetPlugin(typeid(LinearToneMap));
allLT->scale = 1.f / tileRepository->tileMaxPixelValue;
LinearToneMap *evenLT = (LinearToneMap *)evenPassFilm->GetImagePipeline()->GetPlugin(typeid(LinearToneMap));
evenLT->scale = allLT->scale;
// If it is an even pass, check convergence status
CheckConvergence();
}
}
if ((tileRepository->maxPassCount > 0) && (pass >= tileRepository->maxPassCount))
done = true;
} else
done = true;
}
示例12: GetGammaCorrectionValue
float ImagePipelinePlugin::GetGammaCorrectionValue(const Film &film, const u_int index) {
float gamma = 1.f;
const ImagePipeline *ip = film.GetImagePipeline(index);
if (ip) {
const GammaCorrectionPlugin *gc = (const GammaCorrectionPlugin *)ip->GetPlugin(typeid(GammaCorrectionPlugin));
if (gc)
gamma = gc->gamma;
}
return gamma;
}
示例13: GetCinemaPeople
std::string GetCinemaPeople(const Film& film, const std::string& prev)
{
if (!prev.size())
return "";
auto creators = film.getCreators();
for (auto i : creators)
if (i > prev)
return i;
return "";
}
示例14: logf
void Reinhard02ToneMap::Apply(Film &film, const u_int index) {
Spectrum *pixels = (Spectrum *)film.channel_IMAGEPIPELINEs[index]->GetPixels();
RGBColor *rgbPixels = (RGBColor *)pixels;
const float alpha = .1f;
const u_int pixelCount = film.GetWidth() * film.GetHeight();
float Ywa = 0.f;
for (u_int i = 0; i < pixelCount; ++i) {
if (*(film.channel_FRAMEBUFFER_MASK->GetPixel(i)) && !rgbPixels[i].IsInf())
Ywa += logf(Max(rgbPixels[i].Y(), 1e-6f));
}
if (pixelCount > 0)
Ywa = expf(Ywa / pixelCount);
// Avoid division by zero
if (Ywa == 0.f)
Ywa = 1.f;
const float invB2 = (burn > 0.f) ? 1.f / (burn * burn) : 1e5f;
const float scale = alpha / Ywa;
const float preS = scale / preScale;
const float postS = scale * postScale;
#pragma omp parallel for
for (
// Visual C++ 2013 supports only OpenMP 2.5
#if _OPENMP >= 200805
unsigned
#endif
int i = 0; i < pixelCount; ++i) {
if (*(film.channel_FRAMEBUFFER_MASK->GetPixel(i))) {
const float ys = rgbPixels[i].Y() * preS;
// Note: I don't need to convert to XYZ and back because I'm only
// scaling the value.
rgbPixels[i] *= postS * (1.f + ys * invB2) / (1.f + ys);
}
}
}
示例15:
Film::Film(const Film & f):AbstractMedia(f)
{
m_realisateur = f.getRealisateur();
m_scenariste = f.getScenariste();
m_acteurPrincipaux = f.getActeursPrincipaux();
m_type = f.getType();
m_duree = f.getDuree();
m_support = f.getSupport();
}