mirror of https://github.com/AxioDL/metaforce.git
More stubs for GuiSys
This commit is contained in:
parent
8cb4bacb17
commit
5054cd1d8a
|
@ -30,7 +30,7 @@ void ViewManager::BuildTestPART(urde::IObjectStore& objStore)
|
|||
m_lineRenderer.reset(new urde::CLineRenderer(urde::CLineRenderer::EPrimitiveMode::LineStrip, 4, nullptr, true));
|
||||
*/
|
||||
m_particleView.reset(new ParticleView(*this, m_viewResources, *m_rootView));
|
||||
m_moviePlayer.reset(new CMoviePlayer("Video/SpecialEnding.thp", -1.f, false, true));
|
||||
m_moviePlayer.reset(new CMoviePlayer("Video/SpecialEnding.thp", 1.f, false, true));
|
||||
m_moviePlayer->SetFrame({-1.0f, 1.0f, 0.f}, {-1.0f, -1.0f, 0.f}, {1.0f, -1.0f, 0.f}, {1.0f, 1.0f, 0.f});
|
||||
CDvdFile testRSF("Audio/frontend_1.rsf");
|
||||
u64 rsfLen = testRSF.Length();
|
||||
|
|
|
@ -49,7 +49,9 @@ BOO_GLSL_BINDING_HEAD
|
|||
" yuv.r = 1.1643*(yuv.r-0.0625);\n"
|
||||
" yuv.g = yuv.g-0.5;\n"
|
||||
" yuv.b = yuv.b-0.5;\n"
|
||||
" colorOut = vec4(yuv.r+1.5958*yuv.b, yuv.r-0.39173*yuv.g-0.81290*yuv.b, yuv.r+2.017*yuv.g, 1.0) * vtf.color;\n"
|
||||
" colorOut = vec4(yuv.r+1.5958*yuv.b,\n"
|
||||
" yuv.r-0.39173*yuv.g-0.81290*yuv.b,\n"
|
||||
" yuv.r+2.017*yuv.g, 1.0) * vtf.color;\n"
|
||||
"}\n";
|
||||
|
||||
static const char* VS_HLSL_YUV =
|
||||
|
@ -92,7 +94,9 @@ static const char* FS_HLSL_YUV =
|
|||
" yuv.r = 1.1643*(yuv.r-0.0625);\n"
|
||||
" yuv.g = yuv.g-0.5;\n"
|
||||
" yuv.b = yuv.b-0.5;\n"
|
||||
" return float4(yuv.r+1.5958*yuv.b, yuv.r-0.39173*yuv.g-0.81290*yuv.b, yuv.r+2.017*yuv.g, 1.0) * vtf.color;\n"
|
||||
" return float4(yuv.r+1.5958*yuv.b,\n"
|
||||
" yuv.r-0.39173*yuv.g-0.81290*yuv.b,\n"
|
||||
" yuv.r+2.017*yuv.g, 1.0) * vtf.color;\n"
|
||||
"}\n";
|
||||
|
||||
static const char* VS_METAL_YUV =
|
||||
|
@ -141,9 +145,13 @@ static const char* FS_METAL_YUV =
|
|||
" yuv.r = 1.1643*(yuv.r-0.0625);\n"
|
||||
" yuv.g = yuv.g-0.5;\n"
|
||||
" yuv.b = yuv.b-0.5;\n"
|
||||
" return float4(yuv.r+1.5958*yuv.b, yuv.r-0.39173*yuv.g-0.81290*yuv.b, yuv.r+2.017*yuv.g, 1.0) * vtf.color;\n"
|
||||
" return float4(yuv.r+1.5958*yuv.b,\n"
|
||||
" yuv.r-0.39173*yuv.g-0.81290*yuv.b,\n"
|
||||
" yuv.r+2.017*yuv.g, 1.0) * vtf.color;\n"
|
||||
"}\n";
|
||||
|
||||
/* used in the original to look up fixed-point dividends on a
|
||||
* MIDI-style volume scale (0-127) -> (n/0x8000) */
|
||||
static const u16 StaticVolumeLookup[] =
|
||||
{
|
||||
0x0000, 0x0002, 0x0008, 0x0012, 0x0020, 0x0032, 0x0049, 0x0063,
|
||||
|
@ -164,18 +172,19 @@ static const u16 StaticVolumeLookup[] =
|
|||
0x7247, 0x7430, 0x761E, 0x7810, 0x7A06, 0x7C00, 0x7DFE, 0x8000
|
||||
};
|
||||
|
||||
/* shared boo resources */
|
||||
static boo::GraphicsDataToken GraphicsData;
|
||||
static boo::IVertexFormat* YUVVTXFmt = nullptr;
|
||||
static boo::IShaderPipeline* YUVShaderPipeline = nullptr;
|
||||
static tjhandle TjHandle = nullptr;
|
||||
|
||||
/* RSF audio state */
|
||||
static const u8* StaticAudio = nullptr;
|
||||
static u32 StaticAudioSize = 0;
|
||||
static u32 StaticAudioOffset = 0;
|
||||
static u16 StaticVolumeAtten = 0x50F4;
|
||||
static u32 StaticLoopBegin = 0;
|
||||
static u32 StaticLoopEnd = 0;
|
||||
|
||||
static g72x_state StaticStateLeft = {};
|
||||
static g72x_state StaticStateRight = {};
|
||||
|
||||
|
@ -344,6 +353,7 @@ u32 CMoviePlayer::THPAudioDecode(s16* buffer, const u8* audioFrame, bool stereo)
|
|||
CMoviePlayer::CMoviePlayer(const char* path, float preLoadSeconds, bool loop, bool deinterlace)
|
||||
: CDvdFile(path), xec_preLoadSeconds(preLoadSeconds), xf4_24_loop(loop), m_deinterlace(deinterlace)
|
||||
{
|
||||
/* Read THP header information */
|
||||
u8 buf[64];
|
||||
SyncRead(buf, 64);
|
||||
memcpy(&x28_thpHead, buf, 48);
|
||||
|
@ -376,6 +386,7 @@ CMoviePlayer::CMoviePlayer(const char* path, float preLoadSeconds, bool loop, bo
|
|||
}
|
||||
}
|
||||
|
||||
/* Initial read state */
|
||||
xb4_nextReadOff = x28_thpHead.firstFrameOffset;
|
||||
xb0_nextReadSize = x28_thpHead.firstFrameSize;
|
||||
xb8_readSizeWrapped = x28_thpHead.firstFrameSize;
|
||||
|
@ -399,6 +410,7 @@ CMoviePlayer::CMoviePlayer(const char* path, float preLoadSeconds, bool loop, bo
|
|||
if (xf0_preLoadFrames > 0)
|
||||
xa0_bufferQueue.reserve(xf0_preLoadFrames);
|
||||
|
||||
/* Establish GPU resources */
|
||||
m_blockBuf = CGraphics::g_BooFactory->newDynamicBuffer(boo::BufferUse::Uniform,
|
||||
sizeof(m_viewVertBlock), 1);
|
||||
m_vertBuf = CGraphics::g_BooFactory->newDynamicBuffer(boo::BufferUse::Vertex,
|
||||
|
@ -415,6 +427,7 @@ CMoviePlayer::CMoviePlayer(const char* path, float preLoadSeconds, bool loop, bo
|
|||
vtxFmt = CGraphics::g_BooFactory->newVertexFormat(2, texvdescs);
|
||||
}
|
||||
|
||||
/* Allocate textures here (rather than at decode time) */
|
||||
x80_textures.reserve(3);
|
||||
for (int i=0 ; i<3 ; ++i)
|
||||
{
|
||||
|
@ -422,6 +435,7 @@ CMoviePlayer::CMoviePlayer(const char* path, float preLoadSeconds, bool loop, bo
|
|||
CTHPTextureSet& set = x80_textures.back();
|
||||
if (deinterlace)
|
||||
{
|
||||
/* urde addition: this way interlaced THPs don't look horrible */
|
||||
set.Y[0] = CGraphics::g_BooFactory->newDynamicTexture(x6c_videoInfo.width,
|
||||
x6c_videoInfo.height / 2,
|
||||
boo::TextureFormat::I8);
|
||||
|
@ -445,6 +459,7 @@ CMoviePlayer::CMoviePlayer(const char* path, float preLoadSeconds, bool loop, bo
|
|||
}
|
||||
else
|
||||
{
|
||||
/* normal progressive presentation */
|
||||
set.Y[0] = CGraphics::g_BooFactory->newDynamicTexture(x6c_videoInfo.width,
|
||||
x6c_videoInfo.height,
|
||||
boo::TextureFormat::I8);
|
||||
|
@ -464,9 +479,13 @@ CMoviePlayer::CMoviePlayer(const char* path, float preLoadSeconds, bool loop, bo
|
|||
set.audioBuf.reset(new s16[x28_thpHead.maxAudioSamples * 2]);
|
||||
}
|
||||
|
||||
/* Temporary planar YUV decode buffer, resulting planes copied to Boo */
|
||||
m_yuvBuf.reset(new uint8_t[tjBufSizeYUV(x6c_videoInfo.width, x6c_videoInfo.height, TJ_420)]);
|
||||
|
||||
/* All set for GPU resources */
|
||||
m_token = CGraphics::CommitResources();
|
||||
|
||||
/* Schedule initial read */
|
||||
PostDVDReadRequestIfNeeded();
|
||||
|
||||
m_frame[0].m_uv = {0.f, 0.f};
|
||||
|
@ -497,6 +516,7 @@ void CMoviePlayer::SetStaticAudio(const void* data, u32 size, u32 loopBegin, u32
|
|||
|
||||
void CMoviePlayer::MixAudio(s16* out, const s16* in, u32 samples)
|
||||
{
|
||||
/* No audio frames ready */
|
||||
if (xd4_audioSlot == -1)
|
||||
{
|
||||
if (in)
|
||||
|
@ -512,6 +532,7 @@ void CMoviePlayer::MixAudio(s16* out, const s16* in, u32 samples)
|
|||
u32 thisSamples = std::min(tex->audioSamples - tex->playedSamples, samples);
|
||||
if (!thisSamples)
|
||||
{
|
||||
/* Advance frame */
|
||||
++xd4_audioSlot;
|
||||
if (xd4_audioSlot >= x80_textures.size())
|
||||
xd4_audioSlot = 0;
|
||||
|
@ -520,6 +541,7 @@ void CMoviePlayer::MixAudio(s16* out, const s16* in, u32 samples)
|
|||
}
|
||||
if (thisSamples)
|
||||
{
|
||||
/* mix samples with `in` or no mix */
|
||||
if (in)
|
||||
{
|
||||
for (u32 i=0 ; i<thisSamples ; ++i, out += 2, in += 2)
|
||||
|
@ -545,6 +567,7 @@ void CMoviePlayer::MixAudio(s16* out, const s16* in, u32 samples)
|
|||
}
|
||||
else
|
||||
{
|
||||
/* urde addition: failsafe for buffer overrun */
|
||||
if (in)
|
||||
memcpy(out, in, samples * 4);
|
||||
else
|
||||
|
@ -565,6 +588,7 @@ void CMoviePlayer::MixStaticAudio(s16* out, const s16* in, u32 samples)
|
|||
const u8* thisOffsetLeft = &StaticAudio[StaticAudioOffset/2];
|
||||
const u8* thisOffsetRight = &StaticAudio[StaticAudioSize/2 + StaticAudioOffset/2];
|
||||
|
||||
/* urde addition: mix samples with `in` or no mix */
|
||||
if (in)
|
||||
{
|
||||
for (u32 i=0 ; i<thisSamples ; i+=2)
|
||||
|
@ -646,12 +670,18 @@ void CMoviePlayer::DrawFrame()
|
|||
{
|
||||
if (xd0_drawTexSlot == -1)
|
||||
return;
|
||||
|
||||
/* draw appropriate field */
|
||||
CTHPTextureSet& tex = x80_textures[xd0_drawTexSlot];
|
||||
CGraphics::g_BooMainCommandQueue->setShaderDataBinding
|
||||
(tex.binding[m_deinterlace ? (xfc_fieldIndex != 0) : 0]);
|
||||
CGraphics::g_BooMainCommandQueue->draw(0, 4);
|
||||
|
||||
/* ensure second field is being displayed by VI to signal advance
|
||||
* (faked in urde with continuous xor) */
|
||||
if (!xfc_fieldIndex && CGraphics::g_LastFrameUsedAbove)
|
||||
xf4_26_fieldFlip = true;
|
||||
|
||||
++xfc_fieldIndex;
|
||||
}
|
||||
|
||||
|
@ -659,6 +689,7 @@ void CMoviePlayer::Update(float dt)
|
|||
{
|
||||
if (xc0_curLoadFrame < xf0_preLoadFrames)
|
||||
{
|
||||
/* in buffering phase, ensure read data is stored for mem-cache access */
|
||||
if (x98_request && x98_request->IsComplete())
|
||||
{
|
||||
ReadCompleted();
|
||||
|
@ -672,6 +703,7 @@ void CMoviePlayer::Update(float dt)
|
|||
}
|
||||
else
|
||||
{
|
||||
/* out of buffering phase, skip mem-cache straight to decode */
|
||||
if (x98_request)
|
||||
{
|
||||
bool flag = false;
|
||||
|
@ -691,12 +723,15 @@ void CMoviePlayer::Update(float dt)
|
|||
}
|
||||
}
|
||||
|
||||
/* submit request for additional read to keep stream-consumer happy
|
||||
* (if buffer slot is available) */
|
||||
if (!x98_request && xe0_playMode == EPlayMode::Playing &&
|
||||
xa0_bufferQueue.size() < x28_thpHead.numFrames)
|
||||
{
|
||||
PostDVDReadRequestIfNeeded();
|
||||
}
|
||||
|
||||
/* decode frame directly from mem-cache if needed */
|
||||
if (xd8_decodedTexCount < 2)
|
||||
{
|
||||
if (xe0_playMode == EPlayMode::Playing && xc4_requestFrameWrapped < xf0_preLoadFrames)
|
||||
|
@ -713,21 +748,25 @@ void CMoviePlayer::Update(float dt)
|
|||
}
|
||||
}
|
||||
|
||||
/* paused THPs shall not pass */
|
||||
if (xd8_decodedTexCount <= 0 || xe0_playMode != EPlayMode::Playing)
|
||||
return;
|
||||
|
||||
/* timing update */
|
||||
xe8_curSeconds += dt;
|
||||
if (xf4_24_loop)
|
||||
xe8_curSeconds = std::fmod(xe8_curSeconds, xe4_totalSeconds);
|
||||
else
|
||||
xe8_curSeconds = std::min(xe4_totalSeconds, xe8_curSeconds);
|
||||
|
||||
/* test remainder threshold, determine if frame needs to be advanced */
|
||||
float frameDt = 1.f / x28_thpHead.fps;
|
||||
float rem = xdc_frameRem - dt;
|
||||
if (rem <= 0.f)
|
||||
{
|
||||
if (!xf4_26_fieldFlip)
|
||||
{
|
||||
/* second field has drawn, advance consumer-queue to next THP frame */
|
||||
++xd0_drawTexSlot;
|
||||
if (xd0_drawTexSlot >= x80_textures.size())
|
||||
xd0_drawTexSlot = 0;
|
||||
|
@ -742,6 +781,7 @@ void CMoviePlayer::Update(float dt)
|
|||
}
|
||||
else
|
||||
{
|
||||
/* advance timing within second field */
|
||||
rem += dt;
|
||||
xf4_26_fieldFlip = false;
|
||||
}
|
||||
|
@ -815,6 +855,7 @@ void CMoviePlayer::DecodeFromRead(const void* data)
|
|||
}
|
||||
}
|
||||
|
||||
/* advance YUV producer-queue slot */
|
||||
++xcc_decodedTexSlot;
|
||||
if (xcc_decodedTexSlot == x80_textures.size())
|
||||
xcc_decodedTexSlot = 0;
|
||||
|
@ -826,9 +867,12 @@ void CMoviePlayer::ReadCompleted()
|
|||
x98_request.reset();
|
||||
const THPFrameHeader* frameHeader =
|
||||
reinterpret_cast<const THPFrameHeader*>(buffer.get());
|
||||
|
||||
/* transfer request buffer to mem-cache if needed */
|
||||
if (xc0_curLoadFrame == xa0_bufferQueue.size() && xf0_preLoadFrames > xc0_curLoadFrame)
|
||||
xa0_bufferQueue.push_back(std::move(buffer));
|
||||
|
||||
/* store params of next read operation */
|
||||
xb4_nextReadOff += xb0_nextReadSize;
|
||||
xb0_nextReadSize = hecl::SBig(frameHeader->nextSize);
|
||||
++xc0_curLoadFrame;
|
||||
|
@ -847,6 +891,7 @@ void CMoviePlayer::ReadCompleted()
|
|||
}
|
||||
}
|
||||
|
||||
/* handle loop-event read */
|
||||
if (xc0_curLoadFrame >= x28_thpHead.numFrames && xf4_24_loop)
|
||||
{
|
||||
xb4_nextReadOff = xbc_readOffWrapped;
|
||||
|
|
|
@ -135,16 +135,19 @@ private:
|
|||
|
||||
specter::View::TexShaderVert m_frame[4];
|
||||
|
||||
public:
|
||||
static u32 THPAudioDecode(s16* buffer, const u8* audioFrame, bool stereo);
|
||||
void DecodeFromRead(const void* data);
|
||||
void ReadCompleted();
|
||||
void PostDVDReadRequestIfNeeded();
|
||||
|
||||
public:
|
||||
CMoviePlayer(const char* path, float preLoadSeconds, bool loop, bool deinterlace);
|
||||
|
||||
static u32 THPAudioDecode(s16* buffer, const u8* audioFrame, bool stereo);
|
||||
static void DisableStaticAudio() {SetStaticAudio(nullptr, 0, 0, 0);}
|
||||
static void SetStaticAudioVolume(int vol);
|
||||
static void SetStaticAudio(const void* data, u32 size, u32 loopBegin, u32 loopEnd);
|
||||
void MixAudio(s16* out, const s16* in, u32 samples);
|
||||
static void MixStaticAudio(s16* out, const s16* in, u32 samples);
|
||||
void MixAudio(s16* out, const s16* in, u32 samples);
|
||||
void Rewind();
|
||||
|
||||
bool GetIsMovieFinishedPlaying() const
|
||||
|
@ -161,9 +164,6 @@ public:
|
|||
const zeus::CVector3f& c, const zeus::CVector3f& d);
|
||||
void DrawFrame();
|
||||
void Update(float dt);
|
||||
void DecodeFromRead(const void* data);
|
||||
void ReadCompleted();
|
||||
void PostDVDReadRequestIfNeeded();
|
||||
|
||||
static void Initialize();
|
||||
static void Shutdown();
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef __URDE_CAUIENERGYBAR_HPP__
|
||||
#define __URDE_CAUIENERGYBAR_HPP__
|
||||
|
||||
#include "CGuiWidget.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
class CAuiEnergyBarT01 : public CGuiWidget
|
||||
{
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CAUIENERGYBAR_HPP__
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef __URDE_CAUIIMAGEPANE_HPP__
|
||||
#define __URDE_CAUIIMAGEPANE_HPP__
|
||||
|
||||
#include "CGuiWidget.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
class CAuiImagePane : public CGuiWidget
|
||||
{
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CAUIIMAGEPANE_HPP__
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef __URDE_CAUIMETER_HPP__
|
||||
#define __URDE_CAUIMETER_HPP__
|
||||
|
||||
#include "CGuiCompoundWidget.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
class CAuiMeter : public CGuiCompoundWidget
|
||||
{
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CAUIMETER_HPP__
|
|
@ -0,0 +1,71 @@
|
|||
#ifndef __URDE_CGUIANIMBASE_HPP__
|
||||
#define __URDE_CGUIANIMBASE_HPP__
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CGuiAnimController;
|
||||
class CGuiWidgetDrawParams;
|
||||
class CGuiRandomVar;
|
||||
|
||||
enum class EGuiAnimType
|
||||
{
|
||||
Rotation = 0,
|
||||
Translation = 1,
|
||||
Scaling = 2,
|
||||
Shearing = 3,
|
||||
Dissolve = 4,
|
||||
Keyframe = 5,
|
||||
Particles = 6,
|
||||
SFX = 9
|
||||
};
|
||||
|
||||
class CGuiAnimBase
|
||||
{
|
||||
const CGuiRandomVar& x30_randomVar;
|
||||
public:
|
||||
virtual ~CGuiAnimBase() = default;
|
||||
CGuiAnimBase(float, const CGuiRandomVar&, bool);
|
||||
|
||||
virtual void AnimInit(const CGuiAnimController* controller, float);
|
||||
virtual void AnimUpdate(CGuiAnimController* controller, float dt);
|
||||
virtual void AnimDraw(const CGuiWidgetDrawParams& params) const;
|
||||
virtual void CalcInitVelocity(const CGuiAnimController* controller);
|
||||
virtual void GetAnimType(const CGuiAnimController* controller) const;
|
||||
virtual void GetItFinishedLoading() const {return true;}
|
||||
};
|
||||
|
||||
class CGuiAnimRotation : public CGuiAnimBase
|
||||
{
|
||||
};
|
||||
|
||||
class CGuiAnimTranslation : public CGuiAnimBase
|
||||
{
|
||||
};
|
||||
|
||||
class CGuiAnimScaling : public CGuiAnimBase
|
||||
{
|
||||
};
|
||||
|
||||
class CGuiAnimShearing : public CGuiAnimBase
|
||||
{
|
||||
};
|
||||
|
||||
class CGuiAnimDissolve : public CGuiAnimBase
|
||||
{
|
||||
};
|
||||
|
||||
class CGuiAnimKeyframe : public CGuiAnimBase
|
||||
{
|
||||
};
|
||||
|
||||
class CGuiAnimParticles : public CGuiAnimBase
|
||||
{
|
||||
};
|
||||
|
||||
class CGuiAnimSFX : public CGuiAnimBase
|
||||
{
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CGUIANIMBASE_HPP__
|
|
@ -0,0 +1,17 @@
|
|||
#ifndef __URDE_CGUIANIMCONTROLLER_HPP__
|
||||
#define __URDE_CGUIANIMCONTROLLER_HPP__
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
class CGuiAnimSet
|
||||
{
|
||||
};
|
||||
|
||||
class CGuiAnimController
|
||||
{
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CGUIANIMCONTROLLER_HPP__
|
|
@ -0,0 +1,10 @@
|
|||
#ifndef __URDE_CGUIAUTOREPEATDATA_HPP__
|
||||
#define __URDE_CGUIAUTOREPEATDATA_HPP__
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CGUIAUTOREPEATDATA_HPP__
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef __URDE_CGUICAMERA_HPP__
|
||||
#define __URDE_CGUICAMERA_HPP__
|
||||
|
||||
#include "CGuiWidget.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CGUICAMERA_HPP__
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef __URDE_CGUICOMPOUNDWIDGET_HPP__
|
||||
#define __URDE_CGUICOMPOUNDWIDGET_HPP__
|
||||
|
||||
#include "CGuiWidget.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
class CGuiCompoundWidget : public CGuiWidget
|
||||
{
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CGUICOMPOUNDWIDGET_HPP__
|
|
@ -0,0 +1,10 @@
|
|||
#ifndef __URDE_CGUIFACTORIES_HPP__
|
||||
#define __URDE_CGUIFACTORIES_HPP__
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CGUIFACTORIES_HPP__
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef __URDE_CGUIFRAME_HPP__
|
||||
#define __URDE_CGUIFRAME_HPP__
|
||||
|
||||
#include "CGuiWidget.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CGUIFRAME_HPP__
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef __URDE_CGUILIGHT_HPP__
|
||||
#define __URDE_CGUILIGHT_HPP__
|
||||
|
||||
#include "CGuiWidget.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CGUILIGHT_HPP__
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef __URDE_CGUIMODEL_HPP__
|
||||
#define __URDE_CGUIMODEL_HPP__
|
||||
|
||||
#include "CGuiWidget.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CGUIMODEL_HPP__
|
|
@ -0,0 +1,142 @@
|
|||
#include "CGuiObject.hpp"
|
||||
#include "CGuiWidgetDrawParams.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
void CGuiObject::Update(float dt)
|
||||
{
|
||||
if (x74_child)
|
||||
x74_child->Update(dt);
|
||||
if (x78_nextSibling)
|
||||
x78_nextSibling->Update(dt);
|
||||
}
|
||||
|
||||
void CGuiObject::Draw(const CGuiWidgetDrawParms& parms) const
|
||||
{
|
||||
if (x74_child)
|
||||
x74_child->Draw(parms);
|
||||
if (x78_nextSibling)
|
||||
x78_nextSibling->Draw(parms);
|
||||
}
|
||||
|
||||
void CGuiObject::MoveInWorld(const zeus::CVector3f& vec)
|
||||
{
|
||||
if (x70_parent)
|
||||
x70_parent->RotateW2O(vec);
|
||||
x4_localXF.m_origin += vec;
|
||||
Reorthogonalize();
|
||||
RecalculateTransforms();
|
||||
}
|
||||
|
||||
void CGuiObject::RotateReset()
|
||||
{
|
||||
}
|
||||
|
||||
zeus::CVector3f CGuiObject::RotateW2O(const zeus::CVector3f& vec) const
|
||||
{
|
||||
}
|
||||
|
||||
zeus::CVector3f CGuiObject::RotateO2P(const zeus::CVector3f& vec) const
|
||||
{
|
||||
}
|
||||
|
||||
zeus::CVector3f CGuiObject::RotateTranslateW2O(const zeus::CVector3f& vec) const
|
||||
{
|
||||
}
|
||||
|
||||
void CGuiObject::MultiplyO2P(const zeus::CTransform& xf)
|
||||
{
|
||||
x4_localXF.m_origin += x64_rotationCenter;
|
||||
x4_localXF = xf * x4_localXF;
|
||||
x4_localXF.m_origin -= x64_rotationCenter;
|
||||
Reorthogonalize();
|
||||
RecalculateTransforms();
|
||||
}
|
||||
|
||||
void CGuiObject::AddChildObject(CGuiObject* obj, bool calcChildWorld, bool atEnd)
|
||||
{
|
||||
obj->x70_parent = this;
|
||||
|
||||
if (!x74_child)
|
||||
{
|
||||
x74_child = obj;
|
||||
}
|
||||
else if (atEnd)
|
||||
{
|
||||
CGuiObject* prev = nullptr;
|
||||
CGuiObject* cur = x74_child;
|
||||
for (; cur ; cur = cur->x78_nextSibling) {prev = cur;}
|
||||
if (prev)
|
||||
prev->x78_nextSibling = obj;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj->x78_nextSibling = x74_child;
|
||||
x74_child = obj;
|
||||
}
|
||||
|
||||
if (calcChildWorld)
|
||||
{
|
||||
// TODO: do
|
||||
}
|
||||
|
||||
RecalculateTransforms();
|
||||
}
|
||||
|
||||
CGuiObject* CGuiObject::RemoveChildObject(CGuiObject* obj, bool makeWorldLocal)
|
||||
{
|
||||
CGuiObject* prev = nullptr;
|
||||
CGuiObject* cur = x74_child;
|
||||
for (; cur && cur != obj ; cur = cur->x78_nextSibling) {prev = cur;}
|
||||
if (!cur)
|
||||
return nullptr;
|
||||
if (prev)
|
||||
prev->x78_nextSibling = cur->x78_nextSibling;
|
||||
cur->x78_nextSibling = nullptr;
|
||||
cur->x70_parent = nullptr;
|
||||
|
||||
if (makeWorldLocal)
|
||||
cur->x4_localXF = cur->x34_worldXF;
|
||||
cur->RecalculateTransforms();
|
||||
|
||||
return cur;
|
||||
}
|
||||
|
||||
void CGuiObject::RecalculateTransforms()
|
||||
{
|
||||
if (x70_parent)
|
||||
{
|
||||
x4_localXF.m_origin += x64_rotationCenter;
|
||||
x34_worldXF = x70_parent->x34_worldXF * x4_localXF;
|
||||
x4_localXF.m_origin -= x64_rotationCenter;
|
||||
x34_worldXF.m_origin -= x64_rotationCenter;
|
||||
}
|
||||
else
|
||||
{
|
||||
x34_worldXF = x4_localXF;
|
||||
}
|
||||
|
||||
if (x78_nextSibling)
|
||||
x78_nextSibling->RecalculateTransforms();
|
||||
if (x74_child)
|
||||
x74_child->RecalculateTransforms();
|
||||
}
|
||||
|
||||
void CGuiObject::Reorthogonalize()
|
||||
{
|
||||
static bool Global = false;
|
||||
if (Global)
|
||||
{
|
||||
x4_localXF.orthonormalize();
|
||||
RecalculateTransforms();
|
||||
}
|
||||
}
|
||||
|
||||
void CGuiObject::SetO2WTransform(const zeus::CTransform& xf)
|
||||
{
|
||||
x4_localXF = GetParent()->x34_worldXF.inverse() * xf;
|
||||
RecalculateTransforms();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
#ifndef __URDE_CGUIOBJECT_HPP__
|
||||
#define __URDE_CGUIOBJECT_HPP__
|
||||
|
||||
#include "RetroTypes.hpp"
|
||||
#include "zeus/CVector3f.hpp"
|
||||
#include "zeus/CTransform.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CGuiWidgetDrawParms;
|
||||
|
||||
class CGuiObject
|
||||
{
|
||||
zeus::CTransform x4_localXF;
|
||||
zeus::CTransform x34_worldXF;
|
||||
zeus::CVector3f x64_rotationCenter;
|
||||
CGuiObject* x70_parent = nullptr;
|
||||
CGuiObject* x74_child = nullptr;
|
||||
CGuiObject* x78_nextSibling = nullptr;
|
||||
public:
|
||||
virtual ~CGuiObject() = default;
|
||||
virtual void Update(float dt);
|
||||
virtual void Draw(const CGuiWidgetDrawParms& parms) const;
|
||||
|
||||
void MoveInWorld(const zeus::CVector3f& vec);
|
||||
const zeus::CVector3f& GetLocalPosition() const {return x4_localXF.m_origin;}
|
||||
const zeus::CVector3f& GetWorldPosition() const {return x34_worldXF.m_origin;}
|
||||
void SetRotationCenter(const zeus::CVector3f& center) {x64_rotationCenter = center;}
|
||||
void RotateReset();
|
||||
zeus::CVector3f RotateW2O(const zeus::CVector3f& vec) const;
|
||||
zeus::CVector3f RotateO2P(const zeus::CVector3f& vec) const;
|
||||
zeus::CVector3f RotateTranslateW2O(const zeus::CVector3f& vec) const;
|
||||
void MultiplyO2P(const zeus::CTransform& xf);
|
||||
void AddChildObject(CGuiObject* obj, bool, bool);
|
||||
CGuiObject* RemoveChildObject(CGuiObject* obj, bool makeWorldLocal);
|
||||
CGuiObject* GetParent() {return x70_parent;}
|
||||
CGuiObject* GetChildObject() {return x74_child;}
|
||||
CGuiObject* GetNextSibling() {return x78_nextSibling;}
|
||||
void RecalculateTransforms();
|
||||
void Reorthogonalize();
|
||||
void SetO2WTransform(const zeus::CTransform& xf);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CGUIOBJECT_HPP__
|
|
@ -0,0 +1,31 @@
|
|||
#ifndef __URDE_CGUIRANDOMVAR_HPP__
|
||||
#define __URDE_CGUIRANDOMVAR_HPP__
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
class CGuiRandomVar
|
||||
{
|
||||
enum class Type
|
||||
{
|
||||
Zero,
|
||||
One
|
||||
} x0_type;
|
||||
float x4_num;
|
||||
|
||||
float GenNum() const
|
||||
{
|
||||
switch (x0_type)
|
||||
{
|
||||
case Type::Zero:
|
||||
case Type::One:
|
||||
return x4_num;
|
||||
default: break;
|
||||
}
|
||||
return 0.f;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CGUIRANDOMVAR_HPP__
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef __URDE_CGUISLIDERGROUP_HPP__
|
||||
#define __URDE_CGUISLIDERGROUP_HPP__
|
||||
|
||||
#include "CGuiWidget.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CGUISLIDERGROUP_HPP__
|
|
@ -0,0 +1,10 @@
|
|||
#ifndef __URDE_CGUISTATICIMAGE_HPP__
|
||||
#define __URDE_CGUISTATICIMAGE_HPP__
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CGUISTATICIMAGE_HPP__
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef __PSHAG_CGUISYS_HPP__
|
||||
#define __PSHAG_CGUISYS_HPP__
|
||||
#ifndef __URDE_CGUISYS_HPP__
|
||||
#define __URDE_CGUISYS_HPP__
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
@ -10,4 +10,4 @@ class CGuiSys
|
|||
|
||||
}
|
||||
|
||||
#endif // __PSHAG_CGUISYS_HPP__
|
||||
#endif // __URDE_CGUISYS_HPP__
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef __URDE_CGUITABLEGROUP_HPP__
|
||||
#define __URDE_CGUITABLEGROUP_HPP__
|
||||
|
||||
#include "CGuiWidget.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CGUITABLEGROUP_HPP__
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef __URDE_CGUITEXTPANE_HPP__
|
||||
#define __URDE_CGUITEXTPANE_HPP__
|
||||
|
||||
#include "CGuiWidget.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CGUITEXTPANE_HPP__
|
|
@ -0,0 +1,10 @@
|
|||
#ifndef __URDE_CGUITEXTSUPPORT_HPP__
|
||||
#define __URDE_CGUITEXTSUPPORT_HPP__
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CGUITEXTSUPPORT_HPP__
|
|
@ -0,0 +1,6 @@
|
|||
#include "CGuiWidget.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
#ifndef __URDE_CGUIWIDGET_HPP__
|
||||
#define __URDE_CGUIWIDGET_HPP__
|
||||
|
||||
#include "IOStreams.hpp"
|
||||
#include "CGuiObject.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CGuiAnimBase;
|
||||
class CGuiFrame;
|
||||
class CGuiMessage;
|
||||
|
||||
enum class EGuiAnimBehListID
|
||||
{
|
||||
};
|
||||
|
||||
class CGuiWidget : public CGuiObject
|
||||
{
|
||||
public:
|
||||
struct CGuiWidgetParms
|
||||
{
|
||||
};
|
||||
private:
|
||||
public:
|
||||
virtual void Message(const CGuiMessage& msg);
|
||||
virtual void ParseBaseInfo(CGuiFrame* frame, CInputStream& in, const CGuiWidgetParms& parms);
|
||||
virtual void ParseMessages(CInputStream& in, const CGuiWidgetParms& parms);
|
||||
virtual void ParseAnimations(CInputStream& in, const CGuiWidgetParms& parms);
|
||||
virtual void GetTextureAssets() const;
|
||||
virtual void GetModelAssets() const;
|
||||
virtual void GetFontAssets() const;
|
||||
virtual void GetKFAMAssets() const;
|
||||
virtual void Initialize();
|
||||
virtual void Touch() const;
|
||||
virtual void GetIsVisible() const;
|
||||
virtual void GetIsActive() const;
|
||||
virtual void TextSupport();
|
||||
virtual void GetTextSupport() const;
|
||||
virtual void ModifyRGBA(CGuiWidget* widget);
|
||||
virtual void AddAnim(EGuiAnimBehListID, CGuiAnimBase*);
|
||||
virtual void AddChildWidget(CGuiWidget* widget, bool, bool);
|
||||
virtual void RemoveChildWidget(CGuiWidget* widget, bool);
|
||||
virtual void GetWidgetTypeID() const;
|
||||
virtual void AddWorkerWidget(CGuiWidget* worker);
|
||||
virtual void GetFinishedLoadingWidgetSpecific() const;
|
||||
virtual void OnVisible();
|
||||
virtual void OnInvisible();
|
||||
virtual void OnActivate(bool);
|
||||
virtual void OnDeActivate();
|
||||
virtual void DoRegisterEventHandler();
|
||||
virtual void DoUnregisterEventHandler();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CGUIWIDGET_HPP__
|
|
@ -0,0 +1,10 @@
|
|||
#ifndef __URDE_CGUIWIDGETDRAWPARAMS_HPP__
|
||||
#define __URDE_CGUIWIDGETDRAWPARAMS_HPP__
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CGUIWIDGETDRAWPARAMS_HPP__
|
|
@ -1,4 +1,54 @@
|
|||
add_library(RuntimeCommonGuiSys
|
||||
CGuiSys.hpp CGuiSys.cpp
|
||||
CSplashScreen.hpp CSplashScreen.cpp
|
||||
CConsoleOutputWindow.hpp CConsoleOutputWindow.cpp)
|
||||
CSplashScreen.cpp
|
||||
CSplashScreen.hpp
|
||||
CGuiObject.cpp
|
||||
CGuiObject.hpp
|
||||
CConsoleOutputWindow.cpp
|
||||
CConsoleOutputWindow.hpp
|
||||
CAuiEnergyBarT01.cpp
|
||||
CAuiEnergyBarT01.hpp
|
||||
CAuiImagePane.cpp
|
||||
CAuiImagePane.hpp
|
||||
CAuiMeter.cpp
|
||||
CAuiMeter.hpp
|
||||
CConsoleOutputWindow.cpp
|
||||
CConsoleOutputWindow.hpp
|
||||
CGuiAnimBase.cpp
|
||||
CGuiAnimBase.hpp
|
||||
CGuiAnimController.cpp
|
||||
CGuiAnimController.hpp
|
||||
CGuiAutoRepeatData.cpp
|
||||
CGuiAutoRepeatData.hpp
|
||||
CGuiCamera.cpp
|
||||
CGuiCamera.hpp
|
||||
CGuiFactories.cpp
|
||||
CGuiFactories.hpp
|
||||
CGuiFrame.cpp
|
||||
CGuiFrame.hpp
|
||||
CGuiLight.cpp
|
||||
CGuiLight.hpp
|
||||
CGuiModel.cpp
|
||||
CGuiModel.hpp
|
||||
CGuiRandomVar.cpp
|
||||
CGuiRandomVar.hpp
|
||||
CGuiSliderGroup.cpp
|
||||
CGuiSliderGroup.hpp
|
||||
CGuiStaticImage.cpp
|
||||
CGuiStaticImage.hpp
|
||||
CGuiSys.cpp
|
||||
CGuiSys.hpp
|
||||
CGuiTableGroup.cpp
|
||||
CGuiTableGroup.hpp
|
||||
CGuiTextPane.cpp
|
||||
CGuiTextPane.hpp
|
||||
CGuiTextSupport.cpp
|
||||
CGuiTextSupport.hpp
|
||||
CGuiWidget.cpp
|
||||
CGuiWidgetDrawParams.cpp
|
||||
CGuiWidgetDrawParams.hpp
|
||||
CGuiWidget.hpp
|
||||
CMakeLists.txt
|
||||
CSplashScreen.cpp
|
||||
CSplashScreen.hpp
|
||||
CGuiCompoundWidget.cpp
|
||||
CGuiCompoundWidget.hpp)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef __PSHAG_CSPLASHSCREEN_HPP__
|
||||
#define __PSHAG_CSPLASHSCREEN_HPP__
|
||||
#ifndef __URDE_CSPLASHSCREEN_HPP__
|
||||
#define __URDE_CSPLASHSCREEN_HPP__
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
@ -10,4 +10,4 @@ class CSplashScreen
|
|||
|
||||
}
|
||||
|
||||
#endif // __PSHAG_CSPLASHSCREEN_HPP__
|
||||
#endif // __URDE_CSPLASHSCREEN_HPP__
|
||||
|
|
2
specter
2
specter
|
@ -1 +1 @@
|
|||
Subproject commit ba1b4ecc5120455bd6c65a76f18fd6abf93e049c
|
||||
Subproject commit 0b750609a665a47afc959ae58613703a689e91f2
|
Loading…
Reference in New Issue