MCPcopy Create free account
hub / github.com/OneLoneCoder/olcPixelGameEngine / Shade

Class Shade

extensions/olcPGEX_Shaders.h:271–381  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

269 };
270
271 class Shade : public olc::PGEX
272 {
273 friend class olc::Effect;
274
275 public:
276 Shade();
277
278 public:
279 olc::Effect MakeEffect(const olc::EffectConfig& premade);
280
281 public:
282 int32_t SetSourceDecal(olc::Decal* pDecal, const uint32_t nSlot = 0, const olc::vf2d& vSourcePos = { 0.0f, 0.0f }, const olc::vf2d& vSourceSize = { 1.0f, 1.0f });
283 int32_t SetTargetDecal(olc::Decal* pDecal, const uint32_t nSlot = 0);
284 int32_t Start(olc::Effect* pEffect);
285 int32_t End();
286
287 public: // Simplified Interface
288 void Clear(const olc::Pixel& p = olc::BLANK);
289 void DrawDecal(const olc::vf2d& pos, olc::Decal* decal, const olc::vf2d& scale = { 1.0f, 1.0f }, const olc::Pixel& tint = olc::WHITE);
290 void DrawPartialDecal(const olc::vf2d& pos, olc::Decal* decal, const olc::vf2d& source_pos, const olc::vf2d& source_size, const olc::vf2d& scale = { 1.0f,1.0f }, const olc::Pixel& tint = olc::WHITE);
291 void DrawPartialDecal(const olc::vf2d& pos, const olc::vf2d& size, olc::Decal* decal, const olc::vf2d& source_pos, const olc::vf2d& source_size, const olc::Pixel& tint = olc::WHITE);
292 void DrawPolygonDecal(olc::Decal* decal, const std::vector<olc::vf2d>& pos, const std::vector<olc::vf2d>& uv, const std::vector<olc::Pixel>& colours);
293
294
295
296 public: // Advanced Interface
297 int32_t DrawQuad(const olc::vf2d& vPos, const olc::vf2d& vSize);
298
299 private:
300
301 struct sResourceSlot
302 {
303 bool bInUse = false;
304 int nTargetResID = 0;
305 olc::vf2d vPos = { 0.0f, 0.0f };
306 olc::vf2d vSize = { 1.0f, 1.0f };
307 olc::vf2d vInvSize = { 1.0f, 1.0f };
308 };
309
310 std::array<sResourceSlot, 8> slotTarget;
311 std::array<sResourceSlot, 8> slotSource;
312
313
314 struct sOmniVertex
315 {
316 float pos[3];
317 olc::Pixel col;
318 olc::vf2d tex[8];
319 };
320
321 uint32_t m_nVB = 0;
322 uint32_t m_nVA = 0;
323
324 sOmniVertex pVertexMem[olc::OLC_MAX_VERTS];
325
326 uint32_t m_nFBO = 0;
327 uint32_t m_nEffectID = 0;
328

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected