00001 #include <gra/arch/RayTrArch.h>
00002
00003 using namespace gra;
00004
00005
00006
00007 RayTrArch::RayTrArch(RayTrArch::Params& params)
00008 : Architecture(params)
00009 {
00010 _pIntersector = params.intersector;
00011 _background.set(params.background);
00012 _pixelRendering = params.pixelRendering;
00013 _raysPerPixel = params.raysPerPixel;
00014 _fbWriteMode = params.fbWriteMode;
00015 _fbWriteElements = params.fbWriteElements;
00016 _pRTReflection = NULL;
00017
00018 if (params.shadowRays == 1) {
00019 _pRTReflection = new RayTracing(new AutoPtr<LocalReflection>(new LocalReflection(NULL, NULL, NULL, LocalReflection::SD_RAY_FROM_EMITTANCE, 1, params.cacheDepth)),
00020 _background,
00021 _pIntersector,
00022 params.maxRecDepth,
00023 params.minRecWeight,
00024 REFR_AIR);
00025 return;
00026 }
00027
00028 if (params.shadowRays > 1) {
00029 _pRTReflection = new RayTracing(new AutoPtr<LocalReflection>(new LocalReflection(NULL, NULL, NULL, LocalReflection::SD_GEOMETRY_SAMPLING, params.shadowRays, params.cacheDepth)),
00030 _background,
00031 _pIntersector,
00032 params.maxRecDepth,
00033 params.minRecWeight,
00034 REFR_AIR);
00035 }
00036
00037
00038 }
00039
00040 RayTrArch::~RayTrArch()
00041 {
00042 if (_pRTReflection) delete _pRTReflection;
00043 }
00044
00045 Render* RayTrArch::createRender(void)
00046 {
00047 return new RTRender(_pIntersector, _pStopFlag, _background,
00048 _pixelRendering, _raysPerPixel,
00049 _fbWriteMode, _fbWriteElements);
00050 }
00051
00052 Shader* RayTrArch::createShader(void)
00053 {
00054 return new RTShader(_pRTReflection,
00055 _pDefaultDiffuseBRDF,
00056 _pDefaultSpecularBRDF);
00057 }
00058