| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- #include "CmMaterial.h"
- #include "CmException.h"
- #include "CmShader.h"
- #include "CmTechnique.h"
- namespace CamelotEngine
- {
- void Material::setShader(ShaderPtr shader)
- {
- mShader = shader;
- }
- void Material::throwIfNotInitialized() const
- {
- if(mShader == nullptr)
- {
- CM_EXCEPT(InternalErrorException, "Material does not have shader set.");
- }
- }
- void Material::setTexture(const String& name, TexturePtr value)
- {
- throwIfNotInitialized();
- }
- void Material::setFloat(const String& name, float value)
- {
- throwIfNotInitialized();
- }
- void Material::setColor(const String& name, const Color& value)
- {
- throwIfNotInitialized();
- }
- void Material::setVec(const String& name, const Vector2& value)
- {
- throwIfNotInitialized();
- }
- void Material::setVec(const String& name, const Vector3& value)
- {
- throwIfNotInitialized();
- }
- void Material::setVec(const String& name, const Vector4& value)
- {
- throwIfNotInitialized();
- }
- void Material::setMat(const String& name, const Matrix3& value)
- {
- throwIfNotInitialized();
- }
- void Material::setMat(const String& name, const Matrix4& value)
- {
- throwIfNotInitialized();
- }
- UINT32 Material::getNumPasses() const
- {
- throwIfNotInitialized();
- return mShader->getBestTechnique()->getNumPasses();
- }
- void Material::applyPass(UINT32 passIdx)
- {
- throwIfNotInitialized();
- }
- }
|