Adjust the vertex color view to clamp values above 255
This commit is contained in:
parent
976c214799
commit
ba6fef722d
Binary file not shown.
@ -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";
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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.")]
|
||||
|
Loading…
x
Reference in New Issue
Block a user