Removes ShaderProgramPtr argument from DebugRenderer methods.
This was SVN commit r25329.
This commit is contained in:
parent
cd6a554198
commit
5b33d3a76c
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 2011 Wildfire Games.
|
/* Copyright (C) 2021 Wildfire Games.
|
||||||
* This file is part of 0 A.D.
|
* This file is part of 0 A.D.
|
||||||
*
|
*
|
||||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||||
@ -90,7 +90,7 @@ public:
|
|||||||
m_Rot = rot;
|
m_Rot = rot;
|
||||||
}
|
}
|
||||||
|
|
||||||
CQuaternion GetRotation() const
|
const CQuaternion& GetRotation() const
|
||||||
{
|
{
|
||||||
return m_Rot;
|
return m_Rot;
|
||||||
}
|
}
|
||||||
@ -98,7 +98,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Get the bounding box of the center points of particles at their current positions.
|
* Get the bounding box of the center points of particles at their current positions.
|
||||||
*/
|
*/
|
||||||
CBoundingBoxAligned GetParticleBounds() { return m_ParticleBounds; }
|
const CBoundingBoxAligned& GetParticleBounds() const { return m_ParticleBounds; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Push a new particle onto the ring buffer. (May overwrite an old particle.)
|
* Push a new particle onto the ring buffer. (May overwrite an old particle.)
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "lib/ogl.h"
|
#include "lib/ogl.h"
|
||||||
#include "maths/BoundingBoxAligned.h"
|
#include "maths/BoundingBoxAligned.h"
|
||||||
#include "maths/Brush.h"
|
#include "maths/Brush.h"
|
||||||
|
#include "maths/Matrix3D.h"
|
||||||
#include "maths/Vector3D.h"
|
#include "maths/Vector3D.h"
|
||||||
#include "renderer/Renderer.h"
|
#include "renderer/Renderer.h"
|
||||||
|
|
||||||
@ -47,9 +48,8 @@ void CDebugRenderer::DrawLine(const std::vector<CVector3D>& line, const CColor&
|
|||||||
CShaderTechniquePtr debugLineTech =
|
CShaderTechniquePtr debugLineTech =
|
||||||
g_Renderer.GetShaderManager().LoadEffect(str_debug_line);
|
g_Renderer.GetShaderManager().LoadEffect(str_debug_line);
|
||||||
debugLineTech->BeginPass();
|
debugLineTech->BeginPass();
|
||||||
CShaderProgramPtr debugLineShader = debugLineTech->GetShader();
|
|
||||||
|
|
||||||
debugLineShader->Bind();
|
CShaderProgramPtr debugLineShader = debugLineTech->GetShader();
|
||||||
debugLineShader->Uniform(str_transform, g_Renderer.GetViewCamera().GetViewProjection());
|
debugLineShader->Uniform(str_transform, g_Renderer.GetViewCamera().GetViewProjection());
|
||||||
debugLineShader->Uniform(str_color, color);
|
debugLineShader->Uniform(str_color, color);
|
||||||
|
|
||||||
@ -86,7 +86,6 @@ void CDebugRenderer::DrawLine(const std::vector<CVector3D>& line, const CColor&
|
|||||||
debugLineShader->AssertPointersBound();
|
debugLineShader->AssertPointersBound();
|
||||||
glDrawArrays(GL_TRIANGLES, 0, vertices.size() / 3);
|
glDrawArrays(GL_TRIANGLES, 0, vertices.size() / 3);
|
||||||
|
|
||||||
debugLineShader->Unbind();
|
|
||||||
debugLineTech->EndPass();
|
debugLineTech->EndPass();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -99,11 +98,10 @@ void CDebugRenderer::DrawCircle(const CVector3D& origin, const float radius, con
|
|||||||
CShaderTechniquePtr debugCircleTech =
|
CShaderTechniquePtr debugCircleTech =
|
||||||
g_Renderer.GetShaderManager().LoadEffect(str_debug_line);
|
g_Renderer.GetShaderManager().LoadEffect(str_debug_line);
|
||||||
debugCircleTech->BeginPass();
|
debugCircleTech->BeginPass();
|
||||||
CShaderProgramPtr debugCircleShader = debugCircleTech->GetShader();
|
|
||||||
|
|
||||||
const CCamera& camera = g_Renderer.GetViewCamera();
|
const CCamera& camera = g_Renderer.GetViewCamera();
|
||||||
|
|
||||||
debugCircleShader->Bind();
|
CShaderProgramPtr debugCircleShader = debugCircleTech->GetShader();
|
||||||
debugCircleShader->Uniform(str_transform, camera.GetViewProjection());
|
debugCircleShader->Uniform(str_transform, camera.GetViewProjection());
|
||||||
debugCircleShader->Uniform(str_color, color);
|
debugCircleShader->Uniform(str_color, color);
|
||||||
|
|
||||||
@ -132,12 +130,11 @@ void CDebugRenderer::DrawCircle(const CVector3D& origin, const float radius, con
|
|||||||
debugCircleShader->AssertPointersBound();
|
debugCircleShader->AssertPointersBound();
|
||||||
glDrawArrays(GL_TRIANGLE_FAN, 0, vertices.size() / 3);
|
glDrawArrays(GL_TRIANGLE_FAN, 0, vertices.size() / 3);
|
||||||
|
|
||||||
debugCircleShader->Unbind();
|
|
||||||
debugCircleTech->EndPass();
|
debugCircleTech->EndPass();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebugRenderer::DrawCameraFrustum(const CCamera& camera, const CColor& color, int intermediates) const
|
void CDebugRenderer::DrawCameraFrustum(const CCamera& camera, const CColor& color, int intermediates)
|
||||||
{
|
{
|
||||||
#if CONFIG2_GLES
|
#if CONFIG2_GLES
|
||||||
#warning TODO: implement camera frustum for GLES
|
#warning TODO: implement camera frustum for GLES
|
||||||
@ -156,9 +153,8 @@ void CDebugRenderer::DrawCameraFrustum(const CCamera& camera, const CColor& colo
|
|||||||
CShaderTechniquePtr overlayTech =
|
CShaderTechniquePtr overlayTech =
|
||||||
g_Renderer.GetShaderManager().LoadEffect(str_debug_line);
|
g_Renderer.GetShaderManager().LoadEffect(str_debug_line);
|
||||||
overlayTech->BeginPass();
|
overlayTech->BeginPass();
|
||||||
CShaderProgramPtr overlayShader = overlayTech->GetShader();
|
|
||||||
|
|
||||||
overlayShader->Bind();
|
CShaderProgramPtr overlayShader = overlayTech->GetShader();
|
||||||
overlayShader->Uniform(str_transform, g_Renderer.GetViewCamera().GetViewProjection());
|
overlayShader->Uniform(str_transform, g_Renderer.GetViewCamera().GetViewProjection());
|
||||||
overlayShader->Uniform(str_color, color);
|
overlayShader->Uniform(str_color, color);
|
||||||
|
|
||||||
@ -218,13 +214,24 @@ void CDebugRenderer::DrawCameraFrustum(const CCamera& camera, const CColor& colo
|
|||||||
glDrawArrays(GL_QUAD_STRIP, 0, vertices.size() / 3);
|
glDrawArrays(GL_QUAD_STRIP, 0, vertices.size() / 3);
|
||||||
#undef ADD
|
#undef ADD
|
||||||
|
|
||||||
overlayShader->Unbind();
|
|
||||||
overlayTech->EndPass();
|
overlayTech->EndPass();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebugRenderer::DrawBoundingBox(const CBoundingBoxAligned& boundingBox, const CShaderProgramPtr& shader) const
|
void CDebugRenderer::DrawBoundingBox(const CBoundingBoxAligned& boundingBox, const CColor& color)
|
||||||
{
|
{
|
||||||
|
DrawBoundingBox(boundingBox, color, g_Renderer.GetViewCamera().GetViewProjection());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDebugRenderer::DrawBoundingBox(const CBoundingBoxAligned& boundingBox, const CColor& color, const CMatrix3D& transform)
|
||||||
|
{
|
||||||
|
CShaderTechniquePtr shaderTech = g_Renderer.GetShaderManager().LoadEffect(str_gui_solid);
|
||||||
|
shaderTech->BeginPass();
|
||||||
|
|
||||||
|
CShaderProgramPtr shader = shaderTech->GetShader();
|
||||||
|
shader->Uniform(str_color, color);
|
||||||
|
shader->Uniform(str_transform, transform);
|
||||||
|
|
||||||
std::vector<float> data;
|
std::vector<float> data;
|
||||||
|
|
||||||
#define ADD_FACE(x, y, z) \
|
#define ADD_FACE(x, y, z) \
|
||||||
@ -253,10 +260,24 @@ void CDebugRenderer::DrawBoundingBox(const CBoundingBoxAligned& boundingBox, con
|
|||||||
|
|
||||||
shader->AssertPointersBound();
|
shader->AssertPointersBound();
|
||||||
glDrawArrays(GL_TRIANGLES, 0, 6*6);
|
glDrawArrays(GL_TRIANGLES, 0, 6*6);
|
||||||
|
|
||||||
|
shaderTech->EndPass();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebugRenderer::DrawBoundingBoxOutline(const CBoundingBoxAligned& boundingBox, const CShaderProgramPtr& shader) const
|
void CDebugRenderer::DrawBoundingBoxOutline(const CBoundingBoxAligned& boundingBox, const CColor& color)
|
||||||
{
|
{
|
||||||
|
DrawBoundingBoxOutline(boundingBox, color, g_Renderer.GetViewCamera().GetViewProjection());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDebugRenderer::DrawBoundingBoxOutline(const CBoundingBoxAligned& boundingBox, const CColor& color, const CMatrix3D& transform)
|
||||||
|
{
|
||||||
|
CShaderTechniquePtr shaderTech = g_Renderer.GetShaderManager().LoadEffect(str_gui_solid);
|
||||||
|
shaderTech->BeginPass();
|
||||||
|
|
||||||
|
CShaderProgramPtr shader = shaderTech->GetShader();
|
||||||
|
shader->Uniform(str_color, color);
|
||||||
|
shader->Uniform(str_transform, transform);
|
||||||
|
|
||||||
std::vector<float> data;
|
std::vector<float> data;
|
||||||
|
|
||||||
#define ADD_FACE(x, y, z) \
|
#define ADD_FACE(x, y, z) \
|
||||||
@ -287,10 +308,19 @@ void CDebugRenderer::DrawBoundingBoxOutline(const CBoundingBoxAligned& boundingB
|
|||||||
|
|
||||||
shader->AssertPointersBound();
|
shader->AssertPointersBound();
|
||||||
glDrawArrays(GL_LINES, 0, 6*8);
|
glDrawArrays(GL_LINES, 0, 6*8);
|
||||||
|
|
||||||
|
shaderTech->EndPass();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebugRenderer::DrawBrush(const CBrush& brush, const CShaderProgramPtr& shader) const
|
void CDebugRenderer::DrawBrush(const CBrush& brush, const CColor& color)
|
||||||
{
|
{
|
||||||
|
CShaderTechniquePtr shaderTech = g_Renderer.GetShaderManager().LoadEffect(str_gui_solid);
|
||||||
|
shaderTech->BeginPass();
|
||||||
|
|
||||||
|
CShaderProgramPtr shader = shaderTech->GetShader();
|
||||||
|
shader->Uniform(str_color, color);
|
||||||
|
shader->Uniform(str_transform, g_Renderer.GetViewCamera().GetViewProjection());
|
||||||
|
|
||||||
std::vector<float> data;
|
std::vector<float> data;
|
||||||
|
|
||||||
std::vector<std::vector<size_t>> faces;
|
std::vector<std::vector<size_t>> faces;
|
||||||
@ -325,10 +355,19 @@ void CDebugRenderer::DrawBrush(const CBrush& brush, const CShaderProgramPtr& sha
|
|||||||
|
|
||||||
shader->AssertPointersBound();
|
shader->AssertPointersBound();
|
||||||
glDrawArrays(GL_TRIANGLES, 0, data.size() / 5);
|
glDrawArrays(GL_TRIANGLES, 0, data.size() / 5);
|
||||||
|
|
||||||
|
shaderTech->EndPass();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebugRenderer::DrawBrushOutline(const CBrush& brush, const CShaderProgramPtr& shader) const
|
void CDebugRenderer::DrawBrushOutline(const CBrush& brush, const CColor& color)
|
||||||
{
|
{
|
||||||
|
CShaderTechniquePtr shaderTech = g_Renderer.GetShaderManager().LoadEffect(str_gui_solid);
|
||||||
|
shaderTech->BeginPass();
|
||||||
|
|
||||||
|
CShaderProgramPtr shader = shaderTech->GetShader();
|
||||||
|
shader->Uniform(str_color, color);
|
||||||
|
shader->Uniform(str_transform, g_Renderer.GetViewCamera().GetViewProjection());
|
||||||
|
|
||||||
std::vector<float> data;
|
std::vector<float> data;
|
||||||
|
|
||||||
std::vector<std::vector<size_t>> faces;
|
std::vector<std::vector<size_t>> faces;
|
||||||
@ -361,4 +400,6 @@ void CDebugRenderer::DrawBrushOutline(const CBrush& brush, const CShaderProgramP
|
|||||||
|
|
||||||
shader->AssertPointersBound();
|
shader->AssertPointersBound();
|
||||||
glDrawArrays(GL_LINES, 0, data.size() / 5);
|
glDrawArrays(GL_LINES, 0, data.size() / 5);
|
||||||
|
|
||||||
|
shaderTech->EndPass();
|
||||||
}
|
}
|
||||||
|
@ -18,13 +18,12 @@
|
|||||||
#ifndef INCLUDED_DEBUGRENDERER
|
#ifndef INCLUDED_DEBUGRENDERER
|
||||||
#define INCLUDED_DEBUGRENDERER
|
#define INCLUDED_DEBUGRENDERER
|
||||||
|
|
||||||
#include "graphics/ShaderProgramPtr.h"
|
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class CBoundingBoxAligned;
|
class CBoundingBoxAligned;
|
||||||
class CBrush;
|
class CBrush;
|
||||||
class CCamera;
|
class CCamera;
|
||||||
|
class CMatrix3D;
|
||||||
class CVector3D;
|
class CVector3D;
|
||||||
|
|
||||||
struct CColor;
|
struct CColor;
|
||||||
@ -52,27 +51,29 @@ public:
|
|||||||
* @param intermediates determines how many intermediate distance planes should
|
* @param intermediates determines how many intermediate distance planes should
|
||||||
* be hinted at between the near and far planes
|
* be hinted at between the near and far planes
|
||||||
*/
|
*/
|
||||||
void DrawCameraFrustum(const CCamera& camera, const CColor& color, int intermediates = 0) const;
|
void DrawCameraFrustum(const CCamera& camera, const CColor& color, int intermediates = 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render the surfaces of the bound box as triangles.
|
* Render the surfaces of the bound box as triangles.
|
||||||
*/
|
*/
|
||||||
void DrawBoundingBox(const CBoundingBoxAligned& boundingBox, const CShaderProgramPtr& shader) const;
|
void DrawBoundingBox(const CBoundingBoxAligned& boundingBox, const CColor& color);
|
||||||
|
void DrawBoundingBox(const CBoundingBoxAligned& boundingBox, const CColor& color, const CMatrix3D& transform);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render the outline of the bound box as lines.
|
* Render the outline of the bound box as lines.
|
||||||
*/
|
*/
|
||||||
void DrawBoundingBoxOutline(const CBoundingBoxAligned& boundingBox, const CShaderProgramPtr& shader) const;
|
void DrawBoundingBoxOutline(const CBoundingBoxAligned& boundingBox, const CColor& color);
|
||||||
|
void DrawBoundingBoxOutline(const CBoundingBoxAligned& boundingBox, const CColor& color, const CMatrix3D& transform);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render the surfaces of the brush as triangles.
|
* Render the surfaces of the brush as triangles.
|
||||||
*/
|
*/
|
||||||
void DrawBrush(const CBrush& brush, const CShaderProgramPtr& shader) const;
|
void DrawBrush(const CBrush& brush, const CColor& color);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render the outline of the brush as lines.
|
* Render the outline of the brush as lines.
|
||||||
*/
|
*/
|
||||||
void DrawBrushOutline(const CBrush& brush, const CShaderProgramPtr& shader) const;
|
void DrawBrushOutline(const CBrush& brush, const CColor& color);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCLUDED_DEBUGRENDERER
|
#endif // INCLUDED_DEBUGRENDERER
|
||||||
|
@ -150,15 +150,12 @@ void ParticleRenderer::RenderParticles(int cullGroup, bool solidColor)
|
|||||||
shader->EndPass();
|
shader->EndPass();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleRenderer::RenderBounds(int cullGroup, CShaderProgramPtr& shader)
|
void ParticleRenderer::RenderBounds(int cullGroup)
|
||||||
{
|
{
|
||||||
std::vector<CParticleEmitter*>& emitters = m->emitters[cullGroup];
|
for (const CParticleEmitter* emitter : m->emitters[cullGroup])
|
||||||
|
|
||||||
for (size_t i = 0; i < emitters.size(); ++i)
|
|
||||||
{
|
{
|
||||||
CParticleEmitter* emitter = emitters[i];
|
const CBoundingBoxAligned bounds =
|
||||||
|
emitter->m_Type->CalculateBounds(emitter->GetPosition(), emitter->GetParticleBounds());
|
||||||
CBoundingBoxAligned bounds = emitter->m_Type->CalculateBounds(emitter->GetPosition(), emitter->GetParticleBounds());
|
g_Renderer.GetDebugRenderer().DrawBoundingBox(bounds, CColor(0.0f, 1.0f, 0.0f, 1.0f));
|
||||||
g_Renderer.GetDebugRenderer().DrawBoundingBox(bounds, shader);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 2013 Wildfire Games.
|
/* Copyright (C) 2021 Wildfire Games.
|
||||||
* This file is part of 0 A.D.
|
* This file is part of 0 A.D.
|
||||||
*
|
*
|
||||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||||
@ -22,8 +22,6 @@ class CParticleEmitter;
|
|||||||
class CShaderDefines;
|
class CShaderDefines;
|
||||||
struct ParticleRendererInternals;
|
struct ParticleRendererInternals;
|
||||||
|
|
||||||
#include "graphics/ShaderProgramPtr.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render particles.
|
* Render particles.
|
||||||
*/
|
*/
|
||||||
@ -60,7 +58,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Render bounding boxes for all the submitted emitters.
|
* Render bounding boxes for all the submitted emitters.
|
||||||
*/
|
*/
|
||||||
void RenderBounds(int cullGroup, CShaderProgramPtr& shader);
|
void RenderBounds(int cullGroup);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ParticleRendererInternals* m;
|
ParticleRendererInternals* m;
|
||||||
|
@ -1223,20 +1223,8 @@ void CRenderer::RenderParticles(int cullGroup)
|
|||||||
{
|
{
|
||||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||||
|
|
||||||
glDisable(GL_TEXTURE_2D);
|
|
||||||
glColor3f(0.0f, 0.5f, 0.0f);
|
|
||||||
|
|
||||||
m->particleRenderer.RenderParticles(true);
|
m->particleRenderer.RenderParticles(true);
|
||||||
|
m->particleRenderer.RenderBounds(cullGroup);
|
||||||
CShaderTechniquePtr shaderTech = g_Renderer.GetShaderManager().LoadEffect(str_gui_solid);
|
|
||||||
shaderTech->BeginPass();
|
|
||||||
CShaderProgramPtr shader = shaderTech->GetShader();
|
|
||||||
shader->Uniform(str_color, 0.0f, 1.0f, 0.0f, 1.0f);
|
|
||||||
shader->Uniform(str_transform, m_ViewCamera.GetViewProjection());
|
|
||||||
|
|
||||||
m->particleRenderer.RenderBounds(cullGroup, shader);
|
|
||||||
|
|
||||||
shaderTech->EndPass();
|
|
||||||
|
|
||||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||||
}
|
}
|
||||||
|
@ -654,10 +654,6 @@ void ShadowMap::SetDepthTextureBits(int bits)
|
|||||||
|
|
||||||
void ShadowMap::RenderDebugBounds()
|
void ShadowMap::RenderDebugBounds()
|
||||||
{
|
{
|
||||||
CShaderTechniquePtr shaderTech = g_Renderer.GetShaderManager().LoadEffect(str_gui_solid);
|
|
||||||
shaderTech->BeginPass();
|
|
||||||
CShaderProgramPtr shader = shaderTech->GetShader();
|
|
||||||
|
|
||||||
glDepthMask(0);
|
glDepthMask(0);
|
||||||
glDisable(GL_CULL_FACE);
|
glDisable(GL_CULL_FACE);
|
||||||
|
|
||||||
@ -667,27 +663,18 @@ void ShadowMap::RenderDebugBounds()
|
|||||||
// Green = bounds of objects in culling frustum that cast shadows
|
// Green = bounds of objects in culling frustum that cast shadows
|
||||||
// Blue = frustum used for rendering the shadow map
|
// Blue = frustum used for rendering the shadow map
|
||||||
|
|
||||||
shader->Uniform(str_transform, g_Renderer.GetViewCamera().GetViewProjection() * m->InvLightTransform);
|
const CMatrix3D transform = g_Renderer.GetViewCamera().GetViewProjection() * m->InvLightTransform;
|
||||||
|
|
||||||
shader->Uniform(str_color, 1.0f, 1.0f, 0.0f, 1.0f);
|
|
||||||
g_Renderer.GetDebugRenderer().DrawBoundingBoxOutline(m->ShadowReceiverBound, shader);
|
|
||||||
|
|
||||||
shader->Uniform(str_color, 0.0f, 1.0f, 0.0f, 1.0f);
|
|
||||||
g_Renderer.GetDebugRenderer().DrawBoundingBoxOutline(m->ShadowCasterBound, shader);
|
|
||||||
|
|
||||||
|
g_Renderer.GetDebugRenderer().DrawBoundingBoxOutline(m->ShadowReceiverBound, CColor(1.0f, 1.0f, 0.0f, 1.0f), transform);
|
||||||
|
g_Renderer.GetDebugRenderer().DrawBoundingBoxOutline(m->ShadowCasterBound, CColor(0.0f, 1.0f, 0.0f, 1.0f), transform);
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
shader->Uniform(str_color, 0.0f, 0.0f, 1.0f, 0.25f);
|
g_Renderer.GetDebugRenderer().DrawBoundingBox(m->ShadowRenderBound, CColor(0.0f, 0.0f, 1.0f, 0.25f), transform);
|
||||||
g_Renderer.GetDebugRenderer().DrawBoundingBox(m->ShadowRenderBound, shader);
|
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
|
g_Renderer.GetDebugRenderer().DrawBoundingBoxOutline(m->ShadowRenderBound, CColor(0.0f, 0.0f, 1.0f, 1.0f), transform);
|
||||||
shader->Uniform(str_color, 0.0f, 0.0f, 1.0f, 1.0f);
|
|
||||||
g_Renderer.GetDebugRenderer().DrawBoundingBoxOutline(m->ShadowRenderBound, shader);
|
|
||||||
|
|
||||||
// Render light frustum
|
// Render light frustum
|
||||||
|
|
||||||
shader->Uniform(str_transform, g_Renderer.GetViewCamera().GetViewProjection());
|
|
||||||
|
|
||||||
CFrustum frustum = GetShadowCasterCullFrustum();
|
CFrustum frustum = GetShadowCasterCullFrustum();
|
||||||
// We don't have a function to create a brush directly from a frustum, so use
|
// We don't have a function to create a brush directly from a frustum, so use
|
||||||
// the ugly approach of creating a large cube and then intersecting with the frustum
|
// the ugly approach of creating a large cube and then intersecting with the frustum
|
||||||
@ -698,14 +685,9 @@ void ShadowMap::RenderDebugBounds()
|
|||||||
|
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
shader->Uniform(str_color, 1.0f, 0.0f, 0.0f, 0.25f);
|
g_Renderer.GetDebugRenderer().DrawBrush(frustumBrush, CColor(1.0f, 0.0f, 0.0f, 0.25f));
|
||||||
g_Renderer.GetDebugRenderer().DrawBrush(frustumBrush, shader);
|
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
|
g_Renderer.GetDebugRenderer().DrawBrushOutline(frustumBrush, CColor(1.0f, 0.0f, 0.0f, 1.0f));
|
||||||
shader->Uniform(str_color, 1.0f, 0.0f, 0.0f, 1.0f);
|
|
||||||
g_Renderer.GetDebugRenderer().DrawBrushOutline(frustumBrush, shader);
|
|
||||||
|
|
||||||
shaderTech->EndPass();
|
|
||||||
|
|
||||||
glEnable(GL_CULL_FACE);
|
glEnable(GL_CULL_FACE);
|
||||||
glDepthMask(1);
|
glDepthMask(1);
|
||||||
|
@ -444,20 +444,14 @@ void SilhouetteRenderer::RenderSubmitCasters(SceneCollector& collector)
|
|||||||
|
|
||||||
void SilhouetteRenderer::RenderDebugOverlays(const CCamera& camera)
|
void SilhouetteRenderer::RenderDebugOverlays(const CCamera& camera)
|
||||||
{
|
{
|
||||||
CShaderTechniquePtr shaderTech = g_Renderer.GetShaderManager().LoadEffect(str_gui_solid);
|
if (m_DebugBounds.empty() && m_DebugRects.empty())
|
||||||
shaderTech->BeginPass();
|
return;
|
||||||
CShaderProgramPtr shader = shaderTech->GetShader();
|
|
||||||
|
|
||||||
glDepthMask(0);
|
glDepthMask(0);
|
||||||
glDisable(GL_CULL_FACE);
|
glDisable(GL_CULL_FACE);
|
||||||
|
|
||||||
shader->Uniform(str_transform, camera.GetViewProjection());
|
|
||||||
|
|
||||||
for (size_t i = 0; i < m_DebugBounds.size(); ++i)
|
for (size_t i = 0; i < m_DebugBounds.size(); ++i)
|
||||||
{
|
g_Renderer.GetDebugRenderer().DrawBoundingBoxOutline(m_DebugBounds[i].bounds, m_DebugBounds[i].color);
|
||||||
shader->Uniform(str_color, m_DebugBounds[i].color);
|
|
||||||
g_Renderer.GetDebugRenderer().DrawBoundingBoxOutline(m_DebugBounds[i].bounds, shader);
|
|
||||||
}
|
|
||||||
|
|
||||||
CMatrix3D m;
|
CMatrix3D m;
|
||||||
m.SetIdentity();
|
m.SetIdentity();
|
||||||
@ -468,6 +462,11 @@ void SilhouetteRenderer::RenderDebugOverlays(const CCamera& camera)
|
|||||||
proj.SetOrtho(0.f, g_MaxCoord, 0.f, g_MaxCoord, -1.f, 1000.f);
|
proj.SetOrtho(0.f, g_MaxCoord, 0.f, g_MaxCoord, -1.f, 1000.f);
|
||||||
m = proj * m;
|
m = proj * m;
|
||||||
|
|
||||||
|
|
||||||
|
CShaderTechniquePtr shaderTech = g_Renderer.GetShaderManager().LoadEffect(str_gui_solid);
|
||||||
|
shaderTech->BeginPass();
|
||||||
|
|
||||||
|
CShaderProgramPtr shader = shaderTech->GetShader();
|
||||||
shader->Uniform(str_transform, proj);
|
shader->Uniform(str_transform, proj);
|
||||||
|
|
||||||
for (size_t i = 0; i < m_DebugRects.size(); ++i)
|
for (size_t i = 0; i < m_DebugRects.size(); ++i)
|
||||||
|
Loading…
Reference in New Issue
Block a user