mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-06 19:49:36 -06:00
Fix perform shading property bug
This commit is contained in:
@@ -45,10 +45,11 @@ namespace {
|
||||
constexpr std::string_view _loggerCat = "RenderableTube";
|
||||
constexpr int8_t CurrentMajorVersion = 0;
|
||||
constexpr int8_t CurrentMinorVersion = 1;
|
||||
constexpr std::array<const char*, 9> UniformNames = {
|
||||
constexpr std::array<const char*, 12> UniformNames = {
|
||||
"modelViewTransform", "projectionTransform", "normalTransform", "color",
|
||||
"opacity", "performShading", "nLightSources", "lightDirectionsViewSpace",
|
||||
"lightIntensities"
|
||||
"lightIntensities", "ambientIntensity", "diffuseIntensity",
|
||||
"specularIntensity"
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo ColorInfo = {
|
||||
@@ -140,8 +141,8 @@ RenderableTube::Shading::Shading()
|
||||
: properties::PropertyOwner({ "Shading" })
|
||||
, enabled(ShadingEnabledInfo, true)
|
||||
, ambientIntensity(AmbientIntensityInfo, 0.2f, 0.f, 1.f)
|
||||
, diffuseIntensity(DiffuseIntensityInfo, 0.7f, 0.f, 1.f)
|
||||
, specularIntensity(SpecularIntensityInfo, 0.f, 0.f, 1.f)
|
||||
, diffuseIntensity(DiffuseIntensityInfo, 1.f, 0.f, 1.f)
|
||||
, specularIntensity(SpecularIntensityInfo, 1.f, 0.f, 1.f)
|
||||
{
|
||||
addProperty(enabled);
|
||||
addProperty(ambientIntensity);
|
||||
@@ -574,6 +575,10 @@ void RenderableTube::render(const RenderData& data, RendererTasks&) {
|
||||
_uniformCache.lightDirectionsViewSpace,
|
||||
_lightDirectionsViewSpaceBuffer
|
||||
);
|
||||
|
||||
_shader->setUniform(_uniformCache.ambientIntensity, _shading.ambientIntensity);
|
||||
_shader->setUniform(_uniformCache.diffuseIntensity, _shading.diffuseIntensity);
|
||||
_shader->setUniform(_uniformCache.specularIntensity, _shading.specularIntensity);
|
||||
}
|
||||
|
||||
// Render
|
||||
|
||||
@@ -91,7 +91,8 @@ private:
|
||||
|
||||
UniformCache(modelViewTransform, projectionTransform, normalTransform, color,
|
||||
opacity, performShading, nLightSources, lightDirectionsViewSpace,
|
||||
lightIntensities) _uniformCache;
|
||||
lightIntensities, ambientIntensity, diffuseIntensity,
|
||||
specularIntensity) _uniformCache;
|
||||
|
||||
std::vector<float> _lightIntensitiesBuffer;
|
||||
std::vector<glm::vec3> _lightDirectionsViewSpaceBuffer;
|
||||
|
||||
@@ -32,9 +32,9 @@ uniform vec3 color;
|
||||
uniform float opacity;
|
||||
|
||||
uniform bool performShading = true;
|
||||
uniform float ambientIntensity = 0.2;
|
||||
uniform float diffuseIntensity = 1.0;
|
||||
uniform float specularIntensity = 1.0;
|
||||
uniform float ambientIntensity;
|
||||
uniform float diffuseIntensity;
|
||||
uniform float specularIntensity;
|
||||
|
||||
uniform int nLightSources;
|
||||
uniform vec3 lightDirectionsViewSpace[8];
|
||||
|
||||
Reference in New Issue
Block a user