Object Occlusion Culling
This commit is contained in:
@ -34,7 +34,7 @@ class LightObject extends Object {
|
||||
// Cascades
|
||||
public static var cascadeCount = 1;
|
||||
public static var cascadeSplitFactor = 0.8;
|
||||
public static var cascadeBounds = 1.0;
|
||||
public static var cascadeBounds = 2.0; // occlusion culling shadows pop with 1.0
|
||||
#if lnx_csm
|
||||
var cascadeData: Float32Array = null;
|
||||
var cascadeVP: Array<Mat4>;
|
||||
@ -140,6 +140,9 @@ class LightObject extends Object {
|
||||
}
|
||||
#end
|
||||
#end
|
||||
#if lnx_occlusion_culling
|
||||
if (iron.culling.CullSystem.active != null) iron.culling.CullSystem.active.removeLight(this);
|
||||
#end
|
||||
super.remove();
|
||||
}
|
||||
|
||||
@ -278,12 +281,13 @@ class LightObject extends Object {
|
||||
var worldPerTexelX = (maxx - minx) / smsize;
|
||||
var worldPerTexelY = (maxy - miny) / smsize;
|
||||
var worldPerTexelZ = (maxz - minz) / smsize;
|
||||
var ex = maxx - minx, ey = maxy - miny, ez = maxz - minz;
|
||||
minx = Math.floor(minx / worldPerTexelX) * worldPerTexelX;
|
||||
miny = Math.floor(miny / worldPerTexelY) * worldPerTexelY;
|
||||
minz = Math.floor(minz / worldPerTexelZ) * worldPerTexelZ;
|
||||
maxx = Math.floor(maxx / worldPerTexelX) * worldPerTexelX;
|
||||
maxy = Math.floor(maxy / worldPerTexelY) * worldPerTexelY;
|
||||
maxz = Math.floor(maxz / worldPerTexelZ) * worldPerTexelZ;
|
||||
maxx = minx + ex;
|
||||
maxy = miny + ey;
|
||||
maxz = minz + ez;
|
||||
|
||||
var hx = (maxx - minx) / 2;
|
||||
var hy = (maxy - miny) / 2;
|
||||
|
||||
Reference in New Issue
Block a user