fix block meshgen with multiple types in data set
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2025-04-27 01:01:56 -04:00
parent bd9f57fe3d
commit 0e50845ec6
8 changed files with 47 additions and 5 deletions

Binary file not shown.

Binary file not shown.

View File

@ -18,5 +18,6 @@
+ bug fixes
- Terrain edits do not save
- Window does not play nice with its minWidth/minHeight being set differently
- Interaction block cursor is overwriting fab cursor
+ unreproducible bugs

View File

@ -1564,6 +1564,7 @@ Disable failing ui tests
Pine trees drop wood blocks
More block types
Transparent blocks
Fix block meshgen

View File

@ -18,9 +18,7 @@ import electrosphere.collision.CollisionBodyCreation;
import electrosphere.collision.CollisionEngine;
import electrosphere.collision.PhysicsUtils;
import electrosphere.collision.collidable.Collidable;
import electrosphere.controls.cursor.CursorState;
import electrosphere.engine.Globals;
import electrosphere.engine.assetmanager.AssetDataStrings;
import electrosphere.entity.Entity;
import electrosphere.entity.EntityDataStrings;
import electrosphere.entity.EntityUtils;
@ -279,7 +277,7 @@ public class ClientInteractionEngine {
short type = blockChunkData.getType(blockPos.x, blockPos.y, blockPos.z);
String text = Globals.gameConfigCurrent.getBlockData().getTypeFromId(type).getName();
InteractionTargetMenu.setInteractionTargetString(text);
CursorState.makeBlockVisible(AssetDataStrings.TEXTURE_RED_TRANSPARENT);
Globals.cursorState.hintShowBlockCursor();
Globals.cursorState.hintClampToExistingBlock();
set = true;
}

View File

@ -416,6 +416,15 @@ public class CursorState {
}
}
/**
* Hints to show the block cursor
*/
public void hintShowBlockCursor(){
if(!Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(CursorState.playerFabCursor)){
CursorState.makeBlockVisible(AssetDataStrings.TEXTURE_RED_TRANSPARENT);
}
}
/**
* Gets the fab cursor
* @return The fab cursor

View File

@ -43,10 +43,12 @@ public class LightManager {
* The width of the light cluster grid's x dimension
*/
public static final int LIGHT_CLUSTER_WIDTH_X = 12;
/**
* The width of the light cluster grid's y dimension
*/
public static final int LIGHT_CLUSTER_WIDTH_Y = 12;
/**
* The width of the light cluster grid's z dimension
*/

View File

@ -104,13 +104,44 @@ public class BlockMeshgen {
currentQuad.w = 1;
currentQuad.h = 1;
currentQuad.type = data.getType(x, y, z);
} else {
} else if(currentQuad.type == data.getType(x, y, z)) {
continue;
} else {
currentQuad.h = y - currentQuad.y;
//check if should merge with previous quad
for(QuadMesh prevMesh : quadMeshes){
if(prevMesh.x + prevMesh.w == currentQuad.x && prevMesh.y == currentQuad.y && prevMesh.h == currentQuad.h && prevMesh.z == currentQuad.z){
prevMesh.w = prevMesh.w + 1;
currentQuad = null;
break;
}
}
if(currentQuad != null){
quadMeshes.add(currentQuad);
}
currentQuad = new QuadMesh();
currentQuad.x = x;
currentQuad.y = y;
currentQuad.z = z;
currentQuad.w = 1;
currentQuad.h = 1;
currentQuad.type = data.getType(x, y, z);
}
}
}
if(currentQuad != null){
quadMeshes.add(currentQuad);
currentQuad.h = dimensions.y - currentQuad.y;
//check if should merge with previous quad
for(QuadMesh prevMesh : quadMeshes){
if(prevMesh.x + prevMesh.w == currentQuad.x && prevMesh.y == currentQuad.y && prevMesh.h == currentQuad.h && prevMesh.z == currentQuad.z){
prevMesh.w = prevMesh.w + 1;
currentQuad = null;
break;
}
}
if(currentQuad != null){
quadMeshes.add(currentQuad);
}
}
}
}