diff --git a/inc/Graphics/Pass/HTMLDrawerPass.h b/inc/Graphics/Pass/HTMLDrawerPass.h
index 9f013264..3e1a282f 100644
--- a/inc/Graphics/Pass/HTMLDrawerPass.h
+++ b/inc/Graphics/Pass/HTMLDrawerPass.h
@@ -9,6 +9,7 @@
#include
namespace SR_GRAPH_NS {
+#ifdef SR_COMMON_LITEHTML
class HTMLDrawerPass : public BasePass {
SR_REGISTER_LOGICAL_NODE(HTMLDrawerPass, HTML Drawer Pass, { "Passes" })
using Super = BasePass;
@@ -40,6 +41,7 @@ namespace SR_GRAPH_NS {
std::atomic m_needReloadPage = false;
};
+#endif
}
#endif //SR_ENGINE_HTML_DRAWER_PASS_H
\ No newline at end of file
diff --git a/inc/Graphics/Render/HTMLRenderer.h b/inc/Graphics/Render/HTMLRenderer.h
index c34a03f6..016843ba 100644
--- a/inc/Graphics/Render/HTMLRenderer.h
+++ b/inc/Graphics/Render/HTMLRenderer.h
@@ -9,7 +9,8 @@
namespace SR_GRAPH_NS {
class TextBuilder;
-
+
+#ifdef SR_COMMON_LITEHTML
class HTMLRenderContainer : public SR_UTILS_NS::Web::HTMLContainerInterface {
using Super = SR_UTILS_NS::Web::HTMLContainerInterface;
struct ShaderInfo {
@@ -91,6 +92,7 @@ namespace SR_GRAPH_NS {
std::map m_shaders;
std::vector m_textAtlases;
};
+#endif // SR_COMMON_LITEHTML
}
#endif //SR_ENGINE_GRAPHICS_HTML_RENDERER_H
diff --git a/src/Graphics/Pass/HTMLDrawerPass.cpp b/src/Graphics/Pass/HTMLDrawerPass.cpp
index 9fca6262..3a117da2 100644
--- a/src/Graphics/Pass/HTMLDrawerPass.cpp
+++ b/src/Graphics/Pass/HTMLDrawerPass.cpp
@@ -10,7 +10,12 @@
#include
namespace SR_GRAPH_NS {
+#ifdef SR_COMMON_LITEHTML
SR_REGISTER_RENDER_PASS(HTMLDrawerPass)
+ HTMLDrawerPass::~HTMLDrawerPass() {
+ SRAssert2(m_fileWatchers.empty(), "Watchers are not empty!");
+ SRAssert2(!m_pPage, "Page is not empty!");
+ }
HTMLDrawerPass::~HTMLDrawerPass() {
SRAssert2(m_fileWatchers.empty(), "Watchers are not empty!");
@@ -173,4 +178,5 @@ namespace SR_GRAPH_NS {
m_pPage->GetDocument()->render(static_cast(size.x));
}
+#endif //SR_COMMON_LITEHTML
}
diff --git a/src/Graphics/Render/HTML/HTMLDrawableElement.cpp b/src/Graphics/Render/HTML/HTMLDrawableElement.cpp
index 2912d929..8f5b4cd9 100644
--- a/src/Graphics/Render/HTML/HTMLDrawableElement.cpp
+++ b/src/Graphics/Render/HTML/HTMLDrawableElement.cpp
@@ -62,12 +62,12 @@ namespace SR_GRAPH_NS {
position.y = -position.y - context.size.y;
position = SR_MATH_NS::FVector2(-1, 1) + (position / context.resolution);
- m_pShader->SetVec2("position"_atom_hash_cexpr, position);
- m_pShader->SetVec2("size"_atom_hash_cexpr, context.size / context.resolution);
+ m_pShader->SetVec2("position"_atom_hash, position);
+ m_pShader->SetVec2("size"_atom_hash, context.size / context.resolution);
if (style.backgroundColor.colorType == SR_UTILS_NS::Web::CSSColor::ColorType::RGBA) {
- m_pShader->SetVec4("backgroundColor"_atom_hash_cexpr, style.backgroundColor.color.ToFColor());
- //m_pShader->SetVec4("backgroundColor"_atom_hash_cexpr, SR_MATH_NS::FColor::Cyan());
+ m_pShader->SetVec4("backgroundColor"_atom_hash, style.backgroundColor.color.ToFColor());
+ //m_pShader->SetVec4("backgroundColor"_atom_hash, SR_MATH_NS::FColor::Cyan());
}
SR_MAYBE_UNUSED_VAR m_pShader->Flush();
diff --git a/src/Graphics/Render/HTMLRenderer.cpp b/src/Graphics/Render/HTMLRenderer.cpp
index 482690f1..32793170 100644
--- a/src/Graphics/Render/HTMLRenderer.cpp
+++ b/src/Graphics/Render/HTMLRenderer.cpp
@@ -14,10 +14,12 @@ namespace SR_GRAPH_NS {
SR_UTILS_NS::StringAtom SR_SOLID_FILL_SHADER = "solid-fill"_atom;
SR_UTILS_NS::StringAtom SR_TEXT_SHADER = "text"_atom;
+
std::vector SR_HTML_SHADERS = {
SR_SOLID_FILL_SHADER, SR_TEXT_SHADER
};
+#ifdef SR_COMMON_LITEHTML
HTMLRenderContainer::HTMLRenderContainer()
: Super()
, m_uboManager(SR_GRAPH_NS::Memory::UBOManager::Instance())
@@ -122,6 +124,7 @@ namespace SR_GRAPH_NS {
m_pipeline->SetDirty(true);
}
+
if (SR_UTILS_NS::Input::Instance().GetKey(SR_UTILS_NS::KeyCode::RightArrow)) {
m_scroll.x -= 10;
m_pipeline->SetDirty(true);
@@ -132,6 +135,7 @@ namespace SR_GRAPH_NS {
continue;
}
+
if (shaderInfo.pShader->BeginSharedUBO()) {
if (m_pCamera) {
shaderInfo.pShader->SetMat4(SHADER_ORTHOGONAL_MATRIX, m_pCamera->GetOrthogonal());
@@ -167,9 +171,11 @@ namespace SR_GRAPH_NS {
void HTMLRenderContainer::get_client_rect(litehtml::position& client) const {
SR_TRACY_ZONE;
+
client.x = 0;
client.y = 0;
+
if (m_pCamera) {
client.width = m_pCamera->GetSize().Cast().x;
client.height = m_pCamera->GetSize().Cast().y;
@@ -285,9 +291,11 @@ namespace SR_GRAPH_NS {
position.x = position.x + box.width;
position.y = -position.y - box.height;
- pShader->SetVec2("position"_atom_hash_cexpr, SR_MATH_NS::FVector2(-1, 1) + position / m_viewSize);
- pShader->SetVec2("size"_atom_hash_cexpr, SR_MATH_NS::FVector2(box.width, box.height) / m_viewSize);
- pShader->SetVec4("color"_atom_hash_cexpr, SR_MATH_NS::FColor(color.red, color.green, color.blue, color.alpha) / 255.f);
+
+ pShader->SetVec2("position"_atom_hash, SR_MATH_NS::FVector2(-1, 1) + position / m_viewSize);
+ pShader->SetVec2("size"_atom_hash, SR_MATH_NS::FVector2(box.width, box.height) / m_viewSize);
+ pShader->SetVec4("color"_atom_hash, SR_MATH_NS::FColor(color.red, color.green, color.blue, color.alpha) / 255.f);
+
DrawElement(shaderInfo);
UpdateElement(shaderInfo);
EndElement(shaderInfo);
@@ -307,6 +315,12 @@ namespace SR_GRAPH_NS {
}
ShaderInfo& shaderInfo = pIt->second;
+ auto&& pTextAtlas = GetTextAtlas(text, reinterpret_cast(hFont));
+ if (!pTextAtlas) {
+ return;
+ }
+ ShaderInfo& shaderInfo = pIt->second;
+
auto&& pTextAtlas = GetTextAtlas(text, reinterpret_cast(hFont));
if (!pTextAtlas) {
return;
@@ -318,6 +332,13 @@ namespace SR_GRAPH_NS {
auto&& pShader = m_pipeline->GetCurrentShader();
+ if (!BeginElement(shaderInfo)) {
+ return;
+ }
+
+ auto&& pShader = m_pipeline->GetCurrentShader();
+
+
litehtml::position box = pos;
box.height += pTextAtlas->pTextBuilderRef->GetHeight();
@@ -325,9 +346,11 @@ namespace SR_GRAPH_NS {
position.x = position.x + box.width;
position.y = -position.y - box.height;
- pShader->SetVec2("position"_atom_hash_cexpr, SR_MATH_NS::FVector2(-1, 1) + position / m_viewSize);
- pShader->SetVec2("size"_atom_hash_cexpr, SR_MATH_NS::FVector2(box.width, box.height) / m_viewSize);
- pShader->SetVec4("color"_atom_hash_cexpr, SR_MATH_NS::FColor(color.red, color.green, color.blue, color.alpha) / 255.f);
+
+ pShader->SetVec2("position"_atom_hash, SR_MATH_NS::FVector2(-1, 1) + position / m_viewSize);
+ pShader->SetVec2("size"_atom_hash, SR_MATH_NS::FVector2(box.width, box.height) / m_viewSize);
+ pShader->SetVec4("color"_atom_hash, SR_MATH_NS::FColor(color.red, color.green, color.blue, color.alpha) / 255.f);
+
pShader->SetSampler2D("textAtlas", pTextAtlas->id);
DrawElement(shaderInfo);
@@ -451,4 +474,5 @@ namespace SR_GRAPH_NS {
m_pipeline->Draw(4);
}
}
+#endif //SR_COMMON_LITEHTML
}