|
@@ -160,13 +160,18 @@ class PointShadowMap extends Shadows {
|
|
if( tmpTex != null) return tmpTex;
|
|
if( tmpTex != null) return tmpTex;
|
|
tmpTex = new h3d.mat.Texture(1,1, [Target,Cube], format);
|
|
tmpTex = new h3d.mat.Texture(1,1, [Target,Cube], format);
|
|
tmpTex.name = "defaultCubeShadowMap";
|
|
tmpTex.name = "defaultCubeShadowMap";
|
|
|
|
+ clear(tmpTex);
|
|
|
|
+ return tmpTex;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ inline function clear( t : h3d.mat.Texture, ?layer = -1 ) {
|
|
if( format == RGBA )
|
|
if( format == RGBA )
|
|
- tmpTex.clear(0xFFFFFF);
|
|
|
|
|
|
+ t.clear(0xFFFFFF, layer);
|
|
else
|
|
else
|
|
- tmpTex.clearF(1);
|
|
|
|
- return tmpTex;
|
|
|
|
|
|
+ t.clearF(1, 1, 1, 1, layer);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ var clearDepthColor = new h3d.Vector(1,1,1,1);
|
|
override function draw( passes : h3d.pass.PassList, ?sort ) {
|
|
override function draw( passes : h3d.pass.PassList, ?sort ) {
|
|
if( !enabled )
|
|
if( !enabled )
|
|
return;
|
|
return;
|
|
@@ -204,7 +209,7 @@ class PointShadowMap extends Shadows {
|
|
|
|
|
|
// Shadows on the current face is disabled
|
|
// Shadows on the current face is disabled
|
|
if( !faceMask.has(CubeFaceFlag.createByIndex(i)) ) {
|
|
if( !faceMask.has(CubeFaceFlag.createByIndex(i)) ) {
|
|
- texture.clear(0xFFFFFF, 0, i);
|
|
|
|
|
|
+ clear(texture, i);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -215,13 +220,12 @@ class PointShadowMap extends Shadows {
|
|
cullPasses(passes, function(col) return col.inFrustum(lightCamera.frustum));
|
|
cullPasses(passes, function(col) return col.inFrustum(lightCamera.frustum));
|
|
if( passes.isEmpty() ) {
|
|
if( passes.isEmpty() ) {
|
|
passes.load(save);
|
|
passes.load(save);
|
|
- texture.clear(0xFFFFFF, 0, i);
|
|
|
|
|
|
+ clear(texture, i);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
|
|
ctx.engine.pushTarget(texture, i);
|
|
ctx.engine.pushTarget(texture, i);
|
|
- ctx.engine.clear(0xFFFFFF, 1);
|
|
|
|
-
|
|
|
|
|
|
+ format == RGBA ? ctx.engine.clear(0xFFFFFF, i) : ctx.engine.clearF(clearDepthColor, 1);
|
|
super.draw(passes,sort);
|
|
super.draw(passes,sort);
|
|
passes.load(save);
|
|
passes.load(save);
|
|
ctx.engine.popTarget();
|
|
ctx.engine.popTarget();
|