feat: complete native client rendering parity updates
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "EterLib/StdAfx.h"
|
||||
#include "EterLib/GrpScreen.h"
|
||||
#include "EterLib/StateManager.h"
|
||||
#include "EterLib/Camera.h"
|
||||
|
||||
#include "../PlatformStub.h"
|
||||
#include "UIRenderCommands.h"
|
||||
@@ -285,27 +286,75 @@ void CScreen::SetCursorPosition(int x, int y, int hres, int vres)
|
||||
ms_Ray.SetDirection(-ms_vtPickRayDir, 51200.0f);
|
||||
}
|
||||
|
||||
auto CScreen::GetCursorPosition(float *, float *, float *) -> bool
|
||||
auto CScreen::GetCursorPosition(float * px, float * py, float * pz) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
if (!GetCursorXYPosition(px, py)) return false;
|
||||
if (!GetCursorZPosition(pz)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
auto CScreen::GetCursorXYPosition(float *, float *) -> bool
|
||||
auto CScreen::GetCursorXYPosition(float * px, float * py) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
D3DXVECTOR3 v3Eye = CCameraManager::Instance().GetCurrentCamera()->GetEye();
|
||||
|
||||
TPosition posVertices[4];
|
||||
posVertices[0] = TPosition(v3Eye.x - 90000000.0f, v3Eye.y + 90000000.0f, 0.0f);
|
||||
posVertices[1] = TPosition(v3Eye.x - 90000000.0f, v3Eye.y - 90000000.0f, 0.0f);
|
||||
posVertices[2] = TPosition(v3Eye.x + 90000000.0f, v3Eye.y + 90000000.0f, 0.0f);
|
||||
posVertices[3] = TPosition(v3Eye.x + 90000000.0f, v3Eye.y - 90000000.0f, 0.0f);
|
||||
|
||||
static const WORD sc_awFillRectIndices[6] = { 0, 2, 1, 2, 3, 1, };
|
||||
|
||||
float u, v, t;
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
if (IntersectTriangle(ms_vtPickRayOrig, ms_vtPickRayDir,
|
||||
posVertices[sc_awFillRectIndices[i * 3]],
|
||||
posVertices[sc_awFillRectIndices[i * 3 + 1]],
|
||||
posVertices[sc_awFillRectIndices[i * 3 + 2]],
|
||||
&u, &v, &t))
|
||||
{
|
||||
*px = u;
|
||||
*py = v;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
auto CScreen::GetCursorZPosition(float *) -> bool
|
||||
auto CScreen::GetCursorZPosition(float * pz) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
D3DXVECTOR3 v3Eye = CCameraManager::Instance().GetCurrentCamera()->GetEye();
|
||||
|
||||
TPosition posVertices[4];
|
||||
posVertices[0] = TPosition(v3Eye.x - 90000000.0f, 0.0f, v3Eye.z + 90000000.0f);
|
||||
posVertices[1] = TPosition(v3Eye.x - 90000000.0f, 0.0f, v3Eye.z - 90000000.0f);
|
||||
posVertices[2] = TPosition(v3Eye.x + 90000000.0f, 0.0f, v3Eye.z + 90000000.0f);
|
||||
posVertices[3] = TPosition(v3Eye.x + 90000000.0f, 0.0f, v3Eye.z - 90000000.0f);
|
||||
|
||||
static const WORD sc_awFillRectIndices[6] = { 0, 2, 1, 2, 3, 1, };
|
||||
|
||||
float u, v, t;
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
if (IntersectTriangle(ms_vtPickRayOrig, ms_vtPickRayDir,
|
||||
posVertices[sc_awFillRectIndices[i * 3]],
|
||||
posVertices[sc_awFillRectIndices[i * 3 + 1]],
|
||||
posVertices[sc_awFillRectIndices[i * 3 + 2]],
|
||||
&u, &v, &t))
|
||||
{
|
||||
*pz = t;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
auto CScreen::GetPickingPosition(float, float *, float *, float *) -> void
|
||||
auto CScreen::GetPickingPosition(float t, float * x, float * y, float * z) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
*x = ms_vtPickRayOrig.x + ms_vtPickRayDir.x * t;
|
||||
*y = ms_vtPickRayOrig.y + ms_vtPickRayDir.y * t;
|
||||
*z = ms_vtPickRayOrig.z + ms_vtPickRayDir.z * t;
|
||||
}
|
||||
|
||||
// 40250 GrpScreen.cpp:749-779.
|
||||
@@ -313,7 +362,7 @@ void CScreen::ProjectPosition(float x, float y, float z, float * pfX, float * pf
|
||||
{
|
||||
D3DXVECTOR3 Input(x, y, z);
|
||||
D3DXVECTOR3 Output;
|
||||
D3DXVec3Project(&Output, &Input, &ms_Viewport, &ms_matProj, &ms_matView, &ms_matWorld);
|
||||
D3DXVec3Project(&Output, &Input, &ms_Viewport, &ms_matProj, &ms_matView, &ms_matIdentity);
|
||||
|
||||
*pfX = Output.x;
|
||||
*pfY = Output.y;
|
||||
@@ -323,7 +372,7 @@ void CScreen::ProjectPosition(float x, float y, float z, float * pfX, float * pf
|
||||
{
|
||||
D3DXVECTOR3 Input(x, y, z);
|
||||
D3DXVECTOR3 Output;
|
||||
D3DXVec3Project(&Output, &Input, &ms_Viewport, &ms_matProj, &ms_matView, &ms_matWorld);
|
||||
D3DXVec3Project(&Output, &Input, &ms_Viewport, &ms_matProj, &ms_matView, &ms_matIdentity);
|
||||
|
||||
*pfX = Output.x;
|
||||
*pfY = Output.y;
|
||||
@@ -334,7 +383,7 @@ void CScreen::UnprojectPosition(float x, float y, float z, float * pfX, float *
|
||||
{
|
||||
D3DXVECTOR3 Input(x, y, z);
|
||||
D3DXVECTOR3 Output;
|
||||
D3DXVec3Unproject(&Output, &Input, &ms_Viewport, &ms_matProj, &ms_matView, &ms_matWorld);
|
||||
D3DXVec3Unproject(&Output, &Input, &ms_Viewport, &ms_matProj, &ms_matView, &ms_matIdentity);
|
||||
|
||||
*pfX = Output.x;
|
||||
*pfY = Output.y;
|
||||
@@ -355,12 +404,24 @@ auto CScreen::RestoreDevice() -> BOOL
|
||||
|
||||
auto CScreen::BuildViewFrustum() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
CCamera* pkCamera = CCameraManager::Instance().GetCurrentCamera();
|
||||
if (!pkCamera)
|
||||
return;
|
||||
const D3DXVECTOR3& c_rv3Eye = pkCamera->GetEye();
|
||||
const D3DXVECTOR3& c_rv3View = pkCamera->GetView();
|
||||
auto vv = ms_matView * ms_matProj;
|
||||
ms_frustum.BuildViewFrustum2(
|
||||
vv,
|
||||
ms_fNearY,
|
||||
ms_fFarY,
|
||||
ms_fFieldOfView,
|
||||
ms_fAspect,
|
||||
c_rv3Eye, c_rv3View);
|
||||
}
|
||||
|
||||
auto CScreen::Identity() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
STATEMANAGER.SetTransform(D3DTS_WORLD, &ms_matIdentity);
|
||||
}
|
||||
|
||||
decltype(CScreen::ms_diffuseColor) CScreen::ms_diffuseColor{};
|
||||
|
||||
Reference in New Issue
Block a user