Removed some implementations that may just be rewritten.
This commit is contained in:
parent
48a2671b95
commit
4d330e68ab
@ -1,90 +0,0 @@
|
|||||||
using OpenTK;
|
|
||||||
namespace RecrownedAthenaeum.Graphics.Render
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// A generic camera. Functions in 3D.
|
|
||||||
/// </summary>
|
|
||||||
public class BasicCamera
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The scale for the world.
|
|
||||||
/// </summary>
|
|
||||||
public float worldScale = 1f;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Current position in the world.
|
|
||||||
/// </summary>
|
|
||||||
public Vector3 position;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The place the 3D camera is looking at.
|
|
||||||
/// </summary>
|
|
||||||
public Vector3 lookAt;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The direction up is for the camera.
|
|
||||||
/// </summary>
|
|
||||||
public Vector3 upDirection;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The transform matrix representing the world (rotation and translations of the original world).
|
|
||||||
/// </summary>
|
|
||||||
public Matrix worldMatrix;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The view matrix that describes where the camera looks.
|
|
||||||
/// </summary>
|
|
||||||
public Matrix ViewMatrix { get; protected set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The projection matrix.
|
|
||||||
/// </summary>
|
|
||||||
public Matrix projectionMatrix;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// A basic effect that will be updated with the correct matrice information everytime <see cref="Apply"/> is called. Can be null and thus will not be used.
|
|
||||||
/// </summary>
|
|
||||||
public BasicEffect basicEffect;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructs 3D camera with an orthographic projection matrix with dimensions of graphics devices viewport. All changes to matrices should have apply called after changes.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="basicEffect">A basic effect that will be updated with the correct matrice information everytime <see cref="Apply"/> is called. Can be null and thus will not be used.</param>
|
|
||||||
public BasicCamera(BasicEffect basicEffect = null)
|
|
||||||
{
|
|
||||||
worldMatrix = Matrix.Identity;
|
|
||||||
lookAt = Vector3.Forward;
|
|
||||||
upDirection = Vector3.Up;
|
|
||||||
|
|
||||||
projectionMatrix = Matrix.Identity;
|
|
||||||
this.basicEffect = basicEffect;
|
|
||||||
Apply();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Applies the changes to the fields and properties of the camera.
|
|
||||||
/// </summary>
|
|
||||||
public virtual void Apply()
|
|
||||||
{
|
|
||||||
ViewMatrix = Matrix.CreateLookAt(position, lookAt, upDirection);
|
|
||||||
worldMatrix *= Matrix.CreateScale(worldScale);
|
|
||||||
|
|
||||||
if (basicEffect != null)
|
|
||||||
{
|
|
||||||
basicEffect.World = worldMatrix;
|
|
||||||
basicEffect.Projection = projectionMatrix;
|
|
||||||
basicEffect.View = ViewMatrix;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Moves camera by the given amount.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="move">A <see cref="Vector3"/> that contains how much in each direction to move.</param>
|
|
||||||
public void MoveCamera(Vector3 move)
|
|
||||||
{
|
|
||||||
position += move;
|
|
||||||
Apply();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,54 +0,0 @@
|
|||||||
using RecrownedAthenaeum.Types;
|
|
||||||
|
|
||||||
namespace RecrownedAthenaeum.Graphics.Render
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// A simple utility object that will start and end a scissor setup given a <see cref="ConsistentSpriteBatch"/> to work with.
|
|
||||||
/// </summary>
|
|
||||||
public class BasicScissor
|
|
||||||
{
|
|
||||||
ConsistentSpriteBatch spriteBatch;
|
|
||||||
RasterizerState scissorRasterizer;
|
|
||||||
Rectangle scissorRectangle;
|
|
||||||
|
|
||||||
RasterizerState originalRasterizer;
|
|
||||||
Rectangle originalScissor;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes the basic scissor.
|
|
||||||
/// </summary>
|
|
||||||
public BasicScissor()
|
|
||||||
{
|
|
||||||
scissorRasterizer = new RasterizerState();
|
|
||||||
scissorRasterizer.MultiSampleAntiAlias = false;
|
|
||||||
scissorRasterizer.ScissorTestEnable = true;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Begins the <see cref="ConsistentSpriteBatch"/> with scissoring in mind.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="scissorRectangle">The rectangle to use to outline the scissor.</param>
|
|
||||||
/// <param name="consistentSpriteBatch">The consistent sprite batch to use for this process.</param>
|
|
||||||
public void Begin(Rectangle scissorRectangle, ConsistentSpriteBatch consistentSpriteBatch)
|
|
||||||
{
|
|
||||||
originalRasterizer = consistentSpriteBatch.rasterizerState;
|
|
||||||
this.scissorRectangle = scissorRectangle;
|
|
||||||
|
|
||||||
spriteBatch = consistentSpriteBatch;
|
|
||||||
spriteBatch.Begin(rasterizerState: scissorRasterizer);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Ends the scissor state of the spritebatch.
|
|
||||||
/// </summary>
|
|
||||||
public void End()
|
|
||||||
{
|
|
||||||
originalScissor = spriteBatch.GraphicsDevice.ScissorRectangle;
|
|
||||||
spriteBatch.GraphicsDevice.ScissorRectangle = scissorRectangle;
|
|
||||||
spriteBatch.End();
|
|
||||||
spriteBatch.rasterizerState = originalRasterizer;
|
|
||||||
spriteBatch.GraphicsDevice.ScissorRectangle = originalScissor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
using System;
|
|
||||||
namespace RecrownedAthenaeum.Graphics.Render {
|
|
||||||
public class Batch {
|
|
||||||
private bool begun;
|
|
||||||
public Batch() {
|
|
||||||
//TODO Finish batch.
|
|
||||||
}
|
|
||||||
public void Begin() {
|
|
||||||
if (begun) throw new InvalidOperationException("This batch has already been started.");
|
|
||||||
begun = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user