mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-18 13:41:06 +03:00
Compare commits
17 Commits
8bd4e08c80
...
0c0c936874
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0c0c936874 | ||
|
|
f8f00b599e | ||
|
|
703dc26df7 | ||
|
|
09c016c935 | ||
|
|
2145348935 | ||
|
|
50685c7cc0 | ||
|
|
b3c07f0607 | ||
|
|
6bcaec1fe7 | ||
|
|
4628b7d831 | ||
|
|
8935c520c0 | ||
|
|
7cf7127810 | ||
|
|
8fb51991e0 | ||
|
|
7fdd22545f | ||
|
|
15eafe92d7 | ||
|
|
1ad3679f90 | ||
|
|
81970958a8 | ||
|
|
a9cad5238d |
@ -1 +1 @@
|
||||
Subproject commit dc8f10e407daa8bdf7e90d9438b55d5883780825
|
||||
Subproject commit 4ba7e0a6c3836254daf97bab159807fae6cab039
|
||||
@ -32,6 +32,8 @@ if(WHOA_SYSTEM_MAC)
|
||||
"-framework AppKit"
|
||||
"-framework Carbon"
|
||||
"-framework IOKit"
|
||||
"-framework Metal"
|
||||
"-framework QuartzCore"
|
||||
)
|
||||
|
||||
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/EngineGLLayerView.h"
|
||||
#include "app/mac/EngineMTLLayerView.h"
|
||||
#include "app/mac/WindowCallbacks.h"
|
||||
#include "gx/gll/GLWindow.h"
|
||||
#include "gx/Device.hpp"
|
||||
|
||||
GLWindowCallbacks EngineViewCallbacks = {
|
||||
&MacOnResized,
|
||||
@ -23,5 +25,9 @@ void AssignEngineViewCallbacks(GLWindowCallbacks* callbacks) {
|
||||
}
|
||||
|
||||
Class GetEngineViewClass() {
|
||||
if (GxDevApi() == GxApi_Metal) {
|
||||
return [EngineMTLLayerView class];
|
||||
}
|
||||
|
||||
return [EngineGLLayerView class];
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
#include "app/mac/MacClient.h"
|
||||
#include "event/Input.hpp"
|
||||
#include "gx/gll/CGxDeviceGLL.hpp"
|
||||
#include "gx/mtl/CGxDeviceMTL.hpp"
|
||||
#include "gx/Device.hpp"
|
||||
#include "gx/Window.hpp"
|
||||
#include <bc/Debug.hpp>
|
||||
@ -171,7 +172,11 @@ void MacOnResized(int32_t width, int32_t height, bool a3) {
|
||||
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);
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
#include "gx/Adapter.hpp"
|
||||
#include "gx/Device.hpp"
|
||||
#include <storm/Array.hpp>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
static CGxDevice* s_device;
|
||||
@ -417,6 +418,13 @@ void ConsoleDeviceInitialize(const char* title) {
|
||||
api = GxApi_GLL;
|
||||
#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);
|
||||
|
||||
// TODO
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
|
||||
#if defined(WHOA_SYSTEM_MAC)
|
||||
#include "gx/gll/CGxDeviceGLL.hpp"
|
||||
#include "gx/mtl/CGxDeviceMTL.hpp"
|
||||
#include "gx/mac/Display.hpp"
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
#include <OpenGL/OpenGL.h>
|
||||
@ -117,6 +118,8 @@ int32_t CGxDevice::AdapterFormats(EGxApi api, TSGrowableArray<CGxFormat>& adapte
|
||||
CGxDevice::OpenGlAdapterFormats(adapterFormats);
|
||||
} else if (api == GxApi_GLL) {
|
||||
CGxDevice::GLLAdapterFormats(adapterFormats);
|
||||
} else if (api == GxApi_Metal) {
|
||||
CGxDevice::OpenGlAdapterFormats(adapterFormats);
|
||||
}
|
||||
|
||||
#elif defined(WHOA_SYSTEM_LINUX)
|
||||
@ -228,6 +231,11 @@ CGxDevice* CGxDevice::NewGLL() {
|
||||
auto m = SMemAlloc(sizeof(CGxDeviceGLL), __FILE__, __LINE__, 0x0);
|
||||
return new (m) CGxDeviceGLL();
|
||||
}
|
||||
|
||||
CGxDevice* CGxDevice::NewMTL() {
|
||||
auto m = SMemAlloc(sizeof(CGxDeviceMTL), __FILE__, __LINE__, 0x0);
|
||||
return new (m) CGxDeviceMTL();
|
||||
}
|
||||
#endif
|
||||
|
||||
CGxDevice* CGxDevice::NewOpenGl() {
|
||||
|
||||
@ -70,6 +70,7 @@ class CGxDevice {
|
||||
#endif
|
||||
#if defined(WHOA_SYSTEM_MAC)
|
||||
static CGxDevice* NewGLL();
|
||||
static CGxDevice* NewMTL();
|
||||
#endif
|
||||
static CGxDevice* NewOpenGl();
|
||||
static void OpenGlAdapterFormats(TSGrowableArray<CGxFormat>& adapterFormats);
|
||||
|
||||
@ -20,6 +20,7 @@ if(WHOA_SYSTEM_MAC)
|
||||
file(GLOB MAC_SOURCES
|
||||
"gll/*.cpp"
|
||||
"gll/*.mm"
|
||||
"mtl/*.mm"
|
||||
"mac/*.cpp"
|
||||
)
|
||||
|
||||
|
||||
@ -24,6 +24,8 @@ CGxDevice* GxDevCreate(EGxApi api, int32_t (*windowProc)(void* window, uint32_t
|
||||
device = CGxDevice::NewOpenGl();
|
||||
} else if (api == GxApi_GLL) {
|
||||
device = CGxDevice::NewGLL();
|
||||
} else if (api == GxApi_Metal) {
|
||||
device = CGxDevice::NewMTL();
|
||||
} else {
|
||||
// Error
|
||||
}
|
||||
|
||||
@ -35,7 +35,8 @@ enum EGxApi {
|
||||
GxApi_D3d10 = 3,
|
||||
GxApi_D3d11 = 4,
|
||||
GxApi_GLL = 5,
|
||||
GxApis_Last = 6
|
||||
GxApi_Metal = 6,
|
||||
GxApis_Last = 7
|
||||
};
|
||||
|
||||
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
@ -1,4 +1,5 @@
|
||||
#include "ui/simple/CSimpleCamera.hpp"
|
||||
#include "gx/Transform.hpp"
|
||||
#include "model/Model2.hpp"
|
||||
#include <tempest/Math.hpp>
|
||||
|
||||
@ -63,7 +64,7 @@ CSimpleCamera::CSimpleCamera(float nearZ, float farZ, float fov) {
|
||||
this->SetFacing(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
float CSimpleCamera::FOV() {
|
||||
float CSimpleCamera::FOV() const {
|
||||
return this->m_fov;
|
||||
}
|
||||
|
||||
@ -107,6 +108,25 @@ void CSimpleCamera::SetNearZ(float nearZ) {
|
||||
this->m_nearZ = nearZ;
|
||||
}
|
||||
|
||||
void CSimpleCamera::SetGxProjectionAndView(const CRect& projRect) {
|
||||
// Projection
|
||||
|
||||
this->m_aspect = (projRect.maxX - projRect.minX) / (projRect.maxY - projRect.minY);
|
||||
|
||||
C44Matrix projMat;
|
||||
GxuXformCreateProjection_Exact(this->FOV() * 0.6f, this->m_aspect, this->m_nearZ, this->m_farZ, projMat);
|
||||
|
||||
GxXformSetProjection(projMat);
|
||||
|
||||
// View
|
||||
|
||||
C3Vector eye;
|
||||
C44Matrix viewMat;
|
||||
GxuXformCreateLookAtSgCompat(eye, this->Forward(), this->Up(), viewMat);
|
||||
|
||||
GxXformSetView(viewMat);
|
||||
}
|
||||
|
||||
C3Vector CSimpleCamera::Up() const {
|
||||
return { this->m_facing.c0, this->m_facing.c1, this->m_facing.c2 };
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
#define UI_SIMPLE_C_SIMPLE_CAMERA_HPP
|
||||
|
||||
#include <tempest/Matrix.hpp>
|
||||
#include <tempest/Rect.hpp>
|
||||
#include <tempest/Vector.hpp>
|
||||
|
||||
class CM2Scene;
|
||||
@ -9,7 +10,7 @@ class CM2Scene;
|
||||
class CSimpleCamera {
|
||||
public:
|
||||
// Virtual public member functions
|
||||
virtual float FOV();
|
||||
virtual float FOV() const;
|
||||
virtual C3Vector Forward() const;
|
||||
virtual C3Vector Right() const;
|
||||
virtual C3Vector Up() const;
|
||||
@ -22,6 +23,7 @@ class CSimpleCamera {
|
||||
void SetFacing(float yaw, float pitch, float roll);
|
||||
void SetFarZ(float farZ);
|
||||
void SetFieldOfView(float fov);
|
||||
void SetGxProjectionAndView(const CRect& projRect);
|
||||
void SetNearZ(float nearZ);
|
||||
|
||||
protected:
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
#include "gx/Gx.hpp"
|
||||
#include "gx/Shader.hpp"
|
||||
#include "model/Model2.hpp"
|
||||
#include "world/CWorldParam.hpp"
|
||||
#include "world/Map.hpp"
|
||||
#include "world/Weather.hpp"
|
||||
#include <storm/Memory.hpp>
|
||||
@ -10,14 +11,36 @@ uint32_t CWorld::s_curTimeMs;
|
||||
float CWorld::s_curTimeSec;
|
||||
uint32_t CWorld::s_enables;
|
||||
uint32_t CWorld::s_enables2;
|
||||
float CWorld::s_farClip;
|
||||
uint32_t CWorld::s_gameTimeFixed;
|
||||
float CWorld::s_gameTimeSec;
|
||||
CM2Scene* CWorld::s_m2Scene;
|
||||
float CWorld::s_nearClip = 0.1f;
|
||||
float CWorld::s_prevFarClip;
|
||||
uint32_t CWorld::s_tickTimeFixed;
|
||||
uint32_t CWorld::s_tickTimeMs;
|
||||
float CWorld::s_tickTimeSec;
|
||||
Weather* CWorld::s_weather;
|
||||
|
||||
namespace {
|
||||
|
||||
float AdjustFarClip(float farClip, int32_t mapID) {
|
||||
float minFarClip = 183.33333f;
|
||||
float maxFarClip = 1583.3334f;
|
||||
|
||||
if (mapID < 530 || mapID == 575 || mapID == 543) {
|
||||
if (!CWorldParam::cvar_farClipOverride || CWorldParam::cvar_farClipOverride->GetInt() < 1) {
|
||||
maxFarClip = 791.66669f;
|
||||
}
|
||||
} else if (false /* TODO OsGetPhysicalMemory() <= 1073741824 */) {
|
||||
maxFarClip = 791.66669f;
|
||||
}
|
||||
|
||||
return std::min(std::max(farClip, minFarClip), maxFarClip);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
HWORLDOBJECT CWorld::AddObject(CM2Model* model, void* handler, void* handlerParam, uint64_t param64, uint32_t param32, uint32_t objFlags) {
|
||||
auto entity = CMap::AllocEntity(objFlags & 0x8 ? true : false);
|
||||
|
||||
@ -55,6 +78,10 @@ float CWorld::GetCurTimeSec() {
|
||||
return CWorld::s_curTimeSec;
|
||||
}
|
||||
|
||||
float CWorld::GetFarClip() {
|
||||
return CWorld::s_farClip;
|
||||
}
|
||||
|
||||
uint32_t CWorld::GetFixedPrecisionTime(float timeSec) {
|
||||
return static_cast<uint32_t>(timeSec * 1024.0f);
|
||||
}
|
||||
@ -71,6 +98,10 @@ CM2Scene* CWorld::GetM2Scene() {
|
||||
return CWorld::s_m2Scene;
|
||||
}
|
||||
|
||||
float CWorld::GetNearClip() {
|
||||
return CWorld::s_nearClip;
|
||||
}
|
||||
|
||||
uint32_t CWorld::GetTickTimeFixed() {
|
||||
return CWorld::s_tickTimeFixed;
|
||||
}
|
||||
@ -133,10 +164,14 @@ void CWorld::Initialize() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void CWorld::LoadMap(const char* mapName, const C3Vector& position, int32_t zoneID) {
|
||||
void CWorld::LoadMap(const char* mapName, const C3Vector& position, int32_t mapID) {
|
||||
CWorld::s_farClip = AdjustFarClip(CWorldParam::cvar_farClip->GetFloat(), mapID);
|
||||
CWorld::s_nearClip = 0.2f;
|
||||
CWorld::s_prevFarClip = CWorld::s_farClip;
|
||||
|
||||
// TODO
|
||||
|
||||
CMap::Load(mapName, zoneID);
|
||||
CMap::Load(mapName, mapID);
|
||||
|
||||
// TODO
|
||||
}
|
||||
@ -147,6 +182,24 @@ int32_t CWorld::OnTick(const EVENT_DATA_TICK* data, void* param) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
void CWorld::SetFarClip(float farClip) {
|
||||
farClip = AdjustFarClip(farClip, CMap::s_mapID);
|
||||
|
||||
if (CWorld::s_farClip == farClip) {
|
||||
return;
|
||||
}
|
||||
|
||||
CWorld::s_prevFarClip = CWorld::s_farClip;
|
||||
CWorld::s_farClip = farClip;
|
||||
|
||||
// TODO CMapRenderChunk::DirtyPools();
|
||||
|
||||
CWorld::s_nearClip = 0.2f;
|
||||
|
||||
// TODO dword_D1C410 = 1;
|
||||
// TODO dword_ADEEE0 = 1;
|
||||
}
|
||||
|
||||
void CWorld::SetUpdateTime(float tickTimeSec, uint32_t curTimeMs) {
|
||||
auto tickTimeFixed = CWorld::GetFixedPrecisionTime(tickTimeSec);
|
||||
|
||||
|
||||
@ -57,24 +57,30 @@ class CWorld {
|
||||
static HWORLDOBJECT AddObject(CM2Model* model, void* handler, void* handlerParam, uint64_t param64, uint32_t param32, uint32_t objFlags);
|
||||
static uint32_t GetCurTimeMs();
|
||||
static float GetCurTimeSec();
|
||||
static float GetFarClip();
|
||||
static uint32_t GetGameTimeFixed();
|
||||
static float GetGameTimeSec();
|
||||
static CM2Scene* GetM2Scene();
|
||||
static float GetNearClip();
|
||||
static uint32_t GetTickTimeFixed();
|
||||
static uint32_t GetTickTimeMs();
|
||||
static float GetTickTimeSec();
|
||||
static void Initialize();
|
||||
static void LoadMap(const char* mapName, const C3Vector& position, int32_t zoneID);
|
||||
static void LoadMap(const char* mapName, const C3Vector& position, int32_t mapID);
|
||||
static int32_t OnTick(const EVENT_DATA_TICK* data, void* param);
|
||||
static void SetFarClip(float farClip);
|
||||
static void SetUpdateTime(float tickTimeSec, uint32_t curTimeMs);
|
||||
|
||||
private:
|
||||
// Private static variables
|
||||
static uint32_t s_curTimeMs;
|
||||
static float s_curTimeSec;
|
||||
static float s_farClip;
|
||||
static uint32_t s_gameTimeFixed;
|
||||
static float s_gameTimeSec;
|
||||
static CM2Scene* s_m2Scene;
|
||||
static float s_nearClip;
|
||||
static float s_prevFarClip;
|
||||
static uint32_t s_tickTimeFixed;
|
||||
static uint32_t s_tickTimeMs;
|
||||
static float s_tickTimeSec;
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
#include "world/CWorldParam.hpp"
|
||||
#include "world/CWorld.hpp"
|
||||
#include "console/CVar.hpp"
|
||||
|
||||
CVar* CWorldParam::cvar_baseMip;
|
||||
@ -53,7 +54,8 @@ bool CWorldParam::ExtShadowQualityCallback(CVar* var, const char* oldValue, cons
|
||||
}
|
||||
|
||||
bool CWorldParam::FarClipCallback(CVar* var, const char* oldValue, const char* value, void* arg) {
|
||||
// TODO
|
||||
CWorld::SetFarClip(SStrToFloat(value));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#ifndef WORLD_C_WORLD_PARAM_HPP
|
||||
#define WORLD_C_WORLD_PARAM_HPP
|
||||
|
||||
class CVar;
|
||||
#include "console/CVar.hpp"
|
||||
|
||||
class CWorldParam {
|
||||
public:
|
||||
|
||||
@ -28,6 +28,7 @@ uint32_t* CMap::s_mapObjDefGroupHeap;
|
||||
uint32_t* CMap::s_mapObjDefHeap;
|
||||
uint32_t* CMap::s_mapObjGroupHeap;
|
||||
uint32_t* CMap::s_mapObjHeap;
|
||||
int32_t CMap::s_mapID = -1;
|
||||
char CMap::s_mapName[256];
|
||||
char CMap::s_mapPath[256];
|
||||
char CMap::s_wdtFilename[256];
|
||||
@ -61,7 +62,7 @@ void CMap::Initialize() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void CMap::Load(const char* mapName, int32_t zoneID) {
|
||||
void CMap::Load(const char* mapName, int32_t mapID) {
|
||||
// TODO
|
||||
|
||||
auto nameOfs = SStrCopy(CMap::s_mapPath, "World\\Maps\\");
|
||||
@ -72,6 +73,10 @@ void CMap::Load(const char* mapName, int32_t zoneID) {
|
||||
SStrPrintf(CMap::s_wdtFilename, sizeof(CMap::s_wdtFilename), "%s\\%s.wdt", CMap::s_mapPath, CMap::s_mapName);
|
||||
|
||||
// TODO
|
||||
|
||||
CMap::s_mapID = mapID;
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
void CMap::MapMemInitialize() {
|
||||
|
||||
@ -23,6 +23,7 @@ class CMap {
|
||||
static uint32_t* s_mapObjDefHeap;
|
||||
static uint32_t* s_mapObjGroupHeap;
|
||||
static uint32_t* s_mapObjHeap;
|
||||
static int32_t s_mapID;
|
||||
static char s_mapName[];
|
||||
static char s_mapPath[];
|
||||
static char s_wdtFilename[];
|
||||
@ -30,7 +31,7 @@ class CMap {
|
||||
// Static functions
|
||||
static CMapEntity* AllocEntity(int32_t a1);
|
||||
static void Initialize();
|
||||
static void Load(const char* mapName, int32_t zoneID);
|
||||
static void Load(const char* mapName, int32_t mapID);
|
||||
static void MapMemInitialize();
|
||||
};
|
||||
|
||||
|
||||
@ -23,6 +23,8 @@ if(WHOA_SYSTEM_MAC)
|
||||
"-framework AppKit"
|
||||
"-framework Carbon"
|
||||
"-framework IOKit"
|
||||
"-framework Metal"
|
||||
"-framework QuartzCore"
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user