1#include "MaterialOptions.h"
3#include "Utilities/Parsing.h"
5#include "Foundation/StringView.h"
6#include "Foundation/Logging/Logger.h"
13void Cogs::Core::applyMaterialOption(MaterialOptions & options,
const StringView & key,
const StringView & value)
15 const size_t code = key.hash();
16 const size_t valueCode = value.hash();
29 options.cullMode = CullMode::None;
35 case
Cogs::hash(
"TransparencyMode"):
39 options.transparencyMode = TransparencyMode::On;
42 options.transparencyMode = TransparencyMode::
Off;
45 options.transparencyMode = TransparencyMode::Auto;
48 options.transparencyMode = TransparencyMode::
Alpha;
51 LOG_WARNING(logger,
"Unknown Transparency value '%.*s'", StringViewFormat(value));
57 options.drawOrder = parseInt(value, 0);
64 LOG_WARNING(logger,
"DepthWrite Deprecated, please use DepthWriteEnabled instead.");
67 options.depthWriteEnabled = false;
70 options.depthWriteEnabled =
true;
77 LOG_WARNING(logger,
"DepthTest Deprecated, please use DepthTestEnabled instead.");
80 options.depthTestEnabled = false;
83 options.depthTestEnabled =
true;
90 options.depthWriteEnabled = parseBool(value,
false);
95 options.depthTestEnabled = parseBool(value,
false);
100 options.depthFunc = parseEnum<DepthFunc>(value, DepthFunc::Less);
104 LOG_WARNING_ONCE(logger,
"DepthTestAlwaysPass Deprecated, please use DepthTestEnabled instead.");
105 if (parseBool(value,
false)) {
106 options.depthFunc = DepthFunc::Always;
109 options.depthFunc = DepthFunc::Less;
114 options.depthBiasEnabled = parseBool(value,
false);
119 options.depthBias.constant = parseFloat(value, 0.0f);
124 options.depthBias.slope = parseFloat(value, 0.0f);
129 options.depthBias.clamp = parseFloat(value, 0.0f);
Log implementation class.
@ Off
Disable capture and camera, consume no rendering resources.
BlendMode
Defines blending modes for rendering.
@ Alpha
Fetch elevation from alpha channel of elevation texture.
CullMode
Defines primitive culling modes.
@ Back
Back face of primitives discarded before rasterization.
@ Front
Front face of primitives discarded before rasterization.
constexpr Log getLogger(const char(&name)[LEN]) noexcept
Contains all Cogs related functionality.
constexpr size_t hash() noexcept
Simple getter function that returns the initial value for fnv1a hashing.