mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-28 00:34:19 +00:00
Replace fixed placement hooks with a module-owned stage graph
Modules now define every stage themselves through IrisModule.install(StageGraph): typed stage constants, hard requires(...) on other modules' constants, soft ordering by id, when(...) activation and typed outputs. Placement and chunk generation resolve on the same machinery; adjacent per-block stages fuse into one block pass. The host-defined PlacementModifier hooks, string Dependencies, GenerationPlan, PlacementPipeline, DependencyOrder and OccurrenceOrder are removed.
This commit is contained in:
1 parent
9043d93fbd
commit
eeb5486098
76 files changed
+2717
-1567
No files matched your search
@@ -1,52 +0,0 @@
|
||||
package com.volmit.generation;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import com.volmit.resource.ResourceId;
|
||||
|
||||
/** Immutable ordering declarations referencing modifier IDs, not feature IDs.
|
||||
* Requirements must exist and finish first. Optional constraints apply only when present.
|
||||
* Nothing here activates a feature. The host resolves and validates the graph at pack load.
|
||||
*/
|
||||
public record Dependencies(Set<String> required, Set<String> after, Set<String> before) {
|
||||
public Dependencies {
|
||||
required = validatedCopy(required);
|
||||
after = validatedCopy(after);
|
||||
before = validatedCopy(before);
|
||||
}
|
||||
|
||||
public static Dependencies none() {
|
||||
return new Dependencies(Set.of(), Set.of(), Set.of());
|
||||
}
|
||||
|
||||
public static Dependencies requires(String... ids) {
|
||||
return none().andRequires(ids);
|
||||
}
|
||||
|
||||
/** Adds required predecessors without changing this declaration. */
|
||||
public Dependencies andRequires(String... ids) {
|
||||
return new Dependencies(adding(required, ids), after, before);
|
||||
}
|
||||
|
||||
public Dependencies afterIfPresent(String... ids) {
|
||||
return new Dependencies(required, adding(after, ids), before);
|
||||
}
|
||||
|
||||
public Dependencies beforeIfPresent(String... ids) {
|
||||
return new Dependencies(required, after, adding(before, ids));
|
||||
}
|
||||
|
||||
private static Set<String> adding(Set<String> existing, String[] ids) {
|
||||
var result = new HashSet<>(existing);
|
||||
for (String id : ids) result.add(id);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static Set<String> validatedCopy(Set<String> ids) {
|
||||
var copy = Set.copyOf(ids);
|
||||
for (String id : copy) {
|
||||
ResourceId.parse(id);
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
package com.volmit.generation;
|
||||
|
||||
import com.volmit.hunk.Hunk;
|
||||
import com.volmit.mantle.Mantle;
|
||||
import com.volmit.config.FeatureSettings;
|
||||
import com.volmit.world.TerrainSampler;
|
||||
|
||||
/** Per-invocation state. Must not be retained by a modifier after execution. */
|
||||
/** Per-invocation chunk generation inputs. Must not be retained after execution. */
|
||||
public interface GenerationContext extends InvocationContext {
|
||||
/** World block coordinates corresponding to local volume coordinates (0, 0, 0). */
|
||||
int originX();
|
||||
@@ -16,4 +17,9 @@ public interface GenerationContext extends InvocationContext {
|
||||
|
||||
/** Non-null mantle access scoped to this invocation; the host owns its lifetime. */
|
||||
Mantle mantle();
|
||||
|
||||
/** The host-owned local volume of the given value type, shared by all stages of this
|
||||
* invocation. Unsupported types throw IllegalArgumentException.
|
||||
*/
|
||||
<T> Hunk<T> hunk(Class<T> type);
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package com.volmit.generation;
|
||||
|
||||
import com.volmit.hunk.Hunk;
|
||||
|
||||
/** Bound to one configured feature instance.
|
||||
* Calls may occur concurrently for different volumes. Keep settings read-only and temporary
|
||||
* state local to modify(). Exceptions propagate: the host must not publish partial output.
|
||||
*/
|
||||
public abstract class GenerationModifier<T> {
|
||||
/** Stable, nonblank namespaced modifier identity, independent of feature identity.
|
||||
* Configured instances of the same modifier share this ID and dependency declaration.
|
||||
* Different modifier implementations must not claim the same ID.
|
||||
*/
|
||||
public abstract String id();
|
||||
|
||||
/** Stable requirements read at pack load, not per invocation. Constructors must not
|
||||
* depend on prerequisite modifiers having run. Ordering does not guarantee that
|
||||
* a prerequisite changed blocks at the current location.
|
||||
*/
|
||||
public Dependencies depends() {
|
||||
return Dependencies.none();
|
||||
}
|
||||
|
||||
/** Nonnegative horizontal reach in blocks beyond the output footprint; zero by default.
|
||||
* Read once per configured instance at pack load. The host must prepare this area and
|
||||
* required predecessor work before invocation, bound vertical access to the world, and
|
||||
* serialize overlapping writes. It must reject negative or unsupported reach, not clip it.
|
||||
*/
|
||||
public int mantleRadius() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public abstract void modify(GenerationContext context, Hunk<T> output);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.volmit.generation;
|
||||
|
||||
import com.volmit.IrisFeature;
|
||||
|
||||
/** Connects a feature's decoded options to its executable modifier. */
|
||||
@FunctionalInterface
|
||||
public interface ModifierFactory<F extends IrisFeature, T> {
|
||||
GenerationModifier<T> create(F feature);
|
||||
}
|
||||
Reference in new issue
Block a user