1
0
mirror of synced 2025-01-31 12:23:52 +01:00

Adjust the vertex color view to clamp values above 255

This commit is contained in:
KillzXGaming 2019-07-21 14:51:50 -04:00
parent 976c214799
commit ba6fef722d
4 changed files with 61 additions and 56 deletions

Binary file not shown.

View File

@ -7,6 +7,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Toolbox.Library;
using OpenTK;
namespace FirstPlugin
@ -48,16 +49,11 @@ namespace FirstPlugin
{
Color SetColor = Color.White;
int someIntX = (int)Math.Ceiling(value.X * 255);
int someIntY = (int)Math.Ceiling(value.Y * 255);
int someIntZ = (int)Math.Ceiling(value.Z * 255);
int someIntW = (int)Math.Ceiling(value.W * 255);
SetColor = Color.FromArgb(
255,
someIntX,
someIntY,
someIntZ
Utils.FloatToIntClamp(value.X),
Utils.FloatToIntClamp(value.Y),
Utils.FloatToIntClamp(value.Z)
);
columnHeader2.Text = "R";

View File

@ -545,6 +545,9 @@ namespace Toolbox.Library
Width = header.width;
Height = header.height;
MipCount = header.mipmapCount;
Depth = header.depth;
if (Depth == 0)
Depth = 1;
byte[] Components = new byte[4] { 0, 1, 2, 3 };
@ -897,11 +900,13 @@ namespace Toolbox.Library
return surfaces;
}
public void SetArrayLevel(byte[] data, int ArrayIndex)
public void SetArrayLevel(byte[] data, int ArrayIndex, int DepthIndex = 0)
{
uint formatSize = GetBytesPerPixel(Format);
uint Offset = 0;
for (byte d = 0; d < Depth; ++d)
{
for (byte i = 0; i < ArrayCount; ++i)
{
if (i == ArrayIndex)
@ -931,6 +936,7 @@ namespace Toolbox.Library
}
}
}
}
public static List<Surface> GetArrayFaces(STGenericTexture tex, byte[] ImageData, uint Length)
{
@ -941,6 +947,8 @@ namespace Toolbox.Library
uint formatSize = GetBytesPerPixel(tex.Format);
uint Offset = 0;
for (byte d = 0; d < tex.Depth; ++d)
{
for (byte i = 0; i < Length; ++i)
{
var Surface = new STGenericTexture.Surface();
@ -968,6 +976,7 @@ namespace Toolbox.Library
}
Surfaces.Add(Surface);
}
}
return Surfaces;
}

View File

@ -1073,18 +1073,18 @@ namespace Toolbox.Library
[Category("Image Info")]
public uint Width { get; set; }
[Browsable(true)]
[ReadOnly(true)]
[Description("Format of the image.")]
[Category("Image Info")]
public TEX_FORMAT Format { get; set; }
[Browsable(true)]
[ReadOnly(true)]
[Description("Depth of the image (3D type).")]
[Category("Image Info")]
public uint Depth { get; set; }
[Browsable(true)]
[ReadOnly(true)]
[Description("Format of the image.")]
[Category("Image Info")]
public TEX_FORMAT Format { get; set; }
[Browsable(true)]
[ReadOnly(true)]
[Description("Mip map count of the image.")]