Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)

To expand with full Organic Maps and Maps.ME commits history run:
  git remote add om-historic [om-historic.git repo url]
  git fetch --tags om-historic
  git replace squashed-history historic-commits
This commit is contained in:
Konstantin Pastbin
2025-04-13 16:37:30 +07:00
commit e3e4a1985a
12931 changed files with 13195100 additions and 0 deletions

110
drape/uniform_value.cpp Normal file
View File

@@ -0,0 +1,110 @@
#include "drape/uniform_value.hpp"
#include "drape/gl_functions.hpp"
namespace dp
{
namespace
{
void ApplyInt(int8_t location, int32_t const * pointer, size_t componentCount)
{
switch (componentCount)
{
case 1:
GLFunctions::glUniformValuei(location, pointer[0]);
break;
case 2:
GLFunctions::glUniformValuei(location, pointer[0], pointer[1]);
break;
case 3:
GLFunctions::glUniformValuei(location, pointer[0], pointer[1], pointer[2]);
break;
case 4:
GLFunctions::glUniformValuei(location, pointer[0], pointer[1], pointer[2], pointer[3]);
break;
default:
ASSERT(false, ());
}
}
void ApplyFloat(int8_t location, float const * pointer, size_t componentCount)
{
switch (componentCount)
{
case 1:
GLFunctions::glUniformValuef(location, pointer[0]);
break;
case 2:
GLFunctions::glUniformValuef(location, pointer[0], pointer[1]);
break;
case 3:
GLFunctions::glUniformValuef(location, pointer[0], pointer[1], pointer[2]);
break;
case 4:
GLFunctions::glUniformValuef(location, pointer[0], pointer[1], pointer[2], pointer[3]);
break;
default:
ASSERT(false, ());
}
}
void ApplyMatrix(int8_t location, float const * matrix)
{
GLFunctions::glUniformMatrix4x4Value(location, matrix);
}
} // namespace
// static
void UniformValue::ApplyRaw(int8_t location, glsl::mat4 const & m)
{
ASSERT_GREATER_OR_EQUAL(location, 0, ());
ApplyMatrix(location, glsl::value_ptr(m));
}
// static
void UniformValue::ApplyRaw(int8_t location, float f)
{
ApplyFloat(location, &f, 1);
}
// static
void UniformValue::ApplyRaw(int8_t location, glsl::vec2 const & v)
{
ApplyFloat(location, glsl::value_ptr(v), 2);
}
// static
void UniformValue::ApplyRaw(int8_t location, glsl::vec3 const & v)
{
ApplyFloat(location, glsl::value_ptr(v), 3);
}
// static
void UniformValue::ApplyRaw(int8_t location, glsl::vec4 const & v)
{
ApplyFloat(location, glsl::value_ptr(v), 4);
}
// static
void UniformValue::ApplyRaw(int8_t location, int i)
{
ApplyInt(location, &i, 1);
}
// static
void UniformValue::ApplyRaw(int8_t location, glsl::ivec2 const & v)
{
ApplyInt(location, glsl::value_ptr(v), 2);
}
// static
void UniformValue::ApplyRaw(int8_t location, glsl::ivec3 const & v)
{
ApplyInt(location, glsl::value_ptr(v), 3);
}
// static
void UniformValue::ApplyRaw(int8_t location, glsl::ivec4 const & v)
{
ApplyInt(location, glsl::value_ptr(v), 4);
}
} // namespace dp