Skip to content

Commit

Permalink
Merge branch 'model_scale_fixes' into integration
Browse files Browse the repository at this point in the history
  • Loading branch information
cam72cam committed Sep 13, 2023
2 parents 9fb8130 + 27a7d7c commit 003279b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ public float getRearYaw(EntityMoveableRollingStock stock) {
}

protected void postRender(ENTITY stock, RenderState state) {
state.scale(stock.gauge.scale(), stock.gauge.scale(), stock.gauge.scale());
state.rotate(sway.getRollDegrees(stock), 1, 0, 0);
controls.forEach(c -> c.postRender(stock, state));
doors.forEach(c -> c.postRender(stock, state));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,8 @@ public void postRender(T stock, RenderState state) {
}
}

Matrix4 m = new Matrix4().scale(stock.gauge.scale(), stock.gauge.scale(), stock.gauge.scale());
Matrix4 gm = this.state.getGroupMatrix(stock, modelId);
if (gm != null) {
m = m.multiply(gm);
}
Vec3d pos = m.apply(center);
Matrix4 m = this.state.getGroupMatrix(stock, modelId);
Vec3d pos = m == null ? center : m.apply(center);
String labelstate = "";
float percent = getValue(stock) - offset;
switch (part.type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public void postRender(T stock, RenderState state) {
return;
}

Vec3d flareOffset = new Vec3d(forward ? component.min.x - 0.02 : component.max.x + 0.02, (component.min.y + component.max.y) / 2, (component.min.z + component.max.z) / 2);//.scale(stock.gauge.scale());
Vec3d flareOffset = new Vec3d(forward ? component.min.x - 0.02 : component.max.x + 0.02, (component.min.y + component.max.y) / 2, (component.min.z + component.max.z) / 2);;
if (location != null) {
// TODO this does not actually work
Matrix4 m = location.apply(stock);
Expand All @@ -169,9 +169,9 @@ public void postRender(T stock, RenderState state) {

if (intensity > 0.01) {
RenderState matrix = state.clone();
matrix.translate(flareOffset.x - (intensity / 2 /* * stock.gauge.scale()*/)*(forward ? 3 : -3), flareOffset.y, flareOffset.z);
matrix.translate(flareOffset.x - (intensity / 2)*(forward ? 3 : -3), flareOffset.y, flareOffset.z);
matrix.rotate(90, 0, 1, 0);
double scale = Math.max((component.max.z - component.min.z) * 0.5, intensity * 2) /* * stock.gauge.scale()*/;
double scale = Math.max((component.max.z - component.min.z) * 0.5, intensity * 2);
matrix.scale(scale, scale, scale);
if (!forward) {
matrix.rotate(180, 0, 1, 0);
Expand All @@ -190,7 +190,7 @@ public void postRender(T stock, RenderState state) {
RenderState matrix = state.clone();
matrix.translate(flareOffset.x, flareOffset.y, flareOffset.z);
matrix.rotate(90, 0, 1, 0);
double scale = (component.max.z - component.min.z) / 1.5 /* * stock.gauge.scale()*/;
double scale = (component.max.z - component.min.z) / 1.5;
matrix.scale(scale, scale, scale);
if (!forward) {
matrix.rotate(180, 0, 1, 0);
Expand Down

0 comments on commit 003279b

Please sign in to comment.