2022-05-19 23:04:19 +00:00
|
|
|
#ifndef BBGE_RENDERSTATE_H
|
|
|
|
#define BBGE_RENDERSTATE_H
|
|
|
|
|
|
|
|
#include "Vector.h"
|
|
|
|
#include "EngineEnums.h"
|
|
|
|
|
|
|
|
struct CombinedRenderAndGPUState;
|
|
|
|
|
|
|
|
// Only once of these exists at any time.
|
|
|
|
// It stores the known GPU state so that we don't need so many futile state changes
|
|
|
|
struct GPUState
|
|
|
|
{
|
|
|
|
friend struct CombinedRenderAndGPUState;
|
|
|
|
GPUState();
|
|
|
|
|
|
|
|
void setBlend(BlendType bt);
|
|
|
|
|
|
|
|
private:
|
|
|
|
BlendType _blendType;
|
|
|
|
};
|
|
|
|
|
|
|
|
// The RenderState is passed through the scene graph as each layer is rendered
|
|
|
|
// TODO: what needs to end up here? matrix stack too?
|
|
|
|
struct RenderState
|
|
|
|
{
|
|
|
|
GPUState& gpu;
|
|
|
|
|
|
|
|
Vector color;
|
2023-03-02 01:19:48 +00:00
|
|
|
Vector scale;
|
2022-05-19 23:04:19 +00:00
|
|
|
float alpha;
|
2022-05-22 05:38:23 +00:00
|
|
|
int pass;
|
2022-05-19 23:04:19 +00:00
|
|
|
|
2022-09-24 02:57:08 +00:00
|
|
|
bool forceRenderBorder;
|
|
|
|
bool forceRenderCenter;
|
|
|
|
Vector renderBorderColor;
|
|
|
|
float renderBorderAlpha;
|
|
|
|
|
2022-05-19 23:04:19 +00:00
|
|
|
protected:
|
|
|
|
RenderState(GPUState& gpu);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct CombinedRenderAndGPUState : public RenderState
|
|
|
|
{
|
|
|
|
GPUState gpu;
|
|
|
|
CombinedRenderAndGPUState() : RenderState(gpu) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|