CubeMesh - Remove 'SetName' and add constructor with 'name' parameter

This commit is contained in:
miku-666
2024-10-16 18:36:45 +02:00
parent ba07e8e009
commit ed6acba51f
2 changed files with 8 additions and 10 deletions

View File

@@ -55,7 +55,11 @@ namespace PckStudio.Rendering
internal static VertexBufferLayout VertexBufferLayout { get; } = new VertexBufferLayout().Add(ShaderDataType.Float3).Add(ShaderDataType.Float2);
public CubeMesh(Cube cube) : this(nameof(CubeMesh), cube, true)
public CubeMesh(Cube cube) : this(nameof(CubeMesh), cube)
{
}
public CubeMesh(string name, Cube cube) : this(name, cube, true)
{
}
@@ -65,12 +69,6 @@ namespace PckStudio.Rendering
_cube = cube;
}
public CubeMesh SetName(string name)
{
_ = name ?? throw new ArgumentNullException(nameof(name));
return new CubeMesh(name, _cube, Visible);
}
public CubeMesh SetCube(Cube cube)
{
_ = cube ?? throw new ArgumentNullException(nameof(cube));
@@ -83,7 +81,7 @@ namespace PckStudio.Rendering
public override BoundingBox GetBounds(Matrix4 transform)
{
return _cube.GetBoundingBox(transform);
return _cube.GetBoundingBox(Transform * transform);
}
internal override IEnumerable<TextureVertex> GetVertices()

View File

@@ -33,7 +33,7 @@ namespace PckStudio.Rendering
internal static void AddSkinBox(this CubeMeshCollection cubeMeshes, SkinBOX skinBox, float inflate = 0f)
{
var cube = skinBox.ToCube(inflate, cubeMeshes.FlipZMapping);
cubeMeshes.Add(new CubeMesh(cube).SetName(skinBox.Type));
cubeMeshes.Add(new CubeMesh(skinBox.Type, cube));
}
}
@@ -117,7 +117,7 @@ namespace PckStudio.Rendering
internal void AddNamed(string name, Vector3 position, Vector3 size, Vector2 uv, float inflate = 0f, bool mirrorTexture = false)
{
var cube = new Cube(position, size, uv, inflate, mirrorTexture, FlipZMapping);
Add(new CubeMesh(cube).SetName(name));
Add(new CubeMesh(name, cube));
}
internal void AddSubCollection(string name, Vector3 translation, Vector3 pivot, Vector3 rotation = default)