utility functions

This commit is contained in:
h4570
2022-08-17 00:19:16 +02:00
parent 4fb0ab3b6c
commit fea2398699
27 changed files with 419 additions and 247 deletions
+27 -5
View File
@@ -14,10 +14,16 @@
#include "renderer/models/color.hpp"
#include "renderer/core/3d/bbox/core_bbox.hpp"
#include "../core/renderer_core.hpp"
#include "renderer/core/3d/clipper/planes_clip_algorithm.hpp"
namespace Tyra {
/** Debug functions, with bad performance. */
/**
* Debug functions, with bad performance.
*
* Remember that you need to use them AFTER ALLPASS rendering.
* (for example after skybox), otherwise colors will not work.
*/
class Renderer3DUtility {
public:
Renderer3DUtility();
@@ -25,8 +31,8 @@ class Renderer3DUtility {
void init(RendererCore* core);
void drawPoint(const Vec4& v);
void drawPoint(const Vec4& v, const Color& color);
void drawBox(const Vec4& v, const float& size);
void drawBox(const Vec4& v, const float& size, const Color& color);
void drawLine(const Vec4& from, const Vec4& to);
void drawLine(const Vec4& from, const Vec4& to, const Color& color);
@@ -35,10 +41,26 @@ class Renderer3DUtility {
void drawBBox(const CoreBBox& v, const Color& color);
private:
std::array<PlanesClipVertex, 9> clippedVerts;
std::array<PlanesClipVertexPtrs, 3> clipInput;
RendererCore* core;
prim_t basePrim;
color_t baseColor;
prim_t prim;
void fillBBoxVertices(std::array<std::array<Vec4, 4>, 6>& v,
const CoreBBox& bbox);
color_t getGSColor(const Color& color);
/**
* @return true - To draw
* @return false - To skip (outside view frustum)
*/
bool calcLineVertices(xyz_t* outputArray, const Vec4& a, const Vec4& b,
const u8& displayOffset);
PlanesClipAlgorithm planesClipAlgorithm;
};
} // namespace Tyra