Cogs.Core
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Cogs::Core::MaterialComponent Struct Reference

Exposes material properties for legacy entities and code. More...

#include <MaterialComponent.h>

Inheritance diagram for Cogs::Core::MaterialComponent:
Cogs::ComponentModel::Component

Public Member Functions

void COGSCORE_DLL_API copyProperties (const MaterialComponent *source)
 
- Public Member Functions inherited from Cogs::ComponentModel::Component
class EntitygetContainer () const
 Get the container currently owning this component instance.
 
void setContainer (class Entity *container)
 Set the container owning this component instance.
 
template<typename ComponentType >
ComponentType * getComponent () const
 
COGSFOUNDATION_API ComponentgetComponent (const Reflection::Name &name) const
 
COGSFOUNDATION_API ComponentgetComponent (const Reflection::TypeId &id) const
 
template<typename ComponentType >
ComponentHandle getComponentHandle () const
 
COGSFOUNDATION_API ComponentHandle getComponentHandle (const Reflection::Name &name) const
 
COGSFOUNDATION_API ComponentHandle getComponentHandle (const Reflection::TypeId &id) const
 
void setActive ()
 Sets the component to the ComponentFlags::Active state.
 
bool isActive () const
 Gets if the component is currently set to the ComponentFlags::Active state.
 
void setChanged ()
 Sets the component to the ComponentFlags::Changed state with carry.
 
void setChangedTransient ()
 Sets the component to the ComponentFlags::Changed state without carry.
 
void setFieldChanged (const Reflection::FieldId fieldId)
 Sets the component to the ComponentFlags::Changed state without carry.
 
template<typename ClassType , typename FieldType >
void setFieldChanged (FieldType ClassType::*field)
 Sets a flag indicating that the given field has changed.
 
void setFieldChangedTransient (const Reflection::FieldId fieldId)
 Sets the component to the ComponentFlags::Changed state without carry.
 
bool hasChanged () const
 
bool hasAnyfieldChanged () const
 Gets if any fields have been changed.
 
bool hasFieldChanged (const Reflection::FieldId fieldId) const
 Gets if the field with the given id on this component instance has changed.
 
template<typename ClassType , typename FieldType >
bool hasFieldChanged (FieldType ClassType::*field) const
 Gets if the given field has changed.
 
void resetCarryChanged ()
 Reset the CarryChanged flag. Called at start of redraw. See ComponentFlags::CarryChanged.
 
void resetChanged ()
 Resets the changed state of the component, respecting any carry state set.
 
template<typename ClassType , typename FieldType >
Reflection::FieldId getFieldId (FieldType ClassType::*field) const
 Gets field ID of the given field.
 
void resetFieldsChanged ()
 Resets the state of all changed field flags.
 
void resetFieldChanged (const Reflection::FieldId fieldId)
 Resets the changed state of the given fieldId.
 
template<typename ClassType , typename FieldType >
void resetFieldChanged (FieldType ClassType::*field)
 Resets the changed state of the given field.
 
constexpr void setFlags (const uint32_t flags)
 Override all flags of the Component, setting the given flags.
 
constexpr void setFlag (const uint32_t flag)
 Set the given flags. Does not override the currently set flags.
 
constexpr void unsetFlag (const uint32_t flag)
 Unset the given flag. Does not remove the status of other than the given flags.
 
constexpr bool isSet (const uint32_t flag) const
 Checks if the given flag is set. Requires exact bit match if test of several bits.
 
constexpr void setTypeId (const Reflection::TypeId typeId)
 Set the Reflection::TypeId of the component.
 
constexpr Reflection::TypeId getTypeId () const
 Get the Reflection::TypeId of the component.
 
COGSFOUNDATION_API const Reflection::TypegetType () const
 Get the full Reflection::Type of the component.
 
constexpr void setIndex (const ComponentIndex index)
 Set the components pool index. For internal use only.
 
constexpr ComponentIndex getIndex () const
 Get the components pool index. For internal use only.
 
constexpr void setGeneration (uint16_t generation)
 Sets the component generation.
 
constexpr uint16_t getGeneration () const
 Gets the component generation.
 
size_t hash (size_t hashValue=Cogs::hash()) const
 Calculates a hash of this component's members.
 

Static Public Member Functions

static void registerType ()
 
- Static Public Member Functions inherited from Cogs::ComponentModel::Component
static COGSFOUNDATION_API void registerType ()
 Register the Component type in the global type database.
 
static COGSFOUNDATION_API Reflection::TypeId getComponentTypeId (const StringView &name)
 Get the type id of the component type with the given name.
 

Public Attributes

WeakEntityPtr material
 
TextureHandle diffuseMap = TextureHandle::NoHandle
 
TextureHandle normalMap = TextureHandle::NoHandle
 
TextureHandle specularMap = TextureHandle::NoHandle
 
glm::vec4 diffuseColor = glm::vec4(1, 1, 1, 1)
 
glm::vec4 emissiveColor = glm::vec4(0, 0, 0, 1)
 
glm::vec4 specularColor = glm::vec4(0, 0, 0, 1)
 
glm::vec4 ambientColor = glm::vec4(0, 0, 0, 1)
 
glm::vec2 diffuseMapScale = glm::vec2(1, 1)
 
glm::vec2 normalMapScale = glm::vec2(1, 1)
 
glm::vec2 specularMapScale = glm::vec2(1, 1)
 
float specularPower = 80
 
float transparency = 0
 
float lineWidth = 1.0f
 
float pointSize = 1.0f
 
float depthBiasConstant = 0.f
 
float depthBiasSlope = 0.f
 
float depthBiasClamp = 0.f
 
float normalMapFactor = 1.0f
 
uint32_t stippleFactor = 1
 
uint32_t stipplePattern = 0xFFFFFFFF
 
int32_t drawOrder = 0
 Manages draw order, maps to MaterialOptions::drawOrder.
 
PrimitiveType::EPrimitiveType primitiveType = PrimitiveType::TriangleList
 
CullMode cullMode = CullMode::None
 
BlendMode blendMode = BlendMode::None
 
SamplerState::AddressMode addressMode = SamplerState::Wrap
 
SamplerState::FilterMode filterMode = SamplerState::FilterMode::MinMagMipLinear
 
bool instancedLine = false
 Lines rendered with instancing.
 
bool vertexColor = false
 
bool backdrop = false
 If true the MaterialFlags::Backdrop on the material instance.
 
bool enableLighting = true
 
bool shadowReceiver = true
 If false, object never gets shadowed.
 
bool depthWriteEnabled = true
 
bool depthTestEnabled = true
 
bool depthTestAlwaysPass = false
 
bool depthBiasEnable = false
 
bool enableOverride = false
 
bool enableColorOverride = true
 
bool enableAlphaOverride = true
 
bool enableTextureOverride = true
 

Detailed Description

Exposes material properties for legacy entities and code.

The values used in the material components will automatically be applied to the material instance(s) on the MeshRenderComponent from the same entity. If no instances are found, a new or shared material will be created.

Definition at line 21 of file MaterialComponent.h.

Member Function Documentation

◆ copyProperties()

void Cogs::Core::MaterialComponent::copyProperties ( const MaterialComponent source)

Definition at line 55 of file MaterialComponent.cpp.

◆ registerType()

void Cogs::Core::MaterialComponent::registerType ( )
static

Definition at line 7 of file MaterialComponent.cpp.

Member Data Documentation

◆ addressMode

SamplerState::AddressMode Cogs::Core::MaterialComponent::addressMode = SamplerState::Wrap

Definition at line 59 of file MaterialComponent.h.

◆ ambientColor

glm::vec4 Cogs::Core::MaterialComponent::ambientColor = glm::vec4(0, 0, 0, 1)

Definition at line 41 of file MaterialComponent.h.

◆ backdrop

bool Cogs::Core::MaterialComponent::backdrop = false

If true the MaterialFlags::Backdrop on the material instance.

Definition at line 63 of file MaterialComponent.h.

◆ blendMode

BlendMode Cogs::Core::MaterialComponent::blendMode = BlendMode::None

Definition at line 58 of file MaterialComponent.h.

◆ cullMode

CullMode Cogs::Core::MaterialComponent::cullMode = CullMode::None

Definition at line 57 of file MaterialComponent.h.

◆ depthBiasClamp

float Cogs::Core::MaterialComponent::depthBiasClamp = 0.f

Definition at line 51 of file MaterialComponent.h.

◆ depthBiasConstant

float Cogs::Core::MaterialComponent::depthBiasConstant = 0.f

Definition at line 49 of file MaterialComponent.h.

◆ depthBiasEnable

bool Cogs::Core::MaterialComponent::depthBiasEnable = false

Definition at line 69 of file MaterialComponent.h.

◆ depthBiasSlope

float Cogs::Core::MaterialComponent::depthBiasSlope = 0.f

Definition at line 50 of file MaterialComponent.h.

◆ depthTestAlwaysPass

bool Cogs::Core::MaterialComponent::depthTestAlwaysPass = false

Definition at line 68 of file MaterialComponent.h.

◆ depthTestEnabled

bool Cogs::Core::MaterialComponent::depthTestEnabled = true

Definition at line 67 of file MaterialComponent.h.

◆ depthWriteEnabled

bool Cogs::Core::MaterialComponent::depthWriteEnabled = true

Definition at line 66 of file MaterialComponent.h.

◆ diffuseColor

glm::vec4 Cogs::Core::MaterialComponent::diffuseColor = glm::vec4(1, 1, 1, 1)

Definition at line 38 of file MaterialComponent.h.

◆ diffuseMap

TextureHandle Cogs::Core::MaterialComponent::diffuseMap = TextureHandle::NoHandle

Definition at line 35 of file MaterialComponent.h.

◆ diffuseMapScale

glm::vec2 Cogs::Core::MaterialComponent::diffuseMapScale = glm::vec2(1, 1)

Definition at line 42 of file MaterialComponent.h.

◆ drawOrder

int32_t Cogs::Core::MaterialComponent::drawOrder = 0

Manages draw order, maps to MaterialOptions::drawOrder.

Definition at line 55 of file MaterialComponent.h.

◆ emissiveColor

glm::vec4 Cogs::Core::MaterialComponent::emissiveColor = glm::vec4(0, 0, 0, 1)

Definition at line 39 of file MaterialComponent.h.

◆ enableAlphaOverride

bool Cogs::Core::MaterialComponent::enableAlphaOverride = true

Definition at line 72 of file MaterialComponent.h.

◆ enableColorOverride

bool Cogs::Core::MaterialComponent::enableColorOverride = true

Definition at line 71 of file MaterialComponent.h.

◆ enableLighting

bool Cogs::Core::MaterialComponent::enableLighting = true

Definition at line 64 of file MaterialComponent.h.

◆ enableOverride

bool Cogs::Core::MaterialComponent::enableOverride = false

Definition at line 70 of file MaterialComponent.h.

◆ enableTextureOverride

bool Cogs::Core::MaterialComponent::enableTextureOverride = true

Definition at line 73 of file MaterialComponent.h.

◆ filterMode

SamplerState::FilterMode Cogs::Core::MaterialComponent::filterMode = SamplerState::FilterMode::MinMagMipLinear

Definition at line 60 of file MaterialComponent.h.

◆ instancedLine

bool Cogs::Core::MaterialComponent::instancedLine = false

Lines rendered with instancing.

Definition at line 61 of file MaterialComponent.h.

Referenced by Cogs::Core::ShapeSystem::update().

◆ lineWidth

float Cogs::Core::MaterialComponent::lineWidth = 1.0f

Definition at line 47 of file MaterialComponent.h.

◆ material

WeakEntityPtr Cogs::Core::MaterialComponent::material

Master material entity. When set, all material properties of this instance will be overridden by the values of a MaterialComponent on the master material entity.

Definition at line 25 of file MaterialComponent.h.

Referenced by Cogs::Core::VariableExtrusionSystem::update(), and Cogs::Core::EchoSounder::SwathBottomSystem::update().

◆ normalMap

TextureHandle Cogs::Core::MaterialComponent::normalMap = TextureHandle::NoHandle

Definition at line 36 of file MaterialComponent.h.

◆ normalMapFactor

float Cogs::Core::MaterialComponent::normalMapFactor = 1.0f

Definition at line 52 of file MaterialComponent.h.

◆ normalMapScale

glm::vec2 Cogs::Core::MaterialComponent::normalMapScale = glm::vec2(1, 1)

Definition at line 43 of file MaterialComponent.h.

◆ pointSize

float Cogs::Core::MaterialComponent::pointSize = 1.0f

Definition at line 48 of file MaterialComponent.h.

◆ primitiveType

PrimitiveType::EPrimitiveType Cogs::Core::MaterialComponent::primitiveType = PrimitiveType::TriangleList

Definition at line 56 of file MaterialComponent.h.

◆ shadowReceiver

bool Cogs::Core::MaterialComponent::shadowReceiver = true

If false, object never gets shadowed.

Definition at line 65 of file MaterialComponent.h.

◆ specularColor

glm::vec4 Cogs::Core::MaterialComponent::specularColor = glm::vec4(0, 0, 0, 1)

Definition at line 40 of file MaterialComponent.h.

◆ specularMap

TextureHandle Cogs::Core::MaterialComponent::specularMap = TextureHandle::NoHandle

Definition at line 37 of file MaterialComponent.h.

◆ specularMapScale

glm::vec2 Cogs::Core::MaterialComponent::specularMapScale = glm::vec2(1, 1)

Definition at line 44 of file MaterialComponent.h.

◆ specularPower

float Cogs::Core::MaterialComponent::specularPower = 80

Definition at line 45 of file MaterialComponent.h.

◆ stippleFactor

uint32_t Cogs::Core::MaterialComponent::stippleFactor = 1

Definition at line 53 of file MaterialComponent.h.

◆ stipplePattern

uint32_t Cogs::Core::MaterialComponent::stipplePattern = 0xFFFFFFFF

Definition at line 54 of file MaterialComponent.h.

◆ transparency

float Cogs::Core::MaterialComponent::transparency = 0

Definition at line 46 of file MaterialComponent.h.

◆ vertexColor

bool Cogs::Core::MaterialComponent::vertexColor = false

Definition at line 62 of file MaterialComponent.h.


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