EntropyCanvas::MaterialData
EntropyCanvas::MaterialData
Section titled “EntropyCanvas::MaterialData”Shared material data - portable across SDK, Server, Portal. More…
#include <MaterialData.h>
Public Functions
Section titled “Public Functions”| Name | |
|---|---|
| void | setVec4(const std::string & propName, const glm::vec4 & value) Set a vec4 property (also used for colors). |
| void | setVec3(const std::string & propName, const glm::vec3 & value) Set a vec3 property. |
| void | setVec2(const std::string & propName, const glm::vec2 & value) Set a vec2 property. |
| void | setTextureRef(const std::string & name, const AssetId & textureAssetId) Set a texture reference by name. |
| void | setMat4(const std::string & propName, const glm::mat4 & value) Set a mat4 property. |
| void | setMat3(const std::string & propName, const glm::mat3 & value) Set a mat3 property. |
| void | setInt(const std::string & propName, int32_t value) Set an int property. |
| void | setFloat(const std::string & propName, float value) Set a float property. |
| bool | isValid() const Check if this is valid (has a shader assigned). |
| bool | isTransparent() const Check if this material uses transparency. |
| bool | isKeywordEnabled(const std::string & keyword) const Check if a keyword is enabled. |
| std::optional< AssetId > | getTextureRef(const std::string & name) const Get a texture reference by name. |
| void | enableKeyword(const std::string & keyword) Enable a shader keyword. |
| void | disableKeyword(const std::string & keyword) Disable a shader keyword. |
| MaterialData | createUnlit(const std::string & materialName) Create an Unlit material with default values. |
| MaterialData | createPBR(const std::string & materialName) Create a PBR material with default values. |
| std::vector< std::pair< std::string, AssetId > > | allTextureRefs() const Get all texture references. |
Public Attributes
Section titled “Public Attributes”| Name | |
|---|---|
| uint64_t | version Monotonic version number for change tracking. |
| AssetId | shaderAssetId Shader asset ID (content hash of shader source) Use BuiltinShaders constants for built-in shaders. |
| int32_t | renderQueue Render queue priority (default: 2000 = Geometry) Background=1000, Geometry=2000, AlphaTest=2450, Transparent=3000, Overlay=4000, UI=5000. |
| bool | receivesShadows Whether this material receives shadows. |
| std::map< std::string, MaterialPropertyValue > | properties Material properties (ordered for deterministic serialization). |
| std::string | name Human-readable material name. |
| uint64_t | modifiedAt Timestamp of last modification (microseconds since Unix epoch). |
| std::vector< std::string > | enabledKeywords Enabled shader keywords (converted to bitmask by Portal). |
| bool | depthWrite Whether this material writes to the depth buffer. |
| uint64_t | creatorSessionId Session that created this material (for ownership/cleanup). |
| bool | castsShadows Whether this material casts shadows. |
| std::string | appId Creating application identifier. |
Detailed Description
Section titled “Detailed Description”struct EntropyCanvas::MaterialData;Shared material data - portable across SDK, Server, Portal.
This struct contains all material properties in a serializable format. Portal’s Material class contains this and adds GPU-specific members.
Properties map is ordered (std::map) for deterministic serialization and USD output consistency.
Public Functions Documentation
Section titled “Public Functions Documentation”function setVec4
Section titled “function setVec4”inline void setVec4( const std::string & propName, const glm::vec4 & value)Set a vec4 property (also used for colors).
function setVec3
Section titled “function setVec3”inline void setVec3( const std::string & propName, const glm::vec3 & value)Set a vec3 property.
function setVec2
Section titled “function setVec2”inline void setVec2( const std::string & propName, const glm::vec2 & value)Set a vec2 property.
function setTextureRef
Section titled “function setTextureRef”inline void setTextureRef( const std::string & name, const AssetId & textureAssetId)Set a texture reference by name.
Parameters:
Generic texture reference API - no predefined slots. The name should match the texture declaration in the shader.
function setMat4
Section titled “function setMat4”inline void setMat4( const std::string & propName, const glm::mat4 & value)Set a mat4 property.
function setMat3
Section titled “function setMat3”inline void setMat3( const std::string & propName, const glm::mat3 & value)Set a mat3 property.
function setInt
Section titled “function setInt”inline void setInt( const std::string & propName, int32_t value)Set an int property.
function setFloat
Section titled “function setFloat”inline void setFloat( const std::string & propName, float value)Set a float property.
function isValid
Section titled “function isValid”inline bool isValid() constCheck if this is valid (has a shader assigned).
function isTransparent
Section titled “function isTransparent”inline bool isTransparent() constCheck if this material uses transparency.
function isKeywordEnabled
Section titled “function isKeywordEnabled”inline bool isKeywordEnabled( const std::string & keyword) constCheck if a keyword is enabled.
function getTextureRef
Section titled “function getTextureRef”inline std::optional< AssetId > getTextureRef( const std::string & name) constGet a texture reference by name.
Parameters:
- name Texture name to look up
Return: AssetId if texture reference exists, nullopt otherwise
function enableKeyword
Section titled “function enableKeyword”inline void enableKeyword( const std::string & keyword)Enable a shader keyword.
function disableKeyword
Section titled “function disableKeyword”inline void disableKeyword( const std::string & keyword)Disable a shader keyword.
function createUnlit
Section titled “function createUnlit”static inline MaterialData createUnlit( const std::string & materialName)Create an Unlit material with default values.
Parameters:
- materialName Human-readable name for the material
Return: MaterialData configured for unlit rendering
function createPBR
Section titled “function createPBR”static inline MaterialData createPBR( const std::string & materialName)Create a PBR material with default values.
Parameters:
- materialName Human-readable name for the material
Return: MaterialData configured for PBR rendering
function allTextureRefs
Section titled “function allTextureRefs”inline std::vector< std::pair< std::string, AssetId > > allTextureRefs() constGet all texture references.
Return: Vector of (name, AssetId) pairs for all texture references
Returns all properties that are AssetId references.
Public Attributes Documentation
Section titled “Public Attributes Documentation”variable version
Section titled “variable version”uint64_t version = 0;Monotonic version number for change tracking.
variable shaderAssetId
Section titled “variable shaderAssetId”AssetId shaderAssetId;Shader asset ID (content hash of shader source) Use BuiltinShaders constants for built-in shaders.
variable renderQueue
Section titled “variable renderQueue”int32_t renderQueue = 2000;Render queue priority (default: 2000 = Geometry) Background=1000, Geometry=2000, AlphaTest=2450, Transparent=3000, Overlay=4000, UI=5000.
variable receivesShadows
Section titled “variable receivesShadows”bool receivesShadows = true;Whether this material receives shadows.
variable properties
Section titled “variable properties”std::map< std::string, MaterialPropertyValue > properties;Material properties (ordered for deterministic serialization).
variable name
Section titled “variable name”std::string name;Human-readable material name.
variable modifiedAt
Section titled “variable modifiedAt”uint64_t modifiedAt = 0;Timestamp of last modification (microseconds since Unix epoch).
variable enabledKeywords
Section titled “variable enabledKeywords”std::vector< std::string > enabledKeywords;Enabled shader keywords (converted to bitmask by Portal).
variable depthWrite
Section titled “variable depthWrite”bool depthWrite = true;Whether this material writes to the depth buffer.
variable creatorSessionId
Section titled “variable creatorSessionId”uint64_t creatorSessionId = 0;Session that created this material (for ownership/cleanup).
variable castsShadows
Section titled “variable castsShadows”bool castsShadows = true;Whether this material casts shadows.
variable appId
Section titled “variable appId”std::string appId;Creating application identifier.
Updated on 2026-01-26 at 17:14:35 -0500