Panda3D
 All Classes Functions Variables Enumerations
shaderContext.h
1 // Filename: shaderContext.h
2 // Created by: jyelon (01Sep05)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef SHADERCONTEXT_H
16 #define SHADERCONTEXT_H
17 
18 #include "pandabase.h"
19 #include "internalName.h"
20 #include "savedContext.h"
21 #include "shader.h"
22 
23 ////////////////////////////////////////////////////////////////////
24 // Class : ShaderContext
25 // Description : The ShaderContext is meant to contain the compiled
26 // version of a shader string. ShaderContext is an
27 // abstract base class, there will be a subclass of it
28 // for each shader language and graphics API.
29 // Since the languages are so different and the
30 // graphics APIs have so little in common, the base
31 // class contains almost nothing. All the implementation
32 // details are in the subclasses.
33 ////////////////////////////////////////////////////////////////////
34 
35 class EXPCL_PANDA_GOBJ ShaderContext: public SavedContext {
36 public:
37  INLINE ShaderContext(Shader *se);
38 
39  INLINE virtual bool valid() { return false; }
40  INLINE virtual void bind(bool reissue_parameters = true) {};
41  INLINE virtual void unbind() {};
42  INLINE virtual void issue_parameters(int altered) {};
43  INLINE virtual void disable_shader_vertex_arrays() {};
44  INLINE virtual bool update_shader_vertex_arrays(ShaderContext *prev, bool force) { return false; };
45  INLINE virtual void disable_shader_texture_bindings() {};
46  INLINE virtual void update_shader_texture_bindings(ShaderContext *prev) {};
47 
48  INLINE virtual bool uses_standard_vertex_arrays(void) { return true; };
49  INLINE virtual bool uses_custom_vertex_arrays(void) { return false; };
50  INLINE virtual bool uses_custom_texture_bindings(void) { return false; };
51 
52 PUBLISHED:
53  INLINE Shader *get_shader() const;
54 
55 public:
56  Shader *_shader;
57 
58 public:
59  static TypeHandle get_class_type() {
60  return _type_handle;
61  }
62  static void init_type() {
64  register_type(_type_handle, "ShaderContext",
65  TypedObject::get_class_type());
66  }
67  virtual TypeHandle get_type() const {
68  return get_class_type();
69  }
70  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
71 
72 private:
73  static TypeHandle _type_handle;
74 };
75 
76 #include "shaderContext.I"
77 
78 #endif
static void init_type()
This function is declared non-inline to work around a compiler bug in g++ 2.96.
Definition: typedObject.cxx:52
Definition: shader.h:50
The ShaderContext is meant to contain the compiled version of a shader string.
Definition: shaderContext.h:35
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
This is the base class for all GSG-specific context objects, such as TextureContext and GeomContext...
Definition: savedContext.h:29