timi-liuliang / echo

A New Cross-Platform 2D 3D Game Engine
MIT License
938 stars 107 forks source link

ShaderEditor support get texture size (May need update glsl version) #1225

Closed timi-liuliang closed 1 year ago

timi-liuliang commented 1 year ago

https://stackoverflow.com/questions/25803909/glsl-texture-size

timi-liuliang commented 1 year ago

Set texture size when bind texture

if (texture)
{
    shaderProgram->setUniform(StringUtil::Format("u_%sSize", uniform->m_name.c_str()), &texture->getSize(), ShaderParamType::SPT_VEC2, 1);
    shaderProgram->setUniform(uniform->m_name.c_str(), &textureCount, uniform->m_type, uniform->m_count);
}