Fix height fog

This commit is contained in:
James Seibel
2024-11-09 20:58:45 -06:00
parent 52452e356d
commit 6413725eae
12 changed files with 513 additions and 660 deletions
@@ -25,7 +25,7 @@ package com.seibel.distanthorizons.api.enums.rendering;
* EXPONENTIAL_SQUARED <br>
*
* @author Leetom
* @version 2022-6-30
* @version 2024-11-09
* @since API 2.0.0
*/
public enum EDhApiFogFalloff
@@ -35,8 +35,17 @@ public enum EDhApiFogFalloff
// when removing items up the API major version
LINEAR,
EXPONENTIAL,
EXPONENTIAL_SQUARED,
LINEAR(0),
EXPONENTIAL(1),
EXPONENTIAL_SQUARED(2);
/**
* Stable version of {@link EDhApiFogFalloff#ordinal()}
* @since API 4.0.0
*/
public final int value;
EDhApiFogFalloff(int value) { this.value = value; }
}
@@ -31,28 +31,28 @@ package com.seibel.distanthorizons.api.enums.rendering;
* @version 2024-4-6
* @since API 2.0.0
*/
public enum EDhApiHeightFogMode
public enum EDhApiHeightFogDirection
{
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
ABOVE_CAMERA(true, true, false),
BELOW_CAMERA(true, false, true),
ABOVE_AND_BELOW_CAMERA(true, true, true),
ABOVE_SET_HEIGHT(false, true, false),
BELOW_SET_HEIGHT(false, false, true),
ABOVE_AND_BELOW_SET_HEIGHT(false, true, true);
ABOVE_CAMERA (true, true, false),
BELOW_CAMERA (true, false, true),
ABOVE_AND_BELOW_CAMERA (true, true, true),
ABOVE_SET_HEIGHT (false, true, false),
BELOW_SET_HEIGHT (false, false, true),
ABOVE_AND_BELOW_SET_HEIGHT (false, true, true);
public final boolean basedOnCamera;
public final boolean above;
public final boolean below;
public final boolean fogAppliesUp;
public final boolean fogAppliesDown;
EDhApiHeightFogMode(boolean basedOnCamera, boolean above, boolean below)
EDhApiHeightFogDirection(boolean basedOnCamera, boolean fogAppliesUp, boolean fogAppliesDown)
{
this.basedOnCamera = basedOnCamera;
this.above = above;
this.below = below;
this.fogAppliesUp = fogAppliesUp;
this.fogAppliesDown = fogAppliesDown;
}
}
@@ -20,10 +20,11 @@
package com.seibel.distanthorizons.api.enums.rendering;
/**
* BASIC <br>
* IGNORE_HEIGHT <br>
* ADDITION <br>
* SPHERICAL <br>
* CYLINDRICAL <br>
* <br>
* MAX <br>
* ADDITION <br>
* MULTIPLY <br>
* INVERSE_MULTIPLY <br>
* LIMITED_ADDITION <br>
@@ -37,14 +38,36 @@ package com.seibel.distanthorizons.api.enums.rendering;
*/
public enum EDhApiHeightFogMixMode
{
BASIC,
IGNORE_HEIGHT,
ADDITION,
MAX,
MULTIPLY,
INVERSE_MULTIPLY,
LIMITED_ADDITION,
MULTIPLY_ADDITION,
INVERSE_MULTIPLY_ADDITION,
AVERAGE,
/**
* Basic just means the fog will be based on the fragment depth
* not on any special height calculation IE spherical fog. <br><br>
*
* Not to be confused with {@link EDhApiHeightFogMixMode#CYLINDRICAL}
* which causes fog to only apply based on horizontal distance.
*/
SPHERICAL(0),
/**
* Fog is applied based on horizontal distance from the camera,
* IE cylindrical fog.
*/
CYLINDRICAL(1),
MAX(2),
ADDITION(3),
MULTIPLY(4),
INVERSE_MULTIPLY(5),
LIMITED_ADDITION(6),
MULTIPLY_ADDITION(7),
INVERSE_MULTIPLY_ADDITION(8),
AVERAGE(9);
/**
* Stable version of {@link EDhApiFogFalloff#ordinal()}
* @since API 4.0.0
*/
public final int value;
EDhApiHeightFogMixMode(int value) { this.value = value; }
}
@@ -21,7 +21,7 @@ package com.seibel.distanthorizons.api.interfaces.config.client;
import com.seibel.distanthorizons.api.enums.rendering.EDhApiFogFalloff;
import com.seibel.distanthorizons.api.enums.rendering.EDhApiHeightFogMixMode;
import com.seibel.distanthorizons.api.enums.rendering.EDhApiHeightFogMode;
import com.seibel.distanthorizons.api.enums.rendering.EDhApiHeightFogDirection;
import com.seibel.distanthorizons.api.interfaces.config.IDhApiConfigGroup;
import com.seibel.distanthorizons.api.interfaces.config.IDhApiConfigValue;
@@ -42,11 +42,14 @@ public interface IDhApiHeightFogConfig extends IDhApiConfigGroup
/** Defines how the height fog mixes. */
IDhApiConfigValue<EDhApiHeightFogMixMode> heightFogMixMode();
/** Defines how the height fog is drawn relative to the camera or world. */
IDhApiConfigValue<EDhApiHeightFogMode> heightFogMode();
/**
* Defines which direction height fog is drawn relative to the world.
* @since API 4.0.0
*/
IDhApiConfigValue<EDhApiHeightFogDirection> heightFogDirection();
/**
* Defines the height fog's base height if {@link IDhApiHeightFogConfig#heightFogMode()}
* Defines the height fog's base height if {@link IDhApiHeightFogConfig#heightFogDirection()}
* is set to use a specific height.
*/
IDhApiConfigValue<Double> heightFogBaseHeight();