Browse Source

Shaders: make Phong uniform location calculations more parametrized.

pull/364/head
Vladimír Vondruš 7 years ago
parent
commit
2cfe5199b4
  1. 4
      src/Magnum/Shaders/Phong.cpp

4
src/Magnum/Shaders/Phong.cpp

@ -51,7 +51,7 @@ namespace {
}; };
} }
Phong::Phong(const Flags flags, const UnsignedInt lightCount): _flags{flags}, _lightCount{lightCount}, _lightColorsUniform{9 + Int(lightCount)} { Phong::Phong(const Flags flags, const UnsignedInt lightCount): _flags{flags}, _lightCount{lightCount}, _lightColorsUniform{_lightPositionsUniform + Int(lightCount)} {
#ifdef MAGNUM_BUILD_STATIC #ifdef MAGNUM_BUILD_STATIC
/* Import resources on static build, if not already */ /* Import resources on static build, if not already */
if(!Utility::Resource::hasGroup("MagnumShaders")) if(!Utility::Resource::hasGroup("MagnumShaders"))
@ -100,7 +100,7 @@ Phong::Phong(const Flags flags, const UnsignedInt lightCount): _flags{flags}, _l
.addSource(flags & Flag::AlphaMask ? "#define ALPHA_MASK\n" : "") .addSource(flags & Flag::AlphaMask ? "#define ALPHA_MASK\n" : "")
.addSource(Utility::formatString( .addSource(Utility::formatString(
"#define LIGHT_COUNT {}\n" "#define LIGHT_COUNT {}\n"
"#define LIGHT_COLORS_LOCATION {}\n", lightCount, 9 + lightCount)) "#define LIGHT_COLORS_LOCATION {}\n", lightCount, _lightPositionsUniform + lightCount))
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
.addSource(std::move(lightInitializer)) .addSource(std::move(lightInitializer))
#endif #endif

Loading…
Cancel
Save