Skip to content

Commit

Permalink
Do not understand what's going on
Browse files Browse the repository at this point in the history
  • Loading branch information
EPICGameGuy committed Nov 28, 2023
1 parent 601a7f7 commit febb4c0
Show file tree
Hide file tree
Showing 9 changed files with 299 additions and 124 deletions.
2 changes: 1 addition & 1 deletion include/engine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Tickable;

namespace Engine
{
void init();
void init(int argc, char* argv[]);
void run();

/// @brief Returns the current frame number. This is incremented after ticking. The first frame is frame 0.
Expand Down
12 changes: 7 additions & 5 deletions include/renderer/ps2gl_renderers/vertex_color_renderer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
#include "ps2gl/linear_renderer.h"
#include "ps2gl/renderer.h"

#define kVCRPrimType (((tU32)1 << 31) | 1)
#define kVCRPrimTypeFlag ((tU64)1 << 32)
static constexpr u32 kVCRPrimType = (((tU32)1 << 31) | GL_TRIANGLE_STRIP);
static constexpr u64 kVCRPrimTypeFlag((tU64)1 << 32);

class VertexColorRenderer: public CLinearRenderer
class CVertexColorRenderer: public CLinearRenderer
{
public:
VertexColorRenderer();
CVertexColorRenderer();

static VertexColorRenderer* Register();
static CVertexColorRenderer* Register();
//virtual void InitContext(GLenum primType, tU32 rcChanges, bool userRcChanged) override;
virtual void DrawLinearArrays(CGeometryBlock& block) override;
};
2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ all: $(ISO_TGT)

run: $(EE_BIN)
cd $(dir $(EE_BIN))
ps2client -h $(PS2HOST) execee host:$(notdir $(EE_BIN))
ps2client -h $(PS2HOST) execee host:$(notdir $(EE_BIN)) --filesystem=host

reset:
ps2client -h $(PS2HOST) reset
14 changes: 12 additions & 2 deletions src/engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,19 @@ static float game_time = 0.f;
static float tickrate = 1.f / 59.93f; // ntsc default
static u32 frameCounter = 0;

void init()
void init(int argc, char* argv[])
{
Filesystem::set_filesystem_type(Filesystem::Type::cdrom);
// TODO: figure out why this don't work
// if (argc == 2 && strcmp(argv[1], "--filesystem=host") == 0)
// {
// printf("Using host filesystem type\n");
// Filesystem::set_filesystem_type(Filesystem::Type::host);
// }
// else
{
printf("Using cdrom filesystem type\n");
Filesystem::set_filesystem_type(Filesystem::Type::cdrom);
}

if (Filesystem::get_filesystem_type() != Filesystem::Type::host)
{
Expand Down
2 changes: 1 addition & 1 deletion src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

int main(int argc, char* argv[])
{
Engine::init();
Engine::init(argc, argv);

Engine::run();

Expand Down
2 changes: 1 addition & 1 deletion src/renderer/gs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ static void init_renderer()

init_lights();

VertexColorRenderer::Register();
CVertexColorRenderer::Register();

for (Renderable::TIterator Itr = Renderable::Itr(); Itr; ++Itr)
{
Expand Down
1 change: 1 addition & 0 deletions src/renderer/mesh.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ void Mesh::compile()
printf("Compiling mesh strip: %d\n", i);
const auto start_index = strip.strip_start_index;
const auto count = strip.strip_end_index - start_index;

glDrawArrays(kVCRPrimType, start_index, count);

++i;
Expand Down
Loading

0 comments on commit febb4c0

Please sign in to comment.