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