port 2V2-d.2: Granny runtime on libgr2, main character model animates
Implement the Granny SDK 2.11 API the client uses on top of libgr2 (platform/EterGrnLib/GrannyRuntime.cpp, shim granny.h declared from the SDK header): file sections, type-definition vertex conversion, material textures by Usage, mesh/bone bindings, deformer, control clock/loop/ease and weighted SRT sampling. Port EterGrnLib (LODController, Material, Mesh, Model, ModelInstance*, Motion, Thing, ThingInstance, Util) plus EterLib GrpObjectInstance/GrpCollisionObject/CollisionData verbatim and drop their platform skeletons and pending stand-ins; register the gr2 resource factory; vertex/index buffers are CPU-side until the 2V2-e render adapter. app.UpdateGame/RenderGame now run 40250's bodies, reaching the CPythonApplication members through their singletons (the platform has no app object); CPythonGraphic joins GameSingletons in member order, and GetMousePosition reads the host cursor. port.login_flow asserts the main instance's PART_MAIN model has meshes, its diffuse image loaded and the WAIT motion moves the bones between frames; offline and live pass, port_gate macos PASS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
5266b00c6e
commit
668f48d6ec
@@ -0,0 +1,47 @@
|
||||
#pragma once
|
||||
// CPU-memory vertex/index buffers behind the D3D8 buffer handles. 40250 fills its buffers through
|
||||
// Lock/Unlock (CGrannyModel::__LoadVertices, CGrannyModelInstance deform) and the renderer later reads
|
||||
// them back, so the platform keeps the bytes in memory instead of creating device objects.
|
||||
#include "EterLib/StdAfx.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
struct MtCpuVertexBuffer : IDirect3DVertexBuffer8
|
||||
{
|
||||
std::vector<uint8_t> bytes;
|
||||
DWORD fvf = 0;
|
||||
};
|
||||
|
||||
struct MtCpuIndexBuffer : IDirect3DIndexBuffer8
|
||||
{
|
||||
std::vector<uint8_t> bytes;
|
||||
D3DFORMAT format = D3DFMT_INDEX16;
|
||||
};
|
||||
|
||||
// D3DXGetFVFVertexSize.
|
||||
inline unsigned mt_fvf_vertex_size(DWORD fvf)
|
||||
{
|
||||
unsigned size = 0;
|
||||
switch (fvf & D3DFVF_POSITION_MASK)
|
||||
{
|
||||
case D3DFVF_XYZ: size += 12; break;
|
||||
case D3DFVF_XYZRHW: size += 16; break;
|
||||
case D3DFVF_XYZB1: size += 16; break;
|
||||
case D3DFVF_XYZB2: size += 20; break;
|
||||
case D3DFVF_XYZB3: size += 24; break;
|
||||
case D3DFVF_XYZB4: size += 28; break;
|
||||
case D3DFVF_XYZB5: size += 32; break;
|
||||
}
|
||||
if (fvf & D3DFVF_NORMAL) size += 12;
|
||||
if (fvf & D3DFVF_PSIZE) size += 4;
|
||||
if (fvf & D3DFVF_DIFFUSE) size += 4;
|
||||
if (fvf & D3DFVF_SPECULAR) size += 4;
|
||||
const unsigned texCount = (fvf & D3DFVF_TEXCOUNT_MASK) >> D3DFVF_TEXCOUNT_SHIFT;
|
||||
for (unsigned i = 0; i < texCount; ++i)
|
||||
{
|
||||
static const unsigned coordSize[4] = { 8, 12, 16, 4 };
|
||||
size += coordSize[(fvf >> (16 + i * 2)) & 3];
|
||||
}
|
||||
return size;
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
// Platform skeleton for EterLib/GrpCollisionObject.h (40250 EterLib/GrpCollisionObject.cpp), generated by platform_stub.py.
|
||||
// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation.
|
||||
#include "EterLib/StdAfx.h"
|
||||
#include "EterLib/GrpCollisionObject.h"
|
||||
|
||||
#include "../PlatformStub.h"
|
||||
|
||||
CGraphicCollisionObject::CGraphicCollisionObject()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CGraphicCollisionObject::~CGraphicCollisionObject()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicCollisionObject::IntersectTriangle(const D3DXVECTOR3 &, const D3DXVECTOR3 &, const D3DXVECTOR3 &, const D3DXVECTOR3 &, const D3DXVECTOR3 &, float *, float *, float *) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CGraphicCollisionObject::IntersectBoundBox(const D3DXMATRIX *, const TBoundBox &, float *, float *, float *) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CGraphicCollisionObject::IntersectCube(const D3DXMATRIX *, float, float, float, float, float, float, D3DXVECTOR3 &, D3DXVECTOR3 &, float *, float *, float *) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CGraphicCollisionObject::IntersectIndexedMesh(const D3DXMATRIX *, const void *, int, int, const void *, int, D3DXVECTOR3 &, D3DXVECTOR3 &, float *, float *, float *) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CGraphicCollisionObject::IntersectMesh(const D3DXMATRIX *, const void *, DWORD, DWORD, D3DXVECTOR3 &, D3DXVECTOR3 &, float *, float *, float *) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CGraphicCollisionObject::IntersectSphere(const D3DXVECTOR3 &, float, const D3DXVECTOR3 &, const D3DXVECTOR3 &) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CGraphicCollisionObject::IntersectCylinder(const D3DXVECTOR3 &, float, float, const D3DXVECTOR3 &, const D3DXVECTOR3 &) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CGraphicCollisionObject::IntersectSphere(const D3DXVECTOR3 &, float) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CGraphicCollisionObject::IntersectCylinder(const D3DXVECTOR3 &, float, float) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
@@ -1,88 +1,126 @@
|
||||
// Platform skeleton for EterLib/GrpIndexBuffer.h (40250 EterLib/GrpIndexBuffer.cpp), generated by platform_stub.py.
|
||||
// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation.
|
||||
// 40250 EterLib/GrpIndexBuffer.cpp over CPU memory (CpuBuffer.h).
|
||||
#include "EterLib/StdAfx.h"
|
||||
#include "EterLib/GrpIndexBuffer.h"
|
||||
#include "EterLib/StateManager.h"
|
||||
|
||||
#include "../PlatformStub.h"
|
||||
#include "CpuBuffer.h"
|
||||
|
||||
namespace {
|
||||
BYTE* index_bytes(LPDIRECT3DINDEXBUFFER8 buffer)
|
||||
{
|
||||
return static_cast<MtCpuIndexBuffer*>(buffer)->bytes.data();
|
||||
}
|
||||
}
|
||||
|
||||
LPDIRECT3DINDEXBUFFER8 CGraphicIndexBuffer::GetD3DIndexBuffer() const
|
||||
{
|
||||
assert(m_lpd3dIdxBuf!=NULL);
|
||||
return m_lpd3dIdxBuf;
|
||||
}
|
||||
|
||||
void CGraphicIndexBuffer::SetIndices(int startIndex) const
|
||||
{
|
||||
STATEMANAGER.SetIndices(m_lpd3dIdxBuf, startIndex);
|
||||
}
|
||||
|
||||
bool CGraphicIndexBuffer::Lock(void** pretIndices) const
|
||||
{
|
||||
assert(m_lpd3dIdxBuf!=NULL);
|
||||
|
||||
*pretIndices = index_bytes(m_lpd3dIdxBuf);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CGraphicIndexBuffer::Unlock() const
|
||||
{
|
||||
assert(m_lpd3dIdxBuf!=NULL);
|
||||
}
|
||||
|
||||
bool CGraphicIndexBuffer::Lock(void** pretIndices)
|
||||
{
|
||||
assert(m_lpd3dIdxBuf!=NULL);
|
||||
|
||||
*pretIndices = index_bytes(m_lpd3dIdxBuf);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CGraphicIndexBuffer::Unlock()
|
||||
{
|
||||
assert(m_lpd3dIdxBuf!=NULL);
|
||||
}
|
||||
|
||||
bool CGraphicIndexBuffer::Copy(int bufSize, const void* srcIndices)
|
||||
{
|
||||
assert(m_lpd3dIdxBuf!=NULL);
|
||||
|
||||
memcpy(index_bytes(m_lpd3dIdxBuf), srcIndices, bufSize);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CGraphicIndexBuffer::Create(int faceCount, TFace* faces)
|
||||
{
|
||||
int idxCount = faceCount * 3;
|
||||
m_iidxCount = idxCount;
|
||||
if (!Create(idxCount, D3DFMT_INDEX16))
|
||||
return false;
|
||||
|
||||
WORD* dstIndices = reinterpret_cast<WORD*>(index_bytes(m_lpd3dIdxBuf));
|
||||
|
||||
for (int i = 0; i<faceCount; ++i, dstIndices+=3)
|
||||
{
|
||||
TFace * curFace=faces+i;
|
||||
dstIndices[0]=curFace->indices[0];
|
||||
dstIndices[1]=curFace->indices[1];
|
||||
dstIndices[2]=curFace->indices[2];
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CGraphicIndexBuffer::CreateDeviceObjects()
|
||||
{
|
||||
MtCpuIndexBuffer* buffer = new MtCpuIndexBuffer;
|
||||
buffer->bytes.assign(m_dwBufferSize, 0);
|
||||
buffer->format = m_d3dFmt;
|
||||
m_lpd3dIdxBuf = buffer;
|
||||
return true;
|
||||
}
|
||||
|
||||
void CGraphicIndexBuffer::DestroyDeviceObjects()
|
||||
{
|
||||
delete static_cast<MtCpuIndexBuffer*>(m_lpd3dIdxBuf);
|
||||
m_lpd3dIdxBuf = NULL;
|
||||
}
|
||||
|
||||
bool CGraphicIndexBuffer::Create(int idxCount, D3DFORMAT d3dFmt)
|
||||
{
|
||||
Destroy();
|
||||
|
||||
m_iidxCount = idxCount;
|
||||
m_dwBufferSize = sizeof(WORD) * idxCount;
|
||||
m_d3dFmt = d3dFmt;
|
||||
|
||||
return CreateDeviceObjects();
|
||||
}
|
||||
|
||||
void CGraphicIndexBuffer::Destroy()
|
||||
{
|
||||
DestroyDeviceObjects();
|
||||
}
|
||||
|
||||
void CGraphicIndexBuffer::Initialize()
|
||||
{
|
||||
m_lpd3dIdxBuf=NULL;
|
||||
m_iidxCount=0;
|
||||
m_dwBufferSize=0;
|
||||
}
|
||||
|
||||
CGraphicIndexBuffer::CGraphicIndexBuffer()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
Initialize();
|
||||
}
|
||||
|
||||
CGraphicIndexBuffer::~CGraphicIndexBuffer()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicIndexBuffer::Destroy() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicIndexBuffer::Create(int, D3DFORMAT) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CGraphicIndexBuffer::Create(int, TFace *) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CGraphicIndexBuffer::CreateDeviceObjects() -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CGraphicIndexBuffer::DestroyDeviceObjects() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicIndexBuffer::Copy(int, const void *) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CGraphicIndexBuffer::Lock(void **) const -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CGraphicIndexBuffer::Unlock() const -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicIndexBuffer::Lock(void **) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CGraphicIndexBuffer::Unlock() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicIndexBuffer::SetIndices(int) const -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicIndexBuffer::GetD3DIndexBuffer() const -> LPDIRECT3DINDEXBUFFER8
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<LPDIRECT3DINDEXBUFFER8>();
|
||||
}
|
||||
|
||||
auto CGraphicIndexBuffer::Initialize() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
Destroy();
|
||||
}
|
||||
|
||||
@@ -1,270 +0,0 @@
|
||||
// Platform skeleton for EterLib/GrpObjectInstance.h (40250 EterLib/GrpObjectInstance.cpp), generated by platform_stub.py.
|
||||
// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation.
|
||||
#include "EterLib/StdAfx.h"
|
||||
#include "EterLib/GrpObjectInstance.h"
|
||||
|
||||
#include "../PlatformStub.h"
|
||||
|
||||
CGraphicObjectInstance::CGraphicObjectInstance()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CGraphicObjectInstance::~CGraphicObjectInstance()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::GetPosition() const -> const D3DXVECTOR3 &
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<const D3DXVECTOR3 &>();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::GetScale() const -> const D3DXVECTOR3 &
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<const D3DXVECTOR3 &>();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::GetRotation() -> float
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<float>();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::GetYaw() -> float
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<float>();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::GetPitch() -> float
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<float>();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::GetRoll() -> float
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<float>();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::SetPosition(float, float, float) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::SetPosition(const D3DXVECTOR3 &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::SetScale(float, float, float) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::SetRotation(float) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::SetRotation(float, float, float) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::SetRotationQuaternion(const D3DXQUATERNION &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::SetRotationMatrix(const D3DXMATRIX &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::Clear() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::Update() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::Render() -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::BlendRender() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::RenderToShadowMap() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::RenderShadow() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::RenderPCBlocker() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::Deform() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::Transform() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::Show() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::Hide() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::isShow() -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::isIntersect(const CRay &, float *, float *, float *) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::GetWTBBoxVertex(const unsigned char &) -> D3DXVECTOR4 &
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<D3DXVECTOR4 &>();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::GetTransform() -> D3DXMATRIX &
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<D3DXMATRIX &>();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::SetPortal(DWORD, int) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::GetPortal(DWORD) -> int
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<int>();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::Initialize() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::OnInitialize() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::UpdateBoundingSphere() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::RegisterBoundingSphere() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::AddCollision(const CStaticCollisionData *, const D3DXMATRIX *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::ClearCollision() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::CollisionDynamicSphere(const CDynamicSphereInstance &) const -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::MovementCollisionDynamicSphere(const CDynamicSphereInstance &) const -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::GetCollisionMovementAdjust(const CDynamicSphereInstance &) const -> D3DXVECTOR3
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<D3DXVECTOR3>();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::UpdateCollisionData(const CStaticCollisionDataVector *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::GetCollisionInstanceCount() -> DWORD
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<DWORD>();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::GetCollisionInstanceData(DWORD) -> CBaseCollisionInstance *
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<CBaseCollisionInstance *>();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::SetHeightInstance(CAttributeInstance *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::ClearHeightInstance() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::UpdateHeightInstance(CAttributeInstance *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::IsObjectHeight() -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CGraphicObjectInstance::GetObjectHeight(float, float, float *) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
@@ -1,114 +1,160 @@
|
||||
// Platform skeleton for EterLib/GrpVertexBuffer.h (40250 EterLib/GrpVertexBuffer.cpp), generated by platform_stub.py.
|
||||
// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation.
|
||||
// 40250 EterLib/GrpVertexBuffer.cpp over CPU memory (CpuBuffer.h): the device buffer is a byte vector
|
||||
// that Lock hands out directly, so Granny vertex loading and deform write real data.
|
||||
#include "EterLib/StdAfx.h"
|
||||
#include "EterLib/GrpVertexBuffer.h"
|
||||
#include "EterLib/StateManager.h"
|
||||
|
||||
#include "../PlatformStub.h"
|
||||
#include "CpuBuffer.h"
|
||||
|
||||
int CGraphicVertexBuffer::GetVertexStride() const
|
||||
{
|
||||
int retSize = mt_fvf_vertex_size(m_dwFVF);
|
||||
return retSize;
|
||||
}
|
||||
|
||||
DWORD CGraphicVertexBuffer::GetFlexibleVertexFormat() const
|
||||
{
|
||||
return m_dwFVF;
|
||||
}
|
||||
|
||||
int CGraphicVertexBuffer::GetVertexCount() const
|
||||
{
|
||||
return m_vtxCount;
|
||||
}
|
||||
|
||||
void CGraphicVertexBuffer::SetStream(int stride, int layer) const
|
||||
{
|
||||
STATEMANAGER.SetStreamSource(layer, m_lpd3dVB, stride);
|
||||
}
|
||||
|
||||
bool CGraphicVertexBuffer::LockRange(unsigned count, void** pretVertices) const
|
||||
{
|
||||
if (!m_lpd3dVB)
|
||||
return false;
|
||||
|
||||
*pretVertices = static_cast<MtCpuVertexBuffer*>(m_lpd3dVB)->bytes.data();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CGraphicVertexBuffer::Lock(void ** pretVertices) const
|
||||
{
|
||||
if (!m_lpd3dVB)
|
||||
return false;
|
||||
|
||||
*pretVertices = static_cast<MtCpuVertexBuffer*>(m_lpd3dVB)->bytes.data();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CGraphicVertexBuffer::Unlock() const
|
||||
{
|
||||
if (!m_lpd3dVB)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Returns true when a buffer exists, as 40250 does.
|
||||
bool CGraphicVertexBuffer::IsEmpty() const
|
||||
{
|
||||
if (m_lpd3dVB)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CGraphicVertexBuffer::LockDynamic(void** pretVertices)
|
||||
{
|
||||
if (!m_lpd3dVB)
|
||||
return false;
|
||||
|
||||
*pretVertices = static_cast<MtCpuVertexBuffer*>(m_lpd3dVB)->bytes.data();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CGraphicVertexBuffer::Lock(void ** pretVertices)
|
||||
{
|
||||
if (!m_lpd3dVB)
|
||||
return false;
|
||||
|
||||
*pretVertices = static_cast<MtCpuVertexBuffer*>(m_lpd3dVB)->bytes.data();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CGraphicVertexBuffer::Unlock()
|
||||
{
|
||||
if (!m_lpd3dVB)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CGraphicVertexBuffer::Copy(int bufSize, const void* srcVertices)
|
||||
{
|
||||
void * dstVertices;
|
||||
|
||||
if (!Lock(&dstVertices))
|
||||
return false;
|
||||
|
||||
memcpy(dstVertices, srcVertices, bufSize);
|
||||
|
||||
Unlock();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CGraphicVertexBuffer::CreateDeviceObjects()
|
||||
{
|
||||
assert(m_lpd3dVB == NULL);
|
||||
|
||||
MtCpuVertexBuffer* buffer = new MtCpuVertexBuffer;
|
||||
buffer->bytes.assign(m_dwBufferSize, 0);
|
||||
buffer->fvf = m_dwFVF;
|
||||
m_lpd3dVB = buffer;
|
||||
return true;
|
||||
}
|
||||
|
||||
void CGraphicVertexBuffer::DestroyDeviceObjects()
|
||||
{
|
||||
delete static_cast<MtCpuVertexBuffer*>(m_lpd3dVB);
|
||||
m_lpd3dVB = NULL;
|
||||
}
|
||||
|
||||
bool CGraphicVertexBuffer::Create(int vtxCount, DWORD fvf, DWORD usage, D3DPOOL d3dPool)
|
||||
{
|
||||
assert(vtxCount > 0);
|
||||
|
||||
Destroy();
|
||||
|
||||
m_vtxCount = vtxCount;
|
||||
m_dwBufferSize = mt_fvf_vertex_size(fvf) * m_vtxCount;
|
||||
m_d3dPool = d3dPool;
|
||||
m_dwUsage = usage;
|
||||
m_dwFVF = fvf;
|
||||
|
||||
if (usage == D3DUSAGE_WRITEONLY || usage == D3DUSAGE_DYNAMIC)
|
||||
m_dwLockFlag = 0;
|
||||
else
|
||||
m_dwLockFlag = D3DLOCK_READONLY;
|
||||
|
||||
return CreateDeviceObjects();
|
||||
}
|
||||
|
||||
void CGraphicVertexBuffer::Destroy()
|
||||
{
|
||||
DestroyDeviceObjects();
|
||||
}
|
||||
|
||||
void CGraphicVertexBuffer::Initialize()
|
||||
{
|
||||
m_lpd3dVB = NULL;
|
||||
m_vtxCount = 0;
|
||||
m_dwBufferSize = 0;
|
||||
m_dwFVF = 0;
|
||||
}
|
||||
|
||||
CGraphicVertexBuffer::CGraphicVertexBuffer()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
Initialize();
|
||||
}
|
||||
|
||||
CGraphicVertexBuffer::~CGraphicVertexBuffer()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicVertexBuffer::Destroy() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicVertexBuffer::Create(int, DWORD, DWORD, D3DPOOL) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CGraphicVertexBuffer::CreateDeviceObjects() -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CGraphicVertexBuffer::DestroyDeviceObjects() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicVertexBuffer::Copy(int, const void *) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CGraphicVertexBuffer::LockRange(unsigned int, void **) const -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CGraphicVertexBuffer::Lock(void **) const -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CGraphicVertexBuffer::Unlock() const -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CGraphicVertexBuffer::LockDynamic(void **) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CGraphicVertexBuffer::Lock(void **) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CGraphicVertexBuffer::Unlock() -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CGraphicVertexBuffer::SetStream(int, int) const -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CGraphicVertexBuffer::GetVertexCount() const -> int
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<int>();
|
||||
}
|
||||
|
||||
auto CGraphicVertexBuffer::GetVertexStride() const -> int
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<int>();
|
||||
}
|
||||
|
||||
auto CGraphicVertexBuffer::GetFlexibleVertexFormat() const -> DWORD
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<DWORD>();
|
||||
}
|
||||
|
||||
auto CGraphicVertexBuffer::IsEmpty() const -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CGraphicVertexBuffer::Initialize() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
Destroy();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
#pragma once
|
||||
// The cursor in client coordinates, as the host (Godot) last pushed it. 40250 CMSWindow::GetMousePosition
|
||||
// asks Win32 (GetCursorPos + ScreenToClient); here the host is the only source of mouse input.
|
||||
void MtHostSetCursor(int x, int y);
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "EterLib/MSWindow.h"
|
||||
|
||||
#include "../PlatformStub.h"
|
||||
#include "HostCursor.h"
|
||||
|
||||
CMSWindow::CMSWindow()
|
||||
{
|
||||
@@ -78,9 +79,19 @@ auto CMSWindow::IsActive() -> bool
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CMSWindow::GetMousePosition(POINT *) -> void
|
||||
namespace {
|
||||
POINT g_host_cursor = {0, 0};
|
||||
}
|
||||
|
||||
void MtHostSetCursor(int x, int y)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
g_host_cursor.x = x;
|
||||
g_host_cursor.y = y;
|
||||
}
|
||||
|
||||
auto CMSWindow::GetMousePosition(POINT * ppt) -> void
|
||||
{
|
||||
*ppt = g_host_cursor;
|
||||
}
|
||||
|
||||
auto CMSWindow::GetClientRect(RECT *) -> void
|
||||
|
||||
Reference in New Issue
Block a user