Commit e2dc4cc2 authored by Johannes Braun's avatar Johannes Braun
Browse files

Several fixes and maybe even improvements

parent e4ba8e9e
<linespace version="1.0">
<item name="subdivisions" value="30"/>
<item name="subdivisions" value="22"/>
<item name="radial-subdivision" value="50"/>
<item name="generator" value="gpu"/>
</linespace>
#version 430
#extension GL_ARB_shading_language_include : require
#extension GL_ARB_compute_variable_group_size : require
layout(rgba32f) uniform image2D u_first_image;
layout(rgba32f) uniform image2D u_second_image;
layout(rgba32f) uniform image2D u_result_heatmap;
layout(local_size_variable) in;
void main()
{
ivec2 pixel = ivec2(gl_GlobalInvocationID.xy);
vec4 pixel_first = u_first_image.imageLoad(pixel);
vec4 pixel_second = u_second_image.imageLoad(pixel);
u_result_heatmap.imageStore(pixel, abs(pixel_first - pixel_second));
}
#include <functional>
#include <core/base/program.h>
#include <core/rendering/texture_renderer.h>
#include <core/state.h>
#include <util/files.h>
using namespace glare;
int main(int argc, char* argv[])
{
core::state::initialize(files::asset("/preferences/default.xml"));
auto texture_renderer = core::DefaultTextureRenderers::makeSimpleRenderer();
system("pause");
}
\ No newline at end of file
......@@ -33,7 +33,7 @@ const fs::path engine_settings_path = files::asset("/preferences/default.xml");
const fs::path pathtracer_settings_path = files::asset("/preferences/pathtracer_default.xml");
const fs::path skybox_files_path = files::asset("/textures/ryfjallet/");
const fs::path env_audio_path = files::asset("/audio/env.wav");
const fs::path startup_scene_path = files::asset("/meshes/scenery/House.dae");
const fs::path startup_scene_path = files::asset("/meshes/scenery/TY_Plane.dae");
// My little all-enclosing pathtracer pointer
std::unique_ptr<raytrace::Pathtracer> pathtracer = nullptr;
......
......@@ -16,50 +16,16 @@ namespace glare
void GraphNode::gui()
{
/* auto cached_indent = ImGui::GetStyle().IndentSpacing;
ImGui::GetStyle().IndentSpacing = 10;*/
ImGui::PushID(("Node::" + m_name).c_str());
if (ImGui::SelectableTreeNode("tree_scene_graph", m_name.c_str(), this))
if (ImGui::SelectableTreeNode("tree_scene_graph", m_name.c_str(), this, m_children.empty() ? ImGuiTreeNodeFlags_Bullet : 0))
{
//ImGui::PushItemWidth(200);
//if (ImGui::TreeNodeEx("Transform", ImGuiTreeNodeFlags_Bullet))
//{
// // Pos
// ImGui::DragFloat3("Position", reinterpret_cast<float*>(&(transform.position)), 0.01f);
// // Rotation
// ImGui::QuaternionGizmo("Rotation", *reinterpret_cast<ImQuat*>(&transform.rotation));
//
// // Scale
// ImGui::DragFloat3("Scale", reinterpret_cast<float*>(&(transform.scale)), 0.01f);
// ImGui::TreePop();
//}
//if (!m_components.empty() && ImGui::TreeNodeEx("Components", ImGuiTreeNodeFlags_Bullet))
//{
// iterateComponentsStable([](GraphNodeComponent& component)
// {
// component.gui();
// });
// ImGui::TreePop();
//}
/*if (!m_children.empty() && ImGui::TreeNodeEx("Children"))
{*/
for (auto && child : iterateChildren())
{
child->gui();
}
/* ImGui::TreePop();
for (auto && child : iterateChildren())
{
child->gui();
}
ImGui::PopItemWidth();*/
ImGui::TreePop();
}
ImGui::PopID();
//ImGui::GetStyle().IndentSpacing = cached_indent;
}
void GraphNode::update(const glm::mat4 &parent_transform)
......
......@@ -27,7 +27,7 @@ namespace glare
void Camera::gui()
{
if (ImGui::TreeNode(("<Camera id=" + std::to_string(id()) + "> " + owner()->name()).c_str()))
if (ImGui::ComponentHeader("Camera", owner()->name().c_str(), id()))
{
ImGui::PushID(owner()->name().c_str());
if (ImGui::DragFloat("Focus Distance", &m_focus_distance, 0.05f, 0.05f, 10000.f))
......@@ -41,7 +41,6 @@ namespace glare
messaging::Handler::getInstance().submit(tags::camera, 1);
}
ImGui::PopID();
ImGui::TreePop();
}
}
......
......@@ -114,7 +114,7 @@ namespace glare
void LightComponent::gui()
{
if (ImGui::TreeNode(("<LightComponent id=" + std::to_string(id()) + "> " + owner()->name()).c_str()))
if (ImGui::ComponentHeader("Light", owner()->name().c_str(), id()))
{
bool changed = false;
ImGui::PushID(owner()->name().c_str());
......@@ -178,7 +178,6 @@ namespace glare
messaging::Handler::getInstance().submit(tags::light, LightUpdate{ m_id, this });
}
ImGui::TreePop();
}
}
......
......@@ -76,22 +76,22 @@ namespace glare
program.uniform(name+".base.texture_available", static_cast<uint32_t>(static_cast<bool>(base.texture)));
program.uniform(name+".roughness.value", roughness.value);
if (base.texture)
if (roughness.texture)
program.uniform(name+".roughness.texture", roughness.texture->makeTextureResident());
program.uniform(name+".roughness.texture_available", static_cast<uint32_t>(static_cast<bool>(roughness.texture)));
program.uniform(name+".metallic.value", metallic.value);
if (base.texture)
if (metallic.texture)
program.uniform(name+".metallic.texture", metallic.texture->makeTextureResident());
program.uniform(name+".metallic.texture_available", static_cast<uint32_t>(static_cast<bool>(metallic.texture)));
program.uniform(name+".transmission.value", transmissive.value);
if (base.texture)
if (transmissive.texture)
program.uniform(name+".transmission.texture", transmissive.texture->makeTextureResident());
program.uniform(name+".transmission.texture_available", static_cast<uint32_t>(static_cast<bool>(transmissive.texture)));
program.uniform(name+".emission.value", emission.value);
if (base.texture)
if (emission.texture)
program.uniform(name+".emission.texture", emission.texture->makeTextureResident());
program.uniform(name+".emission.texture_available", static_cast<uint32_t>(static_cast<bool>(emission.texture)));
......
......@@ -6002,7 +6002,11 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
{
// Framed type
RenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding);
RenderCollapseTriangle(bb.Min + padding + ImVec2(0.0f, text_base_offset_y), is_open, 1.0f);
if (flags & ImGuiTreeNodeFlags_Bullet)
RenderBullet(ImVec2(bb.Min.x + text_offset_x * 0.5f, (bb.Min.y + bb.Max.y) * 0.5f - g.FontSize*0.50f + padding.y + text_base_offset_y));
else
RenderCollapseTriangle(bb.Min + padding + ImVec2(0.0f, text_base_offset_y), is_open, 1.0f);
if (g.LogEnabled)
{
// NB: '##' is normally used to hide text (as a library-wide feature), so we need to specify the text range to make sure the ## aren't stripped out here.
......
......@@ -467,4 +467,9 @@ namespace ImGui {
return active;
}
bool ComponentHeader(const char* component_name, const char* owner_name, uint64_t component_id)
{
return CollapsingHeader((std::string(component_name) + " " + std::to_string(component_id)).c_str());
}
}
......@@ -46,6 +46,8 @@ namespace ImGui {
bool FeatureButton(const char* label, const ImVec2& size = ImVec2(0, 0));
bool ComponentHeader(const char* component_name, const char* owner_name, uint64_t component_id);
template<int Count>
inline bool VTabs(const std::array<std::string, Count>& names, int& current)
{
......@@ -72,9 +74,11 @@ namespace ImGui {
w->DrawList->AddLine(ImVec2(x, y1-1.f), ImVec2(x, y2-1.f), col, 2);
ImGui::GetStyle().Colors[ImGuiCol_FrameBg].w *= 0.5f;
//ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(12, 12));
auto old_pad = ImGui::GetStyle().FramePadding;
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(12, 12));
ImGui::BeginChildFrame(ImHash(names[0].c_str(), 1), ImVec2(ImGui::GetContentRegionAvailWidth(), 0));
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, old_pad);
ImGui::BeginChildFrame(ImHash(names[0].c_str(), 1), ImVec2(ImGui::GetContentRegionAvailWidth(), 0));
//ImGui::PopStyleVar();
ImGui::GetStyle().Colors[ImGuiCol_FrameBg].w *= 2.f;
ImGui::GetStyle().ItemSpacing = space;
ImGui::SameLine();
......
......@@ -216,7 +216,7 @@ namespace glare
Log_Debug << "BVH info: Nodes " << m_node_counter;
Log_Debug << "BVH info: Depth " << m_bvh_depth;
Log_Debug << "BVH info: Construction took " << timer.time() << " microseconds";
Log_Info << "BVH info: Construction took " << timer.time() << " microseconds";
}
template<typename TPrimitive>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment