Parcourir la source

Delete DebugRenderer

Daniele Bartolini il y a 12 ans
Parent
commit
b8dc1c1ac3

+ 0 - 1
engine/Android.mk

@@ -77,7 +77,6 @@ LOCAL_SRC_FILES :=\
 \
 	renderers/gl/GLRenderer.cpp\
 	renderers/gl/egl/GLContext.cpp\
-	renderers/DebugRenderer.cpp\
 \
 	resource/FileBundle.cpp\
 	resource/ResourceLoader.cpp\

+ 0 - 2
engine/CMakeLists.txt

@@ -265,13 +265,11 @@ set (NETWORK_HEADERS
 )
 
 set (RENDERERS_SRC
-	renderers/DebugRenderer.cpp
 )
 
 set (RENDERERS_HEADERS
 	renderers/Renderer.h
 	renderers/RenderContext.h
-	renderers/DebugRenderer.h
 	renderers/PixelFormat.h
 	renderers/VertexFormat.h
 )

+ 0 - 1
engine/Crown.h

@@ -125,7 +125,6 @@ OTHER DEALINGS IN THE SOFTWARE.
 // Engine/Renderers
 #include "Renderer.h"
 #include "RenderContext.h"
-#include "DebugRenderer.h"
 #include "PixelFormat.h"
 #include "VertexFormat.h"
 

+ 0 - 18
engine/Device.cpp

@@ -31,7 +31,6 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "Device.h"
 #include "Accelerometer.h"
 #include "Args.h"
-#include "DebugRenderer.h"
 #include "DiskFile.h"
 #include "DiskFilesystem.h"
 #include "JSONParser.h"
@@ -87,7 +86,6 @@ Device::Device()
 	, m_filesystem(NULL)
 	, m_lua_environment(NULL)
 	, m_renderer(NULL)
-	, m_debug_renderer(NULL)
 	, m_sound_renderer(NULL)
 
 	, m_bundle_compiler(NULL)
@@ -155,10 +153,6 @@ void Device::init()
 	m_renderer->init();
 	Log::d("Renderer created.");
 
-	// Create debug renderer
-	m_debug_renderer = CE_NEW(m_allocator, DebugRenderer)(*m_renderer);
-	Log::d("Debug renderer created.");
-
 	m_lua_environment = CE_NEW(m_allocator, LuaEnvironment)();
 	m_lua_environment->init();
 	Log::d("Lua environment created.");
@@ -219,12 +213,6 @@ void Device::shutdown()
 	CE_DELETE(m_allocator, m_mouse);
 	CE_DELETE(m_allocator, m_keyboard);
 
-	Log::d("Releasing DebugRenderer...");
-	if (m_debug_renderer)
-	{
-		CE_DELETE(m_allocator, m_debug_renderer);
-	}
-
 	Log::d("Releasing Renderer...");
 	if (m_renderer)
 	{
@@ -302,12 +290,6 @@ Renderer* Device::renderer()
 	return m_renderer;
 }
 
-//-----------------------------------------------------------------------------
-DebugRenderer* Device::debug_renderer()
-{
-	return m_debug_renderer;
-}
-
 //-----------------------------------------------------------------------------
 SoundRenderer* Device::sound_renderer()
 {

+ 0 - 3
engine/Device.h

@@ -41,7 +41,6 @@ class ResourceManager;
 class OsWindow;
 class Bundle;
 class Renderer;
-class DebugRenderer;
 class Keyboard;
 class Mouse;
 class Touch;
@@ -132,7 +131,6 @@ public:
 
 	OsWindow*				window();
 	Renderer*				renderer();
-	DebugRenderer*			debug_renderer();
 
 	SoundRenderer*			sound_renderer();
 
@@ -180,7 +178,6 @@ protected:
 
 	LuaEnvironment*			m_lua_environment;
 	Renderer*				m_renderer;
-	DebugRenderer*			m_debug_renderer;
 
 	SoundRenderer*			m_sound_renderer;
 

+ 0 - 149
engine/renderers/DebugRenderer.cpp

@@ -1,149 +0,0 @@
-/*
-Copyright (c) 2013 Daniele Bartolini, Michele Rossi
-Copyright (c) 2012 Daniele Bartolini, Simone Boscaratto
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DebugRenderer.h"
-#include "Renderer.h"
-#include "MathUtils.h"
-
-namespace crown
-{
-
-//-----------------------------------------------------------------------------
-DebugRenderer::DebugRenderer(Renderer& renderer) :
-	m_renderer(renderer),
-	m_lines_count(0)
-{
-}
-
-//-----------------------------------------------------------------------------
-DebugRenderer::~DebugRenderer()
-{
-}
-
-//-----------------------------------------------------------------------------
-void DebugRenderer::add_line(const Vector3& start, const Vector3& end, const Color4& color, bool depth_write)
-{
-	if (m_lines_count >= MAX_DEBUG_LINES)
-	{
-		return;
-	}
-
-	m_lines[m_lines_count * 2 + 0] = start;
-	m_lines[m_lines_count * 2 + 1] = end;
-
-	m_colors[m_lines_count * 2 + 0] = color;
-	m_colors[m_lines_count * 2 + 1] = color;
-
-	m_depth_writes[m_lines_count * 2 + 0] = depth_write;
-	m_depth_writes[m_lines_count * 2 + 1] = depth_write;
-
-	m_lines_count++;
-}
-
-//-----------------------------------------------------------------------------
-void DebugRenderer::add_sphere(const Vector3& center, const float radius, const Color4& color, bool depth_write)
-{
-	const uint32_t deg_step = 15;
-
-	// XZ plane
-	for (uint32_t deg = 0; deg < 360; deg += deg_step)
-	{
-		float rad_0 = math::deg_to_rad(deg);
-		float rad_1 = math::deg_to_rad(deg + deg_step);
-
-		Vector3 start(math::cos(rad_0) * radius, 0, -math::sin(rad_0) * radius);
-		Vector3 end  (math::cos(rad_1) * radius, 0, -math::sin(rad_1) * radius);
-
-		add_line(center + start, center + end, color, depth_write);
-	}
-
-	// XY plane
-	for (uint32_t deg = 0; deg < 360; deg += deg_step)
-	{
-		float rad_0 = math::deg_to_rad(deg);
-		float rad_1 = math::deg_to_rad(deg + deg_step);
-
-		Vector3 start(math::cos(rad_0) * radius, math::sin(rad_0) * radius, 0);
-		Vector3 end  (math::cos(rad_1) * radius, math::sin(rad_1) * radius, 0);
-
-		add_line(center + start, center + end, color, depth_write);
-	}
-
-	// YZ plane
-	for (uint32_t deg = 0; deg < 360; deg += deg_step)
-	{
-		float rad_0 = math::deg_to_rad(deg);
-		float rad_1 = math::deg_to_rad(deg + deg_step);
-
-		Vector3 start(0, math::sin(rad_0) * radius, -math::cos(rad_0) * radius);
-		Vector3 end  (0, math::sin(rad_1) * radius, -math::cos(rad_1) * radius);
-
-		add_line(center + start, center + end, color, depth_write);
-	}
-}
-
-//-----------------------------------------------------------------------------
-void DebugRenderer::add_box(const Vector3& min, const Vector3& max, const Color4& color, bool depth_write)
-{
-	// Back lines
-	add_line(min                      , Vector3(max.x, min.y, min.z), color, depth_write);
-	add_line(Vector3(max.x, min.y, min.z), Vector3(max.x, max.y, min.z), color, depth_write);
-	add_line(Vector3(max.x, max.y, min.z), Vector3(min.x, max.y, min.z), color, depth_write);
-	add_line(Vector3(min.x, max.y, min.z), min                      , color, depth_write);
-
-	// Front lines
-	add_line(Vector3(min.x, min.y, max.z), Vector3(max.x, min.y, max.z), color, depth_write);
-	add_line(Vector3(max.x, min.y, max.z), Vector3(max.x, max.y, max.z), color, depth_write);
-	add_line(Vector3(max.x, max.y, max.z), Vector3(min.x, max.y, max.z), color, depth_write);
-	add_line(Vector3(min.x, max.y, max.z), Vector3(min.x, min.y, max.z), color, depth_write);
-
-	// Connect back and front vertices
-	add_line(min                      , Vector3(min.x, min.y, max.z), color, depth_write);
-	add_line(Vector3(max.x, min.y, min.z), Vector3(max.x, min.y, max.z), color, depth_write);
-	add_line(Vector3(max.x, max.y, min.z), Vector3(max.x, max.y, max.z), color, depth_write);
-	add_line(Vector3(min.x, max.y, min.z), Vector3(min.x, max.y, max.z), color, depth_write);
-}
-
-//-----------------------------------------------------------------------------
-void DebugRenderer::add_pose(const Matrix4x4& pose, bool depth_write)
-{
-	add_line(pose.translation(), pose.translation() + pose.x(), Color4::RED, depth_write);
-	add_line(pose.translation(), pose.translation() + pose.y(), Color4::GREEN, depth_write);
-	add_line(pose.translation(), pose.translation() + pose.z(), Color4::BLUE, depth_write);
-}
-
-//-----------------------------------------------------------------------------
-void DebugRenderer::draw_all()
-{
-	if (m_lines_count > 0)
-	{
-		// m_renderer.draw_lines(m_lines[0].to_float_ptr(), m_colors[0].to_float_ptr(), m_lines_count * 2);
-	}
-
-	m_lines_count = 0;
-}
-
-} // namespace crown

+ 0 - 81
engine/renderers/DebugRenderer.h

@@ -1,81 +0,0 @@
-/*
-Copyright (c) 2013 Daniele Bartolini, Michele Rossi
-Copyright (c) 2012 Daniele Bartolini, Simone Boscaratto
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-#pragma once
-
-#include "Types.h"
-#include "Vector3.h"
-#include "Color4.h"
-#include "Matrix4x4.h"
-
-namespace crown
-{
-
-const uint32_t MAX_DEBUG_LINES = 4096;
-
-class Renderer;
-
-/// Util class to render various types of primiteves
-/// for debugging purposes only.
-/// @note
-/// All the coordinates are in world-space.
-class DebugRenderer
-{
-public:
-
-				DebugRenderer(Renderer& renderer);
-				~DebugRenderer();
-
-	void		add_line(const Vector3& start, const Vector3& end, const Color4& color, bool depth_write);
-
-	/// Total cost: 72 lines
-	void		add_sphere(const Vector3& center, const float radius, const Color4& color, bool depth_write);
-
-	/// Total cost: 12 lines
-	void		add_box(const Vector3& min, const Vector3& max, const Color4& color, bool depth_write);
-
-	/// Total cost: 3 lines
-	void		add_pose(const Matrix4x4& pose, bool depth_write);
-
-private:
-
-	void		draw_all();
-
-private:
-
-	Renderer&	m_renderer;
-
-	uint32_t	m_lines_count;
-
-	Vector3		m_lines[MAX_DEBUG_LINES * 2];
-	Color4		m_colors[MAX_DEBUG_LINES * 2];
-	bool		m_depth_writes[MAX_DEBUG_LINES * 2];
-
-	friend class	Device;
-};
-
-} // namespace crown
-