Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members |
#include <Shader.h>
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 | |
ShaderParameter * | createParameter (const std::string &name, ShaderParameterType type, u32 index, u32 elemCount) |
virtual ShaderParameter * | createParameterImpl (const std::string &name) |
ShaderParameter * | findParameter (const std::string &name) |
f32 * | getFloatPrameterData (u32 index) |
const f32 * | getFloatPrameterData (u32 index) const |
s32 * | getIntPrameterData (u32 index) |
const s32 * | getIntPrameterData (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< f32 > | mFloatParameterData |
std::vector< s32 > | mIntParameterData |
hashmap< std::string, ShaderParameter * > | mParameters |
ShaderType | mShaderType |
std::string | mSource |
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.
render::Shader::Shader | ( | const std::string & | name, |
resource::Serializer * | serializer | ||
) |
References initProperties(), resource::Resource::mResourceType, and resource::RT_RESOURCE_SHADER.
render::Shader::~Shader | ( | ) | [virtual] |
References removeAllParameters().
void render::Shader::addParamerter | ( | const std::string & | name, |
ShaderParameterType | type | ||
) | [virtual] |
References createParameter(), findParameter(), getElementCount(), isFloat(), mFloatParameterData, and mIntParameterData.
void render::Shader::bind | ( | ) | [virtual] |
Referenced by render::RenderDriver::bindShader().
ShaderParameter * render::Shader::createParameter | ( | const std::string & | name, |
ShaderParameterType | type, | ||
u32 | index, | ||
u32 | elemCount | ||
) | [protected] |
References createParameterImpl(), render::ShaderParameter::elemCount, render::ShaderParameter::index, mParameters, and render::ShaderParameter::paramType.
Referenced by addParamerter(), setAutoParamerter(), and setParamerter().
ShaderParameter * render::Shader::createParameterImpl | ( | const std::string & | name | ) | [protected, virtual] |
Referenced by createParameter().
ShaderParameter * render::Shader::findParameter | ( | const std::string & | name | ) | [protected] |
References mParameters.
Referenced by addParamerter(), setAutoParamerter(), and setParamerter().
u32 render::Shader::getElementCount | ( | ShaderParameterType | type | ) | [static, protected] |
References render::SPT_FLOAT, render::SPT_FLOAT2, render::SPT_FLOAT3, render::SPT_FLOAT4, render::SPT_INT, render::SPT_INT2, render::SPT_INT3, render::SPT_INT4, render::SPT_MATRIX_2X2, render::SPT_MATRIX_2X3, render::SPT_MATRIX_2X4, render::SPT_MATRIX_3X2, render::SPT_MATRIX_3X3, render::SPT_MATRIX_3X4, render::SPT_MATRIX_4X2, render::SPT_MATRIX_4X3, render::SPT_MATRIX_4X4, render::SPT_SAMPLER1D, render::SPT_SAMPLER1DSHADOW, render::SPT_SAMPLER2D, render::SPT_SAMPLER2DSHADOW, render::SPT_SAMPLER3D, and render::SPT_SAMPLERCUBE.
Referenced by addParamerter(), setAutoParamerter(), and setParamerter().
u32 render::Shader::getElementCount | ( | 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, and render::SAPT_WORLDVIEWPROJ_MATRIX.
References mFloatParameterData.
References mFloatParameterData.
References mIntParameterData.
References mIntParameterData.
ShaderType render::Shader::getShaderType | ( | ) |
Gets the type of shader.
References mShaderType.
Referenced by render::RenderDriver::bindShader(), render::Material::setFragmentShader(), render::Material::setGeometryShader(), and render::Material::setVertexShader().
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 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 Color & | col | ||
) | [virtual] |
References createParameter(), findParameter(), render::Color::get(), getElementCount(), render::ShaderParameter::index, mFloatParameterData, render::SPT_FLOAT4, and writedParameterData().
Referenced by updateAutoParameters().
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] |
Referenced by render::RenderDriver::bindShader(), and render::RenderDriver::unbindShader().
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().
References mIntParameterData.
References mFloatParameterData.
Referenced by setParamerter().
std::string render::Shader::mEntryPoint [protected] |
Referenced by setEntryPoint().
std::vector<f32> render::Shader::mFloatParameterData [protected] |
Referenced by addParamerter(), getFloatPrameterData(), removeAllParameters(), setAutoParamerter(), setParamerter(), and writedParameterData().
std::vector<s32> render::Shader::mIntParameterData [protected] |
Referenced by addParamerter(), getIntPrameterData(), removeAllParameters(), setAutoParamerter(), setParamerter(), and writedParameterData().
hashmap<std::string, ShaderParameter*> render::Shader::mParameters [protected] |
Referenced by createParameter(), findParameter(), removeAllParameters(), and updateAutoParameters().
ShaderType render::Shader::mShaderType [protected] |
Referenced by getShaderType(), initProperties(), and setShaderType().
std::string render::Shader::mSource [protected] |
Referenced by initProperties(), loadImpl(), and setSource().
The KG Game Engine
Documentation © 2006-2011 by Kat'Oun. Generated on Sat Jul 2 2011 00:50:09 by
Doxygen
(1.7.4)
|