diff --git a/assets/Textures/engine/stormenginelogo1.png b/assets/Textures/engine/stormenginelogo1.png new file mode 100644 index 00000000..8d111f47 Binary files /dev/null and b/assets/Textures/engine/stormenginelogo1.png differ diff --git a/buildNumber.properties b/buildNumber.properties index 8394a28b..41399377 100644 --- a/buildNumber.properties +++ b/buildNumber.properties @@ -1,3 +1,3 @@ #maven.buildNumber.plugin properties file -#Sat Nov 16 20:18:53 EST 2024 -buildNumber=390 +#Wed Nov 20 13:22:48 EST 2024 +buildNumber=392 diff --git a/docs/src/progress/renderertodo.md b/docs/src/progress/renderertodo.md index 4e2e88b9..2f825f71 100644 --- a/docs/src/progress/renderertodo.md +++ b/docs/src/progress/renderertodo.md @@ -1086,6 +1086,10 @@ Optimize data passing from voxel rasterizer to model generation Vector pooling in transvoxel rasterizer Fix invalid normals from transvoxel rasterizer +(11/20/2024) +Design storm engine icon +Fix edge-polygon generation for invalid cases +Add engine logo to title menu # TODO diff --git a/src/main/java/electrosphere/client/ui/menu/mainmenu/MenuGeneratorsTitleMenu.java b/src/main/java/electrosphere/client/ui/menu/mainmenu/MenuGeneratorsTitleMenu.java index 8fbbb0e0..959ed6c7 100644 --- a/src/main/java/electrosphere/client/ui/menu/mainmenu/MenuGeneratorsTitleMenu.java +++ b/src/main/java/electrosphere/client/ui/menu/mainmenu/MenuGeneratorsTitleMenu.java @@ -8,8 +8,10 @@ import electrosphere.engine.loadingthreads.LoadingThread; import electrosphere.engine.loadingthreads.LoadingThread.LoadingThreadType; import electrosphere.renderer.ui.elements.Button; import electrosphere.renderer.ui.elements.Div; +import electrosphere.renderer.ui.elements.ImagePanel; import electrosphere.renderer.ui.elements.Label; import electrosphere.renderer.ui.elementtypes.ContainerElement.YogaAlignment; +import electrosphere.renderer.ui.elementtypes.ContainerElement.YogaFlexDirection; import electrosphere.renderer.ui.elementtypes.ContainerElement.YogaJustification; import electrosphere.renderer.ui.elementtypes.Element; @@ -25,61 +27,88 @@ public class MenuGeneratorsTitleMenu { public static Element createTitleMenu(){ Div rVal = Div.createDiv(); //top-bottom - rVal.setJustifyContent(YogaJustification.Center); + rVal.setJustifyContent(YogaJustification.Between); //left-right rVal.setAlignItems(YogaAlignment.Center); - rVal.setAlignContent(YogaAlignment.Center); rVal.setFlexGrow(1.0f); + rVal.setFlexDirection(YogaFlexDirection.Column); - //label (title) - Label titleLabel = Label.createLabel("ORPG"); - rVal.addChild(titleLabel); - //button (multiplayer) - rVal.addChild(Button.createButtonCentered("Singleplayer", () -> { - WindowUtils.replaceMainMenuContents(MenuGenerators.createWorldSelectMenu()); - }).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE)); + //main option panel + { + Div optionPanel = Div.createCol(); + optionPanel.setAlignItems(YogaAlignment.Center); + optionPanel.setJustifyContent(YogaJustification.Center); + optionPanel.setFlexGrow(1.0f); - //button (multiplayer) - rVal.addChild(Button.createButtonCentered("Multiplayer", () -> { - WindowUtils.replaceMainMenuContents(MenuGenerators.createMultiplayerMenu()); - }).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE)); - //button (static level) - rVal.addChild(Button.createButtonCentered("Level Editor", () -> { - WindowUtils.replaceMainMenuContents(MenuGeneratorsLevelEditor.createLevelEditorTopMenu()); - }).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE)); + //label (title) + Label titleLabel = Label.createLabel("ORPG"); + optionPanel.addChild(titleLabel); - //button (options) - rVal.addChild(Button.createButtonCentered("Options", () -> { - WindowUtils.replaceMainMenuContents(MenuGenerators.createOptionsMainMenu()); - }).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE)); + //button (multiplayer) + optionPanel.addChild(Button.createButtonCentered("Singleplayer", () -> { + WindowUtils.replaceMainMenuContents(MenuGenerators.createWorldSelectMenu()); + }).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE)); - //button (sp debug) - rVal.addChild(Button.createButtonCentered("Debug SP Quickstart", () -> { - LoadingThread loadingThread = new LoadingThread(LoadingThreadType.DEBUG_RANDOM_SP_WORLD); - Globals.RUN_CLIENT = true; - Globals.RUN_SERVER = true; - Globals.threadManager.start(loadingThread); - }).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE)); + //button (multiplayer) + optionPanel.addChild(Button.createButtonCentered("Multiplayer", () -> { + WindowUtils.replaceMainMenuContents(MenuGenerators.createMultiplayerMenu()); + }).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE)); - //button (sp debug) - rVal.addChild(Button.createButtonCentered("Load Test Generation Realm", () -> { - LoadingThread loadingThread = new LoadingThread(LoadingThreadType.CHUNK_GENERATION_REALM); - Globals.RUN_CLIENT = true; - Globals.RUN_SERVER = true; - Globals.threadManager.start(loadingThread); - }).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE)); + //button (static level) + optionPanel.addChild(Button.createButtonCentered("Level Editor", () -> { + WindowUtils.replaceMainMenuContents(MenuGeneratorsLevelEditor.createLevelEditorTopMenu()); + }).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE)); - //button (ui testing) - rVal.addChild(Button.createButtonCentered("UI Testing", () -> { - WindowUtils.replaceMainMenuContents(MenuGeneratorsUITesting.createUITestMenu()); - }).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE)); + //button (options) + optionPanel.addChild(Button.createButtonCentered("Options", () -> { + WindowUtils.replaceMainMenuContents(MenuGenerators.createOptionsMainMenu()); + }).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE)); - //button (Viewport Test) - rVal.addChild(Button.createButtonCentered("Viewport Test", () -> { - Globals.threadManager.start(new LoadingThread(LoadingThreadType.LOAD_VIEWPORT)); - }).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE)); + //button (sp debug) + optionPanel.addChild(Button.createButtonCentered("Debug SP Quickstart", () -> { + LoadingThread loadingThread = new LoadingThread(LoadingThreadType.DEBUG_RANDOM_SP_WORLD); + Globals.RUN_CLIENT = true; + Globals.RUN_SERVER = true; + Globals.threadManager.start(loadingThread); + }).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE)); + + //button (sp debug) + optionPanel.addChild(Button.createButtonCentered("Load Test Generation Realm", () -> { + LoadingThread loadingThread = new LoadingThread(LoadingThreadType.CHUNK_GENERATION_REALM); + Globals.RUN_CLIENT = true; + Globals.RUN_SERVER = true; + Globals.threadManager.start(loadingThread); + }).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE)); + + //button (ui testing) + optionPanel.addChild(Button.createButtonCentered("UI Testing", () -> { + WindowUtils.replaceMainMenuContents(MenuGeneratorsUITesting.createUITestMenu()); + }).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE)); + + //button (Viewport Test) + optionPanel.addChild(Button.createButtonCentered("Viewport Test", () -> { + Globals.threadManager.start(new LoadingThread(LoadingThreadType.LOAD_VIEWPORT)); + }).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE)); + + + rVal.addChild(optionPanel); + } + + //footer + { + Div footer = Div.createRow(); + footer.setJustifyContent(YogaJustification.End); + footer.setWidthPercent(100.0f); + + ImagePanel engineLogoPanel = ImagePanel.createImagePanel(AssetDataStrings.UI_ENGINE_LOGO_1); + engineLogoPanel.setMinWidth(50); + engineLogoPanel.setMinHeight(50); + footer.addChild(engineLogoPanel); + + rVal.addChild(footer); + } return rVal; } diff --git a/src/main/java/electrosphere/engine/Globals.java b/src/main/java/electrosphere/engine/Globals.java index 19869c83..548e01d8 100644 --- a/src/main/java/electrosphere/engine/Globals.java +++ b/src/main/java/electrosphere/engine/Globals.java @@ -602,6 +602,7 @@ public class Globals { "Textures/ui/uiFrame1.png", "Textures/ui/uiFrame2.png", "Textures/ui/uiOutline1.png", + AssetDataStrings.UI_ENGINE_LOGO_1, "Textures/ui/circle.png", "Textures/ui/square.png", "Textures/color/transparent_green.png", diff --git a/src/main/java/electrosphere/engine/assetmanager/AssetDataStrings.java b/src/main/java/electrosphere/engine/assetmanager/AssetDataStrings.java index 1a734122..934311f5 100644 --- a/src/main/java/electrosphere/engine/assetmanager/AssetDataStrings.java +++ b/src/main/java/electrosphere/engine/assetmanager/AssetDataStrings.java @@ -21,6 +21,7 @@ public class AssetDataStrings { /** * UI textures */ + public static final String UI_ENGINE_LOGO_1 = "Textures/engine/stormenginelogo1.png"; public static final String UI_FRAME_TEXTURE_DEFAULT_1 = "Textures/ui/uiFrame1.png"; public static final String UI_FRAME_TEXTURE_DEFAULT_2 = "Textures/ui/uiFrame2.png"; diff --git a/src/main/java/electrosphere/renderer/meshgen/TransvoxelModelGeneration.java b/src/main/java/electrosphere/renderer/meshgen/TransvoxelModelGeneration.java index f65b6cd7..2de55180 100644 --- a/src/main/java/electrosphere/renderer/meshgen/TransvoxelModelGeneration.java +++ b/src/main/java/electrosphere/renderer/meshgen/TransvoxelModelGeneration.java @@ -767,6 +767,11 @@ public class TransvoxelModelGeneration { float firstSample = TransvoxelModelGeneration.getTransvoxelSampleValue(transitionCell.simpleFaceValues,transitionCell.complexFaceValues,firstCornerSampleIndex); float secondSample = TransvoxelModelGeneration.getTransvoxelSampleValue(transitionCell.simpleFaceValues,transitionCell.complexFaceValues,secondCornerSampleIndex); + //skip if it's 0-0 or 0-negative number + if(firstSample <= 0 && secondSample <= 0){ + continue; + } + // //Sample check -- we should never be interpolating between two samples of 0 value if(firstSample < 0 && secondSample < 0){ @@ -834,6 +839,12 @@ public class TransvoxelModelGeneration { Vector3f vert1 = vertList[triangleData.vertexIndex[i+1]]; Vector3f vert2 = vertList[triangleData.vertexIndex[i+2]]; + //the verts can be zero if the samples are 0 and a negative number + //in this case, we don't want to generate triangles + if(vert0 == null || vert1 == null || vert2 == null){ + continue; + } + LoggerInterface.loggerRenderer.DEBUG(vert0 + ""); LoggerInterface.loggerRenderer.DEBUG(vert1 + ""); LoggerInterface.loggerRenderer.DEBUG(vert2 + ""); @@ -1794,92 +1805,92 @@ public class TransvoxelModelGeneration { //xn-zn edge - if(chunkData.xNegativeEdgeIso != null && chunkData.zNegativeEdgeIso != null){ - int x = 0; - int z = 0; - int edgeLength = chunkWidth - (chunkData.yNegativeEdgeIso != null ? 1 : 0) - (chunkData.yPositiveEdgeIso != null ? 1 : 0); - int startIndex = 0 + (chunkData.yNegativeEdgeIso != null ? 1 : 0); - for(int i = startIndex; i < edgeLength - 1; i++){ - int y = i; - // - //Generate the x-side transition cell - // - currentTransitionCell.setValues( - //complex face vertex coordinates - new Vector3f(x,y,z), new Vector3f(x,y+TRANSITION_CELL_WIDTH,z), new Vector3f(x,y+1,z), - new Vector3f(x,y,z+TRANSITION_CELL_WIDTH), new Vector3f(x,y+TRANSITION_CELL_WIDTH,z+TRANSITION_CELL_WIDTH), new Vector3f(x,y+1,z+TRANSITION_CELL_WIDTH), - new Vector3f(x,y,z+1), new Vector3f(x,y+TRANSITION_CELL_WIDTH,z+1), new Vector3f(x,y+1,z+1), - //simple face vertex coordinates - new Vector3f(x+TRANSITION_CELL_WIDTH,y,z+TRANSITION_CELL_WIDTH), new Vector3f(x+TRANSITION_CELL_WIDTH,y+1,z+TRANSITION_CELL_WIDTH), - new Vector3f(x+TRANSITION_CELL_WIDTH,y,z+1), new Vector3f(x+TRANSITION_CELL_WIDTH,y+1,z+1), - //complex face iso values - chunkData.xNegativeEdgeIso[(y+0)*2+0][(z+0)*2+0], chunkData.xNegativeEdgeIso[(y+0)*2+1][(z+0)*2+0], chunkData.xNegativeEdgeIso[(y+1)*2+0][(z+0)*2+0], - chunkData.xNegativeEdgeIso[(y+0)*2+0][(z+0)*2+1], chunkData.xNegativeEdgeIso[(y+0)*2+1][(z+0)*2+1], chunkData.xNegativeEdgeIso[(y+1)*2+0][(z+0)*2+1], - chunkData.xNegativeEdgeIso[(y+0)*2+0][(z+1)*2+0], chunkData.xNegativeEdgeIso[(y+0)*2+1][(z+1)*2+0], chunkData.xNegativeEdgeIso[(y+1)*2+0][(z+1)*2+0], - //simple face iso values - chunkData.xNegativeEdgeIso[(y+0)*2+0][(z+0)*2+0], chunkData.xNegativeEdgeIso[(y+1)*2+0][(z+0)*2+0], - chunkData.xNegativeEdgeIso[(y+0)*2+0][(z+1)*2+0], chunkData.xNegativeEdgeIso[(y+1)*2+0][(z+1)*2+0], - //complex face texture atlas values - chunkData.xNegativeEdgeAtlas[(y+0)*2+0][(z+0)*2+0], chunkData.xNegativeEdgeAtlas[(y+0)*2+1][(z+0)*2+0], chunkData.xNegativeEdgeAtlas[(y+1)*2+0][(z+0)*2+0], - chunkData.xNegativeEdgeAtlas[(y+0)*2+0][(z+0)*2+1], chunkData.xNegativeEdgeAtlas[(y+0)*2+1][(z+0)*2+1], chunkData.xNegativeEdgeAtlas[(y+1)*2+0][(z+0)*2+1], - chunkData.xNegativeEdgeAtlas[(y+0)*2+0][(z+1)*2+0], chunkData.xNegativeEdgeAtlas[(y+0)*2+1][(z+1)*2+0], chunkData.xNegativeEdgeAtlas[(y+1)*2+0][(z+1)*2+0], - //simple face texture atlas values - chunkData.xNegativeEdgeAtlas[(y+0)*2+0][(z+0)*2+0], chunkData.xNegativeEdgeAtlas[(y+1)*2+0][(z+0)*2+0], - chunkData.xNegativeEdgeAtlas[(y+0)*2+0][(z+1)*2+0], chunkData.xNegativeEdgeAtlas[(y+1)*2+0][(z+1)*2+0] - ); - TransvoxelModelGeneration.polygonizeTransition(currentTransitionCell, TerrainChunkModelGeneration.MIN_ISO_VALUE, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, false); + // if(chunkData.xNegativeEdgeIso != null && chunkData.zNegativeEdgeIso != null){ + // int x = 0; + // int z = 0; + // int edgeLength = chunkWidth - (chunkData.yNegativeEdgeIso != null ? 1 : 0) - (chunkData.yPositiveEdgeIso != null ? 1 : 0); + // int startIndex = 0 + (chunkData.yNegativeEdgeIso != null ? 1 : 0); + // for(int i = startIndex; i < edgeLength - 1; i++){ + // int y = i; + // // + // //Generate the x-side transition cell + // // + // currentTransitionCell.setValues( + // //complex face vertex coordinates + // new Vector3f(x,y,z), new Vector3f(x,y+TRANSITION_CELL_WIDTH,z), new Vector3f(x,y+1,z), + // new Vector3f(x,y,z+TRANSITION_CELL_WIDTH), new Vector3f(x,y+TRANSITION_CELL_WIDTH,z+TRANSITION_CELL_WIDTH), new Vector3f(x,y+1,z+TRANSITION_CELL_WIDTH), + // new Vector3f(x,y,z+1), new Vector3f(x,y+TRANSITION_CELL_WIDTH,z+1), new Vector3f(x,y+1,z+1), + // //simple face vertex coordinates + // new Vector3f(x+TRANSITION_CELL_WIDTH,y,z+TRANSITION_CELL_WIDTH), new Vector3f(x+TRANSITION_CELL_WIDTH,y+1,z+TRANSITION_CELL_WIDTH), + // new Vector3f(x+TRANSITION_CELL_WIDTH,y,z+1), new Vector3f(x+TRANSITION_CELL_WIDTH,y+1,z+1), + // //complex face iso values + // chunkData.xNegativeEdgeIso[(y+0)*2+0][(z+0)*2+0], chunkData.xNegativeEdgeIso[(y+0)*2+1][(z+0)*2+0], chunkData.xNegativeEdgeIso[(y+1)*2+0][(z+0)*2+0], + // chunkData.xNegativeEdgeIso[(y+0)*2+0][(z+0)*2+1], chunkData.xNegativeEdgeIso[(y+0)*2+1][(z+0)*2+1], chunkData.xNegativeEdgeIso[(y+1)*2+0][(z+0)*2+1], + // chunkData.xNegativeEdgeIso[(y+0)*2+0][(z+1)*2+0], chunkData.xNegativeEdgeIso[(y+0)*2+1][(z+1)*2+0], chunkData.xNegativeEdgeIso[(y+1)*2+0][(z+1)*2+0], + // //simple face iso values + // chunkData.xNegativeEdgeIso[(y+0)*2+0][(z+0)*2+0], chunkData.xNegativeEdgeIso[(y+1)*2+0][(z+0)*2+0], + // chunkData.xNegativeEdgeIso[(y+0)*2+0][(z+1)*2+0], chunkData.xNegativeEdgeIso[(y+1)*2+0][(z+1)*2+0], + // //complex face texture atlas values + // chunkData.xNegativeEdgeAtlas[(y+0)*2+0][(z+0)*2+0], chunkData.xNegativeEdgeAtlas[(y+0)*2+1][(z+0)*2+0], chunkData.xNegativeEdgeAtlas[(y+1)*2+0][(z+0)*2+0], + // chunkData.xNegativeEdgeAtlas[(y+0)*2+0][(z+0)*2+1], chunkData.xNegativeEdgeAtlas[(y+0)*2+1][(z+0)*2+1], chunkData.xNegativeEdgeAtlas[(y+1)*2+0][(z+0)*2+1], + // chunkData.xNegativeEdgeAtlas[(y+0)*2+0][(z+1)*2+0], chunkData.xNegativeEdgeAtlas[(y+0)*2+1][(z+1)*2+0], chunkData.xNegativeEdgeAtlas[(y+1)*2+0][(z+1)*2+0], + // //simple face texture atlas values + // chunkData.xNegativeEdgeAtlas[(y+0)*2+0][(z+0)*2+0], chunkData.xNegativeEdgeAtlas[(y+1)*2+0][(z+0)*2+0], + // chunkData.xNegativeEdgeAtlas[(y+0)*2+0][(z+1)*2+0], chunkData.xNegativeEdgeAtlas[(y+1)*2+0][(z+1)*2+0] + // ); + // TransvoxelModelGeneration.polygonizeTransition(currentTransitionCell, TerrainChunkModelGeneration.MIN_ISO_VALUE, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, false); - // - //Generate the z-side transition cell - // - currentTransitionCell.setValues( - //complex face vertex coordinates - new Vector3f(x+0, y,z), new Vector3f(x+0, y+TRANSITION_CELL_WIDTH,z), new Vector3f(x+0, y+1,z), - new Vector3f(x+TRANSITION_CELL_WIDTH,y,z), new Vector3f(x+TRANSITION_CELL_WIDTH,y+TRANSITION_CELL_WIDTH,z), new Vector3f(x+TRANSITION_CELL_WIDTH,y+1,z), - new Vector3f(x+1, y,z), new Vector3f(x+1, y+TRANSITION_CELL_WIDTH,z), new Vector3f(x+1, y+1,z), - //simple face vertex coordinates - new Vector3f(x+TRANSITION_CELL_WIDTH,y,z+TRANSITION_CELL_WIDTH), new Vector3f(x+TRANSITION_CELL_WIDTH,y+1,z+TRANSITION_CELL_WIDTH), - new Vector3f(x+1,y,z+TRANSITION_CELL_WIDTH), new Vector3f(x+1,y+1,z+TRANSITION_CELL_WIDTH), - //complex face iso values - chunkData.zNegativeEdgeIso[(x+0)*2+0][(y+0)*2+0], chunkData.zNegativeEdgeIso[(x+0)*2+0][(y+0)*2+1], chunkData.zNegativeEdgeIso[(x+0)*2+0][(y+1)*2+0], - chunkData.zNegativeEdgeIso[(x+0)*2+1][(y+0)*2+0], chunkData.zNegativeEdgeIso[(x+0)*2+1][(y+0)*2+1], chunkData.zNegativeEdgeIso[(x+0)*2+1][(y+1)*2+0], - chunkData.zNegativeEdgeIso[(x+1)*2+0][(y+0)*2+0], chunkData.zNegativeEdgeIso[(x+1)*2+0][(y+0)*2+1], chunkData.zNegativeEdgeIso[(x+1)*2+0][(y+1)*2+0], - //simple face iso values - chunkData.zNegativeEdgeIso[(x+0)*2+0][(y+0)*2+0], chunkData.zNegativeEdgeIso[(x+0)*2+0][(y+1)*2+0], - chunkData.zNegativeEdgeIso[(x+1)*2+0][(y+0)*2+0], chunkData.zNegativeEdgeIso[(x+1)*2+0][(y+1)*2+0], - //complex face texture atlas values - chunkData.zNegativeEdgeAtlas[(x+0)*2+0][(y+0)*2+0], chunkData.zNegativeEdgeAtlas[(x+0)*2+0][(y+0)*2+1], chunkData.zNegativeEdgeAtlas[(x+0)*2+0][(y+1)*2+0], - chunkData.zNegativeEdgeAtlas[(x+0)*2+1][(y+0)*2+0], chunkData.zNegativeEdgeAtlas[(x+0)*2+1][(y+0)*2+1], chunkData.zNegativeEdgeAtlas[(x+0)*2+1][(y+1)*2+0], - chunkData.zNegativeEdgeAtlas[(x+1)*2+0][(y+0)*2+0], chunkData.zNegativeEdgeAtlas[(x+1)*2+0][(y+0)*2+1], chunkData.zNegativeEdgeAtlas[(x+1)*2+0][(y+1)*2+0], - //simple face texture atlas values - chunkData.zNegativeEdgeAtlas[(x+0)*2+0][(y+0)*2+0], chunkData.zNegativeEdgeAtlas[(x+0)*2+0][(y+1)*2+0], - chunkData.zNegativeEdgeAtlas[(x+1)*2+0][(y+0)*2+0], chunkData.zNegativeEdgeAtlas[(x+1)*2+0][(y+1)*2+0] - ); - TransvoxelModelGeneration.polygonizeTransition(currentTransitionCell, TerrainChunkModelGeneration.MIN_ISO_VALUE, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, true); + // // + // //Generate the z-side transition cell + // // + // currentTransitionCell.setValues( + // //complex face vertex coordinates + // new Vector3f(x+0, y,z), new Vector3f(x+0, y+TRANSITION_CELL_WIDTH,z), new Vector3f(x+0, y+1,z), + // new Vector3f(x+TRANSITION_CELL_WIDTH,y,z), new Vector3f(x+TRANSITION_CELL_WIDTH,y+TRANSITION_CELL_WIDTH,z), new Vector3f(x+TRANSITION_CELL_WIDTH,y+1,z), + // new Vector3f(x+1, y,z), new Vector3f(x+1, y+TRANSITION_CELL_WIDTH,z), new Vector3f(x+1, y+1,z), + // //simple face vertex coordinates + // new Vector3f(x+TRANSITION_CELL_WIDTH,y,z+TRANSITION_CELL_WIDTH), new Vector3f(x+TRANSITION_CELL_WIDTH,y+1,z+TRANSITION_CELL_WIDTH), + // new Vector3f(x+1,y,z+TRANSITION_CELL_WIDTH), new Vector3f(x+1,y+1,z+TRANSITION_CELL_WIDTH), + // //complex face iso values + // chunkData.zNegativeEdgeIso[(x+0)*2+0][(y+0)*2+0], chunkData.zNegativeEdgeIso[(x+0)*2+0][(y+0)*2+1], chunkData.zNegativeEdgeIso[(x+0)*2+0][(y+1)*2+0], + // chunkData.zNegativeEdgeIso[(x+0)*2+1][(y+0)*2+0], chunkData.zNegativeEdgeIso[(x+0)*2+1][(y+0)*2+1], chunkData.zNegativeEdgeIso[(x+0)*2+1][(y+1)*2+0], + // chunkData.zNegativeEdgeIso[(x+1)*2+0][(y+0)*2+0], chunkData.zNegativeEdgeIso[(x+1)*2+0][(y+0)*2+1], chunkData.zNegativeEdgeIso[(x+1)*2+0][(y+1)*2+0], + // //simple face iso values + // chunkData.zNegativeEdgeIso[(x+0)*2+0][(y+0)*2+0], chunkData.zNegativeEdgeIso[(x+0)*2+0][(y+1)*2+0], + // chunkData.zNegativeEdgeIso[(x+1)*2+0][(y+0)*2+0], chunkData.zNegativeEdgeIso[(x+1)*2+0][(y+1)*2+0], + // //complex face texture atlas values + // chunkData.zNegativeEdgeAtlas[(x+0)*2+0][(y+0)*2+0], chunkData.zNegativeEdgeAtlas[(x+0)*2+0][(y+0)*2+1], chunkData.zNegativeEdgeAtlas[(x+0)*2+0][(y+1)*2+0], + // chunkData.zNegativeEdgeAtlas[(x+0)*2+1][(y+0)*2+0], chunkData.zNegativeEdgeAtlas[(x+0)*2+1][(y+0)*2+1], chunkData.zNegativeEdgeAtlas[(x+0)*2+1][(y+1)*2+0], + // chunkData.zNegativeEdgeAtlas[(x+1)*2+0][(y+0)*2+0], chunkData.zNegativeEdgeAtlas[(x+1)*2+0][(y+0)*2+1], chunkData.zNegativeEdgeAtlas[(x+1)*2+0][(y+1)*2+0], + // //simple face texture atlas values + // chunkData.zNegativeEdgeAtlas[(x+0)*2+0][(y+0)*2+0], chunkData.zNegativeEdgeAtlas[(x+0)*2+0][(y+1)*2+0], + // chunkData.zNegativeEdgeAtlas[(x+1)*2+0][(y+0)*2+0], chunkData.zNegativeEdgeAtlas[(x+1)*2+0][(y+1)*2+0] + // ); + // TransvoxelModelGeneration.polygonizeTransition(currentTransitionCell, TerrainChunkModelGeneration.MIN_ISO_VALUE, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, true); - // - //Generate the normal cell with half width - // - vecPool[0].set(x+TRANSITION_CELL_WIDTH,y+0,z+TRANSITION_CELL_WIDTH); - vecPool[1].set(x+TRANSITION_CELL_WIDTH,y+0,z+1); - vecPool[2].set(x+1,y+0,z+1); - vecPool[3].set(x+1,y+0,z+TRANSITION_CELL_WIDTH); - vecPool[4].set(x+TRANSITION_CELL_WIDTH,y+1,z+TRANSITION_CELL_WIDTH); - vecPool[5].set(x+TRANSITION_CELL_WIDTH,y+1,z+1); - vecPool[6].set(x+1,y+1,z+1); - vecPool[7].set(x+1,y+1,z+TRANSITION_CELL_WIDTH); - currentCell.setValues( - // new Vector3f(x+TRANSITION_CELL_WIDTH,y+0,z+TRANSITION_CELL_WIDTH), new Vector3f(x+TRANSITION_CELL_WIDTH,y+0,z+1), new Vector3f(x+1,y+0,z+1), new Vector3f(x+1,y+0,z+TRANSITION_CELL_WIDTH), - // new Vector3f(x+TRANSITION_CELL_WIDTH,y+1,z+TRANSITION_CELL_WIDTH), new Vector3f(x+TRANSITION_CELL_WIDTH,y+1,z+1), new Vector3f(x+1,y+1,z+1), new Vector3f(x+1,y+1,z+TRANSITION_CELL_WIDTH), - chunkData.xNegativeEdgeIso[(y+0)*2+0][(z+0)*2+0], chunkData.xNegativeEdgeIso[(y+0)*2+0][(z+1)*2+0], chunkData.terrainGrid[x+1][y+0][z+1], chunkData.terrainGrid[x+1][y+0][z+0], - chunkData.xNegativeEdgeIso[(y+1)*2+0][(z+0)*2+0], chunkData.xNegativeEdgeIso[(y+1)*2+0][(z+1)*2+0], chunkData.terrainGrid[x+1][y+1][z+1], chunkData.terrainGrid[x+1][y+1][z+0], - chunkData.xNegativeEdgeAtlas[(y+0)*2+0][(z+0)*2+0], chunkData.xNegativeEdgeAtlas[(y+0)*2+0][(z+1)*2+0], chunkData.textureGrid[x+1][y+0][z+1], chunkData.textureGrid[x+1][y+0][z+0], - chunkData.xNegativeEdgeAtlas[(y+1)*2+0][(z+0)*2+0], chunkData.xNegativeEdgeAtlas[(y+1)*2+0][(z+1)*2+0], chunkData.textureGrid[x+1][y+1][z+1], chunkData.textureGrid[x+1][y+1][z+0] - ); - //polygonize the current gridcell - TransvoxelModelGeneration.polygonize(currentCell, TerrainChunkModelGeneration.MIN_ISO_VALUE, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, true); - } - } + // // + // //Generate the normal cell with half width + // // + // vecPool[0].set(x+TRANSITION_CELL_WIDTH,y+0,z+TRANSITION_CELL_WIDTH); + // vecPool[1].set(x+TRANSITION_CELL_WIDTH,y+0,z+1); + // vecPool[2].set(x+1,y+0,z+1); + // vecPool[3].set(x+1,y+0,z+TRANSITION_CELL_WIDTH); + // vecPool[4].set(x+TRANSITION_CELL_WIDTH,y+1,z+TRANSITION_CELL_WIDTH); + // vecPool[5].set(x+TRANSITION_CELL_WIDTH,y+1,z+1); + // vecPool[6].set(x+1,y+1,z+1); + // vecPool[7].set(x+1,y+1,z+TRANSITION_CELL_WIDTH); + // currentCell.setValues( + // // new Vector3f(x+TRANSITION_CELL_WIDTH,y+0,z+TRANSITION_CELL_WIDTH), new Vector3f(x+TRANSITION_CELL_WIDTH,y+0,z+1), new Vector3f(x+1,y+0,z+1), new Vector3f(x+1,y+0,z+TRANSITION_CELL_WIDTH), + // // new Vector3f(x+TRANSITION_CELL_WIDTH,y+1,z+TRANSITION_CELL_WIDTH), new Vector3f(x+TRANSITION_CELL_WIDTH,y+1,z+1), new Vector3f(x+1,y+1,z+1), new Vector3f(x+1,y+1,z+TRANSITION_CELL_WIDTH), + // chunkData.xNegativeEdgeIso[(y+0)*2+0][(z+0)*2+0], chunkData.xNegativeEdgeIso[(y+0)*2+0][(z+1)*2+0], chunkData.terrainGrid[x+1][y+0][z+1], chunkData.terrainGrid[x+1][y+0][z+0], + // chunkData.xNegativeEdgeIso[(y+1)*2+0][(z+0)*2+0], chunkData.xNegativeEdgeIso[(y+1)*2+0][(z+1)*2+0], chunkData.terrainGrid[x+1][y+1][z+1], chunkData.terrainGrid[x+1][y+1][z+0], + // chunkData.xNegativeEdgeAtlas[(y+0)*2+0][(z+0)*2+0], chunkData.xNegativeEdgeAtlas[(y+0)*2+0][(z+1)*2+0], chunkData.textureGrid[x+1][y+0][z+1], chunkData.textureGrid[x+1][y+0][z+0], + // chunkData.xNegativeEdgeAtlas[(y+1)*2+0][(z+0)*2+0], chunkData.xNegativeEdgeAtlas[(y+1)*2+0][(z+1)*2+0], chunkData.textureGrid[x+1][y+1][z+1], chunkData.textureGrid[x+1][y+1][z+0] + // ); + // //polygonize the current gridcell + // TransvoxelModelGeneration.polygonize(currentCell, TerrainChunkModelGeneration.MIN_ISO_VALUE, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, true); + // } + // } if (verts.size() != normals.size()){ diff --git a/src/main/java/electrosphere/renderer/ui/elements/ImagePanel.java b/src/main/java/electrosphere/renderer/ui/elements/ImagePanel.java index db27febd..ca620dec 100644 --- a/src/main/java/electrosphere/renderer/ui/elements/ImagePanel.java +++ b/src/main/java/electrosphere/renderer/ui/elements/ImagePanel.java @@ -76,7 +76,7 @@ public class ImagePanel extends StandardElement implements DrawableElement, Drag if(texture != null){ customMat.setTexturePointer(texture.getTexturePointer()); hasLoadedTexture = true; - } else { + } else if(Globals.assetManager.fetchTexture(Globals.blackTexture) != null) { customMat.setTexturePointer(Globals.assetManager.fetchTexture(Globals.blackTexture).getTexturePointer()); } } diff --git a/src/main/java/electrosphere/renderer/ui/elements/StandardElement.java b/src/main/java/electrosphere/renderer/ui/elements/StandardElement.java index 64f51360..6b4a4018 100644 --- a/src/main/java/electrosphere/renderer/ui/elements/StandardElement.java +++ b/src/main/java/electrosphere/renderer/ui/elements/StandardElement.java @@ -81,11 +81,21 @@ public class StandardElement implements Element { Yoga.YGNodeStyleSetWidth(this.yogaNode, width); } + @Override + public void setWidthPercent(float width) { + Yoga.YGNodeStyleSetWidthPercent(yogaNode, width); + } + @Override public void setHeight(int height) { Yoga.YGNodeStyleSetHeight(this.yogaNode, height); } + @Override + public void setHeightPercent(float height) { + Yoga.YGNodeStyleSetHeightPercent(yogaNode, height); + } + @Override public void setPositionX(int posX) { Yoga.YGNodeStyleSetPosition(this.yogaNode, Yoga.YGEdgeLeft, posX); diff --git a/src/main/java/electrosphere/renderer/ui/elements/Window.java b/src/main/java/electrosphere/renderer/ui/elements/Window.java index 92373626..03cc66f4 100644 --- a/src/main/java/electrosphere/renderer/ui/elements/Window.java +++ b/src/main/java/electrosphere/renderer/ui/elements/Window.java @@ -292,6 +292,11 @@ public class Window implements DrawableElement, ContainerElement, NavigableEleme this.width = width; Yoga.YGNodeStyleSetWidth(this.yogaNode, width); } + + @Override + public void setWidthPercent(float width) { + Yoga.YGNodeStyleSetWidthPercent(yogaNode, width); + } @Override public void setHeight(int height){ @@ -299,6 +304,11 @@ public class Window implements DrawableElement, ContainerElement, NavigableEleme Yoga.YGNodeStyleSetHeight(this.yogaNode, height); } + @Override + public void setHeightPercent(float height) { + Yoga.YGNodeStyleSetHeightPercent(yogaNode, height); + } + @Override public void setMaxWidth(int width) { Yoga.YGNodeStyleSetMaxWidth(yogaNode, width); diff --git a/src/main/java/electrosphere/renderer/ui/elementtypes/Element.java b/src/main/java/electrosphere/renderer/ui/elementtypes/Element.java index 0af9f69a..7791b341 100644 --- a/src/main/java/electrosphere/renderer/ui/elementtypes/Element.java +++ b/src/main/java/electrosphere/renderer/ui/elementtypes/Element.java @@ -14,7 +14,9 @@ public interface Element { public int getWidth(); public int getHeight(); public void setWidth(int width); + public void setWidthPercent(float width); public void setHeight(int height); + public void setHeightPercent(float height); public void setMaxWidth(int width); public void setMaxWidthPercent(float percent); public void setMaxHeight(int height);