Ult3D
Implementation of "Ultimate 3D Game Engine Design & Architecture" by Allan Sherrod
Loading...
Searching...
No Matches
TextureShader.h
Go to the documentation of this file.
1#ifndef ULT_TEXTURE_SHADER_H_INCLUDED
2#define ULT_TEXTURE_SHADER_H_INCLUDED
3
4#include "Effect.h"
6
7namespace Ult
8{
9
14class TextureShader : public Effect
15{
16public:
17
23 const char* vs, const char* ps, const char* decalFile,
24 std::vector<FilterType>* filters,
25 RenderInterface* renderer)
26 {
27 mRenderer = renderer;
28 assert(mRenderer);
29 mRenderer->LoadTexFromFile(decalFile, ULT_TEX2D_TYPE, &mDecalTexture);
30 mRenderer->ApplyFilters(mDecalTexture, filters);
31 mRenderer->CreateShaderFromFile(vs, ps, &mShader);
32 mRenderer->SetupShaderParameter("mvp", mShader, &mMvpParam);
33 mRenderer->SetupShaderParameter("decal", mShader, &mDecalParam);
34 }
35
40
45 {
46 mRenderer->ApplyShader(mShader);
47 mRenderer->SetShaderParameter1i(mDecalParam, 0);
48 mRenderer->ApplyTexture(0, mDecalTexture);
49 }
50
54 void Release()
55 {
56 mRenderer->DeleteTexture(mDecalTexture);
57 }
58
59protected:
63
65
67};
68
69} // namespace Ult
70
71#endif // ULT_TEXTURE_SHADER_H_INCLUDED
72
Effect()
Definition Effect.h:30
Definition RenderInterface.h:34
Texture mDecalTexture
Definition TextureShader.h:64
TextureShader(const char *vs, const char *ps, const char *decalFile, std::vector< FilterType > *filters, RenderInterface *renderer)
Definition TextureShader.h:22
ParameterHandle mMvpParam
Definition TextureShader.h:61
RenderInterface * mRenderer
Definition TextureShader.h:66
void Release()
Definition TextureShader.h:54
~TextureShader()
Definition TextureShader.h:38
ParameterHandle mDecalParam
Definition TextureShader.h:62
void ApplyEffect()
Definition TextureShader.h:44
ShaderHandle mShader
Definition TextureShader.h:60
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