Improve IDhApi Render events

This commit is contained in:
James Seibel
2022-07-13 21:24:11 -05:00
parent e04f1d9dd5
commit 4f6433ee0f
5 changed files with 43 additions and 33 deletions
@@ -5,7 +5,6 @@ import com.seibel.lod.core.api.external.sharedObjects.DhApiResult;
/**
* Handles adding/removing event handlers.
* Based off of JQuery's event system.
*
* @author James Seibel
* @version 2022-7-13
@@ -1 +1,3 @@
The events api package holds objects and methods for listening to events fired by Distant Horizons'.
The events api package holds objects and methods for listening to events fired by Distant Horizons'.
Each interface should only contain one method and that method should match the name of the file. This is done so Developers can mix and match what events they want their classes to handle.
@@ -0,0 +1,19 @@
package com.seibel.lod.core.api.external.events.interfaces;
import com.seibel.lod.core.objects.math.Mat4f;
import com.seibel.lod.core.wrapperInterfaces.world.ILevelWrapper;
/**
* @author James Seibel
* @version 2022-7-13
*/
public interface IDhApiAfterRenderEvent extends IDhApiEvent
{
/**
* Called after Distant Horizons' rendering pipeline finishes.
*
* @param renderingEnabled Passes in false if DH rendering was disabled or canceled for this frame.
*/
void afterRender(ILevelWrapper levelWrapper, Mat4f mcModelViewMatrix, Mat4f mcProjectionMatrix, float partialTicks, boolean renderingEnabled);
}
@@ -0,0 +1,21 @@
package com.seibel.lod.core.api.external.events.interfaces;
import com.seibel.lod.core.objects.math.Mat4f;
import com.seibel.lod.core.wrapperInterfaces.world.ILevelWrapper;
/**
* @author James Seibel
* @version 2022-7-13
*/
public interface IDhApiBeforeRenderEvent extends IDhApiEvent
{
// TODO should we allow editing the levelWrapper MVM matrix, etc.?
// TODO make sure to document it either way.
/**
* Called before Distant Horizons starts rendering. <Br>
* If this methods returns false, DH's rendering will be skipped for that frame.
*/
boolean beforeRender(ILevelWrapper levelWrapper, Mat4f mcModelViewMatrix, Mat4f mcProjectionMatrix, float partialTicks);
}
@@ -1,31 +0,0 @@
package com.seibel.lod.core.api.external.events.interfaces;
import com.seibel.lod.core.objects.math.Mat4f;
import com.seibel.lod.core.wrapperInterfaces.world.ILevelWrapper;
/**
* Event handler for when Distant Horizons
* starts and finishes rendering
*
* @author James Seibel
* @version 2022-7-13
*/
public interface IDhApiRenderEvent extends IDhApiEvent
{
// TODO should we allow editing the levelWrapper MVM matrix, etc.?
// TODO make sure to document it either way.
/**
* Called before Distant Horizons starts rendering. <Br>
* If this methods returns false DH's rendering will be skipped for that frame.
*/
public boolean beforeRender(ILevelWrapper levelWrapper, Mat4f mcModelViewMatrix, Mat4f mcProjectionMatrix, float partialTicks);
/**
* Called after Distant Horizons finishes rendering.
* If DH has rendering disabled or beforeRender //TODO Link
* canceled the rendering this event will not fire.
*/
public void afterRender(ILevelWrapper levelWrapper, Mat4f mcModelViewMatrix, Mat4f mcProjectionMatrix, float partialTicks);
}