45 std::string mUniformName;
46 bgfx::UniformType::Enum mUniformType = bgfx::UniformType::Count;
51 Uniform(
const std::string& name, bgfx::UniformType::Enum type) :
52 mUniformName(name), mUniformType(type)
54 mUniformHandle = bgfx::createUniform(name.c_str(), type);
58 mUniformName(
oth.mUniformName), mUniformType(
oth.mUniformType)
61 bgfx::createUniform(mUniformName.c_str(), mUniformType);
68 if (bgfx::isValid(mUniformHandle))
69 bgfx::destroy(mUniformHandle);
72 bgfx::UniformHandle handle()
const {
return mUniformHandle; }
74 const std::string& name()
const {
return mUniformName; }
76 bgfx::UniformType::Enum type()
const {
return mUniformType; }
78 void bind(
const void* data)
const
80 bgfx::setUniform(mUniformHandle, data);
86 swap(mUniformHandle,
oth.mUniformHandle);
87 swap(mUniformName,
oth.mUniformName);
88 swap(mUniformType,
oth.mUniformType);
99 static float uintBitsToFloat(
uint bits)
111 static uint floatToUintBits(
float f)