diff --git a/PCK-Studio/Rendering/SkinRenderer.cs b/PCK-Studio/Rendering/SkinRenderer.cs index 25e77c06..b4235cd7 100644 --- a/PCK-Studio/Rendering/SkinRenderer.cs +++ b/PCK-Studio/Rendering/SkinRenderer.cs @@ -204,7 +204,6 @@ namespace PckStudio.Rendering private Texture2D capeTexture; private Texture2D armorTexture; private Texture2D toolsTexture; - private DrawContext _cubicalDrawContext; private DrawContext _skeletonDrawContext; private DrawContext _groundDrawContext; @@ -346,7 +345,7 @@ namespace PckStudio.Rendering private void InitializeCapeData() { - cape ??= new CubeMesh(new Cube(new(5, 0, 3), new(10, 16, 1), new(0, 0), 0f, false, false)); + cape ??= new CubeMesh(new Cube(new(5, 0, 3), new(10, 16, 1), new(0, 0), 0f, false, false, 0)); } private void InitializeArmorData() diff --git a/PckStudio.Rendering/Cube.cs b/PckStudio.Rendering/Cube.cs index de675454..87253104 100644 --- a/PckStudio.Rendering/Cube.cs +++ b/PckStudio.Rendering/Cube.cs @@ -35,6 +35,8 @@ namespace PckStudio.Rendering public bool MirrorTexture { get; } + public int ArmorFlags { get; } + public bool FlipZMapping { get; } public Vector3 Center => Position + Size / 2f; @@ -49,7 +51,7 @@ namespace PckStudio.Rendering Right } - public Cube(Vector3 position, Vector3 size, Vector2 uv, float inflate, bool mirrorTexture, bool flipZMapping) + public Cube(Vector3 position, Vector3 size, Vector2 uv, float inflate, bool mirrorTexture, bool flipZMapping, int armorFlags) { Position = position; Size = size; @@ -57,6 +59,7 @@ namespace PckStudio.Rendering Inflate = inflate; MirrorTexture = mirrorTexture; FlipZMapping = flipZMapping; + ArmorFlags = armorFlags; } public Vector3 GetFaceCenter(Face face) diff --git a/PckStudio.Rendering/CubeMeshCollection.cs b/PckStudio.Rendering/CubeMeshCollection.cs index 9114acc4..eb1c4f32 100644 --- a/PckStudio.Rendering/CubeMeshCollection.cs +++ b/PckStudio.Rendering/CubeMeshCollection.cs @@ -117,15 +117,15 @@ namespace PckStudio.Rendering return cubes.Where(c => c.Visible).SelectMany(selector); } - public void Add(Vector3 position, Vector3 size, Vector2 uv, float inflate = 0f, bool mirrorTexture = false) + public void Add(Vector3 position, Vector3 size, Vector2 uv, float inflate = 0f, bool mirrorTexture = false, int armorFlags = 0) { - var cube = new Cube(position, size, uv, inflate, mirrorTexture, FlipZMapping); + var cube = new Cube(position, size, uv, inflate, mirrorTexture, FlipZMapping, armorFlags); Add(new CubeMesh(cube)); } - public void AddNamed(string name, Vector3 position, Vector3 size, Vector2 uv, float inflate = 0f, bool mirrorTexture = false) + public void AddNamed(string name, Vector3 position, Vector3 size, Vector2 uv, float inflate = 0f, bool mirrorTexture = false, int armorFlags = 0) { - var cube = new Cube(position, size, uv, inflate, mirrorTexture, FlipZMapping); + var cube = new Cube(position, size, uv, inflate, mirrorTexture, FlipZMapping, armorFlags); Add(new CubeMesh(name, cube)); } @@ -150,14 +150,14 @@ namespace PckStudio.Rendering cubes.RemoveAt(index); } - public void ReplaceCube(int index, Vector3 position, Vector3 size, Vector2 uv, float inflate = 0f, bool mirrorTexture = false) + public void ReplaceCube(int index, Vector3 position, Vector3 size, Vector2 uv, float inflate = 0f, bool mirrorTexture = false, int armorFlags = 0) { if (!cubes.IndexInRange(index)) throw new IndexOutOfRangeException(); if (cubes[index] is CubeMesh cubeMesh) - cubes[index] = cubeMesh.SetCube(new Cube(position, size, uv, inflate, mirrorTexture, FlipZMapping)); + cubes[index] = cubeMesh.SetCube(new Cube(position, size, uv, inflate, mirrorTexture, FlipZMapping, armorFlags)); } public Vector3 GetCenter(int index) diff --git a/PckStudio.Rendering/Extension/SkinBoxExtension.cs b/PckStudio.Rendering/Extension/SkinBoxExtension.cs index 6a8675bf..9eca892a 100644 --- a/PckStudio.Rendering/Extension/SkinBoxExtension.cs +++ b/PckStudio.Rendering/Extension/SkinBoxExtension.cs @@ -13,6 +13,6 @@ namespace PckStudio.Rendering.Extension public static Cube ToCube(this SkinBOX skinBOX) => skinBOX.ToCube(0f); public static Cube ToCube(this SkinBOX skinBOX, float inflate, bool flipZMapping = false) - => new Cube(skinBOX.Pos.ToOpenTKVector(), skinBOX.Size.ToOpenTKVector(), skinBOX.UV.ToOpenTKVector(), skinBOX.Scale + inflate, skinBOX.Mirror, flipZMapping); + => new Cube(skinBOX.Pos.ToOpenTKVector(), skinBOX.Size.ToOpenTKVector(), skinBOX.UV.ToOpenTKVector(), skinBOX.Scale + inflate, skinBOX.Mirror, flipZMapping, skinBOX.ArmorMaskFlags); } }