2023-12-07 07:10:42 -05:00
|
|
|
|
2024-01-06 21:29:32 -05:00
|
|
|
#include "compat.h"
|
2023-12-11 16:33:46 -05:00
|
|
|
#include "decomp.h"
|
2024-01-08 04:58:49 -05:00
|
|
|
#include "tgl/tgl.h"
|
2023-12-07 07:10:42 -05:00
|
|
|
|
|
|
|
#include <d3drm.h>
|
|
|
|
|
|
|
|
// Forward declare D3D types
|
2024-01-05 14:38:34 -05:00
|
|
|
struct IDirect3DRM2;
|
|
|
|
struct IDirect3DRMDevice2;
|
2023-12-07 07:10:42 -05:00
|
|
|
struct IDirect3DRMViewport;
|
2024-01-05 14:38:34 -05:00
|
|
|
struct IDirect3DRMFrame2;
|
2023-12-07 07:10:42 -05:00
|
|
|
struct IDirect3DRMMesh;
|
|
|
|
struct IDirect3DRMMeshBuilder;
|
|
|
|
struct IDirect3DRMTexture;
|
|
|
|
|
|
|
|
namespace TglImpl
|
|
|
|
{
|
|
|
|
|
|
|
|
using namespace Tgl;
|
|
|
|
|
|
|
|
// Utility function used by implementations
|
|
|
|
inline Result ResultVal(HRESULT result)
|
|
|
|
{
|
|
|
|
return SUCCEEDED(result) ? Success : Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Forward declare implementations
|
|
|
|
class RendererImpl;
|
|
|
|
class DeviceImpl;
|
|
|
|
class ViewImpl;
|
|
|
|
class LightImpl;
|
|
|
|
class CameraImpl;
|
|
|
|
class GroupImpl;
|
|
|
|
class MeshImpl;
|
|
|
|
class TextureImpl;
|
2024-03-08 11:55:25 -05:00
|
|
|
class MeshBuilderImpl;
|
2023-12-07 07:10:42 -05:00
|
|
|
|
2024-01-14 16:28:46 -05:00
|
|
|
// VTABLE: LEGO1 0x100db910
|
2023-12-07 07:10:42 -05:00
|
|
|
class RendererImpl : public Renderer {
|
|
|
|
public:
|
|
|
|
RendererImpl() : m_data(0) {}
|
2024-02-01 15:42:10 -05:00
|
|
|
~RendererImpl() override { Destroy(); }
|
2023-12-07 07:10:42 -05:00
|
|
|
|
2024-02-01 15:42:10 -05:00
|
|
|
void* ImplementationDataPtr() override;
|
2023-12-07 07:10:42 -05:00
|
|
|
|
|
|
|
// vtable+0x08
|
2024-02-01 15:42:10 -05:00
|
|
|
Device* CreateDevice(const DeviceDirectDrawCreateData&) override;
|
|
|
|
Device* CreateDevice(const DeviceDirect3DCreateData&) override;
|
2023-12-07 07:10:42 -05:00
|
|
|
|
|
|
|
// vtable+0x10
|
2024-02-01 15:42:10 -05:00
|
|
|
View* CreateView(
|
2023-12-07 07:10:42 -05:00
|
|
|
const Device*,
|
|
|
|
const Camera*,
|
|
|
|
unsigned long x,
|
|
|
|
unsigned long y,
|
|
|
|
unsigned long width,
|
|
|
|
unsigned long height
|
2024-01-06 21:29:32 -05:00
|
|
|
) override;
|
2024-02-01 15:42:10 -05:00
|
|
|
Camera* CreateCamera() override;
|
|
|
|
Light* CreateLight(LightType, float r, float g, float b) override;
|
|
|
|
Group* CreateGroup(const Group* pParent) override;
|
2023-12-07 07:10:42 -05:00
|
|
|
|
|
|
|
// vtable+0x20
|
2024-03-08 11:55:25 -05:00
|
|
|
MeshBuilder* CreateMeshBuilder() override;
|
2024-02-01 15:42:10 -05:00
|
|
|
Texture* CreateTexture(
|
2023-12-07 07:10:42 -05:00
|
|
|
int width,
|
|
|
|
int height,
|
|
|
|
int bitsPerTexel,
|
|
|
|
const void* pTexels,
|
|
|
|
int pTexelsArePersistent,
|
|
|
|
int paletteEntryCount,
|
|
|
|
const PaletteEntry* pEntries
|
2024-01-06 21:29:32 -05:00
|
|
|
) override;
|
2024-02-01 15:42:10 -05:00
|
|
|
Texture* CreateTexture() override;
|
2024-01-20 18:04:46 -05:00
|
|
|
|
2024-02-01 15:42:10 -05:00
|
|
|
Result SetTextureDefaultShadeCount(unsigned long) override;
|
2023-12-07 07:10:42 -05:00
|
|
|
|
|
|
|
// vtable+0x30
|
2024-02-01 15:42:10 -05:00
|
|
|
Result SetTextureDefaultColorCount(unsigned long) override;
|
2023-12-07 07:10:42 -05:00
|
|
|
|
2024-02-22 16:59:44 -05:00
|
|
|
inline HRESULT CreateTextureFromSurface(LPDIRECTDRAWSURFACE pSurface, LPDIRECT3DRMTEXTURE2* pTexture2)
|
|
|
|
{
|
|
|
|
return m_data->CreateTextureFromSurface(pSurface, pTexture2);
|
|
|
|
}
|
|
|
|
|
2024-03-02 09:43:19 -05:00
|
|
|
inline IDirect3DRM2* ImplementationData() const { return m_data; }
|
|
|
|
|
2023-12-07 07:10:42 -05:00
|
|
|
public:
|
|
|
|
inline Result Create();
|
|
|
|
inline void Destroy();
|
|
|
|
|
|
|
|
private:
|
2024-01-05 14:38:34 -05:00
|
|
|
IDirect3DRM2* m_data;
|
2023-12-07 07:10:42 -05:00
|
|
|
};
|
|
|
|
|
2024-01-07 12:30:45 -05:00
|
|
|
extern IDirect3DRM2* g_pD3DRM;
|
|
|
|
|
|
|
|
inline void RendererDestroy(IDirect3DRM2* pRenderer)
|
|
|
|
{
|
|
|
|
int refCount = pRenderer->Release();
|
|
|
|
if (refCount <= 0) {
|
|
|
|
g_pD3DRM = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Inlined only
|
|
|
|
void RendererImpl::Destroy()
|
|
|
|
{
|
|
|
|
if (m_data) {
|
|
|
|
RendererDestroy(m_data);
|
|
|
|
m_data = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-14 16:28:46 -05:00
|
|
|
// VTABLE: LEGO1 0x100db988
|
2023-12-07 07:10:42 -05:00
|
|
|
class DeviceImpl : public Device {
|
|
|
|
public:
|
|
|
|
DeviceImpl() : m_data(0) {}
|
2024-02-01 15:42:10 -05:00
|
|
|
~DeviceImpl() override
|
2023-12-07 07:10:42 -05:00
|
|
|
{
|
|
|
|
if (m_data) {
|
|
|
|
m_data->Release();
|
|
|
|
m_data = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-02-01 15:42:10 -05:00
|
|
|
void* ImplementationDataPtr() override;
|
2023-12-07 07:10:42 -05:00
|
|
|
|
|
|
|
// vtable+0x08
|
2024-02-01 15:42:10 -05:00
|
|
|
unsigned long GetWidth() override;
|
|
|
|
unsigned long GetHeight() override;
|
2023-12-07 07:10:42 -05:00
|
|
|
|
|
|
|
// vtable+0x10
|
2024-02-01 15:42:10 -05:00
|
|
|
Result SetColorModel(ColorModel) override;
|
|
|
|
Result SetShadingModel(ShadingModel) override;
|
|
|
|
Result SetShadeCount(unsigned long) override;
|
|
|
|
Result SetDither(int) override;
|
2023-12-07 07:10:42 -05:00
|
|
|
|
|
|
|
// vtable+0x20
|
2024-02-01 15:42:10 -05:00
|
|
|
Result Update() override;
|
|
|
|
void InitFromD3DDevice(Device*) override;
|
|
|
|
void InitFromWindowsDevice(Device*) override;
|
2023-12-07 07:10:42 -05:00
|
|
|
|
2024-01-05 14:38:34 -05:00
|
|
|
inline IDirect3DRMDevice2* ImplementationData() const { return m_data; }
|
2023-12-07 07:10:42 -05:00
|
|
|
|
|
|
|
friend class RendererImpl;
|
|
|
|
|
|
|
|
private:
|
2024-01-05 14:38:34 -05:00
|
|
|
IDirect3DRMDevice2* m_data;
|
2023-12-07 07:10:42 -05:00
|
|
|
};
|
|
|
|
|
2024-01-14 16:28:46 -05:00
|
|
|
// VTABLE: LEGO1 0x100db9e8
|
2023-12-07 07:10:42 -05:00
|
|
|
class ViewImpl : public View {
|
|
|
|
public:
|
|
|
|
ViewImpl() : m_data(0) {}
|
2024-02-01 15:42:10 -05:00
|
|
|
~ViewImpl() override
|
2023-12-07 07:10:42 -05:00
|
|
|
{
|
|
|
|
if (m_data) {
|
|
|
|
m_data->Release();
|
|
|
|
m_data = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-02-01 15:42:10 -05:00
|
|
|
void* ImplementationDataPtr() override;
|
2023-12-07 07:10:42 -05:00
|
|
|
|
|
|
|
// vtable+0x08
|
2024-02-01 15:42:10 -05:00
|
|
|
Result Add(const Light*) override;
|
|
|
|
Result Remove(const Light*) override;
|
2023-12-07 07:10:42 -05:00
|
|
|
|
|
|
|
// vtable+0x10
|
2024-02-01 15:42:10 -05:00
|
|
|
Result SetCamera(const Camera*) override;
|
|
|
|
Result SetProjection(ProjectionType) override;
|
|
|
|
Result SetFrustrum(float frontClippingDistance, float backClippingDistance, float degrees) override;
|
|
|
|
Result SetBackgroundColor(float r, float g, float b) override;
|
2023-12-07 07:10:42 -05:00
|
|
|
|
|
|
|
// vtable+0x20
|
2024-02-01 15:42:10 -05:00
|
|
|
Result GetBackgroundColor(float* r, float* g, float* b) override;
|
|
|
|
Result Clear() override;
|
2024-02-16 10:28:20 -05:00
|
|
|
Result Render(const Group*) override;
|
2024-02-01 15:42:10 -05:00
|
|
|
Result ForceUpdate(unsigned long x, unsigned long y, unsigned long width, unsigned long height) override;
|
2023-12-07 07:10:42 -05:00
|
|
|
|
|
|
|
// vtable+0x30
|
2024-02-01 15:42:10 -05:00
|
|
|
Result TransformWorldToScreen(const float world[3], float screen[4]) override;
|
|
|
|
Result TransformScreenToWorld(const float screen[4], float world[3]) override;
|
|
|
|
Result Pick(
|
2023-12-07 07:10:42 -05:00
|
|
|
unsigned long x,
|
|
|
|
unsigned long y,
|
|
|
|
const Group** ppGroupsToPickFrom,
|
|
|
|
int groupsToPickFromCount,
|
|
|
|
const Group**& rppPickedGroups,
|
|
|
|
int& rPickedGroupCount
|
2024-02-01 15:42:10 -05:00
|
|
|
) override;
|
2023-12-07 07:10:42 -05:00
|
|
|
|
|
|
|
inline IDirect3DRMViewport* ImplementationData() const { return m_data; }
|
|
|
|
|
2024-01-05 14:38:34 -05:00
|
|
|
static Result ViewportCreateAppData(IDirect3DRM2*, IDirect3DRMViewport*, IDirect3DRMFrame2*);
|
2023-12-07 07:10:42 -05:00
|
|
|
|
|
|
|
friend class RendererImpl;
|
|
|
|
|
|
|
|
private:
|
|
|
|
IDirect3DRMViewport* m_data;
|
|
|
|
};
|
|
|
|
|
2024-01-14 16:28:46 -05:00
|
|
|
// VTABLE: LEGO1 0x100dbad8
|
2023-12-07 07:10:42 -05:00
|
|
|
class CameraImpl : public Camera {
|
|
|
|
public:
|
|
|
|
CameraImpl() : m_data(0) {}
|
2024-02-01 15:42:10 -05:00
|
|
|
~CameraImpl() override
|
2023-12-07 07:10:42 -05:00
|
|
|
{
|
|
|
|
if (m_data) {
|
|
|
|
m_data->Release();
|
|
|
|
m_data = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-02-01 15:42:10 -05:00
|
|
|
void* ImplementationDataPtr() override;
|
2023-12-07 07:10:42 -05:00
|
|
|
|
|
|
|
// vtable+0x08
|
2024-02-01 15:42:10 -05:00
|
|
|
Result SetTransformation(FloatMatrix4&) override;
|
2023-12-07 07:10:42 -05:00
|
|
|
|
2024-01-05 14:38:34 -05:00
|
|
|
inline IDirect3DRMFrame2* ImplementationData() const { return m_data; }
|
2023-12-07 07:10:42 -05:00
|
|
|
|
|
|
|
friend class RendererImpl;
|
|
|
|
|
|
|
|
private:
|
2024-01-05 14:38:34 -05:00
|
|
|
IDirect3DRMFrame2* m_data;
|
2023-12-07 07:10:42 -05:00
|
|
|
};
|
|
|
|
|
2024-01-14 16:28:46 -05:00
|
|
|
// VTABLE: LEGO1 0x100dbaf8
|
2023-12-07 07:10:42 -05:00
|
|
|
class LightImpl : public Light {
|
|
|
|
public:
|
|
|
|
LightImpl() : m_data(0) {}
|
2024-02-01 15:42:10 -05:00
|
|
|
~LightImpl() override
|
2023-12-07 07:10:42 -05:00
|
|
|
{
|
|
|
|
if (m_data) {
|
|
|
|
m_data->Release();
|
|
|
|
m_data = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-02-01 15:42:10 -05:00
|
|
|
void* ImplementationDataPtr() override;
|
2023-12-07 07:10:42 -05:00
|
|
|
|
|
|
|
// vtable+0x08
|
2024-02-01 15:42:10 -05:00
|
|
|
Result SetTransformation(FloatMatrix4&) override;
|
|
|
|
Result SetColor(float r, float g, float b) override;
|
2023-12-07 07:10:42 -05:00
|
|
|
|
2024-01-05 14:38:34 -05:00
|
|
|
inline IDirect3DRMFrame2* ImplementationData() const { return m_data; }
|
2023-12-07 07:10:42 -05:00
|
|
|
|
|
|
|
friend class RendererImpl;
|
|
|
|
|
|
|
|
private:
|
2024-01-05 14:38:34 -05:00
|
|
|
IDirect3DRMFrame2* m_data;
|
2023-12-07 07:10:42 -05:00
|
|
|
};
|
|
|
|
|
2024-01-14 16:28:46 -05:00
|
|
|
// VTABLE: LEGO1 0x100dbb88
|
2023-12-07 07:10:42 -05:00
|
|
|
class MeshImpl : public Mesh {
|
|
|
|
public:
|
|
|
|
MeshImpl() : m_data(0) {}
|
2024-02-01 15:42:10 -05:00
|
|
|
~MeshImpl() override
|
2023-12-07 07:10:42 -05:00
|
|
|
{
|
|
|
|
if (m_data) {
|
|
|
|
delete m_data;
|
|
|
|
m_data = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-02-01 15:42:10 -05:00
|
|
|
void* ImplementationDataPtr() override;
|
2023-12-07 07:10:42 -05:00
|
|
|
|
|
|
|
// vtable+0x08
|
2024-02-01 15:42:10 -05:00
|
|
|
Result SetColor(float r, float g, float b, float a) override;
|
|
|
|
Result SetTexture(const Texture*) override;
|
2023-12-07 07:10:42 -05:00
|
|
|
|
|
|
|
// vtable+0x10
|
2024-02-01 15:42:10 -05:00
|
|
|
Result GetTexture(Texture*&) override;
|
2024-03-08 11:55:25 -05:00
|
|
|
Result SetTextureMappingMode(TextureMappingMode) override;
|
2024-02-01 15:42:10 -05:00
|
|
|
Result SetShadingModel(ShadingModel) override;
|
2024-03-08 11:55:25 -05:00
|
|
|
Mesh* DeepClone(MeshBuilder*) override;
|
2023-12-07 07:10:42 -05:00
|
|
|
|
|
|
|
// vtable+0x20
|
2024-03-08 11:55:25 -05:00
|
|
|
Mesh* ShallowClone(MeshBuilder*) override;
|
2023-12-07 07:10:42 -05:00
|
|
|
|
|
|
|
struct MeshData {
|
|
|
|
IDirect3DRMMesh* groupMesh;
|
2024-03-07 14:57:17 -05:00
|
|
|
D3DRMGROUPINDEX groupIndex;
|
2023-12-07 07:10:42 -05:00
|
|
|
};
|
|
|
|
|
2024-03-08 11:55:25 -05:00
|
|
|
typedef MeshData* MeshDataType;
|
|
|
|
|
|
|
|
inline const MeshDataType& ImplementationData() const { return m_data; }
|
|
|
|
inline MeshDataType& ImplementationData() { return m_data; }
|
2023-12-07 07:10:42 -05:00
|
|
|
|
|
|
|
friend class RendererImpl;
|
|
|
|
|
|
|
|
private:
|
2024-03-08 11:55:25 -05:00
|
|
|
MeshDataType m_data;
|
2023-12-07 07:10:42 -05:00
|
|
|
};
|
|
|
|
|
2024-01-14 16:28:46 -05:00
|
|
|
// VTABLE: LEGO1 0x100dba68
|
2023-12-07 07:10:42 -05:00
|
|
|
class GroupImpl : public Group {
|
|
|
|
public:
|
|
|
|
GroupImpl() : m_data(0) {}
|
2024-02-01 15:42:10 -05:00
|
|
|
~GroupImpl() override
|
2023-12-07 07:10:42 -05:00
|
|
|
{
|
|
|
|
if (m_data) {
|
|
|
|
m_data->Release();
|
|
|
|
m_data = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-02-01 15:42:10 -05:00
|
|
|
void* ImplementationDataPtr() override;
|
2023-12-07 07:10:42 -05:00
|
|
|
|
|
|
|
// vtable+0x08
|
2024-02-01 15:42:10 -05:00
|
|
|
Result SetTransformation(FloatMatrix4&) override;
|
|
|
|
Result SetColor(float r, float g, float b, float a) override;
|
2023-12-07 07:10:42 -05:00
|
|
|
|
|
|
|
// vtable+0x10
|
2024-02-01 15:42:10 -05:00
|
|
|
Result SetTexture(const Texture*) override;
|
|
|
|
Result GetTexture(Texture*&) override;
|
|
|
|
Result SetMaterialMode(MaterialMode) override;
|
2024-03-04 16:57:35 -05:00
|
|
|
Result Add(const Group*) override;
|
2023-12-07 07:10:42 -05:00
|
|
|
|
|
|
|
// vtable+0x20
|
2024-03-09 23:12:15 -05:00
|
|
|
Result Add(const MeshBuilder*) override;
|
2024-02-01 15:42:10 -05:00
|
|
|
Result Remove(const Group*) override;
|
2024-03-08 11:55:25 -05:00
|
|
|
Result Remove(const MeshBuilder*) override;
|
2024-02-01 15:42:10 -05:00
|
|
|
Result RemoveAll() override;
|
2023-12-07 07:10:42 -05:00
|
|
|
|
|
|
|
// vtable+0x30
|
2024-02-01 15:42:10 -05:00
|
|
|
Result Unknown() override;
|
2023-12-07 07:10:42 -05:00
|
|
|
|
2024-02-16 10:28:20 -05:00
|
|
|
inline IDirect3DRMFrame2* ImplementationData() const { return m_data; }
|
|
|
|
|
2023-12-07 07:10:42 -05:00
|
|
|
friend class RendererImpl;
|
|
|
|
|
|
|
|
private:
|
2024-01-05 14:38:34 -05:00
|
|
|
IDirect3DRMFrame2* m_data;
|
2023-12-07 07:10:42 -05:00
|
|
|
};
|
|
|
|
|
2024-01-14 16:28:46 -05:00
|
|
|
// VTABLE: LEGO1 0x100dbb18
|
2024-03-08 11:55:25 -05:00
|
|
|
class MeshBuilderImpl : public MeshBuilder {
|
2023-12-07 07:10:42 -05:00
|
|
|
public:
|
2024-03-08 11:55:25 -05:00
|
|
|
MeshBuilderImpl() : m_data(0) {}
|
|
|
|
~MeshBuilderImpl() override
|
2023-12-07 07:10:42 -05:00
|
|
|
{
|
|
|
|
if (m_data) {
|
|
|
|
m_data->Release();
|
|
|
|
m_data = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-02-01 15:42:10 -05:00
|
|
|
void* ImplementationDataPtr() override;
|
2023-12-07 07:10:42 -05:00
|
|
|
|
|
|
|
// vtable+0x08
|
2024-03-08 11:55:25 -05:00
|
|
|
Mesh* CreateMesh(
|
2023-12-07 07:10:42 -05:00
|
|
|
unsigned long faceCount,
|
|
|
|
unsigned long vertexCount,
|
2024-03-07 14:57:17 -05:00
|
|
|
float (*pPositions)[3],
|
|
|
|
float (*pNormals)[3],
|
|
|
|
float (*pTextureCoordinates)[2],
|
|
|
|
unsigned long (*pFaceIndices)[3],
|
|
|
|
unsigned long (*pTextureIndices)[3],
|
2024-03-08 11:55:25 -05:00
|
|
|
ShadingModel shadingModel
|
2024-02-01 15:42:10 -05:00
|
|
|
) override;
|
|
|
|
Result GetBoundingBox(float min[3], float max[3]) override;
|
2023-12-07 07:10:42 -05:00
|
|
|
|
|
|
|
// vtable+0x10
|
2024-03-08 11:55:25 -05:00
|
|
|
MeshBuilder* Clone() override;
|
2023-12-07 07:10:42 -05:00
|
|
|
|
|
|
|
inline IDirect3DRMMesh* ImplementationData() const { return m_data; }
|
|
|
|
|
|
|
|
friend class RendererImpl;
|
|
|
|
|
|
|
|
private:
|
2024-03-08 11:55:25 -05:00
|
|
|
inline Result CreateMeshImpl(
|
|
|
|
MeshImpl* pMeshImpl,
|
|
|
|
unsigned long faceCount,
|
|
|
|
unsigned long vertexCount,
|
|
|
|
float (*pPositions)[3],
|
|
|
|
float (*pNormals)[3],
|
|
|
|
float (*pTextureCoordinates)[2],
|
|
|
|
unsigned long (*pFaceIndices)[3],
|
|
|
|
unsigned long (*pTextureIndices)[3],
|
|
|
|
ShadingModel shadingModel
|
|
|
|
);
|
|
|
|
|
2023-12-07 07:10:42 -05:00
|
|
|
IDirect3DRMMesh* m_data;
|
|
|
|
};
|
|
|
|
|
|
|
|
// No vtable, this is just a simple wrapper around D3DRMIMAGE
|
|
|
|
class TglD3DRMIMAGE {
|
|
|
|
public:
|
|
|
|
TglD3DRMIMAGE(
|
|
|
|
int width,
|
|
|
|
int height,
|
|
|
|
int depth,
|
|
|
|
void* pBuffer,
|
|
|
|
int useBuffer,
|
|
|
|
int paletteSize,
|
|
|
|
PaletteEntry* pEntries
|
|
|
|
);
|
|
|
|
~TglD3DRMIMAGE() { Destroy(); }
|
|
|
|
|
|
|
|
Result CreateBuffer(int width, int height, int depth, void* pBuffer, int useBuffer);
|
|
|
|
void Destroy();
|
|
|
|
void FillRowsOfTexture(int y, int height, char* content);
|
|
|
|
Result InitializePalette(int paletteSize, PaletteEntry* pEntries);
|
|
|
|
|
|
|
|
D3DRMIMAGE m_image;
|
|
|
|
int m_texelsAllocatedByClient;
|
|
|
|
};
|
|
|
|
|
2024-01-14 16:28:46 -05:00
|
|
|
// VTABLE: LEGO1 0x100dbb48
|
2023-12-07 07:10:42 -05:00
|
|
|
class TextureImpl : public Texture {
|
|
|
|
public:
|
|
|
|
TextureImpl() : m_data(0) {}
|
2024-02-01 15:42:10 -05:00
|
|
|
~TextureImpl() override
|
2023-12-07 07:10:42 -05:00
|
|
|
{
|
|
|
|
if (m_data) {
|
|
|
|
m_data->Release();
|
|
|
|
m_data = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-02-01 15:42:10 -05:00
|
|
|
void* ImplementationDataPtr() override;
|
2023-12-07 07:10:42 -05:00
|
|
|
|
|
|
|
// vtable+0x08
|
2024-02-01 15:42:10 -05:00
|
|
|
Result SetTexels(int width, int height, int bitsPerTexel, void* pTexels) override;
|
|
|
|
void FillRowsOfTexture(int y, int height, void* pBuffer) override;
|
2023-12-07 07:10:42 -05:00
|
|
|
|
|
|
|
// vtable+0x10
|
2024-02-01 15:42:10 -05:00
|
|
|
Result Changed(int texelsChanged, int paletteChanged) override;
|
|
|
|
Result GetBufferAndPalette(
|
2023-12-07 07:10:42 -05:00
|
|
|
int* pWidth,
|
|
|
|
int* pHeight,
|
|
|
|
int* pDepth,
|
|
|
|
void** ppBuffer,
|
|
|
|
int* ppPaletteSize,
|
|
|
|
PaletteEntry** ppPalette
|
2024-02-01 15:42:10 -05:00
|
|
|
) override;
|
|
|
|
Result SetPalette(int entryCount, PaletteEntry* entries) override;
|
2023-12-07 07:10:42 -05:00
|
|
|
|
|
|
|
inline IDirect3DRMTexture* ImplementationData() const { return m_data; }
|
|
|
|
inline void SetImplementation(IDirect3DRMTexture* pData) { m_data = pData; }
|
|
|
|
|
|
|
|
friend class RendererImpl;
|
|
|
|
|
|
|
|
static Result SetImage(IDirect3DRMTexture* pSelf, TglD3DRMIMAGE* pImage);
|
|
|
|
|
|
|
|
private:
|
|
|
|
IDirect3DRMTexture* m_data;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Translation helpers
|
|
|
|
inline D3DRMRENDERQUALITY Translate(ShadingModel tglShadingModel)
|
|
|
|
{
|
|
|
|
D3DRMRENDERQUALITY renderQuality;
|
|
|
|
|
|
|
|
switch (tglShadingModel) {
|
|
|
|
case Wireframe:
|
|
|
|
renderQuality = D3DRMRENDER_WIREFRAME;
|
|
|
|
break;
|
|
|
|
case UnlitFlat:
|
|
|
|
renderQuality = D3DRMRENDER_UNLITFLAT;
|
|
|
|
break;
|
|
|
|
case Flat:
|
|
|
|
renderQuality = D3DRMRENDER_FLAT;
|
|
|
|
break;
|
|
|
|
case Gouraud:
|
|
|
|
renderQuality = D3DRMRENDER_GOURAUD;
|
|
|
|
break;
|
|
|
|
case Phong:
|
|
|
|
renderQuality = D3DRMRENDER_PHONG;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
renderQuality = D3DRMRENDER_FLAT;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return renderQuality;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline D3DRMPROJECTIONTYPE Translate(ProjectionType tglProjectionType)
|
|
|
|
{
|
|
|
|
D3DRMPROJECTIONTYPE projectionType;
|
|
|
|
switch (tglProjectionType) {
|
|
|
|
case Perspective:
|
|
|
|
projectionType = D3DRMPROJECT_PERSPECTIVE;
|
|
|
|
break;
|
|
|
|
case Orthographic:
|
|
|
|
projectionType = D3DRMPROJECT_ORTHOGRAPHIC;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
projectionType = D3DRMPROJECT_PERSPECTIVE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return projectionType;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Yes this function serves no purpose, originally they intended it to
|
|
|
|
// convert from doubles to floats but ended up using floats throughout
|
|
|
|
// the software stack.
|
2024-01-12 19:34:38 -05:00
|
|
|
inline D3DRMMATRIX4D* Translate(FloatMatrix4& tglMatrix4x4, D3DRMMATRIX4D& rD3DRMMatrix4x4)
|
2023-12-07 07:10:42 -05:00
|
|
|
{
|
|
|
|
for (int i = 0; i < (sizeof(rD3DRMMatrix4x4) / sizeof(rD3DRMMatrix4x4[0])); i++) {
|
|
|
|
for (int j = 0; j < (sizeof(rD3DRMMatrix4x4[0]) / sizeof(rD3DRMMatrix4x4[0][0])); j++) {
|
|
|
|
rD3DRMMatrix4x4[i][j] = D3DVAL(tglMatrix4x4[i][j]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return &rD3DRMMatrix4x4;
|
|
|
|
}
|
|
|
|
|
2023-12-12 14:27:17 -05:00
|
|
|
// SYNTHETIC: LEGO1 0x100a16d0
|
|
|
|
// TglImpl::RendererImpl::`scalar deleting destructor'
|
|
|
|
|
|
|
|
// SYNTHETIC: LEGO1 0x100a22c0
|
|
|
|
// TglImpl::DeviceImpl::`scalar deleting destructor'
|
|
|
|
|
|
|
|
// SYNTHETIC: LEGO1 0x100a23a0
|
|
|
|
// TglImpl::ViewImpl::`scalar deleting destructor'
|
|
|
|
|
|
|
|
// SYNTHETIC: LEGO1 0x100a2480
|
|
|
|
// TglImpl::GroupImpl::`scalar deleting destructor'
|
|
|
|
|
|
|
|
// SYNTHETIC: LEGO1 0x100a2560
|
|
|
|
// TglImpl::CameraImpl::`scalar deleting destructor'
|
|
|
|
|
|
|
|
// SYNTHETIC: LEGO1 0x100a2640
|
|
|
|
// TglImpl::LightImpl::`scalar deleting destructor'
|
|
|
|
|
|
|
|
// SYNTHETIC: LEGO1 0x100a2720
|
2024-03-08 11:55:25 -05:00
|
|
|
// TglImpl::MeshBuilderImpl::`scalar deleting destructor'
|
2023-12-12 14:27:17 -05:00
|
|
|
|
|
|
|
// SYNTHETIC: LEGO1 0x100a2800
|
|
|
|
// TglImpl::TextureImpl::`scalar deleting destructor'
|
|
|
|
|
|
|
|
// SYNTHETIC: LEGO1 0x100a3d80
|
|
|
|
// TglImpl::MeshImpl::`scalar deleting destructor'
|
|
|
|
|
2023-12-07 07:10:42 -05:00
|
|
|
} /* namespace TglImpl */
|