Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 259 vs 260 for /trunk/Source Code/Rendering/Lighting/ShadowMapping/CubeShadowMap.cpp

Diff revisions: vs.
  @@ -10,9 +10,6 @@
10 10
11 11 CubeShadowMap::CubeShadowMap(Light* light) : ShadowMap(light, SHADOW_TYPE_CubeMap)
12 12 {
13 - _maxResolution = 0;
14 - _resolutionFactor = ParamHandler::getInstance().getParam<U8>("rendering.shadowResolutionFactor");
15 - CLAMP<F32>(_resolutionFactor,0.001f, 1.0f);
16 13 PRINT_FN(Locale::get("LIGHT_CREATE_SHADOW_FB"), light->getId(), "Single Shadow Map");
17 14 TextureDescriptor depthMapDescriptor(TEXTURE_CUBE_MAP,
18 15 DEPTH_COMPONENT,
  @@ -26,7 +23,7 @@
26 23 depthMapSampler._cmpFunc = CMP_FUNC_LEQUAL; //< Use less or equal
27 24 depthMapDescriptor.setSampler(depthMapSampler);
28 25
29 - _depthMap = GFX_DEVICE.newFB(FB_CUBE_DEPTH);
26 + _depthMap = GFX_DEVICE.newFB();
30 27 _depthMap->AddAttachment(depthMapDescriptor, TextureDescriptor::Depth);
31 28 _depthMap->toggleColorWrites(false);
32 29 }
  @@ -36,21 +33,17 @@
36 33 }
37 34
38 35 void CubeShadowMap::init(ShadowMapInfo* const smi){
39 - resolution(smi->resolution(), smi->resolutionFactor());
36 + resolution(smi->resolution(), _light->shadowMapResolutionFactor());
40 37 _init = true;
41 38 }
42 39
43 - void CubeShadowMap::resolution(U16 resolution, F32 resolutionFactor){
44 - U8 resolutionFactorTemp = resolutionFactor;
45 - CLAMP<U8>(resolutionFactorTemp, 1, 4);
46 - U16 maxResolutionTemp = resolution;
47 - if(resolutionFactorTemp != _resolutionFactor || _maxResolution != maxResolutionTemp){
48 - _resolutionFactor = resolutionFactorTemp;
49 - _maxResolution = maxResolutionTemp;
40 + void CubeShadowMap::resolution(U16 resolution, U8 resolutionFactor){
41 + U16 resolutionTemp = resolution * resolutionFactor;
42 + if (resolutionTemp != _resolution){
43 + _resolution = resolutionTemp;
50 44 ///Initialize the FB's with a variable resolution
51 45 PRINT_FN(Locale::get("LIGHT_INIT_SHADOW_FB"), _light->getId());
52 - U16 shadowMapDimension = _maxResolution/_resolutionFactor;
53 - _depthMap->Create(shadowMapDimension,shadowMapDimension);
46 + _depthMap->Create(_resolution, _resolution);
54 47 }
55 48 ShadowMap::resolution(resolution, resolutionFactor);
56 49 }