Create/src/main/java/com/simibubi/create/content/schematics/client/tools/RotateTool.java
PepperCode1 d4106d545b Rewrite outline buffering
- Outline buffering now uses Vector3f instead of Vec3 to avoid creating
many objects and double to float casts
- Remove OutlineParams.transformNormals since it was not used
- Rename OutlineParams#disableNormals to disableLineNormals since only
lines have normals disabled
- Fix seats not having descriptions
2023-03-10 16:10:47 -08:00

45 lines
1.3 KiB
Java

package com.simibubi.create.content.schematics.client.tools;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.foundation.utility.outliner.LineOutline;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
public class RotateTool extends PlacementToolBase {
private LineOutline line = new LineOutline();
@Override
public boolean handleMouseWheel(double delta) {
schematicHandler.getTransformation()
.rotate90(delta > 0);
schematicHandler.markDirty();
return true;
}
@Override
public void renderOnSchematic(PoseStack ms, SuperRenderTypeBuffer buffer) {
AABB bounds = schematicHandler.getBounds();
double height = bounds.getYsize() + Math.max(20, bounds.getYsize());
Vec3 center = bounds.getCenter()
.add(schematicHandler.getTransformation()
.getRotationOffset(false));
Vec3 start = center.subtract(0, height / 2, 0);
Vec3 end = center.add(0, height / 2, 0);
line.getParams()
.disableCull()
.disableLineNormals()
.colored(0xdddddd)
.lineWidth(1 / 16f);
line.set(start, end)
.render(ms, buffer, AnimationTickHolder.getPartialTicks());
super.renderOnSchematic(ms, buffer);
}
}