dynpip files
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
# ______ ____ ___
|
||||
# | \/ ____| |___|
|
||||
# | | | \ | |
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||
# Licenced under Apache License 2.0
|
||||
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
enum DynPipProgramName {
|
||||
DynPipUndefinedProgram,
|
||||
|
||||
DynPipColor,
|
||||
DynPipDirLights,
|
||||
DynPipTextureDirLights,
|
||||
DynPipTextureColor,
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
# ______ ____ ___
|
||||
# | \/ ____| |___|
|
||||
# | | | \ | |
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||
# Licenced under Apache License 2.0
|
||||
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "debug/debug.hpp"
|
||||
#include "renderer/core/paths/path1/vu1_program.hpp"
|
||||
|
||||
#include "./programs/dynpip_c_vu1_program.hpp"
|
||||
#include "./programs/dynpip_d_vu1_program.hpp"
|
||||
#include "./programs/dynpip_td_vu1_program.hpp"
|
||||
#include "./programs/dynpip_tc_vu1_program.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class DynPipProgramsRepository {
|
||||
public:
|
||||
DynPipProgramsRepository();
|
||||
~DynPipProgramsRepository();
|
||||
|
||||
DynPipVU1Program* getProgram(const DynPipProgramName& name);
|
||||
|
||||
private:
|
||||
DynPipCVU1Program color;
|
||||
DynPipDVU1Program dirLights;
|
||||
DynPipTDVU1Program textureDirLights;
|
||||
DynPipTCVU1Program textureColor;
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
# ______ ____ ___
|
||||
# | \/ ____| |___|
|
||||
# | | | \ | |
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||
# Licenced under Apache License 2.0
|
||||
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class DynPipQBuffer {
|
||||
public:
|
||||
DynPipQBuffer();
|
||||
~DynPipQBuffer();
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
# ______ ____ ___
|
||||
# | \/ ____| |___|
|
||||
# | | | \ | |
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||
# Licenced under Apache License 2.0
|
||||
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "./dynpip_program_name.hpp"
|
||||
#include "renderer/core/paths/path1/vu1_program.hpp"
|
||||
#include "./programs/dynpip_vu1_shared_defines.h"
|
||||
#include "./dynpip_qbuffer.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class DynPipVU1Program : public VU1Program {
|
||||
public:
|
||||
DynPipVU1Program(const DynPipProgramName& name, u32* start, u32* end,
|
||||
const u32& t_reglist, const u8& t_reglistCount,
|
||||
const u8& t_elementsPerVertex);
|
||||
~DynPipVU1Program();
|
||||
|
||||
u32& getReglist();
|
||||
|
||||
const DynPipProgramName& getName() const;
|
||||
|
||||
u16 getMaxVertCount(const bool& singleColorEnabled,
|
||||
const u16& vu1DBufferSize) const;
|
||||
|
||||
void addBufferDataToPacket(packet2_t* packet, DynPipQBuffer* buffer,
|
||||
prim_t* prim);
|
||||
|
||||
protected:
|
||||
DynPipProgramName name;
|
||||
u8 reglistCount, elementsPerVertex;
|
||||
u32 destinationAddress, reglist;
|
||||
|
||||
virtual void addProgramQBufferDataToPacket(packet2_t* packet,
|
||||
DynPipQBuffer* qbuffer) const = 0;
|
||||
|
||||
private:
|
||||
void addStandardBufferDataToPacket(packet2_t* packet, DynPipQBuffer* buffer,
|
||||
prim_t* prim);
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
+6
-5
@@ -12,17 +12,18 @@
|
||||
|
||||
#include <packet2_utils.h>
|
||||
#include <string>
|
||||
#include "../../vu1_program.hpp"
|
||||
#include "../dynpip_vu1_program.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class VU1DrawFinish : public VU1Program {
|
||||
class DynPipCVU1Program : public DynPipVU1Program {
|
||||
public:
|
||||
VU1DrawFinish();
|
||||
~VU1DrawFinish();
|
||||
DynPipCVU1Program();
|
||||
~DynPipCVU1Program();
|
||||
|
||||
std::string getStringName() const;
|
||||
void addTag(packet2_t* packet, prim_t* prim) const;
|
||||
void addProgramQBufferDataToPacket(packet2_t* packet,
|
||||
DynPipQBuffer* qbuffer) const;
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
# ______ ____ ___
|
||||
# | \/ ____| |___|
|
||||
# | | | \ | |
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||
# Licenced under Apache License 2.0
|
||||
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <packet2_utils.h>
|
||||
#include <string>
|
||||
#include "../dynpip_vu1_program.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class DynPipDVU1Program : public DynPipVU1Program {
|
||||
public:
|
||||
DynPipDVU1Program();
|
||||
~DynPipDVU1Program();
|
||||
|
||||
std::string getStringName() const;
|
||||
void addProgramQBufferDataToPacket(packet2_t* packet,
|
||||
DynPipQBuffer* qbuffer) const;
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
# ______ ____ ___
|
||||
# | \/ ____| |___|
|
||||
# | | | \ | |
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||
# Licenced under Apache License 2.0
|
||||
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <packet2_utils.h>
|
||||
#include <string>
|
||||
#include "../dynpip_vu1_program.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class DynPipTCVU1Program : public DynPipVU1Program {
|
||||
public:
|
||||
DynPipTCVU1Program();
|
||||
~DynPipTCVU1Program();
|
||||
|
||||
std::string getStringName() const;
|
||||
void addProgramQBufferDataToPacket(packet2_t* packet,
|
||||
DynPipQBuffer* qbuffer) const;
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
# ______ ____ ___
|
||||
# | \/ ____| |___|
|
||||
# | | | \ | |
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||
# Licenced under Apache License 2.0
|
||||
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <packet2_utils.h>
|
||||
#include <string>
|
||||
#include "../dynpip_vu1_program.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class DynPipTDVU1Program : public DynPipVU1Program {
|
||||
public:
|
||||
DynPipTDVU1Program();
|
||||
~DynPipTDVU1Program();
|
||||
|
||||
std::string getStringName() const;
|
||||
void addProgramQBufferDataToPacket(packet2_t* packet,
|
||||
DynPipQBuffer* qbuffer) const;
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// ______ ____ ___
|
||||
// | \/ ____| |___|
|
||||
// | | | \ | |
|
||||
//-----------------------------------------------------------------------
|
||||
// Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||
// Licenced under Apache License 2.0
|
||||
// Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||
//
|
||||
|
||||
// Updated once per mesh
|
||||
// #define VU1_MVP_MATRIX_ADDR 0
|
||||
// #define VU1_LIGHTS_MATRIX_ADDR 4
|
||||
// #define VU1_SINGLE_COLOR_ADDR 7
|
||||
// #define VU1_OPTIONS_ADDR 8
|
||||
// #define VU1_LOD_ADDR 9
|
||||
// #define VU1_CLUT_ADDR 10
|
||||
// #define VU1_LIGHTS_DIRS_ADDR 11
|
||||
// #define VU1_LIGHTS_COLORS_ADDR 14
|
||||
// #define VU1_SET_GIFTAG_ADDR 18
|
||||
// #define VU1_LAST_ITEM_ADDR 18
|
||||
|
||||
// Buffer data (xtop)
|
||||
// #define VU1_VERT_DATA_ADDR 2
|
||||
@@ -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/paths/path1/clipper/path1_ee_clip_algorithm.hpp"
|
||||
#include "renderer/core/3d/clipper/ee_clip_algorithm.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
@@ -27,8 +27,8 @@ class McpipClip {
|
||||
McpipClip();
|
||||
~McpipClip();
|
||||
|
||||
Path1EEClipAlgorithm algorithm;
|
||||
Path1EEClipAlgorithmSettings algoSettings;
|
||||
EEClipAlgorithm algorithm;
|
||||
EEClipAlgorithmSettings algoSettings;
|
||||
|
||||
void init(RendererCore* core, McpipBlockData* t_singleBlockData,
|
||||
McpipBlockData* t_multiBlockData);
|
||||
@@ -48,16 +48,14 @@ class McpipClip {
|
||||
packet2_t* staticPacket;
|
||||
u16 vu1DBufferSize;
|
||||
|
||||
std::vector<Path1ClipVertex> clippedTriangle;
|
||||
std::vector<Path1ClipVertex> inputTriangle;
|
||||
std::vector<EEClipVertex> clippedTriangle;
|
||||
std::vector<EEClipVertex> inputTriangle;
|
||||
|
||||
Vec4 vertexBuffers[2][108];
|
||||
Vec4 texCoordBuffers[2][108];
|
||||
|
||||
void addCorrections(std::vector<Path1ClipVertex>* vertices,
|
||||
McpipBlock* block);
|
||||
void moveDataToBuffer(std::vector<Path1ClipVertex>* vertices,
|
||||
const u8& context);
|
||||
void addCorrections(std::vector<EEClipVertex>* vertices, McpipBlock* block);
|
||||
void moveDataToBuffer(std::vector<EEClipVertex>* 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/paths/path1/clipper/path1_ee_clip_algorithm.hpp"
|
||||
#include "renderer/core/3d/clipper/ee_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/paths/path1/clipper/path1_ee_clip_algorithm.hpp"
|
||||
#include "renderer/core/3d/clipper/ee_clip_algorithm.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
@@ -36,11 +36,11 @@ class StaPipClipper {
|
||||
|
||||
private:
|
||||
u32 maxVertCount;
|
||||
Path1EEClipAlgorithm algorithm;
|
||||
EEClipAlgorithm algorithm;
|
||||
M4x4* mvp;
|
||||
|
||||
void perspectiveDivide(std::vector<Path1ClipVertex>* vertices);
|
||||
void moveDataToBuffer(const std::vector<Path1ClipVertex>& vertices,
|
||||
void perspectiveDivide(std::vector<EEClipVertex>* vertices);
|
||||
void moveDataToBuffer(const std::vector<EEClipVertex>& vertices,
|
||||
StaPipQBuffer* buffer);
|
||||
};
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
namespace Tyra {
|
||||
|
||||
enum StaPipProgramName {
|
||||
StdipUndefinedProgram,
|
||||
StaPipUndefinedProgram,
|
||||
|
||||
StaPipCullColor,
|
||||
StaPipAsIsColor,
|
||||
|
||||
@@ -23,8 +23,6 @@
|
||||
#include "./programs/cull/stapip_cull_td_vu1_program.hpp"
|
||||
#include "./programs/cull/stapip_cull_tc_vu1_program.hpp"
|
||||
|
||||
#include "renderer/core/paths/path1/programs/draw_finish/vu1_draw_finish.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class StaPipProgramsRepository {
|
||||
@@ -37,13 +35,12 @@ class StaPipProgramsRepository {
|
||||
private:
|
||||
StaPipAsIsCVU1Program asIsColor;
|
||||
StaPipCullCVU1Program cullColor;
|
||||
StaPipAsIsDVU1Program asIsLightingColor;
|
||||
StaPipCullDVU1Program cullLightingColor;
|
||||
StaPipAsIsTDVU1Program asIsLightingTextureColor;
|
||||
StaPipCullTDVU1Program cullLightingTextureColor;
|
||||
StaPipAsIsDVU1Program asIsDirLights;
|
||||
StaPipCullDVU1Program cullDirLights;
|
||||
StaPipAsIsTDVU1Program asIsTextureDirLights;
|
||||
StaPipCullTDVU1Program cullTextureDirLights;
|
||||
StaPipAsIsTCVU1Program asIsTextureColor;
|
||||
StaPipCullTCVU1Program cullTextureColor;
|
||||
VU1DrawFinish drawFinish;
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
|
||||
+13
-13
@@ -11,42 +11,42 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include "./path1_clip_vertex.hpp"
|
||||
#include "./ee_clip_vertex.hpp"
|
||||
#include "debug/debug.hpp"
|
||||
#include "renderer/renderer_settings.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
struct Path1EEClipAlgorithmSettings {
|
||||
struct EEClipAlgorithmSettings {
|
||||
bool lerpNormals, lerpTexCoords, lerpColors;
|
||||
};
|
||||
|
||||
class Path1EEClipAlgorithm {
|
||||
class EEClipAlgorithm {
|
||||
public:
|
||||
Path1EEClipAlgorithm();
|
||||
~Path1EEClipAlgorithm();
|
||||
EEClipAlgorithm();
|
||||
~EEClipAlgorithm();
|
||||
|
||||
void init(const RendererSettings& settings);
|
||||
|
||||
void clip(std::vector<Path1ClipVertex>* o_vertices,
|
||||
const std::vector<Path1ClipVertex>& vertices,
|
||||
const Path1EEClipAlgorithmSettings& settings);
|
||||
void clip(std::vector<EEClipVertex>* o_vertices,
|
||||
const std::vector<EEClipVertex>& vertices,
|
||||
const EEClipAlgorithmSettings& settings);
|
||||
|
||||
static float clipMargin;
|
||||
|
||||
private:
|
||||
float halfWidth, halfHeight, near, far;
|
||||
std::vector<Path1ClipVertex> tempVertices;
|
||||
std::vector<EEClipVertex> tempVertices;
|
||||
|
||||
float getValueByPlane(const Path1ClipVertex& v, const int& plane);
|
||||
float getValueByPlane(const EEClipVertex& v, const int& plane);
|
||||
|
||||
bool isInside(const int& plane, const float& v, const float& w,
|
||||
const float& planeLimitValue);
|
||||
|
||||
void clipAgainstPlane(const std::vector<Path1ClipVertex>& original,
|
||||
std::vector<Path1ClipVertex>* clipped, const int& plane,
|
||||
void clipAgainstPlane(const std::vector<EEClipVertex>& original,
|
||||
std::vector<EEClipVertex>* clipped, const int& plane,
|
||||
const float& planeLimitValue,
|
||||
const Path1EEClipAlgorithmSettings& settings);
|
||||
const EEClipAlgorithmSettings& settings);
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
struct Path1ClipVertex {
|
||||
struct EEClipVertex {
|
||||
Vec4 position, normal, st, color;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
# ______ ____ ___
|
||||
# | \/ ____| |___|
|
||||
# | | | \ | |
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||
# Licenced under Apache License 2.0
|
||||
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||
*/
|
||||
|
||||
#include "renderer/3d/pipeline/dynamic/dynpip_programs_repository.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
DynPipProgramsRepository::DynPipProgramsRepository() {}
|
||||
|
||||
DynPipProgramsRepository::~DynPipProgramsRepository() {}
|
||||
|
||||
DynPipVU1Program* DynPipProgramsRepository::getProgram(
|
||||
const DynPipProgramName& name) {
|
||||
switch (name) {
|
||||
case DynPipProgramName::DynPipColor:
|
||||
return &color;
|
||||
case DynPipProgramName::DynPipDirLights:
|
||||
return &dirLights;
|
||||
case DynPipProgramName::DynPipTextureDirLights:
|
||||
return &textureDirLights;
|
||||
case DynPipProgramName::DynPipTextureColor:
|
||||
return &textureColor;
|
||||
|
||||
default:
|
||||
TYRA_TRAP("Unknown VU1 program name");
|
||||
return &color;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Tyra
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
# ______ ____ ___
|
||||
# | \/ ____| |___|
|
||||
# | | | \ | |
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||
# Licenced under Apache License 2.0
|
||||
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||
*/
|
||||
|
||||
#include "renderer/3d/pipeline/dynamic/dynpip_qbuffer.hpp"
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
DynPipQBuffer::DynPipQBuffer() {}
|
||||
|
||||
DynPipQBuffer::~DynPipQBuffer() {}
|
||||
|
||||
} // namespace Tyra
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
# ______ ____ ___
|
||||
# | \/ ____| |___|
|
||||
# | | | \ | |
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||
# Licenced under Apache License 2.0
|
||||
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||
*/
|
||||
|
||||
#include "renderer/3d/pipeline/dynamic/dynpip_vu1_program.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
DynPipVU1Program::DynPipVU1Program(const DynPipProgramName& t_name,
|
||||
u32* t_start, u32* t_end,
|
||||
const u32& t_reglist,
|
||||
const u8& t_reglistCount,
|
||||
const u8& t_elementsPerVertex)
|
||||
: VU1Program(t_start, t_end),
|
||||
name(t_name),
|
||||
reglistCount(t_reglistCount),
|
||||
elementsPerVertex(t_elementsPerVertex),
|
||||
reglist(t_reglist) {
|
||||
packetSize = packet2_utils_get_packet_size_for_program(start, end);
|
||||
programSize = calculateProgramSize();
|
||||
}
|
||||
|
||||
DynPipVU1Program::~DynPipVU1Program() {}
|
||||
|
||||
const DynPipProgramName& DynPipVU1Program::getName() const { return name; }
|
||||
|
||||
u32& DynPipVU1Program::getReglist() { return reglist; }
|
||||
|
||||
void DynPipVU1Program::addBufferDataToPacket(packet2_t* packet,
|
||||
DynPipQBuffer* buffer,
|
||||
prim_t* prim) {
|
||||
addStandardBufferDataToPacket(packet, buffer, prim);
|
||||
addProgramQBufferDataToPacket(packet, buffer);
|
||||
}
|
||||
|
||||
void DynPipVU1Program::addStandardBufferDataToPacket(packet2_t* packet,
|
||||
DynPipQBuffer* buffer,
|
||||
prim_t* prim) {
|
||||
// if (buffer->bag->texture)
|
||||
// prim->mapping = 1;
|
||||
// else
|
||||
// prim->mapping = 0;
|
||||
|
||||
// packet2_utils_vu_open_unpack(packet, 0, true);
|
||||
// {
|
||||
// packet2_add_float(packet, 2048.0F); // scale
|
||||
// packet2_add_float(packet, 2048.0F); // scale
|
||||
// packet2_add_float(packet,
|
||||
// static_cast<float>(0xFFFFFF) / 32.0F); // scale
|
||||
// packet2_add_u32(packet, buffer->size); // vertex count
|
||||
|
||||
// packet2_utils_gs_add_prim_giftag(packet, prim, buffer->size, reglist,
|
||||
// reglistCount, 0);
|
||||
// }
|
||||
// packet2_utils_vu_close_unpack(packet);
|
||||
}
|
||||
|
||||
u16 DynPipVU1Program::getMaxVertCount(const bool& singleColorEnabled,
|
||||
const u16& bufferSize) const {
|
||||
return 0; // TODO
|
||||
|
||||
// u16 res = bufferSize - 4;
|
||||
// u8 colorElementsPerVertex =
|
||||
// singleColorEnabled ? (elementsPerVertex - 1) : elementsPerVertex;
|
||||
// res /= (colorElementsPerVertex + reglistCount);
|
||||
|
||||
// // Buffer size = VU1 double buffer size (xtop)
|
||||
// // res = qbuffer size (directly inside VU1)
|
||||
|
||||
// // Must be dividable by 3 and the result also dividable by 3. Why?
|
||||
// // 1st dividable reason - triangle, and packaging system in 3d rendering
|
||||
// // 2nd dividable reason - subpackaging system. We are splitting packages
|
||||
// into
|
||||
// // 3 subpackages in 3d renderer.
|
||||
// res = res / 3 / 3;
|
||||
// res = res * 3 * 3;
|
||||
// return res;
|
||||
}
|
||||
|
||||
} // namespace Tyra
|
||||
@@ -21,7 +21,7 @@
|
||||
.init_vf_all
|
||||
.init_vi_all
|
||||
|
||||
#include "src/renderer/core/paths/path1/programs/vcl_sml.i"
|
||||
#include "src/renderer/3d/pipeline/shared_macros/vcl_sml.i"
|
||||
#include "inc/renderer/3d/pipeline/minecraft/programs/as_is/mcpip_vu1_as_is_shared_defines.h"
|
||||
#include "src/renderer/3d/pipeline/minecraft/programs/as_is/macros.i"
|
||||
|
||||
|
||||
@@ -57,14 +57,14 @@ void McpipClip::initStaticPacket() {
|
||||
void McpipClip::addData(McpipBlock* block, const bool& isMulti,
|
||||
RendererCoreTextureBuffers* texBuffers,
|
||||
packet2_t* packet, const u8& context) {
|
||||
std::vector<Path1ClipVertex> clippedVertices;
|
||||
std::vector<EEClipVertex> clippedVertices;
|
||||
auto mvp = rendererCore->renderer3D.getViewProj() * block->model;
|
||||
|
||||
const auto* blockData = isMulti ? multiBlockData : singleBlockData;
|
||||
|
||||
for (u32 i = 0; i < blockData->count / 3; i++) {
|
||||
for (u8 j = 0; j < 3; j++) {
|
||||
Path1ClipVertex vert = {mvp * blockData->vertices[i * 3 + j], Vec4(),
|
||||
EEClipVertex vert = {mvp * blockData->vertices[i * 3 + j], Vec4(),
|
||||
blockData->textureCoords[i * 3 + j], Vec4()};
|
||||
|
||||
inputTriangle.push_back(vert);
|
||||
@@ -93,7 +93,7 @@ void McpipClip::addData(McpipBlock* block, const bool& isMulti,
|
||||
addDataToPacket(packet, context, block, clippedVertices.size(), texBuffers);
|
||||
}
|
||||
|
||||
void McpipClip::addCorrections(std::vector<Path1ClipVertex>* vertices,
|
||||
void McpipClip::addCorrections(std::vector<EEClipVertex>* vertices,
|
||||
McpipBlock* block) {
|
||||
for (u32 i = 0; i < vertices->size(); i++) {
|
||||
(*vertices)[i].position /= (*vertices)[i].position.w; // Perspective divide
|
||||
@@ -101,7 +101,7 @@ void McpipClip::addCorrections(std::vector<Path1ClipVertex>* vertices,
|
||||
}
|
||||
}
|
||||
|
||||
void McpipClip::moveDataToBuffer(std::vector<Path1ClipVertex>* vertices,
|
||||
void McpipClip::moveDataToBuffer(std::vector<EEClipVertex>* vertices,
|
||||
const u8& context) {
|
||||
for (u32 i = 0; i < vertices->size(); i++) {
|
||||
vertexBuffers[context][i].set(vertices->at(i).position);
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
.init_vf_all
|
||||
.init_vi_all
|
||||
|
||||
#include "src/renderer/core/paths/path1/programs/vcl_sml.i"
|
||||
#include "src/renderer/3d/pipeline/shared_macros/vcl_sml.i"
|
||||
#include "inc/renderer/3d/pipeline/minecraft/programs/cull/mcpip_vu1_cull_shared_defines.h"
|
||||
#include "src/renderer/3d/pipeline/minecraft/programs/cull/macros.i"
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
.init_vf_all
|
||||
.init_vi_all
|
||||
|
||||
#include "src/renderer/core/paths/path1/programs/vcl_sml.i"
|
||||
#include "src/renderer/core/paths/path1/programs/tyra_macros.i"
|
||||
#include "src/renderer/3d/pipeline/shared_macros/vcl_sml.i"
|
||||
#include "src/renderer/3d/pipeline/shared_macros/tyra_macros.i"
|
||||
#include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h"
|
||||
|
||||
#define RGBA_STORE_OFFSET 0
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
.init_vf_all
|
||||
.init_vi_all
|
||||
|
||||
#include "src/renderer/core/paths/path1/programs/vcl_sml.i"
|
||||
#include "src/renderer/core/paths/path1/programs/tyra_macros.i"
|
||||
#include "src/renderer/3d/pipeline/shared_macros/vcl_sml.i"
|
||||
#include "src/renderer/3d/pipeline/shared_macros/tyra_macros.i"
|
||||
#include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h"
|
||||
|
||||
#define RGBA_STORE_OFFSET 0
|
||||
|
||||
+2
-2
@@ -18,8 +18,8 @@
|
||||
.init_vf_all
|
||||
.init_vi_all
|
||||
|
||||
#include "src/renderer/core/paths/path1/programs/vcl_sml.i"
|
||||
#include "src/renderer/core/paths/path1/programs/tyra_macros.i"
|
||||
#include "src/renderer/3d/pipeline/shared_macros/vcl_sml.i"
|
||||
#include "src/renderer/3d/pipeline/shared_macros/tyra_macros.i"
|
||||
#include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h"
|
||||
|
||||
#define STQ_STORE_OFFSET 0
|
||||
|
||||
+2
-2
@@ -18,8 +18,8 @@
|
||||
.init_vf_all
|
||||
.init_vi_all
|
||||
|
||||
#include "src/renderer/core/paths/path1/programs/vcl_sml.i"
|
||||
#include "src/renderer/core/paths/path1/programs/tyra_macros.i"
|
||||
#include "src/renderer/3d/pipeline/shared_macros/vcl_sml.i"
|
||||
#include "src/renderer/3d/pipeline/shared_macros/tyra_macros.i"
|
||||
#include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h"
|
||||
|
||||
#define STQ_STORE_OFFSET 0
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
.init_vf_all
|
||||
.init_vi_all
|
||||
|
||||
#include "src/renderer/core/paths/path1/programs/vcl_sml.i"
|
||||
#include "src/renderer/core/paths/path1/programs/tyra_macros.i"
|
||||
#include "src/renderer/3d/pipeline/shared_macros/vcl_sml.i"
|
||||
#include "src/renderer/3d/pipeline/shared_macros/tyra_macros.i"
|
||||
#include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h"
|
||||
|
||||
#define RGBA_STORE_OFFSET 0
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
.init_vf_all
|
||||
.init_vi_all
|
||||
|
||||
#include "src/renderer/core/paths/path1/programs/vcl_sml.i"
|
||||
#include "src/renderer/core/paths/path1/programs/tyra_macros.i"
|
||||
#include "src/renderer/3d/pipeline/shared_macros/vcl_sml.i"
|
||||
#include "src/renderer/3d/pipeline/shared_macros/tyra_macros.i"
|
||||
#include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h"
|
||||
|
||||
#define RGBA_STORE_OFFSET 0
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
.init_vf_all
|
||||
.init_vi_all
|
||||
|
||||
#include "src/renderer/core/paths/path1/programs/vcl_sml.i"
|
||||
#include "src/renderer/core/paths/path1/programs/tyra_macros.i"
|
||||
#include "src/renderer/3d/pipeline/shared_macros/vcl_sml.i"
|
||||
#include "src/renderer/3d/pipeline/shared_macros/tyra_macros.i"
|
||||
#include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h"
|
||||
|
||||
#define STQ_STORE_OFFSET 0
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
.init_vf_all
|
||||
.init_vi_all
|
||||
|
||||
#include "src/renderer/core/paths/path1/programs/vcl_sml.i"
|
||||
#include "src/renderer/core/paths/path1/programs/tyra_macros.i"
|
||||
#include "src/renderer/3d/pipeline/shared_macros/vcl_sml.i"
|
||||
#include "src/renderer/3d/pipeline/shared_macros/tyra_macros.i"
|
||||
#include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h"
|
||||
|
||||
#define STQ_STORE_OFFSET 0
|
||||
|
||||
@@ -27,16 +27,16 @@ void StaPipClipper::clip(StaPipQBuffer* buffer) {
|
||||
TYRA_ASSERT(buffer->size <= maxVertCount / 3, "Buffer should have max ",
|
||||
maxVertCount / 3, " verts if we want to clip it.");
|
||||
|
||||
Path1EEClipAlgorithmSettings algoSettings = {
|
||||
buffer->bag->lighting != nullptr, buffer->bag->texture != nullptr,
|
||||
EEClipAlgorithmSettings algoSettings = {buffer->bag->lighting != nullptr,
|
||||
buffer->bag->texture != nullptr,
|
||||
buffer->bag->color->many != nullptr};
|
||||
|
||||
std::vector<Path1ClipVertex> clippedVertices;
|
||||
std::vector<EEClipVertex> clippedVertices;
|
||||
|
||||
for (u32 i = 0; i < buffer->size / 3; i++) {
|
||||
std::vector<Path1ClipVertex> inputTriangle;
|
||||
std::vector<EEClipVertex> inputTriangle;
|
||||
for (u8 j = 0; j < 3; j++) {
|
||||
Path1ClipVertex vert = {
|
||||
EEClipVertex vert = {
|
||||
*mvp * buffer->vertices[i * 3 + j],
|
||||
buffer->bag->lighting ? buffer->normals[i * 3 + j] : Vec4(),
|
||||
buffer->bag->texture ? buffer->sts[i * 3 + j] : Vec4(),
|
||||
@@ -45,7 +45,7 @@ void StaPipClipper::clip(StaPipQBuffer* buffer) {
|
||||
inputTriangle.push_back(vert);
|
||||
}
|
||||
|
||||
std::vector<Path1ClipVertex> clippedTriangle;
|
||||
std::vector<EEClipVertex> clippedTriangle;
|
||||
algorithm.clip(&clippedTriangle, inputTriangle, algoSettings);
|
||||
|
||||
if (clippedTriangle.size() == 0) continue;
|
||||
@@ -64,14 +64,14 @@ void StaPipClipper::clip(StaPipQBuffer* buffer) {
|
||||
moveDataToBuffer(clippedVertices, buffer);
|
||||
}
|
||||
|
||||
void StaPipClipper::perspectiveDivide(std::vector<Path1ClipVertex>* vertices) {
|
||||
void StaPipClipper::perspectiveDivide(std::vector<EEClipVertex>* vertices) {
|
||||
for (u32 i = 0; i < vertices->size(); i++) {
|
||||
(*vertices)[i].position /= (*vertices)[i].position.w;
|
||||
}
|
||||
}
|
||||
|
||||
void StaPipClipper::moveDataToBuffer(
|
||||
const std::vector<Path1ClipVertex>& vertices, StaPipQBuffer* buffer) {
|
||||
void StaPipClipper::moveDataToBuffer(const std::vector<EEClipVertex>& vertices,
|
||||
StaPipQBuffer* buffer) {
|
||||
buffer->reallocateManually(vertices.size());
|
||||
|
||||
for (u32 i = 0; i < vertices.size(); i++) {
|
||||
|
||||
@@ -25,14 +25,14 @@ StaPipVU1Program* StaPipProgramsRepository::getProgram(
|
||||
return &cullColor;
|
||||
|
||||
case StaPipProgramName::StaPipAsIsDirLights:
|
||||
return &asIsLightingColor;
|
||||
return &asIsDirLights;
|
||||
case StaPipProgramName::StaPipCullDirLights:
|
||||
return &cullLightingColor;
|
||||
return &cullDirLights;
|
||||
|
||||
case StaPipProgramName::StaPipAsIsTextureDirLights:
|
||||
return &asIsLightingTextureColor;
|
||||
return &asIsTextureDirLights;
|
||||
case StaPipProgramName::StaPipCullTextureDirLights:
|
||||
return &cullLightingTextureColor;
|
||||
return &cullTextureDirLights;
|
||||
|
||||
case StaPipProgramName::StaPipAsIsTextureColor:
|
||||
return &asIsTextureColor;
|
||||
@@ -41,7 +41,7 @@ StaPipVU1Program* StaPipProgramsRepository::getProgram(
|
||||
|
||||
default:
|
||||
TYRA_TRAP("Unknown VU1 program name");
|
||||
return &cullLightingTextureColor;
|
||||
return &cullTextureDirLights;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Tyra {
|
||||
|
||||
StaPipQBufferRenderer::StaPipQBufferRenderer() {
|
||||
context = 0;
|
||||
lastProgramName = StdipUndefinedProgram;
|
||||
lastProgramName = StaPipUndefinedProgram;
|
||||
staticDataPacket = packet2_create(3, P2_TYPE_NORMAL, P2_MODE_CHAIN, true);
|
||||
objectDataPacket = packet2_create(16, P2_TYPE_NORMAL, P2_MODE_CHAIN, true);
|
||||
programsPacket = nullptr;
|
||||
@@ -221,7 +221,7 @@ void StaPipQBufferRenderer::clip(StaPipQBuffer* buffer) {
|
||||
}
|
||||
|
||||
void StaPipQBufferRenderer::clearLastProgramName() {
|
||||
lastProgramName = StdipUndefinedProgram;
|
||||
lastProgramName = StaPipUndefinedProgram;
|
||||
}
|
||||
|
||||
void StaPipQBufferRenderer::addBufferDataToPacket(StaPipVU1Program* program,
|
||||
|
||||
+15
-17
@@ -8,26 +8,26 @@
|
||||
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||
*/
|
||||
|
||||
#include "renderer/core/paths/path1/clipper/path1_ee_clip_algorithm.hpp"
|
||||
#include "renderer/core/3d/clipper/ee_clip_algorithm.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
Path1EEClipAlgorithm::Path1EEClipAlgorithm() {}
|
||||
EEClipAlgorithm::EEClipAlgorithm() {}
|
||||
|
||||
Path1EEClipAlgorithm::~Path1EEClipAlgorithm() {}
|
||||
EEClipAlgorithm::~EEClipAlgorithm() {}
|
||||
|
||||
float Path1EEClipAlgorithm::clipMargin = -10.0F;
|
||||
float EEClipAlgorithm::clipMargin = -10.0F;
|
||||
|
||||
void Path1EEClipAlgorithm::init(const RendererSettings& settings) {
|
||||
void EEClipAlgorithm::init(const RendererSettings& settings) {
|
||||
halfWidth = settings.getWidth() / 2;
|
||||
halfHeight = settings.getHeight() / 2;
|
||||
near = settings.getNear() - (-clipMargin);
|
||||
far = -settings.getFar();
|
||||
}
|
||||
|
||||
void Path1EEClipAlgorithm::clip(std::vector<Path1ClipVertex>* o_vertices,
|
||||
const std::vector<Path1ClipVertex>& vertices,
|
||||
const Path1EEClipAlgorithmSettings& settings) {
|
||||
void EEClipAlgorithm::clip(std::vector<EEClipVertex>* o_vertices,
|
||||
const std::vector<EEClipVertex>& vertices,
|
||||
const EEClipAlgorithmSettings& settings) {
|
||||
tempVertices.clear();
|
||||
|
||||
for (u32 i = 0; i < vertices.size(); i++) {
|
||||
@@ -42,7 +42,7 @@ void Path1EEClipAlgorithm::clip(std::vector<Path1ClipVertex>* o_vertices,
|
||||
clipAgainstPlane(tempVertices, o_vertices, 4, far, settings);
|
||||
}
|
||||
|
||||
float Path1EEClipAlgorithm::getValueByPlane(const Path1ClipVertex& v,
|
||||
float EEClipAlgorithm::getValueByPlane(const EEClipVertex& v,
|
||||
const int& plane) {
|
||||
switch (plane) {
|
||||
case 1:
|
||||
@@ -57,8 +57,7 @@ float Path1EEClipAlgorithm::getValueByPlane(const Path1ClipVertex& v,
|
||||
}
|
||||
}
|
||||
|
||||
bool Path1EEClipAlgorithm::isInside(const int& plane, const float& v,
|
||||
const float& w,
|
||||
bool EEClipAlgorithm::isInside(const int& plane, const float& v, const float& w,
|
||||
const float& planeLimitValue) {
|
||||
switch (plane) {
|
||||
case 3:
|
||||
@@ -71,11 +70,10 @@ bool Path1EEClipAlgorithm::isInside(const int& plane, const float& v,
|
||||
}
|
||||
}
|
||||
|
||||
void Path1EEClipAlgorithm::clipAgainstPlane(
|
||||
const std::vector<Path1ClipVertex>& original,
|
||||
std::vector<Path1ClipVertex>* clipped, const int& plane,
|
||||
const float& planeLimitValue,
|
||||
const Path1EEClipAlgorithmSettings& settings) {
|
||||
void EEClipAlgorithm::clipAgainstPlane(
|
||||
const std::vector<EEClipVertex>& original,
|
||||
std::vector<EEClipVertex>* clipped, const int& plane,
|
||||
const float& planeLimitValue, const EEClipAlgorithmSettings& settings) {
|
||||
clipped->clear();
|
||||
|
||||
for (u32 i = 0; i < original.size(); i++) {
|
||||
@@ -98,7 +96,7 @@ void Path1EEClipAlgorithm::clipAgainstPlane(
|
||||
((b.position.w - a.position.w) * planeLimitValue -
|
||||
(bpx - apx));
|
||||
|
||||
Path1ClipVertex nb = {
|
||||
EEClipVertex nb = {
|
||||
Vec4::getByLerp(a.position, b.position, p),
|
||||
settings.lerpNormals ? Vec4::getByLerp(a.normal, b.normal, p)
|
||||
: Vec4(),
|
||||
@@ -1,45 +0,0 @@
|
||||
; ______ ____ ___
|
||||
; | \/ ____| |___|
|
||||
; | | | \ | |
|
||||
;---------------------------------------------------------------
|
||||
; Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||
; Licenced under Apache License 2.0
|
||||
; Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||
;
|
||||
;---------------------------------------------------------------
|
||||
; Needed for synchronization with draw_wait_finish()
|
||||
;---------------------------------------------------------------
|
||||
|
||||
.syntax new
|
||||
.name VU1DrawFinish
|
||||
.vu
|
||||
.init_vf_all
|
||||
.init_vi_all
|
||||
|
||||
#include "src/renderer/core/paths/path1/programs/vcl_sml.i"
|
||||
#include "src/renderer/core/paths/path1/programs/tyra_macros.i"
|
||||
#include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h"
|
||||
|
||||
--enter
|
||||
--endenter
|
||||
|
||||
#vuprog VU1DrawFinish
|
||||
|
||||
LoadTyraStaticData{ gifSetTag }
|
||||
|
||||
xtop buffer
|
||||
lq drawFinishTag, 0(buffer)
|
||||
lq primTag, 1(buffer)
|
||||
|
||||
iaddiu kickAddress, buffer, 2
|
||||
|
||||
sq gifSetTag, 0(kickAddress)
|
||||
sq drawFinishTag, 1(kickAddress)
|
||||
sq primTag, 2(kickAddress)
|
||||
|
||||
xgkick kickAddress
|
||||
|
||||
#endvuprog
|
||||
|
||||
--exit
|
||||
--endexit
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
# ______ ____ ___
|
||||
# | \/ ____| |___|
|
||||
# | | | \ | |
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||
# Licenced under Apache License 2.0
|
||||
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||
*/
|
||||
|
||||
#include "debug/debug.hpp"
|
||||
#include "renderer/core/paths/path1/programs/draw_finish/vu1_draw_finish.hpp"
|
||||
|
||||
extern u32 VU1DrawFinish_CodeStart __attribute__((section(".vudata")));
|
||||
extern u32 VU1DrawFinish_CodeEnd __attribute__((section(".vudata")));
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
VU1DrawFinish::VU1DrawFinish()
|
||||
: VU1Program(&VU1DrawFinish_CodeStart, &VU1DrawFinish_CodeEnd) {}
|
||||
|
||||
VU1DrawFinish::~VU1DrawFinish() {}
|
||||
|
||||
std::string VU1DrawFinish::getStringName() const {
|
||||
return std::string("Draw finish");
|
||||
}
|
||||
|
||||
void VU1DrawFinish::addTag(packet2_t* packet, prim_t* prim) const {
|
||||
packet2_utils_vu_open_unpack(packet, 0, true);
|
||||
packet2_utils_gs_add_draw_finish_giftag(packet);
|
||||
packet2_utils_gs_add_prim_giftag(
|
||||
packet, prim, 1, ((u64)GIF_REG_RGBAQ) << 0 | ((u64)GIF_REG_XYZ2) << 4, 2,
|
||||
0);
|
||||
packet2_utils_vu_close_unpack(packet);
|
||||
}
|
||||
|
||||
} // namespace Tyra
|
||||
Reference in New Issue
Block a user