image panel color transparency support
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
051e5afe8b
commit
d8ecca2a7b
@ -4,13 +4,14 @@ out vec4 FragColor;
|
||||
in vec2 TexCoords;
|
||||
|
||||
uniform sampler2D screenTexture;
|
||||
uniform vec3 color;
|
||||
uniform vec4 color;
|
||||
|
||||
void main(){
|
||||
vec4 textureColor = texture(screenTexture, TexCoords);
|
||||
textureColor.r = textureColor.r * color.r;
|
||||
textureColor.g = textureColor.g * color.g;
|
||||
textureColor.b = textureColor.b * color.b;
|
||||
textureColor.a = textureColor.a * color.a;
|
||||
if(textureColor.a < 0.1){
|
||||
discard;
|
||||
}
|
||||
|
||||
@ -4,13 +4,14 @@ out vec4 FragColor;
|
||||
in vec2 TexCoords;
|
||||
|
||||
uniform sampler2D screenTexture;
|
||||
uniform vec3 color;
|
||||
uniform vec4 color;
|
||||
|
||||
void main(){
|
||||
vec4 textureColor = texture(screenTexture, TexCoords);
|
||||
textureColor.r = textureColor.r * color.r;
|
||||
textureColor.g = textureColor.g * color.g;
|
||||
textureColor.b = textureColor.b * color.b;
|
||||
textureColor.a = textureColor.a * color.a;
|
||||
if(textureColor.a < 0.1){
|
||||
discard;
|
||||
}
|
||||
|
||||
@ -5,14 +5,16 @@ out vec4 FragColor;
|
||||
in vec2 TexCoords;
|
||||
|
||||
uniform sampler2D screenTexture;
|
||||
uniform vec3 color;
|
||||
uniform vec4 color;
|
||||
|
||||
void main(){
|
||||
vec3 textColorModifier = color;
|
||||
vec4 textColorModifier = color;
|
||||
if(color.x == 0 && color.y == 0 && color.z == 0){
|
||||
textColorModifier.x = 1;
|
||||
textColorModifier.y = 1;
|
||||
textColorModifier.z = 1;
|
||||
}
|
||||
FragColor = texture(screenTexture, TexCoords) * vec4(textColorModifier.xyz, 1.0);
|
||||
float baseColor = texture(screenTexture, TexCoords).r;
|
||||
textColorModifier.a = textColorModifier.a * baseColor;
|
||||
FragColor = textColorModifier;
|
||||
}
|
||||
@ -5,15 +5,17 @@ out vec4 FragColor;
|
||||
in vec2 TexCoords;
|
||||
|
||||
uniform sampler2D screenTexture;
|
||||
uniform vec3 color;
|
||||
uniform vec4 color;
|
||||
|
||||
void main(){
|
||||
vec3 textColorModifier = color;
|
||||
vec4 textColorModifier = color;
|
||||
if(color.x == 0 && color.y == 0 && color.z == 0){
|
||||
textColorModifier.x = 1;
|
||||
textColorModifier.y = 1;
|
||||
textColorModifier.z = 1;
|
||||
}
|
||||
vec4 sample = texture(screenTexture, TexCoords);
|
||||
FragColor = vec4(sample.r) * vec4(textColorModifier.xyz, 1.0);
|
||||
float baseColor = sample.r;
|
||||
textColorModifier.a = textColorModifier.a * baseColor;
|
||||
FragColor = textColorModifier;
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
#version 330 core
|
||||
out vec4 FragColor;
|
||||
|
||||
uniform vec3 color;
|
||||
uniform vec4 color;
|
||||
|
||||
void main(){
|
||||
FragColor = vec4(color,1.0);
|
||||
FragColor = color;
|
||||
}
|
||||
@ -3,7 +3,7 @@ package electrosphere.client.ui.components;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.joml.Vector3f;
|
||||
import org.joml.Vector4f;
|
||||
|
||||
import electrosphere.client.ui.menu.WindowStrings;
|
||||
import electrosphere.client.ui.menu.YogaUtils;
|
||||
@ -49,7 +49,7 @@ public class VoxelSelectionPanel {
|
||||
/**
|
||||
* The color of the select voxel type
|
||||
*/
|
||||
static final Vector3f ELEMENT_COLOR_SELECTED = new Vector3f(1,0,0);
|
||||
static final Vector4f ELEMENT_COLOR_SELECTED = new Vector4f(1,0,0,1);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package electrosphere.client.ui.menu.ingame;
|
||||
|
||||
import org.joml.Vector3f;
|
||||
import org.joml.Vector4f;
|
||||
|
||||
import electrosphere.client.ui.menu.WindowStrings;
|
||||
import electrosphere.client.ui.menu.WindowUtils;
|
||||
@ -346,7 +346,7 @@ public class MenuGeneratorsInGame {
|
||||
for(VisualAttribute attribute : playeCreatureType.getVisualAttributes()){
|
||||
int posY = offset * 350 + 100;
|
||||
if(attribute.getType().equals("bone")){
|
||||
Slider attributeSlider = new Slider(50,posY,400,100,new Vector3f(0.1f,0.1f,0.1f),new Vector3f(1.0f,0,0));
|
||||
Slider attributeSlider = new Slider(50,posY,400,100,new Vector4f(0.1f,0.1f,0.1f,1.0f),new Vector4f(1.0f,0,0,1.0f));
|
||||
attributeSlider.setOnValueChangeCallback(new ValueChangeEventCallback() {public void execute(ValueChangeEvent event) {
|
||||
// float value = event.getAsFloat();
|
||||
// float minVal = attribute.getMinValue();
|
||||
|
||||
@ -8,6 +8,7 @@ import static org.lwjgl.opengl.GL11.glDisable;
|
||||
import static org.lwjgl.opengl.GL11.glPolygonMode;
|
||||
|
||||
import org.joml.Vector3f;
|
||||
import org.joml.Vector4f;
|
||||
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.logger.LoggerInterface;
|
||||
@ -59,7 +60,7 @@ public class DebugRendering {
|
||||
static VisualShader windowDrawDebugProgram = null;
|
||||
static VisualShader elementDrawDebugProgram = null;
|
||||
static Model planeModel = null;
|
||||
public static void drawUIBounds(Framebuffer parentFramebuffer, Vector3f boxPosition, Vector3f boxDimensions, Vector3f color){
|
||||
public static void drawUIBounds(Framebuffer parentFramebuffer, Vector3f boxPosition, Vector3f boxDimensions, Vector4f color){
|
||||
if(Globals.RENDER_FLAG_RENDER_UI_BOUNDS){
|
||||
if(planeModel == null){
|
||||
planeModel = Globals.assetManager.fetchModel(Globals.imagePlaneModelID);
|
||||
@ -83,7 +84,7 @@ public class DebugRendering {
|
||||
}
|
||||
}
|
||||
|
||||
public static void drawUIBoundsWindow(Framebuffer parentFramebuffer, Vector3f boxPosition, Vector3f boxDimensions, Vector3f color){
|
||||
public static void drawUIBoundsWindow(Framebuffer parentFramebuffer, Vector3f boxPosition, Vector3f boxDimensions, Vector4f color){
|
||||
if(Globals.RENDER_FLAG_RENDER_UI_BOUNDS){
|
||||
if(planeModel == null){
|
||||
planeModel = Globals.assetManager.fetchModel(Globals.imagePlaneModelID);
|
||||
|
||||
@ -23,6 +23,7 @@ import org.joml.Sphered;
|
||||
import org.joml.Vector3d;
|
||||
import org.joml.Vector3f;
|
||||
import org.joml.Vector3i;
|
||||
import org.joml.Vector4f;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL15;
|
||||
import org.lwjgl.opengl.GL40;
|
||||
@ -332,6 +333,12 @@ public class Mesh {
|
||||
// glUniform3fv(glGetUniformLocation(openGLState.getActiveShader().getId(), key), currentUniform.get(BufferUtils.createFloatBuffer(3)));
|
||||
Globals.renderingEngine.checkError();
|
||||
}
|
||||
if(currentUniformRaw instanceof Vector4f){
|
||||
Vector4f currentUniform = (Vector4f)currentUniformRaw;
|
||||
openGLState.getActiveShader().setUniform(openGLState, key, currentUniform);
|
||||
// glUniform3fv(glGetUniformLocation(openGLState.getActiveShader().getId(), key), currentUniform.get(BufferUtils.createFloatBuffer(3)));
|
||||
Globals.renderingEngine.checkError();
|
||||
}
|
||||
if(currentUniformRaw instanceof Integer){
|
||||
int currentUniform = (Integer)currentUniformRaw;
|
||||
openGLState.getActiveShader().setUniform(openGLState, key, currentUniform);
|
||||
|
||||
@ -9,6 +9,7 @@ import org.joml.Vector2i;
|
||||
import org.joml.Vector3d;
|
||||
import org.joml.Vector3f;
|
||||
import org.joml.Vector3i;
|
||||
import org.joml.Vector4f;
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.GL40;
|
||||
import org.lwjgl.system.MemoryStack;
|
||||
@ -51,7 +52,15 @@ public class ShaderUtils {
|
||||
uniformMap.put(uniformLocation,new Matrix4d(currentUniform)); //create new matrix4f to break pointer-matching with equals on cache check
|
||||
|
||||
//
|
||||
//vector3f
|
||||
//vector4f
|
||||
} else if(value instanceof Vector4f){
|
||||
Vector4f currentUniform = (Vector4f)value;
|
||||
GL40.glUniform4fv(uniformLocation, currentUniform.get(BufferUtils.createFloatBuffer(4)));
|
||||
Globals.renderingEngine.checkError();
|
||||
uniformMap.put(uniformLocation,new Vector4f(currentUniform)); //create new vector3f to break pointer-matching with equals on cache check
|
||||
|
||||
//
|
||||
//vector3d
|
||||
} else if(value instanceof Vector3f){
|
||||
Vector3f currentUniform = (Vector3f)value;
|
||||
GL40.glUniform3fv(uniformLocation, currentUniform.get(BufferUtils.createFloatBuffer(3)));
|
||||
|
||||
@ -5,6 +5,7 @@ import org.joml.Quaterniond;
|
||||
import org.joml.Vector3d;
|
||||
import org.joml.Vector3f;
|
||||
import org.joml.Vector4d;
|
||||
import org.joml.Vector4f;
|
||||
import org.lwjgl.opengl.GL40;
|
||||
|
||||
import electrosphere.client.entity.camera.CameraEntityUtils;
|
||||
@ -71,7 +72,7 @@ public class ActorPanel extends BufferedStandardDrawableContainerElement impleme
|
||||
/**
|
||||
* Color to clear the background with
|
||||
*/
|
||||
static Vector3f color = new Vector3f(1.0f);
|
||||
static Vector4f color = new Vector4f(1.0f);
|
||||
|
||||
/**
|
||||
* Color to clear the panel with
|
||||
|
||||
@ -12,6 +12,7 @@ import electrosphere.renderer.ui.events.Event;
|
||||
import electrosphere.renderer.ui.font.Font;
|
||||
|
||||
import org.joml.Vector3f;
|
||||
import org.joml.Vector4f;
|
||||
|
||||
/**
|
||||
* A single character
|
||||
@ -20,7 +21,7 @@ public class BitmapCharacter extends StandardElement implements DrawableElement
|
||||
|
||||
String text;
|
||||
|
||||
Vector3f color = new Vector3f(1.0f);
|
||||
Vector4f color = new Vector4f(1.0f);
|
||||
|
||||
Font font;
|
||||
|
||||
@ -68,7 +69,7 @@ public class BitmapCharacter extends StandardElement implements DrawableElement
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public void setColor(Vector3f color) {
|
||||
public void setColor(Vector4f color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ package electrosphere.renderer.ui.elements;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.joml.Vector3f;
|
||||
import org.joml.Vector4f;
|
||||
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.engine.assetmanager.AssetDataStrings;
|
||||
@ -26,30 +27,30 @@ import electrosphere.renderer.ui.frame.UIFrameUtils;
|
||||
*/
|
||||
public class Button extends StandardContainerElement implements DrawableElement, FocusableElement, ClickableElement, HoverableElement {
|
||||
|
||||
/**
|
||||
* Color for when the button is focused
|
||||
*/
|
||||
static Vector3f COLOR_FOCUSED = new Vector3f(0.97f,0.97f,0.98f);
|
||||
|
||||
/**
|
||||
* Color for when the button is unfocused
|
||||
*/
|
||||
static Vector3f COLOR_UNFOCUSED = new Vector3f(0.42f,0.46f,0.49f);
|
||||
static Vector4f COLOR_UNFOCUSED = new Vector4f(0.97f,0.97f,0.98f,1.0f);
|
||||
|
||||
/**
|
||||
* Color for when the button is focused
|
||||
*/
|
||||
static Vector4f COLOR_FOCUSED = new Vector4f(0.42f,0.46f,0.49f,1.0f);
|
||||
|
||||
/**
|
||||
* Default button color
|
||||
*/
|
||||
static Vector3f COLOR_DEFAULT = new Vector3f(COLOR_UNFOCUSED);
|
||||
static Vector4f COLOR_DEFAULT = new Vector4f(COLOR_UNFOCUSED);
|
||||
|
||||
/**
|
||||
* Default color for focused frame
|
||||
*/
|
||||
static Vector3f COLOR_FRAME_FOCUSED_DEFAULT = new Vector3f(0.914f, 0.925f, 0.937f);
|
||||
static Vector4f COLOR_FRAME_FOCUSED_DEFAULT = new Vector4f(0.914f, 0.925f, 0.937f, 0.7f);
|
||||
|
||||
/**
|
||||
* Default color for unfocused frame
|
||||
*/
|
||||
static Vector3f COLOR_FRAME_UNFOCUSED_DEFAULT = new Vector3f(0.089f, 0.105f, 0.121f);
|
||||
static Vector4f COLOR_FRAME_UNFOCUSED_DEFAULT = new Vector4f(0.089f, 0.105f, 0.121f, 0.7f);
|
||||
|
||||
/**
|
||||
* Default padding applied to buttons
|
||||
@ -59,17 +60,17 @@ public class Button extends StandardContainerElement implements DrawableElement,
|
||||
/**
|
||||
* The color of the backing element
|
||||
*/
|
||||
Vector3f color = new Vector3f(COLOR_DEFAULT);
|
||||
Vector4f color = new Vector4f(COLOR_DEFAULT);
|
||||
|
||||
/**
|
||||
* The color of the frame
|
||||
*/
|
||||
Vector3f frameColor = new Vector3f(COLOR_FRAME_FOCUSED_DEFAULT);
|
||||
Vector4f frameColor = new Vector4f(COLOR_FRAME_FOCUSED_DEFAULT);
|
||||
|
||||
/**
|
||||
* The color of the background of the frame
|
||||
*/
|
||||
Vector3f frameBackgroundColor = new Vector3f(COLOR_FRAME_UNFOCUSED_DEFAULT);
|
||||
Vector4f frameBackgroundColor = new Vector4f(COLOR_FRAME_UNFOCUSED_DEFAULT);
|
||||
|
||||
|
||||
boolean visible = false;
|
||||
@ -219,7 +220,7 @@ public class Button extends StandardContainerElement implements DrawableElement,
|
||||
for(Element child : childList){
|
||||
if(child instanceof Label){
|
||||
Label childLabel = (Label) child;
|
||||
childLabel.setColor(new Vector3f(COLOR_UNFOCUSED));
|
||||
childLabel.setColor(new Vector4f(COLOR_UNFOCUSED));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -232,7 +233,7 @@ public class Button extends StandardContainerElement implements DrawableElement,
|
||||
for(Element child : childList){
|
||||
if(child instanceof Label){
|
||||
Label childLabel = (Label) child;
|
||||
childLabel.setColor(new Vector3f(COLOR_UNFOCUSED));
|
||||
childLabel.setColor(new Vector4f(COLOR_UNFOCUSED));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -247,14 +248,14 @@ public class Button extends StandardContainerElement implements DrawableElement,
|
||||
for(Element child : childList){
|
||||
if(child instanceof Label){
|
||||
Label childLabel = (Label) child;
|
||||
childLabel.setColor(new Vector3f(COLOR_FOCUSED));
|
||||
childLabel.setColor(new Vector4f(COLOR_FOCUSED));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for(Element child : childList){
|
||||
if(child instanceof Label){
|
||||
Label childLabel = (Label) child;
|
||||
childLabel.setColor(new Vector3f(COLOR_UNFOCUSED));
|
||||
childLabel.setColor(new Vector4f(COLOR_UNFOCUSED));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -390,7 +391,7 @@ public class Button extends StandardContainerElement implements DrawableElement,
|
||||
* Sets the background color of this element
|
||||
* @param color The color
|
||||
*/
|
||||
public void setColor(Vector3f color){
|
||||
public void setColor(Vector4f color){
|
||||
this.color.set(color);
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package electrosphere.renderer.ui.elements;
|
||||
|
||||
import org.joml.Vector3f;
|
||||
import org.joml.Vector4f;
|
||||
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.logger.LoggerInterface;
|
||||
@ -24,7 +25,7 @@ import electrosphere.renderer.ui.events.HoverEvent;
|
||||
*/
|
||||
public class ImagePanel extends StandardElement implements DrawableElement, DraggableElement, HoverableElement {
|
||||
|
||||
Vector3f color = new Vector3f(1.0f);
|
||||
Vector4f color = new Vector4f(1.0f);
|
||||
|
||||
//Asset path for the model data that is used to draw the image panel
|
||||
public static String imagePanelModelPath;
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package electrosphere.renderer.ui.elements;
|
||||
|
||||
import org.joml.Vector3f;
|
||||
import org.joml.Vector4f;
|
||||
import org.lwjgl.util.yoga.Yoga;
|
||||
|
||||
import electrosphere.engine.Globals;
|
||||
@ -117,7 +118,7 @@ public class Label extends StandardContainerElement implements DrawableElement {
|
||||
* Sets the color of the label
|
||||
* @param color The color
|
||||
*/
|
||||
public void setColor(Vector3f color){
|
||||
public void setColor(Vector4f color){
|
||||
for(Element character : childList){
|
||||
((BitmapCharacter)character).setColor(color);
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package electrosphere.renderer.ui.elements;
|
||||
|
||||
import org.joml.Vector3f;
|
||||
import org.joml.Vector4f;
|
||||
import org.lwjgl.util.yoga.Yoga;
|
||||
|
||||
import electrosphere.engine.assetmanager.AssetDataStrings;
|
||||
@ -18,7 +18,7 @@ import electrosphere.renderer.ui.frame.UIFrameUtils;
|
||||
public class Panel extends StandardContainerElement implements DrawableElement {
|
||||
|
||||
|
||||
static final Vector3f windowDrawDebugColor = new Vector3f(1.0f,1.0f,1.0f);
|
||||
static final Vector4f windowDrawDebugColor = new Vector4f(1.0f,1.0f,1.0f,1.0f);
|
||||
|
||||
/**
|
||||
* Default padding applied to buttons
|
||||
@ -33,7 +33,7 @@ public class Panel extends StandardContainerElement implements DrawableElement {
|
||||
/**
|
||||
* The color of the frame
|
||||
*/
|
||||
Vector3f frameColor = new Vector3f(COLOR_FRAME_FOCUSED_DEFAULT);
|
||||
Vector4f frameColor = new Vector4f(COLOR_FRAME_FOCUSED_DEFAULT);
|
||||
|
||||
/**
|
||||
* Creates a label element
|
||||
@ -61,7 +61,7 @@ public class Panel extends StandardContainerElement implements DrawableElement {
|
||||
* Sets the color of the panel
|
||||
* @param color The color
|
||||
*/
|
||||
public void setColor(Vector3f color){
|
||||
public void setColor(Vector4f color){
|
||||
for(Element character : childList){
|
||||
((BitmapCharacter)character).setColor(color);
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package electrosphere.renderer.ui.elements;
|
||||
|
||||
import org.joml.Vector3f;
|
||||
import org.joml.Vector4f;
|
||||
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.logger.LoggerInterface;
|
||||
@ -30,7 +31,7 @@ public class ScrollableContainer extends BufferedStandardDrawableContainerElemen
|
||||
/**
|
||||
* The color associated with the scrollable
|
||||
*/
|
||||
Vector3f color = new Vector3f(1.0f);
|
||||
Vector4f color = new Vector4f(1.0f);
|
||||
|
||||
Vector3f boxPosition = new Vector3f();
|
||||
Vector3f boxDimensions = new Vector3f();
|
||||
|
||||
@ -3,6 +3,7 @@ package electrosphere.renderer.ui.elements;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.joml.Vector3f;
|
||||
import org.joml.Vector4f;
|
||||
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.logger.LoggerInterface;
|
||||
@ -41,8 +42,8 @@ public class Slider extends StandardDrawableElement implements ClickableElement,
|
||||
float max = 1.0f;
|
||||
float value = 0.5f;
|
||||
|
||||
Vector3f colorBackground = new Vector3f(0.2f,0.2f,0.2f);
|
||||
Vector3f colorForeground = new Vector3f(1,1,1);
|
||||
Vector4f colorBackground = new Vector4f(0.2f,0.2f,0.2f,1);
|
||||
Vector4f colorForeground = new Vector4f(1,1,1,1);
|
||||
|
||||
static Material mat;
|
||||
|
||||
@ -94,7 +95,7 @@ public class Slider extends StandardDrawableElement implements ClickableElement,
|
||||
}
|
||||
|
||||
|
||||
public Slider(int positionX, int positionY, int width, int height, Vector3f colorBackground, Vector3f colorForeground){
|
||||
public Slider(int positionX, int positionY, int width, int height, Vector4f colorBackground, Vector4f colorForeground){
|
||||
super();
|
||||
if(mat == null){
|
||||
mat = new Material();
|
||||
@ -261,7 +262,7 @@ public class Slider extends StandardDrawableElement implements ClickableElement,
|
||||
propagate = this.onFocusCallback.execute(focusEvent);
|
||||
} else {
|
||||
//default behavior/
|
||||
colorForeground = new Vector3f(1,0.5f,0.5f);
|
||||
colorForeground = new Vector4f(1,0.5f,0.5f,1);
|
||||
propagate = true;
|
||||
}
|
||||
} else {
|
||||
@ -269,7 +270,7 @@ public class Slider extends StandardDrawableElement implements ClickableElement,
|
||||
propagate = this.onLoseFocusCallback.execute(focusEvent);
|
||||
} else {
|
||||
//default behavior
|
||||
colorForeground = new Vector3f(1,1,1);
|
||||
colorForeground = new Vector4f(1,1,1,1);
|
||||
propagate = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.joml.Vector3f;
|
||||
import org.joml.Vector4f;
|
||||
import org.lwjgl.util.yoga.Yoga;
|
||||
|
||||
import electrosphere.engine.Globals;
|
||||
@ -145,12 +146,12 @@ public class StringCarousel extends StandardContainerElement implements Drawable
|
||||
}
|
||||
generateLetters();
|
||||
if(focused){
|
||||
setColor(new Vector3f(1,0,0));
|
||||
setColor(new Vector4f(1,0,0,1));
|
||||
}
|
||||
Globals.signalSystem.post(SignalType.YOGA_APPLY, this);
|
||||
}
|
||||
|
||||
public void setColor(Vector3f color){
|
||||
public void setColor(Vector4f color){
|
||||
for(Element character : childList){
|
||||
((BitmapCharacter)character).setColor(color);
|
||||
}
|
||||
@ -226,7 +227,7 @@ public class StringCarousel extends StandardContainerElement implements Drawable
|
||||
} else {
|
||||
//default behavior
|
||||
propagate = false;
|
||||
setColor(new Vector3f(1,0,0));
|
||||
setColor(new Vector4f(1,0,0,1));
|
||||
}
|
||||
} else {
|
||||
this.focused = false;
|
||||
@ -235,7 +236,7 @@ public class StringCarousel extends StandardContainerElement implements Drawable
|
||||
} else {
|
||||
//default behavior
|
||||
propagate = false;
|
||||
setColor(new Vector3f(1,1,1));
|
||||
setColor(new Vector4f(1,1,1,1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,6 +21,7 @@ import electrosphere.renderer.ui.font.Font;
|
||||
import electrosphere.renderer.ui.frame.UIFrameUtils;
|
||||
|
||||
import org.joml.Vector3f;
|
||||
import org.joml.Vector4f;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@ -37,7 +38,7 @@ public class TextInput extends StandardContainerElement implements DrawableEleme
|
||||
/**
|
||||
* The color of the background element of the input
|
||||
*/
|
||||
Vector3f backgroundColor = new Vector3f(0.2f,0.2f,0.2f);
|
||||
Vector4f backgroundColor = new Vector4f(0.2f,0.2f,0.2f,1.0f);
|
||||
|
||||
/**
|
||||
* Stores visibility status
|
||||
@ -77,7 +78,7 @@ public class TextInput extends StandardContainerElement implements DrawableEleme
|
||||
/**
|
||||
* The color of the text input
|
||||
*/
|
||||
private Vector3f color;
|
||||
private Vector4f color;
|
||||
|
||||
/**
|
||||
* The content of the text input
|
||||
@ -121,7 +122,7 @@ public class TextInput extends StandardContainerElement implements DrawableEleme
|
||||
super();
|
||||
this.font = Globals.fontManager.getFont("default");
|
||||
this.fontSize = fontSize;
|
||||
this.color = new Vector3f(1,1,1);
|
||||
this.color = new Vector4f(1,1,1,1);
|
||||
this.setHeight((int)(font.getFontHeight() * fontSize) + DEFAULT_PADDING * 2);
|
||||
this.setFlexDirection(YogaFlexDirection.Row);
|
||||
this.setMinWidth(1);
|
||||
@ -161,7 +162,7 @@ public class TextInput extends StandardContainerElement implements DrawableEleme
|
||||
* Sets the color of the text input
|
||||
* @param color The color
|
||||
*/
|
||||
public void setColor(Vector3f color){
|
||||
public void setColor(Vector4f color){
|
||||
this.color.set(color);
|
||||
for(Element character : childList){
|
||||
((BitmapCharacter)character).setColor(color);
|
||||
@ -232,7 +233,7 @@ public class TextInput extends StandardContainerElement implements DrawableEleme
|
||||
this.onFocusCallback.execute(focusEvent);
|
||||
} else {
|
||||
this.focused = true;
|
||||
this.setColor(new Vector3f(1,0,0));
|
||||
this.setColor(new Vector4f(1,0,0,1));
|
||||
propagate = false;
|
||||
}
|
||||
} else {
|
||||
@ -240,7 +241,7 @@ public class TextInput extends StandardContainerElement implements DrawableEleme
|
||||
this.onLoseFocusCallback.execute(focusEvent);
|
||||
} else {
|
||||
this.focused = false;
|
||||
this.setColor(new Vector3f(1,1,1));
|
||||
this.setColor(new Vector4f(1,1,1,1));
|
||||
propagate = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package electrosphere.renderer.ui.elements;
|
||||
|
||||
import org.joml.Vector3f;
|
||||
import org.joml.Vector4f;
|
||||
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.logger.LoggerInterface;
|
||||
@ -53,7 +54,7 @@ public class ToggleInput extends StandardDrawableElement implements ClickableEle
|
||||
/**
|
||||
* The color of the circle
|
||||
*/
|
||||
Vector3f circleColor = new Vector3f(0.8f,0.8f,0.8f);
|
||||
Vector4f circleColor = new Vector4f(0.8f,0.8f,0.8f,1);
|
||||
|
||||
/**
|
||||
* Material for drawing the connecting bar between the circle positions
|
||||
@ -68,7 +69,7 @@ public class ToggleInput extends StandardDrawableElement implements ClickableEle
|
||||
/**
|
||||
* The color of the bar
|
||||
*/
|
||||
Vector3f barColor = new Vector3f(0.3f,0.3f,0.3f);
|
||||
Vector4f barColor = new Vector4f(0.3f,0.3f,0.3f,1);
|
||||
|
||||
/**
|
||||
* The default width of the toggle in pixels
|
||||
@ -135,12 +136,12 @@ public class ToggleInput extends StandardDrawableElement implements ClickableEle
|
||||
//the actual offset from the center (with appropriate sign based on value)
|
||||
float circleOffsetActual = 0;
|
||||
if(value){
|
||||
circleColor.set(0.9f, 0.9f, 0.9f);
|
||||
barColor.set(0.5f, 0.9f, 0.5f);
|
||||
circleColor.set(0.9f, 0.9f, 0.9f, 1.0f);
|
||||
barColor.set(0.5f, 0.9f, 0.5f, 1.0f);
|
||||
circleOffsetActual = CIRCLE_OFFSET_FROM_CENTER;
|
||||
} else {
|
||||
circleColor.set(0.9f, 0.9f, 0.9f);
|
||||
barColor.set(0.9f, 0.5f, 0.5f);
|
||||
circleColor.set(0.9f, 0.9f, 0.9f, 1.0f);
|
||||
barColor.set(0.9f, 0.5f, 0.5f, 1.0f);
|
||||
circleOffsetActual = -CIRCLE_OFFSET_FROM_CENTER;
|
||||
}
|
||||
//ratio to adjust the circlewidth by to always show a circle and not a deformed oval
|
||||
|
||||
@ -3,6 +3,7 @@ package electrosphere.renderer.ui.elements;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.joml.Vector3f;
|
||||
import org.joml.Vector4f;
|
||||
|
||||
import electrosphere.client.ui.menu.WindowStrings;
|
||||
import electrosphere.engine.Globals;
|
||||
@ -23,7 +24,7 @@ import electrosphere.renderer.ui.elementtypes.Element;
|
||||
public class Tooltip extends StandardDrawableContainerElement {
|
||||
|
||||
//color of the decorations for the tooltip popout
|
||||
Vector3f backgroundColor = new Vector3f(0.2f,0.2f,0.2f);
|
||||
Vector4f backgroundColor = new Vector4f(0.2f,0.2f,0.2f,1.0f);
|
||||
|
||||
Vector3f boxPosition = new Vector3f();
|
||||
Vector3f boxDimensions = new Vector3f();
|
||||
|
||||
@ -4,6 +4,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.joml.Vector3f;
|
||||
import org.joml.Vector4f;
|
||||
import org.lwjgl.opengl.GL40;
|
||||
import org.lwjgl.util.yoga.YGLayout;
|
||||
import org.lwjgl.util.yoga.YGNode;
|
||||
@ -36,7 +37,7 @@ public class Window implements DrawableElement, ContainerElement, NavigableEleme
|
||||
/**
|
||||
* The color of the window
|
||||
*/
|
||||
Vector3f color = new Vector3f(0.1f);
|
||||
Vector4f color = new Vector4f(0.5f);
|
||||
|
||||
/**
|
||||
* The child elements of this window
|
||||
@ -262,7 +263,7 @@ public class Window implements DrawableElement, ContainerElement, NavigableEleme
|
||||
planeModel.pushUniformToMesh("plane", "mDimension", boxDimensions);
|
||||
planeModel.pushUniformToMesh("plane", "tPosition", texPosition);
|
||||
planeModel.pushUniformToMesh("plane", "tDimension", texScale);
|
||||
planeModel.pushUniformToMesh(planeModel.getMeshes().get(0).getMeshName(), "color", new Vector3f(1.0f));
|
||||
planeModel.pushUniformToMesh(planeModel.getMeshes().get(0).getMeshName(), "color", new Vector4f(1.0f));
|
||||
customMat.setTexturePointer(widgetBuffer.getTexture().getTexturePointer());
|
||||
planeModel.getMeshes().get(0).setMaterial(customMat);
|
||||
planeModel.drawUI();
|
||||
@ -901,7 +902,7 @@ public class Window implements DrawableElement, ContainerElement, NavigableEleme
|
||||
* Gets the color of the window decorations
|
||||
* @return The color of the decorations
|
||||
*/
|
||||
public Vector3f getColor() {
|
||||
public Vector4f getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
@ -909,7 +910,7 @@ public class Window implements DrawableElement, ContainerElement, NavigableEleme
|
||||
* Sets the color of the window decorations
|
||||
* @param color The color of the decorations
|
||||
*/
|
||||
public void setColor(Vector3f color) {
|
||||
public void setColor(Vector4f color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package electrosphere.renderer.ui.frame;
|
||||
|
||||
import org.joml.Vector3f;
|
||||
import org.joml.Vector4f;
|
||||
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.renderer.framebuffer.Framebuffer;
|
||||
@ -52,7 +53,7 @@ public class UIFrameUtils {
|
||||
* @param framebufferPosY The y position of the framebuffer
|
||||
*/
|
||||
public static void drawFrame(
|
||||
String frame, Vector3f color, int frameTexDim, int frameCornerDim,
|
||||
String frame, Vector4f color, int frameTexDim, int frameCornerDim,
|
||||
int posX, int posY, int width, int height,
|
||||
Framebuffer framebuffer, int framebufferPosX, int framebufferPosY
|
||||
){
|
||||
|
||||
Loading…
Reference in New Issue
Block a user