Full BSDF
This commit is contained in:
@ -827,9 +827,20 @@ class Uniforms {
|
||||
}
|
||||
}
|
||||
case "_shadowMapSize": {
|
||||
if (light != null && light.data.raw.cast_shadow) {
|
||||
var shadowLight = light;
|
||||
if (shadowLight == null || !shadowLight.data.raw.cast_shadow) {
|
||||
shadowLight = RenderPath.active.sun;
|
||||
}
|
||||
if (shadowLight != null && shadowLight.data.raw.cast_shadow) {
|
||||
v = helpVec;
|
||||
v.x = v.y = light.data.raw.shadowmap_size;
|
||||
v.x = v.y = shadowLight.data.raw.shadowmap_size;
|
||||
#if lnx_csm
|
||||
#if (!lnx_shadowmap_atlas)
|
||||
if (shadowLight.data.raw.type == "sun") {
|
||||
v.x = shadowLight.data.raw.shadowmap_size * LightObject.cascadeCount;
|
||||
}
|
||||
#end
|
||||
#end
|
||||
}
|
||||
}
|
||||
default:
|
||||
@ -887,9 +898,11 @@ class Uniforms {
|
||||
case "_envmapIrradiance": {
|
||||
fa = Scene.active.world == null ? WorldData.getEmptyIrradiance() : Scene.active.world.probe.irradiance;
|
||||
}
|
||||
case "_materialParams": {
|
||||
#if (rp_renderer == "Deferred")
|
||||
case "_materialParams": {
|
||||
fa = Scene.active.materialParamsBuffer;
|
||||
}
|
||||
#end
|
||||
#if lnx_clusters
|
||||
case "_lightsArray": {
|
||||
fa = LightObject.lightsArray;
|
||||
@ -906,15 +919,18 @@ class Uniforms {
|
||||
#end
|
||||
#end // lnx_clusters
|
||||
#if lnx_csm
|
||||
case "_cascadeData": {
|
||||
for (l in Scene.active.lights) {
|
||||
if (l.data.raw.type == "sun") {
|
||||
fa = l.getCascadeData();
|
||||
break;
|
||||
}
|
||||
}
|
||||
case "_cascadeData": {
|
||||
var sun = RenderPath.active.sun;
|
||||
if (sun != null && sun.data.raw.type == "sun") {
|
||||
fa = sun.getCascadeData();
|
||||
}
|
||||
#end
|
||||
}
|
||||
#end
|
||||
#if lnx_shadowmap_atlas
|
||||
case "_tileBoundsSunArray": {
|
||||
fa = LightObject.updateSunTileBoundsArray();
|
||||
}
|
||||
#end
|
||||
}
|
||||
|
||||
if (fa != null) {
|
||||
@ -1067,32 +1083,30 @@ class Uniforms {
|
||||
}
|
||||
}
|
||||
case "_biasLightWorldViewProjectionMatrixSun": {
|
||||
for (l in iron.Scene.active.lights) {
|
||||
if (l.data.raw.type == "sun") {
|
||||
// object is null for DrawQuad
|
||||
object == null ? helpMat.setIdentity() : helpMat.setFrom(object.transform.worldUnpack);
|
||||
helpMat.multmat(l.VP);
|
||||
helpMat.multmat(biasMat);
|
||||
#if lnx_shadowmap_atlas
|
||||
// tile matrix
|
||||
helpMat2.setIdentity();
|
||||
// scale [0-1] coords to [0-tilescale]
|
||||
helpMat2._00 = l.tileScale[0];
|
||||
helpMat2._11 = l.tileScale[0];
|
||||
// offset coordinate start from [0, 0] to [tile-start-x, tile-start-y]
|
||||
helpMat2._30 = l.tileOffsetX[0];
|
||||
helpMat2._31 = l.tileOffsetY[0];
|
||||
helpMat.multmat(helpMat2);
|
||||
#if (!kha_opengl)
|
||||
helpMat2.setIdentity();
|
||||
helpMat2._11 = -1.0;
|
||||
helpMat2._31 = 1.0;
|
||||
helpMat.multmat(helpMat2);
|
||||
#end
|
||||
#end
|
||||
m = helpMat;
|
||||
break;
|
||||
}
|
||||
var sun = RenderPath.active.sun;
|
||||
if (sun != null && sun.data.raw.type == "sun") {
|
||||
// object is null for DrawQuad
|
||||
object == null ? helpMat.setIdentity() : helpMat.setFrom(object.transform.worldUnpack);
|
||||
helpMat.multmat(sun.VP);
|
||||
helpMat.multmat(biasMat);
|
||||
#if lnx_shadowmap_atlas
|
||||
// tile matrix
|
||||
helpMat2.setIdentity();
|
||||
// scale [0-1] coords to [0-tilescale]
|
||||
helpMat2._00 = sun.tileScale[0];
|
||||
helpMat2._11 = sun.tileScale[0];
|
||||
// offset coordinate start from [0, 0] to [tile-start-x, tile-start-y]
|
||||
helpMat2._30 = sun.tileOffsetX[0];
|
||||
helpMat2._31 = sun.tileOffsetY[0];
|
||||
helpMat.multmat(helpMat2);
|
||||
#if (!kha_opengl)
|
||||
helpMat2.setIdentity();
|
||||
helpMat2._11 = -1.0;
|
||||
helpMat2._31 = 1.0;
|
||||
helpMat.multmat(helpMat2);
|
||||
#end
|
||||
#end
|
||||
m = helpMat;
|
||||
}
|
||||
}
|
||||
#if rp_probes
|
||||
@ -1376,7 +1390,7 @@ class Uniforms {
|
||||
if (fa == null) return;
|
||||
g.setFloats(location, fa);
|
||||
}
|
||||
else if (c.type == "int") {
|
||||
else if (c.type == "int" || c.type == "uint") {
|
||||
var i: Null<Int> = null;
|
||||
switch (c.link) {
|
||||
case "_uid": {
|
||||
|
||||
Reference in New Issue
Block a user