18 #ifndef HEADER_SP_BASE_HPP
19 #define HEADER_SP_BASE_HPP
21 #include "graphics/gl_headers.hpp"
22 #include "utils/constants.hpp"
23 #include "utils/no_copy.hpp"
39 namespace scene {
class ICameraSceneNode;
class IMesh; }
40 namespace video {
class SColor; }
49 enum DrawCallType:
unsigned int
60 inline std::ostream& operator<<(std::ostream& os,
const DrawCallType& dct)
65 return os <<
"normal";
67 return os <<
"transparent";
69 return os <<
"shadow cam 1";
71 return os <<
"shadow cam 2";
73 return os <<
"shadow cam 3";
75 return os <<
"shadow cam 4";
81 enum SamplerType:
unsigned int;
82 enum RenderPass:
unsigned int;
83 class SPDynamicDrawCall;
89 extern GLuint sp_mat_ubo[MAX_PLAYER_COUNT][3];
90 extern GLuint sp_fog_ubo;
91 extern std::array<GLuint, 1> sp_prefilled_tex;
92 extern std::atomic<uint32_t> sp_max_texture_size;
93 extern unsigned sp_solid_poly_count;
94 extern unsigned sp_shadow_poly_count;
95 extern int sp_cur_shadow_cascade;
96 extern bool sp_culling;
97 extern bool sp_debug_view;
98 extern bool sp_apitrace;
99 extern unsigned sp_cur_player;
100 extern unsigned sp_cur_buf_id[MAX_PLAYER_COUNT];
101 extern irr::core::vector3df sp_wind_dir;
107 GLuint getSampler(SamplerType);
109 SPShader* getNormalVisualizer();
111 SPShader* getGlowShader();
113 bool skinningUseTBO();
115 void prepareDrawCalls();
117 void draw(RenderPass, DrawCallType dct = DCT_NORMAL);
121 void drawSPDebugView();
123 void addObject(SPMeshNode*);
131 void handleDynamicDrawCall();
133 void addDynamicDrawCall(std::shared_ptr<SPDynamicDrawCall>);
135 void updateModelMatrix();
139 void resetEmptyFogColor();
141 void drawBoundingBoxes();
145 SPMesh* convertEVTStandard(irr::scene::IMesh* mesh,
146 const irr::video::SColor* color = NULL);
148 void uploadSPM(irr::scene::IMesh* mesh);
151 inline void setMaxTextureSize() {}
153 void setMaxTextureSize();
156 inline void unsetMaxTextureSize() { sp_max_texture_size.store(2048); }
158 inline uint8_t srgbToLinear(
float color_srgb)
161 if (color_srgb <= 0.04045f)
163 ret = (int)(255.0f * (color_srgb / 12.92f));
167 ret = (int)(255.0f * (powf((color_srgb + 0.055f) / 1.055f, 2.4f)));
169 return uint8_t(irr::core::clamp(ret, 0, 255));
172 inline uint8_t linearToSrgb(
float color_linear)
174 if (color_linear <= 0.0031308f)
176 color_linear = color_linear * 12.92f;
180 color_linear = 1.055f * powf(color_linear, 1.0f / 2.4f) - 0.055f;
182 return uint8_t(irr::core::clamp(
int(color_linear * 255.0f), 0, 255));
Definition: shader_based_renderer.hpp:49