Skip to content

Commit

Permalink
17.7-dev14-fix3, Implemented zCRndD3D::DrawLineZ
Browse files Browse the repository at this point in the history
  • Loading branch information
kirides committed Dec 3, 2020
1 parent d2b320f commit 7845b25
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion D3D11Engine/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#define stdext std
#endif

#define VERSION_NUMBER "17.7-dev14-fix2"
#define VERSION_NUMBER "17.7-dev14-fix3"
__declspec(selectany) const char* VERSION_NUMBER_STR = VERSION_NUMBER;

extern bool GMPModeActive;
Expand Down
17 changes: 13 additions & 4 deletions D3D11Engine/zCRndD3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,20 @@ class zCRndD3D {

/** Draws a straight line from xyz1 to xyz2 */
static void __fastcall hooked_zCRndD3DDrawLineZ( void* thisptr, void* unknwn, float x1, float y1, float z1, float x2, float y2, float z2, zColor color ) {
return;
// TODO: Coordinates are kinda wonky. Wrong space? ScreenSpace to Worldspace neccessery?
// TODO: Implement occlusion culling for the lines.

auto lineRenderer = Engine::GraphicsEngine->GetLineRenderer();
if ( lineRenderer )
lineRenderer->AddLine( LineVertex( XMFLOAT3( x1, y1, z1 ), color.dword ), LineVertex( XMFLOAT3( x2, y2, z2 ), color.dword ) );
if ( lineRenderer ) {
static XMVECTOR pos1 = {}, pos2 = {}, discard = {};
// Coordinates are screen space. Unproject to Worldspace neccessery.
Engine::GAPI->UnprojectXM( XMVectorSet( x1, y1, z1, 0 ), pos1, discard );
Engine::GAPI->UnprojectXM( XMVectorSet( x2, y2, z2, 0 ), pos2, discard );

static XMFLOAT3 fPos1; XMStoreFloat3( &fPos1, pos1 );
static XMFLOAT3 fPos2; XMStoreFloat3( &fPos2, pos2 );

lineRenderer->AddLine( LineVertex( fPos1, color.dword ), LineVertex( fPos2, color.dword ) );
}
}

static void __fastcall hooked_zCRndD3DDrawPoly( void* thisptr, void* unknwn, zCPolygon* poly ) {
Expand Down

0 comments on commit 7845b25

Please sign in to comment.