2021-04-15 20:07:01 +02:00
|
|
|
/* Copyright (C) 2021 Wildfire Games.
|
|
|
|
* This file is part of 0 A.D.
|
|
|
|
*
|
|
|
|
* 0 A.D. is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 0 A.D. is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef INCLUDED_DEBUGRENDERER
|
|
|
|
#define INCLUDED_DEBUGRENDERER
|
|
|
|
|
2021-04-25 22:48:44 +02:00
|
|
|
#include <vector>
|
|
|
|
|
2021-04-15 20:07:01 +02:00
|
|
|
class CBoundingBoxAligned;
|
|
|
|
class CBrush;
|
|
|
|
class CCamera;
|
2021-04-27 21:23:37 +02:00
|
|
|
class CMatrix3D;
|
2021-04-16 00:51:25 +02:00
|
|
|
class CVector3D;
|
|
|
|
|
|
|
|
struct CColor;
|
2021-04-15 20:07:01 +02:00
|
|
|
|
|
|
|
// Helper for unoptimized rendering of geometrics primitives. Should not be
|
|
|
|
// used for regular passes.
|
|
|
|
class CDebugRenderer
|
|
|
|
{
|
|
|
|
public:
|
2021-04-16 00:51:25 +02:00
|
|
|
/**
|
|
|
|
* Render the line in world space.
|
|
|
|
*/
|
|
|
|
void DrawLine(const CVector3D& from, const CVector3D& to, const CColor& color, const float width);
|
2021-04-25 22:48:44 +02:00
|
|
|
void DrawLine(const std::vector<CVector3D>& line, const CColor& color, const float width);
|
2021-04-16 00:51:25 +02:00
|
|
|
|
2021-04-25 23:55:19 +02:00
|
|
|
/**
|
|
|
|
* Render the circle in world space oriented to the view camera.
|
|
|
|
*/
|
|
|
|
void DrawCircle(const CVector3D& origin, const float radius, const CColor& color);
|
|
|
|
|
2021-04-15 20:07:01 +02:00
|
|
|
/**
|
|
|
|
* Render: Renders the camera's frustum in world space.
|
|
|
|
* The caller should set the color using glColorXy before calling Render.
|
|
|
|
*
|
|
|
|
* @param intermediates determines how many intermediate distance planes should
|
|
|
|
* be hinted at between the near and far planes
|
|
|
|
*/
|
2021-04-27 21:23:37 +02:00
|
|
|
void DrawCameraFrustum(const CCamera& camera, const CColor& color, int intermediates = 0);
|
2021-04-15 20:07:01 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Render the surfaces of the bound box as triangles.
|
|
|
|
*/
|
2021-04-27 21:23:37 +02:00
|
|
|
void DrawBoundingBox(const CBoundingBoxAligned& boundingBox, const CColor& color);
|
|
|
|
void DrawBoundingBox(const CBoundingBoxAligned& boundingBox, const CColor& color, const CMatrix3D& transform);
|
2021-04-15 20:07:01 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Render the outline of the bound box as lines.
|
|
|
|
*/
|
2021-04-27 21:23:37 +02:00
|
|
|
void DrawBoundingBoxOutline(const CBoundingBoxAligned& boundingBox, const CColor& color);
|
|
|
|
void DrawBoundingBoxOutline(const CBoundingBoxAligned& boundingBox, const CColor& color, const CMatrix3D& transform);
|
2021-04-15 20:07:01 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Render the surfaces of the brush as triangles.
|
|
|
|
*/
|
2021-04-27 21:23:37 +02:00
|
|
|
void DrawBrush(const CBrush& brush, const CColor& color);
|
2021-04-15 20:07:01 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Render the outline of the brush as lines.
|
|
|
|
*/
|
2021-04-27 21:23:37 +02:00
|
|
|
void DrawBrushOutline(const CBrush& brush, const CColor& color);
|
2021-04-15 20:07:01 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // INCLUDED_DEBUGRENDERER
|