-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Not attached to the name - Add SmoothLitVisual opt in interface, allowing any visuals to contribute light sections to the arena - Remove lightChunks from VisualEmbedding, it has been usurped - Pass total collected light sections from BEs, Es, and effects to the engine interface. It seemed the most proper way to hand off information from the impl to the backend - Add SmoothLitVisualStorage to maintain the set of collected sections, though at the moment it is very naive and simply unions everything upon request, which is also naively done every frame
- Loading branch information
Showing
14 changed files
with
132 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
common/src/api/java/dev/engine_room/flywheel/api/visual/SmoothLitVisual.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package dev.engine_room.flywheel.api.visual; | ||
|
||
import org.jetbrains.annotations.ApiStatus; | ||
|
||
import it.unimi.dsi.fastutil.longs.LongSet; | ||
|
||
public interface SmoothLitVisual extends Visual { | ||
/** | ||
* Set the section property object. | ||
* | ||
* <p>This method is only called once, upon visual creation, | ||
* | ||
* @param property The property. | ||
*/ | ||
void setSectionProperty(SectionProperty property); | ||
|
||
@ApiStatus.NonExtendable | ||
interface SectionProperty { | ||
/** | ||
* Invoke this to indicate to the impl that your visual has moved to a different set of sections. | ||
*/ | ||
void lightSections(LongSet sections); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...main/java/dev/engine_room/flywheel/impl/visualization/storage/SmoothLitVisualStorage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package dev.engine_room.flywheel.impl.visualization.storage; | ||
|
||
import java.util.Map; | ||
|
||
import dev.engine_room.flywheel.api.visual.SmoothLitVisual; | ||
import it.unimi.dsi.fastutil.longs.LongArraySet; | ||
import it.unimi.dsi.fastutil.longs.LongOpenHashSet; | ||
import it.unimi.dsi.fastutil.longs.LongSet; | ||
import it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap; | ||
|
||
public class SmoothLitVisualStorage { | ||
private final Map<SmoothLitVisual, SectionProperty> visuals = new Reference2ObjectOpenHashMap<>(); | ||
|
||
public LongSet sections() { | ||
var out = new LongOpenHashSet(); | ||
for (SectionProperty value : visuals.values()) { | ||
out.addAll(value.sections); | ||
} | ||
return out; | ||
} | ||
|
||
public void remove(SmoothLitVisual smoothLit) { | ||
visuals.remove(smoothLit); | ||
} | ||
|
||
public void add(SmoothLitVisual smoothLit) { | ||
var sections = new SectionProperty(); | ||
visuals.put(smoothLit, sections); | ||
smoothLit.setSectionProperty(sections); | ||
} | ||
|
||
public void clear() { | ||
visuals.clear(); | ||
} | ||
|
||
private static final class SectionProperty implements SmoothLitVisual.SectionProperty { | ||
private final LongSet sections = new LongArraySet(); | ||
|
||
@Override | ||
public void lightSections(LongSet sections) { | ||
this.sections.clear(); | ||
this.sections.addAll(sections); | ||
} | ||
} | ||
} |
Oops, something went wrong.