utility functions
This commit is contained in:
@@ -19,13 +19,17 @@ namespace Tyra {
|
||||
/** Bounding box with more features */
|
||||
class BBox : public CoreBBox {
|
||||
public:
|
||||
BBox(const BBox& t_bbox);
|
||||
explicit BBox(CoreBBox** t_bboxes, const u32& count);
|
||||
explicit BBox(Vec4* t_vertices, u32* faces, u32 t_count);
|
||||
explicit BBox(Vec4* t_vertices, u32 t_count);
|
||||
explicit BBox(const BBox& t_bbox, const M4x4& t_matrix);
|
||||
explicit BBox(const BBox& t_bbox);
|
||||
explicit BBox(Vec4* t_vertices);
|
||||
|
||||
static BBox create(const Vec4& center, const float& size);
|
||||
|
||||
void operator=(const BBox& v);
|
||||
|
||||
const float& getHeight() const { return _height; }
|
||||
const float& getDepth() const { return _depth; }
|
||||
const float& getWidth() const { return _width; }
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "../../mcpip_block.hpp"
|
||||
#include "../../data/mcpip_block_data.hpp"
|
||||
#include "./mcpip_vu1_as_is_shared_defines.h"
|
||||
#include "renderer/core/3d/clipper/ee_clip_algorithm.hpp"
|
||||
#include "renderer/core/3d/clipper/planes_clip_algorithm.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
@@ -27,7 +27,7 @@ class McpipClip {
|
||||
McpipClip();
|
||||
~McpipClip();
|
||||
|
||||
EEClipAlgorithm algorithm;
|
||||
PlanesClipAlgorithm algorithm;
|
||||
EEClipAlgorithmSettings algoSettings;
|
||||
|
||||
void init(RendererCore* core, McpipBlockData* t_singleBlockData,
|
||||
@@ -52,14 +52,16 @@ class McpipClip {
|
||||
u16 vu1DBufferSize;
|
||||
|
||||
Vec4 inputVerts[3];
|
||||
EEClipVertexPtrs inputTriangle[3];
|
||||
EEClipVertex clippedTriangle[9];
|
||||
PlanesClipVertexPtrs inputTriangle[3];
|
||||
PlanesClipVertex clippedTriangle[9];
|
||||
|
||||
Vec4 vertexBuffers[2][108];
|
||||
Vec4 texCoordBuffers[2][108];
|
||||
|
||||
void addCorrections(std::vector<EEClipVertex>* vertices, McpipBlock* block);
|
||||
void moveDataToBuffer(std::vector<EEClipVertex>* vertices, const u8& context);
|
||||
void addCorrections(std::vector<PlanesClipVertex>* vertices,
|
||||
McpipBlock* block);
|
||||
void moveDataToBuffer(std::vector<PlanesClipVertex>* vertices,
|
||||
const u8& context);
|
||||
void addDataToPacket(packet2_t* packet, const u8& context, McpipBlock* block,
|
||||
const int& count,
|
||||
RendererCoreTextureBuffers* texBuffers);
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#include "renderer/core/3d/bbox/core_bbox.hpp"
|
||||
#include "renderer/core/3d/renderer_3d_frustum_planes.hpp"
|
||||
#include "renderer/core/3d/clipper/ee_clip_algorithm.hpp"
|
||||
#include "renderer/core/3d/clipper/planes_clip_algorithm.hpp"
|
||||
#include "./stapip_bag_packages_bbox.hpp"
|
||||
#include "./stapip_bag_package.hpp"
|
||||
#include "../stapip_bag.hpp"
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "debug/debug.hpp"
|
||||
#include "./stapip_qbuffer.hpp"
|
||||
#include "renderer/renderer_settings.hpp"
|
||||
#include "renderer/core/3d/clipper/ee_clip_algorithm.hpp"
|
||||
#include "renderer/core/3d/clipper/planes_clip_algorithm.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
@@ -36,15 +36,15 @@ class StaPipClipper {
|
||||
|
||||
private:
|
||||
u32 maxVertCount;
|
||||
EEClipAlgorithm algorithm;
|
||||
PlanesClipAlgorithm algorithm;
|
||||
M4x4* mvp;
|
||||
|
||||
Vec4 inputVerts[3];
|
||||
EEClipVertexPtrs inputTriangle[3];
|
||||
EEClipVertex clippedTriangle[9];
|
||||
PlanesClipVertexPtrs inputTriangle[3];
|
||||
PlanesClipVertex clippedTriangle[9];
|
||||
|
||||
void perspectiveDivide(std::vector<EEClipVertex>* vertices);
|
||||
void moveDataToBuffer(const std::vector<EEClipVertex>& vertices,
|
||||
void perspectiveDivide(std::vector<PlanesClipVertex>* vertices);
|
||||
void moveDataToBuffer(const std::vector<PlanesClipVertex>& vertices,
|
||||
StaPipQBuffer* buffer);
|
||||
};
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user