Ult3D
Implementation of "Ultimate 3D Game Engine Design & Architecture" by Allan Sherrod
Loading...
Searching...
No Matches
MultiTexShader.h
Go to the documentation of this file.
1#ifndef ULT_MULTITEX_SHADER_H_INCLUDED
2#define ULT_MULTITEX_SHADER_H_INCLUDED
3
4#include "Effect.h"
6
7namespace Ult
8{
9
14class MultiTexShader : public Effect
15{
16public:
22 const char* vs, const char* ps,
23 const char* decalFile1, const char* decalFile2,
24 std::vector<FilterType>* filters,
25 RenderInterface* renderer)
26 {
27 mRenderer = renderer;
28 assert(mRenderer);
29 mRenderer->LoadTexFromFile(decalFile1, ULT_TEX2D_TYPE, &mDecalTexture1);
30 mRenderer->ApplyFilters(mDecalTexture1, filters);
31 mRenderer->LoadTexFromFile(decalFile2, ULT_TEX2D_TYPE, &mDecalTexture2);
32 mRenderer->ApplyFilters(mDecalTexture2, filters);
33 mRenderer->CreateShaderFromFile(vs, ps, &mShader);
34 mRenderer->SetupShaderParameter("mvp", mShader, &mMvpParam);
35 mRenderer->SetupShaderParameter("decal1", mShader, &mDecalParam1);
36 mRenderer->SetupShaderParameter("decal2", mShader, &mDecalParam2);
37 }
38
42 {
43 }
44
49 {
50 mRenderer->ApplyShader(mShader);
51 mRenderer->SetShaderParameter1i(mDecalParam1, 0);
52 mRenderer->ApplyTexture(0, mDecalTexture1);
53 mRenderer->SetShaderParameter1i(mDecalParam2, 1);
54 mRenderer->ApplyTexture(1, mDecalTexture2);
55 }
56
60 void Release()
61 {
62 mRenderer->DeleteTexture(mDecalTexture1);
63 mRenderer->DeleteTexture(mDecalTexture2);
64 }
65
66protected:
72};
73
74} // namespace Ult
75
76#endif // ULT_MULTITEX_SHADER_H_INCLUDED
77
Effect()
Definition Effect.h:30
ShaderHandle mShader
Definition MultiTexShader.h:67
~MultiTexShader()
Definition MultiTexShader.h:41
MultiTexShader(const char *vs, const char *ps, const char *decalFile1, const char *decalFile2, std::vector< FilterType > *filters, RenderInterface *renderer)
Definition MultiTexShader.h:21
Texture mDecalTexture2
Definition MultiTexShader.h:70
RenderInterface * mRenderer
Definition MultiTexShader.h:71
ParameterHandle mMvpParam
Definition MultiTexShader.h:68
ParameterHandle mDecalParam2
Definition MultiTexShader.h:69
Texture mDecalTexture1
Definition MultiTexShader.h:70
ParameterHandle mDecalParam1
Definition MultiTexShader.h:69
void Release()
Definition MultiTexShader.h:60
void ApplyEffect()
Definition MultiTexShader.h:48
Definition RenderInterface.h:34
int ShaderHandle
Definition RenderInterface.h:25
int ParameterHandle
Definition RenderInterface.h:27
Definition Archive.h:13
Handle< stTexture > Texture
Definition Texture.h:10
@ ULT_TEX2D_TYPE
Definition TextureType.h:9