mirror of
https://github.com/OpenDriver2/REDRIVER2.git
synced 2024-11-22 10:22:48 +01:00
- line debug overlay [WIP]
This commit is contained in:
parent
ecd1594fbc
commit
2ff1377c4d
73
src_rebuild/DebugOverlay.cpp
Normal file
73
src_rebuild/DebugOverlay.cpp
Normal file
@ -0,0 +1,73 @@
|
||||
#include "THISDUST.H"
|
||||
|
||||
#include "LIBGTE.H"
|
||||
#include "LIBGPU.H"
|
||||
#include "INLINE_C.H"
|
||||
#include "GTEREG.H"
|
||||
|
||||
#include "GAME/ASM/ASMTEST.H"
|
||||
#include "GAME/C/CONVERT.H"
|
||||
#include "GAME/C/CAMERA.H"
|
||||
#include "GAME/C/DRAW.H"
|
||||
#include "GAME/C/SYSTEM.H"
|
||||
|
||||
|
||||
struct LineDef_t
|
||||
{
|
||||
VECTOR posA, posB;
|
||||
CVECTOR color;
|
||||
};
|
||||
|
||||
LineDef_t gDebug_Lines[512];
|
||||
int gDebug_numLines = 0;
|
||||
|
||||
void DrawDebugOverlays()
|
||||
{
|
||||
VECTOR _zerov = { 0 };
|
||||
|
||||
while(gDebug_numLines > 0)
|
||||
{
|
||||
LineDef_t& ld = gDebug_Lines[gDebug_numLines-1];
|
||||
|
||||
gte_SetTransVector(&_zerov);
|
||||
gte_SetRotMatrix(&inv_camera_matrix);
|
||||
|
||||
SVECTOR a, b;
|
||||
a.vx = ld.posA.vx - camera_position.vx;
|
||||
a.vy = ld.posA.vy - camera_position.vy;
|
||||
a.vz = ld.posA.vz - camera_position.vz;
|
||||
|
||||
b.vx = ld.posB.vx - camera_position.vx;
|
||||
b.vy = ld.posB.vy - camera_position.vy;
|
||||
b.vz = ld.posB.vz - camera_position.vz;
|
||||
|
||||
gte_ldv0(&a);
|
||||
gte_ldv1(&b);
|
||||
|
||||
docop2(0x280030);
|
||||
|
||||
LINE_F2* line = (LINE_F2*)current->primptr;
|
||||
setLineF2(line);
|
||||
line->x0 = SX0;
|
||||
line->y0 = SY0;
|
||||
line->x1 = SX1;
|
||||
line->y1 = SY1;
|
||||
line->r0 = ld.color.r;
|
||||
line->g0 = ld.color.g;
|
||||
line->b0 = ld.color.b;
|
||||
|
||||
addPrim(current->ot + 2, line);
|
||||
|
||||
current->primptr += sizeof(LINE_F2);
|
||||
gDebug_numLines--;
|
||||
}
|
||||
gDebug_numLines = 0;
|
||||
}
|
||||
|
||||
void Debug_AddLine(VECTOR& pointA, VECTOR& pointB, CVECTOR& color)
|
||||
{
|
||||
LineDef_t& ld = gDebug_Lines[gDebug_numLines++];
|
||||
ld.posA = pointA;
|
||||
ld.posB = pointB;
|
||||
ld.color = color;
|
||||
}
|
@ -2906,6 +2906,12 @@ void RenderGame2(int view)
|
||||
}
|
||||
|
||||
DrawAllTheCars(view);
|
||||
|
||||
#ifndef PSX
|
||||
extern void DrawDebugOverlays();
|
||||
|
||||
DrawDebugOverlays();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -166,6 +166,7 @@
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="DebugOverlay.cpp" />
|
||||
<ClCompile Include="EMULATOR\ABS.C" />
|
||||
<ClCompile Include="EMULATOR\CRASHHANDLER.C" />
|
||||
<ClCompile Include="EMULATOR\EMULATOR.C" />
|
||||
|
@ -258,6 +258,9 @@
|
||||
<ClCompile Include="GAME\C\ENVSOUND.C">
|
||||
<Filter>main\C</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DebugOverlay.cpp">
|
||||
<Filter>main</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="EMULATOR\ABS.H">
|
||||
|
Loading…
Reference in New Issue
Block a user