metaforce/Runtime/Graphics/CBooRenderer.hpp

167 lines
6.0 KiB
C++
Raw Normal View History

2016-04-13 06:07:23 +00:00
#ifndef __URDE_CBOORENDERER_HPP__
#define __URDE_CBOORENDERER_HPP__
2015-08-18 05:54:43 +00:00
2016-07-25 22:52:02 +00:00
#include <functional>
2016-07-21 05:21:45 +00:00
#include "IRenderer.hpp"
#include "CDrawable.hpp"
2016-07-25 22:52:02 +00:00
#include "CDrawablePlaneObject.hpp"
#include "Shaders/CThermalColdFilter.hpp"
2016-07-25 22:52:02 +00:00
#include "CRandom16.hpp"
2016-07-21 05:21:45 +00:00
2016-03-04 23:04:53 +00:00
namespace urde
2015-08-18 05:54:43 +00:00
{
2015-08-22 01:58:41 +00:00
class IObjectStore;
class CMemorySys;
2016-04-15 20:42:40 +00:00
class IFactory;
2016-07-25 22:52:02 +00:00
class CTexture;
2015-08-18 05:54:43 +00:00
class Buckets
{
2016-07-25 22:52:02 +00:00
friend class CBooRenderer;
static rstl::reserved_vector<u16, 50> sBucketIndex;
static rstl::reserved_vector<CDrawable, 50>* sData;
static rstl::reserved_vector<rstl::reserved_vector<CDrawable*, 128>, 50>* sBuckets;
static rstl::reserved_vector<CDrawablePlaneObject, 8>* sPlaneObjectData;
static rstl::reserved_vector<u16, 8>* sPlaneObjectBucket;
static const float skWorstMinMaxDistance[2];
static float sMinMaxDistance[2];
public:
static void Clear();
static void Sort();
2016-07-25 22:52:02 +00:00
static void InsertPlaneObject(float dist, float something, const zeus::CAABox& aabb, bool b1,
const zeus::CPlane& plane, bool b2, EDrawableType dtype, const void* data);
static void Insert(const zeus::CVector3f& pos, const zeus::CAABox& aabb, EDrawableType dtype,
const void* data, const zeus::CPlane& plane, u16 extraSort);
static void Shutdown();
static void Init();
};
2016-07-21 05:21:45 +00:00
class CBooRenderer : public IRenderer
2015-08-18 05:54:43 +00:00
{
IFactory& x8_factory;
IObjectStore& xc_store;
2016-07-25 22:52:02 +00:00
boo::GraphicsDataToken m_gfxToken;
// CFont x10_fnt;
u32 x18_ = 0;
std::list<u32> x1c_;
zeus::CFrustum x44_frustumPlanes;
2016-07-25 22:52:02 +00:00
TDrawableCallback xa8_renderCallback;
const void* xac_callbackContext;
zeus::CVector3f xb0_ = {0.f, 1.f, 0.f};
float xbc_ = 0;
//boo::ITextureS* xe4_blackTex = nullptr;
bool xee_24_ : 1;
boo::ITextureR* x14c_reflectionTex = nullptr;
boo::ITextureS* x150_mirrorRamp = nullptr;
boo::ITextureS* x1b8_fogVolumeRamp = nullptr;
boo::ITextureS* x220_sphereRamp = nullptr;
TLockedToken<CTexture> m_thermoPaletteTex;
boo::ITexture* x288_thermoPalette = nullptr;
2016-07-25 22:52:02 +00:00
CRandom16 x2a8_thermalRand;
std::list<u32> x2b8_;
std::list<u32> x2d0_;
zeus::CColor x2e0_ = zeus::CColor::skWhite;
zeus::CVector3f x2e4_ = {0.f, 1.f, 0.f};
zeus::CColor x2f4_thermColor;
float x2f8_thermColdScale = 0.f;
CThermalColdFilter m_thermColdFilter;
2016-07-25 22:52:02 +00:00
union
{
struct
{
bool x318_24_refectionDirty : 1;
bool x318_25_ : 1;
bool x318_26_ : 1;
bool x318_27_ : 1;
bool x318_28_ : 1;
bool x318_29_ : 1;
bool x318_30_ : 1;
bool x318_31_ : 1;
};
u16 dummy = 0;
};
void GenerateMirrorRampTex(boo::IGraphicsDataFactory::Context& ctx);
void GenerateFogVolumeRampTex(boo::IGraphicsDataFactory::Context& ctx);
void GenerateSphereRampTex(boo::IGraphicsDataFactory::Context& ctx);
void LoadThermoPalette(boo::IGraphicsDataFactory::Context& ctx);
void RenderBucketItems(const std::vector<CLight>& lights);
2015-08-18 05:54:43 +00:00
public:
CBooRenderer(IObjectStore& store, IFactory& resFac);
2016-07-21 05:21:45 +00:00
void AddStaticGeometry(const std::vector<CMetroidModelInstance>&, const CAreaOctTree*, int);
void RemoveStaticGeometry(const std::vector<CMetroidModelInstance>&);
void DrawUnsortedGeometry(const std::vector<CLight>&, int, unsigned int, unsigned int);
void DrawSortedGeometry(const std::vector<CLight>&, int, unsigned int, unsigned int);
void DrawStaticGeometry(const std::vector<CLight>&, int, unsigned int, unsigned int);
void PostRenderFogs();
void AddParticleGen(const CElementGen&);
void AddPlaneObject(const void*, const zeus::CAABox&, const zeus::CPlane&, int);
void AddDrawable(void const *, const zeus::CVector3f&, const zeus::CAABox&, int, EDrawableSorting);
void SetDrawableCallback(TDrawableCallback, const void*);
void SetWorldViewpoint(const zeus::CTransform&);
void SetPerspectiveFovScalar(float);
void SetPerspective(float, float, float, float, float);
void SetPerspective(float, float, float, float);
void SetViewportOrtho(bool, float, float);
void SetClippingPlanes(const zeus::CFrustum&);
void SetViewport(int, int, int, int);
void SetDepthReadWrite(bool, bool);
void SetBlendMode_AdditiveAlpha();
void SetBlendMode_AlphaBlended();
void SetBlendMode_NoColorWrite();
void SetBlendMode_ColorMultiply();
void SetBlendMode_InvertDst();
void SetBlendMode_InvertSrc();
void SetBlendMode_Replace();
void SetBlendMode_AdditiveDestColor();
void SetDebugOption(EDebugOption, int);
void BeginScene();
void EndScene();
void BeginPrimitive(EPrimitiveType, int);
void BeginLines(int);
void BeginLineStrip(int);
void BeginTriangles(int);
void BeginTriangleStrip(int);
void BeginTriangleFan(int);
void PrimVertex(const zeus::CVector3f&);
void PrimNormal(const zeus::CVector3f&);
void PrimColor(float, float, float, float);
void PrimColor(const zeus::CColor&);
void EndPrimitive();
void SetAmbientColor(const zeus::CColor&);
void SetStaticWorldAmbientColor(const zeus::CColor&);
void DrawString(const char*, int, int);
u32 GetFPS();
void CacheReflection(TReflectionCallback, void*, bool);
void DrawSpaceWarp(const zeus::CVector3f&, float);
void DrawThermalModel(const CModel&, const zeus::CColor&, const zeus::CColor&, const float*, const float*);
void DrawXRayOutline(const CModel&, const float*, const float*);
void SetWireframeFlags(int);
void SetWorldFog(ERglFogMode, float, float, const zeus::CColor&);
void RenderFogVolume(const zeus::CColor&, const zeus::CAABox&, const TLockedToken<CModel>*, const CSkinnedModel*);
void SetThermal(bool, float, const zeus::CColor&);
void SetThermalColdScale(float scale);
2016-07-21 05:21:45 +00:00
void DoThermalBlendCold();
void DoThermalBlendHot();
u32 GetStaticWorldDataSize();
2016-07-25 22:52:02 +00:00
void BindMainDrawTarget() {CGraphics::g_BooMainCommandQueue->setRenderTarget(CGraphics::g_SpareTexture);}
void BindReflectionDrawTarget() {CGraphics::g_BooMainCommandQueue->setRenderTarget(x14c_reflectionTex);}
2015-08-18 05:54:43 +00:00
};
}
2016-04-13 06:07:23 +00:00
#endif // __URDE_CBOORENDERER_HPP__