Scaled slope bias and transparent shadows fixes

This commit is contained in:
2026-10-31 01:10:21 -07:00
parent 29f0765864
commit f45ad72056
15 changed files with 126 additions and 48 deletions

View File

@ -928,6 +928,14 @@ class Uniforms {
case "_tileBoundsSunArray": {
fa = LightObject.updateSunTileBoundsArray();
}
case "_tileBoundsSpotArray": {
fa = LightObject.updateSpotTileBoundsArray();
}
#end
#if (!lnx_clusters && lnx_spot)
case "_biasLightWorldViewProjectionMatrixSpotArray": {
fa = updateSpotMatrixFloats();
}
#end
}
@ -1387,6 +1395,11 @@ class Uniforms {
fa = LightObject.updateLWVPMatrixArray(object, "spot");
}
#end // lnx_clusters
#if (!lnx_clusters && lnx_spot)
case "_biasLightWorldViewProjectionMatrixSpotArray": {
fa = updateSpotMatrixFloats();
}
#end
#if lnx_morph_target
case "_morphWeights": {
fa = cast(object, MeshObject).morphTarget.morphWeights;
@ -1473,6 +1486,32 @@ class Uniforms {
}
return null;
}
static var spotMatrixFloats: Float32Array = null;
static function updateSpotMatrixFloats(): Float32Array {
var light = getSpot(0);
if (light == null) return null;
if (spotMatrixFloats == null) spotMatrixFloats = new Float32Array(16);
helpMat.setFrom(light.VP);
helpMat.multmat(biasMat);
spotMatrixFloats[0 ] = helpMat._00;
spotMatrixFloats[1 ] = helpMat._01;
spotMatrixFloats[2 ] = helpMat._02;
spotMatrixFloats[3 ] = helpMat._03;
spotMatrixFloats[4 ] = helpMat._10;
spotMatrixFloats[5 ] = helpMat._11;
spotMatrixFloats[6 ] = helpMat._12;
spotMatrixFloats[7 ] = helpMat._13;
spotMatrixFloats[8 ] = helpMat._20;
spotMatrixFloats[9 ] = helpMat._21;
spotMatrixFloats[10] = helpMat._22;
spotMatrixFloats[11] = helpMat._23;
spotMatrixFloats[12] = helpMat._30;
spotMatrixFloats[13] = helpMat._31;
spotMatrixFloats[14] = helpMat._32;
spotMatrixFloats[15] = helpMat._33;
return spotMatrixFloats;
}
#end
static function currentMat(object: Object): MaterialData {