Panda3D

- Main Page
- Packages
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Static Public Member Functions

# Shader Class Reference

Inheritance diagram for Shader:

List of all members.

## Public Types
enum | AutoShaderBit { bitAutoShaderNormal = 0, bitAutoShaderGlow = 1, bitAutoShaderGloss = 2, bitAutoShaderRamp = 3, bitAutoShaderShadow = 4 }
enum | AutoShaderSwitch { ASNormal = 1, ASGlow = 2, ASGloss = 4, ASRamp = 8, ASShadow = 16 }
enum | ShaderLanguage { SLNone = 0, SLCg = 1, SLGLSL = 2 }
enum | ShaderType { STNone = 0, STVertex = 1, STFragment = 2, STGeometry = 3 }
## Public Member Functions
bool | getErrorFlag ()
| Returns true if the shader contains a compile-time error.
Filename const | getFilename (ShaderType type)
| Return the Shader's filename for the given shader type.
Filename const | getFilename ()
| Return the Shader's filename for the given shader type.
ShaderLanguage | getLanguage ()
| Returns the shader language in which this shader was written.
string | getText ()
| Return the Shader's text for the given shader type.
string | getText (ShaderType type)
| Return the Shader's text for the given shader type.
bool | isPrepared (PreparedGraphicsObjects prepared_objects)
| Returns true if the shader has already been prepared or enqueued for preparation on the indicated GSG, false otherwise.
| prepare (PreparedGraphicsObjects prepared_objects)
| Indicates that the shader should be enqueued to be prepared in the indicated prepared_objects at the beginning of the next frame.
ShaderContext | prepareNow (PreparedGraphicsObjects prepared_objects, GraphicsStateGuardianBase gsg)
| Creates a context for the shader on the particular GSG, if it does not already exist.
bool | release (PreparedGraphicsObjects prepared_objects)
| Frees the texture context only on the indicated object, if it exists there.
int | releaseAll ()
| Frees the context allocated on all objects for which the texture has been declared.
## Static Public Member Functions
static TypeHandle | getClassType ()
static ShaderUtilization | getShaderUtilization ()
| This flag returns SUT_none, SUT_basic, or SUT_advanced and controls the automatic generation of shaders.
static bool | haveShaderUtilization ()
| If true, then get_shader_utilization has been set using set_shader_utilization.
static Shader | load (Filename const file)
| Loads the shader with the given filename.
static Shader | load (ShaderLanguage lang, Filename const vertex, Filename const fragment)
| This variant of Shader.load loads all shader programs separately.
static Shader | load (Filename const file, ShaderLanguage lang)
| Loads the shader with the given filename.
static Shader | load (ShaderLanguage lang, Filename const vertex, Filename const fragment, Filename const geometry)
| This variant of Shader.load loads all shader programs separately.
static Shader | make (ShaderLanguage lang, string vertex, string fragment)
| Loads the shader, using the strings as shader bodies.
static Shader | make (ShaderLanguage lang, string vertex, string fragment, string geometry)
| Loads the shader, using the strings as shader bodies.
static Shader | make (string body)
| Loads the shader, using the string as shader body.
static Shader | make (string body, ShaderLanguage lang)
| Loads the shader, using the string as shader body.
static | setShaderUtilization (ShaderUtilization utl)
| Set this flag to SUT_none, SUT_basic, or SUT_advanced to limit panda's automatic shader generation facilities.

## Member Enumeration Documentation

enum AutoShaderBit

Enumerator:

  bitAutoShaderNormal |
  bitAutoShaderGlow |
  bitAutoShaderGloss |
  bitAutoShaderRamp |
  bitAutoShaderShadow |

enum AutoShaderSwitch

Enumerator:

  ASNormal |
  ASGlow |
  ASGloss |
  ASRamp |
  ASShadow |

enum ShaderLanguage

Enumerator:

  SLNone |
  SLCg |
  SLGLSL |

enum ShaderType

Enumerator:

  STNone |
  STVertex |
  STFragment |
  STGeometry |

## Member Function Documentation

static TypeHandle getClassType | ( |  | ) | `[static]`

Reimplemented from TypedReferenceCount.

bool getErrorFlag | ( |  | ) |

Returns true if the shader contains a compile-time error.

This doesn't tell you whether or not the shader is supported on the current video card.

Filename const getFilename | ( |  | ) |

Return the Shader's filename for the given shader type.

Filename const getFilename | ( | ShaderType | type | ) |

Return the Shader's filename for the given shader type.

ShaderLanguage getLanguage | ( |  | ) |

Returns the shader language in which this shader was written.

static ShaderUtilization getShaderUtilization | ( |  | ) | `[static]`

This flag returns SUT_none, SUT_basic, or SUT_advanced and controls the automatic generation of shaders.

It is initialized from the config variable of the same name, but it can be subsequently adjusted.

string getText | ( | ShaderType | type | ) |

Return the Shader's text for the given shader type.

string getText | ( |  | ) |

Return the Shader's text for the given shader type.

static bool haveShaderUtilization | ( |  | ) | `[static]`

If true, then get_shader_utilization has been set using set_shader_utilization.

If false, then get_shader_utilization simply returns the config variable of the same name.

bool isPrepared | ( | PreparedGraphicsObjects | prepared_objects | ) |

Returns true if the shader has already been prepared or enqueued for preparation on the indicated GSG, false otherwise.

static Shader load | ( | Filename const | file | ) | `[static]`

Loads the shader with the given filename.

static Shader load | ( | Filename const | file,
|  | ShaderLanguage | lang
| ) |  | `[static]`

Loads the shader with the given filename.

static Shader load | ( | ShaderLanguage | lang,
|  | Filename const | vertex,
|  | Filename const | fragment
| ) |  | `[static]`

This variant of Shader.load loads all shader programs separately.

static Shader load | ( | ShaderLanguage | lang,
|  | Filename const | vertex,
|  | Filename const | fragment,
|  | Filename const | geometry
| ) |  | `[static]`

This variant of Shader.load loads all shader programs separately.

static Shader make | ( | string | body | ) | `[static]`

Loads the shader, using the string as shader body.

static Shader make | ( | ShaderLanguage | lang,
|  | string | vertex,
|  | string | fragment,
|  | string | geometry
| ) |  | `[static]`

Loads the shader, using the strings as shader bodies.

static Shader make | ( | ShaderLanguage | lang,
|  | string | vertex,
|  | string | fragment
| ) |  | `[static]`

Loads the shader, using the strings as shader bodies.

static Shader make | ( | string | body,
|  | ShaderLanguage | lang
| ) |  | `[static]`

Loads the shader, using the string as shader body.

prepare | ( | PreparedGraphicsObjects | prepared_objects | ) |

Indicates that the shader should be enqueued to be prepared in the indicated prepared_objects at the beginning of the next frame.

This will ensure the texture is already loaded into texture memory if it is expected to be rendered soon.

Use this function instead of prepare_now() to preload textures from a user interface standpoint.

ShaderContext prepareNow | ( | PreparedGraphicsObjects | prepared_objects,
|  | GraphicsStateGuardianBase | gsg
| ) |  |

Creates a context for the shader on the particular GSG, if it does not already exist.

Returns the new (or old) ShaderContext. This assumes that the GraphicsStateGuardian is the currently active rendering context and that it is ready to accept new textures. If this is not necessarily the case, you should use prepare() instead.

Normally, this is not called directly except by the GraphicsStateGuardian; a shader does not need to be explicitly prepared by the user before it may be rendered.

bool release | ( | PreparedGraphicsObjects | prepared_objects | ) |

Frees the texture context only on the indicated object, if it exists there.

Returns true if it was released, false if it had not been prepared.

int releaseAll | ( |  | ) |

Frees the context allocated on all objects for which the texture has been declared.

Returns the number of contexts which have been freed.

static setShaderUtilization | ( | ShaderUtilization | utl | ) | `[static]`

Set this flag to SUT_none, SUT_basic, or SUT_advanced to limit panda's automatic shader generation facilities.

All Classes Namespaces Functions Variables Enumerations Enumerator Properties