-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
EPICGameGuy
committed
Nov 27, 2023
1 parent
0047d11
commit e54e045
Showing
9 changed files
with
324 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
include/renderer/ps2gl_renderers/vertex_color_renderer.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#pragma once | ||
|
||
#include "GL/gl.h" | ||
#include "ps2gl/immgmanager.h" | ||
#include "ps2gl/linear_renderer.h" | ||
#include "ps2gl/renderer.h" | ||
|
||
#define kVCRPrimType (((tU32)1 << 31) | 1) | ||
#define kVCRPrimTypeFlag ((tU64)1 << 32) | ||
|
||
class VertexColorRenderer: public CLinearRenderer | ||
{ | ||
public: | ||
VertexColorRenderer(); | ||
|
||
static VertexColorRenderer* Register(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
RENDERERS = \ | ||
vertex_color_renderer | ||
|
||
EE_OBJS += $(addsuffix .vo, $(addprefix vu1/, $(RENDERERS))) | ||
VSM_SOURCES = $(addsuffix _vcl.vsm, $(addprefix vu1/, $(RENDERERS))) | ||
|
||
%.vo: %_vcl.vsm | ||
dvp-as -o $@ $< | ||
|
||
%_vcl.vsm: %_pp4.vcl | ||
vcl -o$@ $< | ||
|
||
%indexed_pp4.vcl: %indexed_pp3.vcl | ||
cat $< | cc -E -P -imacros $(PS2GL_DIR)/vu1/vu1_mem_indexed.h -o $@ - | ||
|
||
%_pp4.vcl: %_pp3.vcl | ||
cat $< | cc -E -P -imacros $(PS2GL_DIR)/vu1/vu1_mem_linear.h -o $@ - | ||
|
||
%_pp3.vcl: %_pp2.vcl | ||
cat $< | sed 's/\[\([0-9]\)\]/_\1/g ; s/\[\([w-zW-Z]\)\]/\1/g' - > $@ | ||
|
||
%_pp2.vcl: %_pp1.vcl | ||
masp -c ';' -I$(PS2GL_DIR) -o $@ $< | ||
|
||
%_pp1.vcl: %.vcl | ||
cat $< | sed 's/#include[ ]\+.\+// ; s/#define[ ]\+.\+// ; s|\(\.include[ ]\+\)"\([^/].\+\)"|\1"$(<D)/\2"|' - > $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#include "renderer/ps2gl_renderers/vertex_color_renderer.hpp" | ||
#include "vu1_mem_linear.h" | ||
|
||
#define VU_FUNCTIONS(name) \ | ||
void vsm##name##_CodeStart(); \ | ||
void vsm##name##_CodeEnd() | ||
|
||
#define mVsmAddr(name) ((void*)vsm##name##_CodeStart) | ||
#define mVsmSize(name) ((u8*)vsm##name##_CodeEnd - (u8*)vsm##name##_CodeStart) | ||
|
||
extern "C" { | ||
VU_FUNCTIONS(VertexColorRenderer); | ||
} | ||
|
||
VertexColorRenderer::VertexColorRenderer() | ||
: CLinearRenderer(mVsmAddr(VertexColorRenderer), mVsmSize(VertexColorRenderer), 4, 3, | ||
kInputStart, | ||
kInputBufSize - kInputStart, | ||
"Vertex color renderer") | ||
{ | ||
Requirements = 0; // no requirements | ||
Capabilities = kVCRPrimTypeFlag; // provides the "kVCRPrimType" capability | ||
} | ||
|
||
VertexColorRenderer* VertexColorRenderer::Register() | ||
{ | ||
// create a renderer and register it | ||
|
||
VertexColorRenderer* renderer = new VertexColorRenderer; | ||
pglRegisterRenderer(renderer); | ||
|
||
// register the prim type | ||
|
||
pglRegisterCustomPrimType(kVCRPrimType, // the prim type we will pass to ps2gl (glBegin...) | ||
kVCRPrimTypeFlag, // the corresponding renderer requirement | ||
~(tU64)0xffffffff, // we only care about the custom stuff (upper 32 bits) | ||
true); // ok to merge multiple calls when possible | ||
|
||
return renderer; | ||
} |
Oops, something went wrong.