Skip to content

Commit

Permalink
small performance changes
Browse files Browse the repository at this point in the history
This shouldn't be noticeable to anyone, but it's technically better.
  • Loading branch information
EternalBlueFlame committed May 22, 2024
1 parent 0c30f02 commit 132f569
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
11 changes: 4 additions & 7 deletions src/main/java/fexcraft/tmt/slim/ModelRendererTurbo.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,11 @@ public ModelRendererTurbo(ModelBase modelbase, int textureX, int textureY, int t


private TexturedPolygon textureQuad(TexturedVertex vert1, TexturedVertex vert2, TexturedVertex vert3, TexturedVertex vert4, float f, float g, float h, float j){
float uOffs = 1.0F / (textureWidth * 10.0F);
float vOffs = 1.0F / (textureHeight * 10.0F);
List<TexturedVertex> verts = new ArrayList<>();
//todo: use the longest, or shortest for that side for h/f g/j respectively
verts.add(vert1.setTexturePosition(h / textureWidth - uOffs, g / textureHeight + vOffs));
verts.add(vert2.setTexturePosition(f / textureWidth + uOffs, g / textureHeight + vOffs));
verts.add(vert3.setTexturePosition(f / textureWidth + uOffs, j / textureHeight - vOffs));
verts.add(vert4.setTexturePosition(h / textureWidth - uOffs, j / textureHeight - vOffs));
verts.add(vert1.setTexturePosition(h / textureWidth, g / textureHeight));
verts.add(vert2.setTexturePosition(f / textureWidth, g / textureHeight));
verts.add(vert3.setTexturePosition(f / textureWidth, j / textureHeight));
verts.add(vert4.setTexturePosition(h / textureWidth, j / textureHeight));
return new TexturedPolygon(verts);
}

Expand Down
8 changes: 6 additions & 2 deletions src/main/java/train/client/render/RenderRollingStock.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.Random;

import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL12.GL_CLAMP_TO_EDGE;

@SideOnly(Side.CLIENT)
public class RenderRollingStock extends Render {
Expand Down Expand Up @@ -58,8 +59,11 @@ public static void renderTheMinecart(EntityRollingStock cart, double x, double y
GL11.glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
GL11.glLightModelf(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);
GL11.glShadeModel(GL_SMOOTH);
GL11.glEnable(GL_NORMALIZE);GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT);
GL11.glEnable(GL_NORMALIZE);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL_NEAREST);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL_NEAREST);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL_REPEAT);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL_REPEAT);


double var15 = cart.lastTickPosX + (cart.posX - cart.lastTickPosX) * time;
Expand Down

0 comments on commit 132f569

Please sign in to comment.