2021-03-07
+ IScriptable can now be disabled instancewise + IShowItem can disable rendering. ~ SM.Base.Mesh has now ILineMesh - IGenericWindow.AspectRatioReverse
This commit is contained in:
parent
c6bf5c75bc
commit
4efc47d75a
10 changed files with 16 additions and 10 deletions
|
|
@ -46,7 +46,8 @@ namespace SM.Base.Drawing
|
|||
/// This value determents if the object should draw something.
|
||||
/// </summary>
|
||||
public bool Active { get; set; } = true;
|
||||
|
||||
public bool RenderActive { get; set; } = true;
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Draw(DrawContext context)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -73,7 +73,9 @@ namespace SM.Base.Drawing.Particles
|
|||
|
||||
CreateParticles();
|
||||
}
|
||||
|
||||
|
||||
public bool UpdateActive { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Update(UpdateContext context)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,8 +8,11 @@ using SM.OGL.Mesh;
|
|||
namespace SM.Base.Objects
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public class Mesh : GenericMesh
|
||||
public class Mesh : GenericMesh, ILineMesh
|
||||
{
|
||||
|
||||
public float LineWidth { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// While initializing, it will add the <see cref="Color" /> to the data index.
|
||||
/// </summary>
|
||||
|
|
@ -23,5 +26,6 @@ namespace SM.Base.Objects
|
|||
/// Contains vertex colors
|
||||
/// </summary>
|
||||
public virtual VBO Color { get; protected set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -45,7 +45,7 @@ namespace SM.Base.Scene
|
|||
|
||||
for (var i = 0; i < _scriptableObjects.Count; i++)
|
||||
{
|
||||
if (!_scriptableObjects[i].Active) continue;
|
||||
if (!_scriptableObjects[i].Active || !_scriptableObjects[i].UpdateActive) continue;
|
||||
_scriptableObjects[i].Update(context);
|
||||
}
|
||||
}
|
||||
|
|
@ -57,7 +57,7 @@ namespace SM.Base.Scene
|
|||
|
||||
for (var i = 0; i < Objects.Count; i++)
|
||||
{
|
||||
if (!this[i].Active) continue;
|
||||
if (!this[i].Active || !this[i].RenderActive) continue;
|
||||
this[i].Draw(context);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ namespace SM.Base.Scene
|
|||
public interface IScriptable
|
||||
{
|
||||
bool Active { get; set; }
|
||||
bool UpdateActive { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Updates the object.
|
||||
|
|
|
|||
|
|
@ -31,7 +31,8 @@ namespace SM.Base.Scene
|
|||
ICollection<string> Flags { get; set; }
|
||||
|
||||
bool Active { get; set; }
|
||||
|
||||
bool RenderActive { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Tells the object to draw its object.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ namespace SM.Base.Windows
|
|||
{
|
||||
public bool Loading { get; private set; } = true;
|
||||
public float AspectRatio { get; set; }
|
||||
public float AspectRatioReverse { get; set; }
|
||||
|
||||
public GenericCamera ViewportCamera { get; set; }
|
||||
public bool ForceViewportCamera { get; set; }
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ namespace SM.Base.Windows
|
|||
{
|
||||
bool Loading { get; }
|
||||
float AspectRatio { get; set; }
|
||||
float AspectRatioReverse { get; set; }
|
||||
|
||||
GenericCamera ViewportCamera { get; set; }
|
||||
bool ForceViewportCamera { get; set; }
|
||||
|
|
|
|||
|
|
@ -55,7 +55,6 @@ namespace SM.Base.Windows
|
|||
{
|
||||
window.WindowSize = new Vector2(window.Width, window.Height);
|
||||
window.AspectRatio = (float) window.Width / window.Height;
|
||||
window.AspectRatioReverse = (float) window.Height / window.Width;
|
||||
GL.Viewport(window.ClientRectangle);
|
||||
|
||||
window.CurrentRenderPipeline?.Resize();
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ namespace SM2D.Scene
|
|||
{
|
||||
if (RequestedWorldScale.HasValue)
|
||||
{
|
||||
float aspect = window.Width > window.Height ? window.AspectRatio : window.AspectRatioReverse;
|
||||
float aspect = window.AspectRatio;
|
||||
Vector2 requested = RequestedWorldScale.Value;
|
||||
|
||||
if (requested.X > 0 && requested.Y > 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue