当前位置: 首页>>代码示例>>C++>>正文


C++ Film类代码示例

本文整理汇总了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;
}
开发者ID:ranjaykrishna,项目名称:RayTracer,代码行数:29,代码来源:main.cpp

示例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;
}
开发者ID:scollinson,项目名称:luxrays,代码行数:25,代码来源:pathstate.cpp

示例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");
}
开发者ID:yangzhengxing,项目名称:luxrender,代码行数:30,代码来源:bloom.cpp

示例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);
		}
	}
}
开发者ID:yangzhengxing,项目名称:luxrender,代码行数:35,代码来源:bloom.cpp

示例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;
}
开发者ID:beeboypralienka,项目名称:bioskop,代码行数:29,代码来源:Main.cpp

示例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);
	}
}
开发者ID:yangzhengxing,项目名称:luxrender,代码行数:14,代码来源:backgroundimg.cpp

示例7: AccumulateContributionToFilm

void PSSMLTSplats::AccumulateContributionToFilm( Film& film, const Math::Float& weight ) const
{
	for (auto& splat : splats)
	{
		film.AccumulateContribution(splat.rasterPos, splat.L * weight);
	}
}
开发者ID:Vertexwahn,项目名称:lightmetrica,代码行数:7,代码来源:pssmlt.splat.cpp

示例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);
          }
        }
      }
    }
  }
开发者ID:honzasp,项目名称:dort,代码行数:28,代码来源:sample_renderer.cpp

示例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;
}
开发者ID:trainman419,项目名称:raytracer,代码行数:47,代码来源:model.cpp

示例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;
			}
		}
	}
}
开发者ID:yangzhengxing,项目名称:luxrender,代码行数:43,代码来源:bloom.cpp

示例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;
}
开发者ID:DavidBluecame,项目名称:LuxRays,代码行数:43,代码来源:renderengine.cpp

示例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;
}
开发者ID:yangzhengxing,项目名称:luxrender,代码行数:11,代码来源:imagepipeline.cpp

示例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 "";
}
开发者ID:dissonmatveev,项目名称:exercises,代码行数:12,代码来源:FilmAssistants.cpp

示例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);
		}
	}
}
开发者ID:yangzhengxing,项目名称:luxrender,代码行数:40,代码来源:reinhard02.cpp

示例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();
}
开发者ID:Chewnonobelix,项目名称:ProduitMedia,代码行数:9,代码来源:film.cpp


注:本文中的Film类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。