|
@@ -195,17 +195,13 @@ class Light extends Object3D {
|
|
|
|
|
|
override function updateInstance( ctx : Context, ?propName : String ) {
|
|
|
super.updateInstance(ctx, propName);
|
|
|
-
|
|
|
+
|
|
|
var color = color | 0xff000000;
|
|
|
- var light = Std.downcast(ctx.local3d,h3d.scene.pbr.Light);
|
|
|
- if( light == null ) {
|
|
|
- // FWD light
|
|
|
- var light = Std.downcast(ctx.local3d, h3d.scene.Light);
|
|
|
- light.color.setColor(color | 0xFF000000);
|
|
|
- } else {
|
|
|
- // PBR light
|
|
|
- light.isMainLight = isMainLight;
|
|
|
- light.occlusionFactor = occlusionFactor;
|
|
|
+ var pbrLight = Std.downcast(ctx.local3d, h3d.scene.pbr.Light);
|
|
|
+ var light = Std.downcast(ctx.local3d, h3d.scene.pbr.Light);
|
|
|
+ if( pbrLight != null ) { // PBR
|
|
|
+ pbrLight.isMainLight = isMainLight;
|
|
|
+ pbrLight.occlusionFactor = occlusionFactor;
|
|
|
|
|
|
switch( kind ) {
|
|
|
case Spot:
|
|
@@ -222,28 +218,31 @@ class Light extends Object3D {
|
|
|
pl.zNear = hxd.Math.max(0.02, zNear);
|
|
|
default:
|
|
|
}
|
|
|
- light.color.setColor(color);
|
|
|
- light.power = power;
|
|
|
- light.shadows.mode = shadows.mode;
|
|
|
- light.shadows.size = shadows.size;
|
|
|
- light.shadows.blur.radius = shadows.radius;
|
|
|
- light.shadows.blur.quality = shadows.quality;
|
|
|
- light.shadows.bias = shadows.bias * 0.1;
|
|
|
+ pbrLight.color.setColor(color);
|
|
|
+ pbrLight.power = power;
|
|
|
+ pbrLight.shadows.mode = shadows.mode;
|
|
|
+ pbrLight.shadows.size = shadows.size;
|
|
|
+ pbrLight.shadows.blur.radius = shadows.radius;
|
|
|
+ pbrLight.shadows.blur.quality = shadows.quality;
|
|
|
+ pbrLight.shadows.bias = shadows.bias * 0.1;
|
|
|
|
|
|
switch (shadows.samplingMode.kind) {
|
|
|
case None:
|
|
|
- light.shadows.samplingKind = None;
|
|
|
+ pbrLight.shadows.samplingKind = None;
|
|
|
case PCF:
|
|
|
var sm : ShadowSamplingPCF = cast shadows.samplingMode;
|
|
|
- light.shadows.pcfQuality = sm.quality;
|
|
|
- light.shadows.pcfScale = sm.scale;
|
|
|
- light.shadows.samplingKind = PCF;
|
|
|
+ pbrLight.shadows.pcfQuality = sm.quality;
|
|
|
+ pbrLight.shadows.pcfScale = sm.scale;
|
|
|
+ pbrLight.shadows.samplingKind = PCF;
|
|
|
case ESM:
|
|
|
var sm : ShadowSamplingESM = cast shadows.samplingMode;
|
|
|
- light.shadows.power = sm.power;
|
|
|
- light.shadows.samplingKind = ESM;
|
|
|
+ pbrLight.shadows.power = sm.power;
|
|
|
+ pbrLight.shadows.samplingKind = ESM;
|
|
|
}
|
|
|
}
|
|
|
+ else if( light != null ) { // FWD
|
|
|
+ light.color.setColor(color | 0xFF000000);
|
|
|
+ }
|
|
|
|
|
|
#if editor
|
|
|
|