Continue setting up the DhApi Rendering events
This commit is contained in:
+3
-3
@@ -23,9 +23,9 @@ package com.seibel.lod.core.api.external.config.objects.enums;
|
||||
* Assembly classes are used to reference the package they are in.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-6-9
|
||||
* @version 2022-7-13
|
||||
*/
|
||||
public class DhApiEnumAssembly
|
||||
public class DhApiConfigEnumAssembly
|
||||
{
|
||||
public static final String API_ENUM_PREFIX = "EDhApi";
|
||||
|
||||
}
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package com.seibel.lod.core.api.external.data;
|
||||
|
||||
import com.seibel.lod.core.api.external.data.objects.DhApiTerrainDataPoint;
|
||||
import com.seibel.lod.core.api.external.sharedObjects.DhApiResult;
|
||||
import com.seibel.lod.core.api.external.shared.objects.DhApiResult;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package com.seibel.lod.core.api.external.events;
|
||||
|
||||
import com.seibel.lod.core.api.external.events.interfaces.IDhApiEvent;
|
||||
import com.seibel.lod.core.api.external.sharedObjects.DhApiResult;
|
||||
import com.seibel.lod.core.api.external.shared.objects.DhApiResult;
|
||||
|
||||
/**
|
||||
* Handles adding/removing event handlers.
|
||||
|
||||
Vendored
+6
-3
@@ -1,7 +1,7 @@
|
||||
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;
|
||||
import com.seibel.lod.core.api.external.shared.interfaces.IDhApiLevelWrapper;
|
||||
import com.seibel.lod.core.api.external.shared.objects.math.DhApiMat4f;
|
||||
|
||||
/**
|
||||
* @author James Seibel
|
||||
@@ -14,6 +14,9 @@ public interface IDhApiAfterRenderEvent extends IDhApiEvent
|
||||
*
|
||||
* @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);
|
||||
void afterRender(IDhApiLevelWrapper levelWrapper,
|
||||
DhApiMat4f mcModelViewMatrix, DhApiMat4f mcProjectionMatrix, // the matrices received from Minecraft
|
||||
DhApiMat4f dhModelViewMatrix, DhApiMat4f dhProjectionMatrix, // the matrices used by Distant Horizons
|
||||
float partialTicks, boolean renderingEnabled);
|
||||
|
||||
}
|
||||
Vendored
+10
-7
@@ -1,7 +1,7 @@
|
||||
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;
|
||||
import com.seibel.lod.core.api.external.shared.interfaces.IDhApiLevelWrapper;
|
||||
import com.seibel.lod.core.api.external.shared.objects.math.DhApiMat4f;
|
||||
|
||||
/**
|
||||
* @author James Seibel
|
||||
@@ -9,13 +9,16 @@ import com.seibel.lod.core.wrapperInterfaces.world.ILevelWrapper;
|
||||
*/
|
||||
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.
|
||||
* If this method returns false; DH's rendering will be skipped for that frame. <Br> <Br>
|
||||
*
|
||||
* The Matrices received are not passed on to the renderer and can be safely
|
||||
* edited without modifying Minecraft or Distant Horizons' rendering.
|
||||
*/
|
||||
boolean beforeRender(ILevelWrapper levelWrapper, Mat4f mcModelViewMatrix, Mat4f mcProjectionMatrix, float partialTicks);
|
||||
boolean beforeRender(IDhApiLevelWrapper levelWrapper,
|
||||
DhApiMat4f mcModelViewMatrix, DhApiMat4f mcProjectionMatrix, // the matrices received from Minecraft
|
||||
DhApiMat4f dhModelViewMatrix, DhApiMat4f dhProjectionMatrix, // the matrices used by Distant Horizons
|
||||
float partialTicks);
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
the shared package contains objects, interfaces, methods, etc. used by one or more api packages.
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||
* licensed under the GNU LGPL v3 License.
|
||||
*
|
||||
* Copyright (C) 2020-2022 James Seibel
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.core.api.external.shared.enums;
|
||||
|
||||
/**
|
||||
* Assembly classes are used to reference the package they are in.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-7-13
|
||||
*/
|
||||
public class DhApiSharedEnumAssembly
|
||||
{
|
||||
public static final String API_ENUM_PREFIX = "EDhApi";
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.seibel.lod.core.api.external.shared.enums;
|
||||
|
||||
/**
|
||||
* SERVER_LEVEL, <br>
|
||||
* CLIENT_LEVEL, <br>
|
||||
* UNKNOWN <br>
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-7-13
|
||||
*/
|
||||
public enum EDhApiLevelType
|
||||
{
|
||||
SERVER_LEVEL,
|
||||
CLIENT_LEVEL,
|
||||
UNKNOWN
|
||||
}
|
||||
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||
* licensed under the GNU LGPL v3 License.
|
||||
*
|
||||
* Copyright (C) 2020-2022 James Seibel
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.core.api.external.shared.interfaces;
|
||||
|
||||
/**
|
||||
* @author James Seibel
|
||||
* @version 2022-7-13
|
||||
*/
|
||||
public interface IDhApiDimensionTypeWrapper
|
||||
{
|
||||
String getDimensionName();
|
||||
|
||||
boolean hasCeiling();
|
||||
|
||||
boolean hasSkyLight();
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||
* licensed under the GNU LGPL v3 License.
|
||||
*
|
||||
* Copyright (C) 2020-2022 James Seibel
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.core.api.external.shared.interfaces;
|
||||
|
||||
import com.seibel.lod.core.api.external.shared.enums.EDhApiLevelType;
|
||||
|
||||
/**
|
||||
* Can be either a Server or Client level.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-7-13
|
||||
*/
|
||||
public interface IDhApiLevelWrapper
|
||||
{
|
||||
IDhApiDimensionTypeWrapper getDimensionType();
|
||||
|
||||
EDhApiLevelType getLevelType();
|
||||
|
||||
boolean hasCeiling();
|
||||
|
||||
boolean hasSkyLight();
|
||||
|
||||
int getHeight();
|
||||
|
||||
int getSeaLevel();
|
||||
|
||||
default short getMinHeight()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.seibel.lod.core.api.external.sharedObjects;
|
||||
package com.seibel.lod.core.api.external.shared.objects;
|
||||
|
||||
/**
|
||||
* Allows for more descriptive non-critical failure states.
|
||||
+171
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||
* licensed under the GNU LGPL v3 License.
|
||||
*
|
||||
* Copyright (C) 2020-2022 James Seibel
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.core.api.external.shared.objects.math;
|
||||
|
||||
/**
|
||||
* A simple way to store a 4x4 array
|
||||
* of floats without having to worry
|
||||
* about remembering which array is columns
|
||||
* and which one is rows.
|
||||
* <br>
|
||||
* Based on Minecraft 1.16's implementation
|
||||
* of a 4x4 matrix.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-7-13
|
||||
*/
|
||||
public class DhApiMat4f
|
||||
{
|
||||
private float m00;
|
||||
private float m01;
|
||||
private float m02;
|
||||
private float m03;
|
||||
private float m10;
|
||||
private float m11;
|
||||
private float m12;
|
||||
private float m13;
|
||||
private float m20;
|
||||
private float m21;
|
||||
private float m22;
|
||||
private float m23;
|
||||
private float m30;
|
||||
private float m31;
|
||||
private float m32;
|
||||
private float m33;
|
||||
|
||||
|
||||
public DhApiMat4f()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public DhApiMat4f(DhApiMat4f sourceMatrix)
|
||||
{
|
||||
this.m00 = sourceMatrix.m00;
|
||||
this.m01 = sourceMatrix.m01;
|
||||
this.m02 = sourceMatrix.m02;
|
||||
this.m03 = sourceMatrix.m03;
|
||||
this.m10 = sourceMatrix.m10;
|
||||
this.m11 = sourceMatrix.m11;
|
||||
this.m12 = sourceMatrix.m12;
|
||||
this.m13 = sourceMatrix.m13;
|
||||
this.m20 = sourceMatrix.m20;
|
||||
this.m21 = sourceMatrix.m21;
|
||||
this.m22 = sourceMatrix.m22;
|
||||
this.m23 = sourceMatrix.m23;
|
||||
this.m30 = sourceMatrix.m30;
|
||||
this.m31 = sourceMatrix.m31;
|
||||
this.m32 = sourceMatrix.m32;
|
||||
this.m33 = sourceMatrix.m33;
|
||||
}
|
||||
|
||||
|
||||
public DhApiMat4f(float[] values)
|
||||
{
|
||||
m00 = values[0];
|
||||
m01 = values[1];
|
||||
m02 = values[2];
|
||||
m03 = values[3];
|
||||
m10 = values[4];
|
||||
m11 = values[5];
|
||||
m12 = values[6];
|
||||
m13 = values[7];
|
||||
m20 = values[8];
|
||||
m21 = values[9];
|
||||
m22 = values[10];
|
||||
m23 = values[11];
|
||||
m30 = values[12];
|
||||
m31 = values[13];
|
||||
m32 = values[14];
|
||||
m33 = values[15];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (this == obj)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (obj != null && this.getClass() == obj.getClass())
|
||||
{
|
||||
DhApiMat4f otherMatrix = (DhApiMat4f) obj;
|
||||
return Float.compare(otherMatrix.m00, this.m00) == 0
|
||||
&& Float.compare(otherMatrix.m01, this.m01) == 0
|
||||
&& Float.compare(otherMatrix.m02, this.m02) == 0
|
||||
&& Float.compare(otherMatrix.m03, this.m03) == 0
|
||||
&& Float.compare(otherMatrix.m10, this.m10) == 0
|
||||
&& Float.compare(otherMatrix.m11, this.m11) == 0
|
||||
&& Float.compare(otherMatrix.m12, this.m12) == 0
|
||||
&& Float.compare(otherMatrix.m13, this.m13) == 0
|
||||
&& Float.compare(otherMatrix.m20, this.m20) == 0
|
||||
&& Float.compare(otherMatrix.m21, this.m21) == 0
|
||||
&& Float.compare(otherMatrix.m22, this.m22) == 0
|
||||
&& Float.compare(otherMatrix.m23, this.m23) == 0
|
||||
&& Float.compare(otherMatrix.m30, this.m30) == 0
|
||||
&& Float.compare(otherMatrix.m31, this.m31) == 0
|
||||
&& Float.compare(otherMatrix.m32, this.m32) == 0
|
||||
&& Float.compare(otherMatrix.m33, this.m33) == 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
int i = this.m00 != 0.0F ? Float.floatToIntBits(this.m00) : 0;
|
||||
i = 31 * i + (this.m01 != 0.0F ? Float.floatToIntBits(this.m01) : 0);
|
||||
i = 31 * i + (this.m02 != 0.0F ? Float.floatToIntBits(this.m02) : 0);
|
||||
i = 31 * i + (this.m03 != 0.0F ? Float.floatToIntBits(this.m03) : 0);
|
||||
i = 31 * i + (this.m10 != 0.0F ? Float.floatToIntBits(this.m10) : 0);
|
||||
i = 31 * i + (this.m11 != 0.0F ? Float.floatToIntBits(this.m11) : 0);
|
||||
i = 31 * i + (this.m12 != 0.0F ? Float.floatToIntBits(this.m12) : 0);
|
||||
i = 31 * i + (this.m13 != 0.0F ? Float.floatToIntBits(this.m13) : 0);
|
||||
i = 31 * i + (this.m20 != 0.0F ? Float.floatToIntBits(this.m20) : 0);
|
||||
i = 31 * i + (this.m21 != 0.0F ? Float.floatToIntBits(this.m21) : 0);
|
||||
i = 31 * i + (this.m22 != 0.0F ? Float.floatToIntBits(this.m22) : 0);
|
||||
i = 31 * i + (this.m23 != 0.0F ? Float.floatToIntBits(this.m23) : 0);
|
||||
i = 31 * i + (this.m30 != 0.0F ? Float.floatToIntBits(this.m30) : 0);
|
||||
i = 31 * i + (this.m31 != 0.0F ? Float.floatToIntBits(this.m31) : 0);
|
||||
i = 31 * i + (this.m32 != 0.0F ? Float.floatToIntBits(this.m32) : 0);
|
||||
return 31 * i + (this.m33 != 0.0F ? Float.floatToIntBits(this.m33) : 0);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "Matrix4f:\n" +
|
||||
this.m00 + " " + this.m01 + " " + this.m02 + " " + this.m03 + "\n" +
|
||||
this.m10 + " " + this.m11 + " " + this.m12 + " " + this.m13 + "\n" +
|
||||
this.m20 + " " + this.m21 + " " + this.m22 + " " + this.m23 + "\n" +
|
||||
this.m30 + " " + this.m31 + " " + this.m32 + " " + this.m33 + "\n";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
the sharedObjects package contains objects used by one or more different api packages.
|
||||
@@ -20,14 +20,16 @@
|
||||
package com.seibel.lod.core.enums;
|
||||
|
||||
/**
|
||||
* ServerWorld, ClientWorld, Unknown
|
||||
*
|
||||
* SERVER_LEVEL, <br>
|
||||
* CLIENT_LEVEL, <br>
|
||||
* UNKNOWN <br>
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 11-12-2021
|
||||
* @version 2022-7-13
|
||||
*/
|
||||
public enum ELevelType
|
||||
{
|
||||
ServerLevel,
|
||||
ClientLevel,
|
||||
Unknown
|
||||
SERVER_LEVEL,
|
||||
CLIENT_LEVEL,
|
||||
UNKNOWN
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ package com.seibel.lod.core.objects.math;
|
||||
import java.nio.FloatBuffer;
|
||||
|
||||
/**
|
||||
* A (almost) exact copy of Minecraft's 1.16.5
|
||||
* An (almost) exact copy of Minecraft's 1.16.5
|
||||
* implementation of a 4x4 float matrix.
|
||||
*
|
||||
* @author James Seibel
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import com.seibel.lod.core.api.external.config.objects.enums.DhApiEnumAssembly;
|
||||
import com.seibel.lod.core.api.external.config.objects.enums.DhApiConfigEnumAssembly;
|
||||
import com.seibel.lod.core.api.external.shared.enums.DhApiSharedEnumAssembly;
|
||||
import com.seibel.lod.core.enums.rendering.EFogDrawMode;
|
||||
import com.seibel.lod.core.enums.CoreEnumAssembly;
|
||||
import com.seibel.lod.core.enums.config.EVerticalQuality;
|
||||
@@ -66,16 +67,25 @@ public class ApiEnumSyncTests
|
||||
//================//
|
||||
|
||||
// make sure the enum packages are loaded
|
||||
new DhApiEnumAssembly();
|
||||
new DhApiConfigEnumAssembly();
|
||||
new DhApiSharedEnumAssembly();
|
||||
new CoreEnumAssembly();
|
||||
|
||||
// get the list of API enums
|
||||
ArrayList<Class<? extends Enum<?>>> apiEnumClassList = new ArrayList<>();
|
||||
ArrayList<String> apiEnumPackageNames = EnumTestHelper.findPackageNamesStartingWith(DhApiEnumAssembly.class.getPackage().getName());
|
||||
for (String apiEnumPackageName : apiEnumPackageNames)
|
||||
// get the config enums
|
||||
ArrayList<String> apiConfigEnumPackageNames = EnumTestHelper.findPackageNamesStartingWith(DhApiConfigEnumAssembly.class.getPackage().getName());
|
||||
for (String apiEnumPackageName : apiConfigEnumPackageNames)
|
||||
{
|
||||
apiEnumClassList.addAll(EnumTestHelper.getAllEnumsFromPackage(apiEnumPackageName));
|
||||
}
|
||||
// get the shared enums
|
||||
ArrayList<String> apiSharedEnumPackageNames = EnumTestHelper.findPackageNamesStartingWith(DhApiSharedEnumAssembly.class.getPackage().getName());
|
||||
for (String apiEnumPackageName : apiSharedEnumPackageNames)
|
||||
{
|
||||
apiEnumClassList.addAll(EnumTestHelper.getAllEnumsFromPackage(apiEnumPackageName));
|
||||
}
|
||||
|
||||
|
||||
// get the list of core enums
|
||||
ArrayList<Class<? extends Enum<?>>> coreEnumClassList = new ArrayList<>();
|
||||
@@ -93,7 +103,7 @@ public class ApiEnumSyncTests
|
||||
// compare each API enum to its corresponding Core enum
|
||||
for (Class<? extends Enum<?>> apiEnumClass : apiEnumClassList)
|
||||
{
|
||||
String coreEnumName = CoreEnumAssembly.ENUM_PREFIX + apiEnumClass.getSimpleName().substring(DhApiEnumAssembly.API_ENUM_PREFIX.length());
|
||||
String coreEnumName = CoreEnumAssembly.ENUM_PREFIX + apiEnumClass.getSimpleName().substring(DhApiSharedEnumAssembly.API_ENUM_PREFIX.length());
|
||||
boolean coreEnumFound = false;
|
||||
|
||||
// find the core enum to compare against
|
||||
|
||||
Reference in New Issue
Block a user