Compare commits

..

No commits in common. "7e9596d77fd8418ea49fbf1fdd254e5437822880" and "ff7eb827fef2df68d8c9ff6a5f1e71dc3543dc4c" have entirely different histories.

2 changed files with 25 additions and 42 deletions

View file

@ -228,14 +228,11 @@ namespace psemek::gfx
target.name = material["name"].GetString();
target.two_sided = false;
if (material.HasMember("doubleSided"))
target.two_sided = material["doubleSided"].GetBool();
else
target.two_sided = false;
// Material can omit pbrMetallicRoughness entry if
// all the values are defaulted
if (material.HasMember("pbrMetallicRoughness"))
{
auto const & pbr = material["pbrMetallicRoughness"];
if (pbr.HasMember("baseColorFactor"))
@ -265,7 +262,6 @@ namespace psemek::gfx
{
target.material_texture = document["textures"].GetArray()[pbr["metallicRoughnessTexture"]["index"].GetUint64()]["source"].GetInt64();
}
}
if (material.HasMember("emissiveFactor"))
{

View file

@ -235,17 +235,4 @@ namespace psemek::math
return T{1} / T{2} - std::sin(std::asin(T{1} - T{2} * x) / T{3});
}
// Stateless piecewise-quadratic spline acceleration
// based on current velocity, current distance to target,
// and max acceleration
template <typename T>
T quadratic_spline_acceleration(T velocity, T distance, T max_acceleration)
{
T max_velocity = std::sqrt(2.f * std::abs(distance) * max_acceleration);
return max_acceleration
* (distance < 0.f ? -1.f : 1.f)
* ((std::abs(velocity) < max_velocity || (distance > 0.f) != (velocity > 0.f))? 1.f : -1.f)
;
}
}