Add a flag to StateAwareTesselator for per-quad directional shading (#1989)

* Add a flag for no directional shading

* Mark StateAwareTessellator as an API

* Reset internal state better
This commit is contained in:
ah-OOG-ah authored and GitHub committed 2026-08-19 18:16:04 +00:00
1 parent 096dd01446
commit 6d8cbf9c2f
3 files changed
+26 -12

No files matched your search

@@ -1,18 +1,20 @@
package com.gtnewhorizons.angelica.rendering;
/// Despite not in the `api` package, this interface is used by GT5uNH and GTNHLib, possibly others. Be careful what you
/// change!
@SuppressWarnings("unused")
public interface StateAwareTessellator {
/**
* True if the vertex originated from a RenderBlocks method call with the enableAO flag set.
*/
/// True if the vertex originated from a RenderBlocks method call with the enableAO flag set.
int RENDERED_WITH_VANILLA_AO = 0x1;
int NO_DIRECTIONAL_SHADING = 0x2;
void angelica$setAppliedAo(boolean flag);
void angelica$setNoDirectionalShading(boolean flag);
/**
* Sets whether we're doing terrain meshing as part of celeritas -- collects additional information.
*
* Enables per-vertex AO state collection into {@link #angelica$getVertexStates()}.
*/
/// Sets whether we're doing terrain meshing as part of celeritas -- collects additional information.
///
/// Enables per-vertex AO state collection into [#angelica$getVertexStates()].
void angelica$setCeleritasMeshing(boolean active);
int[] angelica$getVertexStates();
@@ -1,5 +1,7 @@
package com.gtnewhorizons.angelica.rendering.celeritas;
import static com.gtnewhorizons.angelica.rendering.StateAwareTessellator.NO_DIRECTIONAL_SHADING;
import com.gtnewhorizons.angelica.api.ExtQuadLightData;
import com.gtnewhorizons.angelica.api.TintComputer;
import com.gtnewhorizons.angelica.api.TintRegistry;
@@ -209,7 +211,7 @@ public class AngelicaChunkBuildContext extends ChunkBuildContext {
// specified its own lightmaps for visual purposes (e.g. fullbright)
if (useAoCalculation && (quadState & StateAwareTessellator.RENDERED_WITH_VANILLA_AO) != 0) {
calculateQuadLight(trueNormal, blockX, blockY, blockZ, worldX, worldY, worldZ, isFluid,
blockAllowsSmoothLighting, shouldApplyDiffuse);
blockAllowsSmoothLighting, shouldApplyDiffuse && (quadState & NO_DIRECTIONAL_SHADING) == 0);
for (int vIdx = 0; vIdx < 4; vIdx++) {
final var vertex = vertices[vIdx];