mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-12-08 18:36:00 +03:00
Compare commits
No commits in common. "6c5c560dc785153a550d535da3e9fcbae576617b" and "b1694c2897fccfd5e430129e39ed20a0552b9a9f" have entirely different histories.
6c5c560dc7
...
b1694c2897
@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
#include <bc/Memory.hpp>
|
#include <bc/Memory.hpp>
|
||||||
#include <tempest/Matrix.hpp>
|
#include <tempest/Matrix.hpp>
|
||||||
#include <common/Time.hpp>
|
|
||||||
|
|
||||||
|
|
||||||
CGWorldFrame* CGWorldFrame::s_currentWorldFrame = nullptr;
|
CGWorldFrame* CGWorldFrame::s_currentWorldFrame = nullptr;
|
||||||
@ -119,17 +118,7 @@ int32_t CGWorldFrame::OnLayerKeyDown(const CKeyEvent& evt) {
|
|||||||
|
|
||||||
this->m_camera->SetFacing(yaw, pitch, roll);
|
this->m_camera->SetFacing(yaw, pitch, roll);
|
||||||
|
|
||||||
return 1;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGWorldFrame::OnLayerKeyDownRepeat(const CKeyEvent& evt) {
|
|
||||||
if (CSimpleFrame::OnLayerKeyDownRepeat(evt)) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
this->OnLayerKeyDown(evt);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CSimpleFrame* CGWorldFrame::Create(CSimpleFrame* parent) {
|
CSimpleFrame* CGWorldFrame::Create(CSimpleFrame* parent) {
|
||||||
@ -177,7 +166,7 @@ void CGWorldFrame::OnWorldRender() {
|
|||||||
GxRsSet(GxRs_Multisample, 1);
|
GxRsSet(GxRs_Multisample, 1);
|
||||||
|
|
||||||
if (true) {
|
if (true) {
|
||||||
CImVector clearColor = { 0x80, 0x80, 0x80, 0xFF };
|
CImVector clearColor = { 0, 0, 0, 0xFF };
|
||||||
GxSceneClear(3, clearColor);
|
GxSceneClear(3, clearColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,11 +187,7 @@ void CGWorldFrame::OnWorldRender() {
|
|||||||
|
|
||||||
CShaderEffect::UpdateProjMatrix();
|
CShaderEffect::UpdateProjMatrix();
|
||||||
|
|
||||||
static auto s_time = 0;
|
CWorld::Render(C3Vector(), 0.0f);
|
||||||
|
|
||||||
float elapsed = static_cast<float>(OsGetAsyncTimeMs() - s_time) / 1000.0f;
|
|
||||||
s_time = OsGetAsyncTimeMs();
|
|
||||||
CWorld::Render(C3Vector(), elapsed);
|
|
||||||
|
|
||||||
if (CWorldScene::s_m2Scene) {
|
if (CWorldScene::s_m2Scene) {
|
||||||
CWorldScene::s_m2Scene->Draw(M2PASS_0);
|
CWorldScene::s_m2Scene->Draw(M2PASS_0);
|
||||||
|
|||||||
@ -12,7 +12,6 @@ class CGWorldFrame : public CSimpleFrame {
|
|||||||
|
|
||||||
virtual void OnFrameRender(CRenderBatch* batch, uint32_t layer);
|
virtual void OnFrameRender(CRenderBatch* batch, uint32_t layer);
|
||||||
virtual int32_t OnLayerKeyDown(const CKeyEvent& evt);
|
virtual int32_t OnLayerKeyDown(const CKeyEvent& evt);
|
||||||
virtual int32_t OnLayerKeyDownRepeat(const CKeyEvent& evt);
|
|
||||||
|
|
||||||
static CSimpleFrame* Create(CSimpleFrame* parent);
|
static CSimpleFrame* Create(CSimpleFrame* parent);
|
||||||
static void RenderWorld(void* param);
|
static void RenderWorld(void* param);
|
||||||
|
|||||||
@ -1015,7 +1015,7 @@ void CGxDeviceD3d::ICursorClip(int32_t a1) {
|
|||||||
if (a1) {
|
if (a1) {
|
||||||
this->m_hwCursorNeedsUpdate = 1;
|
this->m_hwCursorNeedsUpdate = 1;
|
||||||
|
|
||||||
if (this->m_format.window == 0) {
|
if (this->m_format.window) {
|
||||||
RECT windowRect;
|
RECT windowRect;
|
||||||
GetWindowRect(this->m_hwnd, &windowRect);
|
GetWindowRect(this->m_hwnd, &windowRect);
|
||||||
ClipCursor(&windowRect);
|
ClipCursor(&windowRect);
|
||||||
|
|||||||
@ -891,23 +891,6 @@ int32_t CSimpleEditBox::OnLayerKeyDown(const CKeyEvent& evt) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleEditBox::OnLayerKeyDownRepeat(const CKeyEvent& evt) {
|
|
||||||
if (!this->m_visible) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!CSimpleEditBox::s_currentFocus && this->m_autoFocus) {
|
|
||||||
CSimpleEditBox::SetKeyboardFocus(this);
|
|
||||||
return this->OnLayerKeyDown(evt);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this == CSimpleEditBox::s_currentFocus) {
|
|
||||||
return this->OnLayerKeyDown(evt);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CSimpleEditBox::OnLayerMouseDown(const CMouseEvent& evt, const char* btn) {
|
int32_t CSimpleEditBox::OnLayerMouseDown(const CMouseEvent& evt, const char* btn) {
|
||||||
int32_t eaten = CSimpleFrame::OnLayerMouseDown(evt, btn);
|
int32_t eaten = CSimpleFrame::OnLayerMouseDown(evt, btn);
|
||||||
|
|
||||||
|
|||||||
@ -72,7 +72,6 @@ class CSimpleEditBox : public CSimpleFrame, CSimpleFontedFrame {
|
|||||||
virtual void OnFrameSizeChanged(float width, float height);
|
virtual void OnFrameSizeChanged(float width, float height);
|
||||||
virtual int32_t OnLayerChar(const CCharEvent& evt);
|
virtual int32_t OnLayerChar(const CCharEvent& evt);
|
||||||
virtual int32_t OnLayerKeyDown(const CKeyEvent& evt);
|
virtual int32_t OnLayerKeyDown(const CKeyEvent& evt);
|
||||||
virtual int32_t OnLayerKeyDownRepeat(const CKeyEvent& evt);
|
|
||||||
virtual int32_t OnLayerMouseDown(const CMouseEvent& evt, const char* btn);
|
virtual int32_t OnLayerMouseDown(const CMouseEvent& evt, const char* btn);
|
||||||
virtual int32_t OnLayerMouseUp(const CMouseEvent& evt, const char* btn);
|
virtual int32_t OnLayerMouseUp(const CMouseEvent& evt, const char* btn);
|
||||||
virtual void FontUpdated(CSimpleFontedFrameFont* font, int32_t a3);
|
virtual void FontUpdated(CSimpleFontedFrameFont* font, int32_t a3);
|
||||||
|
|||||||
@ -1091,10 +1091,6 @@ int32_t CSimpleFrame::OnLayerKeyUp(const CKeyEvent& evt) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleFrame::OnLayerKeyDownRepeat(const CKeyEvent& evt) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CSimpleFrame::OnLayerMouseDown(const CMouseEvent& evt, const char* btn) {
|
int32_t CSimpleFrame::OnLayerMouseDown(const CMouseEvent& evt, const char* btn) {
|
||||||
if (!btn) {
|
if (!btn) {
|
||||||
if (this->m_lookForDrag & evt.button) {
|
if (this->m_lookForDrag & evt.button) {
|
||||||
|
|||||||
@ -100,7 +100,6 @@ class CSimpleFrame : public CScriptRegion {
|
|||||||
virtual int32_t OnLayerChar(const CCharEvent& evt);
|
virtual int32_t OnLayerChar(const CCharEvent& evt);
|
||||||
virtual int32_t OnLayerKeyDown(const CKeyEvent& evt);
|
virtual int32_t OnLayerKeyDown(const CKeyEvent& evt);
|
||||||
virtual int32_t OnLayerKeyUp(const CKeyEvent& evt);
|
virtual int32_t OnLayerKeyUp(const CKeyEvent& evt);
|
||||||
virtual int32_t OnLayerKeyDownRepeat(const CKeyEvent& evt);
|
|
||||||
virtual int32_t OnLayerMouseDown(const CMouseEvent& evt, const char* btn);
|
virtual int32_t OnLayerMouseDown(const CMouseEvent& evt, const char* btn);
|
||||||
virtual int32_t OnLayerMouseUp(const CMouseEvent& evt, const char* btn);
|
virtual int32_t OnLayerMouseUp(const CMouseEvent& evt, const char* btn);
|
||||||
virtual void PostLoadXML(XMLNode* node, CStatus* status);
|
virtual void PostLoadXML(XMLNode* node, CStatus* status);
|
||||||
|
|||||||
@ -124,25 +124,9 @@ int32_t CSimpleTop::OnKeyDown(const EVENT_DATA_KEY* pKeyData, void* param) {
|
|||||||
return eaten == 0;
|
return eaten == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleTop::OnKeyDownRepeat(const EVENT_DATA_KEY* pKeyData, void* param) {
|
int32_t CSimpleTop::OnKeyDownRepeat(const void* a1, void* a2) {
|
||||||
CSimpleTop* top = static_cast<CSimpleTop*>(param);
|
// TODO
|
||||||
CSimpleTop::m_eventTime = pKeyData->time;
|
return 0;
|
||||||
|
|
||||||
int32_t eaten = 0;
|
|
||||||
|
|
||||||
CSimpleFrame* frame = top->m_keydownCapture[pKeyData->key];
|
|
||||||
|
|
||||||
if (frame) {
|
|
||||||
CKeyEvent keyEvent;
|
|
||||||
keyEvent = *pKeyData;
|
|
||||||
keyEvent.id = 0x40060065;
|
|
||||||
|
|
||||||
frame->OnLayerKeyDownRepeat(keyEvent);
|
|
||||||
|
|
||||||
eaten = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return eaten == 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleTop::OnKeyUp(const EVENT_DATA_KEY* pKeyData, void* param) {
|
int32_t CSimpleTop::OnKeyUp(const EVENT_DATA_KEY* pKeyData, void* param) {
|
||||||
|
|||||||
@ -36,7 +36,7 @@ class CSimpleTop : public CLayoutFrame {
|
|||||||
static int32_t OnFocusChanged(const void* a1, void* a2);
|
static int32_t OnFocusChanged(const void* a1, void* a2);
|
||||||
static int32_t OnIme(const void* a1, void* a2);
|
static int32_t OnIme(const void* a1, void* a2);
|
||||||
static int32_t OnKeyDown(const EVENT_DATA_KEY* pKeyData, void* param);
|
static int32_t OnKeyDown(const EVENT_DATA_KEY* pKeyData, void* param);
|
||||||
static int32_t OnKeyDownRepeat(const EVENT_DATA_KEY* pKeyData, void* param);
|
static int32_t OnKeyDownRepeat(const void* a1, void* a2);
|
||||||
static int32_t OnKeyUp(const EVENT_DATA_KEY* pKeyData, void* param);
|
static int32_t OnKeyUp(const EVENT_DATA_KEY* pKeyData, void* param);
|
||||||
static int32_t OnMouseDown(const EVENT_DATA_MOUSE* pMouseData, void* param);
|
static int32_t OnMouseDown(const EVENT_DATA_MOUSE* pMouseData, void* param);
|
||||||
static int32_t OnMouseMove(const EVENT_DATA_MOUSE* pMouseData, void* param);
|
static int32_t OnMouseMove(const EVENT_DATA_MOUSE* pMouseData, void* param);
|
||||||
|
|||||||
@ -17,42 +17,14 @@
|
|||||||
|
|
||||||
|
|
||||||
CM2Scene* CWorldScene::s_m2Scene;
|
CM2Scene* CWorldScene::s_m2Scene;
|
||||||
HTEXTURE CWorldScene::s_defaultTexture;
|
|
||||||
HTEXTURE CWorldScene::s_defaultBlendTexture;
|
|
||||||
|
|
||||||
CM2Model* g_models[10] = {};
|
|
||||||
|
|
||||||
void CWorldSceneLightingCallback(CM2Model* model, CM2Lighting* lighting, void* userArg) {
|
|
||||||
lighting->AddAmbient({ 1.0f, 1.0f, 1.0f });
|
|
||||||
lighting->AddDiffuse({ 1.0f, 1.0f, 1.0f }, { 1.0f, 0.0f, 0.0f });
|
|
||||||
lighting->AddSpecular({ 0.0f, 0.0f, 0.0f });
|
|
||||||
}
|
|
||||||
|
|
||||||
void CWorldScene::Initialize() {
|
void CWorldScene::Initialize() {
|
||||||
// TODO
|
// TODO
|
||||||
CWorldScene::s_m2Scene = M2CreateScene();
|
CWorldScene::s_m2Scene = M2CreateScene();
|
||||||
g_models[0] = CWorldScene::s_m2Scene->CreateModel(R"(World\LORDAERON\Arathi\PassiveDoodads\Trees\ArathiStump01.m2)", 0);
|
auto model = CWorldScene::s_m2Scene->CreateModel("Spells\\ErrorCube.mdx", 0);
|
||||||
g_models[0]->SetWorldTransform(C3Vector(0.0f, 1.0f, 0.0f), 180.0f, 0.1f);
|
model->SetAnimating(1);
|
||||||
|
model->SetVisible(1);
|
||||||
g_models[1] = CWorldScene::s_m2Scene->CreateModel(R"(World\NoDXT\Detail\ApkBus01.m2)", 0);
|
|
||||||
g_models[1]->SetWorldTransform(C3Vector(0.0f, 1.5f, 0.0f), 180.0f, 1.0f);
|
|
||||||
|
|
||||||
g_models[2] = CWorldScene::s_m2Scene->CreateModel(R"(Creature\BloodElfGuard\BloodElfMale_Guard.m2)", 0);
|
|
||||||
g_models[2]->SetWorldTransform(C3Vector(0.0f), 180.0f, 1.0f);
|
|
||||||
|
|
||||||
g_models[3] = CWorldScene::s_m2Scene->CreateModel(R"(World\AZEROTH\ELWYNN\PASSIVEDOODADS\Trees\ElwynnTree01\ElwynnPine01.m2)", 0);
|
|
||||||
g_models[3]->SetWorldTransform(C3Vector(0.0f, -1.0f, 0.0f), 180.0f, 1.0f);
|
|
||||||
|
|
||||||
for (size_t i = 0; i < 10; ++i) {
|
|
||||||
if (!g_models[i])
|
|
||||||
continue;
|
|
||||||
|
|
||||||
g_models[i]->SetBoneSequence(0xFFFFFFFF, 0, 0xFFFFFFFF, 0, 1.0f, 1, 1);
|
|
||||||
g_models[i]->SetLightingCallback(&CWorldSceneLightingCallback, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
CWorldScene::s_defaultTexture = TextureCreateSolid({ 0x80, 0x80, 0x80, 0xFF });
|
|
||||||
CWorldScene::s_defaultBlendTexture = TextureCreateSolid({ 0, 0, 0, 0xFF });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWorldScene::Render(const C3Vector& cameraPos, float time) {
|
void CWorldScene::Render(const C3Vector& cameraPos, float time) {
|
||||||
@ -65,25 +37,12 @@ void CWorldScene::Render(const C3Vector& cameraPos, float time) {
|
|||||||
|
|
||||||
|
|
||||||
if (CWorldScene::s_m2Scene) {
|
if (CWorldScene::s_m2Scene) {
|
||||||
for (size_t i = 0; i < 10; ++i) {
|
|
||||||
if (!g_models[i])
|
|
||||||
continue;
|
|
||||||
g_models[i]->SetAnimating(1);
|
|
||||||
g_models[i]->SetVisible(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
CWorldScene::s_m2Scene->m_flags |= 1u;
|
CWorldScene::s_m2Scene->m_flags |= 1u;
|
||||||
CWorldScene::s_m2Scene->AdvanceTime(static_cast<uint32_t>(time * 1000.0f));
|
CWorldScene::s_m2Scene->AdvanceTime(static_cast<uint32_t>(time * 1000.0f));
|
||||||
CWorldScene::s_m2Scene->Animate(cameraPos);
|
CWorldScene::s_m2Scene->Animate(cameraPos);
|
||||||
CWorldScene::s_m2Scene->m_flags &= ~1u;
|
CWorldScene::s_m2Scene->m_flags &= ~1u;
|
||||||
}
|
}
|
||||||
|
|
||||||
// sub_6FDA20();
|
|
||||||
// sub_7BB570();
|
|
||||||
|
|
||||||
CShaderEffect::UpdateProjMatrix();
|
|
||||||
// CWorldScene::RenderSetFog();
|
|
||||||
|
|
||||||
DayNight::Update();
|
DayNight::Update();
|
||||||
DayNight::RenderSky();
|
DayNight::RenderSky();
|
||||||
|
|
||||||
|
|||||||
@ -4,16 +4,11 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <tempest/Vector.hpp>
|
#include <tempest/Vector.hpp>
|
||||||
|
|
||||||
#include "gx/Texture.hpp"
|
|
||||||
|
|
||||||
class CM2Scene;
|
class CM2Scene;
|
||||||
|
|
||||||
class CWorldScene {
|
class CWorldScene {
|
||||||
public:
|
public:
|
||||||
static CM2Scene* s_m2Scene;
|
static CM2Scene* s_m2Scene;
|
||||||
static HTEXTURE s_defaultTexture;
|
|
||||||
static HTEXTURE s_defaultBlendTexture;
|
|
||||||
|
|
||||||
|
|
||||||
static void Initialize();
|
static void Initialize();
|
||||||
static void Render(const C3Vector& cameraPos, float time);
|
static void Render(const C3Vector& cameraPos, float time);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user