33
33
import com .mojang .blaze3d .vertex .Tessellator ;
34
34
import io .github .axolotlclient .AxolotlClientConfig .api .util .Colors ;
35
35
import io .github .axolotlclient .AxolotlClientConfig .impl .util .DrawUtil ;
36
+ import io .github .axolotlclient .modules .freelook .Perspective ;
36
37
import io .github .axolotlclient .waypoints .AxolotlClientWaypoints ;
37
38
import io .github .axolotlclient .waypoints .mixin .GameRendererAccessor ;
38
39
import net .minecraft .client .Minecraft ;
39
40
import net .minecraft .client .gui .GuiElement ;
41
+ import net .minecraft .client .render .Camera ;
40
42
import net .minecraft .client .render .Window ;
41
43
import net .minecraft .entity .Entity ;
42
44
import net .minecraft .util .math .Vec3d ;
@@ -66,11 +68,8 @@ public void render(float f) {
66
68
GlStateManager .color3f (1 , 1 , 1 );
67
69
GlStateManager .pushMatrix ();
68
70
69
- var camPos = cam .getEyePosition (f );
70
- var cpos = camPos .subtract (0 , cam .getEyeHeight (), 0 );
71
- //var camPos = new Vector3d(cam.x, cam.y, cam.z);
72
- //var prevCamPos = new Vector3d(cam.prevTickX, cam.prevTickY, cam.prevTickZ);
73
- //camPos.sub(prevCamPos).mul(f).add(prevCamPos);
71
+ var camPos = Camera .getPos (cam , f );
72
+ var cpos = cam .getEyePosition (f ).subtract (0 , cam .getEyeHeight (), 0 );
74
73
75
74
GlStateManager .depthMask (false );
76
75
GlStateManager .disableDepthTest ();
@@ -109,7 +108,11 @@ private void renderWaypoint(Waypoint waypoint, Vec3d camPos, Vec3d camEyePos, fl
109
108
GlStateManager .translated (waypoint .x () - camEyePos .x , waypoint .y () - camEyePos .y , waypoint .z () - camEyePos .z );
110
109
var dispatcher = minecraft .getEntityRenderDispatcher ();
111
110
GlStateManager .rotatef (-dispatcher .cameraYaw , 0.0F , 1.0F , 0.0F );
112
- GlStateManager .rotatef (dispatcher .cameraPitch , 1.0F , 0.0F , 0.0F );
111
+ if (Minecraft .getInstance ().options .perspective == Perspective .THIRD_PERSON_FRONT .ordinal ()) {
112
+ GlStateManager .rotatef (-dispatcher .cameraPitch , 1.0F , 0.0F , 0.0F );
113
+ } else {
114
+ GlStateManager .rotatef (dispatcher .cameraPitch , 1.0F , 0.0F , 0.0F );
115
+ }
113
116
float scale = 0.04F ;
114
117
GlStateManager .scalef (-scale , -scale , scale );
115
118
GlStateManager .enableBlend ();
@@ -165,7 +168,7 @@ public void renderWaypoints(float tick) {
165
168
166
169
private Matrix4f getProjectionMatrix (float fov ) {
167
170
Matrix4f matrix4f = new Matrix4f ();
168
- return matrix4f .perspective (fov * ((float ) Math .PI / 180F ), (float ) this .minecraft .width / (float ) this .minecraft .height , 0.05F , minecraft .options .viewDistance * 4 );
171
+ return matrix4f .perspective (fov * ((float ) Math .PI / 180F ), (float ) this .minecraft .width / (float ) this .minecraft .height , 0.05F , minecraft .options .viewDistance * 2 );
169
172
}
170
173
171
174
private void renderWaypoint (Waypoint waypoint , float tick , Entity camera , List <Runnable > positionDrawn , int guiWidth , int guiHeight ) {
@@ -175,7 +178,7 @@ private void renderWaypoint(Waypoint waypoint, float tick, Entity camera, List<R
175
178
int width = textWidth + Waypoint .displayXOffset () * 2 ;
176
179
int textHeight = minecraft .textRenderer .fontHeight ;
177
180
int height = textHeight + Waypoint .displayYOffset () * 2 ;
178
- var camPos = camera . getEyePosition ( tick );
181
+ var camPos = Camera . getPos ( camera , tick );
179
182
180
183
var displayStart = projectToScreen (guiWidth , guiHeight , camPos , fov , width , height , waypoint .x (), waypoint .y (), waypoint .z (), new Vector2f (-(width / 2f * 0.04f ), (height / 2f * 0.04f )));
181
184
var displayEnd = projectToScreen (guiWidth , guiHeight , camPos , fov , width , height , waypoint .x (), waypoint .y (), waypoint .z (), new Vector2f ((width / 2f * 0.04f ), -(height / 2f * 0.04f )));
@@ -248,10 +251,11 @@ private void renderWaypoint(Waypoint waypoint, float tick, Entity camera, List<R
248
251
private @ Nullable Result projectToScreen (int guiWidth , int guiHeight , Vec3d camPos , float fov , int width , int height , double x , double y , double z , Vector2f orthoOffset ) {
249
252
viewProj .set (x , y , z , 1 );
250
253
var dispatcher = minecraft .getEntityRenderDispatcher ();
254
+ var pitch = Minecraft .getInstance ().options .perspective == Perspective .THIRD_PERSON_FRONT .ordinal () ? -dispatcher .cameraPitch : dispatcher .cameraPitch ;
251
255
if (orthoOffset != null ) {
252
256
var vec = new Matrix4f ();
253
257
var camRot = new Quaternionf ()
254
- .rotationYXZ (-dispatcher .cameraYaw * (float ) (Math .PI / 180.0 ), dispatcher . cameraPitch * (float ) (Math .PI / 180.0 ), 0.0F )
258
+ .rotationYXZ (-dispatcher .cameraYaw * (float ) (Math .PI / 180.0 ), pitch * (float ) (Math .PI / 180.0 ), 0.0F )
255
259
.rotateY ((float ) -(Math .PI )).invert ();
256
260
vec .rotate (camRot .invert (new Quaternionf ()));
257
261
vec .translate (orthoOffset .x (), orthoOffset .y (), 0 );
@@ -260,7 +264,7 @@ private void renderWaypoint(Waypoint waypoint, float tick, Entity camera, List<R
260
264
}
261
265
262
266
view .rotation (new Quaternionf ()
263
- .rotationYXZ (-dispatcher .cameraYaw * (float ) (Math .PI / 180.0 ), dispatcher . cameraPitch * (float ) (Math .PI / 180.0 ), 0.0F )
267
+ .rotationYXZ (-dispatcher .cameraYaw * (float ) (Math .PI / 180.0 ), pitch * (float ) (Math .PI / 180.0 ), 0.0F )
264
268
.rotateY ((float ) -(Math .PI )).invert ()).translate ((float ) -camPos .x , (float ) -camPos .y , (float ) -camPos .z );
265
269
266
270
Matrix4f projection = getProjectionMatrix (fov );
0 commit comments