mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-19 12:35:52 -04:00
Fix skybox rendering in forward third person mode. (Thanks 123DMWM)
This commit is contained in:
parent
6ab5dbc3ae
commit
3546d165df
@ -55,9 +55,10 @@ namespace ClassicalSharp.Renderers {
|
||||
game.Graphics.SetBatchFormat( VertexFormat.P3fT2fC4b );
|
||||
|
||||
Vector3 pos = game.CurrentCameraPos;
|
||||
Matrix4 m = Matrix4.Identity;
|
||||
m *= Matrix4.RotateY( game.LocalPlayer.HeadYawRadians );
|
||||
m *= Matrix4.RotateX( game.LocalPlayer.PitchRadians );
|
||||
Matrix4 m = Matrix4.Identity;
|
||||
Vector2 rotation = game.Camera.GetCameraOrientation();
|
||||
m *= Matrix4.RotateY( rotation.X ); // yaw
|
||||
m *= Matrix4.RotateX( rotation.Y ); // pitch
|
||||
game.Graphics.LoadMatrix( ref m );
|
||||
|
||||
game.Graphics.BindVb( vb );
|
||||
|
@ -18,6 +18,9 @@ namespace ClassicalSharp {
|
||||
/// based on the entity's eye position. </summary>
|
||||
public abstract Vector3 GetCameraPos( Vector3 eyePos );
|
||||
|
||||
/// <summary> Calculates the yaw and pitch of the camera in radians. </summary>
|
||||
public abstract Vector2 GetCameraOrientation();
|
||||
|
||||
/// <summary> Whether this camera is using a third person perspective. </summary>
|
||||
/// <remarks> This causes the local player to be renderered if true. </remarks>
|
||||
public abstract bool IsThirdPerson { get; }
|
||||
@ -140,6 +143,10 @@ namespace ClassicalSharp {
|
||||
public ThirdPersonCamera( Game window ) : base( window ) {
|
||||
}
|
||||
|
||||
public override Vector2 GetCameraOrientation() {
|
||||
return new Vector2( player.HeadYawRadians, player.PitchRadians );
|
||||
}
|
||||
|
||||
float dist = 3;
|
||||
public override bool DoZoom( float deltaPrecise ) {
|
||||
dist = Math.Max( dist - deltaPrecise, 2 );
|
||||
@ -173,6 +180,10 @@ namespace ClassicalSharp {
|
||||
public ForwardThirdPersonCamera( Game window ) : base( window ) {
|
||||
}
|
||||
|
||||
public override Vector2 GetCameraOrientation() {
|
||||
return new Vector2( player.HeadYawRadians, -player.PitchRadians );
|
||||
}
|
||||
|
||||
float dist = 3;
|
||||
public override bool DoZoom( float deltaPrecise ) {
|
||||
dist = Math.Max( dist - deltaPrecise, 2 );
|
||||
@ -206,6 +217,10 @@ namespace ClassicalSharp {
|
||||
public FirstPersonCamera( Game window ) : base( window ) {
|
||||
}
|
||||
|
||||
public override Vector2 GetCameraOrientation() {
|
||||
return new Vector2( player.HeadYawRadians, player.PitchRadians );
|
||||
}
|
||||
|
||||
public override Matrix4 GetView( double delta ) {
|
||||
CalcViewBobbing( delta );
|
||||
Vector3 eyePos = player.EyePosition;
|
||||
|
Loading…
x
Reference in New Issue
Block a user