slight improvements to select and simplerender
All checks were successful
/ Build BaseBand DSM & Broadway (push) Successful in 2m9s

This commit is contained in:
Daniella / Tove 2024-06-20 21:19:30 +02:00
parent 8dead855f2
commit 3d959cdf42
Signed by: TudbuT
GPG key ID: B3CF345217F202D3
2 changed files with 16 additions and 11 deletions

View file

@ -93,9 +93,9 @@ public class Select extends Feature {
int c = Features.getFeature(Client.class).theme.getGreenColor() | 0xff000000; int c = Features.getFeature(Client.class).theme.getGreenColor() | 0xff000000;
SimpleRender simpleRender = new SimpleRender(event.getPartialTicks()); SimpleRender simpleRender = new SimpleRender(event.getPartialTicks());
if(wireframe) if(wireframe)
simpleRender.color(c).lines().aabb(selection.toAABB()).back(); simpleRender.color(c).lines().aabb(selection.toAABB()).end();
if(fill) if(fill)
simpleRender.color(Pixels.mulTransparency(c, opacity)).quadsFill().aabb(selection.toAABB()).back(); simpleRender.color(Pixels.mulTransparency(c, opacity)).quadsFill().aabb(selection.toAABB()).end();
simpleRender.finish(); simpleRender.finish();
} }

View file

@ -80,7 +80,7 @@ public class SimpleRender {
} }
SimpleRenderBackend aabb(AxisAlignedBB box); SimpleRenderBackend aabb(AxisAlignedBB box);
SimplePolyMesh<?> mesh(); SimplePolyMesh<?> mesh();
SimpleRender back(); SimpleRender end();
} }
public class SimplePolyMesh<T extends SimpleRenderBackend> { public class SimplePolyMesh<T extends SimpleRenderBackend> {
@ -103,8 +103,8 @@ public class SimpleRender {
} }
} }
public class SimpleLinePolyMesh<T extends SimpleRenderBackend> extends SimplePolyMesh<T> { public class SimpleLineMesh<T extends SimpleRenderBackend> extends SimplePolyMesh<T> {
private SimpleLinePolyMesh(T parent) { private SimpleLineMesh(T parent) {
super(parent); super(parent);
} }
@ -112,7 +112,7 @@ public class SimpleRender {
double lx, ly, lz; double lx, ly, lz;
boolean b; boolean b;
@Override @Override
public SimpleLinePolyMesh<T> point(double x, double y, double z) { public SimpleLineMesh<T> point(double x, double y, double z) {
if(b) { if(b) {
put(lx, ly, lz); put(lx, ly, lz);
put(lx = x, ly = y, lz = z); put(lx = x, ly = y, lz = z);
@ -125,6 +125,11 @@ public class SimpleRender {
return this; return this;
} }
public SimpleLineMesh<T> breakPolygon() {
b = false;
return this;
}
@Override @Override
public T end() { public T end() {
if(b) { if(b) {
@ -135,7 +140,7 @@ public class SimpleRender {
} }
@Override @Override
public SimpleLinePolyMesh<T> next() { public SimpleLineMesh<T> next() {
if(b) { if(b) {
put(lx, ly, lz); put(lx, ly, lz);
put(fx, fy, fz); put(fx, fy, fz);
@ -158,7 +163,7 @@ public class SimpleRender {
} }
@Override @Override
public SimpleRender back() { public SimpleRender end() {
glEnd(); glEnd();
return SimpleRender.this; return SimpleRender.this;
} }
@ -198,12 +203,12 @@ public class SimpleRender {
} }
@Override @Override
public SimpleLinePolyMesh<SimpleLineBackend> mesh() { public SimpleLineMesh<SimpleLineBackend> mesh() {
return new SimpleLinePolyMesh<>(this); return new SimpleLineMesh<>(this);
} }
@Override @Override
public SimpleRender back() { public SimpleRender end() {
glEnd(); glEnd();
return SimpleRender.this; return SimpleRender.this;
} }