continue reducing global state

This commit is contained in:
austin 2025-05-15 14:42:09 -04:00
parent 73faf78d21
commit e62671d239
22 changed files with 62 additions and 44 deletions

View File

@ -1821,6 +1821,7 @@ Move threadManager into engineState
Move serviceManager into engineState Move serviceManager into engineState
Move timeKeeper into engineState Move timeKeeper into engineState
Move signalSystem into engineState Move signalSystem into engineState
Move some global state into rendering engine

View File

@ -136,7 +136,7 @@ public class ItemIconPanel {
rVal.addChild(panel); rVal.addChild(panel);
if(ClientChargeState.hasClientChargeState(currentItem)){ if(ClientChargeState.hasClientChargeState(currentItem)){
ImagePanel labelBackground = ImagePanel.createImagePanel(Globals.blackTexture); ImagePanel labelBackground = ImagePanel.createImagePanel(AssetDataStrings.TEXTURE_BLACK);
labelBackground.setPositionType(YogaPositionType.Absolute); labelBackground.setPositionType(YogaPositionType.Absolute);
labelBackground.setWidth(20); labelBackground.setWidth(20);
labelBackground.setHeight(20); labelBackground.setHeight(20);

View File

@ -9,6 +9,7 @@ import electrosphere.data.creature.CreatureData;
import electrosphere.data.creature.visualattribute.VisualAttribute; import electrosphere.data.creature.visualattribute.VisualAttribute;
import electrosphere.engine.Globals; import electrosphere.engine.Globals;
import electrosphere.engine.Main; import electrosphere.engine.Main;
import electrosphere.engine.assetmanager.AssetDataStrings;
import electrosphere.engine.signal.Signal.SignalType; import electrosphere.engine.signal.Signal.SignalType;
import electrosphere.entity.Entity; import electrosphere.entity.Entity;
import electrosphere.entity.EntityDataStrings; import electrosphere.entity.EntityDataStrings;
@ -336,7 +337,7 @@ public class MenuGeneratorsInGame {
}}); }});
//black texture background //black texture background
ImagePanel imagePanel = ImagePanel.createImagePanelAbsolute(0,0,width,height + 1000,Globals.blackTexture); ImagePanel imagePanel = ImagePanel.createImagePanelAbsolute(0,0,width,height + 1000,AssetDataStrings.TEXTURE_BLACK);
scrollable.addChild(imagePanel); scrollable.addChild(imagePanel);
//label 1 (back) //label 1 (back)

View File

@ -37,7 +37,6 @@ import electrosphere.renderer.RenderingEngine;
import electrosphere.renderer.actor.instance.InstanceManager; import electrosphere.renderer.actor.instance.InstanceManager;
import electrosphere.renderer.loading.ModelPretransforms; import electrosphere.renderer.loading.ModelPretransforms;
import electrosphere.renderer.meshgen.FluidChunkModelGeneration; import electrosphere.renderer.meshgen.FluidChunkModelGeneration;
import electrosphere.renderer.model.Material;
import electrosphere.renderer.shader.ShaderOptionMap; import electrosphere.renderer.shader.ShaderOptionMap;
import electrosphere.renderer.shader.VisualShader; import electrosphere.renderer.shader.VisualShader;
import electrosphere.renderer.texture.TextureMap; import electrosphere.renderer.texture.TextureMap;
@ -212,24 +211,16 @@ public class Globals {
//
//Renderer-adjacent data I need to move into config at some point
//
public static TextureMap textureMapDefault;
public static ModelPretransforms modelPretransforms;
// //
//OpenGL - Abstracted engine objects //OpenGL - Abstracted engine objects
// //
public static String textureDiffuseDefault;
public static String textureSpecularDefault;
public static Material materialDefault;
public static final String blackTexture = "Textures/b1.png";
public static final String whiteTexture = "Textures/w1.png";
public static final String offWhiteTexture = "Textures/ow1.png";
public static String imagePlaneModelID;
public static String solidPlaneModelID;
public static TextureMap textureMapDefault;
public static ModelPretransforms modelPretransforms;
public static VisualShader defaultMeshShader; public static VisualShader defaultMeshShader;
public static VisualShader terrainShaderProgram; public static VisualShader terrainShaderProgram;
@ -479,11 +470,6 @@ public class Globals {
Globals.assetManager.addTexturePathtoQueue(defaultTexturePath); Globals.assetManager.addTexturePathtoQueue(defaultTexturePath);
} }
//create default material
materialDefault = new Material();
materialDefault.setDiffuse(AssetDataStrings.TEXTURE_DEFAULT);
materialDefault.setSpecular(AssetDataStrings.TEXTURE_DEFAULT);
//create font manager //create font manager
fontManager = new FontManager(); fontManager = new FontManager();
fontManager.loadFonts(); fontManager.loadFonts();
@ -508,9 +494,8 @@ public class Globals {
assetManager.addModelPathToQueue("Models/basic/geometry/unitcapsule.glb"); assetManager.addModelPathToQueue("Models/basic/geometry/unitcapsule.glb");
assetManager.addModelPathToQueue("Models/basic/geometry/unitplane.fbx"); assetManager.addModelPathToQueue("Models/basic/geometry/unitplane.fbx");
assetManager.addModelPathToQueue("Models/basic/geometry/unitcube.fbx"); assetManager.addModelPathToQueue("Models/basic/geometry/unitcube.fbx");
imagePlaneModelID = assetManager.registerModel(RenderUtils.createPlaneModel("Shaders/core/plane/plane.vs", "Shaders/core/plane/plane.fs")); assetManager.registerModelWithPath(RenderUtils.createPlaneModel("Shaders/core/plane/plane.vs", "Shaders/core/plane/plane.fs"), AssetDataStrings.MODEL_IMAGE_PLANE);
assetManager.addShaderToQueue("Shaders/core/plane/plane.vs", "Shaders/core/plane/plane.fs"); assetManager.addShaderToQueue("Shaders/core/plane/plane.vs", "Shaders/core/plane/plane.fs");
solidPlaneModelID = assetManager.registerModel(RenderUtils.createInWindowPanel("Shaders/ui/plainBox/plainBox.vs", "Shaders/ui/plainBox/plainBox.fs"));
//init pose models for basic shapes //init pose models for basic shapes
PoseModel emptyPoseModel = PoseModel.createEmpty(); PoseModel emptyPoseModel = PoseModel.createEmpty();

View File

@ -27,12 +27,16 @@ public class AssetDataStrings {
public static final String TEXTURE_PARTICLE = "particleTexture"; public static final String TEXTURE_PARTICLE = "particleTexture";
public static final String POSE_EMPTY = "poseEmpty"; public static final String POSE_EMPTY = "poseEmpty";
public static final String MODEL_BLOCK_SINGLE = "modelBlockSingle"; public static final String MODEL_BLOCK_SINGLE = "modelBlockSingle";
public static final String MODEL_IMAGE_PLANE = "modelImagePlane";
/** /**
* Fundamental textures of the engine * Fundamental textures of the engine
*/ */
public static final String TEXTURE_TEAL_TRANSPARENT = "Textures/color/transparent_teal.png"; 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_RED_TRANSPARENT = "Textures/transparent_red.png";
public static final String TEXTURE_BLACK = "Textures/b1.png";
public static final String TEXTURE_WHITE = "Textures/w1.png";
public static final String TEXTURE_OFF_WHITE = "Textures/ow1.png";
public static final String TEXTURE_DEFAULT = "Textures/color/Testing1.png"; public static final String TEXTURE_DEFAULT = "Textures/color/Testing1.png";
/** /**

View File

@ -55,9 +55,9 @@ public class StateTransitionUtil {
//error checking //error checking
if(!isServer && Globals.clientState.clientSceneWrapper.getScene().getEntityFromId(entity.getId()) == null){ if(!isServer && Globals.clientState.clientSceneWrapper.getScene().getEntityFromId(entity.getId()) == null){
throw new IllegalArgumentException("Tried to create state transition util with isServer=false and passed in a server entity"); throw new Error("Tried to create state transition util with isServer=false and passed in a server entity");
} else if(isServer && Globals.clientState.clientSceneWrapper.getScene().getEntityFromId(entity.getId()) != null){ } else if(isServer && Globals.clientState.clientSceneWrapper.getScene().getEntityFromId(entity.getId()) != null){
throw new IllegalArgumentException("Tried to create state transition util with isServer=true and passed in a client entity"); throw new Error("Tried to create state transition util with isServer=true and passed in a client entity");
} }

View File

@ -27,6 +27,7 @@ import org.lwjgl.system.MemoryStack;
import org.lwjgl.system.MemoryUtil; import org.lwjgl.system.MemoryUtil;
import electrosphere.engine.Globals; import electrosphere.engine.Globals;
import electrosphere.engine.assetmanager.AssetDataStrings;
import electrosphere.engine.os.OSDragAndDrop; import electrosphere.engine.os.OSDragAndDrop;
import electrosphere.engine.signal.Signal.SignalType; import electrosphere.engine.signal.Signal.SignalType;
import electrosphere.logger.LoggerInterface; import electrosphere.logger.LoggerInterface;
@ -35,6 +36,7 @@ import electrosphere.renderer.framebuffer.Framebuffer;
import electrosphere.renderer.framebuffer.FramebufferUtils; import electrosphere.renderer.framebuffer.FramebufferUtils;
import electrosphere.renderer.framebuffer.Renderbuffer; import electrosphere.renderer.framebuffer.Renderbuffer;
import electrosphere.renderer.light.LightManager; import electrosphere.renderer.light.LightManager;
import electrosphere.renderer.model.Material;
import electrosphere.renderer.pipelines.CompositePipeline; import electrosphere.renderer.pipelines.CompositePipeline;
import electrosphere.renderer.pipelines.FirstPersonItemsPipeline; import electrosphere.renderer.pipelines.FirstPersonItemsPipeline;
import electrosphere.renderer.pipelines.FoliagePipeline; import electrosphere.renderer.pipelines.FoliagePipeline;
@ -144,6 +146,11 @@ public class RenderingEngine {
static float aspectRatio = 1.0f; static float aspectRatio = 1.0f;
static float verticalFOV = 90.0f; static float verticalFOV = 90.0f;
/**
* The default material
*/
private Material materialDefault = new Material(AssetDataStrings.TEXTURE_DEFAULT);
/** /**
* the current state of the rendering pipeline * the current state of the rendering pipeline
*/ */
@ -685,6 +692,14 @@ public class RenderingEngine {
return openGLContext; return openGLContext;
} }
/**
* Gets the default material
* @return The default material
*/
public Material getDefaultMaterial(){
return this.materialDefault;
}
/** /**
* Tries to recapture the screen * Tries to recapture the screen
*/ */

View File

@ -11,6 +11,7 @@ import org.joml.Vector3f;
import org.joml.Vector4f; import org.joml.Vector4f;
import electrosphere.engine.Globals; import electrosphere.engine.Globals;
import electrosphere.engine.assetmanager.AssetDataStrings;
import electrosphere.logger.LoggerInterface; import electrosphere.logger.LoggerInterface;
import electrosphere.renderer.framebuffer.Framebuffer; import electrosphere.renderer.framebuffer.Framebuffer;
import electrosphere.renderer.model.Model; import electrosphere.renderer.model.Model;
@ -63,7 +64,7 @@ public class DebugRendering {
public static void drawUIBounds(Framebuffer parentFramebuffer, Vector3f boxPosition, Vector3f boxDimensions, Vector4f color){ public static void drawUIBounds(Framebuffer parentFramebuffer, Vector3f boxPosition, Vector3f boxDimensions, Vector4f color){
if(Globals.RENDER_FLAG_RENDER_UI_BOUNDS){ if(Globals.RENDER_FLAG_RENDER_UI_BOUNDS){
if(planeModel == null){ if(planeModel == null){
planeModel = Globals.assetManager.fetchModel(Globals.imagePlaneModelID); planeModel = Globals.assetManager.fetchModel(AssetDataStrings.MODEL_IMAGE_PLANE);
} }
if(elementDrawDebugProgram == null){ if(elementDrawDebugProgram == null){
elementDrawDebugProgram = Globals.assetManager.fetchShader("Shaders/ui/debug/windowContentBorder/windowContentBound.vs", "Shaders/ui/debug/windowContentBorder/windowContentBound.fs"); elementDrawDebugProgram = Globals.assetManager.fetchShader("Shaders/ui/debug/windowContentBorder/windowContentBound.vs", "Shaders/ui/debug/windowContentBorder/windowContentBound.fs");
@ -87,7 +88,7 @@ public class DebugRendering {
public static void drawUIBoundsWindow(Framebuffer parentFramebuffer, Vector3f boxPosition, Vector3f boxDimensions, Vector4f color){ public static void drawUIBoundsWindow(Framebuffer parentFramebuffer, Vector3f boxPosition, Vector3f boxDimensions, Vector4f color){
if(Globals.RENDER_FLAG_RENDER_UI_BOUNDS){ if(Globals.RENDER_FLAG_RENDER_UI_BOUNDS){
if(planeModel == null){ if(planeModel == null){
planeModel = Globals.assetManager.fetchModel(Globals.imagePlaneModelID); planeModel = Globals.assetManager.fetchModel(AssetDataStrings.MODEL_IMAGE_PLANE);
} }
if(windowDrawDebugProgram == null){ if(windowDrawDebugProgram == null){
windowDrawDebugProgram = Globals.assetManager.fetchShader("Shaders/ui/debug/windowBorder/windowBound.vs", "Shaders/ui/debug/windowBorder/windowBound.fs"); windowDrawDebugProgram = Globals.assetManager.fetchShader("Shaders/ui/debug/windowBorder/windowBound.vs", "Shaders/ui/debug/windowBorder/windowBound.fs");

View File

@ -1,6 +1,7 @@
package electrosphere.renderer.loading; package electrosphere.renderer.loading;
import electrosphere.engine.Globals; import electrosphere.engine.Globals;
import electrosphere.engine.assetmanager.AssetDataStrings;
import electrosphere.logger.LoggerInterface; import electrosphere.logger.LoggerInterface;
import electrosphere.renderer.model.Material; import electrosphere.renderer.model.Material;
import electrosphere.renderer.model.Mesh; import electrosphere.renderer.model.Mesh;
@ -121,7 +122,7 @@ public class ModelLoader {
finalMat.setDiffuse(diffusePath); finalMat.setDiffuse(diffusePath);
LoggerInterface.loggerRenderer.DEBUG(diffusePath); LoggerInterface.loggerRenderer.DEBUG(diffusePath);
} else { } else {
finalMat.setDiffuse(Globals.textureDiffuseDefault); finalMat.setDiffuse(AssetDataStrings.TEXTURE_DEFAULT);
} }
//set specular //set specular
@ -131,7 +132,7 @@ public class ModelLoader {
finalMat.setSpecular(specularPath); finalMat.setSpecular(specularPath);
LoggerInterface.loggerRenderer.DEBUG(specularPath); LoggerInterface.loggerRenderer.DEBUG(specularPath);
} else { } else {
finalMat.setSpecular(Globals.textureSpecularDefault); finalMat.setSpecular(AssetDataStrings.TEXTURE_DEFAULT);
} }
//once we've either added default textures or actual textures, //once we've either added default textures or actual textures,
//set the current mesh's material to this new one //set the current mesh's material to this new one

View File

@ -392,7 +392,7 @@ public class Mesh {
if(renderPipelineState.getUseMaterial() && textureMask == null){ if(renderPipelineState.getUseMaterial() && textureMask == null){
Globals.renderingEngine.checkError(); Globals.renderingEngine.checkError();
if(material == null){ if(material == null){
Globals.materialDefault.apply_material(openGLState); Globals.renderingEngine.getDefaultMaterial().apply_material(openGLState);
openGLState.getActiveShader().setUniform(openGLState, "hasTransparency", 0); openGLState.getActiveShader().setUniform(openGLState, "hasTransparency", 0);
} else { } else {
material.apply_material(openGLState); material.apply_material(openGLState);

View File

@ -4,6 +4,7 @@ import org.lwjgl.opengl.GL40;
import electrosphere.client.ui.menu.WindowStrings; import electrosphere.client.ui.menu.WindowStrings;
import electrosphere.engine.Globals; import electrosphere.engine.Globals;
import electrosphere.engine.assetmanager.AssetDataStrings;
import electrosphere.renderer.OpenGLState; import electrosphere.renderer.OpenGLState;
import electrosphere.renderer.RenderPipelineState; import electrosphere.renderer.RenderPipelineState;
import electrosphere.renderer.RenderingEngine; import electrosphere.renderer.RenderingEngine;
@ -30,7 +31,7 @@ public class UIPipeline implements RenderPipeline {
openGLState.setActiveShader(renderPipelineState, RenderingEngine.screenTextureShaders); openGLState.setActiveShader(renderPipelineState, RenderingEngine.screenTextureShaders);
openGLState.glDepthTest(false); openGLState.glDepthTest(false);
GL40.glBindVertexArray(RenderingEngine.screenTextureVAO); GL40.glBindVertexArray(RenderingEngine.screenTextureVAO);
Texture blackTexture = Globals.assetManager.fetchTexture(Globals.blackTexture); Texture blackTexture = Globals.assetManager.fetchTexture(AssetDataStrings.TEXTURE_BLACK);
if(blackTexture != null){ if(blackTexture != null){
blackTexture.bind(openGLState); blackTexture.bind(openGLState);
} }
@ -46,7 +47,7 @@ public class UIPipeline implements RenderPipeline {
openGLState.setActiveShader(renderPipelineState, RenderingEngine.screenTextureShaders); openGLState.setActiveShader(renderPipelineState, RenderingEngine.screenTextureShaders);
openGLState.glDepthTest(false); openGLState.glDepthTest(false);
GL40.glBindVertexArray(RenderingEngine.screenTextureVAO); GL40.glBindVertexArray(RenderingEngine.screenTextureVAO);
Texture blackTexture = Globals.assetManager.fetchTexture(Globals.offWhiteTexture); Texture blackTexture = Globals.assetManager.fetchTexture(AssetDataStrings.TEXTURE_OFF_WHITE);
if(blackTexture != null){ if(blackTexture != null){
blackTexture.bind(openGLState); blackTexture.bind(openGLState);
} }

View File

@ -69,7 +69,7 @@ public class DebugBonesPipeline implements RenderPipeline {
// //
Actor targetActor = EntityUtils.getActor(targetEntity); Actor targetActor = EntityUtils.getActor(targetEntity);
Model boneModel = Globals.assetManager.fetchModel(AssetDataStrings.UNITCYLINDER); Model boneModel = Globals.assetManager.fetchModel(AssetDataStrings.UNITCYLINDER);
boneModel.getMaterials().get(0).setDiffuse(Globals.textureDiffuseDefault); boneModel.getMaterials().get(0).setDiffuse(AssetDataStrings.TEXTURE_DEFAULT);
for(Bone bone : targetActor.getBoneValues()){ for(Bone bone : targetActor.getBoneValues()){
Vector3d bonePos = MathBones.getBoneWorldPosition(targetEntity, bone.boneID); Vector3d bonePos = MathBones.getBoneWorldPosition(targetEntity, bone.boneID);
Quaterniond boneRot = MathBones.getBoneWorldRotation(targetEntity, bone.boneID); Quaterniond boneRot = MathBones.getBoneWorldRotation(targetEntity, bone.boneID);

View File

@ -3,6 +3,7 @@ package electrosphere.renderer.ui;
import org.joml.Vector3f; import org.joml.Vector3f;
import electrosphere.engine.Globals; import electrosphere.engine.Globals;
import electrosphere.engine.assetmanager.AssetDataStrings;
import electrosphere.logger.LoggerInterface; import electrosphere.logger.LoggerInterface;
import electrosphere.renderer.OpenGLState; import electrosphere.renderer.OpenGLState;
import electrosphere.renderer.RenderPipelineState; import electrosphere.renderer.RenderPipelineState;
@ -35,7 +36,7 @@ public class UIUtils {
Vector3f texPosition = new Vector3f(1,1,0); Vector3f texPosition = new Vector3f(1,1,0);
Vector3f texScale = new Vector3f(ndcWidth,ndcHeight,0); Vector3f texScale = new Vector3f(ndcWidth,ndcHeight,0);
Model planeModel = Globals.assetManager.fetchModel(Globals.imagePlaneModelID); Model planeModel = Globals.assetManager.fetchModel(AssetDataStrings.MODEL_IMAGE_PLANE);
openGLState.setActiveShader(renderPipelineState, RenderingEngine.screenTextureShaders); openGLState.setActiveShader(renderPipelineState, RenderingEngine.screenTextureShaders);
openGLState.glViewport(Globals.WINDOW_WIDTH, Globals.WINDOW_HEIGHT); openGLState.glViewport(Globals.WINDOW_WIDTH, Globals.WINDOW_HEIGHT);

View File

@ -10,6 +10,7 @@ import org.lwjgl.opengl.GL40;
import electrosphere.client.entity.camera.CameraEntityUtils; import electrosphere.client.entity.camera.CameraEntityUtils;
import electrosphere.engine.Globals; import electrosphere.engine.Globals;
import electrosphere.engine.assetmanager.AssetDataStrings;
import electrosphere.logger.LoggerInterface; import electrosphere.logger.LoggerInterface;
import electrosphere.renderer.OpenGLState; import electrosphere.renderer.OpenGLState;
import electrosphere.renderer.RenderPipelineState; import electrosphere.renderer.RenderPipelineState;
@ -308,7 +309,7 @@ public class ActorPanel extends BufferedStandardDrawableContainerElement impleme
Model planeModel = Globals.assetManager.fetchModel(Globals.imagePlaneModelID); Model planeModel = Globals.assetManager.fetchModel(AssetDataStrings.MODEL_IMAGE_PLANE);
if(planeModel != null){ if(planeModel != null){
planeModel.pushUniformToMesh("plane", "mPosition", boxPosition); planeModel.pushUniformToMesh("plane", "mPosition", boxPosition);
planeModel.pushUniformToMesh("plane", "mDimension", boxDimensions); planeModel.pushUniformToMesh("plane", "mDimension", boxDimensions);

View File

@ -8,6 +8,7 @@ import static org.lwjgl.opengl.GL11.glClearColor;
import org.joml.Vector3f; import org.joml.Vector3f;
import electrosphere.engine.Globals; import electrosphere.engine.Globals;
import electrosphere.engine.assetmanager.AssetDataStrings;
import electrosphere.logger.LoggerInterface; import electrosphere.logger.LoggerInterface;
import electrosphere.renderer.OpenGLState; import electrosphere.renderer.OpenGLState;
import electrosphere.renderer.RenderPipelineState; import electrosphere.renderer.RenderPipelineState;
@ -73,7 +74,7 @@ public class BufferedStandardDrawableContainerElement extends StandardDrawableC
Vector3f texScale = new Vector3f(1,1,0); Vector3f texScale = new Vector3f(1,1,0);
//grab assets required to render window //grab assets required to render window
Model planeModel = Globals.assetManager.fetchModel(Globals.imagePlaneModelID); Model planeModel = Globals.assetManager.fetchModel(AssetDataStrings.MODEL_IMAGE_PLANE);
Texture windowFrame = Globals.assetManager.fetchTexture("Textures/ui/uiFrame1.png"); Texture windowFrame = Globals.assetManager.fetchTexture("Textures/ui/uiFrame1.png");

View File

@ -4,6 +4,7 @@ import org.joml.Vector3f;
import org.joml.Vector4f; import org.joml.Vector4f;
import electrosphere.engine.Globals; import electrosphere.engine.Globals;
import electrosphere.engine.assetmanager.AssetDataStrings;
import electrosphere.logger.LoggerInterface; import electrosphere.logger.LoggerInterface;
import electrosphere.renderer.OpenGLState; import electrosphere.renderer.OpenGLState;
import electrosphere.renderer.RenderPipelineState; import electrosphere.renderer.RenderPipelineState;
@ -77,8 +78,8 @@ public class ImagePanel extends StandardElement implements DrawableElement, Drag
if(texture != null){ if(texture != null){
customMat.setTexturePointer(texture.getTexturePointer()); customMat.setTexturePointer(texture.getTexturePointer());
hasLoadedTexture = true; hasLoadedTexture = true;
} else if(Globals.assetManager.fetchTexture(Globals.blackTexture) != null) { } else if(Globals.assetManager.fetchTexture(AssetDataStrings.TEXTURE_BLACK) != null) {
customMat.setTexturePointer(Globals.assetManager.fetchTexture(Globals.blackTexture).getTexturePointer()); customMat.setTexturePointer(Globals.assetManager.fetchTexture(AssetDataStrings.TEXTURE_BLACK).getTexturePointer());
} }
} }

View File

@ -4,6 +4,7 @@ import org.joml.Vector3f;
import org.joml.Vector4f; import org.joml.Vector4f;
import electrosphere.engine.Globals; import electrosphere.engine.Globals;
import electrosphere.engine.assetmanager.AssetDataStrings;
import electrosphere.logger.LoggerInterface; import electrosphere.logger.LoggerInterface;
import electrosphere.renderer.OpenGLState; import electrosphere.renderer.OpenGLState;
import electrosphere.renderer.RenderPipelineState; import electrosphere.renderer.RenderPipelineState;
@ -153,7 +154,7 @@ public class ScrollableContainer extends BufferedStandardDrawableContainerElemen
boxDimensions = new Vector3f(ndcWidth,ndcHeight,0); boxDimensions = new Vector3f(ndcWidth,ndcHeight,0);
//grab assets required to render window //grab assets required to render window
Model planeModel = Globals.assetManager.fetchModel(Globals.imagePlaneModelID); Model planeModel = Globals.assetManager.fetchModel(AssetDataStrings.MODEL_IMAGE_PLANE);
elementBuffer.bind(openGLState); elementBuffer.bind(openGLState);

View File

@ -6,6 +6,7 @@ import org.joml.Vector3f;
import org.joml.Vector4f; import org.joml.Vector4f;
import electrosphere.engine.Globals; import electrosphere.engine.Globals;
import electrosphere.engine.assetmanager.AssetDataStrings;
import electrosphere.logger.LoggerInterface; import electrosphere.logger.LoggerInterface;
import electrosphere.renderer.OpenGLState; import electrosphere.renderer.OpenGLState;
import electrosphere.renderer.RenderPipelineState; import electrosphere.renderer.RenderPipelineState;
@ -146,7 +147,7 @@ public class Slider extends StandardDrawableElement implements ClickableElement,
Vector3f boxPosition = new Vector3f(ndcX,ndcY,0); Vector3f boxPosition = new Vector3f(ndcX,ndcY,0);
Vector3f boxDimensions = new Vector3f(ndcWidth,ndcHeight,0); Vector3f boxDimensions = new Vector3f(ndcWidth,ndcHeight,0);
Model planeModel = Globals.assetManager.fetchModel(Globals.imagePlaneModelID); Model planeModel = Globals.assetManager.fetchModel(AssetDataStrings.MODEL_IMAGE_PLANE);
if(planeModel != null){ if(planeModel != null){
//bounding box/margin //bounding box/margin
planeModel.pushUniformToMesh("plane", "mPosition", boxPosition); planeModel.pushUniformToMesh("plane", "mPosition", boxPosition);

View File

@ -4,6 +4,7 @@ import org.joml.Vector3f;
import org.joml.Vector4f; import org.joml.Vector4f;
import electrosphere.engine.Globals; import electrosphere.engine.Globals;
import electrosphere.engine.assetmanager.AssetDataStrings;
import electrosphere.logger.LoggerInterface; import electrosphere.logger.LoggerInterface;
import electrosphere.renderer.OpenGLState; import electrosphere.renderer.OpenGLState;
import electrosphere.renderer.RenderPipelineState; import electrosphere.renderer.RenderPipelineState;
@ -147,7 +148,7 @@ public class ToggleInput extends StandardDrawableElement implements ClickableEle
//ratio to adjust the circlewidth by to always show a circle and not a deformed oval //ratio to adjust the circlewidth by to always show a circle and not a deformed oval
float circleRatio = getWidth() / (float)getHeight(); float circleRatio = getWidth() / (float)getHeight();
Model planeModel = Globals.assetManager.fetchModel(Globals.imagePlaneModelID); Model planeModel = Globals.assetManager.fetchModel(AssetDataStrings.MODEL_IMAGE_PLANE);
if(planeModel != null){ if(planeModel != null){
//draw bar //draw bar
ndcX = (float)(this.absoluteToFramebuffer(getAbsoluteX(),framebufferPosX) + (getWidth() * ((1.0f - CIRCLE_WIDTH)/2.0f)))/framebuffer.getWidth(); ndcX = (float)(this.absoluteToFramebuffer(getAbsoluteX(),framebufferPosX) + (getWidth() * ((1.0f - CIRCLE_WIDTH)/2.0f)))/framebuffer.getWidth();

View File

@ -7,6 +7,7 @@ import org.joml.Vector4f;
import electrosphere.client.ui.menu.WindowStrings; import electrosphere.client.ui.menu.WindowStrings;
import electrosphere.engine.Globals; import electrosphere.engine.Globals;
import electrosphere.engine.assetmanager.AssetDataStrings;
import electrosphere.engine.signal.Signal.SignalType; import electrosphere.engine.signal.Signal.SignalType;
import electrosphere.logger.LoggerInterface; import electrosphere.logger.LoggerInterface;
import electrosphere.renderer.OpenGLState; import electrosphere.renderer.OpenGLState;
@ -106,7 +107,7 @@ public class Tooltip extends StandardDrawableContainerElement {
boxPosition = new Vector3f(ndcX,ndcY,0); boxPosition = new Vector3f(ndcX,ndcY,0);
boxDimensions = new Vector3f(ndcWidth,ndcHeight,0); boxDimensions = new Vector3f(ndcWidth,ndcHeight,0);
Model planeModel = Globals.assetManager.fetchModel(Globals.imagePlaneModelID); Model planeModel = Globals.assetManager.fetchModel(AssetDataStrings.MODEL_IMAGE_PLANE);
Texture windowFrame = null; Texture windowFrame = null;
windowFrame = Globals.assetManager.fetchTexture("Textures/b1.png"); windowFrame = Globals.assetManager.fetchTexture("Textures/b1.png");

View File

@ -219,7 +219,7 @@ public class Window implements DrawableElement, ContainerElement, NavigableEleme
GL40.glClear(GL40.GL_COLOR_BUFFER_BIT | GL40.GL_DEPTH_BUFFER_BIT); GL40.glClear(GL40.GL_COLOR_BUFFER_BIT | GL40.GL_DEPTH_BUFFER_BIT);
//grab assets required to render window //grab assets required to render window
Model planeModel = Globals.assetManager.fetchModel(Globals.imagePlaneModelID); Model planeModel = Globals.assetManager.fetchModel(AssetDataStrings.MODEL_IMAGE_PLANE);
Texture windowFrame = Globals.assetManager.fetchTexture(AssetDataStrings.UI_FRAME_TEXTURE_DEFAULT_1); Texture windowFrame = Globals.assetManager.fetchTexture(AssetDataStrings.UI_FRAME_TEXTURE_DEFAULT_1);
for(Element child : childList){ for(Element child : childList){

View File

@ -4,6 +4,7 @@ import org.joml.Vector3f;
import org.joml.Vector4f; import org.joml.Vector4f;
import electrosphere.engine.Globals; import electrosphere.engine.Globals;
import electrosphere.engine.assetmanager.AssetDataStrings;
import electrosphere.renderer.OpenGLState; import electrosphere.renderer.OpenGLState;
import electrosphere.renderer.framebuffer.Framebuffer; import electrosphere.renderer.framebuffer.Framebuffer;
import electrosphere.renderer.model.Material; import electrosphere.renderer.model.Material;
@ -63,7 +64,7 @@ public class UIFrameUtils {
framebuffer.bind(openGLState); framebuffer.bind(openGLState);
openGLState.glViewport(framebuffer.getWidth(), framebuffer.getHeight()); openGLState.glViewport(framebuffer.getWidth(), framebuffer.getHeight());
Model planeModel = Globals.assetManager.fetchModel(Globals.imagePlaneModelID); Model planeModel = Globals.assetManager.fetchModel(AssetDataStrings.MODEL_IMAGE_PLANE);
Texture windowFrame = Globals.assetManager.fetchTexture(frame); Texture windowFrame = Globals.assetManager.fetchTexture(frame);
//render background of window //render background of window
if(planeModel != null && windowFrame != null){ if(planeModel != null && windowFrame != null){