mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-06-05 18:35:03 +00:00
Added ArmorFlags to Cube rendering class
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user