CSEngine
Loading...
Searching...
No Matches
SShaderGroup.h
1#pragma once
2
3#include "../../Object/SResource.h"
4#include <unordered_map>
5
6namespace CSE {
7
8 class GLProgramHandle;
9
10 class SShaderGroup : public SResource {
11 public:
13
14 ~SShaderGroup() override;
15
16 void Exterminate() override;
17
18 const GLProgramHandle* GetHandle(const std::string& pass) const;
19 const GLProgramHandle* GetHandleByMode(int mode) const;
20 const GLProgramHandle* GetGeometryHandle() const {
21 return m_geometryHandle;
22 }
23 const GLProgramHandle* GetForwardHandle() const {
24 return m_forwardHandle;
25 }
26 const GLProgramHandle* GetDepthOnlyHandle() const {
27 return m_depthOnlyHandle;
28 }
29
30 protected:
31 void Init(const AssetMgr::AssetReference* asset) override;
32
33 private:
34 static std::string GetShaderHash(const std::string& vert_path, const std::string& frag_path);
35
36 private:
37 std::unordered_map<std::string, GLProgramHandle*> m_handles;
38 GLProgramHandle* m_geometryHandle = nullptr;
39 GLProgramHandle* m_forwardHandle = nullptr;
40 GLProgramHandle* m_depthOnlyHandle = nullptr;
41 };
42}