26.09.2020
+ Added BoundingBoxes to Meshes + SM.Base.Objects.Mesh + Vertex Colors + ShowItem Collections + 2D Equlivant + Default Class to store Default Values + SM.OGL.GLSystem to store OpenGL specific system information + SM2D.DrawColor // not working yet + SM2D.DrawComplex to allow access to all features. + SM2D.DrawPolygon + Polygon system // for 2D only yet ~ Renamed SM.OGL.Mesh to SM.OGL.GenericMesh
This commit is contained in:
parent
c4a0847567
commit
617a7ef044
39 changed files with 598 additions and 66 deletions
40
SMCode/SM.OGL/Mesh/BoundingBox.cs
Normal file
40
SMCode/SM.OGL/Mesh/BoundingBox.cs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using OpenTK;
|
||||
|
||||
namespace SM.OGL.Mesh
|
||||
{
|
||||
public class BoundingBox
|
||||
{
|
||||
public Vector3 Max = Vector3.Zero;
|
||||
public Vector3 Min = Vector3.Zero;
|
||||
|
||||
public Vector3 this[bool x, bool y, bool z] => new Vector3(x ? Max.X : Min.X, y ? Max.Y : Min.Y, z ? Max.Z : Min.Z);
|
||||
|
||||
public BoundingBox() {}
|
||||
|
||||
public BoundingBox(Vector3 min, Vector3 max)
|
||||
{
|
||||
Min = min;
|
||||
Max = max;
|
||||
}
|
||||
|
||||
public void Update(Vector2 vector)
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
Min[i] = Math.Min(Min[i], vector[i]);
|
||||
Max[i] = Math.Max(Min[i], vector[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(Vector3 vector)
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
Min[i] = Math.Min(Min[i], vector[i]);
|
||||
Max[i] = Math.Max(Min[i], vector[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue