tyrav2 init

This commit is contained in:
h4570
2022-07-17 10:21:35 +02:00
parent 44c1ee4fe8
commit c8b22ff331
249 changed files with 18187 additions and 0 deletions
@@ -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
#include "math/vec4.hpp"
namespace Tyra {
struct Path1ClipVertex {
Vec4 position, normal, st, color;
};
} // namespace Tyra
@@ -0,0 +1,52 @@
/*
# ______ ____ ___
# | \/ ____| |___|
# | | | \ | |
#-----------------------------------------------------------------------
# Copyright 2022, tyra - https://github.com/h4570/tyra
# Licenced under Apache License 2.0
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#pragma once
#include <vector>
#include "./path1_clip_vertex.hpp"
#include "debug/debug.hpp"
#include "renderer/renderer_settings.hpp"
namespace Tyra {
struct Path1EEClipAlgorithmSettings {
bool lerpNormals, lerpTexCoords, lerpColors;
};
class Path1EEClipAlgorithm {
public:
Path1EEClipAlgorithm();
~Path1EEClipAlgorithm();
void init(const RendererSettings& settings);
void clip(std::vector<Path1ClipVertex>* o_vertices,
const std::vector<Path1ClipVertex>& vertices,
const Path1EEClipAlgorithmSettings& settings);
static float clipMargin;
private:
float halfWidth, halfHeight, near, far;
std::vector<Path1ClipVertex> tempVertices;
float getValueByPlane(const Path1ClipVertex& 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,
const float& planeLimitValue,
const Path1EEClipAlgorithmSettings& settings);
};
} // namespace Tyra
@@ -0,0 +1,36 @@
/*
# ______ ____ ___
# | \/ ____| |___|
# | | | \ | |
#-----------------------------------------------------------------------
# Copyright 2022, tyra - https://github.com/h4570/tyra
# Licenced under Apache License 2.0
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#pragma once
#include <dma.h>
#include <packet2_utils.h>
#include "debug/debug.hpp"
#include "./vu1_program.hpp"
namespace Tyra {
class Path1 {
public:
Path1();
~Path1();
u32 uploadProgram(VU1Program* program, const u32& address);
packet2_t* createProgramsCache(VU1Program** programs, const u32& count,
const u32& address);
void setDoubleBuffer(const u16& startingAddress, const u16& bufferSize);
private:
packet2_t* doubleBufferPacket;
};
} // namespace Tyra
@@ -0,0 +1,28 @@
/*
# ______ ____ ___
# | \/ ____| |___|
# | | | \ | |
#-----------------------------------------------------------------------
# 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 "../../vu1_program.hpp"
namespace Tyra {
class VU1DrawFinish : public VU1Program {
public:
VU1DrawFinish();
~VU1DrawFinish();
std::string getStringName() const;
void addTag(packet2_t* packet, prim_t* prim) const;
};
} // namespace Tyra
@@ -0,0 +1,41 @@
/*
# ______ ____ ___
# | \/ ____| |___|
# | | | \ | |
#-----------------------------------------------------------------------
# Copyright 2022, tyra - https://github.com/h4570/tyra
# Licenced under Apache License 2.0
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#pragma once
#include <tamtypes.h>
#include <packet2_utils.h>
#include <string>
namespace Tyra {
class VU1Program {
public:
VU1Program(u32* start, u32* end);
~VU1Program();
const u32& getPacketSize() const;
const u32& getProgramSize() const;
const u32& getDestinationAddress() const;
u32* getStart() const;
u32* getEnd() const;
virtual std::string getStringName() const = 0;
void setDestinationAddress(const u32& addr);
protected:
u32 packetSize, destinationAddress, programSize;
u32 *start, *end;
u32 calculateProgramSize() const;
};
} // namespace Tyra
@@ -0,0 +1,42 @@
/*
# ______ ____ ___
# | \/ ____| |___|
# | | | \ | |
#-----------------------------------------------------------------------
# Copyright 2022, tyra - https://github.com/h4570/tyra
# Licenced under Apache License 2.0
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#pragma once
#include <dma.h>
#include <packet2_chain.h>
#include <draw.h>
#include "renderer/core/texture/models/texture.hpp"
#include "renderer/renderer_settings.hpp"
#include "renderer/models/color.hpp"
#include "renderer/core/texture/renderer_core_texture_buffers.hpp"
namespace Tyra {
class Path3 {
public:
Path3();
~Path3();
void init(RendererSettings* settings);
void addDrawFinishTag();
void clearScreen(zbuffer_t* z, const Color& color);
void sendTexture(Texture* texture,
const RendererCoreTextureBuffers& texBuffers);
private:
packet2_t* drawFinishPacket;
packet2_t* clearScreenPacket;
packet2_t* texturePacket;
RendererSettings* settings;
};
} // namespace Tyra