18.09.2020
+ Textures ~ Changed 2D coordnate system to lower right as XY+
This commit is contained in:
parent
589d131246
commit
a603ecc417
26 changed files with 267 additions and 16 deletions
28
SMCode/SM.Base/Drawing/DrawingBasis.cs
Normal file
28
SMCode/SM.Base/Drawing/DrawingBasis.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
using SM.Base.Contexts;
|
||||
using SM.Base.StaticObjects;
|
||||
using SM.OGL.Mesh;
|
||||
|
||||
namespace SM.Base.Scene
|
||||
{
|
||||
public class DrawingBasis<TTransformation> : IShowItem
|
||||
where TTransformation : GenericTransformation, new()
|
||||
{
|
||||
protected Material _material = new Material();
|
||||
protected Mesh _mesh = Plate.Object;
|
||||
|
||||
public TTransformation Transform = new TTransformation();
|
||||
public virtual void Update(UpdateContext context)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void Draw(DrawContext context)
|
||||
{ }
|
||||
|
||||
protected void ApplyContext(ref DrawContext context)
|
||||
{
|
||||
context.Material = _material;
|
||||
context.Mesh = _mesh;
|
||||
}
|
||||
}
|
||||
}
|
||||
9
SMCode/SM.Base/Drawing/GenericTransformation.cs
Normal file
9
SMCode/SM.Base/Drawing/GenericTransformation.cs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
using OpenTK;
|
||||
|
||||
namespace SM.Base.Scene
|
||||
{
|
||||
public abstract class GenericTransformation
|
||||
{
|
||||
public abstract Matrix4 GetMatrix();
|
||||
}
|
||||
}
|
||||
12
SMCode/SM.Base/Drawing/IShader.cs
Normal file
12
SMCode/SM.Base/Drawing/IShader.cs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
using System.Collections.Generic;
|
||||
using OpenTK;
|
||||
using SM.Base.Contexts;
|
||||
|
||||
namespace SM.Base.Scene
|
||||
{
|
||||
public interface IShader
|
||||
{
|
||||
void Draw(DrawContext context);
|
||||
void DrawInstanced(DrawContext context, ICollection<Matrix4> instanceCollection);
|
||||
}
|
||||
}
|
||||
9
SMCode/SM.Base/Drawing/IShowCollection.cs
Normal file
9
SMCode/SM.Base/Drawing/IShowCollection.cs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace SM.Base.Scene
|
||||
{
|
||||
public interface IShowCollection
|
||||
{
|
||||
List<IShowItem> Objects { get; }
|
||||
}
|
||||
}
|
||||
10
SMCode/SM.Base/Drawing/IShowItem.cs
Normal file
10
SMCode/SM.Base/Drawing/IShowItem.cs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
using SM.Base.Contexts;
|
||||
|
||||
namespace SM.Base.Scene
|
||||
{
|
||||
public interface IShowItem
|
||||
{
|
||||
void Update(UpdateContext context);
|
||||
void Draw(DrawContext context);
|
||||
}
|
||||
}
|
||||
14
SMCode/SM.Base/Drawing/Material.cs
Normal file
14
SMCode/SM.Base/Drawing/Material.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
using OpenTK.Graphics;
|
||||
using SM.Base.Shader;
|
||||
using SM.OGL.Texture;
|
||||
|
||||
namespace SM.Base.Scene
|
||||
{
|
||||
public class Material
|
||||
{
|
||||
public TextureBase Texture;
|
||||
public Color4 Tint;
|
||||
|
||||
public IShader Shader = Shaders.Default;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue