Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Ogre::Quake3ShaderManager Class Reference

Class for managing Quake3 custom shaders. More...

#include <OgreQuake3ShaderManager.h>

Inheritance diagram for Ogre::Quake3ShaderManager:

Ogre::ScriptLoader Ogre::Singleton< Quake3ShaderManager > List of all members.

Public Member Functions

 Quake3ShaderManager ()
virtual ~Quake3ShaderManager ()
const StringVectorgetScriptPatterns (void) const
 
Remarks:
This method is called when a resource group is loaded if you use ResourceGroupManager::_registerScriptLoader.
Returns:
A list of file patterns, in the order they should be searched in.


void parseScript (DataStreamPtr &stream, const String &groupName)
 
Parameters:
stream Weak reference to a data stream which is the source of the script
groupName The name of a resource group which should be used if any resources are created during the parse of this script.


Real getLoadingOrder (void) const
 
Parameters:
stream Weak reference to a data stream which is the source of the script
groupName The name of a resource group which should be used if any resources are created during the parse of this script.


Quake3Shadercreate (const String &name)
 Create implementation.

void clear (void)
 Clear all the current shaders.

Quake3ShadergetByName (const String &name)
 Retrieve a Quake3Shader by name.


Static Public Member Functions

Quake3ShaderManagergetSingleton (void)
 Override standard Singleton retrieval.

Quake3ShaderManagergetSingletonPtr (void)
 Override standard Singleton retrieval.


Protected Types

typedef std::map< String,
Quake3Shader * > 
Quake3ShaderMap

Protected Member Functions

void parseNewShaderPass (DataStreamPtr &stream, Quake3Shader *pShader)
void parseShaderAttrib (const String &line, Quake3Shader *pShader)
void parseShaderPassAttrib (const String &line, Quake3Shader *pShader, Quake3Shader::Pass *pPass)
SceneBlendFactor convertBlendFunc (const String &q3func)

Protected Attributes

Quake3ShaderMap mShaderMap
StringVector mScriptPatterns

Static Protected Attributes

Quake3ShaderManagerms_Singleton

Detailed Description

Class for managing Quake3 custom shaders.

Quake3 uses .shader files to define custom shaders, or Materials in Ogre-speak. When a surface texture is mentioned in a level file, it includes no file extension meaning that it can either be a standard texture image (+lightmap) if there is only a .jpg or .tga file, or it may refer to a custom shader if a shader with that name is included in one of the .shader files in the scripts/ folder. Because there are multiple shaders per file you have to parse all the .shader files available to know if there is a custom shader available. This class is designed to parse all the .shader files available and save their settings for future use. I choose not to set up Material instances for shaders found since they may or may not be used by a level, so it would be very wasteful to set up Materials since they load texture images for each layer (apart from the lightmap). Once the usage of a shader is confirmed, a full Material instance can be set up from it. Because this is a subclass of ScriptLoader, any files mentioned will be searched for in any path or archive added to the ResourceGroupManager::WORLD_GROUP_NAME group. See ResourceGroupManager for details.

Definition at line 51 of file OgreQuake3ShaderManager.h.


Member Typedef Documentation

typedef std::map<String, Quake3Shader*> Ogre::Quake3ShaderManager::Quake3ShaderMap [protected]
 

Definition at line 59 of file OgreQuake3ShaderManager.h.


Constructor & Destructor Documentation

Ogre::Quake3ShaderManager::Quake3ShaderManager  ) 
 

virtual Ogre::Quake3ShaderManager::~Quake3ShaderManager  )  [virtual]
 


Member Function Documentation

void Ogre::Quake3ShaderManager::clear void   ) 
 

Clear all the current shaders.

SceneBlendFactor Ogre::Quake3ShaderManager::convertBlendFunc const String q3func  )  [protected]
 

Quake3Shader* Ogre::Quake3ShaderManager::create const String name  ) 
 

Create implementation.

Quake3Shader* Ogre::Quake3ShaderManager::getByName const String name  ) 
 

Retrieve a Quake3Shader by name.

Real Ogre::Quake3ShaderManager::getLoadingOrder void   )  const [virtual]
 

Parameters:
stream Weak reference to a data stream which is the source of the script
groupName The name of a resource group which should be used if any resources are created during the parse of this script.

Implements Ogre::ScriptLoader.

const StringVector& Ogre::Quake3ShaderManager::getScriptPatterns void   )  const [virtual]
 

Remarks:
This method is called when a resource group is loaded if you use ResourceGroupManager::_registerScriptLoader.
Returns:
A list of file patterns, in the order they should be searched in.

Implements Ogre::ScriptLoader.

Quake3ShaderManager& Ogre::Quake3ShaderManager::getSingleton void   )  [static]
 

Override standard Singleton retrieval.

Remarks:
Why do we do this? Well, it's because the Singleton implementation is in a .h file, which means it gets compiled into anybody who includes it. This is needed for the Singleton template to work, but we actually only want it compiled into the implementation of the class based on the Singleton, not all of them. If we don't change this, we get link errors when trying to use the Singleton-based class from an outside dll.
This method just delegates to the template version anyway, but the implementation stays in this single compilation unit, preventing link errors.

Reimplemented from Ogre::Singleton< Quake3ShaderManager >.

Quake3ShaderManager* Ogre::Quake3ShaderManager::getSingletonPtr void   )  [static]
 

Override standard Singleton retrieval.

Remarks:
Why do we do this? Well, it's because the Singleton implementation is in a .h file, which means it gets compiled into anybody who includes it. This is needed for the Singleton template to work, but we actually only want it compiled into the implementation of the class based on the Singleton, not all of them. If we don't change this, we get link errors when trying to use the Singleton-based class from an outside dll.
This method just delegates to the template version anyway, but the implementation stays in this single compilation unit, preventing link errors.

Reimplemented from Ogre::Singleton< Quake3ShaderManager >.

void Ogre::Quake3ShaderManager::parseNewShaderPass DataStreamPtr stream,
Quake3Shader pShader
[protected]
 

void Ogre::Quake3ShaderManager::parseScript DataStreamPtr stream,
const String groupName
[virtual]
 

Parameters:
stream Weak reference to a data stream which is the source of the script
groupName The name of a resource group which should be used if any resources are created during the parse of this script.

Implements Ogre::ScriptLoader.

void Ogre::Quake3ShaderManager::parseShaderAttrib const String line,
Quake3Shader pShader
[protected]
 

void Ogre::Quake3ShaderManager::parseShaderPassAttrib const String line,
Quake3Shader pShader,
Quake3Shader::Pass pPass
[protected]
 


Member Data Documentation

Quake3ShaderManager * Ogre::Singleton< Quake3ShaderManager >::ms_Singleton [static, protected, inherited]
 

Definition at line 54 of file OgreSingleton.h.

StringVector Ogre::Quake3ShaderManager::mScriptPatterns [protected]
 

Definition at line 61 of file OgreQuake3ShaderManager.h.

Quake3ShaderMap Ogre::Quake3ShaderManager::mShaderMap [protected]
 

Definition at line 60 of file OgreQuake3ShaderManager.h.


The documentation for this class was generated from the following file:

Copyright © 2000-2005 by The OGRE Team
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Mar 12 14:47:06 2006