Center(); function of 3D camera now also sets Z position to 0. Changed order of multiplication for matrices.
This commit is contained in:
parent
3bd3b0f9f6
commit
85188e859f
12
ConsoleApp1/ConsoleApp1.csproj
Normal file
12
ConsoleApp1/ConsoleApp1.csproj
Normal file
@ -0,0 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\RecrownedAthenaeum\RecrownedAthenaeum.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
13
ConsoleApp1/Program.cs
Normal file
13
ConsoleApp1/Program.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using RecrownedAthenaeum.Camera;
|
||||
using System;
|
||||
|
||||
namespace ConsoleApp1
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Camera2D camera = new Camera2D();
|
||||
}
|
||||
}
|
||||
}
|
@ -61,7 +61,6 @@ namespace RecrownedAthenaeum.Camera
|
||||
{
|
||||
this.graphicsDevice = graphicsDevice ?? (Configuration.GraphicsDeviceManager.GraphicsDevice);
|
||||
|
||||
position.Z = 0;
|
||||
worldMatrix = Matrix.Identity;
|
||||
lookAt = Vector3.Forward;
|
||||
upDirection = Vector3.Up;
|
||||
@ -76,7 +75,7 @@ namespace RecrownedAthenaeum.Camera
|
||||
public virtual void Apply()
|
||||
{
|
||||
ViewMatrix = Matrix.CreateLookAt(position, lookAt, upDirection);
|
||||
TransformationMatrix = worldMatrix * ViewMatrix * projectionMatrix;
|
||||
TransformationMatrix = projectionMatrix * ViewMatrix * worldMatrix;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -84,6 +83,7 @@ namespace RecrownedAthenaeum.Camera
|
||||
/// </summary>
|
||||
public void Center()
|
||||
{
|
||||
position.Z = 0;
|
||||
position.X = this.graphicsDevice.Viewport.Width * 0.5f;
|
||||
position.Y = this.graphicsDevice.Viewport.Height * 0.5f;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user