|
@@ -90,7 +90,7 @@ class DirShadowMap extends Shadows {
|
|
|
var cameraBounds = new h3d.col.Bounds();
|
|
|
for( pt in ctx.camera.getFrustumCorners() ) {
|
|
|
pt.transform(camera.mcam);
|
|
|
- cameraBounds.addPos(pt.x, pt.y, pt.z);
|
|
|
+ cameraBounds.addPos(pt.x, pt.y, pt.z);
|
|
|
}
|
|
|
cameraBounds.zMin = bounds.zMin;
|
|
|
bounds.intersection(bounds, cameraBounds);
|
|
@@ -167,6 +167,7 @@ class DirShadowMap extends Shadows {
|
|
|
if( staticTexture != null ) staticTexture.dispose();
|
|
|
staticTexture = new h3d.mat.Texture(size, size, [Target], format);
|
|
|
staticTexture.uploadPixels(pixels);
|
|
|
+ staticTexture.name = "defaultDirShadowMap";
|
|
|
syncShader(staticTexture);
|
|
|
return true;
|
|
|
}
|
|
@@ -180,8 +181,10 @@ class DirShadowMap extends Shadows {
|
|
|
case Dynamic:
|
|
|
// nothing
|
|
|
case Static, Mixed:
|
|
|
- if( staticTexture == null || staticTexture.isDisposed() )
|
|
|
+ if( staticTexture == null || staticTexture.isDisposed() ){
|
|
|
staticTexture = h3d.mat.Texture.fromColor(0xFFFFFF);
|
|
|
+ staticTexture.name = "defaultDirShadowMap";
|
|
|
+ }
|
|
|
if( mode == Static ) {
|
|
|
syncShader(staticTexture);
|
|
|
return passes;
|
|
@@ -190,7 +193,7 @@ class DirShadowMap extends Shadows {
|
|
|
|
|
|
passes = filterPasses(passes);
|
|
|
|
|
|
- var texture = ctx.textures.allocTarget("shadowMap", size, size, false, format);
|
|
|
+ var texture = ctx.textures.allocTarget("dirShadowMap", size, size, false, format);
|
|
|
if( customDepth && (depth == null || depth.width != size || depth.height != size || depth.isDisposed()) ) {
|
|
|
if( depth != null ) depth.dispose();
|
|
|
depth = new h3d.mat.DepthBuffer(size, size);
|
|
@@ -221,7 +224,7 @@ class DirShadowMap extends Shadows {
|
|
|
ctx.engine.popTarget();
|
|
|
|
|
|
if( mode == Mixed && !ctx.computingStatic ) {
|
|
|
- var merge = ctx.textures.allocTarget("shadowMap", size, size, false, format);
|
|
|
+ var merge = ctx.textures.allocTarget("mergedDirShadowMap", size, size, false, format);
|
|
|
mergePass.shader.texA = texture;
|
|
|
mergePass.shader.texB = staticTexture;
|
|
|
ctx.engine.pushTarget(merge);
|