diff --git a/src/engine/game/gui/selectoverlay.cpp b/src/engine/game/gui/selectoverlay.cpp index 5a2ac10e..878b91ab 100644 --- a/src/engine/game/gui/selectoverlay.cpp +++ b/src/engine/game/gui/selectoverlay.cpp @@ -198,7 +198,7 @@ void SelectionOverlay::draw() { } void SelectionOverlay::drawReticle(Texture &texture, const glm::vec3 &screenCoords) { - StateManager::instance().setActiveTextureUnit(TextureUnits::diffuse); + StateManager::instance().setActiveTextureUnit(TextureUnits::diffuseMap); texture.bind(); const GraphicsOptions &opts = _game->options().graphics; @@ -287,7 +287,7 @@ void SelectionOverlay::drawActionBar() { } else { frameTexture = _friendlyScroll; } - StateManager::instance().setActiveTextureUnit(TextureUnits::diffuse); + StateManager::instance().setActiveTextureUnit(TextureUnits::diffuseMap); frameTexture->bind(); float frameX, frameY; @@ -309,7 +309,7 @@ void SelectionOverlay::drawActionBar() { shared_ptr texture(_textureByAction.find(action)->second); if (texture) { - StateManager::instance().setActiveTextureUnit(TextureUnits::diffuse); + StateManager::instance().setActiveTextureUnit(TextureUnits::diffuseMap); texture->bind(); float y = opts.height * (1.0f - _selectedScreenCoords.y) - (_reticleHeight + kActionHeight + kActionWidth) / 2.0f - kOffsetToReticle - kActionBarMargin; diff --git a/src/engine/game/map.cpp b/src/engine/game/map.cpp index 585f4a4f..17a7ceac 100644 --- a/src/engine/game/map.cpp +++ b/src/engine/game/map.cpp @@ -99,7 +99,7 @@ void Map::drawArea(Mode mode, const glm::vec4 &bounds) { shared_ptr partyLeader(_game->party().getLeader()); if (!partyLeader) return; - StateManager::instance().setActiveTextureUnit(TextureUnits::diffuse); + StateManager::instance().setActiveTextureUnit(TextureUnits::diffuseMap); _areaTexture->bind(); glm::vec2 worldPos(partyLeader->position()); @@ -123,7 +123,7 @@ void Map::drawArea(Mode mode, const glm::vec4 &bounds) { StateManager::instance().withScissorTest(scissorBounds, []() { Meshes::instance().getQuad()->draw(); }); } else { - StateManager::instance().setActiveTextureUnit(TextureUnits::diffuse); + StateManager::instance().setActiveTextureUnit(TextureUnits::diffuseMap); _areaTexture->bind(); glm::mat4 transform(1.0f); @@ -142,7 +142,7 @@ void Map::drawArea(Mode mode, const glm::vec4 &bounds) { void Map::drawNotes(Mode mode, const glm::vec4 &bounds) { if (mode != Mode::Default) return; - StateManager::instance().setActiveTextureUnit(TextureUnits::diffuse); + StateManager::instance().setActiveTextureUnit(TextureUnits::diffuseMap); _noteTexture->bind(); for (auto &object : _game->module()->area()->getObjectsByType(ObjectType::Waypoint)) { @@ -205,7 +205,7 @@ void Map::drawPartyLeader(Mode mode, const glm::vec4 &bounds) { shared_ptr partyLeader(_game->party().getLeader()); if (!partyLeader) return; - StateManager::instance().setActiveTextureUnit(TextureUnits::diffuse); + StateManager::instance().setActiveTextureUnit(TextureUnits::diffuseMap); _arrowTexture->bind(); glm::vec3 arrowPos(0.0f); diff --git a/src/engine/graphics/cursor.cpp b/src/engine/graphics/cursor.cpp index f3028ee5..158f3dae 100644 --- a/src/engine/graphics/cursor.cpp +++ b/src/engine/graphics/cursor.cpp @@ -45,7 +45,7 @@ Cursor::Cursor(const shared_ptr &up, const shared_ptr &down) : void Cursor::draw() { shared_ptr texture(_pressed ? _down : _up); - StateManager::instance().setActiveTextureUnit(TextureUnits::diffuse); + StateManager::instance().setActiveTextureUnit(TextureUnits::diffuseMap); texture->bind(); glm::mat4 transform(1.0f); diff --git a/src/engine/graphics/font.cpp b/src/engine/graphics/font.cpp index f86e41a3..b15ed832 100644 --- a/src/engine/graphics/font.cpp +++ b/src/engine/graphics/font.cpp @@ -65,7 +65,7 @@ void Font::load(const shared_ptr &texture) { void Font::draw(const string &text, const glm::vec3 &position, const glm::vec3 &color, TextGravity gravity) { if (text.empty()) return; - StateManager::instance().setActiveTextureUnit(TextureUnits::diffuse); + StateManager::instance().setActiveTextureUnit(TextureUnits::diffuseMap); _texture->bind(); glm::vec3 textOffset(getTextOffset(text, gravity), 0.0f); diff --git a/src/engine/graphics/pbribl.cpp b/src/engine/graphics/pbribl.cpp index 4ea0e350..e4318c25 100644 --- a/src/engine/graphics/pbribl.cpp +++ b/src/engine/graphics/pbribl.cpp @@ -111,7 +111,7 @@ shared_ptr PBRIBL::computeIrradianceMap(const Texture *envmap) { _irradianceFB.bind(); - StateManager::instance().setActiveTextureUnit(TextureUnits::envmap); + StateManager::instance().setActiveTextureUnit(TextureUnits::environmentMap); envmap->bind(); StateManager::instance().withViewport(viewport, [&]() { @@ -148,7 +148,7 @@ shared_ptr PBRIBL::computePrefilterMap(const Texture *envmap) { _prefilterFB.bind(); _prefilterFB.attachDepth(*prefilterDepth); - StateManager::instance().setActiveTextureUnit(TextureUnits::envmap); + StateManager::instance().setActiveTextureUnit(TextureUnits::environmentMap); envmap->bind(); for (int mip = 0; mip < kNumPrefilterMipMaps; ++mip) { diff --git a/src/engine/graphics/shader/shaders.cpp b/src/engine/graphics/shader/shaders.cpp index 701241d4..92322ab8 100644 --- a/src/engine/graphics/shader/shaders.cpp +++ b/src/engine/graphics/shader/shaders.cpp @@ -215,16 +215,16 @@ void Shaders::initUBO(const string &block, int bindingPoint, uint32_t ubo, const } void Shaders::initTextureUniforms() { - setUniform("uDiffuse", TextureUnits::diffuse); - setUniform("uLightmap", TextureUnits::lightmap); - setUniform("uEnvmap", TextureUnits::envmap); - setUniform("uBumpmap", TextureUnits::bumpmap); - setUniform("uBloom", TextureUnits::bloom); - setUniform("uIrradianceMap", TextureUnits::irradianceMap); - setUniform("uPrefilterMap", TextureUnits::prefilterMap); - setUniform("uBRDFLookup", TextureUnits::brdfLookup); - setUniform("uShadowMap", TextureUnits::shadowMap); - setUniform("uCubeShadowMap", TextureUnits::cubeShadowMap); + setUniform("sDiffuseMap", TextureUnits::diffuseMap); + setUniform("sLightmap", TextureUnits::lightmap); + setUniform("sEnvironmentMap", TextureUnits::environmentMap); + setUniform("sBumpMap", TextureUnits::bumpMap); + setUniform("sBloom", TextureUnits::bloom); + setUniform("sIrradianceMap", TextureUnits::irradianceMap); + setUniform("sPrefilterMap", TextureUnits::prefilterMap); + setUniform("sBRDFLookup", TextureUnits::brdfLookup); + setUniform("sShadowMap", TextureUnits::shadowMap); + setUniform("sShadowMapCube", TextureUnits::shadowMapCube); } Shaders::~Shaders() { diff --git a/src/engine/graphics/shader/shaders_common.cpp b/src/engine/graphics/shader/shaders_common.cpp index 7ec505a1..c44de048 100644 --- a/src/engine/graphics/shader/shaders_common.cpp +++ b/src/engine/graphics/shader/shaders_common.cpp @@ -180,12 +180,12 @@ bool isFeatureEnabled(int flag) { char g_shaderBaseModel[] = R"END( const float SELFILLUM_THRESHOLD = 0.85; -uniform sampler2D uDiffuse; -uniform sampler2D uLightmap; -uniform sampler2D uBumpmap; -uniform sampler2D uShadowMap; -uniform samplerCube uEnvmap; -uniform samplerCube uCubeShadowMap; +uniform sampler2D sDiffuseMap; +uniform sampler2D sLightmap; +uniform sampler2D sBumpMap; +uniform sampler2D sShadowMap; +uniform samplerCube sEnvironmentMap; +uniform samplerCube sShadowMapCube; in vec3 fragPosition; in vec3 fragNormal; @@ -219,9 +219,9 @@ vec3 getNormalFromBumpMap(vec2 uv) { vec2 packedUv = packUV(uv, frameBounds); vec2 packedUvDu = packUV(uv + du, frameBounds); vec2 packedUvDv = packUV(uv + dv, frameBounds); - vec4 bumpmapSample = texture(uBumpmap, packedUv); - vec4 bumpmapSampleDu = texture(uBumpmap, packedUvDu); - vec4 bumpmapSampleDv = texture(uBumpmap, packedUvDv); + vec4 bumpmapSample = texture(sBumpMap, packedUv); + vec4 bumpmapSampleDu = texture(sBumpMap, packedUvDu); + vec4 bumpmapSampleDv = texture(sBumpMap, packedUvDv); float dBx = bumpmapSampleDu.r - bumpmapSample.r; float dBy = bumpmapSampleDv.r - bumpmapSample.r; vec3 normal = vec3(-dBx * uBumpmaps.scaling, -dBy * uBumpmaps.scaling, 1.0); @@ -230,7 +230,7 @@ vec3 getNormalFromBumpMap(vec2 uv) { } vec3 getNormalFromNormalMap(vec2 uv) { - vec4 bumpmapSample = texture(uBumpmap, uv); + vec4 bumpmapSample = texture(sBumpMap, uv); vec3 normal = bumpmapSample.rgb * 2.0 - 1.0; return normalize(normal * fragTanSpace); } @@ -259,13 +259,13 @@ float getShadow() { vec3 projCoords = fragPosLightSpace.xyz / fragPosLightSpace.w; projCoords = projCoords * 0.5 + 0.5; - float closestDepth = texture(uShadowMap, projCoords.xy).r; + float closestDepth = texture(sShadowMap, projCoords.xy).r; float currentDepth = projCoords.z; - vec2 texelSize = 1.0 / textureSize(uShadowMap, 0); + vec2 texelSize = 1.0 / textureSize(sShadowMap, 0); for (int x = -1; x <= 1; ++x) { for (int y = -1; y <= 1; ++y) { - float pcfDepth = texture(uShadowMap, projCoords.xy + vec2(x, y) * texelSize).r; + float pcfDepth = texture(sShadowMap, projCoords.xy + vec2(x, y) * texelSize).r; result += currentDepth > pcfDepth ? 1.0 : 0.0; } } @@ -287,7 +287,7 @@ float getShadow() { for (float x = -offset; x < offset; x += offset / (samples * 0.5)) { for (float y = -offset; y < offset; y += offset / (samples * 0.5)) { for (float z = -offset; z < offset; z += offset / (samples * 0.5)) { - float closestDepth = texture(uCubeShadowMap, fragToLight + vec3(x, y, z)).r; + float closestDepth = texture(sShadowMapCube, fragToLight + vec3(x, y, z)).r; closestDepth *= SHADOW_FAR_PLANE; if (currentDepth - bias > closestDepth) { @@ -575,7 +575,7 @@ void main() { )END"; char g_shaderFragmentGUI[] = R"END( -uniform sampler2D uDiffuse; +uniform sampler2D sDiffuseMap; in vec2 fragTexCoords; @@ -583,7 +583,7 @@ layout(location = 0) out vec4 fragColor; layout(location = 1) out vec4 fragColorBright; void main() { - vec4 diffuseSample = texture(uDiffuse, fragTexCoords); + vec4 diffuseSample = texture(sDiffuseMap, fragTexCoords); vec3 objectColor = uGeneral.color.rgb * diffuseSample.rgb; if (isFeatureEnabled(FEATURE_DISCARD) && length(uGeneral.discardColor.rgb - objectColor) < 0.01) discard; @@ -594,7 +594,7 @@ void main() { )END"; char g_shaderFragmentText[] = R"END( -uniform sampler2D uDiffuse; +uniform sampler2D sDiffuseMap; in vec2 fragTexCoords; flat in int fragInstanceID; @@ -603,14 +603,14 @@ out vec4 fragColor; void main() { vec2 uv = fragTexCoords * uChars[fragInstanceID].uv.zw + uChars[fragInstanceID].uv.xy; - vec4 diffuseSample = texture(uDiffuse, uv); + vec4 diffuseSample = texture(sDiffuseMap, uv); vec3 objectColor = uGeneral.color.rgb * diffuseSample.rgb; fragColor = vec4(objectColor, diffuseSample.a); } )END"; char g_shaderFragmentParticle[] = R"END( -uniform sampler2D uDiffuse; +uniform sampler2D sDiffuseMap; in vec2 fragTexCoords; flat in int fragInstanceID; @@ -631,7 +631,7 @@ void main() { texCoords.x += oneOverGridX * (uParticles[fragInstanceID].frame % int(uParticleGridSize.x)); } - vec4 diffuseSample = texture(uDiffuse, texCoords); + vec4 diffuseSample = texture(sDiffuseMap, texCoords); fragColor = vec4(uParticles[fragInstanceID].color.rgb * diffuseSample.rgb, uParticles[fragInstanceID].alpha * diffuseSample.a); fragColorBright = vec4(vec3(0.0), 0.0); @@ -639,8 +639,8 @@ void main() { )END"; char g_shaderFragmentGrass[] = R"END( -uniform sampler2D uDiffuse; -uniform sampler2D uLightmap; +uniform sampler2D sDiffuseMap; +uniform sampler2D sLightmap; in vec2 fragTexCoords; flat in int fragInstanceID; @@ -653,11 +653,11 @@ void main() { uv.y += 0.5 * (int(uGrassClusters[fragInstanceID].positionVariant[3]) / 2); uv.x += 0.5 * (int(uGrassClusters[fragInstanceID].positionVariant[3]) % 2); - vec4 diffuseSample = texture(uDiffuse, uv); + vec4 diffuseSample = texture(sDiffuseMap, uv); vec3 objectColor = diffuseSample.rgb; if (isFeatureEnabled(FEATURE_LIGHTMAP)) { - vec4 lightmapSample = texture(uLightmap, uGrassClusters[fragInstanceID].lightmapUV); + vec4 lightmapSample = texture(sLightmap, uGrassClusters[fragInstanceID].lightmapUV); objectColor *= lightmapSample.rgb; } @@ -667,7 +667,7 @@ void main() { )END"; char g_shaderFragmentBlur[] = R"END( -uniform sampler2D uDiffuse; +uniform sampler2D sDiffuseMap; out vec4 fragColor; @@ -676,27 +676,27 @@ void main() { vec4 color = vec4(0.0); vec2 off1 = vec2(1.3846153846) * uBlur.direction; vec2 off2 = vec2(3.2307692308) * uBlur.direction; - color += texture(uDiffuse, uv) * 0.2270270270; - color += texture(uDiffuse, uv + (off1 / uBlur.resolution)) * 0.3162162162; - color += texture(uDiffuse, uv - (off1 / uBlur.resolution)) * 0.3162162162; - color += texture(uDiffuse, uv + (off2 / uBlur.resolution)) * 0.0702702703; - color += texture(uDiffuse, uv - (off2 / uBlur.resolution)) * 0.0702702703; + color += texture(sDiffuseMap, uv) * 0.2270270270; + color += texture(sDiffuseMap, uv + (off1 / uBlur.resolution)) * 0.3162162162; + color += texture(sDiffuseMap, uv - (off1 / uBlur.resolution)) * 0.3162162162; + color += texture(sDiffuseMap, uv + (off2 / uBlur.resolution)) * 0.0702702703; + color += texture(sDiffuseMap, uv - (off2 / uBlur.resolution)) * 0.0702702703; fragColor = color; } )END"; char g_shaderFragmentPresentWorld[] = R"END( -uniform sampler2D uDiffuse; -uniform sampler2D uBloom; +uniform sampler2D sDiffuseMap; +uniform sampler2D sBloom; in vec2 fragTexCoords; out vec4 fragColor; void main() { - vec4 diffuseSample = texture(uDiffuse, fragTexCoords); - vec4 bloomSample = texture(uBloom, fragTexCoords); + vec4 diffuseSample = texture(sDiffuseMap, fragTexCoords); + vec4 bloomSample = texture(sBloom, fragTexCoords); vec3 color = diffuseSample.rgb + bloomSample.rgb; fragColor = vec4(color, 1.0); diff --git a/src/engine/graphics/shader/shaders_pbr.cpp b/src/engine/graphics/shader/shaders_pbr.cpp index 40786fb7..97056af0 100644 --- a/src/engine/graphics/shader/shaders_pbr.cpp +++ b/src/engine/graphics/shader/shaders_pbr.cpp @@ -131,7 +131,7 @@ vec3 fresnelSchlickRoughness(float cosTheta, vec3 F0, float roughness) { )END"; char g_shaderFragmentIrradiance[] = R"END( -uniform samplerCube uEnvmap; +uniform samplerCube sEnvironmentMap; in vec3 fragPosition; @@ -152,7 +152,7 @@ void main() { vec3 tangentSample = vec3(sin(theta) * cos(phi), sin(theta) * sin(phi), cos(theta)); vec3 sampleVec = tangentSample.x * right + tangentSample.y * up + tangentSample.z * N; - irradiance += texture(uEnvmap, sampleVec).rgb * cos(theta) * sin(theta); + irradiance += texture(sEnvironmentMap, sampleVec).rgb * cos(theta) * sin(theta); ++numSamples; } } @@ -163,7 +163,7 @@ void main() { )END"; char g_shaderFragmentPrefilter[] = R"END( -uniform samplerCube uEnvmap; +uniform samplerCube sEnvironmentMap; in vec3 fragPosition; @@ -200,7 +200,7 @@ void main() { float mipLevel = uGeneral.roughness == 0.0 ? 0.0 : 0.5 * log2(saSample / saTexel); - prefilteredColor += textureLod(uEnvmap, L, mipLevel).rgb * NdotL; + prefilteredColor += textureLod(sEnvironmentMap, L, mipLevel).rgb * NdotL; totalWeight += NdotL; } } @@ -223,9 +223,9 @@ void main() { )END"; char g_shaderFragmentPBR[] = R"END( -uniform sampler2D uBRDFLookup; -uniform samplerCube uIrradianceMap; -uniform samplerCube uPrefilterMap; +uniform sampler2D sBRDFLookup; +uniform samplerCube sIrradianceMap; +uniform samplerCube sPrefilterMap; void main() { vec2 uv = getUV(); @@ -236,7 +236,7 @@ void main() { vec3 N = getNormal(uv); vec3 R = reflect(-V, N); - vec4 diffuseSample = texture(uDiffuse, uv); + vec4 diffuseSample = texture(sDiffuseMap, uv); if (isFeatureEnabled(FEATURE_HDR)) { diffuseSample.rgb = pow(diffuseSample.rgb, vec3(GAMMA)); } @@ -247,7 +247,7 @@ void main() { vec3 objectColor; if (isFeatureEnabled(FEATURE_LIGHTMAP)) { - vec4 lightmapSample = texture(uLightmap, fragLightmapCoords); + vec4 lightmapSample = texture(sLightmap, fragLightmapCoords); if (isFeatureEnabled(FEATURE_HDR)) { lightmapSample.rgb = pow(lightmapSample.rgb, vec3(GAMMA)); } @@ -259,7 +259,7 @@ void main() { if (isFeatureEnabled(FEATURE_ENVMAP)) { vec3 R = reflect(-V, N); - vec4 envmapSample = texture(uEnvmap, R); + vec4 envmapSample = texture(sEnvironmentMap, R); if (isFeatureEnabled(FEATURE_HDR)) { envmapSample.rgb = pow(envmapSample.rgb, vec3(GAMMA)); } @@ -280,15 +280,15 @@ void main() { vec3 kD = 1.0 - kS; kD *= 1.0 - metallic; - vec3 irradiance = texture(uIrradianceMap, N).rgb; + vec3 irradiance = texture(sIrradianceMap, N).rgb; vec3 diffuse = irradiance * albedo; const float MAX_REFLECTION_LOD = 4.0; - vec3 prefilteredColor = textureLod(uPrefilterMap, R, roughness * MAX_REFLECTION_LOD).rgb; + vec3 prefilteredColor = textureLod(sPrefilterMap, R, roughness * MAX_REFLECTION_LOD).rgb; if (isFeatureEnabled(FEATURE_HDR)) { prefilteredColor = pow(prefilteredColor, vec3(GAMMA)); } - vec2 brdf = texture(uBRDFLookup, vec2(max(dot(N, V), 0.0), roughness)).rg; + vec2 brdf = texture(sBRDFLookup, vec2(max(dot(N, V), 0.0), roughness)).rg; vec3 specular = (1.0 - diffuseSample.a) * prefilteredColor * (F * brdf.x + brdf.y); ambient += (kD * diffuse + specular) * ao; @@ -335,7 +335,7 @@ void main() { } if (isFeatureEnabled(FEATURE_ENVMAP)) { vec3 R = reflect(-V, N); - vec4 envmapSample = texture(uEnvmap, R); + vec4 envmapSample = texture(sEnvironmentMap, R); if (isFeatureEnabled(FEATURE_HDR)) { envmapSample.rgb = pow(envmapSample.rgb, vec3(GAMMA)); } diff --git a/src/engine/graphics/shader/shaders_phong.cpp b/src/engine/graphics/shader/shaders_phong.cpp index f7daaabd..3972eb38 100644 --- a/src/engine/graphics/shader/shaders_phong.cpp +++ b/src/engine/graphics/shader/shaders_phong.cpp @@ -60,12 +60,12 @@ void main() { vec2 uv = getUV(); vec3 N = getNormal(uv); float shadow = getShadow(); - vec4 diffuseSample = texture(uDiffuse, uv); + vec4 diffuseSample = texture(sDiffuseMap, uv); bool opaque = isFeatureEnabled(FEATURE_ENVMAP) || isFeatureEnabled(FEATURE_BUMPMAP) || isFeatureEnabled(FEATURE_NORMALMAP); vec3 lighting; if (isFeatureEnabled(FEATURE_LIGHTMAP)) { - vec4 lightmapSample = texture(uLightmap, fragLightmapCoords); + vec4 lightmapSample = texture(sLightmap, fragLightmapCoords); lighting = (1.0 - 0.5 * shadow) * lightmapSample.rgb; if (isFeatureEnabled(FEATURE_WATER)) { lighting = mix(vec3(1.0), lighting, 0.2); @@ -86,7 +86,7 @@ void main() { if (isFeatureEnabled(FEATURE_ENVMAP)) { vec3 V = normalize(uGeneral.cameraPosition.xyz - fragPosition); vec3 R = reflect(-V, N); - vec4 envmapSample = texture(uEnvmap, R); + vec4 envmapSample = texture(sEnvironmentMap, R); objectColor += (1.0 - diffuseSample.a) * envmapSample.rgb; } if (isFeatureEnabled(FEATURE_WATER)) { @@ -116,7 +116,7 @@ void main() { vec3 lighting; if (isFeatureEnabled(FEATURE_LIGHTMAP)) { - vec4 lightmapSample = texture(uLightmap, fragLightmapCoords); + vec4 lightmapSample = texture(sLightmap, fragLightmapCoords); lighting = (1.0 - 0.5 * shadow) * lightmapSample.rgb; } else if (isFeatureEnabled(FEATURE_LIGHTING)) { vec3 indirect = getLightingIndirect(N); diff --git a/src/engine/graphics/texture/textures.cpp b/src/engine/graphics/texture/textures.cpp index 77edcd33..244bbb15 100644 --- a/src/engine/graphics/texture/textures.cpp +++ b/src/engine/graphics/texture/textures.cpp @@ -64,16 +64,16 @@ void Textures::invalidateCache() { } void Textures::bindDefaults() { - StateManager::instance().setActiveTextureUnit(TextureUnits::diffuse); + StateManager::instance().setActiveTextureUnit(TextureUnits::diffuseMap); _default->bind(); StateManager::instance().setActiveTextureUnit(TextureUnits::lightmap); _default->bind(); - StateManager::instance().setActiveTextureUnit(TextureUnits::envmap); + StateManager::instance().setActiveTextureUnit(TextureUnits::environmentMap); _defaultCubemap->bind(); - StateManager::instance().setActiveTextureUnit(TextureUnits::bumpmap); + StateManager::instance().setActiveTextureUnit(TextureUnits::bumpMap); _default->bind(); StateManager::instance().setActiveTextureUnit(TextureUnits::bloom); @@ -91,7 +91,7 @@ void Textures::bindDefaults() { StateManager::instance().setActiveTextureUnit(TextureUnits::shadowMap); _default->bind(); - StateManager::instance().setActiveTextureUnit(TextureUnits::cubeShadowMap); + StateManager::instance().setActiveTextureUnit(TextureUnits::shadowMapCube); _defaultCubemap->bind(); } diff --git a/src/engine/graphics/types.h b/src/engine/graphics/types.h index 277d5524..efc07543 100644 --- a/src/engine/graphics/types.h +++ b/src/engine/graphics/types.h @@ -89,16 +89,16 @@ struct GraphicsOptions { }; struct TextureUnits { - static constexpr int diffuse { 0 }; + static constexpr int diffuseMap { 0 }; static constexpr int lightmap { 1 }; - static constexpr int envmap { 2 }; - static constexpr int bumpmap { 3 }; + static constexpr int environmentMap { 2 }; + static constexpr int bumpMap { 3 }; static constexpr int bloom { 4 }; static constexpr int irradianceMap { 5 }; static constexpr int prefilterMap { 6 }; static constexpr int brdfLookup { 7 }; static constexpr int shadowMap { 8 }; - static constexpr int cubeShadowMap { 9 }; + static constexpr int shadowMapCube { 9 }; }; class IEventHandler { diff --git a/src/engine/gui/control/control.cpp b/src/engine/gui/control/control.cpp index c4f6ee7a..0da0bc3c 100644 --- a/src/engine/gui/control/control.cpp +++ b/src/engine/gui/control/control.cpp @@ -264,7 +264,7 @@ void Control::drawBorder(const Border &border, const glm::ivec2 &offset, const g Shaders::instance().activate(ShaderProgram::SimpleGUI, uniforms); } - StateManager::instance().setActiveTextureUnit(TextureUnits::diffuse); + StateManager::instance().setActiveTextureUnit(TextureUnits::diffuseMap); border.fill->bind(); bool additive = border.fill->isAdditive(); @@ -280,7 +280,7 @@ void Control::drawBorder(const Border &border, const glm::ivec2 &offset, const g int width = size.x - 2 * border.dimension; int height = size.y - 2 * border.dimension; - StateManager::instance().setActiveTextureUnit(TextureUnits::diffuse); + StateManager::instance().setActiveTextureUnit(TextureUnits::diffuseMap); border.edge->bind(); if (height > 0.0f) { @@ -357,7 +357,7 @@ void Control::drawBorder(const Border &border, const glm::ivec2 &offset, const g int x = _extent.left + offset.x; int y = _extent.top + offset.y; - StateManager::instance().setActiveTextureUnit(TextureUnits::diffuse); + StateManager::instance().setActiveTextureUnit(TextureUnits::diffuseMap); border.corner->bind(); // Top left corner diff --git a/src/engine/gui/control/imagebutton.cpp b/src/engine/gui/control/imagebutton.cpp index 849717b4..700f73eb 100644 --- a/src/engine/gui/control/imagebutton.cpp +++ b/src/engine/gui/control/imagebutton.cpp @@ -85,7 +85,7 @@ void ImageButton::drawIcon( } if (iconFrame) { - StateManager::instance().setActiveTextureUnit(TextureUnits::diffuse); + StateManager::instance().setActiveTextureUnit(TextureUnits::diffuseMap); iconFrame->bind(); glm::mat4 transform(1.0f); @@ -102,7 +102,7 @@ void ImageButton::drawIcon( } if (iconTexture) { - StateManager::instance().setActiveTextureUnit(TextureUnits::diffuse); + StateManager::instance().setActiveTextureUnit(TextureUnits::diffuseMap); iconTexture->bind(); glm::mat4 transform(1.0f); diff --git a/src/engine/gui/control/progressbar.cpp b/src/engine/gui/control/progressbar.cpp index 3bcd0251..76538f2d 100644 --- a/src/engine/gui/control/progressbar.cpp +++ b/src/engine/gui/control/progressbar.cpp @@ -47,7 +47,7 @@ void ProgressBar::load(const GffStruct &gffs) { void ProgressBar::draw(const glm::ivec2 &offset, const vector &text) { if (_value == 0 || !_progress.fill) return; - StateManager::instance().setActiveTextureUnit(TextureUnits::diffuse); + StateManager::instance().setActiveTextureUnit(TextureUnits::diffuseMap); _progress.fill->bind(); float w = _extent.width * _value / 100.0f; diff --git a/src/engine/gui/control/scrollbar.cpp b/src/engine/gui/control/scrollbar.cpp index e66d25f2..9eeeb0ba 100644 --- a/src/engine/gui/control/scrollbar.cpp +++ b/src/engine/gui/control/scrollbar.cpp @@ -60,7 +60,7 @@ void ScrollBar::draw(const glm::ivec2 &offset, const vector &text) { void ScrollBar::drawThumb(const glm::ivec2 &offset) { if (!_thumb.image || _state.numVisible >= _state.count) return; - StateManager::instance().setActiveTextureUnit(TextureUnits::diffuse); + StateManager::instance().setActiveTextureUnit(TextureUnits::diffuseMap); _thumb.image->bind(); ShaderUniforms uniforms; @@ -107,7 +107,7 @@ void ScrollBar::drawArrows(const glm::ivec2 &offset) { bool canScrollDown = _state.count - _state.offset > _state.numVisible; if (!canScrollUp && !canScrollDown) return; - StateManager::instance().setActiveTextureUnit(TextureUnits::diffuse); + StateManager::instance().setActiveTextureUnit(TextureUnits::diffuseMap); _dir.image->bind(); if (canScrollUp) { diff --git a/src/engine/gui/gui.cpp b/src/engine/gui/gui.cpp index b4400ed3..40231157 100644 --- a/src/engine/gui/gui.cpp +++ b/src/engine/gui/gui.cpp @@ -250,7 +250,7 @@ void GUI::draw3D() { } void GUI::drawBackground() { - StateManager::instance().setActiveTextureUnit(TextureUnits::diffuse); + StateManager::instance().setActiveTextureUnit(TextureUnits::diffuseMap); _background->bind(); glm::mat4 transform(1.0f); diff --git a/src/engine/scene/node/emitternode.cpp b/src/engine/scene/node/emitternode.cpp index a5a605e8..1689afae 100644 --- a/src/engine/scene/node/emitternode.cpp +++ b/src/engine/scene/node/emitternode.cpp @@ -177,7 +177,7 @@ void EmitterSceneNode::drawParticles(const vector &particles) { Shaders::instance().activate(ShaderProgram::ParticleParticle, uniforms); - StateManager::instance().setActiveTextureUnit(TextureUnits::diffuse); + StateManager::instance().setActiveTextureUnit(TextureUnits::diffuseMap); texture->bind(); bool lighten = emitter->blendMode == ModelNode::Emitter::BlendMode::Lighten; diff --git a/src/engine/scene/node/grassnode.cpp b/src/engine/scene/node/grassnode.cpp index b2382567..93b10a21 100644 --- a/src/engine/scene/node/grassnode.cpp +++ b/src/engine/scene/node/grassnode.cpp @@ -53,7 +53,7 @@ void GrassSceneNode::addCluster(Cluster cluster) { } void GrassSceneNode::drawClusters(const vector &clusters) { - StateManager::instance().setActiveTextureUnit(TextureUnits::diffuse); + StateManager::instance().setActiveTextureUnit(TextureUnits::diffuseMap); _texture->bind(); ShaderUniforms uniforms(_sceneGraph->uniformsPrototype()); diff --git a/src/engine/scene/node/lightnode.cpp b/src/engine/scene/node/lightnode.cpp index 79c3f135..eb10bb56 100644 --- a/src/engine/scene/node/lightnode.cpp +++ b/src/engine/scene/node/lightnode.cpp @@ -56,7 +56,7 @@ void LightSceneNode::drawLensFlares(const ModelNode::LensFlare &flare) { shared_ptr camera(_sceneGraph->activeCamera()); if (!camera) return; - StateManager::instance().setActiveTextureUnit(TextureUnits::diffuse); + StateManager::instance().setActiveTextureUnit(TextureUnits::diffuseMap); flare.texture->bind(); glm::vec4 lightPos(_absTransform[3]); diff --git a/src/engine/scene/node/meshnode.cpp b/src/engine/scene/node/meshnode.cpp index 5875abd0..faf26b14 100644 --- a/src/engine/scene/node/meshnode.cpp +++ b/src/engine/scene/node/meshnode.cpp @@ -371,7 +371,7 @@ void MeshSceneNode::drawSingle(bool shadowPass) { // Setup textures if (_textures.diffuse) { - StateManager::instance().setActiveTextureUnit(TextureUnits::diffuse); + StateManager::instance().setActiveTextureUnit(TextureUnits::diffuseMap); _textures.diffuse->bind(); additive = _textures.diffuse->isAdditive(); } @@ -380,7 +380,7 @@ void MeshSceneNode::drawSingle(bool shadowPass) { _textures.lightmap->bind(); } if (_textures.envmap) { - StateManager::instance().setActiveTextureUnit(TextureUnits::envmap); + StateManager::instance().setActiveTextureUnit(TextureUnits::environmentMap); _textures.envmap->bind(); PBRIBL::Derived derived; @@ -394,7 +394,7 @@ void MeshSceneNode::drawSingle(bool shadowPass) { } } if (_textures.bumpmap) { - StateManager::instance().setActiveTextureUnit(TextureUnits::bumpmap); + StateManager::instance().setActiveTextureUnit(TextureUnits::bumpMap); _textures.bumpmap->bind(); } diff --git a/src/engine/scene/pipeline/control.cpp b/src/engine/scene/pipeline/control.cpp index 9c7b639e..080b22a3 100644 --- a/src/engine/scene/pipeline/control.cpp +++ b/src/engine/scene/pipeline/control.cpp @@ -85,7 +85,7 @@ void ControlRenderPipeline::render(const glm::ivec2 &offset) { // Render control - StateManager::instance().setActiveTextureUnit(TextureUnits::diffuse); + StateManager::instance().setActiveTextureUnit(TextureUnits::diffuseMap); _geometryColor->bind(); int viewport[4]; diff --git a/src/engine/scene/pipeline/world.cpp b/src/engine/scene/pipeline/world.cpp index 2200533f..c3858678 100644 --- a/src/engine/scene/pipeline/world.cpp +++ b/src/engine/scene/pipeline/world.cpp @@ -255,7 +255,7 @@ void WorldRenderPipeline::drawGeometry() { StateManager::instance().setActiveTextureUnit(TextureUnits::shadowMap); _shadowsDepth->bind(); } else { - StateManager::instance().setActiveTextureUnit(TextureUnits::cubeShadowMap); + StateManager::instance().setActiveTextureUnit(TextureUnits::shadowMapCube); _cubeShadowsDepth->bind(); } } @@ -279,7 +279,7 @@ void WorldRenderPipeline::applyHorizontalBlur() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - StateManager::instance().setActiveTextureUnit(TextureUnits::diffuse); + StateManager::instance().setActiveTextureUnit(TextureUnits::diffuseMap); _geometryColor2->bind(); ShaderUniforms uniforms; @@ -302,7 +302,7 @@ void WorldRenderPipeline::applyVerticalBlur() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - StateManager::instance().setActiveTextureUnit(TextureUnits::diffuse); + StateManager::instance().setActiveTextureUnit(TextureUnits::diffuseMap); _horizontalBlurColor->bind(); ShaderUniforms uniforms; @@ -320,7 +320,7 @@ void WorldRenderPipeline::applyVerticalBlur() { } void WorldRenderPipeline::drawResult() { - StateManager::instance().setActiveTextureUnit(TextureUnits::diffuse); + StateManager::instance().setActiveTextureUnit(TextureUnits::diffuseMap); _geometryColor1->bind(); StateManager::instance().setActiveTextureUnit(TextureUnits::bloom); diff --git a/src/engine/video/video.cpp b/src/engine/video/video.cpp index bf8e89d9..aa6b9d2e 100644 --- a/src/engine/video/video.cpp +++ b/src/engine/video/video.cpp @@ -74,7 +74,7 @@ void Video::updateFrame(float dt) { void Video::updateFrameTexture() { if (!_frame) return; - StateManager::instance().setActiveTextureUnit(TextureUnits::diffuse); + StateManager::instance().setActiveTextureUnit(TextureUnits::diffuseMap); _texture->bind(); _texture->setPixels(_width, _height, PixelFormat::RGB, _frame->pixels); } @@ -82,7 +82,7 @@ void Video::updateFrameTexture() { void Video::draw() { if (!_inited) return; - StateManager::instance().setActiveTextureUnit(TextureUnits::diffuse); + StateManager::instance().setActiveTextureUnit(TextureUnits::diffuseMap); _texture->bind(); ShaderUniforms uniforms;