Clean up debug visualization
Allow toggle (triangle) normal / (bi)tangent / wireframe separately
This commit is contained in:
parent
9d9502e99c
commit
ac8294abdb
@ -1,3 +1,9 @@
|
||||
uniform int enable_normals;
|
||||
uniform int enable_tangents;
|
||||
uniform int enable_bitangents;
|
||||
uniform int enable_wireframe;
|
||||
uniform int enable_triangle_normals;
|
||||
|
||||
layout(triangles) in;
|
||||
layout(line_strip, max_vertices = 24) out;
|
||||
|
||||
@ -9,6 +15,13 @@ flat out vec4 o_color;
|
||||
|
||||
void main()
|
||||
{
|
||||
if (enable_normals == 0 && enable_tangents == 0 &&
|
||||
enable_bitangents == 0 && enable_wireframe == 0 &&
|
||||
enable_triangle_normals == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// colors for different type of new lines
|
||||
vec4 edge_color = vec4(0.2, 0.1, 0.1, 1.0);
|
||||
vec4 face_normal_color = vec4(0.5, 0.7, 0.2, 1.0);
|
||||
@ -47,56 +60,71 @@ void main()
|
||||
// get position of the vertex
|
||||
vec3 P = gl_in[i].gl_Position.xyz;
|
||||
|
||||
// create normal for vertex
|
||||
o_color = normal_color;
|
||||
gl_Position = pos[i];
|
||||
EmitVertex();
|
||||
gl_Position = u_projection_view_matrix * vec4(P + o_normal[i].xyz
|
||||
* normal_scale, 1.0);
|
||||
EmitVertex();
|
||||
EndPrimitive();
|
||||
if (enable_normals > 0)
|
||||
{
|
||||
// create normal for vertex
|
||||
o_color = normal_color;
|
||||
gl_Position = pos[i];
|
||||
EmitVertex();
|
||||
gl_Position = u_projection_view_matrix * vec4(P + o_normal[i].xyz
|
||||
* normal_scale, 1.0);
|
||||
EmitVertex();
|
||||
EndPrimitive();
|
||||
}
|
||||
|
||||
// create tangent for vertex
|
||||
o_color = tangent_color;
|
||||
gl_Position = pos[i];
|
||||
EmitVertex();
|
||||
gl_Position = u_projection_view_matrix *
|
||||
vec4(P + o_tangent[i].xyz * normal_scale, 1.0);
|
||||
EmitVertex();
|
||||
EndPrimitive();
|
||||
if (enable_tangents > 0)
|
||||
{
|
||||
// create tangent for vertex
|
||||
o_color = tangent_color;
|
||||
gl_Position = pos[i];
|
||||
EmitVertex();
|
||||
gl_Position = u_projection_view_matrix *
|
||||
vec4(P + o_tangent[i].xyz * normal_scale, 1.0);
|
||||
EmitVertex();
|
||||
EndPrimitive();
|
||||
}
|
||||
|
||||
// create bitangent for vertex
|
||||
o_color = bitangent_color;
|
||||
gl_Position = pos[i];
|
||||
if (enable_bitangents > 0)
|
||||
{
|
||||
// create bitangent for vertex
|
||||
o_color = bitangent_color;
|
||||
gl_Position = pos[i];
|
||||
EmitVertex();
|
||||
gl_Position = u_projection_view_matrix * vec4(P +
|
||||
o_bitangent[i].xyz * normal_scale, 1.0);
|
||||
EmitVertex();
|
||||
EndPrimitive();
|
||||
}
|
||||
}
|
||||
|
||||
if (enable_wireframe > 0)
|
||||
{
|
||||
// create edges for triangle
|
||||
o_color = edge_color;
|
||||
gl_Position = pos[0];
|
||||
EmitVertex();
|
||||
gl_Position = u_projection_view_matrix * vec4(P +
|
||||
o_bitangent[i].xyz * normal_scale, 1.0);
|
||||
gl_Position = pos[1];
|
||||
EmitVertex();
|
||||
gl_Position = pos[2];
|
||||
EmitVertex();
|
||||
gl_Position = pos[0];
|
||||
EmitVertex();
|
||||
// end line strip after four added vertices, so we will get three lines
|
||||
EndPrimitive();
|
||||
}
|
||||
|
||||
// create edges for triangle
|
||||
o_color = edge_color;
|
||||
gl_Position = pos[0];
|
||||
EmitVertex();
|
||||
gl_Position = pos[1];
|
||||
EmitVertex();
|
||||
gl_Position = pos[2];
|
||||
EmitVertex();
|
||||
gl_Position = pos[0];
|
||||
EmitVertex();
|
||||
// end line strip after four added vertices, so we will get three lines
|
||||
EndPrimitive();
|
||||
if (enable_triangle_normals > 0)
|
||||
{
|
||||
// create normal for triangle
|
||||
o_color = face_normal_color;
|
||||
|
||||
// create normal for triangle
|
||||
o_color = face_normal_color;
|
||||
|
||||
// position as arithmetic average
|
||||
vec3 P = (gl_in[0].gl_Position.xyz + gl_in[1].gl_Position.xyz
|
||||
+ gl_in[2].gl_Position.xyz) / 3.0;
|
||||
gl_Position = u_projection_view_matrix * vec4(P, 1.0);
|
||||
EmitVertex();
|
||||
gl_Position = u_projection_view_matrix * vec4(P + N * normal_scale, 1.0);
|
||||
EmitVertex();
|
||||
EndPrimitive();
|
||||
// position as arithmetic average
|
||||
vec3 P = (gl_in[0].gl_Position.xyz + gl_in[1].gl_Position.xyz
|
||||
+ gl_in[2].gl_Position.xyz) / 3.0;
|
||||
gl_Position = u_projection_view_matrix * vec4(P, 1.0);
|
||||
EmitVertex();
|
||||
gl_Position = u_projection_view_matrix * vec4(P + N * normal_scale, 1.0);
|
||||
EmitVertex();
|
||||
EndPrimitive();
|
||||
}
|
||||
}
|
||||
|
@ -134,10 +134,9 @@ IrrDriver::IrrDriver()
|
||||
m_request_screenshot = false;
|
||||
m_renderer = NULL;
|
||||
m_wind = new Wind();
|
||||
|
||||
m_mipviz = m_wireframe = m_normals = m_ssaoviz = false;
|
||||
m_lightviz = m_shadowviz = m_distortviz = m_rsm = m_rh = m_gi = false;
|
||||
m_boundingboxesviz = false;
|
||||
m_ssaoviz = false;
|
||||
m_shadowviz = false;
|
||||
m_boundingboxesviz = false;
|
||||
m_last_light_bucket_distance = 0;
|
||||
m_clear_color = video::SColor(255, 100, 101, 140);
|
||||
m_skinning_joint = 0;
|
||||
@ -1967,3 +1966,14 @@ GLuint IrrDriver::getDepthStencilTexture()
|
||||
return m_renderer->getDepthStencilTexture();
|
||||
} // getDepthStencilTexture
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void IrrDriver::resetDebugModes()
|
||||
{
|
||||
m_ssaoviz = false;
|
||||
m_shadowviz = false;
|
||||
m_lightviz = false;
|
||||
m_boundingboxesviz = false;
|
||||
#ifndef SERVER_ONLY
|
||||
SP::sp_debug_view = false;
|
||||
#endif
|
||||
}
|
||||
|
@ -156,16 +156,9 @@ private:
|
||||
|
||||
bool m_request_screenshot;
|
||||
|
||||
bool m_wireframe;
|
||||
bool m_mipviz;
|
||||
bool m_normals;
|
||||
bool m_ssaoviz;
|
||||
bool m_rsm;
|
||||
bool m_rh;
|
||||
bool m_gi;
|
||||
bool m_shadowviz;
|
||||
bool m_lightviz;
|
||||
bool m_distortviz;
|
||||
bool m_boundingboxesviz;
|
||||
bool m_recording;
|
||||
|
||||
@ -352,61 +345,16 @@ public:
|
||||
GLuint getRenderTargetTexture(TypeRTT which);
|
||||
GLuint getDepthStencilTexture();
|
||||
// ------------------------------------------------------------------------
|
||||
void resetDebugModes()
|
||||
{
|
||||
m_wireframe = false;
|
||||
m_mipviz = false;
|
||||
m_normals = false;
|
||||
m_ssaoviz = false;
|
||||
m_rsm = false;
|
||||
m_rh = false;
|
||||
m_gi = false;
|
||||
m_shadowviz = false;
|
||||
m_lightviz = false;
|
||||
m_distortviz = false;
|
||||
m_boundingboxesviz = false;
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
void toggleWireframe() { m_wireframe = !m_wireframe; }
|
||||
// ------------------------------------------------------------------------
|
||||
bool getWireframe() { return m_wireframe; }
|
||||
// ------------------------------------------------------------------------
|
||||
void toggleMipVisualization() { m_mipviz = !m_mipviz; }
|
||||
// ------------------------------------------------------------------------
|
||||
bool getMipViz() { return m_mipviz; }
|
||||
// ------------------------------------------------------------------------
|
||||
void toggleNormals() { m_normals = !m_normals; }
|
||||
// ------------------------------------------------------------------------
|
||||
bool getNormals() { return m_normals; }
|
||||
void resetDebugModes();
|
||||
// ------------------------------------------------------------------------
|
||||
void toggleSSAOViz() { m_ssaoviz = !m_ssaoviz; }
|
||||
// ------------------------------------------------------------------------
|
||||
void toggleLightViz() { m_lightviz = !m_lightviz; }
|
||||
// ------------------------------------------------------------------------
|
||||
bool getLightViz() { return m_lightviz; }
|
||||
// ------------------------------------------------------------------------
|
||||
bool getSSAOViz() { return m_ssaoviz; }
|
||||
// ------------------------------------------------------------------------
|
||||
void toggleRSM() { m_rsm = !m_rsm; }
|
||||
// ------------------------------------------------------------------------
|
||||
bool getRSM() { return m_rsm; }
|
||||
// ------------------------------------------------------------------------
|
||||
void toggleRH() { m_rh = !m_rh; }
|
||||
// ------------------------------------------------------------------------
|
||||
bool getRH() { return m_rh; }
|
||||
// ------------------------------------------------------------------------
|
||||
void toggleGI() { m_gi = !m_gi; }
|
||||
// ------------------------------------------------------------------------
|
||||
bool getGI() { return m_gi; }
|
||||
// ------------------------------------------------------------------------
|
||||
void toggleShadowViz() { m_shadowviz = !m_shadowviz; }
|
||||
// ------------------------------------------------------------------------
|
||||
bool getShadowViz() { return m_shadowviz; }
|
||||
// ------------------------------------------------------------------------
|
||||
void toggleDistortViz() { m_distortviz = !m_distortviz; }
|
||||
// ------------------------------------------------------------------------
|
||||
bool getDistortViz() { return m_distortviz; }
|
||||
// ------------------------------------------------------------------------
|
||||
void toggleBoundingBoxesViz() { m_boundingboxesviz = !m_boundingboxesviz; }
|
||||
// ------------------------------------------------------------------------
|
||||
bool getBoundingBoxesViz() { return m_boundingboxesviz; }
|
||||
|
@ -360,12 +360,12 @@ void ShaderBasedRenderer::renderSceneDeferred(scene::ICameraSceneNode * const ca
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
}
|
||||
|
||||
if (irr_driver->getNormals())
|
||||
if (SP::sp_debug_view)
|
||||
{
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDepthMask(GL_TRUE);
|
||||
m_rtts->getFBO(FBO_NORMAL_AND_DEPTHS).bind();
|
||||
SP::drawNormal();
|
||||
SP::drawSPDebugView();
|
||||
m_rtts->getFBO(FBO_COLORS).bind();
|
||||
}
|
||||
|
||||
@ -558,7 +558,7 @@ void ShaderBasedRenderer::renderPostProcessing(Camera * const camera,
|
||||
glViewport(0, 0, irr_driver->getActualScreenSize().Width,
|
||||
irr_driver->getActualScreenSize().Height);
|
||||
|
||||
if (irr_driver->getNormals())
|
||||
if (SP::sp_debug_view)
|
||||
{
|
||||
m_rtts->getFBO(FBO_NORMAL_AND_DEPTHS).blitToDefault(
|
||||
viewport.UpperLeftCorner.X,
|
||||
|
@ -67,6 +67,8 @@ std::array<float, 16>* g_joint_ptr = NULL;
|
||||
// ----------------------------------------------------------------------------
|
||||
bool sp_culling = true;
|
||||
// ----------------------------------------------------------------------------
|
||||
bool sp_debug_view = false;
|
||||
// ----------------------------------------------------------------------------
|
||||
bool g_handle_shadow = false;
|
||||
// ----------------------------------------------------------------------------
|
||||
SPShader* g_normal_visualizer = NULL;
|
||||
@ -377,6 +379,7 @@ void loadShaders()
|
||||
shader->linkShaderFiles(RP_1ST);
|
||||
shader->use(RP_1ST);
|
||||
shader->addBasicUniforms(RP_1ST);
|
||||
shader->addAllUniforms(RP_1ST);
|
||||
shader->addAllTextures(RP_1ST);
|
||||
});
|
||||
SPShaderManager::get()->addSPShader(sps->getName(), sps);
|
||||
@ -1215,7 +1218,7 @@ void uploadAll()
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void drawNormal()
|
||||
void drawSPDebugView()
|
||||
{
|
||||
if (g_normal_visualizer == NULL)
|
||||
{
|
||||
|
@ -92,6 +92,7 @@ extern unsigned sp_solid_poly_count;
|
||||
extern unsigned sp_shadow_poly_count;
|
||||
extern int sp_cur_shadow_cascade;
|
||||
extern bool sp_culling;
|
||||
extern bool sp_debug_view;
|
||||
extern unsigned sp_cur_player;
|
||||
extern unsigned sp_cur_buf_id[MAX_PLAYER_COUNT];
|
||||
extern irr::core::vector3df sp_wind_dir;
|
||||
@ -112,7 +113,7 @@ void draw(RenderPass, DrawCallType dct = DCT_NORMAL);
|
||||
// ----------------------------------------------------------------------------
|
||||
void drawGlow();
|
||||
// ----------------------------------------------------------------------------
|
||||
void drawNormal();
|
||||
void drawSPDebugView();
|
||||
// ----------------------------------------------------------------------------
|
||||
void addObject(SPMeshNode*);
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -135,6 +135,8 @@ public:
|
||||
// ------------------------------------------------------------------------
|
||||
bool hasShader(RenderPass rp) { return m_program[rp] != 0; }
|
||||
// ------------------------------------------------------------------------
|
||||
GLuint getShaderProgram(RenderPass rp) { return m_program[rp]; }
|
||||
// ------------------------------------------------------------------------
|
||||
void use(RenderPass rp = RP_1ST)
|
||||
{
|
||||
if (m_use_function[rp] != NULL)
|
||||
|
@ -66,6 +66,66 @@ public:
|
||||
return true;
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
void getValue(const GLuint& p, irr::core::matrix4& mat) const
|
||||
{
|
||||
if (rumtimeChecking(typeid(mat)))
|
||||
{
|
||||
#ifndef SERVER_ONLY
|
||||
glGetUniformfv(p, m_location, mat.pointer());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
void getValue(const GLuint& p, std::array<float, 4>& v) const
|
||||
{
|
||||
if (rumtimeChecking(typeid(v)))
|
||||
{
|
||||
#ifndef SERVER_ONLY
|
||||
glGetUniformfv(p, m_location, v.data());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
void getValue(const GLuint& p, irr::core::vector3df& v) const
|
||||
{
|
||||
if (rumtimeChecking(typeid(v)))
|
||||
{
|
||||
#ifndef SERVER_ONLY
|
||||
glGetUniformfv(p, m_location, &v.X);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
void getValue(const GLuint& p, irr::core::vector2df& v) const
|
||||
{
|
||||
if (rumtimeChecking(typeid(v)))
|
||||
{
|
||||
#ifndef SERVER_ONLY
|
||||
glGetUniformfv(p, m_location, &v.X);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
void getValue(const GLuint& p, float& v) const
|
||||
{
|
||||
if (rumtimeChecking(typeid(v)))
|
||||
{
|
||||
#ifndef SERVER_ONLY
|
||||
glGetUniformfv(p, m_location, &v);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
void getValue(const GLuint& p, int& v) const
|
||||
{
|
||||
if (rumtimeChecking(typeid(v)))
|
||||
{
|
||||
#ifndef SERVER_ONLY
|
||||
glGetUniformiv(p, m_location, &v);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
void setValue(const irr::core::matrix4& mat) const
|
||||
{
|
||||
if (rumtimeChecking(typeid(mat)))
|
||||
|
@ -31,7 +31,9 @@
|
||||
#include "graphics/shader.hpp"
|
||||
#include "graphics/sp/sp_base.hpp"
|
||||
#include "graphics/sp/sp_shader_manager.hpp"
|
||||
#include "graphics/sp/sp_shader.hpp"
|
||||
#include "graphics/sp/sp_texture_manager.hpp"
|
||||
#include "graphics/sp/sp_uniform_assigner.hpp"
|
||||
#include "guiengine/widgets/label_widget.hpp"
|
||||
#include "guiengine/widgets/text_box_widget.hpp"
|
||||
#include "items/powerup_manager.hpp"
|
||||
@ -76,24 +78,23 @@ enum DebugMenuCommand
|
||||
//! graphics commands
|
||||
DEBUG_GRAPHICS_RELOAD_SHADERS,
|
||||
DEBUG_GRAPHICS_RESET,
|
||||
DEBUG_GRAPHICS_WIREFRAME,
|
||||
DEBUG_GRAPHICS_MIPMAP_VIZ,
|
||||
DEBUG_GRAPHICS_NORMALS_VIZ,
|
||||
DEBUG_GRAPHICS_SSAO_VIZ,
|
||||
DEBUG_GRAPHICS_RSM_VIZ,
|
||||
DEBUG_GRAPHICS_RH_VIZ,
|
||||
DEBUG_GRAPHICS_GI_VIZ,
|
||||
DEBUG_GRAPHICS_SHADOW_VIZ,
|
||||
DEBUG_GRAPHICS_LIGHT_VIZ,
|
||||
DEBUG_GRAPHICS_DISTORT_VIZ,
|
||||
DEBUG_GRAPHICS_BOUNDING_BOXES_VIZ,
|
||||
DEBUG_GRAPHICS_BULLET_1,
|
||||
DEBUG_GRAPHICS_BULLET_2,
|
||||
DEBUG_GRAPHICS_BOUNDING_BOXES_VIZ,
|
||||
DEBUG_GRAPHICS_TOGGLE_CULLING,
|
||||
DEBUG_PROFILER,
|
||||
DEBUG_PROFILER_WRITE_REPORT,
|
||||
DEBUG_FONT_DUMP_GLYPH_PAGE,
|
||||
DEBUG_FONT_RELOAD,
|
||||
DEBUG_SP_RESET,
|
||||
DEBUG_SP_TOGGLE_CULLING,
|
||||
DEBUG_SP_WN_VIZ,
|
||||
DEBUG_SP_NORMALS_VIZ,
|
||||
DEBUG_SP_TANGENTS_VIZ,
|
||||
DEBUG_SP_BITANGENTS_VIZ,
|
||||
DEBUG_SP_WIREFRAME_VIZ,
|
||||
DEBUG_SP_TN_VIZ,
|
||||
DEBUG_FPS,
|
||||
DEBUG_SAVE_REPLAY,
|
||||
DEBUG_SAVE_HISTORY,
|
||||
@ -244,6 +245,14 @@ bool handleContextMenuAction(s32 cmd_id)
|
||||
|
||||
World *world = World::getWorld();
|
||||
Physics *physics = Physics::getInstance();
|
||||
SP::SPShader* nv = NULL;
|
||||
#ifndef SERVER_ONLY
|
||||
if (SP::getNormalVisualizer())
|
||||
{
|
||||
nv = SP::getNormalVisualizer();
|
||||
}
|
||||
#endif
|
||||
|
||||
switch(cmd_id)
|
||||
{
|
||||
case DEBUG_GRAPHICS_RELOAD_SHADERS:
|
||||
@ -261,27 +270,6 @@ bool handleContextMenuAction(s32 cmd_id)
|
||||
|
||||
irr_driver->resetDebugModes();
|
||||
break;
|
||||
case DEBUG_GRAPHICS_WIREFRAME:
|
||||
if (physics)
|
||||
physics->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
|
||||
irr_driver->resetDebugModes();
|
||||
irr_driver->toggleWireframe();
|
||||
break;
|
||||
case DEBUG_GRAPHICS_MIPMAP_VIZ:
|
||||
if (physics)
|
||||
physics->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
|
||||
irr_driver->resetDebugModes();
|
||||
irr_driver->toggleMipVisualization();
|
||||
break;
|
||||
case DEBUG_GRAPHICS_NORMALS_VIZ:
|
||||
if (physics)
|
||||
physics->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
|
||||
irr_driver->resetDebugModes();
|
||||
irr_driver->toggleNormals();
|
||||
break;
|
||||
case DEBUG_GRAPHICS_SSAO_VIZ:
|
||||
if (physics)
|
||||
physics->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
@ -289,27 +277,6 @@ bool handleContextMenuAction(s32 cmd_id)
|
||||
irr_driver->resetDebugModes();
|
||||
irr_driver->toggleSSAOViz();
|
||||
break;
|
||||
case DEBUG_GRAPHICS_RSM_VIZ:
|
||||
if (physics)
|
||||
physics->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
|
||||
irr_driver->resetDebugModes();
|
||||
irr_driver->toggleRSM();
|
||||
break;
|
||||
case DEBUG_GRAPHICS_RH_VIZ:
|
||||
if (physics)
|
||||
physics->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
|
||||
irr_driver->resetDebugModes();
|
||||
irr_driver->toggleRH();
|
||||
break;
|
||||
case DEBUG_GRAPHICS_GI_VIZ:
|
||||
if (physics)
|
||||
physics->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
|
||||
irr_driver->resetDebugModes();
|
||||
irr_driver->toggleGI();
|
||||
break;
|
||||
case DEBUG_GRAPHICS_SHADOW_VIZ:
|
||||
if (physics)
|
||||
physics->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
@ -317,19 +284,12 @@ bool handleContextMenuAction(s32 cmd_id)
|
||||
irr_driver->resetDebugModes();
|
||||
irr_driver->toggleShadowViz();
|
||||
break;
|
||||
case DEBUG_GRAPHICS_LIGHT_VIZ:
|
||||
case DEBUG_GRAPHICS_BOUNDING_BOXES_VIZ:
|
||||
if (physics)
|
||||
physics->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
|
||||
irr_driver->resetDebugModes();
|
||||
irr_driver->toggleLightViz();
|
||||
break;
|
||||
case DEBUG_GRAPHICS_DISTORT_VIZ:
|
||||
if (physics)
|
||||
physics->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
|
||||
irr_driver->resetDebugModes();
|
||||
irr_driver->toggleDistortViz();
|
||||
irr_driver->toggleBoundingBoxesViz();
|
||||
break;
|
||||
case DEBUG_GRAPHICS_BULLET_1:
|
||||
irr_driver->resetDebugModes();
|
||||
@ -346,15 +306,142 @@ bool handleContextMenuAction(s32 cmd_id)
|
||||
physics->setDebugMode(IrrDebugDrawer::DM_NO_KARTS_GRAPHICS);
|
||||
break;
|
||||
}
|
||||
case DEBUG_GRAPHICS_BOUNDING_BOXES_VIZ:
|
||||
case DEBUG_SP_RESET:
|
||||
irr_driver->resetDebugModes();
|
||||
irr_driver->toggleBoundingBoxesViz();
|
||||
if (physics)
|
||||
physics->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
#ifndef SERVER_ONLY
|
||||
SP::sp_culling = true;
|
||||
#endif
|
||||
break;
|
||||
case DEBUG_GRAPHICS_TOGGLE_CULLING:
|
||||
case DEBUG_SP_TOGGLE_CULLING:
|
||||
#ifndef SERVER_ONLY
|
||||
SP::sp_culling = !SP::sp_culling;
|
||||
#endif
|
||||
break;
|
||||
case DEBUG_SP_WN_VIZ:
|
||||
irr_driver->resetDebugModes();
|
||||
if (physics)
|
||||
physics->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
#ifndef SERVER_ONLY
|
||||
SP::sp_debug_view = true;
|
||||
#endif
|
||||
break;
|
||||
case DEBUG_SP_NORMALS_VIZ:
|
||||
{
|
||||
irr_driver->resetDebugModes();
|
||||
if (physics)
|
||||
physics->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
#ifndef SERVER_ONLY
|
||||
SP::sp_debug_view = true;
|
||||
int normal = 0;
|
||||
if (nv)
|
||||
{
|
||||
SP::SPUniformAssigner* ua = nv->getUniformAssigner("enable_normals");
|
||||
if (ua)
|
||||
{
|
||||
ua->getValue(nv->getShaderProgram(SP::RP_1ST), normal);
|
||||
normal = normal == 0 ? 1 : 0;
|
||||
nv->use();
|
||||
ua->setValue(normal);
|
||||
glUseProgram(0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case DEBUG_SP_TANGENTS_VIZ:
|
||||
{
|
||||
irr_driver->resetDebugModes();
|
||||
if (physics)
|
||||
physics->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
#ifndef SERVER_ONLY
|
||||
SP::sp_debug_view = true;
|
||||
int tangents = 0;
|
||||
if (nv)
|
||||
{
|
||||
SP::SPUniformAssigner* ua = nv->getUniformAssigner("enable_tangents");
|
||||
if (ua)
|
||||
{
|
||||
ua->getValue(nv->getShaderProgram(SP::RP_1ST), tangents);
|
||||
tangents = tangents == 0 ? 1 : 0;
|
||||
nv->use();
|
||||
ua->setValue(tangents);
|
||||
glUseProgram(0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case DEBUG_SP_BITANGENTS_VIZ:
|
||||
{
|
||||
irr_driver->resetDebugModes();
|
||||
if (physics)
|
||||
physics->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
#ifndef SERVER_ONLY
|
||||
SP::sp_debug_view = true;
|
||||
int bitangents = 0;
|
||||
if (nv)
|
||||
{
|
||||
SP::SPUniformAssigner* ua = nv->getUniformAssigner("enable_bitangents");
|
||||
if (ua)
|
||||
{
|
||||
ua->getValue(nv->getShaderProgram(SP::RP_1ST), bitangents);
|
||||
bitangents = bitangents == 0 ? 1 : 0;
|
||||
nv->use();
|
||||
ua->setValue(bitangents);
|
||||
glUseProgram(0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case DEBUG_SP_WIREFRAME_VIZ:
|
||||
{
|
||||
irr_driver->resetDebugModes();
|
||||
if (physics)
|
||||
physics->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
#ifndef SERVER_ONLY
|
||||
SP::sp_debug_view = true;
|
||||
int wireframe = 0;
|
||||
if (nv)
|
||||
{
|
||||
SP::SPUniformAssigner* ua = nv->getUniformAssigner("enable_wireframe");
|
||||
if (ua)
|
||||
{
|
||||
ua->getValue(nv->getShaderProgram(SP::RP_1ST), wireframe);
|
||||
wireframe = wireframe == 0 ? 1 : 0;
|
||||
nv->use();
|
||||
ua->setValue(wireframe);
|
||||
glUseProgram(0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case DEBUG_SP_TN_VIZ:
|
||||
{
|
||||
irr_driver->resetDebugModes();
|
||||
if (physics)
|
||||
physics->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
#ifndef SERVER_ONLY
|
||||
SP::sp_debug_view = true;
|
||||
int triangle_normals = 0;
|
||||
if (nv)
|
||||
{
|
||||
SP::SPUniformAssigner* ua = nv->getUniformAssigner("enable_triangle_normals");
|
||||
if (ua)
|
||||
{
|
||||
ua->getValue(nv->getShaderProgram(SP::RP_1ST), triangle_normals);
|
||||
triangle_normals = triangle_normals == 0 ? 1 : 0;
|
||||
nv->use();
|
||||
ua->setValue(triangle_normals);
|
||||
glUseProgram(0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case DEBUG_PROFILER:
|
||||
profiler.toggleStatus();
|
||||
break;
|
||||
@ -756,22 +843,13 @@ bool onEvent(const SEvent &event)
|
||||
// graphics menu
|
||||
IGUIContextMenu* sub = mnu->getSubMenu(graphicsMenuIndex);
|
||||
|
||||
sub->addItem(L"Reload shaders", DEBUG_GRAPHICS_RELOAD_SHADERS );
|
||||
sub->addItem(L"Wireframe", DEBUG_GRAPHICS_WIREFRAME );
|
||||
sub->addItem(L"Mipmap viz", DEBUG_GRAPHICS_MIPMAP_VIZ );
|
||||
sub->addItem(L"Normals viz", DEBUG_GRAPHICS_NORMALS_VIZ );
|
||||
sub->addItem(L"SSAO viz", DEBUG_GRAPHICS_SSAO_VIZ );
|
||||
sub->addItem(L"RSM viz", DEBUG_GRAPHICS_RSM_VIZ);
|
||||
sub->addItem(L"RH viz", DEBUG_GRAPHICS_RH_VIZ);
|
||||
sub->addItem(L"GI viz", DEBUG_GRAPHICS_GI_VIZ);
|
||||
sub->addItem(L"Shadow viz", DEBUG_GRAPHICS_SHADOW_VIZ );
|
||||
sub->addItem(L"Light viz", DEBUG_GRAPHICS_LIGHT_VIZ );
|
||||
sub->addItem(L"Distort viz", DEBUG_GRAPHICS_DISTORT_VIZ );
|
||||
sub->addItem(L"Reload shaders", DEBUG_GRAPHICS_RELOAD_SHADERS);
|
||||
sub->addItem(L"SSAO viz", DEBUG_GRAPHICS_SSAO_VIZ);
|
||||
sub->addItem(L"Shadow viz", DEBUG_GRAPHICS_SHADOW_VIZ);
|
||||
sub->addItem(L"Bounding Boxes viz", DEBUG_GRAPHICS_BOUNDING_BOXES_VIZ);
|
||||
sub->addItem(L"Physics debug", DEBUG_GRAPHICS_BULLET_1);
|
||||
sub->addItem(L"Physics debug (no kart)", DEBUG_GRAPHICS_BULLET_2);
|
||||
sub->addItem(L"Bounding Boxes viz", DEBUG_GRAPHICS_BOUNDING_BOXES_VIZ);
|
||||
sub->addItem(L"Toggle Culling", DEBUG_GRAPHICS_TOGGLE_CULLING);
|
||||
sub->addItem(L"Reset debug views", DEBUG_GRAPHICS_RESET );
|
||||
sub->addItem(L"Reset debug views", DEBUG_GRAPHICS_RESET);
|
||||
|
||||
mnu->addItem(L"Items >",-1,true,true);
|
||||
sub = mnu->getSubMenu(1);
|
||||
@ -827,6 +905,17 @@ bool onEvent(const SEvent &event)
|
||||
sub->addItem(L"Dump glyph pages of fonts", DEBUG_FONT_DUMP_GLYPH_PAGE);
|
||||
sub->addItem(L"Reload all fonts", DEBUG_FONT_RELOAD);
|
||||
|
||||
mnu->addItem(L"SP debug >",-1,true, true);
|
||||
sub = mnu->getSubMenu(7);
|
||||
sub->addItem(L"Reset SP debug", DEBUG_SP_RESET);
|
||||
sub->addItem(L"Toggle culling", DEBUG_SP_TOGGLE_CULLING);
|
||||
sub->addItem(L"Draw world normal in texture", DEBUG_SP_WN_VIZ);
|
||||
sub->addItem(L"Toggle normals visualization", DEBUG_SP_NORMALS_VIZ);
|
||||
sub->addItem(L"Toggle tangents visualization", DEBUG_SP_TANGENTS_VIZ);
|
||||
sub->addItem(L"Toggle bitangents visualization", DEBUG_SP_BITANGENTS_VIZ);
|
||||
sub->addItem(L"Toggle wireframe visualization", DEBUG_SP_WIREFRAME_VIZ);
|
||||
sub->addItem(L"Toggle triangle normals visualization", DEBUG_SP_TN_VIZ);
|
||||
|
||||
mnu->addItem(L"Adjust values", DEBUG_VISUAL_VALUES);
|
||||
|
||||
mnu->addItem(L"Profiler", DEBUG_PROFILER);
|
||||
|
Loading…
Reference in New Issue
Block a user