diff --git a/ADVect/ADVect.cpp b/ADVect/ADVect.cpp index bc8edb1..d104f4c 100644 --- a/ADVect/ADVect.cpp +++ b/ADVect/ADVect.cpp @@ -188,11 +188,11 @@ namespace ADVect { void Render() { bgfx::touch(0); - draw_image_transition_fade(current_time, bg); + draw_image_transition_crossfade(current_time, bg); if (draw_ui) { if (dialogue_bg.current != nullptr) - ADVect::Graphics::DrawTextureImage(*dialogue_bg.current, dialogue_bg.pos_x, dialogue_bg.pos_y); + ADVect::Graphics::DrawTextureImageAlpha(*dialogue_bg.current, dialogue_bg.pos_x, dialogue_bg.pos_y, 1.0f); draw_image_transition_crossfade(current_time, avatar); ADVect::Graphics::RenderString(speaker.current, speaker.pos_x, speaker.pos_y, speaker.fill, ADVect::Graphics::TEXT_BOLD); @@ -249,8 +249,8 @@ namespace ADVect { } int main(int argc, char* argv[]) { - std::filesystem::current_path("E:\\Archive\\Projects\\NouVeL\\ADVect\\runtime"); -// std::filesystem::current_path("/Users/lachrymal/Projects/NouVeL/ADVect/runtime/"); +// std::filesystem::current_path("E:\\Archive\\Projects\\NouVeL\\ADVect\\runtime"); + std::filesystem::current_path("/Users/lachrymal/Projects/NouVeL/ADVect/runtime/"); NVL::Environment::ENVIRONMENT.enter({ { diff --git a/ADVect/Graphics.cpp b/ADVect/Graphics.cpp index 0068b43..3fb0e39 100644 --- a/ADVect/Graphics.cpp +++ b/ADVect/Graphics.cpp @@ -233,7 +233,7 @@ namespace ADVect::Graphics { ibh = bgfx::createIndexBuffer(bgfx::makeRef(quad_indices, sizeof(quad_indices))); vbh = bgfx::createVertexBuffer(bgfx::makeRef(quad_vert, sizeof(quad_vert)), pcvDecl); - img_program = load_shader_program("test"); // RGBA +// img_program = load_shader_program("test"); // RGBA imga_program = load_shader_program("ImageAlpha"); // RGBA + Opacity a_program = load_shader_program("AlphaStencil"); // A -> FFFA @@ -313,7 +313,7 @@ namespace ADVect::Graphics { } template - void RenderGlyph(NVL::Char c, std::conditional_t pos_x, std::conditional_t pos_y, u32 col, u32 style_flags = TEXT_NONE) { + void RenderGlyph(NVL::Char c, std::conditional_t pos_x, std::conditional_t pos_y, u32 col, u32 style_flags) { Font* f = ResolveStyleFlags(style_flags); auto& [tx, w, h, l, t, x, y] = f->get_char(c); @@ -329,14 +329,14 @@ namespace ADVect::Graphics { } template - void RenderString(const NVL::String& s, std::conditional_t pos_x, std::conditional_t pos_y, u32 col, u32 style_flags = TEXT_NONE) { + void RenderString(const NVL::String& s, std::conditional_t pos_x, std::conditional_t pos_y, u32 col, u32 style_flags) { for (const auto& c : s) { RenderGlyph(c, pos_x, pos_y, col, style_flags); } } template - void RenderString(NVL::String::const_iterator cbegin, NVL::String::const_iterator cend, std::conditional_t pos_x, std::conditional_t pos_y, u32 col, u32 style_flags = TEXT_NONE) { + void RenderString(NVL::String::const_iterator cbegin, NVL::String::const_iterator cend, std::conditional_t pos_x, std::conditional_t pos_y, u32 col, u32 style_flags) { while (cbegin < cend) { RenderGlyph(*cbegin++, pos_x, pos_y, col, style_flags); } diff --git a/ADVect/Graphics.h b/ADVect/Graphics.h index 6583a45..349683c 100644 --- a/ADVect/Graphics.h +++ b/ADVect/Graphics.h @@ -34,11 +34,11 @@ namespace ADVect::Graphics { void DrawTextureStencilAlpha(const bgfx::TextureHandle& tex, i32 pos_x, i32 pos_y, u32 w, u32 h); template - void RenderGlyph(NVL::Char c, std::conditional_t pos_x, std::conditional_t pos_y, u32 col, u32 style_flags); + void RenderGlyph(NVL::Char c, std::conditional_t pos_x, std::conditional_t pos_y, u32 col, u32 style_flags = TEXT_NONE); template - void RenderString(const NVL::String& s, std::conditional_t pos_x, std::conditional_t pos_y, u32 col, u32 style_flags); + void RenderString(const NVL::String& s, std::conditional_t pos_x, std::conditional_t pos_y, u32 col, u32 style_flags = TEXT_NONE); template - void RenderString(NVL::String::const_iterator cbegin, NVL::String::const_iterator cend, std::conditional_t pos_x, std::conditional_t pos_y, u32 col, u32 style_flags); + void RenderString(NVL::String::const_iterator cbegin, NVL::String::const_iterator cend, std::conditional_t pos_x, std::conditional_t pos_y, u32 col, u32 style_flags = TEXT_NONE); i32 RenderSubstringBox(const NVL::String& s, i32& pos_x, i32& pos_y, i32 reset_x, u32 w, u32 col, u32 style_flags = TEXT_NONE, size_t s_end = NVL::String::npos); void RenderSubstringMarkupBox(const NVL::Environment::MarkupString& ms, i32 pos_x, i32 pos_y, u32 w, u32 col, size_t end = NVL::String::npos); diff --git a/ADVect/runtime/shaders/metal/AlphaStencil.frag.bin b/ADVect/runtime/shaders/metal/AlphaStencil.frag.bin new file mode 100644 index 0000000..dcd76e8 Binary files /dev/null and b/ADVect/runtime/shaders/metal/AlphaStencil.frag.bin differ diff --git a/ADVect/runtime/shaders/metal/AlphaStencil.vert.bin b/ADVect/runtime/shaders/metal/AlphaStencil.vert.bin new file mode 100644 index 0000000..b1a3b15 Binary files /dev/null and b/ADVect/runtime/shaders/metal/AlphaStencil.vert.bin differ diff --git a/ADVect/runtime/shaders/metal/ImageAlpha.frag.bin b/ADVect/runtime/shaders/metal/ImageAlpha.frag.bin new file mode 100644 index 0000000..85c45f7 Binary files /dev/null and b/ADVect/runtime/shaders/metal/ImageAlpha.frag.bin differ diff --git a/ADVect/runtime/shaders/metal/ImageAlpha.vert.bin b/ADVect/runtime/shaders/metal/ImageAlpha.vert.bin new file mode 100644 index 0000000..b1a3b15 Binary files /dev/null and b/ADVect/runtime/shaders/metal/ImageAlpha.vert.bin differ