Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes
render::Shader Class Reference

#include <Shader.h>

Inheritance diagram for render::Shader:
resource::Resource engine::Object

List of all members.

Public Member Functions

virtual void addParamerter (const std::string &name, ShaderParameterType type)
virtual void bind ()
ShaderType getShaderType ()
 Gets the type of shader.
void setAutoParamerter (const std::string &name, ShaderAutoParameterType type)
void setEntryPoint (const std::string &entry)
virtual void setParamerter (const std::string &name, const s32 *val, u32 count)
virtual void setParamerter (const std::string &name, const core::vector4d &vec)
virtual void setParamerter (const std::string &name, const Color &col)
virtual void setParamerter (const std::string &name, const core::vector2d &vec)
virtual void setParamerter (const std::string &name, const f32 *val, u32 count)
virtual void setParamerter (const std::string &name, const core::vector3d &vec)
virtual void setParamerter (const std::string &name, const core::matrix4 &m)
void setShaderType (const ShaderType &type)
 Sets the type of texture,.
void setSource (const std::string &source)
 Shader (const std::string &name, resource::Serializer *serializer)
virtual void unbind ()
virtual void updateAutoParameters (ShaderParamData &data)
virtual ~Shader ()

Protected Member Functions

ShaderParametercreateParameter (const std::string &name, ShaderParameterType type, u32 index, u32 elemCount)
virtual ShaderParametercreateParameterImpl (const std::string &name)
ShaderParameterfindParameter (const std::string &name)
f32getFloatPrameterData (u32 index)
const f32getFloatPrameterData (u32 index) const
s32getIntPrameterData (u32 index)
const s32getIntPrameterData (u32 index) const
void initProperties ()
virtual bool loadImpl ()
void removeAllParameters ()
virtual void unloadImpl ()
void writedParameterData (u32 index, const f32 *val, u32 count)
void writedParameterData (u32 index, const s32 *val, u32 count)

Static Protected Member Functions

static u32 getElementCount (ShaderParameterType type)
static u32 getElementCount (ShaderAutoParameterType type)
static ShaderParameterType getType (TextureType type)
static ShaderParameterType getType (ShaderAutoParameterType type)
static bool isFloat (ShaderAutoParameterType type)
static bool isFloat (ShaderParameterType type)
static bool isSampler (ShaderParameterType type)

Protected Attributes

std::string mEntryPoint
std::vector< f32mFloatParameterData
std::vector< s32mIntParameterData
hashmap< std::string,
ShaderParameter * > 
mParameters
ShaderType mShaderType
std::string mSource

Detailed Description

Abstract class representing a Shader resource.

This class defines the low-level program in assembler code, the sort used to directly assemble into machine instructions for the GPU to execute.


Constructor & Destructor Documentation

render::Shader::Shader ( const std::string &  name,
resource::Serializer serializer 
)
render::Shader::~Shader ( ) [virtual]

References removeAllParameters().


Member Function Documentation

void render::Shader::addParamerter ( const std::string &  name,
ShaderParameterType  type 
) [virtual]
void render::Shader::bind ( ) [virtual]
ShaderParameter * render::Shader::createParameter ( const std::string &  name,
ShaderParameterType  type,
u32  index,
u32  elemCount 
) [protected]
ShaderParameter * render::Shader::createParameterImpl ( const std::string &  name) [protected, virtual]

Referenced by createParameter().

ShaderParameter * render::Shader::findParameter ( const std::string &  name) [protected]
u32 render::Shader::getElementCount ( ShaderParameterType  type) [static, protected]
u32 render::Shader::getElementCount ( ShaderAutoParameterType  type) [static, protected]
f32 * render::Shader::getFloatPrameterData ( u32  index) [protected]

References mFloatParameterData.

const f32 * render::Shader::getFloatPrameterData ( u32  index) const [protected]

References mFloatParameterData.

s32 * render::Shader::getIntPrameterData ( u32  index) [protected]

References mIntParameterData.

const s32 * render::Shader::getIntPrameterData ( u32  index) const [protected]

References mIntParameterData.

ShaderType render::Shader::getShaderType ( )
ShaderParameterType render::Shader::getType ( ShaderAutoParameterType  type) [static, protected]

References render::SAPT_AMBIENT_LIGHT_COLOUR, render::SAPT_CAMERA_POSITION, render::SAPT_CAMERA_POSITION_OBJECT_SPACE, render::SAPT_INVERSE_PROJECTION_MATRIX, render::SAPT_INVERSE_TRANSPOSE_PROJECTION_MATRIX, render::SAPT_INVERSE_TRANSPOSE_VIEW_MATRIX, render::SAPT_INVERSE_TRANSPOSE_VIEWPROJ_MATRIX, render::SAPT_INVERSE_TRANSPOSE_WORLD_MATRIX, render::SAPT_INVERSE_TRANSPOSE_WORLDVIEW_MATRIX, render::SAPT_INVERSE_TRANSPOSE_WORLDVIEWPROJ_MATRIX, render::SAPT_INVERSE_VIEW_MATRIX, render::SAPT_INVERSE_VIEWPROJ_MATRIX, render::SAPT_INVERSE_WORLD_MATRIX, render::SAPT_INVERSE_WORLDVIEW_MATRIX, render::SAPT_INVERSE_WORLDVIEWPROJ_MATRIX, render::SAPT_LIGHT_ATTENUATION, render::SAPT_LIGHT_COUNT, render::SAPT_LIGHT_DIFFUSE_COLOUR, render::SAPT_LIGHT_DIRECTION, render::SAPT_LIGHT_DIRECTION_OBJECT_SPACE, render::SAPT_LIGHT_DIRECTION_VIEW_SPACE, render::SAPT_LIGHT_POSITION, render::SAPT_LIGHT_POSITION_OBJECT_SPACE, render::SAPT_LIGHT_POSITION_VIEW_SPACE, render::SAPT_LIGHT_POWER_SCALE, render::SAPT_LIGHT_SPECULAR_COLOUR, render::SAPT_PROJECTION_MATRIX, render::SAPT_TRANSPOSE_PROJECTION_MATRIX, render::SAPT_TRANSPOSE_VIEW_MATRIX, render::SAPT_TRANSPOSE_VIEWPROJ_MATRIX, render::SAPT_TRANSPOSE_WORLD_MATRIX, render::SAPT_TRANSPOSE_WORLDVIEW_MATRIX, render::SAPT_TRANSPOSE_WORLDVIEWPROJ_MATRIX, render::SAPT_VIEW_MATRIX, render::SAPT_VIEWPROJ_MATRIX, render::SAPT_WORLD_MATRIX, render::SAPT_WORLDVIEW_MATRIX, render::SAPT_WORLDVIEWPROJ_MATRIX, render::SPT_FLOAT, render::SPT_FLOAT3, render::SPT_FLOAT4, render::SPT_INT, and render::SPT_MATRIX_4X4.

Referenced by setAutoParamerter().

ShaderParameterType render::Shader::getType ( TextureType  type) [static, protected]
void render::Shader::initProperties ( ) [protected]

Reimplemented from resource::Resource.

References mShaderType, mSource, and render::ST_VERTEX.

Referenced by Shader().

bool render::Shader::isFloat ( ShaderAutoParameterType  type) [static, protected]
bool render::Shader::isFloat ( ShaderParameterType  type) [static, protected]
bool render::Shader::isSampler ( ShaderParameterType  type) [static, protected]
bool render::Shader::loadImpl ( ) [protected, virtual]

Reimplemented from resource::Resource.

References resource::Resource::mDataStream, and mSource.

void render::Shader::removeAllParameters ( ) [protected]

References mFloatParameterData, mIntParameterData, and mParameters.

Referenced by ~Shader().

void render::Shader::setAutoParamerter ( const std::string &  name,
ShaderAutoParameterType  type 
)
void render::Shader::setEntryPoint ( const std::string &  entry)

References mEntryPoint.

void render::Shader::setParamerter ( const std::string &  name,
const core::vector3d vec 
) [virtual]
void render::Shader::setParamerter ( const std::string &  name,
const core::vector2d vec 
) [virtual]
void render::Shader::setParamerter ( const std::string &  name,
const s32 val,
u32  count 
) [virtual]
void render::Shader::setParamerter ( const std::string &  name,
const core::vector4d vec 
) [virtual]
void render::Shader::setParamerter ( const std::string &  name,
const core::matrix4 m 
) [virtual]
void render::Shader::setParamerter ( const std::string &  name,
const f32 val,
u32  count 
) [virtual]
void render::Shader::setParamerter ( const std::string &  name,
const Color col 
) [virtual]
void render::Shader::setShaderType ( const ShaderType type)

Sets the type of texture,.

References mShaderType.

Referenced by render::RenderManager::createShader().

void render::Shader::setSource ( const std::string &  source)

References mSource.

void render::Shader::unbind ( ) [virtual]
void render::Shader::unloadImpl ( ) [protected, virtual]

Reimplemented from resource::Resource.

void render::Shader::updateAutoParameters ( ShaderParamData data) [virtual]

References render::ShaderParameter::autoParamType, render::ShaderParamData::getAmbientLightColour(), render::ShaderParamData::getCameraPosition(), render::ShaderParamData::getCameraPositionObjectSpace(), render::ShaderParamData::getCurrentLightAttenuation(), render::ShaderParamData::getCurrentLightDiffuseColour(), render::ShaderParamData::getCurrentLightDirection(), render::ShaderParamData::getCurrentLightDirectionObjectSpace(), render::ShaderParamData::getCurrentLightDirectionViewSpace(), render::ShaderParamData::getCurrentLightPosition(), render::ShaderParamData::getCurrentLightPositionObjectSpace(), render::ShaderParamData::getCurrentLightPositionViewSpace(), render::ShaderParamData::getCurrentLightSpecularColour(), render::ShaderParamData::getInverseProjectionMatrix(), render::ShaderParamData::getInverseTransposedProjectionMatrix(), render::ShaderParamData::getInverseTransposedViewMatrix(), render::ShaderParamData::getInverseTransposedViewProjectionMatrix(), render::ShaderParamData::getInverseTransposedWorldMatrix(), render::ShaderParamData::getInverseTransposedWorldViewMatrix(), render::ShaderParamData::getInverseTransposedWorldViewProjMatrix(), render::ShaderParamData::getInverseViewMatrix(), render::ShaderParamData::getInverseViewProjectionMatrix(), render::ShaderParamData::getInverseWorldMatrix(), render::ShaderParamData::getInverseWorldViewMatrix(), render::ShaderParamData::getInverseWorldViewProjMatrix(), render::ShaderParamData::getProjectionMatrix(), render::ShaderParamData::getTransposedProjectionMatrix(), render::ShaderParamData::getTransposedViewMatrix(), render::ShaderParamData::getTransposedViewProjectionMatrix(), render::ShaderParamData::getTransposedWorldMatrix(), render::ShaderParamData::getTransposedWorldViewMatrix(), render::ShaderParamData::getTransposedWorldViewProjMatrix(), render::ShaderParamData::getViewMatrix(), render::ShaderParamData::getViewProjectionMatrix(), render::ShaderParamData::getWorldMatrix(), render::ShaderParamData::getWorldViewMatrix(), render::ShaderParamData::getWorldViewProjMatrix(), mParameters, render::SAPT_AMBIENT_LIGHT_COLOUR, render::SAPT_CAMERA_POSITION, render::SAPT_CAMERA_POSITION_OBJECT_SPACE, render::SAPT_INVERSE_PROJECTION_MATRIX, render::SAPT_INVERSE_TRANSPOSE_PROJECTION_MATRIX, render::SAPT_INVERSE_TRANSPOSE_VIEW_MATRIX, render::SAPT_INVERSE_TRANSPOSE_VIEWPROJ_MATRIX, render::SAPT_INVERSE_TRANSPOSE_WORLD_MATRIX, render::SAPT_INVERSE_TRANSPOSE_WORLDVIEW_MATRIX, render::SAPT_INVERSE_TRANSPOSE_WORLDVIEWPROJ_MATRIX, render::SAPT_INVERSE_VIEW_MATRIX, render::SAPT_INVERSE_VIEWPROJ_MATRIX, render::SAPT_INVERSE_WORLD_MATRIX, render::SAPT_INVERSE_WORLDVIEW_MATRIX, render::SAPT_INVERSE_WORLDVIEWPROJ_MATRIX, render::SAPT_LIGHT_ATTENUATION, render::SAPT_LIGHT_DIFFUSE_COLOUR, render::SAPT_LIGHT_DIRECTION, render::SAPT_LIGHT_DIRECTION_OBJECT_SPACE, render::SAPT_LIGHT_DIRECTION_VIEW_SPACE, render::SAPT_LIGHT_POSITION, render::SAPT_LIGHT_POSITION_OBJECT_SPACE, render::SAPT_LIGHT_POSITION_VIEW_SPACE, render::SAPT_LIGHT_SPECULAR_COLOUR, render::SAPT_PROJECTION_MATRIX, render::SAPT_TRANSPOSE_PROJECTION_MATRIX, render::SAPT_TRANSPOSE_VIEW_MATRIX, render::SAPT_TRANSPOSE_VIEWPROJ_MATRIX, render::SAPT_TRANSPOSE_WORLD_MATRIX, render::SAPT_TRANSPOSE_WORLDVIEW_MATRIX, render::SAPT_TRANSPOSE_WORLDVIEWPROJ_MATRIX, render::SAPT_VIEW_MATRIX, render::SAPT_VIEWPROJ_MATRIX, render::SAPT_WORLD_MATRIX, render::SAPT_WORLDVIEW_MATRIX, render::SAPT_WORLDVIEWPROJ_MATRIX, and setParamerter().

Referenced by render::RenderManager::setMaterial(), and render::RenderDriver::updateShaderAutoParameters().

void render::Shader::writedParameterData ( u32  index,
const s32 val,
u32  count 
) [protected]

References mIntParameterData.

void render::Shader::writedParameterData ( u32  index,
const f32 val,
u32  count 
) [protected]

References mFloatParameterData.

Referenced by setParamerter().


Member Data Documentation

std::string render::Shader::mEntryPoint [protected]

Referenced by setEntryPoint().

std::vector<f32> render::Shader::mFloatParameterData [protected]
std::vector<s32> render::Shader::mIntParameterData [protected]
hashmap<std::string, ShaderParameter*> render::Shader::mParameters [protected]
std::string render::Shader::mSource [protected]

Referenced by initProperties(), loadImpl(), and setSource().


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

The KG Game Engine
The KG Game Engine Documentation © 2006-2011 by Kat'Oun. Generated on Sat Jul 2 2011 00:50:09 by Doxygen (1.7.4)