| 131 | } |
| 132 | |
| 133 | Variant MaterialParameter::GetValue() const |
| 134 | { |
| 135 | switch (_type) |
| 136 | { |
| 137 | case MaterialParameterType::Bool: |
| 138 | return _asBool; |
| 139 | case MaterialParameterType::Integer: |
| 140 | case MaterialParameterType::SceneTexture: |
| 141 | case MaterialParameterType::ChannelMask: |
| 142 | case MaterialParameterType::TextureGroupSampler: |
| 143 | return _asInteger; |
| 144 | case MaterialParameterType::Float: |
| 145 | return _asFloat; |
| 146 | case MaterialParameterType::Vector2: |
| 147 | return _asVector2; |
| 148 | case MaterialParameterType::Vector3: |
| 149 | return _asVector3; |
| 150 | case MaterialParameterType::Vector4: |
| 151 | return *(Float4*)&AsData; |
| 152 | case MaterialParameterType::Color: |
| 153 | return _asColor; |
| 154 | case MaterialParameterType::Matrix: |
| 155 | return Variant(*(Matrix*)&AsData); |
| 156 | case MaterialParameterType::NormalMap: |
| 157 | case MaterialParameterType::Texture: |
| 158 | case MaterialParameterType::CubeTexture: |
| 159 | case MaterialParameterType::GameplayGlobal: |
| 160 | return _asAsset.Get(); |
| 161 | case MaterialParameterType::GPUTextureVolume: |
| 162 | case MaterialParameterType::GPUTextureArray: |
| 163 | case MaterialParameterType::GPUTextureCube: |
| 164 | case MaterialParameterType::GPUTexture: |
| 165 | return _asGPUTexture.Get(); |
| 166 | default: |
| 167 | return Variant::Zero; |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | void MaterialParameter::SetValue(const Variant& value) |
| 172 | { |