ShaderPool

from panda3d.core import ShaderPool
class ShaderPool

Bases: DTOOL_SUPER_BASE

This is the preferred interface for loading shaders for the TextNode system. It is similar to ModelPool and TexturePool in that it unifies references to the same filename.

Inheritance diagram

Inheritance diagram of ShaderPool

__init__(*args, **kwargs)
addShader()

C++ Interface: add_shader(const Filename filename, Shader shader)

/**
  • Adds the indicated already-loaded shader to the pool. The shader will

  • always replace any previously-loaded shader in the pool that had the same

  • filename.

*/

add_shader()

C++ Interface: add_shader(const Filename filename, Shader shader)

/**
  • Adds the indicated already-loaded shader to the pool. The shader will

  • always replace any previously-loaded shader in the pool that had the same

  • filename.

*/

garbageCollect()

C++ Interface: garbage_collect()

/**
  • Releases only those shaders in the pool that have a reference count of

  • exactly 1; i.e. only those shaders that are not being used outside of the

  • pool. Returns the number of shaders released.

*/

garbage_collect()

C++ Interface: garbage_collect()

/**
  • Releases only those shaders in the pool that have a reference count of

  • exactly 1; i.e. only those shaders that are not being used outside of the

  • pool. Returns the number of shaders released.

*/

hasShader()

C++ Interface: has_shader(const Filename filename)

/**
  • Returns true if the shader has ever been loaded, false otherwise.

*/

has_shader()

C++ Interface: has_shader(const Filename filename)

/**
  • Returns true if the shader has ever been loaded, false otherwise.

*/

listContents()

C++ Interface: list_contents(ostream out)

/**
  • Lists the contents of the shader pool to the indicated output stream.

*/

list_contents()

C++ Interface: list_contents(ostream out)

/**
  • Lists the contents of the shader pool to the indicated output stream.

*/

loadShader()

C++ Interface: load_shader(const Filename filename)

/**
  • Loads the given filename up into a shader, if it has not already been

  • loaded, and returns the new shader. If a shader with the same filename was

  • previously loaded, returns that one instead. If the shader file cannot be

  • found, returns NULL.

*/

load_shader()

C++ Interface: load_shader(const Filename filename)

/**
  • Loads the given filename up into a shader, if it has not already been

  • loaded, and returns the new shader. If a shader with the same filename was

  • previously loaded, returns that one instead. If the shader file cannot be

  • found, returns NULL.

*/

releaseAllShaders()

C++ Interface: release_all_shaders()

/**
  • Releases all shaders in the pool and restores the pool to the empty state.

*/

releaseShader()

C++ Interface: release_shader(const Filename filename)

/**
  • Removes the indicated shader from the pool, indicating it will never be

  • loaded again; the shader may then be freed. If this function is never

  • called, a reference count will be maintained on every shader every loaded,

  • and shaders will never be freed.

*/

release_all_shaders()

C++ Interface: release_all_shaders()

/**
  • Releases all shaders in the pool and restores the pool to the empty state.

*/

release_shader()

C++ Interface: release_shader(const Filename filename)

/**
  • Removes the indicated shader from the pool, indicating it will never be

  • loaded again; the shader may then be freed. If this function is never

  • called, a reference count will be maintained on every shader every loaded,

  • and shaders will never be freed.

*/

verifyShader()

C++ Interface: verify_shader(const Filename filename)

/**
  • Loads the given filename up into a shader, if it has not already been

  • loaded, and returns true to indicate success, or false to indicate failure.

  • If this returns true, it is guaranteed that a subsequent call to

  • load_shader() with the same shader name will return a valid Shader pointer.

*/

verify_shader()

C++ Interface: verify_shader(const Filename filename)

/**
  • Loads the given filename up into a shader, if it has not already been

  • loaded, and returns true to indicate success, or false to indicate failure.

  • If this returns true, it is guaranteed that a subsequent call to

  • load_shader() with the same shader name will return a valid Shader pointer.

*/

write()

C++ Interface: write(ostream out)

/**
  • Lists the contents of the shader pool to the indicated output stream.

*/