Loads and loads of small improvements I added while developing on my game
This commit is contained in:
parent
41421b1df9
commit
a7c71e7ea1
107 changed files with 2278 additions and 1023 deletions
|
|
@ -13,6 +13,9 @@ namespace SM.OGL.Mesh
|
|||
/// </summary>
|
||||
public abstract class GenericMesh : GLObject
|
||||
{
|
||||
private bool _boundingBoxUpdated = false;
|
||||
|
||||
public static int LastID { get; internal set; } = -1;
|
||||
|
||||
/// <summary>
|
||||
/// Generates the AttribDataIndex
|
||||
|
|
@ -69,14 +72,28 @@ namespace SM.OGL.Mesh
|
|||
/// </summary>
|
||||
public virtual int[] Indices { get; set; }
|
||||
|
||||
public void UpdateBoundingBox()
|
||||
{
|
||||
BoundingBox.Update(this);
|
||||
_boundingBoxUpdated = true;
|
||||
}
|
||||
|
||||
public void Activate()
|
||||
{
|
||||
GL.BindVertexArray(ID);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Compile()
|
||||
{
|
||||
_id = GL.GenVertexArray();
|
||||
GL.BindVertexArray(_id);
|
||||
|
||||
|
||||
if (Attributes == null || Attributes.Count == 0) throw new Exception("[Critical] The model requires attributes.");
|
||||
|
||||
if (!_boundingBoxUpdated)
|
||||
UpdateBoundingBox();
|
||||
|
||||
foreach (var kvp in Attributes)
|
||||
kvp.ConnectedVBO?.BindBuffer(kvp.Index);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue