Repe [T3DU] and Moises Jpelaez updates

This commit is contained in:
2026-05-12 23:54:06 -07:00
parent 6b404f9da6
commit 39091e8db3
147 changed files with 5539 additions and 1750 deletions

View File

@ -18,17 +18,18 @@ class MeshObject extends Object {
public var depthRead(default, null) = false;
#if lnx_particles
public var particleSystems: Array<ParticleSystem> = null; // Particle owner
public var render_emitter = true;
#end
#if lnx_gpu_particles
public var particleChildren: Array<MeshObject> = null;
public var particleOwner: MeshObject = null; // Particle object
public var particleIndex = -1;
public var render_emitter = true;
#end
public var cameraDistance: Float;
public var cameraList: Array<String> = null;
public var screenSize = 0.0;
public var frustumCulling = true;
public var activeTilesheet: Tilesheet = null;
public var tilesheets: Array<Tilesheet> = null;
public var tilesheet: Tilesheet = null;
public var skip_context: String = null; // Do not draw this context
public var force_context: String = null; // Draw only this context
static var lastPipeline: PipelineState = null;
@ -72,18 +73,22 @@ class MeshObject extends Object {
#if lnx_batch
Scene.active.meshBatch.removeMesh(this);
#end
#if lnx_particles
#if lnx_gpu_particles
if (particleChildren != null) {
for (c in particleChildren) c.remove();
particleChildren = null;
}
#end
#if lnx_particles
if (particleSystems != null) {
for (psys in particleSystems) psys.remove();
for (psys in particleSystems) {
#if lnx_cpu_particles psys.stop(); #end
psys.remove();
}
particleSystems = null;
}
#end
if (activeTilesheet != null) activeTilesheet.remove();
if (tilesheets != null) for (ts in tilesheets) { ts.remove(); }
if (tilesheet != null) tilesheet.remove();
if (Scene.active != null) Scene.active.meshes.remove(this);
data.refcount--;
super.remove();
@ -113,35 +118,19 @@ class MeshObject extends Object {
#if lnx_particles
public function setupParticleSystem(sceneName: String, pref: TParticleReference) {
if (particleSystems == null) particleSystems = [];
var psys = new ParticleSystem(sceneName, pref);
var psys = new ParticleSystem(sceneName, pref, this);
particleSystems.push(psys);
}
#end
public function setupTilesheet(sceneName: String, tilesheet_ref: String, tilesheet_action_ref: String) {
activeTilesheet = new Tilesheet(sceneName, tilesheet_ref, tilesheet_action_ref);
if(tilesheets == null) tilesheets = new Array<Tilesheet>();
tilesheets.push(activeTilesheet);
public function setupTilesheet(tilesheetData: iron.data.SceneFormat.TTilesheetData) {
tilesheet = new Tilesheet(tilesheetData, this);
}
public function setActiveTilesheet(sceneName: String, tilesheet_ref: String, tilesheet_action_ref: String) {
var set = false;
// Check if tilesheet already created
if (tilesheets != null) {
for (ts in tilesheets) {
if (ts.raw.name == tilesheet_ref) {
activeTilesheet = ts;
activeTilesheet.play(tilesheet_action_ref);
set = true;
break;
}
}
public function setTilesheetAction(actionRef: String) {
if (tilesheet != null) {
tilesheet.play(actionRef);
}
// If not already created
if (!set) {
setupTilesheet(sceneName, tilesheet_ref, tilesheet_action_ref);
}
}
inline function isLodMaterial(): Bool {
@ -179,7 +168,7 @@ class MeshObject extends Object {
// Scale radius for skinned mesh and particle system
// TODO: define skin & particle bounds
var radiusScale = data.isSkinned ? 2.0 : 1.0;
#if lnx_particles
#if lnx_gpu_particles
// particleSystems for update, particleOwner for render
if (particleSystems != null || particleOwner != null) radiusScale *= 1000;
#end
@ -236,9 +225,14 @@ class MeshObject extends Object {
if (cullMesh(context, Scene.active.camera, RenderPath.active.light)) return;
var meshContext = raw != null ? context == "mesh" : false;
// Update tilesheet
if (tilesheet != null && meshContext) {
tilesheet.update();
}
if (cameraList != null && cameraList.indexOf(Scene.active.camera.name) < 0) return;
#if lnx_particles
#if lnx_gpu_particles
if (raw != null && raw.is_particle && particleOwner == null) return; // Instancing not yet set-up by particle system owner
if (particleSystems != null && meshContext) {
if (particleChildren == null) {
@ -257,9 +251,11 @@ class MeshObject extends Object {
}
}
for (i in 0...particleSystems.length) {
particleSystems[i].update(particleChildren[i], this);
particleSystems[i].update(particleChildren[i]);
}
}
#end
#if lnx_particles
if (particleSystems != null && particleSystems.length > 0 && !render_emitter) return;
if (particleSystems == null && cullMaterial(context)) return;
#else