rendering hardware data

This commit is contained in:
austin 2025-05-19 23:01:57 -04:00
parent a375e1a686
commit acf86bcfa2
5 changed files with 82 additions and 0 deletions

View File

@ -13,6 +13,16 @@ struct Material {
*/
sampler2D specular;
/**
* The normal sampler
*/
sampler2D normal;
/**
* The reflection map
*/
sampler2D parallax;
/**
* The shininess value
*/

View File

@ -1907,6 +1907,7 @@ Material albedo work
Editor entities don't use charges on placing blocks
Overhaul material loading - uses queued textures now
Transparent block support
Grab hardware data on init rendering engine

View File

@ -36,6 +36,7 @@ import electrosphere.renderer.debug.DebugRendering;
import electrosphere.renderer.framebuffer.Framebuffer;
import electrosphere.renderer.framebuffer.FramebufferUtils;
import electrosphere.renderer.framebuffer.Renderbuffer;
import electrosphere.renderer.hw.HardwareData;
import electrosphere.renderer.light.LightManager;
import electrosphere.renderer.model.Material;
import electrosphere.renderer.pipelines.CompositePipeline;
@ -66,6 +67,11 @@ public class RenderingEngine {
* Handle for the window created by glfw
*/
private long windowPtr = -1;
/**
* The glfw hardware data
*/
public HardwareData hardwareData;
public static final int GL_DEFAULT_FRAMEBUFFER = 0;
@ -244,6 +250,10 @@ public class RenderingEngine {
"Error code: " + this.getGLFWErrorMessage(this.getGLFWError());
throw new IllegalStateException(message);
}
//grab hardware data
this.hardwareData = new HardwareData();
//Gives hints to glfw to control how opengl will be used
GLFW.glfwWindowHint(GLFW.GLFW_CONTEXT_VERSION_MAJOR, 4);
GLFW.glfwWindowHint(GLFW.GLFW_CONTEXT_VERSION_MINOR, 5);

View File

@ -0,0 +1,33 @@
package electrosphere.renderer.hw;
import java.util.LinkedList;
import java.util.List;
import org.lwjgl.PointerBuffer;
import org.lwjgl.glfw.GLFW;
/**
* Data about the renderer hardware
*/
public class HardwareData {
/**
* The list of monitors available
*/
public final List<MonitorData> monitors = new LinkedList<MonitorData>();
/**
* Constructor
*/
public HardwareData(){
PointerBuffer monitorBuff = GLFW.glfwGetMonitors();
if(monitorBuff != null){
while(monitorBuff.hasRemaining()){
long id = monitorBuff.get();
String name = GLFW.glfwGetMonitorName(id);
monitors.add(new MonitorData(id, name));
}
}
}
}

View File

@ -0,0 +1,28 @@
package electrosphere.renderer.hw;
/**
* Data about a monitor
*/
public class MonitorData {
/**
* The window id of the monitor
*/
public final long windowId;
/**
* The name of the monitor
*/
public final String name;
/**
* Constructor
* @param windowId The window id of the monitor
* @param name The name of the monitor
*/
public MonitorData(long windowId, String name){
this.windowId = windowId;
this.name = name;
}
}