mirror of
https://github.com/PrimeDecomp/prime.git
synced 2025-12-09 22:27:40 +00:00
More CCubeRenderer
This commit is contained in:
@@ -11,7 +11,6 @@
|
||||
#include "Kyoto/CResFactory.hpp"
|
||||
#include "Kyoto/Graphics/CColor.hpp"
|
||||
#include "Kyoto/Graphics/CGraphicsPalette.hpp"
|
||||
#include "Kyoto/Graphics/CLight.hpp"
|
||||
#include "Kyoto/Graphics/CTexture.hpp"
|
||||
#include "Kyoto/IObjectStore.hpp"
|
||||
#include "Kyoto/Math/CAABox.hpp"
|
||||
@@ -20,6 +19,7 @@
|
||||
#include "Kyoto/Math/CVector2f.hpp"
|
||||
#include "Kyoto/Math/CVector3f.hpp"
|
||||
#include "Kyoto/PVS/CPVSVisSet.hpp"
|
||||
#include "Kyoto/TOneStatic.hpp"
|
||||
#include "Kyoto/TToken.hpp"
|
||||
#include "Kyoto/Text/CFont.hpp"
|
||||
|
||||
@@ -38,29 +38,29 @@ class CCubeModel;
|
||||
class CMetroidModelInstance;
|
||||
class CModel;
|
||||
class CSkinnedModel;
|
||||
class CCubeSurface;
|
||||
class CLight;
|
||||
|
||||
class CCubeRenderer : public IRenderer, public IWeaponRenderer {
|
||||
class CCubeRenderer : public IRenderer, public IWeaponRenderer, public TOneStatic< CCubeRenderer > {
|
||||
private:
|
||||
class CAreaListItem {
|
||||
CAreaListItem(
|
||||
const rstl::vector< CMetroidModelInstance, rstl::rmemory_allocator >* geometry,
|
||||
const CAreaOctTree* octTree,
|
||||
const rstl::auto_ptr< rstl::vector< TCachedToken< CTexture >, rstl::rmemory_allocator > >&
|
||||
textures,
|
||||
const rstl::auto_ptr<
|
||||
rstl::vector< rstl::auto_ptr< CCubeModel >, rstl::rmemory_allocator > >& models,
|
||||
int areaIdx);
|
||||
public:
|
||||
CAreaListItem(const rstl::vector< CMetroidModelInstance >* geometry,
|
||||
const CAreaOctTree* octTree,
|
||||
const rstl::auto_ptr< rstl::vector< TCachedToken< CTexture > > >& textures,
|
||||
const rstl::auto_ptr< rstl::vector< rstl::auto_ptr< CCubeModel > > >& models,
|
||||
int areaIdx);
|
||||
~CAreaListItem() {}
|
||||
|
||||
private:
|
||||
const rstl::vector< CMetroidModelInstance, rstl::rmemory_allocator >* x0_geometry;
|
||||
// private:
|
||||
const rstl::vector< CMetroidModelInstance >* x0_geometry;
|
||||
const CAreaOctTree* x4_octTree;
|
||||
const rstl::auto_ptr< rstl::vector< TCachedToken< CTexture >, rstl::rmemory_allocator > >
|
||||
x8_textures;
|
||||
const rstl::auto_ptr< rstl::vector< rstl::auto_ptr< CCubeModel >, rstl::rmemory_allocator > >
|
||||
xc_models;
|
||||
const rstl::auto_ptr< rstl::vector< TCachedToken< CTexture > > > x8_textures;
|
||||
const rstl::auto_ptr< rstl::vector< rstl::auto_ptr< CCubeModel > > > xc_models;
|
||||
int x18_areaIdx;
|
||||
rstl::vector< uint > x1c_lightOctreeWords;
|
||||
};
|
||||
|
||||
class CFogVolumeListItem {
|
||||
CTransform4f x0_xf;
|
||||
CColor x30_color;
|
||||
@@ -72,11 +72,11 @@ private:
|
||||
public:
|
||||
CCubeRenderer(IObjectStore&, COsContext&, CMemorySys&, CResFactory&);
|
||||
~CCubeRenderer() override;
|
||||
// TODO types
|
||||
void AddStaticGeometry() override;
|
||||
void AddStaticGeometry(const rstl::vector< CMetroidModelInstance >* geometry,
|
||||
const CAreaOctTree* octTree, int areaIdx) override;
|
||||
void EnablePVS(const CPVSVisSet& set, int areaIdx) override;
|
||||
void DisablePVS() override;
|
||||
void RemoveStaticGeometry() override;
|
||||
void RemoveStaticGeometry(const rstl::vector< CMetroidModelInstance >* geometry) override;
|
||||
void DrawUnsortedGeometry(int areaIdx, int mask, int targetMask) override;
|
||||
void DrawSortedGeometry(int areaIdx, int mask, int targetMask) override;
|
||||
void DrawStaticGeometry(int areaIdx, int mask, int targetMask) override;
|
||||
@@ -88,10 +88,10 @@ public:
|
||||
void AddPlaneObject() override;
|
||||
void AddDrawable(const void* obj, const CVector3f& pos, const CAABox& bounds, int mode,
|
||||
IRenderer::EDrawableSorting sorting) override;
|
||||
void SetDrawableCallback(TDrawableCallback cb, void* ctx) override;
|
||||
void SetWorldViewpoint() override;
|
||||
void SetPerspective1(float, float, float, float, float) override;
|
||||
void SetPerspective2() override;
|
||||
void SetDrawableCallback(TDrawableCallback cb, const void* ctx) override;
|
||||
void SetWorldViewpoint(const CTransform4f& xf) override;
|
||||
void SetPerspective(float, float, float, float, float) override;
|
||||
void SetPerspective(float, float, float, float) override;
|
||||
rstl::pair< CVector2f, CVector2f > SetViewportOrtho(bool centered, float znear,
|
||||
float zfar) override;
|
||||
void SetClippingPlanes(const CFrustumPlanes&) override;
|
||||
@@ -105,10 +105,10 @@ public:
|
||||
void SetBlendMode_InvertSrc() override;
|
||||
void SetBlendMode_Replace() override;
|
||||
void SetBlendMode_AdditiveDestColor() override;
|
||||
void SetDebugOption() override;
|
||||
void SetDebugOption(IRenderer::EDebugOption option, int value) override;
|
||||
void BeginScene() override;
|
||||
void EndScene() override;
|
||||
void BeginPrimitive(GXPrimitive prim, int count) override;
|
||||
void BeginPrimitive(IRenderer::EPrimitiveType prim, int count) override;
|
||||
void BeginLines(int nverts) override;
|
||||
void BeginLineStrip(int nverts) override;
|
||||
void BeginTriangles(int nverts) override;
|
||||
@@ -121,7 +121,7 @@ public:
|
||||
void EndPrimitive() override;
|
||||
void SetAmbientColor(const CColor& color) override;
|
||||
void DrawString() override;
|
||||
void GetFPS() override;
|
||||
float GetFPS() override;
|
||||
void CacheReflection() override;
|
||||
void DrawSpaceWarp() override;
|
||||
void DrawThermalModel() override;
|
||||
@@ -144,6 +144,7 @@ public:
|
||||
void AllocatePhazonSuitMaskTexture();
|
||||
|
||||
void SetRequestRGBA6(bool req) { x318_26_requestRGBA6 = req; }
|
||||
CTexture* GetRealReflection();
|
||||
|
||||
private:
|
||||
CResFactory& x8_factory;
|
||||
@@ -151,16 +152,13 @@ private:
|
||||
CFont x10_font;
|
||||
int x18_primVertCount;
|
||||
rstl::list< CAreaListItem > x1c_areaListItems;
|
||||
int x34_unk1;
|
||||
int x38_unk2;
|
||||
int x3c_unk3;
|
||||
int x40_unk4;
|
||||
rstl::vector< CCubeSurface > x34_surfaces;
|
||||
CFrustumPlanes x44_frustumPlanes;
|
||||
TDrawableCallback xa8_drawableCallback;
|
||||
void* xac_drawableCallbackUserData;
|
||||
const void* xac_drawableCallbackUserData;
|
||||
CPlane xb0_viewPlane;
|
||||
uchar xc0_pvsMode;
|
||||
int xc4_unk5;
|
||||
uchar xc0_pvsMode; // bool?
|
||||
int xc4_pvsState;
|
||||
rstl::optional_object< CPVSVisSet > xc8_pvsVisSet;
|
||||
int xe0_pvsAreaIdx;
|
||||
CTexture xe4_blackTex;
|
||||
@@ -196,6 +194,9 @@ private:
|
||||
void GenerateSphereRampTex();
|
||||
void LoadThermoPalette();
|
||||
|
||||
rstl::list< CCubeRenderer::CAreaListItem >::iterator
|
||||
FindStaticGeometry(const rstl::vector< CMetroidModelInstance >* geometry);
|
||||
|
||||
static CCubeRenderer* sRenderer;
|
||||
};
|
||||
CHECK_SIZEOF(CCubeRenderer, 0x31C);
|
||||
|
||||
@@ -2,44 +2,66 @@
|
||||
#define _IRENDERER
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#include <dolphin/gx/GXEnum.h>
|
||||
|
||||
#include "rstl/pair.hpp"
|
||||
#include "rstl/vector.hpp"
|
||||
|
||||
#include "Kyoto/TToken.hpp"
|
||||
|
||||
class CTransform4f;
|
||||
class CParticleGen;
|
||||
class IObjectStore;
|
||||
class COsContext;
|
||||
class CMemorySys;
|
||||
class CResFactory;
|
||||
class CAABox;
|
||||
class CAreaOctTree;
|
||||
class CColor;
|
||||
class CFrustumPlanes;
|
||||
class CLight;
|
||||
class CMemorySys;
|
||||
class CMetroidModelInstance;
|
||||
class CModel;
|
||||
class COsContext;
|
||||
class CParticleGen;
|
||||
class CPVSVisSet;
|
||||
class CResFactory;
|
||||
class CSkinnedModel;
|
||||
class CTransform4f;
|
||||
class CVector2f;
|
||||
class CVector3f;
|
||||
class CModel;
|
||||
class CFrustumPlanes;
|
||||
class CSkinnedModel;
|
||||
class CColor;
|
||||
class CLight;
|
||||
class CPVSVisSet;
|
||||
class IObjectStore;
|
||||
|
||||
class IRenderer {
|
||||
public:
|
||||
typedef void (*TDrawableCallback)(const void*, const void*, int);
|
||||
|
||||
|
||||
enum EDrawableSorting {
|
||||
kDS_SortedCallback,
|
||||
kDS_UnsortedCallback,
|
||||
};
|
||||
|
||||
enum EPrimitiveType {
|
||||
kPT_Quads = GX_QUADS,
|
||||
kPT_Triangles = GX_TRIANGLES,
|
||||
kPT_TriangleStrip = GX_TRIANGLESTRIP,
|
||||
kPT_TriangleFan = GX_TRIANGLEFAN,
|
||||
kPT_Lines = GX_LINES,
|
||||
kPT_LineStrip = GX_LINESTRIP,
|
||||
kPT_Points = GX_POINTS,
|
||||
};
|
||||
|
||||
enum EDebugOption {
|
||||
kDO_Invalid = -1,
|
||||
kDO_PVSMode,
|
||||
kDO_PVSState,
|
||||
kDO_FogDisabled,
|
||||
};
|
||||
|
||||
virtual ~IRenderer();
|
||||
// TODO vtable
|
||||
|
||||
virtual void AddStaticGeometry();
|
||||
|
||||
virtual void AddStaticGeometry(const rstl::vector< CMetroidModelInstance >* geometry,
|
||||
const CAreaOctTree* octTree, int areaIdx);
|
||||
virtual void EnablePVS(const CPVSVisSet& set, int areaIdx);
|
||||
virtual void DisablePVS();
|
||||
virtual void RemoveStaticGeometry();
|
||||
virtual void RemoveStaticGeometry(const rstl::vector< CMetroidModelInstance >* geometry);
|
||||
virtual void DrawUnsortedGeometry(int areaIdx, int mask, int targetMask);
|
||||
virtual void DrawSortedGeometry(int areaIdx, int mask, int targetMask);
|
||||
virtual void DrawStaticGeometry(int areaIdx, int mask, int targetMask);
|
||||
@@ -51,10 +73,10 @@ public:
|
||||
virtual void AddPlaneObject();
|
||||
virtual void AddDrawable(const void* obj, const CVector3f& pos, const CAABox& bounds, int mode,
|
||||
IRenderer::EDrawableSorting sorting);
|
||||
virtual void SetDrawableCallback(TDrawableCallback cb, void* ctx);
|
||||
virtual void SetWorldViewpoint();
|
||||
virtual void SetPerspective1(float, float, float, float, float);
|
||||
virtual void SetPerspective2();
|
||||
virtual void SetDrawableCallback(TDrawableCallback cb, const void* ctx);
|
||||
virtual void SetWorldViewpoint(const CTransform4f& xf);
|
||||
virtual void SetPerspective(float, float, float, float, float);
|
||||
virtual void SetPerspective(float, float, float, float);
|
||||
virtual rstl::pair< CVector2f, CVector2f > SetViewportOrtho(bool centered, float znear,
|
||||
float zfar);
|
||||
virtual void SetClippingPlanes(const CFrustumPlanes&);
|
||||
@@ -69,10 +91,10 @@ public:
|
||||
virtual void SetBlendMode_Replace();
|
||||
virtual void SetBlendMode_AdditiveDestColor();
|
||||
|
||||
virtual void SetDebugOption();
|
||||
virtual void SetDebugOption(IRenderer::EDebugOption option, int value);
|
||||
virtual void BeginScene();
|
||||
virtual void EndScene();
|
||||
virtual void BeginPrimitive(GXPrimitive prim, int count);
|
||||
virtual void BeginPrimitive(IRenderer::EPrimitiveType prim, int count);
|
||||
virtual void BeginLines(int nverts);
|
||||
virtual void BeginLineStrip(int nverts);
|
||||
virtual void BeginTriangles(int nverts);
|
||||
@@ -85,7 +107,7 @@ public:
|
||||
virtual void EndPrimitive();
|
||||
virtual void SetAmbientColor(const CColor& color);
|
||||
virtual void DrawString();
|
||||
virtual void GetFPS();
|
||||
virtual float GetFPS();
|
||||
virtual void CacheReflection();
|
||||
virtual void DrawSpaceWarp();
|
||||
virtual void DrawThermalModel();
|
||||
@@ -94,7 +116,7 @@ public:
|
||||
virtual void SetWireframeFlags();
|
||||
virtual void SetWorldFog();
|
||||
virtual void RenderFogVolume(const CColor&, const CAABox&, const TLockedToken< CModel >*,
|
||||
const CSkinnedModel*);
|
||||
const CSkinnedModel*);
|
||||
virtual void SetThermal();
|
||||
virtual void SetThermalColdScale();
|
||||
virtual void DoThermalBlendCold();
|
||||
@@ -103,9 +125,11 @@ public:
|
||||
virtual void SetGXRegister1Color();
|
||||
virtual void SetWorldLightFadeLevel();
|
||||
virtual void Something();
|
||||
virtual void PrepareDynamicLights(const rstl::vector<CLight>& lights);
|
||||
virtual void PrepareDynamicLights(const rstl::vector< CLight >& lights);
|
||||
};
|
||||
|
||||
inline IRenderer::~IRenderer() {}
|
||||
|
||||
namespace Renderer {
|
||||
IRenderer* AllocateRenderer(IObjectStore&, COsContext&, CMemorySys&, CResFactory&);
|
||||
}; // namespace Renderer
|
||||
|
||||
Reference in New Issue
Block a user