Fehler im LOD System behoben
This commit is contained in:
@@ -8,6 +8,7 @@ import com.jme3.system.lwjgl.LwjglWindow;
|
||||
import de.blight.game.BlightGame;
|
||||
import de.blight.game.state.TerrainChunkState;
|
||||
import de.blight.game.state.WeatherState;
|
||||
import de.blight.game.state.WorldObjectsState;
|
||||
import de.blight.lang.TextResolver;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import org.lwjgl.glfw.GLFWVidMode;
|
||||
@@ -205,6 +206,9 @@ public class GraphicsScreen extends MenuScreen {
|
||||
TerrainChunkState tcs = getApplication().getStateManager().getState(TerrainChunkState.class);
|
||||
if (tcs != null) tcs.setLodRanges(live.viewDistance.lod0Range, live.viewDistance.lod1Range);
|
||||
|
||||
WorldObjectsState wos = getApplication().getStateManager().getState(WorldObjectsState.class);
|
||||
if (wos != null) wos.setLodFactor((float) live.viewDistance.lod0Range);
|
||||
|
||||
close();
|
||||
|
||||
if (needsRestart) {
|
||||
|
||||
@@ -39,9 +39,9 @@ public class GraphicsSettings {
|
||||
}
|
||||
|
||||
public enum ViewDistance {
|
||||
SHORT (0.55f, 0, 2),
|
||||
NORMAL(1.00f, 1, 3),
|
||||
FAR (1.60f, 2, 5);
|
||||
SHORT (1.00f, 1, 3),
|
||||
NORMAL(1.60f, 2, 5),
|
||||
FAR (2.50f, 3, 7);
|
||||
|
||||
public final float fogFactor;
|
||||
public final int lod0Range;
|
||||
|
||||
@@ -254,7 +254,7 @@ public class WorldScene extends BaseAppState {
|
||||
BlightGame.status("Lade Welt-Objekte...");
|
||||
app.getStateManager().attach(new RiverState());
|
||||
WorldObjectsState worldObjects = new WorldObjectsState();
|
||||
worldObjects.setLodFactor(graphicsSettings.viewDistance.fogFactor);
|
||||
worldObjects.setLodFactor((float) graphicsSettings.viewDistance.lod0Range);
|
||||
app.getStateManager().attach(worldObjects);
|
||||
app.getStateManager().attach(new WorldLightState(sharedFPP));
|
||||
app.getStateManager().attach(new StoneWorldState());
|
||||
|
||||
@@ -43,10 +43,9 @@ public class ImpostorViewControl extends AbstractControl {
|
||||
float angle = (float) Math.atan2(dx, dz);
|
||||
float t = angle * dirs / FastMath.TWO_PI;
|
||||
int best = ((int) Math.round(t) % dirs + dirs) % dirs;
|
||||
int opp = (best + dirs / 2) % dirs;
|
||||
|
||||
for (int i = 0; i < dirs; i++) {
|
||||
quads.get(i).setCullHint(i == best || i == opp
|
||||
quads.get(i).setCullHint(i == best
|
||||
? Spatial.CullHint.Inherit
|
||||
: Spatial.CullHint.Always);
|
||||
}
|
||||
|
||||
@@ -34,8 +34,7 @@ public class ModelLodControl extends AbstractControl {
|
||||
private final Camera cam;
|
||||
private final float lod1DistSq;
|
||||
private final float lod2DistSq;
|
||||
private final float cullDistSq;
|
||||
private int currentSlot = 0; // 0=lod0, 1=lod1, 2=lod2, -1=culled
|
||||
private int currentSlot = 0; // 0=lod0, 1=lod1, 2=lod2, -1=ausgeblendet
|
||||
|
||||
// ── Embedded-LOD-Modus ────────────────────────────────────────────────────
|
||||
private final Spatial embLod0;
|
||||
@@ -55,18 +54,17 @@ public class ModelLodControl extends AbstractControl {
|
||||
/**
|
||||
* Embedded-LOD-Modus: Die j3o-Nodes lod0/lod1/lod2 existieren bereits als
|
||||
* Child-Nodes im Spatial, an dem dieser Control befestigt wird.
|
||||
* lod1 und lod2 dürfen null sein (dann bleibt lod0 bis zur cullDistance sichtbar).
|
||||
* lod1 und lod2 dürfen null sein (dann wird lod0 ab der jeweiligen Schwelle ausgeblendet).
|
||||
*/
|
||||
public ModelLodControl(Camera cam,
|
||||
Spatial lod0, Spatial lod1, Spatial lod2,
|
||||
float lod1Distance, float lod2Distance, float cullDistance) {
|
||||
float lod1Distance, float lod2Distance) {
|
||||
this.cam = cam;
|
||||
this.embLod0 = lod0;
|
||||
this.embLod1 = lod1;
|
||||
this.embLod2 = lod2;
|
||||
this.lod1DistSq = lod1 != null ? lod1Distance * lod1Distance : Float.MAX_VALUE;
|
||||
this.lod2DistSq = lod2 != null ? lod2Distance * lod2Distance : Float.MAX_VALUE;
|
||||
this.cullDistSq = cullDistance * cullDistance;
|
||||
this.lod1DistSq = lod1Distance > 0f ? lod1Distance * lod1Distance : Float.MAX_VALUE;
|
||||
this.lod2DistSq = lod2Distance > 0f ? lod2Distance * lod2Distance : Float.MAX_VALUE;
|
||||
this.assets = null;
|
||||
}
|
||||
|
||||
@@ -76,14 +74,13 @@ public class ModelLodControl extends AbstractControl {
|
||||
*/
|
||||
public ModelLodControl(AssetManager assets, Camera cam,
|
||||
String lod1Path, String lod2Path,
|
||||
float lod1Distance, float lod2Distance, float cullDistance) {
|
||||
float lod1Distance, float lod2Distance) {
|
||||
this.assets = assets;
|
||||
this.cam = cam;
|
||||
this.lod1Path = (lod1Path != null && !lod1Path.isBlank()) ? lod1Path : null;
|
||||
this.lod2Path = (lod2Path != null && !lod2Path.isBlank()) ? lod2Path : null;
|
||||
this.lod1DistSq = lod1Distance * lod1Distance;
|
||||
this.lod2DistSq = lod2Distance * lod2Distance;
|
||||
this.cullDistSq = cullDistance * cullDistance;
|
||||
this.lod1DistSq = lod1Distance > 0f ? lod1Distance * lod1Distance : Float.MAX_VALUE;
|
||||
this.lod2DistSq = lod2Distance > 0f ? lod2Distance * lod2Distance : Float.MAX_VALUE;
|
||||
this.embLod0 = null;
|
||||
this.embLod1 = null;
|
||||
this.embLod2 = null;
|
||||
@@ -115,21 +112,25 @@ public class ModelLodControl extends AbstractControl {
|
||||
|
||||
boolean embedded = embLod0 != null;
|
||||
|
||||
boolean hasLod1 = embedded ? embLod1 != null : lod1Path != null;
|
||||
boolean hasLod2 = embedded ? embLod2 != null : lod2Path != null;
|
||||
|
||||
// Sichtbarkeit hängt nur vom LOD-System ab — kein separates Culling.
|
||||
// Fehlt LOD1 aber LOD2 vorhanden: bei lod1Distance direkt zu LOD2 wechseln (nicht ausblenden).
|
||||
// Fehlt beides (z.B. Kaktusfeige): ab lod1Distance ausblenden.
|
||||
int targetSlot;
|
||||
if (distSq >= cullDistSq) {
|
||||
targetSlot = -1;
|
||||
} else if (embedded) {
|
||||
if (embLod2 != null && distSq >= lod2DistSq) targetSlot = 2;
|
||||
else if (embLod1 != null && distSq >= lod1DistSq) targetSlot = 1;
|
||||
else targetSlot = 0;
|
||||
if (distSq >= lod2DistSq) {
|
||||
targetSlot = hasLod2 ? 2 : -1;
|
||||
} else if (distSq >= lod1DistSq) {
|
||||
if (hasLod1) targetSlot = 1;
|
||||
else if (hasLod2) targetSlot = 2; // kein LOD1, aber LOD2 vorhanden → Impostor früher
|
||||
else targetSlot = -1; // weder LOD1 noch LOD2 → ausblenden
|
||||
} else {
|
||||
if (lod2Path != null && distSq >= lod2DistSq) targetSlot = 2;
|
||||
else if (lod1Path != null && distSq >= lod1DistSq) targetSlot = 1;
|
||||
else targetSlot = 0;
|
||||
targetSlot = 0;
|
||||
}
|
||||
|
||||
if (targetSlot == currentSlot) return;
|
||||
log.debug("[LOD] {} Slot {} → {} (dist={}m)",
|
||||
log.info("[LOD] {} Slot {} → {} (dist={}m)",
|
||||
spatial.getName(), currentSlot, targetSlot,
|
||||
String.format("%.1f", Math.sqrt(distSq)));
|
||||
currentSlot = targetSlot;
|
||||
|
||||
@@ -226,9 +226,9 @@ public class WorldItemsState extends BaseAppState {
|
||||
float hMargin = cam.getWidth() * 0.10f;
|
||||
float screenH = cam.getHeight();
|
||||
|
||||
boolean doLog = hoverLogTimer >= 1f;
|
||||
boolean doLog = hoverLogTimer >= 1f && !items.isEmpty();
|
||||
if (hoverLogTimer >= 1f) hoverLogTimer = 0f;
|
||||
if (doLog) {
|
||||
hoverLogTimer = 0f;
|
||||
log.info("[Hover] items={} screenW={} screenH={} centerX={} hMargin={}",
|
||||
items.size(), cam.getWidth(), cam.getHeight(), centerX, hMargin);
|
||||
}
|
||||
|
||||
@@ -6,14 +6,18 @@ import com.jme3.app.state.BaseAppState;
|
||||
import com.jme3.asset.AssetManager;
|
||||
import com.jme3.asset.plugins.FileLocator;
|
||||
import com.jme3.bullet.BulletAppState;
|
||||
import com.jme3.bullet.collision.shapes.CapsuleCollisionShape;
|
||||
import com.jme3.bullet.collision.shapes.CompoundCollisionShape;
|
||||
import com.jme3.bullet.control.RigidBodyControl;
|
||||
import com.jme3.bullet.util.CollisionShapeFactory;
|
||||
import com.jme3.bounding.BoundingBox;
|
||||
import com.jme3.material.Material;
|
||||
import com.jme3.material.MatParam;
|
||||
import com.jme3.material.RenderState;
|
||||
import com.jme3.math.*;
|
||||
import com.jme3.renderer.queue.RenderQueue;
|
||||
import com.jme3.scene.*;
|
||||
import com.jme3.scene.control.BillboardControl;
|
||||
import com.jme3.scene.shape.*;
|
||||
import com.jme3.texture.Texture;
|
||||
import de.blight.common.PlacedModel;
|
||||
@@ -34,9 +38,13 @@ public class WorldObjectsState extends BaseAppState {
|
||||
private SimpleApplication app;
|
||||
private AssetManager assets;
|
||||
private BulletAppState bulletAppState;
|
||||
private final List<Material> sceneLitMaterials = new ArrayList<>();
|
||||
private final List<Material> windMaterials = new ArrayList<>();
|
||||
private final List<Material> pbrMaterials = new ArrayList<>();
|
||||
private final List<Material> sceneLitMaterials = new ArrayList<>();
|
||||
private final List<Material> windMaterials = new ArrayList<>();
|
||||
private final List<Material> pbrMaterials = new ArrayList<>();
|
||||
/** Impostor-Unshaded-Materialien: erhalten pro Frame einen Ambient-Tint (Color-Uniform). */
|
||||
private final List<Material> impostorMaterials = new ArrayList<>();
|
||||
/** Capture-Ambient, mit dem der Impostor-Atlas gerendert wurde. Normalisiert den Tint. */
|
||||
private static final float IMPOSTOR_CAP_AMB = 0.30f;
|
||||
private float debugTimer = 0f;
|
||||
private float lodFactor = 1.0f;
|
||||
|
||||
@@ -92,6 +100,30 @@ public class WorldObjectsState extends BaseAppState {
|
||||
else shadowMode = RenderQueue.ShadowMode.Off;
|
||||
s.setShadowMode(shadowMode);
|
||||
|
||||
// Baum-Stammkollision: Capsule statt Vollmesh (Blätter ausgeschlossen)
|
||||
String objPath = m.modelPath() != null ? m.modelPath() : "";
|
||||
if (objPath.startsWith("Models/trees/") && bulletAppState != null) {
|
||||
try {
|
||||
s.updateGeometricState();
|
||||
float treeHeight = 6f;
|
||||
com.jme3.bounding.BoundingVolume bv = s.getWorldBound();
|
||||
if (bv instanceof BoundingBox bb) {
|
||||
treeHeight = bb.getYExtent() * 2f;
|
||||
}
|
||||
float cylHeight = Math.max(0.5f, treeHeight - 0.5f);
|
||||
CapsuleCollisionShape capsule =
|
||||
new CapsuleCollisionShape(0.25f, cylHeight);
|
||||
CompoundCollisionShape compound =
|
||||
new CompoundCollisionShape();
|
||||
compound.addChildShape(capsule, new Vector3f(0f, treeHeight * 0.5f, 0f));
|
||||
RigidBodyControl treeRbc = new RigidBodyControl(compound, 0f);
|
||||
s.addControl(treeRbc);
|
||||
bulletAppState.getPhysicsSpace().add(treeRbc);
|
||||
} catch (Exception pe) {
|
||||
log.warn("[WorldObjects] Baum-Physik für '{}' nicht erzeugbar: {}", m.modelPath(), pe.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// Physik-Kollision für solide Objekte
|
||||
if (m.solid() && bulletAppState != null) {
|
||||
try {
|
||||
@@ -142,6 +174,17 @@ public class WorldObjectsState extends BaseAppState {
|
||||
for (Material mat : pbrMaterials) {
|
||||
mat.setColor("Emissive", new ColorRGBA(ac.r, ac.g, ac.b, 1f));
|
||||
}
|
||||
// Impostor-Tint: Unshaded-Atlas folgt dem Tag/Nacht-Zyklus über den Color-Multiplikator.
|
||||
// Normiert auf die Capture-Ambient (0.30): Bei gleichem Ambient = 1.0, Nacht ≈ 0.05.
|
||||
if (!impostorMaterials.isEmpty()) {
|
||||
float tR = Math.min(1.2f, ac.r / IMPOSTOR_CAP_AMB);
|
||||
float tG = Math.min(1.2f, ac.g / IMPOSTOR_CAP_AMB);
|
||||
float tB = Math.min(1.2f, ac.b / IMPOSTOR_CAP_AMB);
|
||||
ColorRGBA tint = new ColorRGBA(tR, tG, tB, 1f);
|
||||
for (Material mat : impostorMaterials) {
|
||||
mat.setColor("Color", tint);
|
||||
}
|
||||
}
|
||||
debugTimer += tpf;
|
||||
if (debugTimer >= 5f) {
|
||||
debugTimer = 0f;
|
||||
@@ -193,27 +236,54 @@ public class WorldObjectsState extends BaseAppState {
|
||||
}
|
||||
spatial.setName("obj_" + path);
|
||||
|
||||
// LOD / Distance-Culling
|
||||
if (m.cullDistance() > 0f) {
|
||||
// LOD — kein cullDistance mehr; Objekte ohne LOD-Stufe werden ab der jeweiligen Distanz ausgeblendet
|
||||
if (m.lod1Distance() > 0f || m.lod2Distance() > 0f) {
|
||||
if (spatial instanceof Node treeNode) {
|
||||
Spatial lod0 = treeNode.getChild("lod0");
|
||||
Spatial lod1 = treeNode.getChild("lod1");
|
||||
Spatial lod2 = treeNode.getChild("lod2");
|
||||
|
||||
// Fall A: j3o hat explizite lod0/lod1/lod2 Child-Nodes.
|
||||
// Neues eingebettetes Format: child[0] ist das HD-Modell, aber nicht explizit "lod0"
|
||||
// benannt. Erkennungsmerkmal: "lod1" ist vorhanden (alter Impostor-Format hat nie lod1).
|
||||
if (lod0 == null && lod1 != null && !treeNode.getChildren().isEmpty()) {
|
||||
lod0 = treeNode.getChild(0);
|
||||
}
|
||||
|
||||
// Fall A: j3o hat eingebettete LOD-Child-Nodes (lod0 explizit oder per Index 0 erkannt).
|
||||
if (lod0 != null) {
|
||||
log.info("[WorldObjects-LOD] Fall A: {} | Kinder={} | lod0='{}' lod1={} lod2={} | dist={}/{}m",
|
||||
path, treeNode.getChildren().size(),
|
||||
lod0.getName(), lod1 != null ? "'" + lod1.getName() + "'" : "null",
|
||||
lod2 != null ? "'" + lod2.getName() + "'" : "null",
|
||||
m.lod1Distance() * lodFactor, m.lod2Distance() * lodFactor);
|
||||
lod0.setCullHint(Spatial.CullHint.Inherit);
|
||||
if (lod1 != null) lod1.setCullHint(Spatial.CullHint.Always);
|
||||
if (lod2 != null) lod2.setCullHint(Spatial.CullHint.Always);
|
||||
if (lod2 != null) {
|
||||
lod2.setCullHint(Spatial.CullHint.Always);
|
||||
if (lod2 instanceof Node lod2Node && !lod2Node.getChildren().isEmpty()
|
||||
&& isImpostorNode(lod2Node)) {
|
||||
initImpostor(lod2Node);
|
||||
}
|
||||
}
|
||||
treeNode.addControl(new ModelLodControl(
|
||||
app.getCamera(), lod0, lod1, lod2,
|
||||
m.lod1Distance() * lodFactor, m.lod2Distance() * lodFactor, m.cullDistance() * lodFactor));
|
||||
m.lod1Distance() * lodFactor, m.lod2Distance() * lodFactor));
|
||||
return treeNode;
|
||||
}
|
||||
|
||||
// Vorhandene Controls im geladenen j3o loggen (sollten nach stripControls nicht vorhanden sein)
|
||||
if (treeNode.getNumControls() > 0) {
|
||||
log.warn("[WorldObjects-LOD] {} hat {} Control(s) nach dem Laden! Controls werden entfernt.",
|
||||
path, treeNode.getNumControls());
|
||||
while (treeNode.getNumControls() > 0) treeNode.removeControl(treeNode.getControl(0));
|
||||
}
|
||||
|
||||
// Fall B: j3o hat nur "lod2" als Kind — Root ist lod0, lod2 ist das vereinfachte Mesh.
|
||||
// lod2 aus dem Root ausgliedern, damit beide unabhängig ein/ausgeblendet werden können.
|
||||
if (lod2 != null) {
|
||||
log.info("[WorldObjects-LOD] Fall B: {} | Kinder={} | lod2='{}' | dist=0/{}m",
|
||||
path, treeNode.getChildren().size(), lod2.getName(),
|
||||
m.lod2Distance() * lodFactor);
|
||||
treeNode.detachChild(lod2);
|
||||
Node lodRoot = new Node("lodRoot_" + path);
|
||||
lodRoot.attachChild(treeNode); // index 0 = lod0 (volle Qualität)
|
||||
@@ -232,11 +302,14 @@ public class WorldObjectsState extends BaseAppState {
|
||||
lod2.setLocalTranslation(0f, -groundY, 0f);
|
||||
}
|
||||
}
|
||||
// Impostor: wählt pro Frame das kamerawinkelrichtige Quad-Paar.
|
||||
lod2.addControl(new ImpostorViewControl(app.getCamera()));
|
||||
// Impostor: wählt pro Frame das kamerawinkelrichtige Quad.
|
||||
if (lod2 instanceof Node lod2Node && !lod2Node.getChildren().isEmpty()
|
||||
&& isImpostorNode(lod2Node)) {
|
||||
initImpostor(lod2Node);
|
||||
}
|
||||
lodRoot.addControl(new ModelLodControl(
|
||||
app.getCamera(), treeNode, null, lod2,
|
||||
m.lod1Distance() * lodFactor, m.lod2Distance() * lodFactor, m.cullDistance() * lodFactor));
|
||||
m.lod1Distance() * lodFactor, m.lod2Distance() * lodFactor));
|
||||
return lodRoot;
|
||||
}
|
||||
}
|
||||
@@ -247,7 +320,7 @@ public class WorldObjectsState extends BaseAppState {
|
||||
ModelLodControl ctrl = new ModelLodControl(
|
||||
assets, app.getCamera(),
|
||||
m.lod1Path(), m.lod2Path(),
|
||||
m.lod1Distance() * lodFactor, m.lod2Distance() * lodFactor, m.cullDistance() * lodFactor);
|
||||
m.lod1Distance() * lodFactor, m.lod2Distance() * lodFactor);
|
||||
ctrl.setLodLoadCallback(lod -> {
|
||||
convertUnshadedToPbr(lod);
|
||||
collectSceneLitMaterials(lod);
|
||||
@@ -259,6 +332,83 @@ public class WorldObjectsState extends BaseAppState {
|
||||
return spatial;
|
||||
}
|
||||
|
||||
private boolean isImpostorNode(Node n) {
|
||||
if (n.getControl(BillboardControl.class) != null) {
|
||||
log.info("[Impostor] '{}' erkannt via BillboardControl", n.getName());
|
||||
return true;
|
||||
}
|
||||
if (n.getChildren().isEmpty()) {
|
||||
log.info("[Impostor] '{}' hat keine Kinder → kein Impostor", n.getName());
|
||||
return false;
|
||||
}
|
||||
Spatial first = n.getChild(0);
|
||||
log.info("[Impostor] '{}' erstes Kind: {} ({})", n.getName(), first.getName(), first.getClass().getSimpleName());
|
||||
if (!(first instanceof Geometry g)) {
|
||||
log.info("[Impostor] '{}' erstes Kind ist kein Geometry → kein Impostor", n.getName());
|
||||
return false;
|
||||
}
|
||||
Material mat = g.getMaterial();
|
||||
String matName = mat != null ? mat.getMaterialDef().getName() : "null";
|
||||
log.info("[Impostor] '{}' Material: '{}'", n.getName(), matName);
|
||||
return mat != null && "Unshaded".equals(matName);
|
||||
}
|
||||
|
||||
private void initImpostor(Node lod2Node) {
|
||||
lod2Node.addControl(new ImpostorViewControl(app.getCamera()));
|
||||
if (lod2Node.getControl(BillboardControl.class) == null) {
|
||||
BillboardControl bc = new BillboardControl();
|
||||
bc.setAlignment(BillboardControl.Alignment.AxialY);
|
||||
lod2Node.addControl(bc);
|
||||
}
|
||||
|
||||
// In Opaque-Bucket verschieben (auch für ältere j3os, die noch Transparent hatten).
|
||||
lod2Node.setQueueBucket(com.jme3.renderer.queue.RenderQueue.Bucket.Opaque);
|
||||
|
||||
java.util.Set<Material> seen = new java.util.HashSet<>();
|
||||
boolean firstMat = true;
|
||||
for (Spatial child : lod2Node.getChildren()) {
|
||||
if (!(child instanceof com.jme3.scene.Geometry geo)) continue;
|
||||
Material mat = geo.getMaterial();
|
||||
if (mat == null) continue;
|
||||
|
||||
mat.setFloat("AlphaDiscardThreshold", 0.5f);
|
||||
mat.getAdditionalRenderState().setBlendMode(com.jme3.material.RenderState.BlendMode.Off);
|
||||
// FaceCullMode.Off: Billboard dreht sich immer zur Kamera → beide Seiten rendern
|
||||
// ist sicherer als Back, da Winding-Order nach Billboard-Rotation nicht deterministisch ist.
|
||||
mat.getAdditionalRenderState().setFaceCullMode(com.jme3.material.RenderState.FaceCullMode.Off);
|
||||
geo.setQueueBucket(com.jme3.renderer.queue.RenderQueue.Bucket.Opaque);
|
||||
|
||||
com.jme3.material.MatParam colorMap = mat.getParam("ColorMap");
|
||||
if (colorMap != null && colorMap.getValue() instanceof com.jme3.texture.Texture t) {
|
||||
t.getImage().setColorSpace(com.jme3.texture.image.ColorSpace.sRGB);
|
||||
log.info("[Impostor] Tex '{}': {}×{} fmt={}",
|
||||
t.getName(), t.getImage().getWidth(), t.getImage().getHeight(), t.getImage().getFormat());
|
||||
// Diagnose: Alpha-Wert im Zentrum von Strip 0 prüfen (Pixel 256,256)
|
||||
if (firstMat) {
|
||||
firstMat = false;
|
||||
java.nio.ByteBuffer imgData = t.getImage().getData(0);
|
||||
if (imgData != null && imgData.capacity() >= (256 * 4096 + 256) * 4 + 4) {
|
||||
int off = (256 * 4096 + 256) * 4;
|
||||
int r = imgData.get(off) & 0xFF;
|
||||
int g = imgData.get(off + 1) & 0xFF;
|
||||
int b = imgData.get(off + 2) & 0xFF;
|
||||
int a = imgData.get(off + 3) & 0xFF;
|
||||
log.info("[Impostor] Atlas Pixel(256,256) Strip0: R={} G={} B={} A={}", r, g, b, a);
|
||||
} else {
|
||||
log.warn("[Impostor] Atlas-Daten nicht lesbar (capacity={})",
|
||||
imgData != null ? imgData.capacity() : -1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log.warn("[Impostor] Quad '{}' hat KEINE ColorMap!", geo.getName());
|
||||
}
|
||||
|
||||
if (seen.add(mat)) {
|
||||
impostorMaterials.add(mat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Spatial createPrimitive(String type) {
|
||||
return switch (type) {
|
||||
case "sphere" -> new Geometry("sphere", new Sphere(16, 16, 1f));
|
||||
@@ -319,6 +469,11 @@ public class WorldObjectsState extends BaseAppState {
|
||||
mat.setVector3("AmbientColor", new Vector3f(0.04f, 0.05f, 0.08f));
|
||||
mat.setVector3("LightDir", new Vector3f(0f, -1f, 0f));
|
||||
sceneLitMaterials.add(mat);
|
||||
if ("TreeLeaf".equals(name)) {
|
||||
// discard statt blend → Blätter müssen Tiefenwerte schreiben (Nebel, Wasser).
|
||||
geo.setQueueBucket(RenderQueue.Bucket.Opaque);
|
||||
mat.getAdditionalRenderState().setDepthWrite(true);
|
||||
}
|
||||
} else if ("Fern".equals(name)) {
|
||||
windMaterials.add(mat);
|
||||
} else if ("PBRLighting".equals(name)) {
|
||||
|
||||
Reference in New Issue
Block a user