forked from LeenkxTeam/LNXSDK
Repe [T3DU] Update - 31f26d171bba0355ce2a77031e3aad4c64dbc7e9
This commit is contained in:
@ -11,6 +11,12 @@ import iron.object.CameraObject;
|
||||
class LightObject extends Object {
|
||||
|
||||
public var data: LightData;
|
||||
public var color: Vec4;
|
||||
public var strength: Float;
|
||||
#if lnx_spot
|
||||
public var size: Float;
|
||||
public var blend: Float;
|
||||
#end
|
||||
|
||||
#if rp_shadowmap
|
||||
#if lnx_shadowmap_atlas
|
||||
@ -79,6 +85,15 @@ class LightObject extends Object {
|
||||
super();
|
||||
|
||||
this.data = data;
|
||||
this.color = new Vec4(data.raw.color[0], data.raw.color[1], data.raw.color[2]);
|
||||
this.strength = data.raw.strength;
|
||||
|
||||
#if lnx_spot
|
||||
if (data.raw.type == "spot"){
|
||||
this.size = data.raw.spot_size;
|
||||
this.blend = data.raw.spot_blend;
|
||||
}
|
||||
#end
|
||||
|
||||
var type = data.raw.type;
|
||||
var fov = data.raw.fov;
|
||||
@ -374,7 +389,7 @@ class LightObject extends Object {
|
||||
// Centralize discarding conditions when iterating over lights
|
||||
// Important to avoid issues later with "misaligned" data in uniforms (lightsArray, clusterData, LWVPSpotArray)
|
||||
public inline static function discardLight(light: LightObject) {
|
||||
return !light.visible || light.data.raw.strength == 0.0 || light.data.raw.type == "sun";
|
||||
return !light.visible || light.strength == 0.0 || light.data.raw.type == "sun";
|
||||
}
|
||||
// Discarding conditions but with culling included
|
||||
public inline static function discardLightCulled(light: LightObject) {
|
||||
@ -457,7 +472,7 @@ class LightObject extends Object {
|
||||
lpos.set(l.transform.worldx(), l.transform.worldy(), l.transform.worldz());
|
||||
lpos.applymat4(camera.V);
|
||||
lpos.z *= -1.0;
|
||||
var radius = getRadius(l.data.raw.strength);
|
||||
var radius = getRadius(l.strength);
|
||||
var minX = 0;
|
||||
var minY = 0;
|
||||
var minZ = 0;
|
||||
@ -552,10 +567,10 @@ class LightObject extends Object {
|
||||
lightsArray[i * 12 + 3] = 0.0; // padding or spot scale x
|
||||
|
||||
// light color
|
||||
var f = l.data.raw.strength;
|
||||
lightsArray[i * 12 + 4] = l.data.raw.color[0] * f;
|
||||
lightsArray[i * 12 + 5] = l.data.raw.color[1] * f;
|
||||
lightsArray[i * 12 + 6] = l.data.raw.color[2] * f;
|
||||
var f = l.strength;
|
||||
lightsArray[i * 12 + 4] = l.color.x * f;
|
||||
lightsArray[i * 12 + 5] = l.color.y * f;
|
||||
lightsArray[i * 12 + 6] = l.color.z * f;
|
||||
lightsArray[i * 12 + 7] = 0.0; // padding or spot scale y
|
||||
|
||||
// other data
|
||||
@ -566,13 +581,13 @@ class LightObject extends Object {
|
||||
|
||||
#if lnx_spot
|
||||
if (l.data.raw.type == "spot") {
|
||||
lightsArray[i * 12 + 9] = l.data.raw.spot_size;
|
||||
lightsArray[i * 12 + 9] = l.size;
|
||||
|
||||
var dir = l.look().normalize();
|
||||
lightsArraySpot[i * 8 ] = dir.x;
|
||||
lightsArraySpot[i * 8 + 1] = dir.y;
|
||||
lightsArraySpot[i * 8 + 2] = dir.z;
|
||||
lightsArraySpot[i * 8 + 3] = l.data.raw.spot_blend;
|
||||
lightsArraySpot[i * 8 + 3] = l.blend;
|
||||
|
||||
// Premultiply scale with z component
|
||||
var scale = l.transform.scale;
|
||||
|
||||
Reference in New Issue
Block a user