git.s-ol.nu ~forks/DiligentTools / a8c447a
GLTF Loader: moved AlphaMode parameter to Material::ShaderAttribs assiduous 10 months ago
2 changed file(s) with 12 addition(s) and 15 deletion(s). Raw diff Collapse all Expand all
9393 PBR_WORKFLOW_SPEC_GLOSS
9494 };
9595
96 enum ALPHA_MODE
97 {
98 ALPHA_MODE_OPAQUE = 0,
99 ALPHA_MODE_MASK,
100 ALPHA_MODE_BLEND,
101 ALPHA_MODE_NUM_MODES
102 };
103
96104 // Material attributes packed in a shader-friendly format
97105 struct ShaderAttribs
98106 {
116124 float MetallicFactor = 1;
117125
118126 float RoughnessFactor = 1;
119 int UseAlphaMask = 0;
127 int AlphaMode = ALPHA_MODE_OPAQUE;
120128 float AlphaCutoff = 0.5f;
121129 float Dummy0;
122130
130138 };
131139 static_assert(sizeof(ShaderAttribs) % 16 == 0, "ShaderAttribs struct must be 16-byte aligned");
132140 ShaderAttribs Attribs;
133
134 enum ALPHA_MODE
135 {
136 ALPHA_MODE_OPAQUE,
137 ALPHA_MODE_MASK,
138 ALPHA_MODE_BLEND,
139 ALPHA_MODE_NUM_MODES
140 };
141 ALPHA_MODE AlphaMode = ALPHA_MODE_OPAQUE;
142141
143142 bool DoubleSided = false;
144143
11941194 const tinygltf::Parameter& param = alpha_mode_it->second;
11951195 if (param.string_value == "BLEND")
11961196 {
1197 Mat.AlphaMode = Material::ALPHA_MODE_BLEND;
1197 Mat.Attribs.AlphaMode = Material::ALPHA_MODE_BLEND;
11981198 }
11991199 if (param.string_value == "MASK")
12001200 {
1201 Mat.AlphaMode = Material::ALPHA_MODE_MASK;
1202
1203 Mat.Attribs.UseAlphaMask = 1;
1204 Mat.Attribs.AlphaCutoff = 0.5f;
1201 Mat.Attribs.AlphaMode = Material::ALPHA_MODE_MASK;
1202 Mat.Attribs.AlphaCutoff = 0.5f;
12051203 }
12061204 }
12071205 }