StaticProgram.h
1 /*
2 
3 Copyright (c) 2018, Johnathan Corkery. (jcorkery@umich.edu)
4 All rights reserved.
5 
6 This file is part of the Dynacoe project (https://github.com/jcorks/Dynacoe)
7 Dynacoe was released under the MIT License, as detailed below.
8 
9 
10 
11 Permission is hereby granted, free of charge, to any person obtaining a copy
12 of this software and associated documentation files (the "Software"), to deal
13 in the Software without restriction, including without limitation the rights
14 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 copies of the Software, and to permit persons to whom the Software is furnished
16 to do so, subject to the following conditions:
17 
18 The above copyright notice and this permission notice shall
19 be included in all copies or substantial portions of the Software.
20 
21 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27 DEALINGS IN THE SOFTWARE.
28 
29 
30 
31 */
32 
33 #if ( defined DC_BACKENDS_SHADERGL_X11 || defined DC_BACKENDS_SHADERGL_WIN32 )
34 
35 #ifndef H_DC_STATICPROGRAM_INCLUDED
36 #define H_DC_STATICPROGRAM_INCLUDED
37 
38 #include <Dynacoe/Backends/Renderer/ShaderGL_Multi.h>
39 #include <string>
40 
41 namespace Dynacoe {
42 
43 
44 class StaticProgram {
45  public:
46 
47  virtual bool Set(const char * vertexShader,
48  const char * fragShader,
49 
50  const std::string & name,
51  RenderBuffer * DynacoeView_uniformID,
52  RenderBuffer * Projection_uniformID,
53  RenderBuffer * DynacoeTexturePos_uniformID, // 4 components: xy pos, zw dims 0 -> GUT,
54  RenderBuffer * DynacoeTextureInfo_uniformID, // 4 component: x- enabled
55  RenderBuffer * DynacoeLighting_uniformID, // 4 components: xyz position, w intensity
56  RenderBuffer * DynacoeLightingInfo_uniformID // 4 components: xyz color, w type
57  ) = 0;
58  virtual ~StaticProgram(){};
59 
60  virtual void Run(
61  uint32_t * indexList,
62  uint32_t numIndices,
63  RenderBuffer * vertexBuffer,
64  RenderBuffer * matBufferID,
65  RenderBuffer * modelID,
66  GLuint baseTex,
67  GLuint fbTex) = 0;
68 
69  virtual std::string GetLog() = 0;
70 
71  // returns the base texture index for normal texture bindings
72  int GetBaseTextureActiveIndex() {return GL_TEXTURE0; }
73 
74  // returns the base texutre index for source framebuffer bindings
75  int GetSourceFBTextureActiveIndex() {return GL_TEXTURE0+1;}
76 
77  virtual int MaxLights() =0;
78 
79  virtual int MaxTextures() =0;
80 
81 };
82 
83 StaticProgram * CreateStaticProgram();
84 }
85 
86 
87 #endif
88 #endif
Definition: AssetID.h:37