Skip to content

Commit

Permalink
Fixes + hues window
Browse files Browse the repository at this point in the history
  • Loading branch information
kaczy93 committed Apr 2, 2024
1 parent 61f4d8e commit a3cd23f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions CentrED/HuesManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ public class HuesManager
public static HuesManager Instance => _instance;

public const int HUE_SIZE = 32;
public const int TEXTURE_WIDTH = 32 * HUE_SIZE; //32 hues of 32 values per row
public const int TEXTURE_HEIGHT = 512; //That's enough to fit 16k textures
public const int TEXTURE_WIDTH = 16 * HUE_SIZE; //16 hues of 32 values per row
public const int TEXTURE_HEIGHT = 1024; //That's enough to fit 16k textures
public readonly Texture2D Texture;
public readonly int HuesCount;
public readonly string[] Names;
Expand Down Expand Up @@ -85,7 +85,7 @@ public Vector4 GetHueVector(ushort hue, bool partial, float alpha = 1)

if (hue != 0)
{
// hue -= 1;
hue -= 1;
mode = partial ? HueMode.PARTIAL : HueMode.HUED;
}
else
Expand Down
2 changes: 1 addition & 1 deletion CentrED/Renderer/Shaders/MapEffect.fx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ float4 StaticsPSMain(PSInput pin) : SV_Target0

if (mode == HUED || (mode == PARTIAL && color.r == color.g && color.r == color.b))
{
float2 hue = float2(floor(pin.Hue.x % 32) / 32 + color.r / 32, floor(pin.Hue.x / 32) / 512);
float2 hue = float2(frac(pin.Hue.x / 16) + color.r / 16, (pin.Hue.x + 1) / 16 / 1024);
color.rgb = tex2D(HueSampler, hue).rgb;
}
else if (mode == RGB)
Expand Down
Binary file modified CentrED/Renderer/Shaders/MapEffect.fxc
Binary file not shown.
2 changes: 1 addition & 1 deletion CentrED/UI/Windows/HuesWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ private void DrawHueRow(int index)
CEDGame.UIManager.DrawImage
(
HuesManager.Instance.Texture,
new Rectangle(0, index - 1, 32, 1),
new Rectangle((index - 1) % 16 * 32, index / 16, 32, 1),
new Vector2(ImGui.GetContentRegionAvail().X, _hueRowHeight)
);
}
Expand Down

0 comments on commit a3cd23f

Please sign in to comment.