block cursor custom textures
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2025-04-26 17:50:37 -04:00
parent 7fb0f5a489
commit 3173f1f2e9
5 changed files with 13 additions and 7 deletions

View File

@ -1553,6 +1553,7 @@ Align voxel lookups for movement audio and interaction targeting
Align block lookups for interaction targeting
Cursor logic around blocks
Block destruction work
Block cursor custom textures

View File

@ -20,6 +20,7 @@ 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;
@ -278,7 +279,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();
CursorState.makeBlockVisible(AssetDataStrings.TEXTURE_RED_TRANSPARENT);
Globals.cursorState.hintClampToExistingBlock();
set = true;
}

View File

@ -94,7 +94,7 @@ public class CursorState {
Globals.playerCursor = EntityCreationUtils.createClientSpatialEntity();
EntityCreationUtils.makeEntityDrawable(Globals.playerCursor, AssetDataStrings.UNITSPHERE);
Actor cursorActor = EntityUtils.getActor(Globals.playerCursor);
cursorActor.addTextureMask(new ActorTextureMask("sphere", Arrays.asList(new String[]{"Textures/transparent_red.png"})));
cursorActor.addTextureMask(new ActorTextureMask("sphere", Arrays.asList(new String[]{AssetDataStrings.TEXTURE_RED_TRANSPARENT})));
DrawableUtils.makeEntityTransparent(Globals.playerCursor);
EntityUtils.getScale(Globals.playerCursor).set(0.2f);
Globals.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerCursor, EntityTags.DRAWABLE);
@ -103,7 +103,7 @@ public class CursorState {
Globals.playerBlockCursor = EntityCreationUtils.createClientSpatialEntity();
EntityCreationUtils.makeEntityDrawable(Globals.playerBlockCursor, AssetDataStrings.UNITCUBE);
Actor blockCursorActor = EntityUtils.getActor(Globals.playerBlockCursor);
blockCursorActor.addTextureMask(new ActorTextureMask("cube", Arrays.asList(new String[]{"Textures/transparent_red.png"})));
blockCursorActor.addTextureMask(new ActorTextureMask("cube", Arrays.asList(new String[]{AssetDataStrings.TEXTURE_RED_TRANSPARENT})));
DrawableUtils.makeEntityTransparent(Globals.playerBlockCursor);
EntityUtils.getScale(Globals.playerBlockCursor).set(BLOCK_CURSOR_SCALE_MULTIPLIER);
Globals.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerBlockCursor, EntityTags.DRAWABLE);
@ -112,7 +112,7 @@ public class CursorState {
Globals.playerAreaCursor = EntityCreationUtils.createClientSpatialEntity();
EntityCreationUtils.makeEntityDrawable(Globals.playerAreaCursor, AssetDataStrings.UNITCUBE);
Actor areaCursorActor = EntityUtils.getActor(Globals.playerAreaCursor);
areaCursorActor.addTextureMask(new ActorTextureMask("cube", Arrays.asList(new String[]{"Textures/transparent_red.png"})));
areaCursorActor.addTextureMask(new ActorTextureMask("cube", Arrays.asList(new String[]{AssetDataStrings.TEXTURE_RED_TRANSPARENT})));
DrawableUtils.makeEntityTransparent(Globals.playerAreaCursor);
EntityUtils.getScale(Globals.playerAreaCursor).set(BLOCK_CURSOR_SCALE_MULTIPLIER);
Globals.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerAreaCursor, EntityTags.DRAWABLE);
@ -121,7 +121,7 @@ public class CursorState {
playerFabCursor = EntityCreationUtils.createClientSpatialEntity();
EntityCreationUtils.makeEntityDrawable(playerFabCursor, AssetDataStrings.UNITCUBE);
Actor fabCursorActor = EntityUtils.getActor(playerFabCursor);
fabCursorActor.addTextureMask(new ActorTextureMask("cube", Arrays.asList(new String[]{"Textures/transparent_red.png"})));
fabCursorActor.addTextureMask(new ActorTextureMask("cube", Arrays.asList(new String[]{AssetDataStrings.TEXTURE_RED_TRANSPARENT})));
DrawableUtils.makeEntityTransparent(playerFabCursor);
Globals.clientSceneWrapper.getScene().removeEntityFromTag(playerFabCursor, EntityTags.DRAWABLE);
}
@ -166,8 +166,10 @@ public class CursorState {
/**
* Makes the block position cursor visible
*/
public static void makeBlockVisible(){
public static void makeBlockVisible(String texture){
CursorState.hide();
Actor blockCursorActor = EntityUtils.getActor(Globals.playerBlockCursor);
blockCursorActor.addTextureMask(new ActorTextureMask("cube", Arrays.asList(new String[]{texture})));
Globals.clientSceneWrapper.getScene().registerEntityToTag(Globals.playerBlockCursor, EntityTags.DRAWABLE);
}

View File

@ -32,6 +32,7 @@ public class AssetDataStrings {
* Fundamental textures of the engine
*/
public static final String TEXTURE_TEAL_TRANSPARENT = "Textures/color/transparent_teal.png";
public static final String TEXTURE_RED_TRANSPARENT = "Textures/transparent_red.png";
public static final String TEXTURE_DEFAULT = "Textures/color/Testing1.png";
/**

View File

@ -20,6 +20,7 @@ import java.util.List;
import electrosphere.collision.PhysicsEntityUtils;
import electrosphere.controls.cursor.CursorState;
import electrosphere.engine.Globals;
import electrosphere.engine.assetmanager.AssetDataStrings;
import electrosphere.entity.ClientEntityUtils;
import electrosphere.entity.Entity;
import electrosphere.entity.EntityCreationUtils;
@ -183,7 +184,7 @@ public class ClientToolbarState implements BehaviorTree {
CursorState.makeRealVisible();
} else if(itemData.getTokens().contains(CursorState.CURSOR_BLOCK_TOKEN)) {
Globals.cursorState.setClampToExistingBlock(true);
CursorState.makeBlockVisible();
CursorState.makeBlockVisible(AssetDataStrings.TEXTURE_RED_TRANSPARENT);
}
}
}