Ocular Engine
Ocular::Graphics::D3D11Material Class Reference
Inheritance diagram for Ocular::Graphics::D3D11Material:
Ocular::Graphics::Material Ocular::Core::Resource Ocular::Core::ObjectIO Ocular::Core::Exposable Ocular::Core::Buildable

Public Member Functions

 D3D11Material (ID3D11DeviceContext *context)
virtual void bind () override
virtual void unbind () override
virtual bool setTexture (uint32_t index, std::string const &name, Texture *texture) override
virtual void removeTexture (uint32_t index) override
- Public Member Functions inherited from Ocular::Graphics::Material
virtual void unload () override
virtual void onLoad (Core::BuilderNode const *node) override
virtual void onSave (Core::BuilderNode *node) const override
TexturegetTexture (uint32_t index) const
uint32_t getNumTextures () const
std::vector< TextureSamplerInfo > const * getTextures () const
bool setVertexShader (std::string const &name)
void setVertexShader (VertexShader *shader)
bool setGeometryShader (std::string const &name)
void setGeometryShader (GeometryShader *shader)
bool setFragmentShader (std::string const &name)
void setFragmentShader (FragmentShader *shader)
bool setPreTessellationShader (std::string const &name)
void setPreTessellationShader (PreTessellationShader *shader)
bool setPostTessellationShader (std::string const &name)
void setPostTessellationShader (PostTessellationShader *shader)
VertexShadergetVertexShader () const
GeometryShadergetGeometryShader () const
FragmentShadergetFragmentShader () const
PreTessellationShadergetPreTessellationShader () const
PostTessellationShadergetPostTessellationShader () const
virtual void setUniform (std::string const &name, uint32_t registerIndex, float value)
virtual bool getUniform (std::string const &name, float &value)
virtual void setUniform (std::string const &name, uint32_t registerIndex, Math::Vector4f const &value, std::string const &type=Utils::TypeName< Math::Vector4f >::name)
virtual bool getUniform (std::string const &name, Math::Vector4f &value)
virtual void setUniform (std::string const &name, uint32_t registerIndex, Math::Matrix3x3 const &value)
virtual bool getUniform (std::string const &name, Math::Matrix3x3 &value)
virtual void setUniform (std::string const &name, uint32_t registerIndex, Math::Matrix4x4 const &value)
virtual bool getUniform (std::string const &name, Math::Matrix4x4 &value)
UniformBuffer const * getUniformBuffer () const
void setPrimitiveStyle (PrimitiveStyle style)
PrimitiveStyle getPrimitiveStyle () const
void setFillMode (FillMode mode)
FillMode getFillMode () const
void setRenderPriority (uint32_t priority)
uint32_t getRenderPriority () const
- Public Member Functions inherited from Ocular::Core::Resource
 Resource (File const &source)
virtual void forceLoad ()
File getSourceFile () const
void setSourceFile (File const &file)
void setIsInMemory (bool inMemory)
bool isInMemory () const
void setSize (uint64_t size)
uint64_t getSize () const
ResourceType getResourceType () const
void setName (std::string const &name)
std::string const & getName () const
std::string const & getMappingName () const
void setMappingName (std::string const &name)
ResourceMetadatagetMetadata () const
void setMetadata (ResourceMetadata *metadata)
- Public Member Functions inherited from Ocular::Core::Exposable
void getAllExposedNames (std::vector< std::string > &names) const
bool getVariable (std::string const &name, ExposedVariable &var)
template<typename T >
bool getVariableValue (std::string const &name, T &var)
template<typename T >
bool setVariableValue (std::string const &name, T const &value)
virtual void onVariableModified (std::string const &varName)

Protected Member Functions

void createSampler ()
void bindTextures ()
void unbindTextures ()
- Protected Member Functions inherited from Ocular::Graphics::Material
void setDefaults ()
void bindShaders ()
void unbindShaders ()
void bindStateChanges ()
void unbindStateChanges ()
- Protected Member Functions inherited from Ocular::Core::Exposable
void exposeVariable (std::string const &name, std::string const &type, bool isPointer, bool isExposed, void *data)

Protected Attributes

ID3D11DeviceContext * m_D3DDeviceContext
ID3D11SamplerState * m_D3DSampler
std::vector< ID3D11ShaderResourceView * > m_ShaderResourceViews
std::vector< ID3D11ShaderResourceView * > m_NullShaderResourceViews
- Protected Attributes inherited from Ocular::Graphics::Material
RasterState m_StoredRasterState
std::vector< TextureSamplerInfom_Textures
uint32_t m_RenderPriority
- Protected Attributes inherited from Ocular::Core::Resource
ResourceType m_Type
File m_SourceFile
bool m_IsInMemory
uint64_t m_SizeInMemory
std::string m_Name
std::string m_MappingName
- Protected Attributes inherited from Ocular::Core::Exposable
std::unordered_map< std::string, ExposedVariablem_ExposedVariables

Additional Inherited Members

- Static Public Attributes inherited from Ocular::Graphics::Material
static const std::string ShaderNodeName = "ShaderProgram"
static const std::string TextureNodeName = "Textures"
static const std::string UniformNodeName = "Uniforms"
static const std::string RenderStateNodeName = "RenderState"

Member Function Documentation

void Ocular::Graphics::D3D11Material::removeTexture ( uint32_t  index)

Removes the texture at the specified index from this material.


Reimplemented from Ocular::Graphics::Material.

bool Ocular::Graphics::D3D11Material::setTexture ( uint32_t  index,
std::string const &  name,
Texture texture 

Assigns a texture to a specific input register for use by the shaders that are part of this material. All textures are automatically bound to all relevant (non-NULL) shader stages.

Depending on the underlying graphics API, and shader implementation language, some may make use of the index or the name or both.

Note that some texture assignment indices and names are reserved by the engine. See ----— for a list of all reserved locations.

[in]indexThe index to bind the texture to. This can be on the range of 0 to (GraphicsDriver::getMaxBoundTextures - 1). Note that indices do not have to be sequential. For example, you may have use 0, 1, 3, 79.
[in]nameThe name to bind the texture to.
[in]textureThe texture to bind.
TRUE if texture was successfully set. May fail due to invalid index value.

Reimplemented from Ocular::Graphics::Material.

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