-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(JOML): migrate joml for BlockRegion #4
Conversation
@@ -131,7 +132,7 @@ public void placeDoor(ActivateEvent event, EntityRef entity) { | |||
if (!blockEvent.isConsumed()) { | |||
EntityRef newDoor = entityManager.create(door.doorRegionPrefab); | |||
entity.removeComponent(MeshComponent.class); | |||
newDoor.addComponent(new BlockRegionComponent(Region3i.createBounded(bottomBlockPos, topBlockPos))); | |||
newDoor.addComponent(new BlockRegionComponent(new BlockRegion().union(JomlUtil.from(bottomBlockPos)).union(JomlUtil.from(topBlockPos)))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll introduce BlockRegions.encompassing(...)
which could be used here.
Block bottomBlock = door.bottomBlockFamily.getBlockForPlacement(new BlockPlacementData(regionComp.region.getMin(new org.joml.Vector3i()), newSide, new org.joml.Vector3f(Side.TOP.direction()))); | ||
worldProvider.setBlock(regionComp.region.getMin(new org.joml.Vector3i()), bottomBlock); | ||
Block topBlock = door.topBlockFamily.getBlockForPlacement(new BlockPlacementData(regionComp.region.getMax(new org.joml.Vector3i()), newSide, new org.joml.Vector3f(Side.TOP.direction()))); | ||
worldProvider.setBlock(regionComp.region.getMax(new org.joml.Vector3i()), topBlock); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're basically creating the same immutable vectors twice here 🤔 I think this should be joml-ified by making better use of vector allocation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable. Would approve if I could (PR creator and stuff).
PR: MovingBlocks/Terasology#4296