Panda3D
|
#include <pandadoc.hpp>
Public Types | |
enum | AutoShaderBit { bit_AutoShaderNormal = 0 , bit_AutoShaderGlow = 1 , bit_AutoShaderGloss = 2 , bit_AutoShaderRamp = 3 , bit_AutoShaderShadow = 4 } |
enum | AutoShaderSwitch { AS_normal = 1 , AS_glow = 2 , AS_gloss = 4 , AS_ramp = 8 , AS_shadow = 16 } |
enum | ShaderLanguage { SL_none = 0 , SL_Cg = 1 , SL_GLSL = 2 , SL_HLSL = 3 , SL_SPIR_V = 4 } |
enum | ShaderType { ST_none = 0 , ST_vertex = 1 , ST_fragment = 2 , ST_geometry = 3 , ST_tess_control = 4 , ST_tess_evaluation = 5 , ST_compute = 6 , ST_COUNT = 7 } |
Public Member Functions | |
__init__ (const Shader) | |
bool | getCacheCompiledShader () |
Returns the setting of the cache_compiled_shader flag. | |
bool | getErrorFlag () |
Returns true if the shader contains a compile-time error. | |
Filename | getFilename (Shader::ShaderType type) |
Return the Shader's filename for the given shader type. | |
const Filename | getFullpath () |
Returns the fullpath that has been set. | |
Shader::ShaderLanguage | getLanguage () |
Returns the shader language in which this shader was written. | |
str | getText (Shader::ShaderType type) |
Return the Shader's text for the given shader type. | |
bool | hasFullpath () |
Returns true if the fullpath has been set and is available. | |
bool | isPrepared (PreparedGraphicsObjects prepared_objects) |
Returns true if the shader has already been prepared or enqueued for preparation on the indicated GSG, false otherwise. | |
AsyncFuture | 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. | |
setCacheCompiledShader (bool flag) | |
Sets the cache_compiled_shader flag. | |
setFilename (Shader::ShaderType type, const Filename filename) | |
Sets the Shader's filename for the given shader type. | |
![]() | |
object | __reduce__ () |
object | __reduce_persist__ (object pickler) |
VectorUchar | encodeToBamStream () |
Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a bytes object. | |
bool | encodeToBamStream (VectorUchar data, BamWriter writer) |
Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string. | |
fillin (DatagramIterator scan, BamReader manager) | |
This internal function is intended to be called by each class's make_from_bam() method to read in all of the relevant data from the BamFile for the new object. | |
UpdateSeq | getBamModified () |
Returns the current bam_modified counter. | |
markBamModified () | |
Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams. | |
![]() | |
TypeHandle | getType () |
int | getTypeIndex () |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. | |
bool | isExactType (TypeHandle handle) |
Returns true if the current object is the indicated type exactly. | |
bool | isOfType (TypeHandle handle) |
Returns true if the current object is or derives from the indicated type. | |
![]() | |
int | getRefCount () |
Returns the current reference count. | |
ref () | |
Explicitly increments the reference count. | |
bool | testRefCountIntegrity () |
Does some easy checks to make sure that the reference count isn't completely bogus. | |
bool | testRefCountNonzero () |
Does some easy checks to make sure that the reference count isn't zero, or completely bogus. | |
bool | unref () |
Explicitly decrements the reference count. | |
Static Public Member Functions | |
static TypeHandle | getClassType () |
static Shader | load (const Filename file, Shader::ShaderLanguage lang) |
Loads the shader with the given filename. | |
static Shader | load (Shader::ShaderLanguage lang, const Filename vertex, const Filename fragment, const Filename geometry, const Filename tess_control, const Filename tess_evaluation) |
This variant of Shader::load loads all shader programs separately. | |
static Shader | loadCompute (Shader::ShaderLanguage lang, const Filename fn) |
Loads a compute shader. | |
static Shader | make (Shader::ShaderLanguage lang, str vertex, str fragment, str geometry, str tess_control, str tess_evaluation) |
Loads the shader, using the strings as shader bodies. | |
static Shader | make (str body, Shader::ShaderLanguage lang) |
Loads the shader, using the string as shader body. | |
static Shader | makeCompute (Shader::ShaderLanguage lang, str body) |
Loads the compute shader from the given string. | |
![]() | |
static TypedWritableReferenceCount | decodeFromBamStream (VectorUchar data, BamReader reader) |
Reads the bytes created by a previous call to encode_to_bam_stream(), and extracts and returns the single object on those bytes. | |
static TypeHandle | getClassType () |
![]() | |
static TypeHandle | getClassType () |
![]() | |
static TypeHandle | getClassType () |
![]() | |
static TypeHandle | getClassType () |
Additional Inherited Members | |
![]() | |
TypeHandle | type |
Returns the TypeHandle representing this object's type. | |
![]() | |
int | ref_count |
The current reference count. | |
enum AutoShaderBit |
enum AutoShaderSwitch |
enum ShaderLanguage |
enum ShaderType |
__init__ | ( | const Shader | ) |
bool getCacheCompiledShader | ( | ) |
Returns the setting of the cache_compiled_shader flag.
See set_cache_compiled_shader().
|
static |
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 getFilename | ( | Shader::ShaderType | type | ) |
Return the Shader's filename for the given shader type.
const Filename getFullpath | ( | ) |
Returns the fullpath that has been set.
This is the full path to the file as it was found along the model-path.
Shader::ShaderLanguage getLanguage | ( | ) |
Returns the shader language in which this shader was written.
str getText | ( | Shader::ShaderType | type | ) |
Return the Shader's text for the given shader type.
bool hasFullpath | ( | ) |
Returns true if the fullpath has been set and is available.
See set_fullpath().
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 |
Loads the shader with the given filename.
|
static |
This variant of Shader::load loads all shader programs separately.
|
static |
Loads a compute shader.
|
static |
Loads the shader, using the strings as shader bodies.
|
static |
Loads the shader, using the string as shader body.
|
static |
Loads the compute shader from the given string.
AsyncFuture 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.
setCacheCompiledShader | ( | bool | flag | ) |
Sets the cache_compiled_shader flag.
When this is set, the next time the Shader is loaded on a GSG, it will automatically extract the compiled shader from the GSG and save it to the global BamCache.
This is used to store compiled shaders in the BamCache. This flag should not be set explicitly; it is set automatically by the ShaderPool when model-cache-compiled-shaders is set true.
setFilename | ( | Shader::ShaderType | type, |
const Filename | filename ) |
Sets the Shader's filename for the given shader type.
Useful for associating a shader created with Shader.make with a name for diagnostics.