Compare commits
2 Commits
42c5b55f95
...
6461b442de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6461b442de | ||
|
|
146bf4aa22 |
@@ -107,9 +107,8 @@ namespace Game
|
||||
if (rendering.SetupData.UseImgui)
|
||||
{
|
||||
auto& IO = ImGui::GetIO();
|
||||
IO.ConfigFlags = FlagBool(IO.ConfigFlags,
|
||||
ImGuiConfigFlags_NoMouse | ImGuiConfigFlags_NoKeyboard,
|
||||
GetInstance().Player.InteractionM == InteractionMode::Walk);
|
||||
IO.ConfigFlags =
|
||||
FlagBool(IO.ConfigFlags, ImGuiConfigFlags_NoMouse | ImGuiConfigFlags_NoKeyboard, captureMouse);
|
||||
}
|
||||
rendering.UIVisible = IsGaming ? UIVisibilityState::Game : UIVisibilityState::Debug;
|
||||
}
|
||||
|
||||
@@ -114,6 +114,16 @@ namespace Game
|
||||
}
|
||||
}
|
||||
|
||||
Vec3 CalcBoardOffset(const Gen::PuzzleData& puzData)
|
||||
{
|
||||
return Vec3{
|
||||
(float)(puzData.WidthTiles) / 2.0f - 0.5f,
|
||||
(float)(puzData.HeightTiles) / 2.0f - 0.5f,
|
||||
0.0f,
|
||||
} *
|
||||
WorldPuzzleUI::UICardScale * WorldPuzzleUI::UICardScale;
|
||||
}
|
||||
|
||||
void WorldPuzzleUI::UpdateAvailableCards(Gen::PuzzleData& Data)
|
||||
{
|
||||
auto& level = GetInstance().GameLevel;
|
||||
@@ -159,8 +169,9 @@ namespace Game
|
||||
dragPos += StaticData.ZAxis * -0.01f;
|
||||
quad.EData.Transform.Position = dragPos;
|
||||
|
||||
Vec3 boardOffset = CalcBoardOffset(Data) / WorldPuzzleUI::UICardScale;
|
||||
Vec3 boardPos = GlobalToLocalPoint(StaticData.UITransform, quadPlaneIntersectPos);
|
||||
Vec3 boardTilePos = boardPos / UICardOffset;
|
||||
Vec3 boardTilePos = (boardPos + boardOffset) / UICardOffset;
|
||||
int32_t xPos = (int32_t)bx::round(boardTilePos.x);
|
||||
int32_t yPos = (int32_t)bx::round(boardTilePos.y);
|
||||
|
||||
@@ -190,17 +201,6 @@ namespace Game
|
||||
}
|
||||
}
|
||||
|
||||
Vec3 CalcBoardOffset(const Gen::PuzzleData& puzData)
|
||||
{
|
||||
return {};
|
||||
return Vec3{
|
||||
(float)(puzData.WidthTiles) / (2.0f * Puzzle::Config::CardSize),
|
||||
(float)(puzData.HeightTiles) / (2.0f * Puzzle::Config::CardSize),
|
||||
0.0f,
|
||||
} *
|
||||
2.0f * WorldPuzzleUI::UICardScale * WorldPuzzleUI::UICardScale;
|
||||
}
|
||||
|
||||
void WorldPuzzleUI::UpdateBoardCards(Gen::PuzzleData& Data)
|
||||
{
|
||||
auto& level = GetInstance().GameLevel;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
BIN
src/game/data/puzzles/0.pzl
LFS
BIN
src/game/data/puzzles/0.pzl
LFS
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -86,12 +86,26 @@ float dither(float brightness, vec2 inputUv)
|
||||
|
||||
vec4 rgbToCmyk(vec3 rgb)
|
||||
{
|
||||
return vec4(1.0, 1.0, 1.0, 1.0);
|
||||
float k = min(1.0 - rgb.r, min(1.0 - rgb.g, 1.0 - rgb.b));
|
||||
vec3 cmy = vec3(0.0, 0.0, 0.0);
|
||||
float invK = 1.0 - k;
|
||||
if (invK != 0.0)
|
||||
{
|
||||
cmy.x = 1.0 - rgb.r - k;
|
||||
cmy.y = 1.0 - rgb.g - k;
|
||||
cmy.z = 1.0 - rgb.b - k;
|
||||
cmy /= invK;
|
||||
}
|
||||
return saturate(vec4(cmy, k));
|
||||
}
|
||||
|
||||
vec3 cmykToRgb(vec4 cmyk)
|
||||
{
|
||||
return vec3(1.0, 1.0, 1.0);
|
||||
float invK = 1.0 - cmyk.w;
|
||||
float r = 1.0 - min(1.0, cmyk.x * invK + cmyk.w);
|
||||
float g = 1.0 - min(1.0, cmyk.y * invK + cmyk.w);
|
||||
float b = 1.0 - min(1.0, cmyk.z * invK + cmyk.w);
|
||||
return saturate(vec3(r,g,b));
|
||||
}
|
||||
|
||||
vec2 rotateUV(vec2 uv, vec2 angle)
|
||||
@@ -117,17 +131,17 @@ void main()
|
||||
float r = dither(texColor.r * brightness, v_uv0);
|
||||
float g = dither(texColor.g * brightness, v_uv0);
|
||||
float b = dither(texColor.b * brightness, v_uv0);
|
||||
vec3 ditheredColor = vec3(r,g,b);
|
||||
// vec3 ditheredColor = vec3(r,g,b);
|
||||
|
||||
vec4 cmyk = rgbToCmyk(texColor * brightness);
|
||||
cmyk.x = dither(cmyk.x, rotateUV(v_uv0, float2(0.966, 0.259)));
|
||||
cmyk.y = dither(cmyk.y, rotateUV(v_uv0, float2(0.259, 0.966)));
|
||||
cmyk.z = dither(cmyk.z, rotateUV(v_uv0, float2(1.000, 0.000)));
|
||||
cmyk.w = dither(cmyk.w, rotateUV(v_uv0, float2(0.707, 0.707)));
|
||||
// vec3 ditheredColor = cmykToRgb(cmyk);
|
||||
vec3 ditheredColor = cmykToRgb(cmyk);
|
||||
|
||||
// finalize
|
||||
vec3 finalColor = mix(baseColor, ditheredColor, ditheredColor);
|
||||
gl_FragColor = vec4(finalColor, 1.0);
|
||||
// gl_FragColor = vec4(texColor * brightness, 1.0);
|
||||
gl_FragColor = vec4(finalColor.rg, finalColor.b * 0.99, 1.0);
|
||||
// gl_FragColor = vec4(ditheredColor, 1.0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user