forked from LeenkxTeam/LNXSDK
Next patch
This commit is contained in:
@ -14,6 +14,13 @@ class Inc {
|
||||
static var spotIndex = 0;
|
||||
static var lastFrame = -1;
|
||||
|
||||
#if lnx_shadowmap_atlas
|
||||
static var tilesToRemove: Array<ShadowMapTile> = [];
|
||||
#if lnx_shadowmap_atlas_lod
|
||||
static var tilesToChangeSize: Array<ShadowMapTile> = [];
|
||||
#end
|
||||
#end
|
||||
|
||||
#if ((rp_voxels != 'Off') && lnx_config)
|
||||
static var voxelsCreated = false;
|
||||
#end
|
||||
@ -149,12 +156,39 @@ class Inc {
|
||||
}
|
||||
|
||||
public static function bindShadowMapAtlas() {
|
||||
var hasAtlas = false;
|
||||
|
||||
for (atlas in ShadowMapAtlas.shadowMapAtlases) {
|
||||
path.bindTarget(atlas.target, atlas.target);
|
||||
hasAtlas = true;
|
||||
}
|
||||
|
||||
if (!hasAtlas) {
|
||||
#if lnx_shadowmap_atlas_single_map
|
||||
path.bindTarget("empty_shadowmap", "shadowMapAtlas");
|
||||
#else
|
||||
path.bindTarget("empty_shadowmap", "shadowMapAtlasSun");
|
||||
path.bindTarget("empty_shadowmap", "shadowMapAtlasPoint");
|
||||
path.bindTarget("empty_shadowmap", "shadowMapAtlasSpot");
|
||||
#end
|
||||
}
|
||||
|
||||
#if rp_shadowmap_transparent
|
||||
var hasAtlasT = false;
|
||||
|
||||
for (atlas in ShadowMapAtlas.shadowMapAtlasesTransparent) {
|
||||
path.bindTarget(atlas.target, atlas.target);
|
||||
hasAtlasT = true;
|
||||
}
|
||||
|
||||
if (!hasAtlasT) {
|
||||
#if lnx_shadowmap_atlas_single_map
|
||||
path.bindTarget("empty_shadowmap_transparent", "shadowMapAtlasTransparent");
|
||||
#else
|
||||
path.bindTarget("empty_shadowmap_transparent", "shadowMapAtlasSunTransparent");
|
||||
path.bindTarget("empty_shadowmap_transparent", "shadowMapAtlasPointTransparent");
|
||||
path.bindTarget("empty_shadowmap_transparent", "shadowMapAtlasSpotTransparent");
|
||||
#end
|
||||
}
|
||||
#end
|
||||
}
|
||||
@ -223,9 +257,9 @@ class Inc {
|
||||
#end
|
||||
|
||||
for (atlas in ShadowMapAtlas.shadowMapAtlases) {
|
||||
var tilesToRemove = [];
|
||||
tilesToRemove.resize(0);
|
||||
#if lnx_shadowmap_atlas_lod
|
||||
var tilesToChangeSize = [];
|
||||
tilesToChangeSize.resize(0);
|
||||
#end
|
||||
|
||||
var shadowmap = getShadowMapAtlas(atlas, false);
|
||||
@ -296,13 +330,14 @@ class Inc {
|
||||
path.currentFace = -1;
|
||||
}
|
||||
path.endStream();
|
||||
path.currentG = null;
|
||||
}
|
||||
|
||||
#if rp_shadowmap_transparent
|
||||
for (atlas in ShadowMapAtlas.shadowMapAtlasesTransparent) {
|
||||
var tilesToRemove = [];
|
||||
tilesToRemove.resize(0);
|
||||
#if lnx_shadowmap_atlas_lod
|
||||
var tilesToChangeSize = [];
|
||||
tilesToChangeSize.resize(0);
|
||||
#end
|
||||
|
||||
var shadowmap = getShadowMapAtlas(atlas, true);
|
||||
@ -374,6 +409,8 @@ class Inc {
|
||||
}
|
||||
path.endStream();
|
||||
|
||||
path.currentG = null;
|
||||
|
||||
#if lnx_shadowmap_atlas_lod
|
||||
for (tile in tilesToChangeSize) {
|
||||
tilesToRemove.push(tile);
|
||||
@ -382,9 +419,6 @@ class Inc {
|
||||
if (newTile != null)
|
||||
atlas.activeTiles.push(newTile);
|
||||
}
|
||||
// update point light data after changing size of tiles to avoid render issues
|
||||
updatePointLightAtlasData(false);
|
||||
// update point light data after changing size of tiles to avoid render issues
|
||||
updatePointLightAtlasData(true);
|
||||
#end
|
||||
|
||||
@ -554,8 +588,16 @@ class Inc {
|
||||
}
|
||||
if (superSample != config.rp_supersample) {
|
||||
superSample = config.rp_supersample;
|
||||
|
||||
var inVRPresent = false;
|
||||
#if (kha_webgl && lnx_vr)
|
||||
inVRPresent = kha.vr.VrInterface.instance != null &&
|
||||
kha.vr.VrInterface.instance.IsPresenting();
|
||||
#end
|
||||
|
||||
for (rt in path.renderTargets) {
|
||||
if (rt.raw.width == 0 && rt.raw.scale != null) {
|
||||
// VR present mode renderpath automatically overrides Inc.superSample to 4.0
|
||||
rt.raw.scale = getSuperSampling();
|
||||
}
|
||||
}
|
||||
@ -1372,6 +1414,10 @@ class ShadowMapAtlas {
|
||||
return;
|
||||
}
|
||||
|
||||
mainTile.forEachTileLinked(function(tile) {
|
||||
tile.isTransparent = transparent;
|
||||
});
|
||||
|
||||
atlas.activeTiles.push(mainTile);
|
||||
// notify the tile on light remove
|
||||
light.tileNotifyOnRemove = mainTile.notifyOnLightRemove;
|
||||
@ -1560,6 +1606,7 @@ class ShadowMapTile {
|
||||
public var size:Int;
|
||||
public var tiles:Array<ShadowMapTile> = [];
|
||||
public var linkedTile:ShadowMapTile = null;
|
||||
public var isTransparent:Bool = false; // track for tile
|
||||
|
||||
#if lnx_shadowmap_atlas_lod
|
||||
public var parentTile: ShadowMapTile = null;
|
||||
@ -1791,7 +1838,11 @@ class ShadowMapTile {
|
||||
public function freeTile(): Void {
|
||||
// prevent duplicates
|
||||
if (light != null && unlockLight) {
|
||||
light.lightInAtlas = false;
|
||||
if (isTransparent) {
|
||||
light.lightInAtlasTransparent = false;
|
||||
} else {
|
||||
light.lightInAtlas = false;
|
||||
}
|
||||
unlockLight = false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user