mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-23 08:24:16 +00:00
RendererImpl, CameraImpl, LightImpl (#1525)
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
#include "impl.h"
|
#include "impl.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
using namespace TglImpl;
|
using namespace TglImpl;
|
||||||
|
|
||||||
DECOMP_SIZE_ASSERT(Camera, 0x04);
|
DECOMP_SIZE_ASSERT(Camera, 0x04);
|
||||||
@@ -12,8 +14,8 @@ void* CameraImpl::ImplementationDataPtr()
|
|||||||
return reinterpret_cast<void*>(&m_data);
|
return reinterpret_cast<void*>(&m_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100a3700
|
// FUNCTION: BETA10 0x1016f390
|
||||||
Result CameraImpl::SetTransformation(FloatMatrix4& matrix)
|
inline Result CameraSetTransformation(IDirect3DRMFrame2* pCamera, FloatMatrix4& matrix)
|
||||||
{
|
{
|
||||||
D3DRMMATRIX4D helper;
|
D3DRMMATRIX4D helper;
|
||||||
D3DRMMATRIX4D* pTransformation = Translate(matrix, helper);
|
D3DRMMATRIX4D* pTransformation = Translate(matrix, helper);
|
||||||
@@ -22,10 +24,23 @@ Result CameraImpl::SetTransformation(FloatMatrix4& matrix)
|
|||||||
Result result;
|
Result result;
|
||||||
Result result2;
|
Result result2;
|
||||||
|
|
||||||
result2 = ResultVal(m_data->GetPosition(0, &position));
|
result2 = ResultVal(pCamera->GetPosition(0, &position));
|
||||||
result = ResultVal(m_data->AddTransform(D3DRMCOMBINE_REPLACE, *pTransformation));
|
assert(Succeeded(result2));
|
||||||
// The did this second call just to assert on the return value
|
|
||||||
result2 = ResultVal(m_data->GetPosition(0, &position));
|
result = ResultVal(pCamera->AddTransform(D3DRMCOMBINE_REPLACE, *pTransformation));
|
||||||
|
assert(Succeeded(result));
|
||||||
|
|
||||||
|
result2 = ResultVal(pCamera->GetPosition(0, &position));
|
||||||
|
assert(Succeeded(result2));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FUNCTION: LEGO1 0x100a3700
|
||||||
|
// FUNCTION: BETA10 0x1016f330
|
||||||
|
Result CameraImpl::SetTransformation(FloatMatrix4& matrix)
|
||||||
|
{
|
||||||
|
assert(m_data);
|
||||||
|
|
||||||
|
return CameraSetTransformation(m_data, matrix);
|
||||||
|
}
|
||||||
|
@@ -108,6 +108,7 @@ public:
|
|||||||
inline Result Create();
|
inline Result Create();
|
||||||
inline void Destroy();
|
inline void Destroy();
|
||||||
inline Result CreateLight(LightType type, float r, float g, float b, LightImpl& rLight);
|
inline Result CreateLight(LightType type, float r, float g, float b, LightImpl& rLight);
|
||||||
|
inline Result CreateGroup(const GroupImpl* pParentGroup, GroupImpl& rpGroup);
|
||||||
inline Result CreateView(
|
inline Result CreateView(
|
||||||
const DeviceImpl& rDevice,
|
const DeviceImpl& rDevice,
|
||||||
const CameraImpl& rCamera,
|
const CameraImpl& rCamera,
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
#include "impl.h"
|
#include "impl.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
using namespace TglImpl;
|
using namespace TglImpl;
|
||||||
|
|
||||||
DECOMP_SIZE_ASSERT(Light, 0x04);
|
DECOMP_SIZE_ASSERT(Light, 0x04);
|
||||||
@@ -12,20 +14,43 @@ void* LightImpl::ImplementationDataPtr()
|
|||||||
return reinterpret_cast<void*>(&m_data);
|
return reinterpret_cast<void*>(&m_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100a3780
|
// FUNCTION: BETA10 0x1016f6e0
|
||||||
Result LightImpl::SetTransformation(FloatMatrix4& matrix)
|
inline Result LightSetTransformation(IDirect3DRMFrame2* pLight, FloatMatrix4& matrix)
|
||||||
{
|
{
|
||||||
D3DRMMATRIX4D helper;
|
D3DRMMATRIX4D helper;
|
||||||
D3DRMMATRIX4D* d3dMatrix = Translate(matrix, helper);
|
D3DRMMATRIX4D* d3dMatrix = Translate(matrix, helper);
|
||||||
return ResultVal(m_data->AddTransform(D3DRMCOMBINE_REPLACE, *d3dMatrix));
|
return ResultVal(pLight->AddTransform(D3DRMCOMBINE_REPLACE, *d3dMatrix));
|
||||||
|
}
|
||||||
|
|
||||||
|
// FUNCTION: LEGO1 0x100a3780
|
||||||
|
// FUNCTION: BETA10 0x1016f680
|
||||||
|
Result LightImpl::SetTransformation(FloatMatrix4& matrix)
|
||||||
|
{
|
||||||
|
assert(m_data);
|
||||||
|
|
||||||
|
return LightSetTransformation(m_data, matrix);
|
||||||
|
}
|
||||||
|
|
||||||
|
// FUNCTION: BETA10 0x1016f860
|
||||||
|
inline Result LightSetColor(IDirect3DRMFrame2* pLight, float r, float g, float b)
|
||||||
|
{
|
||||||
|
IDirect3DRMLightArray* lights;
|
||||||
|
IDirect3DRMLight* light;
|
||||||
|
Result result = ResultVal(pLight->GetLights(&lights));
|
||||||
|
assert(Succeeded(result));
|
||||||
|
assert(lights->GetSize() == 1);
|
||||||
|
|
||||||
|
result = ResultVal(lights->GetElement(0, &light));
|
||||||
|
assert(Succeeded(result));
|
||||||
|
|
||||||
|
return ResultVal(light->SetColorRGB(r, g, b));
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100a37e0
|
// FUNCTION: LEGO1 0x100a37e0
|
||||||
|
// FUNCTION: BETA10 0x1016f7f0
|
||||||
Result LightImpl::SetColor(float r, float g, float b)
|
Result LightImpl::SetColor(float r, float g, float b)
|
||||||
{
|
{
|
||||||
IDirect3DRMLightArray* lightArray;
|
assert(m_data);
|
||||||
IDirect3DRMLight* light;
|
|
||||||
m_data->GetLights(&lightArray);
|
return LightSetColor(m_data, r, g, b);
|
||||||
lightArray->GetElement(0, &light);
|
|
||||||
return ResultVal(light->SetColorRGB(r, g, b));
|
|
||||||
}
|
}
|
||||||
|
@@ -218,11 +218,16 @@ View* RendererImpl::CreateView(
|
|||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Result RendererCreateGroup(IDirect3DRM2* pRenderer, IDirect3DRMFrame2* pParent, IDirect3DRMFrame2*& rpGroup)
|
// FUNCTION: BETA10 0x1016d380
|
||||||
|
inline Result RendererCreateGroup(
|
||||||
|
IDirect3DRM2* pRenderer,
|
||||||
|
const IDirect3DRMFrame2* pParent,
|
||||||
|
IDirect3DRMFrame2*& rpGroup
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Result result = ResultVal(pRenderer->CreateFrame(NULL, &rpGroup));
|
Result result = ResultVal(pRenderer->CreateFrame(NULL, &rpGroup));
|
||||||
if (Succeeded(result) && pParent) {
|
if (Succeeded(result) && pParent) {
|
||||||
result = ResultVal(pParent->AddVisual(rpGroup));
|
result = ResultVal(const_cast<IDirect3DRMFrame2*>(pParent)->AddVisual(rpGroup));
|
||||||
if (!Succeeded(result)) {
|
if (!Succeeded(result)) {
|
||||||
rpGroup->Release();
|
rpGroup->Release();
|
||||||
rpGroup = NULL;
|
rpGroup = NULL;
|
||||||
@@ -231,13 +236,28 @@ inline Result RendererCreateGroup(IDirect3DRM2* pRenderer, IDirect3DRMFrame2* pP
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FUNCTION: BETA10 0x1016d280
|
||||||
|
inline Result RendererImpl::CreateGroup(const GroupImpl* pParentGroup, GroupImpl& rGroup)
|
||||||
|
{
|
||||||
|
assert(m_data);
|
||||||
|
assert(!pParentGroup || pParentGroup->ImplementationData());
|
||||||
|
assert(!rGroup.ImplementationData());
|
||||||
|
|
||||||
|
return RendererCreateGroup(
|
||||||
|
m_data,
|
||||||
|
pParentGroup ? pParentGroup->ImplementationData() : NULL,
|
||||||
|
rGroup.ImplementationData()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100a1b20
|
// FUNCTION: LEGO1 0x100a1b20
|
||||||
|
// FUNCTION: BETA10 0x1016a130
|
||||||
Group* RendererImpl::CreateGroup(const Group* pParent)
|
Group* RendererImpl::CreateGroup(const Group* pParent)
|
||||||
{
|
{
|
||||||
|
assert(m_data);
|
||||||
|
|
||||||
GroupImpl* group = new GroupImpl();
|
GroupImpl* group = new GroupImpl();
|
||||||
Result result =
|
if (!CreateGroup(static_cast<const GroupImpl*>(pParent), *group)) {
|
||||||
RendererCreateGroup(m_data, pParent ? static_cast<const GroupImpl*>(pParent)->m_data : NULL, group->m_data);
|
|
||||||
if (!result) {
|
|
||||||
delete group;
|
delete group;
|
||||||
group = NULL;
|
group = NULL;
|
||||||
}
|
}
|
||||||
@@ -511,16 +531,34 @@ Texture* RendererImpl::CreateTexture()
|
|||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FUNCTION: BETA10 0x1016af90
|
||||||
|
inline Result RendererSetTextureDefaultShadeCount(IDirect3DRM2* pRenderer, unsigned long shadeCount)
|
||||||
|
{
|
||||||
|
return ResultVal(pRenderer->SetDefaultTextureShades(shadeCount));
|
||||||
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100a2270
|
// FUNCTION: LEGO1 0x100a2270
|
||||||
|
// FUNCTION: BETA10 0x1016af30
|
||||||
Result RendererImpl::SetTextureDefaultShadeCount(unsigned long shadeCount)
|
Result RendererImpl::SetTextureDefaultShadeCount(unsigned long shadeCount)
|
||||||
{
|
{
|
||||||
return ResultVal(m_data->SetDefaultTextureShades(shadeCount));
|
assert(m_data);
|
||||||
|
|
||||||
|
return RendererSetTextureDefaultShadeCount(m_data, shadeCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
// FUNCTION: BETA10 0x1016b020
|
||||||
|
inline Result RendererSetTextureDefaultColorCount(IDirect3DRM2* pRenderer, unsigned long colorCount)
|
||||||
|
{
|
||||||
|
return ResultVal(pRenderer->SetDefaultTextureColors(colorCount));
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100a2290
|
// FUNCTION: LEGO1 0x100a2290
|
||||||
|
// FUNCTION: BETA10 0x1016afc0
|
||||||
Result RendererImpl::SetTextureDefaultColorCount(unsigned long colorCount)
|
Result RendererImpl::SetTextureDefaultColorCount(unsigned long colorCount)
|
||||||
{
|
{
|
||||||
return ResultVal(m_data->SetDefaultTextureColors(colorCount));
|
assert(m_data);
|
||||||
|
|
||||||
|
return RendererSetTextureDefaultColorCount(m_data, colorCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100a22b0
|
// FUNCTION: LEGO1 0x100a22b0
|
||||||
|
Reference in New Issue
Block a user