mirror of
https://git.mirrors.martin98.com/https://github.com/syoyo/tinygltf.git
synced 2025-08-16 20:15:53 +08:00
Merge pull request #174 from Ybalrid/pr_material_param_tex_info
Add Parameter::TextureStrength(). Precise default values.
This commit is contained in:
commit
80faac5238
19
tiny_gltf.h
19
tiny_gltf.h
@ -390,6 +390,7 @@ struct Parameter {
|
|||||||
if (it != std::end(json_double_value)) {
|
if (it != std::end(json_double_value)) {
|
||||||
return int(it->second);
|
return int(it->second);
|
||||||
}
|
}
|
||||||
|
// As per the spec, if texCoord is ommited, this parameter is 0
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -401,7 +402,20 @@ struct Parameter {
|
|||||||
if (it != std::end(json_double_value)) {
|
if (it != std::end(json_double_value)) {
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
return -1;
|
// As per the spec, if scale is ommited, this paramter is 1
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Return the strength of a texture if this Parameter is a an occlusion map.
|
||||||
|
/// Returned value is only valid if the parameter represent an occlusion map
|
||||||
|
/// from a material
|
||||||
|
double TextureStrength() const {
|
||||||
|
const auto it = json_double_value.find("strength");
|
||||||
|
if (it != std::end(json_double_value)) {
|
||||||
|
return it->second;
|
||||||
|
}
|
||||||
|
// As per the spec, if strenghth is ommited, this parameter is 1
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Material factor, like the roughness or metalness of a material
|
/// Material factor, like the roughness or metalness of a material
|
||||||
@ -448,7 +462,8 @@ struct AnimationChannel {
|
|||||||
struct AnimationSampler {
|
struct AnimationSampler {
|
||||||
int input; // required
|
int input; // required
|
||||||
int output; // required
|
int output; // required
|
||||||
std::string interpolation; // "LINEAR", "STEP","CUBICSPLINE" or user defined string. default "LINEAR"
|
std::string interpolation; // "LINEAR", "STEP","CUBICSPLINE" or user defined
|
||||||
|
// string. default "LINEAR"
|
||||||
Value extras;
|
Value extras;
|
||||||
|
|
||||||
AnimationSampler() : input(-1), output(-1), interpolation("LINEAR") {}
|
AnimationSampler() : input(-1), output(-1), interpolation("LINEAR") {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user