mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-18 05:31:07 +03:00
Compare commits
13 Commits
9e28841cec
...
7e5bf0c8ec
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7e5bf0c8ec | ||
|
|
abf9eb3b05 | ||
|
|
00d340c242 | ||
|
|
d3d4fa884f | ||
|
|
7082e8db17 | ||
|
|
8935c520c0 | ||
|
|
7cf7127810 | ||
|
|
8fb51991e0 | ||
|
|
7fdd22545f | ||
|
|
15eafe92d7 | ||
|
|
1ad3679f90 | ||
|
|
81970958a8 | ||
|
|
a9cad5238d |
@ -1 +1 @@
|
|||||||
Subproject commit 1e5366bbc6935e3363abf5921f0be12f902e790a
|
Subproject commit c6ee931690f71362ab76602fb6f34a6cf23d12b8
|
||||||
@ -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
|
||||||
|
|||||||
@ -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
@ -111,6 +111,14 @@ C3Vector CGObject_C::GetPosition() const {
|
|||||||
return { 0.0f, 0.0f, 0.0f };
|
return { 0.0f, 0.0f, 0.0f };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float CGObject_C::GetRawFacing() const {
|
||||||
|
return this->GetFacing();
|
||||||
|
}
|
||||||
|
|
||||||
|
WOWGUID CGObject_C::GetTransportGUID() const {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t CGObject_C::IsInReenable() {
|
int32_t CGObject_C::IsInReenable() {
|
||||||
return this->m_inReenable;
|
return this->m_inReenable;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,6 +39,9 @@ class CGObject_C : public CGObject, public TSHashObject<CGObject_C, CHashKeyGUID
|
|||||||
virtual C3Vector GetPosition() const;
|
virtual C3Vector GetPosition() const;
|
||||||
// TODO
|
// TODO
|
||||||
virtual float GetFacing() const;
|
virtual float GetFacing() const;
|
||||||
|
virtual float GetRawFacing() const;
|
||||||
|
// TODO
|
||||||
|
virtual WOWGUID GetTransportGUID() const;
|
||||||
// TODO
|
// TODO
|
||||||
virtual int32_t GetModelFileName(const char*& name) const;
|
virtual int32_t GetModelFileName(const char*& name) const;
|
||||||
// TODO
|
// TODO
|
||||||
|
|||||||
@ -42,6 +42,10 @@ C3Vector CGUnit::GetPosition() const {
|
|||||||
return this->m_move->GetPosition();
|
return this->m_move->GetPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float CGUnit::GetRawFacing() const {
|
||||||
|
return this->m_move->GetRawFacing();
|
||||||
|
}
|
||||||
|
|
||||||
CGUnitData* CGUnit::Unit() const {
|
CGUnitData* CGUnit::Unit() const {
|
||||||
return this->m_unit;
|
return this->m_unit;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -92,6 +92,7 @@ class CGUnit {
|
|||||||
float GetFacing() const;
|
float GetFacing() const;
|
||||||
int32_t GetNativeDisplayID() const;
|
int32_t GetNativeDisplayID() const;
|
||||||
C3Vector GetPosition() const;
|
C3Vector GetPosition() const;
|
||||||
|
float GetRawFacing() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Protected member variables
|
// Protected member variables
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
#include "object/client/CGUnit_C.hpp"
|
#include "object/client/CGUnit_C.hpp"
|
||||||
#include "component/CCharacterComponent.hpp"
|
#include "component/CCharacterComponent.hpp"
|
||||||
|
#include "db/Db.hpp"
|
||||||
#include "model/Model2.hpp"
|
#include "model/Model2.hpp"
|
||||||
#include "object/client/ObjMgr.hpp"
|
#include "object/client/ObjMgr.hpp"
|
||||||
#include "db/Db.hpp"
|
|
||||||
#include "ui/Game.hpp"
|
#include "ui/Game.hpp"
|
||||||
#include <storm/Error.hpp>
|
#include <storm/Error.hpp>
|
||||||
|
#include <tempest/Math.hpp>
|
||||||
|
|
||||||
WOWGUID CGUnit_C::s_activeMover;
|
WOWGUID CGUnit_C::s_activeMover;
|
||||||
|
|
||||||
@ -183,6 +184,18 @@ C3Vector CGUnit_C::GetPosition() const {
|
|||||||
return this->CGUnit::GetPosition();
|
return this->CGUnit::GetPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float CGUnit_C::GetRawFacing() const {
|
||||||
|
return this->CGUnit::GetRawFacing();
|
||||||
|
}
|
||||||
|
|
||||||
|
float CGUnit_C::GetRawSmoothFacing() const {
|
||||||
|
return this->m_smoothFacing;
|
||||||
|
}
|
||||||
|
|
||||||
|
WOWGUID CGUnit_C::GetTransportGUID() const {
|
||||||
|
return this->m_localMove.GetTransportGUID();
|
||||||
|
}
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
@ -200,6 +213,10 @@ void CGUnit_C::PostInit(uint32_t time, const CClientObjCreate& init, bool a4) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
|
this->m_smoothFacing = CMath::normalizeangle0to2pi(this->GetRawFacing());
|
||||||
|
|
||||||
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGUnit_C::PostMovementUpdate(const CClientMoveUpdate& move, int32_t activeMover) {
|
void CGUnit_C::PostMovementUpdate(const CClientMoveUpdate& move, int32_t activeMover) {
|
||||||
|
|||||||
@ -31,6 +31,9 @@ class CGUnit_C : public CGObject_C, public CGUnit {
|
|||||||
virtual C3Vector GetPosition() const;
|
virtual C3Vector GetPosition() const;
|
||||||
// TODO
|
// TODO
|
||||||
virtual float GetFacing() const;
|
virtual float GetFacing() const;
|
||||||
|
virtual float GetRawFacing() const;
|
||||||
|
// TODO
|
||||||
|
virtual WOWGUID GetTransportGUID() const;
|
||||||
// TODO
|
// TODO
|
||||||
virtual int32_t GetModelFileName(const char*& name) const;
|
virtual int32_t GetModelFileName(const char*& name) const;
|
||||||
// TODO
|
// TODO
|
||||||
@ -42,6 +45,7 @@ class CGUnit_C : public CGObject_C, public CGUnit {
|
|||||||
CGUnit_C(uint32_t time, CClientObjCreate& objCreate);
|
CGUnit_C(uint32_t time, CClientObjCreate& objCreate);
|
||||||
int32_t GetDisplayID() const;
|
int32_t GetDisplayID() const;
|
||||||
CreatureModelDataRec* GetModelData() const;
|
CreatureModelDataRec* GetModelData() const;
|
||||||
|
float GetRawSmoothFacing() const;
|
||||||
void PostInit(uint32_t time, const CClientObjCreate& init, bool a4);
|
void PostInit(uint32_t time, const CClientObjCreate& init, bool a4);
|
||||||
void PostMovementUpdate(const CClientMoveUpdate& move, int32_t activeMover);
|
void PostMovementUpdate(const CClientMoveUpdate& move, int32_t activeMover);
|
||||||
void SetStorage(uint32_t* storage, uint32_t* saved);
|
void SetStorage(uint32_t* storage, uint32_t* saved);
|
||||||
@ -65,6 +69,8 @@ class CGUnit_C : public CGObject_C, public CGUnit {
|
|||||||
// TODO
|
// TODO
|
||||||
int32_t m_localDisplayID = 0;
|
int32_t m_localDisplayID = 0;
|
||||||
// TODO
|
// TODO
|
||||||
|
float m_smoothFacing;
|
||||||
|
// TODO
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
6
src/object/client/CVehicleCamera_C.cpp
Normal file
6
src/object/client/CVehicleCamera_C.cpp
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#include "object/client/CVehicleCamera_C.hpp"
|
||||||
|
#include "object/client/CGObject_C.hpp"
|
||||||
|
|
||||||
|
int32_t CVehicleCamera_C::ConvertSmoothFacingFromRawToWorld(float& smoothFacing, CGObject_C* relativeTo) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
13
src/object/client/CVehicleCamera_C.hpp
Normal file
13
src/object/client/CVehicleCamera_C.hpp
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#ifndef OBJECT_CLIENT_C_VEHICLE_CAMERA_C_HPP
|
||||||
|
#define OBJECT_CLIENT_C_VEHICLE_CAMERA_C_HPP
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
class CGObject_C;
|
||||||
|
|
||||||
|
class CVehicleCamera_C {
|
||||||
|
public:
|
||||||
|
// Public static functions
|
||||||
|
static int32_t ConvertSmoothFacingFromRawToWorld(float& smoothFacing, CGObject_C* relativeTo);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@ -32,3 +32,11 @@ C3Vector CPassenger::GetPosition(const C3Vector& position) const {
|
|||||||
|
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float CPassenger::GetRawFacing() const {
|
||||||
|
return this->m_facing;
|
||||||
|
}
|
||||||
|
|
||||||
|
WOWGUID CPassenger::GetTransportGUID() const {
|
||||||
|
return this->m_transportGUID;
|
||||||
|
}
|
||||||
|
|||||||
@ -16,6 +16,8 @@ class CPassenger {
|
|||||||
float GetFacing(float facing) const;
|
float GetFacing(float facing) const;
|
||||||
C3Vector GetPosition() const;
|
C3Vector GetPosition() const;
|
||||||
C3Vector GetPosition(const C3Vector& position) const;
|
C3Vector GetPosition(const C3Vector& position) const;
|
||||||
|
float GetRawFacing() const;
|
||||||
|
WOWGUID GetTransportGUID() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Protected member variables
|
// Protected member variables
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
#include "ui/game/CGCamera.hpp"
|
#include "ui/game/CGCamera.hpp"
|
||||||
#include "ui/game/Types.hpp"
|
|
||||||
#include "console/CVar.hpp"
|
#include "console/CVar.hpp"
|
||||||
|
#include "object/Client.hpp"
|
||||||
|
#include "object/client/CVehicleCamera_C.hpp"
|
||||||
|
#include "ui/game/Types.hpp"
|
||||||
#include "world/World.hpp"
|
#include "world/World.hpp"
|
||||||
|
#include <algorithm>
|
||||||
#include <storm/String.hpp>
|
#include <storm/String.hpp>
|
||||||
#include <tempest/Math.hpp>
|
#include <tempest/Math.hpp>
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
static CVar* s_cameraView;
|
static CVar* s_cameraView;
|
||||||
|
|
||||||
@ -75,8 +77,23 @@ int32_t CGCamera::HasModel() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
C33Matrix CGCamera::ParentToWorld() const {
|
C33Matrix CGCamera::ParentToWorld() const {
|
||||||
// TODO
|
auto relativeTo = ClntObjMgrObjectPtr(this->m_relativeTo, TYPE_OBJECT, __FILE__, __LINE__);
|
||||||
return {};
|
|
||||||
|
if (!relativeTo) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
float facing;
|
||||||
|
|
||||||
|
if (relativeTo->IsA(TYPE_UNIT)) {
|
||||||
|
facing = static_cast<CGUnit_C*>(relativeTo)->GetRawSmoothFacing();
|
||||||
|
auto transport = ClntObjMgrObjectPtr(relativeTo->GetTransportGUID(), TYPE_OBJECT, __FILE__, __LINE__);
|
||||||
|
CVehicleCamera_C::ConvertSmoothFacingFromRawToWorld(facing, transport);
|
||||||
|
} else {
|
||||||
|
facing = relativeTo->GetFacing();
|
||||||
|
}
|
||||||
|
|
||||||
|
return C33Matrix::RotationAroundZ(facing);
|
||||||
}
|
}
|
||||||
|
|
||||||
C3Vector CGCamera::Right() const {
|
C3Vector CGCamera::Right() const {
|
||||||
|
|||||||
@ -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