Beta addrs for TglSurface and related (#905)

This commit is contained in:
MS 2024-05-11 12:27:06 -04:00 committed by GitHub
parent f442f1a2f7
commit b3d6319656
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 55 additions and 6 deletions

View File

@ -26,6 +26,7 @@ float g_ambientLightRGB = 0.3;
// LegoView
// FUNCTION: LEGO1 0x100ab510
// FUNCTION: BETA10 0x1017bb90
LegoView::LegoView()
{
m_pScene = 0;
@ -33,18 +34,17 @@ LegoView::LegoView()
}
// FUNCTION: LEGO1 0x100ab5a0
// FUNCTION: BETA10 0x1017bc19
LegoView::~LegoView()
{
Destroy();
}
// FUNCTION: LEGO1 0x100ab600
// FUNCTION: BETA10 0x1017bc89
BOOL LegoView::Create(const TglSurface::CreateStruct& rCreateStruct, Tgl::Renderer* pRenderer)
{
float viewAngle = 45;
if (rCreateStruct.m_isWideViewAngle) {
viewAngle = 90;
}
float frontClippingDistance = 0.1;
float backClippingDistance = 500;
@ -53,6 +53,10 @@ BOOL LegoView::Create(const TglSurface::CreateStruct& rCreateStruct, Tgl::Render
assert(!m_pCamera);
assert(pRenderer);
if (rCreateStruct.m_isWideViewAngle) {
viewAngle = 90;
}
m_pScene = pRenderer->CreateGroup();
assert(m_pScene);
// TglSurface::Create() calls CreateView(), and we need the camera in
@ -78,6 +82,7 @@ BOOL LegoView::Create(const TglSurface::CreateStruct& rCreateStruct, Tgl::Render
}
// FUNCTION: LEGO1 0x100ab6c0
// FUNCTION: BETA10 0x1017befd
Tgl::View* LegoView::CreateView(Tgl::Renderer* pRenderer, Tgl::Device* pDevice)
{
assert(pRenderer);
@ -87,6 +92,7 @@ Tgl::View* LegoView::CreateView(Tgl::Renderer* pRenderer, Tgl::Device* pDevice)
}
// FUNCTION: LEGO1 0x100ab6f0
// FUNCTION: BETA10 0x1017bf96
void LegoView::Destroy()
{
delete m_pScene;
@ -102,6 +108,7 @@ void LegoView::Destroy()
// LegoView1
// FUNCTION: LEGO1 0x100ab730
// FUNCTION: BETA10 0x1017c028
LegoView1::LegoView1()
{
m_pSunLight = 0;
@ -110,14 +117,17 @@ LegoView1::LegoView1()
}
// FUNCTION: LEGO1 0x100ab7c0
// FUNCTION: BETA10 0x1017c0be
LegoView1::~LegoView1()
{
Destroy();
}
// FUNCTION: LEGO1 0x100ab820
// FUNCTION: BETA10 0x1017c12e
BOOL LegoView1::AddLightsToViewport()
{
assert(GetView());
GetView()->Add(m_pSunLight);
GetView()->Add(m_pDirectionalLight);
GetView()->Add(m_pAmbientLight);
@ -125,6 +135,7 @@ BOOL LegoView1::AddLightsToViewport()
}
// FUNCTION: LEGO1 0x100ab860
// FUNCTION: BETA10 0x1017c1ea
BOOL LegoView1::Create(const TglSurface::CreateStruct& rCreateStruct, Tgl::Renderer* pRenderer)
{
if (!LegoView::Create(rCreateStruct, pRenderer)) {
@ -154,12 +165,13 @@ BOOL LegoView1::Create(const TglSurface::CreateStruct& rCreateStruct, Tgl::Rende
SETMAT4(in, transform);
m_pSunLight->SetTransformation(matrix);
assert(GetView());
// assert(GetView());
return AddLightsToViewport();
}
// FUNCTION: LEGO1 0x100abad0
// FUNCTION: BETA10 0x1017c912
void LegoView1::Destroy()
{
if (m_pSunLight) {
@ -184,6 +196,7 @@ void LegoView1::Destroy()
}
// FUNCTION: LEGO1 0x100abb60
// FUNCTION: BETA10 0x1017ca80
void LegoView1::SetLightTransform(BOOL bDirectionalLight, Tgl::FloatMatrix4& rMatrix)
{
Tgl::Light* pLight;
@ -199,12 +212,14 @@ void LegoView1::SetLightTransform(BOOL bDirectionalLight, Tgl::FloatMatrix4& rMa
}
// FUNCTION: LEGO1 0x100abb80
// FUNCTION: BETA10 0x1017cacf
void LegoView1::SetLightTransform(Tgl::Light* pLight, Tgl::FloatMatrix4& rMatrix)
{
pLight->SetTransformation(rMatrix);
}
// FUNCTION: LEGO1 0x100abba0
// FUNCTION: BETA10 0x1017caf6
void LegoView1::SetLightColor(BOOL bDirectionalLight, float red, float green, float blue)
{
Tgl::Light* pLight;
@ -220,6 +235,7 @@ void LegoView1::SetLightColor(BOOL bDirectionalLight, float red, float green, fl
}
// FUNCTION: LEGO1 0x100abbd0
// FUNCTION: BETA10 0x1017cb4d
void LegoView1::SetLightColor(Tgl::Light* pLight, float red, float green, float blue)
{
pLight->SetColor(red, green, blue);

View File

@ -15,6 +15,7 @@ class Light;
// LegoView
// VTABLE: LEGO1 0x100dc000
// VTABLE: BETA10 0x101c3578
// SIZE 0x78
class LegoView : public TglSurface {
public:
@ -49,12 +50,14 @@ inline Tgl::Camera* LegoView::GetCamera() const
}
// SYNTHETIC: LEGO1 0x100ab580
// SYNTHETIC: BETA10 0x1017cb80
// LegoView::`scalar deleting destructor'
/////////////////////////////////////////////////////////////////////////////
// LegoView1
// VTABLE: LEGO1 0x100dc018
// VTABLE: BETA10 0x101c3590
// SIZE 0x88
class LegoView1 : public LegoView {
public:
@ -78,6 +81,7 @@ private:
};
// SYNTHETIC: LEGO1 0x100ab7a0
// SYNTHETIC: BETA10 0x1017cc00
// LegoView1::`scalar deleting destructor'
#endif /* _LegoView1_h */

View File

@ -12,6 +12,7 @@ using namespace Tgl;
// TglSurface
// FUNCTION: LEGO1 0x100abbf0
// FUNCTION: BETA10 0x1017d490
TglSurface::TglSurface()
{
m_pRenderer = 0;
@ -33,12 +34,14 @@ TglSurface::TglSurface()
}
// FUNCTION: LEGO1 0x100abd60
// FUNCTION: BETA10 0x1017d5a2
TglSurface::~TglSurface()
{
Destroy();
}
// FUNCTION: LEGO1 0x100abde0
// FUNCTION: BETA10 0x1017d647
void TglSurface::Destroy()
{
DestroyView();
@ -52,6 +55,7 @@ void TglSurface::Destroy()
// ???
// FUNCTION: LEGO1 0x100abe10
// FUNCTION: BETA10 0x1017d6b0
int GetBitsPerPixel(IDirectDrawSurface* pSurface)
{
DDPIXELFORMAT pixelFormat;
@ -68,6 +72,7 @@ int GetBitsPerPixel(IDirectDrawSurface* pSurface)
}
// FUNCTION: LEGO1 0x100abe50
// FUNCTION: BETA10 0x1017d742
BOOL TglSurface::Create(const CreateStruct& rCreateStruct, Renderer* pRenderer, Group* pScene)
{
DeviceDirect3DCreateData createData = {rCreateStruct.m_direct3d, rCreateStruct.m_d3dDevice};
@ -97,15 +102,16 @@ BOOL TglSurface::Create(const CreateStruct& rCreateStruct, Renderer* pRenderer,
textureShadeCount = 4;
}
else if (bitsPerPixel == 8) {
shadeCount = 32;
shadeCount = 16;
dither = FALSE;
textureShadeCount = 16;
textureShadeCount = shadeCount;
textureColorCount = 256;
}
else if (bitsPerPixel == 16) {
shadeCount = 32;
dither = FALSE;
textureShadeCount = 32;
textureShadeCount = shadeCount;
textureColorCount = 256;
}
else if (bitsPerPixel >= 24) {
@ -161,6 +167,7 @@ BOOL TglSurface::Create(const CreateStruct& rCreateStruct, Renderer* pRenderer,
}
// FUNCTION: LEGO1 0x100ac030
// FUNCTION: BETA10 0x1017db86
void TglSurface::DestroyView()
{
delete m_pView;
@ -168,6 +175,7 @@ void TglSurface::DestroyView()
}
// FUNCTION: LEGO1 0x100ac050
// FUNCTION: BETA10 0x1017dbd0
double TglSurface::Render()
{
MxStopWatch renderTimer;

View File

@ -16,6 +16,7 @@ class Group;
// TglSurface
// VTABLE: LEGO1 0x100dc060
// VTABLE: BETA10 0x101c3648
// SIZE 0x70
class TglSurface {
public:
@ -43,10 +44,15 @@ public:
Tgl::Renderer* GetRenderer() const { return m_pRenderer; }
Tgl::Device* GetDevice() const { return m_pDevice; }
// FUNCTION: BETA10 0x100d5570
Tgl::View* GetView() const { return m_pView; }
Tgl::Group* GetScene() const { return m_pScene; }
// FUNCTION: BETA10 0x1017cbc0
unsigned long GetWidth() const { return m_width; }
// FUNCTION: BETA10 0x1017cbe0
unsigned long GetHeight() const { return m_height; }
double GetRenderingRate() const { return m_renderingRateMeter.Frequency(); }
@ -85,6 +91,7 @@ private:
/////////////////////////////////////////////////////////////////////////////
// SYNTHETIC: LEGO1 0x100abcf0
// SYNTHETIC: BETA10 0x1017de00
// TglSurface::`scalar deleting destructor'
#endif /* _TglSurface_h */

View File

@ -39,17 +39,20 @@ private:
unsigned long m_ticksPerSeconds; // 0x14
};
// FUNCTION: BETA10 0x100d8ba0
inline MxStopWatch::MxStopWatch()
{
Reset();
m_ticksPerSeconds = TicksPerSeconds();
}
// FUNCTION: BETA10 0x100d8be0
inline void MxStopWatch::Start()
{
QueryPerformanceCounter(&m_startTick);
}
// FUNCTION: BETA10 0x100d8f50
inline void MxStopWatch::Stop()
{
LARGE_INTEGER endTick;
@ -67,6 +70,7 @@ inline void MxStopWatch::Stop()
}
}
// FUNCTION: BETA10 0x100d8c10
inline void MxStopWatch::Reset()
{
m_startTick.LowPart = 0;
@ -74,6 +78,7 @@ inline void MxStopWatch::Reset()
m_elapsedSeconds = 0;
}
// FUNCTION: BETA10 0x100d8c60
inline unsigned long MxStopWatch::TicksPerSeconds() const
{
LARGE_INTEGER ticksPerSeconds;
@ -93,12 +98,14 @@ inline unsigned long MxStopWatch::TicksPerSeconds() const
}
}
// FUNCTION: BETA10 0x100d9020
inline double MxStopWatch::ElapsedSeconds() const
{
return m_elapsedSeconds;
}
// SYNTHETIC: LEGO1 0x100a6fc0
// SYNTHETIC: BETA10 0x100d8e70
// MxStopWatch::~MxStopWatch
//////////////////////////////////////////////////////////////////////////////
@ -131,15 +138,18 @@ private:
// MxFrequencyMeter implementation
//
// FUNCTION: BETA10 0x1017dd80
inline MxFrequencyMeter::MxFrequencyMeter() : m_operationCount(0)
{
}
// FUNCTION: BETA10 0x1017deb0
inline void MxFrequencyMeter::StartOperation()
{
m_stopWatch.Start();
}
// FUNCTION: BETA10 0x1017df10
inline void MxFrequencyMeter::EndOperation()
{
m_stopWatch.Stop();
@ -165,6 +175,7 @@ inline double MxFrequencyMeter::Frequency() const
}
}
// FUNCTION: BETA10 0x1017dee0
inline void MxFrequencyMeter::Reset()
{
m_stopWatch.Reset();
@ -176,17 +187,20 @@ inline unsigned long MxFrequencyMeter::OperationCount() const
return m_operationCount;
}
// FUNCTION: BETA10 0x1017df40
inline void MxFrequencyMeter::IncreaseOperationCount(unsigned long delta)
{
m_operationCount += delta;
}
// FUNCTION: BETA10 0x1017df60
inline double MxFrequencyMeter::ElapsedSeconds() const
{
return m_stopWatch.ElapsedSeconds();
}
// SYNTHETIC: LEGO1 0x100abd10
// SYNTHETIC: BETA10 0x1017de40
// MxFrequencyMeter::~MxFrequencyMeter
#endif /* _MxStopWatch_h */