mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-18 05:31:07 +03:00
Compare commits
27 Commits
1347f509d4
...
9e28841cec
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9e28841cec | ||
|
|
e5150d7d21 | ||
|
|
3a876398a7 | ||
|
|
1b90dcb09b | ||
|
|
c5bd63b79e | ||
|
|
5492b3f231 | ||
|
|
8851d2e5e1 | ||
|
|
0a91d44600 | ||
|
|
d19658185a | ||
|
|
abf2e2cde3 | ||
|
|
6b7abe3c03 | ||
|
|
fa98bbc1f0 | ||
|
|
af4b798942 | ||
|
|
9b18f2f3bd | ||
|
|
6cb5310430 | ||
|
|
cb8291af1a | ||
|
|
58c8975769 | ||
|
|
817cec99fe | ||
|
|
6675586a29 | ||
|
|
8935c520c0 | ||
|
|
7cf7127810 | ||
|
|
8fb51991e0 | ||
|
|
7fdd22545f | ||
|
|
15eafe92d7 | ||
|
|
1ad3679f90 | ||
|
|
81970958a8 | ||
|
|
a9cad5238d |
@ -32,6 +32,8 @@ if(WHOA_SYSTEM_MAC)
|
|||||||
"-framework AppKit"
|
"-framework AppKit"
|
||||||
"-framework Carbon"
|
"-framework Carbon"
|
||||||
"-framework IOKit"
|
"-framework IOKit"
|
||||||
|
"-framework Metal"
|
||||||
|
"-framework QuartzCore"
|
||||||
)
|
)
|
||||||
|
|
||||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/mac/MainMenu.nib DESTINATION "bin")
|
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/mac/MainMenu.nib DESTINATION "bin")
|
||||||
|
|||||||
9
src/app/mac/EngineMTLLayerView.h
Normal file
9
src/app/mac/EngineMTLLayerView.h
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#ifndef APP_MAC_ENGINE_MTL_LAYER_VIEW_H
|
||||||
|
#define APP_MAC_ENGINE_MTL_LAYER_VIEW_H
|
||||||
|
|
||||||
|
#include "app/mac/EngineGLLayerView.h"
|
||||||
|
|
||||||
|
@interface EngineMTLLayerView : EngineGLLayerView
|
||||||
|
@end
|
||||||
|
|
||||||
|
#endif
|
||||||
36
src/app/mac/EngineMTLLayerView.mm
Normal file
36
src/app/mac/EngineMTLLayerView.mm
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#include "app/mac/EngineMTLLayerView.h"
|
||||||
|
#import <QuartzCore/CAMetalLayer.h>
|
||||||
|
|
||||||
|
@implementation EngineMTLLayerView
|
||||||
|
|
||||||
|
- (CALayer*)makeBackingLayer {
|
||||||
|
return [CAMetalLayer layer];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)initWithFrame:(NSRect)frame glWindow:(GLWindow*)window {
|
||||||
|
self = [super initWithFrame:frame glWindow:window];
|
||||||
|
|
||||||
|
if (self) {
|
||||||
|
[self setWantsLayer:YES];
|
||||||
|
}
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)drawRect:(NSRect)dirtyRect {
|
||||||
|
// Rendering is driven by CGxDeviceMTL.
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)update {
|
||||||
|
[super update];
|
||||||
|
|
||||||
|
if (![self.layer isKindOfClass:[CAMetalLayer class]]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CAMetalLayer* layer = (CAMetalLayer*)self.layer;
|
||||||
|
CGSize size = [self convertSizeToBacking:self.bounds.size];
|
||||||
|
layer.drawableSize = size;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
@ -1,7 +1,9 @@
|
|||||||
#include "app/mac/View.h"
|
#include "app/mac/View.h"
|
||||||
#include "app/mac/EngineGLLayerView.h"
|
#include "app/mac/EngineGLLayerView.h"
|
||||||
|
#include "app/mac/EngineMTLLayerView.h"
|
||||||
#include "app/mac/WindowCallbacks.h"
|
#include "app/mac/WindowCallbacks.h"
|
||||||
#include "gx/gll/GLWindow.h"
|
#include "gx/gll/GLWindow.h"
|
||||||
|
#include "gx/Device.hpp"
|
||||||
|
|
||||||
GLWindowCallbacks EngineViewCallbacks = {
|
GLWindowCallbacks EngineViewCallbacks = {
|
||||||
&MacOnResized,
|
&MacOnResized,
|
||||||
@ -23,5 +25,9 @@ void AssignEngineViewCallbacks(GLWindowCallbacks* callbacks) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Class GetEngineViewClass() {
|
Class GetEngineViewClass() {
|
||||||
|
if (GxDevApi() == GxApi_Metal) {
|
||||||
|
return [EngineMTLLayerView class];
|
||||||
|
}
|
||||||
|
|
||||||
return [EngineGLLayerView class];
|
return [EngineGLLayerView class];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
#include "app/mac/MacClient.h"
|
#include "app/mac/MacClient.h"
|
||||||
#include "event/Input.hpp"
|
#include "event/Input.hpp"
|
||||||
#include "gx/gll/CGxDeviceGLL.hpp"
|
#include "gx/gll/CGxDeviceGLL.hpp"
|
||||||
|
#include "gx/mtl/CGxDeviceMTL.hpp"
|
||||||
#include "gx/Device.hpp"
|
#include "gx/Device.hpp"
|
||||||
#include "gx/Window.hpp"
|
#include "gx/Window.hpp"
|
||||||
#include <bc/Debug.hpp>
|
#include <bc/Debug.hpp>
|
||||||
@ -171,7 +172,11 @@ void MacOnResized(int32_t width, int32_t height, bool a3) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static_cast<CGxDeviceGLL*>(g_theGxDevicePtr)->Resize(width, height);
|
if (GxDevApi() == GxApi_GLL) {
|
||||||
|
static_cast<CGxDeviceGLL*>(g_theGxDevicePtr)->Resize(width, height);
|
||||||
|
} else if (GxDevApi() == GxApi_Metal) {
|
||||||
|
static_cast<CGxDeviceMTL*>(g_theGxDevicePtr)->Resize(width, height);
|
||||||
|
}
|
||||||
|
|
||||||
OsQueuePut(OS_INPUT_SIZE, width, height, 0, 0);
|
OsQueuePut(OS_INPUT_SIZE, width, height, 0, 0);
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
#include "gx/Adapter.hpp"
|
#include "gx/Adapter.hpp"
|
||||||
#include "gx/Device.hpp"
|
#include "gx/Device.hpp"
|
||||||
#include <storm/Array.hpp>
|
#include <storm/Array.hpp>
|
||||||
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
static CGxDevice* s_device;
|
static CGxDevice* s_device;
|
||||||
@ -417,6 +418,13 @@ void ConsoleDeviceInitialize(const char* title) {
|
|||||||
api = GxApi_GLL;
|
api = GxApi_GLL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(WHOA_SYSTEM_MAC)
|
||||||
|
const char* apiOverride = getenv("WHOA_GX_API");
|
||||||
|
if (apiOverride && !strcmp(apiOverride, "metal")) {
|
||||||
|
api = GxApi_Metal;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
s_device = GxDevCreate(api, OsWindowProc, format);
|
s_device = GxDevCreate(api, OsWindowProc, format);
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
|||||||
@ -38,7 +38,9 @@
|
|||||||
#include <common/MD5.hpp>
|
#include <common/MD5.hpp>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
|
int32_t CGlueMgr::m_acceptedContest = 1; // TODO
|
||||||
int32_t CGlueMgr::m_acceptedEULA = 1; // TODO
|
int32_t CGlueMgr::m_acceptedEULA = 1; // TODO
|
||||||
|
int32_t CGlueMgr::m_acceptedScanning = 1; // TODO
|
||||||
int32_t CGlueMgr::m_acceptedTerminationWithoutNotice;
|
int32_t CGlueMgr::m_acceptedTerminationWithoutNotice;
|
||||||
int32_t CGlueMgr::m_acceptedTOS = 1; // TODO
|
int32_t CGlueMgr::m_acceptedTOS = 1; // TODO
|
||||||
int32_t CGlueMgr::m_accountMsgAvailable;
|
int32_t CGlueMgr::m_accountMsgAvailable;
|
||||||
@ -393,6 +395,11 @@ int32_t CGlueMgr::Idle(const void* a1, void* a2) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case IDLE_CREATE_CHARACTER: {
|
||||||
|
CGlueMgr::PollCreateCharacter(msg, complete, result);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case IDLE_DELETE_CHARACTER: {
|
case IDLE_DELETE_CHARACTER: {
|
||||||
CGlueMgr::PollDeleteCharacter(msg, complete, result);
|
CGlueMgr::PollDeleteCharacter(msg, complete, result);
|
||||||
break;
|
break;
|
||||||
@ -763,6 +770,37 @@ void CGlueMgr::PollCharacterList(const char* msg, int32_t complete, int32_t resu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CGlueMgr::PollCreateCharacter(const char* msg, int32_t complete, int32_t result) {
|
||||||
|
FrameScript_SignalEvent(UPDATE_STATUS_DIALOG, "%s", msg);
|
||||||
|
|
||||||
|
if (CGlueMgr::HandleBattlenetDisconnect()) {
|
||||||
|
CGlueMgr::SetIdleState(IDLE_NONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!complete) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Error
|
||||||
|
|
||||||
|
if (result == 0) {
|
||||||
|
FrameScript_SignalEvent(OPEN_STATUS_DIALOG, "%s%s", "OKAY", msg);
|
||||||
|
|
||||||
|
CGlueMgr::SetIdleState(IDLE_NONE);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Success
|
||||||
|
|
||||||
|
CGlueMgr::SetIdleState(IDLE_NONE);
|
||||||
|
|
||||||
|
FrameScript_SignalEvent(CLOSE_STATUS_DIALOG, nullptr);
|
||||||
|
FrameScript_SignalEvent(SELECT_LAST_CHARACTER, nullptr);
|
||||||
|
|
||||||
|
CGlueMgr::SetScreen("charselect");
|
||||||
|
}
|
||||||
|
|
||||||
void CGlueMgr::PollDeleteCharacter(const char* msg, int32_t complete, int32_t result) {
|
void CGlueMgr::PollDeleteCharacter(const char* msg, int32_t complete, int32_t result) {
|
||||||
FrameScript_SignalEvent(UPDATE_STATUS_DIALOG, "%s", msg);
|
FrameScript_SignalEvent(UPDATE_STATUS_DIALOG, "%s", msg);
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,9 @@ class CGlueMgr {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Static variables
|
// Static variables
|
||||||
|
static int32_t m_acceptedContest;
|
||||||
static int32_t m_acceptedEULA;
|
static int32_t m_acceptedEULA;
|
||||||
|
static int32_t m_acceptedScanning;
|
||||||
static int32_t m_acceptedTerminationWithoutNotice;
|
static int32_t m_acceptedTerminationWithoutNotice;
|
||||||
static int32_t m_acceptedTOS;
|
static int32_t m_acceptedTOS;
|
||||||
static int32_t m_accountMsgAvailable;
|
static int32_t m_accountMsgAvailable;
|
||||||
@ -80,6 +82,7 @@ class CGlueMgr {
|
|||||||
static int32_t OnKickReasonMsg(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg);
|
static int32_t OnKickReasonMsg(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg);
|
||||||
static void PollAccountLogin(int32_t errorCode, const char* msg, int32_t complete, int32_t result, WOWCS_OPS op);
|
static void PollAccountLogin(int32_t errorCode, const char* msg, int32_t complete, int32_t result, WOWCS_OPS op);
|
||||||
static void PollCharacterList(const char* msg, int32_t complete, int32_t result, int32_t errorCode);
|
static void PollCharacterList(const char* msg, int32_t complete, int32_t result, int32_t errorCode);
|
||||||
|
static void PollCreateCharacter(const char* msg, int32_t complete, int32_t result);
|
||||||
static void PollDeleteCharacter(const char* msg, int32_t complete, int32_t result);
|
static void PollDeleteCharacter(const char* msg, int32_t complete, int32_t result);
|
||||||
static void PollEnterWorld();
|
static void PollEnterWorld();
|
||||||
static void PollLoginServerLogin();
|
static void PollLoginServerLogin();
|
||||||
|
|||||||
@ -204,7 +204,13 @@ int32_t Script_ShowTerminationWithoutNoticeNotice(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_TerminationWithoutNoticeAccepted(lua_State* L) {
|
int32_t Script_TerminationWithoutNoticeAccepted(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
if (CGlueMgr::m_acceptedTerminationWithoutNotice) {
|
||||||
|
lua_pushnumber(L, 1.0);
|
||||||
|
} else {
|
||||||
|
lua_pushnil(L);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_AcceptTerminationWithoutNotice(lua_State* L) {
|
int32_t Script_AcceptTerminationWithoutNotice(lua_State* L) {
|
||||||
@ -216,7 +222,13 @@ int32_t Script_ShowScanningNotice(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_ScanningAccepted(lua_State* L) {
|
int32_t Script_ScanningAccepted(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
if (CGlueMgr::m_acceptedScanning) {
|
||||||
|
lua_pushnumber(L, 1.0);
|
||||||
|
} else {
|
||||||
|
lua_pushnil(L);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_AcceptScanning(lua_State* L) {
|
int32_t Script_AcceptScanning(lua_State* L) {
|
||||||
@ -228,7 +240,13 @@ int32_t Script_ShowContestNotice(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_ContestAccepted(lua_State* L) {
|
int32_t Script_ContestAccepted(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
if (CGlueMgr::m_acceptedContest) {
|
||||||
|
lua_pushnumber(L, 1.0);
|
||||||
|
} else {
|
||||||
|
lua_pushnil(L);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_AcceptContest(lua_State* L) {
|
int32_t Script_AcceptContest(lua_State* L) {
|
||||||
|
|||||||
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#if defined(WHOA_SYSTEM_MAC)
|
#if defined(WHOA_SYSTEM_MAC)
|
||||||
#include "gx/gll/CGxDeviceGLL.hpp"
|
#include "gx/gll/CGxDeviceGLL.hpp"
|
||||||
|
#include "gx/mtl/CGxDeviceMTL.hpp"
|
||||||
#include "gx/mac/Display.hpp"
|
#include "gx/mac/Display.hpp"
|
||||||
#include <ApplicationServices/ApplicationServices.h>
|
#include <ApplicationServices/ApplicationServices.h>
|
||||||
#include <OpenGL/OpenGL.h>
|
#include <OpenGL/OpenGL.h>
|
||||||
@ -117,6 +118,8 @@ int32_t CGxDevice::AdapterFormats(EGxApi api, TSGrowableArray<CGxFormat>& adapte
|
|||||||
CGxDevice::OpenGlAdapterFormats(adapterFormats);
|
CGxDevice::OpenGlAdapterFormats(adapterFormats);
|
||||||
} else if (api == GxApi_GLL) {
|
} else if (api == GxApi_GLL) {
|
||||||
CGxDevice::GLLAdapterFormats(adapterFormats);
|
CGxDevice::GLLAdapterFormats(adapterFormats);
|
||||||
|
} else if (api == GxApi_Metal) {
|
||||||
|
CGxDevice::OpenGlAdapterFormats(adapterFormats);
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(WHOA_SYSTEM_LINUX)
|
#elif defined(WHOA_SYSTEM_LINUX)
|
||||||
@ -228,6 +231,11 @@ CGxDevice* CGxDevice::NewGLL() {
|
|||||||
auto m = SMemAlloc(sizeof(CGxDeviceGLL), __FILE__, __LINE__, 0x0);
|
auto m = SMemAlloc(sizeof(CGxDeviceGLL), __FILE__, __LINE__, 0x0);
|
||||||
return new (m) CGxDeviceGLL();
|
return new (m) CGxDeviceGLL();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CGxDevice* CGxDevice::NewMTL() {
|
||||||
|
auto m = SMemAlloc(sizeof(CGxDeviceMTL), __FILE__, __LINE__, 0x0);
|
||||||
|
return new (m) CGxDeviceMTL();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CGxDevice* CGxDevice::NewOpenGl() {
|
CGxDevice* CGxDevice::NewOpenGl() {
|
||||||
|
|||||||
@ -77,6 +77,7 @@ class CGxDevice {
|
|||||||
#endif
|
#endif
|
||||||
#if defined(WHOA_SYSTEM_MAC)
|
#if defined(WHOA_SYSTEM_MAC)
|
||||||
static CGxDevice* NewGLL();
|
static CGxDevice* NewGLL();
|
||||||
|
static CGxDevice* NewMTL();
|
||||||
#endif
|
#endif
|
||||||
static CGxDevice* NewOpenGl();
|
static CGxDevice* NewOpenGl();
|
||||||
static void OpenGlAdapterFormats(TSGrowableArray<CGxFormat>& adapterFormats);
|
static void OpenGlAdapterFormats(TSGrowableArray<CGxFormat>& adapterFormats);
|
||||||
|
|||||||
@ -20,6 +20,7 @@ if(WHOA_SYSTEM_MAC)
|
|||||||
file(GLOB MAC_SOURCES
|
file(GLOB MAC_SOURCES
|
||||||
"gll/*.cpp"
|
"gll/*.cpp"
|
||||||
"gll/*.mm"
|
"gll/*.mm"
|
||||||
|
"mtl/*.mm"
|
||||||
"mac/*.cpp"
|
"mac/*.cpp"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -24,6 +24,8 @@ CGxDevice* GxDevCreate(EGxApi api, int32_t (*windowProc)(void* window, uint32_t
|
|||||||
device = CGxDevice::NewOpenGl();
|
device = CGxDevice::NewOpenGl();
|
||||||
} else if (api == GxApi_GLL) {
|
} else if (api == GxApi_GLL) {
|
||||||
device = CGxDevice::NewGLL();
|
device = CGxDevice::NewGLL();
|
||||||
|
} else if (api == GxApi_Metal) {
|
||||||
|
device = CGxDevice::NewMTL();
|
||||||
} else {
|
} else {
|
||||||
// Error
|
// Error
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,7 +35,8 @@ enum EGxApi {
|
|||||||
GxApi_D3d10 = 3,
|
GxApi_D3d10 = 3,
|
||||||
GxApi_D3d11 = 4,
|
GxApi_D3d11 = 4,
|
||||||
GxApi_GLL = 5,
|
GxApi_GLL = 5,
|
||||||
GxApis_Last = 6
|
GxApi_Metal = 6,
|
||||||
|
GxApis_Last = 7
|
||||||
};
|
};
|
||||||
|
|
||||||
enum EGxBlend {
|
enum EGxBlend {
|
||||||
|
|||||||
81
src/gx/mtl/CGxDeviceMTL.hpp
Normal file
81
src/gx/mtl/CGxDeviceMTL.hpp
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
#ifndef GX_MTL_C_GX_DEVICE_MTL_HPP
|
||||||
|
#define GX_MTL_C_GX_DEVICE_MTL_HPP
|
||||||
|
|
||||||
|
#include "gx/CGxDevice.hpp"
|
||||||
|
#include "gx/gll/GLWindow.h"
|
||||||
|
|
||||||
|
class CGxBatch;
|
||||||
|
class CGxShader;
|
||||||
|
|
||||||
|
class CGxDeviceMTL : public CGxDevice {
|
||||||
|
public:
|
||||||
|
// Member variables
|
||||||
|
GLWindow m_window;
|
||||||
|
|
||||||
|
// Virtual member functions
|
||||||
|
void ITexMarkAsUpdated(CGxTex*) override;
|
||||||
|
void IRsSendToHw(EGxRenderState) override;
|
||||||
|
int32_t DeviceCreate(int32_t (*windowProc)(void* window, uint32_t message, uintptr_t wparam, intptr_t lparam), const CGxFormat&) override;
|
||||||
|
int32_t DeviceSetFormat(const CGxFormat&) override;
|
||||||
|
void* DeviceWindow() override;
|
||||||
|
void DeviceWM(EGxWM wm, uintptr_t param1, uintptr_t param2) override {};
|
||||||
|
void CapsWindowSize(CRect&) override;
|
||||||
|
void CapsWindowSizeInScreenCoords(CRect& dst) override;
|
||||||
|
void ScenePresent() override;
|
||||||
|
void SceneClear(uint32_t, CImVector) override;
|
||||||
|
void Draw(CGxBatch* batch, int32_t indexed) override;
|
||||||
|
void PoolSizeSet(CGxPool*, uint32_t) override;
|
||||||
|
char* BufLock(CGxBuf*) override;
|
||||||
|
int32_t BufUnlock(CGxBuf*, uint32_t) override;
|
||||||
|
void BufData(CGxBuf* buf, const void* data, size_t size, uintptr_t offset) override;
|
||||||
|
void TexDestroy(CGxTex* texId) override;
|
||||||
|
void IShaderCreate(CGxShader*) override;
|
||||||
|
void ShaderCreate(CGxShader*[], EGxShTarget, const char*, const char*, int32_t) override;
|
||||||
|
int32_t StereoEnabled(void) override;
|
||||||
|
void XformSetProjection(const C44Matrix& matrix) override;
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
CGxDeviceMTL();
|
||||||
|
void Resize(uint32_t width, uint32_t height);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void ISetCaps(const CGxFormat& format);
|
||||||
|
void EnsureLibrary();
|
||||||
|
void BeginFrame();
|
||||||
|
void* GetPipeline(EGxVertexBufferFormat format, bool useColor, bool useSkin, bool useTex, int32_t blendMode);
|
||||||
|
void* GetPoolBuffer(CGxPool* pool);
|
||||||
|
void ITexCreate(CGxTex* texId);
|
||||||
|
void ITexUpload(CGxTex* texId);
|
||||||
|
void* GetTexture(CGxTex* texId);
|
||||||
|
void* GetSampler(CGxTex* texId);
|
||||||
|
void EnsureFallbackTexture();
|
||||||
|
void EnsureDepthTexture(uint32_t width, uint32_t height);
|
||||||
|
void* GetDepthState(bool depthTest, bool depthWrite, uint32_t depthFunc);
|
||||||
|
void* m_device = nullptr;
|
||||||
|
void* m_commandQueue = nullptr;
|
||||||
|
void* m_layer = nullptr;
|
||||||
|
void* m_shaderLibrary = nullptr;
|
||||||
|
void* m_pipelineColor[GxVertexBufferFormats_Last][GxBlends_Last] = {};
|
||||||
|
void* m_pipelineSolid[GxVertexBufferFormats_Last][GxBlends_Last] = {};
|
||||||
|
void* m_pipelineSkin[GxVertexBufferFormats_Last][GxBlends_Last] = {};
|
||||||
|
void* m_pipelineColorTex[GxVertexBufferFormats_Last][GxBlends_Last] = {};
|
||||||
|
void* m_pipelineSolidTex[GxVertexBufferFormats_Last][GxBlends_Last] = {};
|
||||||
|
void* m_pipelineSkinTex[GxVertexBufferFormats_Last][GxBlends_Last] = {};
|
||||||
|
void* m_pipelineColorTex2[GxVertexBufferFormats_Last][GxBlends_Last] = {};
|
||||||
|
void* m_pipelineSolidTex2[GxVertexBufferFormats_Last][GxBlends_Last] = {};
|
||||||
|
void* m_pipelineSkinTex2[GxVertexBufferFormats_Last][GxBlends_Last] = {};
|
||||||
|
void* m_frameCommandBuffer = nullptr;
|
||||||
|
void* m_frameEncoder = nullptr;
|
||||||
|
void* m_frameDrawable = nullptr;
|
||||||
|
uint32_t m_frameHasDraw = 0;
|
||||||
|
uint32_t m_clearMask = 0;
|
||||||
|
uint32_t m_clearColor = 0;
|
||||||
|
void* m_fallbackTexture = nullptr;
|
||||||
|
void* m_fallbackSampler = nullptr;
|
||||||
|
void* m_depthTexture = nullptr;
|
||||||
|
uint32_t m_depthWidth = 0;
|
||||||
|
uint32_t m_depthHeight = 0;
|
||||||
|
void* m_depthStates[2][2][4] = {};
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
1855
src/gx/mtl/CGxDeviceMTL.mm
Normal file
1855
src/gx/mtl/CGxDeviceMTL.mm
Normal file
File diff suppressed because it is too large
Load Diff
@ -104,6 +104,10 @@ void ClientConnection::GetRealmList() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClientConnection::HandleCharacterCreate(uint8_t result) {
|
||||||
|
this->Complete(result == 47, result);
|
||||||
|
}
|
||||||
|
|
||||||
void ClientConnection::HandleCharacterDelete(uint8_t result) {
|
void ClientConnection::HandleCharacterDelete(uint8_t result) {
|
||||||
this->Complete(result == 71, result);
|
this->Complete(result == 71, result);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,6 +22,7 @@ class ClientConnection : public RealmConnection {
|
|||||||
|
|
||||||
// Virtual member functions
|
// Virtual member functions
|
||||||
virtual int32_t HandleConnect();
|
virtual int32_t HandleConnect();
|
||||||
|
virtual void HandleCharacterCreate(uint8_t result);
|
||||||
virtual void HandleCharacterDelete(uint8_t result);
|
virtual void HandleCharacterDelete(uint8_t result);
|
||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
|
|||||||
@ -20,7 +20,7 @@ int32_t RealmConnection::MessageHandler(void* param, NETMESSAGE msgId, uint32_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
case SMSG_CHAR_CREATE: {
|
case SMSG_CHAR_CREATE: {
|
||||||
// TODO
|
result = connection->CreateCharHandler(msgId, time, msg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,6 +294,15 @@ int32_t RealmConnection::HandleCharEnum(uint32_t msgId, uint32_t time, CDataStor
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t RealmConnection::CreateCharHandler(uint32_t msgId, uint32_t time, CDataStore* msg) {
|
||||||
|
uint8_t result;
|
||||||
|
msg->Get(result);
|
||||||
|
|
||||||
|
this->HandleCharacterCreate(result);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t RealmConnection::DeleteCharHandler(uint32_t msgId, uint32_t time, CDataStore* msg) {
|
int32_t RealmConnection::DeleteCharHandler(uint32_t msgId, uint32_t time, CDataStore* msg) {
|
||||||
uint8_t result;
|
uint8_t result;
|
||||||
msg->Get(result);
|
msg->Get(result);
|
||||||
|
|||||||
@ -46,12 +46,14 @@ class RealmConnection : public NetClient {
|
|||||||
|
|
||||||
// Virtual member functions
|
// Virtual member functions
|
||||||
virtual int32_t HandleAuthChallenge(AuthenticationChallenge* challenge);
|
virtual int32_t HandleAuthChallenge(AuthenticationChallenge* challenge);
|
||||||
|
virtual void HandleCharacterCreate(uint8_t result) = 0;
|
||||||
virtual void HandleCharacterDelete(uint8_t result) = 0;
|
virtual void HandleCharacterDelete(uint8_t result) = 0;
|
||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
RealmConnection(RealmResponse* realmResponse);
|
RealmConnection(RealmResponse* realmResponse);
|
||||||
int32_t HandleAuthResponse(uint32_t msgId, uint32_t time, CDataStore* msg);
|
int32_t HandleAuthResponse(uint32_t msgId, uint32_t time, CDataStore* msg);
|
||||||
int32_t HandleCharEnum(uint32_t msgId, uint32_t time, CDataStore* msg);
|
int32_t HandleCharEnum(uint32_t msgId, uint32_t time, CDataStore* msg);
|
||||||
|
int32_t CreateCharHandler(uint32_t msgId, uint32_t time, CDataStore* msg);
|
||||||
int32_t DeleteCharHandler(uint32_t msgId, uint32_t time, CDataStore* msg);
|
int32_t DeleteCharHandler(uint32_t msgId, uint32_t time, CDataStore* msg);
|
||||||
void RequestCharacterEnum();
|
void RequestCharacterEnum();
|
||||||
void RequestCharacterLogin(uint64_t guid, int32_t a2);
|
void RequestCharacterLogin(uint64_t guid, int32_t a2);
|
||||||
|
|||||||
@ -95,6 +95,10 @@ void CGObject_C::Disable() {
|
|||||||
this->m_disableTimeMs = CWorld::GetCurTimeMs();
|
this->m_disableTimeMs = CWorld::GetCurTimeMs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float CGObject_C::GetFacing() const {
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t CGObject_C::GetModelFileName(const char*& name) const {
|
int32_t CGObject_C::GetModelFileName(const char*& name) const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -103,6 +107,10 @@ CM2Model* CGObject_C::GetObjectModel() {
|
|||||||
return this->m_model;
|
return this->m_model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
C3Vector CGObject_C::GetPosition() const {
|
||||||
|
return { 0.0f, 0.0f, 0.0f };
|
||||||
|
}
|
||||||
|
|
||||||
int32_t CGObject_C::IsInReenable() {
|
int32_t CGObject_C::IsInReenable() {
|
||||||
return this->m_inReenable;
|
return this->m_inReenable;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,6 +36,10 @@ class CGObject_C : public CGObject, public TSHashObject<CGObject_C, CHashKeyGUID
|
|||||||
virtual void HandleOutOfRange(OUT_OF_RANGE_TYPE type) {};
|
virtual void HandleOutOfRange(OUT_OF_RANGE_TYPE type) {};
|
||||||
virtual void UpdateWorldObject(int32_t a2);
|
virtual void UpdateWorldObject(int32_t a2);
|
||||||
// TODO
|
// TODO
|
||||||
|
virtual C3Vector GetPosition() const;
|
||||||
|
// TODO
|
||||||
|
virtual float GetFacing() const;
|
||||||
|
// TODO
|
||||||
virtual int32_t GetModelFileName(const char*& name) const;
|
virtual int32_t GetModelFileName(const char*& name) const;
|
||||||
// TODO
|
// TODO
|
||||||
virtual int32_t CanHighlight();
|
virtual int32_t CanHighlight();
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#include "object/client/CGUnit.hpp"
|
#include "object/client/CGUnit.hpp"
|
||||||
#include "object/client/CGObject.hpp"
|
#include "object/client/CGObject.hpp"
|
||||||
|
#include "object/client/CMovement_C.hpp"
|
||||||
|
|
||||||
uint32_t CGUnit::GetBaseOffset() {
|
uint32_t CGUnit::GetBaseOffset() {
|
||||||
return CGObject::TotalFields();
|
return CGObject::TotalFields();
|
||||||
@ -29,10 +30,18 @@ int32_t CGUnit::GetDisplayID() const {
|
|||||||
return this->Unit()->displayID;
|
return this->Unit()->displayID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float CGUnit::GetFacing() const {
|
||||||
|
return this->m_move->GetFacing();
|
||||||
|
}
|
||||||
|
|
||||||
int32_t CGUnit::GetNativeDisplayID() const {
|
int32_t CGUnit::GetNativeDisplayID() const {
|
||||||
return this->Unit()->nativeDisplayID;
|
return this->Unit()->nativeDisplayID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
C3Vector CGUnit::GetPosition() const {
|
||||||
|
return this->m_move->GetPosition();
|
||||||
|
}
|
||||||
|
|
||||||
CGUnitData* CGUnit::Unit() const {
|
CGUnitData* CGUnit::Unit() const {
|
||||||
return this->m_unit;
|
return this->m_unit;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,8 +2,11 @@
|
|||||||
#define OBJECT_CLIENT_CG_UNIT_HPP
|
#define OBJECT_CLIENT_CG_UNIT_HPP
|
||||||
|
|
||||||
#include "util/GUID.hpp"
|
#include "util/GUID.hpp"
|
||||||
|
#include <tempest/Vector.hpp>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
|
class CMovement_C;
|
||||||
|
|
||||||
struct CGUnitData {
|
struct CGUnitData {
|
||||||
WOWGUID charm;
|
WOWGUID charm;
|
||||||
WOWGUID summon;
|
WOWGUID summon;
|
||||||
@ -83,13 +86,18 @@ class CGUnit {
|
|||||||
static uint32_t TotalFieldsSaved();
|
static uint32_t TotalFieldsSaved();
|
||||||
|
|
||||||
// Public member functions
|
// Public member functions
|
||||||
|
CGUnit(CMovement_C& move)
|
||||||
|
: m_move(&move) {};
|
||||||
int32_t GetDisplayID() const;
|
int32_t GetDisplayID() const;
|
||||||
|
float GetFacing() const;
|
||||||
int32_t GetNativeDisplayID() const;
|
int32_t GetNativeDisplayID() const;
|
||||||
|
C3Vector GetPosition() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Protected member variables
|
// Protected member variables
|
||||||
CGUnitData* m_unit;
|
CGUnitData* m_unit;
|
||||||
uint32_t* m_unitSaved;
|
uint32_t* m_unitSaved;
|
||||||
|
CMovement_C* m_move;
|
||||||
|
|
||||||
// Protected member functions
|
// Protected member functions
|
||||||
CGUnitData* Unit() const;
|
CGUnitData* Unit() const;
|
||||||
|
|||||||
@ -96,7 +96,11 @@ const char* CGUnit_C::GetDisplayRaceNameFromRecord(const ChrRacesRec* raceRec, U
|
|||||||
return raceRec->m_name;
|
return raceRec->m_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
CGUnit_C::CGUnit_C(uint32_t time, CClientObjCreate& objCreate) : CGObject_C(time, objCreate) {
|
CGUnit_C::CGUnit_C(uint32_t time, CClientObjCreate& objCreate)
|
||||||
|
: CGObject_C(time, objCreate)
|
||||||
|
, CGUnit(this->m_localMove)
|
||||||
|
, m_localMove(objCreate.move.status.position28, objCreate.move.status.facing34, this->GetGUID(), this)
|
||||||
|
{
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
this->RefreshDataPointers();
|
this->RefreshDataPointers();
|
||||||
@ -132,6 +136,10 @@ int32_t CGUnit_C::GetDisplayID() const {
|
|||||||
return this->CGUnit::GetDisplayID();
|
return this->CGUnit::GetDisplayID();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float CGUnit_C::GetFacing() const {
|
||||||
|
return this->CGUnit::GetFacing();
|
||||||
|
}
|
||||||
|
|
||||||
int32_t CGUnit_C::GetLocalDisplayID() const {
|
int32_t CGUnit_C::GetLocalDisplayID() const {
|
||||||
return this->m_localDisplayID;
|
return this->m_localDisplayID;
|
||||||
}
|
}
|
||||||
@ -171,6 +179,10 @@ int32_t CGUnit_C::GetModelFileName(const char*& name) const {
|
|||||||
return modelDataRec->m_modelName ? true : false;
|
return modelDataRec->m_modelName ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
C3Vector CGUnit_C::GetPosition() const {
|
||||||
|
return this->CGUnit::GetPosition();
|
||||||
|
}
|
||||||
|
|
||||||
void CGUnit_C::PostInit(uint32_t time, const CClientObjCreate& init, bool a4) {
|
void CGUnit_C::PostInit(uint32_t time, const CClientObjCreate& init, bool a4) {
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
#include "object/client/CClientObjCreate.hpp"
|
#include "object/client/CClientObjCreate.hpp"
|
||||||
#include "object/client/CGObject_C.hpp"
|
#include "object/client/CGObject_C.hpp"
|
||||||
#include "object/client/CGUnit.hpp"
|
#include "object/client/CGUnit.hpp"
|
||||||
|
#include "object/client/CMovement_C.hpp"
|
||||||
#include "object/Types.hpp"
|
#include "object/Types.hpp"
|
||||||
#include "util/GUID.hpp"
|
#include "util/GUID.hpp"
|
||||||
|
|
||||||
@ -27,6 +28,10 @@ class CGUnit_C : public CGObject_C, public CGUnit {
|
|||||||
// Virtual public member functions
|
// Virtual public member functions
|
||||||
virtual ~CGUnit_C();
|
virtual ~CGUnit_C();
|
||||||
// TODO
|
// TODO
|
||||||
|
virtual C3Vector GetPosition() const;
|
||||||
|
// TODO
|
||||||
|
virtual float GetFacing() const;
|
||||||
|
// TODO
|
||||||
virtual int32_t GetModelFileName(const char*& name) const;
|
virtual int32_t GetModelFileName(const char*& name) const;
|
||||||
// TODO
|
// TODO
|
||||||
virtual int32_t CanHighlight();
|
virtual int32_t CanHighlight();
|
||||||
@ -49,12 +54,14 @@ class CGUnit_C : public CGObject_C, public CGUnit {
|
|||||||
private:
|
private:
|
||||||
// Private member variables
|
// Private member variables
|
||||||
// TODO
|
// TODO
|
||||||
CreatureDisplayInfoRec* m_displayInfo;
|
CMovement_C m_localMove;
|
||||||
CreatureDisplayInfoExtraRec* m_displayInfoExtra;
|
|
||||||
CreatureModelDataRec* m_modelData;
|
|
||||||
CreatureSoundDataRec* m_soundData;
|
|
||||||
// TODO
|
// TODO
|
||||||
UnitBloodLevelsRec* m_bloodRec;
|
CreatureDisplayInfoRec* m_displayInfo = nullptr;
|
||||||
|
CreatureDisplayInfoExtraRec* m_displayInfoExtra = nullptr;
|
||||||
|
CreatureModelDataRec* m_modelData = nullptr;
|
||||||
|
CreatureSoundDataRec* m_soundData = nullptr;
|
||||||
|
// TODO
|
||||||
|
UnitBloodLevelsRec* m_bloodRec = nullptr;
|
||||||
// TODO
|
// TODO
|
||||||
int32_t m_localDisplayID = 0;
|
int32_t m_localDisplayID = 0;
|
||||||
// TODO
|
// TODO
|
||||||
|
|||||||
7
src/object/client/CMovementData_C.cpp
Normal file
7
src/object/client/CMovementData_C.cpp
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#include "object/client/CMovementData_C.hpp"
|
||||||
|
|
||||||
|
CMovementData_C::CMovementData_C(const C3Vector& position, float facing, const WOWGUID& guid, CGUnit_C* unit)
|
||||||
|
: CMovementShared(0, position, facing, guid)
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
14
src/object/client/CMovementData_C.hpp
Normal file
14
src/object/client/CMovementData_C.hpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#ifndef OBJECT_CLIENT_C_MOVEMENT_DATA_C_HPP
|
||||||
|
#define OBJECT_CLIENT_C_MOVEMENT_DATA_C_HPP
|
||||||
|
|
||||||
|
#include "object/movement/CMovementShared.hpp"
|
||||||
|
|
||||||
|
class CGUnit_C;
|
||||||
|
|
||||||
|
class CMovementData_C : public CMovementShared {
|
||||||
|
public:
|
||||||
|
// Public member functions
|
||||||
|
CMovementData_C(const C3Vector& position, float facing, const WOWGUID& guid, CGUnit_C* unit);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
15
src/object/client/CMovement_C.hpp
Normal file
15
src/object/client/CMovement_C.hpp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#ifndef OBJECT_CLIENT_C_MOVEMENT_C_HPP
|
||||||
|
#define OBJECT_CLIENT_C_MOVEMENT_C_HPP
|
||||||
|
|
||||||
|
#include "object/client/CMovementData_C.hpp"
|
||||||
|
#include "util/GUID.hpp"
|
||||||
|
#include <tempest/Vector.hpp>
|
||||||
|
|
||||||
|
class CMovement_C : public CMovementData_C {
|
||||||
|
public:
|
||||||
|
// Public member functions
|
||||||
|
CMovement_C(const C3Vector& position, float facing, const WOWGUID& guid, CGUnit_C* unit)
|
||||||
|
: CMovementData_C(position, facing, guid, unit) {};
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
15
src/object/movement/CMovementShared.cpp
Normal file
15
src/object/movement/CMovementShared.cpp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#include "object/movement/CMovementShared.hpp"
|
||||||
|
|
||||||
|
CMovementShared::CMovementShared(const WOWGUID& transportGUID, const C3Vector& position, float facing, const WOWGUID& guid)
|
||||||
|
: CPassenger(transportGUID, position, guid)
|
||||||
|
{
|
||||||
|
this->m_facing = facing;
|
||||||
|
|
||||||
|
this->m_anchorPosition = position;
|
||||||
|
this->m_anchorFacing = facing;
|
||||||
|
this->m_anchorPitch = 0.0f;
|
||||||
|
this->m_cosAnchorPitch = 1.0f;
|
||||||
|
this->m_sinAnchorPitch = 0.0f;
|
||||||
|
|
||||||
|
this->m_spline = nullptr;
|
||||||
|
}
|
||||||
31
src/object/movement/CMovementShared.hpp
Normal file
31
src/object/movement/CMovementShared.hpp
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#ifndef OBJECT_MOVEMENT_C_MOVEMENT_SHARED_HPP
|
||||||
|
#define OBJECT_MOVEMENT_C_MOVEMENT_SHARED_HPP
|
||||||
|
|
||||||
|
#include "object/movement/CPassenger.hpp"
|
||||||
|
#include "util/GUID.hpp"
|
||||||
|
#include <tempest/Vector.hpp>
|
||||||
|
|
||||||
|
struct CMoveSpline;
|
||||||
|
|
||||||
|
class CMovementShared : public CPassenger {
|
||||||
|
public:
|
||||||
|
// Public member functions
|
||||||
|
CMovementShared(const WOWGUID& transportGUID, const C3Vector& position, float facing, const WOWGUID& guid);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Protected member variables
|
||||||
|
// TODO
|
||||||
|
C3Vector m_anchorPosition;
|
||||||
|
float m_anchorFacing;
|
||||||
|
float m_anchorPitch;
|
||||||
|
// TODO
|
||||||
|
C3Vector m_direction;
|
||||||
|
C2Vector m_direction2d;
|
||||||
|
float m_cosAnchorPitch;
|
||||||
|
float m_sinAnchorPitch;
|
||||||
|
// TODO
|
||||||
|
CMoveSpline* m_spline;
|
||||||
|
// TODO
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@ -48,7 +48,7 @@ CDataStore& operator>>(CDataStore& msg, CMovementStatus& move) {
|
|||||||
msg.Get(move.uint14);
|
msg.Get(move.uint14);
|
||||||
msg.Get(move.uint0);
|
msg.Get(move.uint0);
|
||||||
|
|
||||||
msg >> move.position18;
|
msg >> move.position28;
|
||||||
msg.Get(move.facing34);
|
msg.Get(move.facing34);
|
||||||
|
|
||||||
if (move.moveFlags & 0x200) {
|
if (move.moveFlags & 0x200) {
|
||||||
|
|||||||
34
src/object/movement/CPassenger.cpp
Normal file
34
src/object/movement/CPassenger.cpp
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#include "object/movement/CPassenger.hpp"
|
||||||
|
#include <tempest/Matrix.hpp>
|
||||||
|
|
||||||
|
float CPassenger::GetFacing() const {
|
||||||
|
return this->GetFacing(this->m_facing);
|
||||||
|
}
|
||||||
|
|
||||||
|
float CPassenger::GetFacing(float facing) const {
|
||||||
|
// If on transport, transform facing by transport facing
|
||||||
|
if (this->m_transportGUID) {
|
||||||
|
float transportFacing = 0.0f;
|
||||||
|
// TODO MovementGetTransportFacing(this->m_transportGUID);
|
||||||
|
|
||||||
|
return facing + transportFacing;
|
||||||
|
}
|
||||||
|
|
||||||
|
return facing;
|
||||||
|
}
|
||||||
|
|
||||||
|
C3Vector CPassenger::GetPosition() const {
|
||||||
|
return this->GetPosition(this->m_position);
|
||||||
|
}
|
||||||
|
|
||||||
|
C3Vector CPassenger::GetPosition(const C3Vector& position) const {
|
||||||
|
// If on transport, transform position by transport matrix
|
||||||
|
if (this->m_transportGUID) {
|
||||||
|
C44Matrix transportMatrix;
|
||||||
|
// TODO MovementGetTransportMtxX(this->m_transportGUID, &transportMatrix);
|
||||||
|
|
||||||
|
return position * transportMatrix;
|
||||||
|
}
|
||||||
|
|
||||||
|
return position;
|
||||||
|
}
|
||||||
32
src/object/movement/CPassenger.hpp
Normal file
32
src/object/movement/CPassenger.hpp
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#ifndef OBJECT_MOVEMENT_C_PASSENGER_HPP
|
||||||
|
#define OBJECT_MOVEMENT_C_PASSENGER_HPP
|
||||||
|
|
||||||
|
#include "util/GUID.hpp"
|
||||||
|
#include <tempest/Vector.hpp>
|
||||||
|
|
||||||
|
class CPassenger {
|
||||||
|
public:
|
||||||
|
// Public member functions
|
||||||
|
CPassenger(const WOWGUID& transportGUID, const C3Vector& position, const WOWGUID& guid)
|
||||||
|
: m_transportGUID(transportGUID)
|
||||||
|
, m_position(position)
|
||||||
|
, m_facing(0.0f)
|
||||||
|
, m_guid(guid) {};
|
||||||
|
float GetFacing() const;
|
||||||
|
float GetFacing(float facing) const;
|
||||||
|
C3Vector GetPosition() const;
|
||||||
|
C3Vector GetPosition(const C3Vector& position) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Protected member variables
|
||||||
|
// TODO
|
||||||
|
WOWGUID m_transportGUID;
|
||||||
|
C3Vector m_position;
|
||||||
|
// TODO
|
||||||
|
float m_facing;
|
||||||
|
// TODO
|
||||||
|
const WOWGUID& m_guid;
|
||||||
|
// TODO
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@ -38,6 +38,9 @@ bool ValidateCameraView(CVar* var, const char* oldValue, const char* value, void
|
|||||||
}
|
}
|
||||||
|
|
||||||
CGCamera::CGCamera() : CSimpleCamera(CWorld::GetNearClip(), CWorld::GetFarClip(), 90.0f * CMath::DEG2RAD) {
|
CGCamera::CGCamera() : CSimpleCamera(CWorld::GetNearClip(), CWorld::GetFarClip(), 90.0f * CMath::DEG2RAD) {
|
||||||
|
this->m_model = nullptr;
|
||||||
|
|
||||||
|
this->m_target = 0;
|
||||||
this->m_relativeTo = 0;
|
this->m_relativeTo = 0;
|
||||||
|
|
||||||
this->m_view = s_cameraView->GetInt();
|
this->m_view = s_cameraView->GetInt();
|
||||||
@ -63,6 +66,14 @@ C3Vector CGCamera::Forward() const {
|
|||||||
return this->CSimpleCamera::Forward();
|
return this->CSimpleCamera::Forward();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const WOWGUID& CGCamera::GetTarget() const {
|
||||||
|
return this->m_target;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t CGCamera::HasModel() const {
|
||||||
|
return this->m_model != nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
C33Matrix CGCamera::ParentToWorld() const {
|
C33Matrix CGCamera::ParentToWorld() const {
|
||||||
// TODO
|
// TODO
|
||||||
return {};
|
return {};
|
||||||
@ -80,6 +91,10 @@ void CGCamera::SetupWorldProjection(const CRect& projRect) {
|
|||||||
this->SetGxProjectionAndView(projRect);
|
this->SetGxProjectionAndView(projRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
C3Vector CGCamera::Target() const {
|
||||||
|
return this->m_position + this->Forward();
|
||||||
|
}
|
||||||
|
|
||||||
C3Vector CGCamera::Up() const {
|
C3Vector CGCamera::Up() const {
|
||||||
if (this->m_relativeTo) {
|
if (this->m_relativeTo) {
|
||||||
return this->CSimpleCamera::Up() * this->ParentToWorld();
|
return this->CSimpleCamera::Up() * this->ParentToWorld();
|
||||||
|
|||||||
@ -4,6 +4,8 @@
|
|||||||
#include "ui/simple/CSimpleCamera.hpp"
|
#include "ui/simple/CSimpleCamera.hpp"
|
||||||
#include "util/GUID.hpp"
|
#include "util/GUID.hpp"
|
||||||
|
|
||||||
|
class CM2Model;
|
||||||
|
|
||||||
class CGCamera : public CSimpleCamera {
|
class CGCamera : public CSimpleCamera {
|
||||||
public:
|
public:
|
||||||
// Public structs
|
// Public structs
|
||||||
@ -25,11 +27,17 @@ class CGCamera : public CSimpleCamera {
|
|||||||
|
|
||||||
// Public member functions
|
// Public member functions
|
||||||
CGCamera();
|
CGCamera();
|
||||||
|
const WOWGUID& GetTarget() const;
|
||||||
|
int32_t HasModel() const;
|
||||||
C33Matrix ParentToWorld() const;
|
C33Matrix ParentToWorld() const;
|
||||||
void SetupWorldProjection(const CRect& projRect);
|
void SetupWorldProjection(const CRect& projRect);
|
||||||
|
C3Vector Target() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Private member variables
|
// Private member variables
|
||||||
|
CM2Model* m_model;
|
||||||
|
// TODO
|
||||||
|
WOWGUID m_target;
|
||||||
// TODO
|
// TODO
|
||||||
WOWGUID m_relativeTo;
|
WOWGUID m_relativeTo;
|
||||||
// TODO
|
// TODO
|
||||||
|
|||||||
@ -2,8 +2,10 @@
|
|||||||
#include "gx/Coordinate.hpp"
|
#include "gx/Coordinate.hpp"
|
||||||
#include "gx/Shader.hpp"
|
#include "gx/Shader.hpp"
|
||||||
#include "gx/Transform.hpp"
|
#include "gx/Transform.hpp"
|
||||||
|
#include "object/Client.hpp"
|
||||||
#include "ui/game/CGCamera.hpp"
|
#include "ui/game/CGCamera.hpp"
|
||||||
#include "ui/game/PlayerName.hpp"
|
#include "ui/game/PlayerName.hpp"
|
||||||
|
#include "world/World.hpp"
|
||||||
#include <storm/Memory.hpp>
|
#include <storm/Memory.hpp>
|
||||||
#include <tempest/Matrix.hpp>
|
#include <tempest/Matrix.hpp>
|
||||||
|
|
||||||
@ -92,7 +94,19 @@ void CGWorldFrame::OnWorldRender() {
|
|||||||
void CGWorldFrame::OnWorldUpdate() {
|
void CGWorldFrame::OnWorldUpdate() {
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
|
auto target = ClntObjMgrObjectPtr(this->m_camera->GetTarget(), TYPE_OBJECT, __FILE__, __LINE__);
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
|
||||||
this->m_camera->SetupWorldProjection(this->m_screenRect);
|
this->m_camera->SetupWorldProjection(this->m_screenRect);
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
|
auto targetPos = target && !this->m_camera->HasModel()
|
||||||
|
? target->GetPosition()
|
||||||
|
: this->m_camera->Position();
|
||||||
|
|
||||||
|
CWorld::Update(this->m_camera->Position(), this->m_camera->Target(), targetPos);
|
||||||
|
|
||||||
|
// TODO
|
||||||
}
|
}
|
||||||
|
|||||||
@ -84,6 +84,10 @@ C3Vector CSimpleCamera::Right() const {
|
|||||||
return { this->m_facing.b0, this->m_facing.b1, this->m_facing.b2 };
|
return { this->m_facing.b0, this->m_facing.b1, this->m_facing.b2 };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const C3Vector& CSimpleCamera::Position() const {
|
||||||
|
return this->m_position;
|
||||||
|
}
|
||||||
|
|
||||||
void CSimpleCamera::SetFacing(const C3Vector& forward) {
|
void CSimpleCamera::SetFacing(const C3Vector& forward) {
|
||||||
BuildBillboardMatrix(forward, this->m_facing);
|
BuildBillboardMatrix(forward, this->m_facing);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,6 +18,7 @@ class CSimpleCamera {
|
|||||||
// Public member functions
|
// Public member functions
|
||||||
CSimpleCamera(float nearZ, float farZ, float fov);
|
CSimpleCamera(float nearZ, float farZ, float fov);
|
||||||
CM2Scene* GetScene();
|
CM2Scene* GetScene();
|
||||||
|
const C3Vector& Position() const;
|
||||||
void SetFacing(const C3Vector& forward);
|
void SetFacing(const C3Vector& forward);
|
||||||
void SetFacing(const C3Vector& forward, const C3Vector& up);
|
void SetFacing(const C3Vector& forward, const C3Vector& up);
|
||||||
void SetFacing(float yaw, float pitch, float roll);
|
void SetFacing(float yaw, float pitch, float roll);
|
||||||
|
|||||||
@ -213,3 +213,7 @@ void CWorld::SetUpdateTime(float tickTimeSec, uint32_t curTimeMs) {
|
|||||||
CWorld::s_tickTimeMs = static_cast<uint32_t>(tickTimeSec * 1000.0f);
|
CWorld::s_tickTimeMs = static_cast<uint32_t>(tickTimeSec * 1000.0f);
|
||||||
CWorld::s_tickTimeSec = tickTimeSec;
|
CWorld::s_tickTimeSec = tickTimeSec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CWorld::Update(const C3Vector& cameraPos, const C3Vector& cameraTarget, const C3Vector& targetPos) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|||||||
@ -70,6 +70,7 @@ class CWorld {
|
|||||||
static int32_t OnTick(const EVENT_DATA_TICK* data, void* param);
|
static int32_t OnTick(const EVENT_DATA_TICK* data, void* param);
|
||||||
static void SetFarClip(float farClip);
|
static void SetFarClip(float farClip);
|
||||||
static void SetUpdateTime(float tickTimeSec, uint32_t curTimeMs);
|
static void SetUpdateTime(float tickTimeSec, uint32_t curTimeMs);
|
||||||
|
static void Update(const C3Vector& cameraPos, const C3Vector& cameraTarget, const C3Vector& targetPos);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Private static variables
|
// Private static variables
|
||||||
|
|||||||
@ -23,6 +23,8 @@ if(WHOA_SYSTEM_MAC)
|
|||||||
"-framework AppKit"
|
"-framework AppKit"
|
||||||
"-framework Carbon"
|
"-framework Carbon"
|
||||||
"-framework IOKit"
|
"-framework IOKit"
|
||||||
|
"-framework Metal"
|
||||||
|
"-framework QuartzCore"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user