ShaderPool

Inheritance:

Methods of ShaderPool:

addShader
static void ShaderPool::add_shader(string const &filename, Shader *shader);

Description: 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
static int ShaderPool::garbage_collect(void);

Description: 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
static bool ShaderPool::has_shader(string const &filename);

These functions take string parameters instead of Filenames because that's somewhat more convenient to the scripting language.
Filename: shaderPool.I Created by: aignacio (Mar06)
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University. All rights reserved.
All use of this software is subject to the terms of the revised BSD license. You should have received a copy of this license along with this source code in a file named "LICENSE."
Description: Returns true if the shader has ever been loaded, false otherwise.

listContents
static void ShaderPool::list_contents(ostream &out);

Description: Lists the contents of the shader pool to the indicated output stream.

loadShader
static ConstPointerTo< Shader > ShaderPool::load_shader(string const &filename);

Description: 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
static void ShaderPool::release_all_shaders(void);

Description: Releases all shaders in the pool and restores the pool to the empty state.

releaseShader
static void ShaderPool::release_shader(string const &filename);

Description: 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
static bool ShaderPool::verify_shader(string const &filename);

These functions take string parameters instead of Filenames because that's somewhat more convenient to the scripting language.
Description: 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
static void ShaderPool::write(ostream &out);

Description: Lists the contents of the shader pool to the indicated output stream.