Subversion Repository Public Repository

Divide-Framework

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

Diff Revisions 167 vs 168 for /trunk/Source Code/Rendering/Lighting/DirectionalLight.cpp

Diff revisions: vs.
  @@ -69,20 +69,18 @@
69 69
70 70 void DirectionalLight::setCameraToLightView(const vec3<F32>& eyePos){
71 71 _eyePos = eyePos;
72 - ///Set the virtual light position 500 units above our eye position
73 - ///This is one example why we have different setup functions for each light type
74 - ///This isn't valid for omni or spot
75 - _lightPos = vec3<F32>(_eyePos.x - 500*_properties._position.x,
76 - _eyePos.y - 500*_properties._position.y,
77 - _eyePos.z - 500*_properties._position.z);
72 + //Set the virtual light position DIRECTIONAL_LIGHT_DISTANCE units above our eye position
73 + //This is one example why we have different setup functions for each light type
74 + //This isn't valid for omni or spot
75 + _lightPos = _eyePos - _properties._position.xyz() * Config::DIRECTIONAL_LIGHT_DISTANCE;
78 76
79 - ///Tell our rendering API to move the camera
77 + //Tell our rendering API to move the camera
80 78 GFX_DEVICE.lookAt(_lightPos, //the light's virtual position
81 79 _eyePos); //the light's target
82 80 }
83 81
84 82 #pragma message("ToDo: Near and far planes. Should optimize later! -Ionut")
85 - void DirectionalLight::renderFromLightView(const U8 depthPass,const F32 sceneHalfExtent){
83 + void DirectionalLight::renderFromLightView(const U8 depthPass, const F32 sceneHalfExtent){
86 84 _zPlanes = Frustum::getInstance().getZPlanes();
87 85 //Set the current projection depending on the current depth pass
88 86 GFX_DEVICE.setOrthoProjection(vec4<F32>(-sceneHalfExtent,