#include "exman.h"
#include "blob_exhibit.h"
#include "dbg_gui.h"
+#include "geomdraw.h"
#define NEAR_CLIP 5.0
#define FAR_CLIP 10000.0
}
*/
+ if(debug_gui && dbg_sel_node) {
+ AABox bvol = dbg_sel_node->get_bounds();
+ draw_geom_object(&bvol);
+ }
+
if(show_walk_mesh && mscn->walk_mesh) {
glPushAttrib(GL_ENABLE_BIT);
glEnable(GL_BLEND);
static void render_func(ImDrawData *ddat);
bool debug_gui, parent_expanded;
+SceneNode *dbg_sel_node;
static ImGuiIO *io;
static Texture *tex;
#include "imgui/imgui.h"
+class SceneNode;
+
extern bool debug_gui;
extern bool parent_expanded;
+extern SceneNode *dbg_sel_node;
bool init_debug_gui();
void cleanup_debug_gui();
static char text[256];
if(debug_gui) {
ImGui::Begin("MetaScene nodes", 0, 0);
+ ImGui::Columns(2);
+
+ static bool once;
+ if(!once) {
+ float x = ImGui::GetColumnOffset(1);
+ ImGui::SetColumnOffset(1, x * 1.7);
+ once = true;
+ }
}
int nscn = scenes.size();
sprintf(text, "scene %3d: %s", i, scenes[i]->name.c_str());
}
expanded = parent_expanded = ImGui::TreeNode(text);
+ ImGui::NextColumn();
+ ImGui::NextColumn();
}
scenes[i]->update(dt);
}
if(debug_gui) {
+ ImGui::Columns(1);
ImGui::End();
}
}
+// XXX not used, renderer draws
void MetaScene::draw() const
{
int nscn = scenes.size();
void Renderer::draw_object(Object *obj) const
{
- obj->draw();
+ bool vis = true;
+ SceneNode *n = obj->node;
+ while(n) {
+ if(!n->visible) {
+ vis = false;
+ break;
+ }
+ n = n->get_parent();
+ }
+
+ if(vis) {
+ obj->draw();
+ }
}
scene = 0;
parent = 0;
name = 0;
+ visible = true;
local_bvol_valid = false;
}
scene = 0;
parent = 0;
name = 0;
+ visible = true;
local_bvol_valid = false;
add_object(obj);
}
if(debug_gui) {
if(parent_expanded) {
- int flags = children.empty() ? ImGuiTreeNodeFlags_Leaf : 0;
+ ImGui::PushID(this);
+ ImGui::AlignTextToFramePadding();
+
+ int flags = ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_OpenOnDoubleClick;
+ if(children.empty()) flags |= ImGuiTreeNodeFlags_Leaf;
+ if(dbg_sel_node == this) flags |= ImGuiTreeNodeFlags_Selected;
expanded = ImGui::TreeNodeEx(name ? name : "<nameless node>", flags);
+ if(ImGui::IsItemClicked()) {
+ dbg_sel_node = this;
+ }
+
+ ImGui::NextColumn();
+ ImGui::Checkbox("##vis", &visible);
+ ImGui::NextColumn();
+ ImGui::PopID();
}
}
public:
Scene *scene; // scene to which this node belongs
Mat4 dbg_xform;
+ bool visible; // if true, objects of this node are supposed to be visible
SceneNode();
explicit SceneNode(Object *obj);