document openGL interfaces not used on Blaze3D
Also add API logic to determine if DH is handling the rendering natively or using an interpretation layer
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
|
||||
package com.seibel.distanthorizons.core.render;
|
||||
|
||||
import com.seibel.distanthorizons.api.enums.config.EDhApiRenderApi;
|
||||
import com.seibel.distanthorizons.api.interfaces.render.IDhApiRenderProxy;
|
||||
import com.seibel.distanthorizons.api.objects.DhApiResult;
|
||||
import com.seibel.distanthorizons.core.api.internal.SharedApi;
|
||||
@@ -28,6 +29,8 @@ import com.seibel.distanthorizons.core.level.IDhLevel;
|
||||
import com.seibel.distanthorizons.core.util.RenderUtil;
|
||||
import com.seibel.distanthorizons.core.world.AbstractDhWorld;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.render.AbstractDhRenderApiDefinition;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Used to interact with Distant Horizons' rendering systems.
|
||||
@@ -43,6 +46,18 @@ public class DhApiRenderProxy implements IDhApiRenderProxy
|
||||
|
||||
private boolean deferTransparentRendering = false;
|
||||
|
||||
private static AbstractDhRenderApiDefinition renderApiDef = null;
|
||||
@Nullable
|
||||
private static AbstractDhRenderApiDefinition tryGetApiDef()
|
||||
{
|
||||
if (renderApiDef == null)
|
||||
{
|
||||
renderApiDef = SingletonInjector.INSTANCE.get(AbstractDhRenderApiDefinition.class);
|
||||
}
|
||||
|
||||
return renderApiDef;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=============//
|
||||
@@ -57,6 +72,7 @@ public class DhApiRenderProxy implements IDhApiRenderProxy
|
||||
// methods //
|
||||
//=========//
|
||||
|
||||
@Override
|
||||
public DhApiResult<Boolean> clearRenderDataCache()
|
||||
{
|
||||
// make sure this is a valid time to run the method
|
||||
@@ -80,6 +96,32 @@ public class DhApiRenderProxy implements IDhApiRenderProxy
|
||||
return DhApiResult.createSuccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EDhApiRenderApi getRenderingApi() throws IllegalStateException
|
||||
{
|
||||
AbstractDhRenderApiDefinition apiDef = tryGetApiDef();
|
||||
if (apiDef == null)
|
||||
{
|
||||
// The rendering API hasn't been set up yet
|
||||
throw new IllegalStateException("Distant Horizons hasn't finished setup yet. No renderer has been set.");
|
||||
}
|
||||
|
||||
return apiDef.getRenderApi();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNativeRenderer() throws IllegalStateException
|
||||
{
|
||||
AbstractDhRenderApiDefinition apiDef = tryGetApiDef();
|
||||
if (apiDef == null)
|
||||
{
|
||||
// The rendering API hasn't been set up yet
|
||||
throw new IllegalStateException("Distant Horizons hasn't finished setup yet. No renderer has been set.");
|
||||
}
|
||||
|
||||
return apiDef.isNativeRenderer();
|
||||
}
|
||||
|
||||
|
||||
public static int activeOpenGlDhDepthTextureId = -1;
|
||||
@Override
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
package com.seibel.distanthorizons.core.render;
|
||||
|
||||
/**
|
||||
* VULKAN, <br>
|
||||
* OPEN_GL, <br>
|
||||
*/
|
||||
public enum EDhRenderApi
|
||||
{
|
||||
VULKAN,
|
||||
OPEN_GL;
|
||||
|
||||
}
|
||||
+2
-2
@@ -21,9 +21,9 @@ package com.seibel.distanthorizons.core.wrapperInterfaces.minecraft;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import com.seibel.distanthorizons.api.enums.config.EDhApiRenderApi;
|
||||
import com.seibel.distanthorizons.core.api.internal.rendering.DhRenderState;
|
||||
import com.seibel.distanthorizons.core.enums.EDhDirection;
|
||||
import com.seibel.distanthorizons.core.render.EDhRenderApi;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.misc.ILightMapWrapper;
|
||||
import com.seibel.distanthorizons.coreapi.interfaces.dependencyInjection.IBindable;
|
||||
import com.seibel.distanthorizons.core.util.math.Vec3d;
|
||||
@@ -77,7 +77,7 @@ public interface IMinecraftRenderWrapper extends IBindable
|
||||
boolean mcRendersToFrameBuffer();
|
||||
boolean runningLegacyOpenGL();
|
||||
/** Returns the API Minecraft is currently using for rendering */
|
||||
EDhRenderApi getMcRenderingApi();
|
||||
EDhApiRenderApi getMcRenderingApi();
|
||||
|
||||
/** @return -1 if no valid framebuffer is available yet */
|
||||
int getTargetFramebuffer(); // Note: Iris is now hooking onto this for DH + Iris compat, try not to change (unless we wanna deal with some annoyances)
|
||||
|
||||
+12
-2
@@ -1,8 +1,8 @@
|
||||
package com.seibel.distanthorizons.core.wrapperInterfaces.render;
|
||||
|
||||
import com.seibel.distanthorizons.api.enums.config.EDhApiRenderApi;
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.core.jar.EPlatform;
|
||||
import com.seibel.distanthorizons.core.render.EDhRenderApi;
|
||||
import com.seibel.distanthorizons.core.render.EDhRenderDepth;
|
||||
import com.seibel.distanthorizons.core.render.renderer.AbstractDebugWireframeRenderer;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.render.objects.IDhGenericObjectVertexBufferContainer;
|
||||
@@ -32,7 +32,17 @@ public abstract class AbstractDhRenderApiDefinition implements IBindable
|
||||
public boolean useSingleIbo() { return this.useSingleIbo; }
|
||||
|
||||
public abstract EDhRenderDepth getRenderDepth();
|
||||
public abstract EDhRenderApi getRenderApi();
|
||||
/** will not return {@link EDhApiRenderApi#AUTO} */
|
||||
public abstract EDhApiRenderApi getRenderApi();
|
||||
/**
|
||||
* Returns true if the current renderer
|
||||
* is calling the base rendering API's method calls. <br>
|
||||
* ie GL.drawArrays() for OpenGL. <Br><br>
|
||||
*
|
||||
* If DH is using Blaze3D (Mojang's rendering API)
|
||||
* this will return false.
|
||||
*/
|
||||
public abstract boolean isNativeRenderer();
|
||||
|
||||
//endregion
|
||||
|
||||
|
||||
Reference in New Issue
Block a user