Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/client/java/fr/madu59/ptp/PtpClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,6 @@ private static void renderTrajectory(LevelRenderContext context, List<Vec3> traj
Vec3 cam = client.gameRenderer.getMainCamera().position();
PoseStack matrices = context.poseStack();
RenderType renderType = RenderTypes.LINES;
matrices.pushPose();
matrices.translate(-cam.x, -cam.y, -cam.z);

for (int i = 0; i < trajectoryPoints.size()-1; i++) {
Vec3 lerpedDelta = handToEyeDelta.scale((trajectoryPoints.size()-(i * 1.0))/trajectoryPoints.size());
Expand All @@ -228,14 +226,14 @@ private static void renderTrajectory(LevelRenderContext context, List<Vec3> traj
else if(SettingsManager.TRAJECTORY_STYLE.getValue() == Option.Style.DOTTED){
dir = dir.scale(0.15);
}
Vector3f floatPos = new Vector3f((float) pos.x, (float) pos.y, (float) pos.z);
Vector3f floatPos = new Vector3f((float) (pos.x - cam.x), (float) (pos.y - cam.y), (float) (pos.z - cam.z));

RenderUtils.renderVector(context, matrices, renderType, floatPos, dir, color);
}

if (hasHit) {

Vec3 pos = trajectoryPoints.getLast();
Vec3 pos = trajectoryPoints.getLast().subtract(cam);

double r = 0.1;
double x = pos.x;
Expand All @@ -254,8 +252,6 @@ else if(SettingsManager.TRAJECTORY_STYLE.getValue() == Option.Style.DOTTED){
dir = new Vec3(0,0,2 * r);
RenderUtils.renderVector(context, matrices, renderType, floatPos, dir, color);
}

matrices.popPose();
}

private static PreviewImpact calculateTrajectory(Vec3 pos, Player player, ProjectileData projectileData, boolean canHitEntities) {
Expand Down
14 changes: 2 additions & 12 deletions src/client/java/fr/madu59/ptp/util/RenderUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,14 @@ public static void renderFilledBox(LevelRenderContext context, double minX, doub
PoseStack poseStack = context.poseStack();
Vec3 camera = client.gameRenderer.getMainCamera().position();

poseStack.pushPose();
poseStack.translate(-camera.x, -camera.y, -camera.z);

addChainedFilledBoxVertices(context, poseStack, RenderTypes.debugFilledBox(), minX, minY, minZ, maxX, maxY, maxZ, colorComponents[0], colorComponents[1], colorComponents[2], alpha);

poseStack.popPose();
addChainedFilledBoxVertices(context, poseStack, RenderTypes.debugFilledBox(), minX - camera.x, minY - camera.y, minZ - camera.z, maxX - camera.x, maxY - camera.y, maxZ - camera.z, colorComponents[0], colorComponents[1], colorComponents[2], alpha);
}

public static void renderBox(LevelRenderContext context, double minX, double minY, double minZ, double maxX, double maxY, double maxZ, float[] colorComponents, float alpha) {
PoseStack poseStack = context.poseStack();
Vec3 camera = client.gameRenderer.getMainCamera().position();

poseStack.pushPose();
poseStack.translate(-camera.x, -camera.y, -camera.z);

renderLineBox(context, poseStack, RenderTypes.lines(), minX, minY, minZ, maxX, maxY, maxZ, colorComponents[0], colorComponents[1], colorComponents[2], alpha);

poseStack.popPose();
renderLineBox(context, poseStack, RenderTypes.lines(), minX - camera.x, minY - camera.y, minZ - camera.z, maxX - camera.x, maxY - camera.y, maxZ - camera.z, colorComponents[0], colorComponents[1], colorComponents[2], alpha);
}

public static void renderVector(LevelRenderContext context, PoseStack poseStack, RenderType renderType, Vector3f vector3f, Vec3 vec3, int i) {
Expand Down