本文整理汇总了C++中PointLight::getTransform方法的典型用法代码示例。如果您正苦于以下问题:C++ PointLight::getTransform方法的具体用法?C++ PointLight::getTransform怎么用?C++ PointLight::getTransform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PointLight
的用法示例。
在下文中一共展示了PointLight::getTransform方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadDefaultCallbacks
void Uniform::loadDefaultCallbacks()
{
if (setCallbacks["int"] != nullptr) return;
setCallbacks["int"] = [](void* val, Uniform& u){
glUniform1i(u.getLocation(), *static_cast<int*>(val));
};
setCallbacks["uint"] = [](void* val, Uniform& u){
glUniform1i(u.getLocation(), *static_cast<unsigned int*>(val));
};
setCallbacks["float"] = [](void* val, Uniform& u){
glUniform1f(u.getLocation(), *static_cast<float*>(val));
};
setCallbacks["double"] = [](void* val, Uniform& u){
glUniform1d(u.getLocation(), *static_cast<double*>(val));
};
setCallbacks["bool"] = [](void* val, Uniform& u){
glUniform1i(u.getLocation(), *static_cast<bool*>(val));
};
setCallbacks["sampler1D"] = [](void* val, Uniform& u){
glUniform1i(u.getLocation(), *static_cast<int*>(val));
};
setCallbacks["sampler2D"] = [](void* val, Uniform& u){
glUniform1i(u.getLocation(), *static_cast<int*>(val));
};
setCallbacks["sampler3D"] = [](void* val, Uniform& u){
glUniform1i(u.getLocation(), *static_cast<int*>(val));
};
setCallbacks["vec2"] = [](void* val, Uniform& u){
glUniform2f(u.getLocation(), static_cast<Vector2*>(val)->x, static_cast<Vector2*>(val)->y);
};
setCallbacks["vec3"] = [](void* val, Uniform& u){
Vector3* v = static_cast<Vector3*>(val);
glUniform3f(u.getLocation(), v->x, v->y, v->z);
};
setCallbacks["vec4"] = [](void* val, Uniform& u){
glUniform4f(u.getLocation(), static_cast<Vector4*>(val)->x, static_cast<Vector4*>(val)->y, static_cast<Vector4*>(val)->z, static_cast<Vector4*>(val)->w);
};
setCallbacks["mat4"] = [](void* val, Uniform& u){
//std::cout << v << std::endl;
glUniformMatrix4fv(u.getLocation(), 1, GL_TRUE, static_cast<Matrix4*>(val)->toArray());
};
setCallbacks["BaseLight"] = [](void* val, Uniform& u){
BaseLight* base = static_cast<BaseLight*>(val);
if (u.hasChild("intensity")) u.getChild("intensity")->setValue(base->getIntensity());
if (u.hasChild("color")) u.getChild("color")->setValue(&base->getColor());
};
setCallbacks["DirectionalLight"] = [](void* val, Uniform& u){
DirectionalLight* dir = static_cast<DirectionalLight*>(val);
if (u.hasChild("base")) u.getChild("base")->setValue(static_cast<BaseLight*>(dir));
if (u.hasChild("direction")) u.getChild("direction")->setValue(dir->getDirection());
};
setCallbacks["PointLight"] = [](void* val, Uniform& u){
PointLight* poi = static_cast<PointLight*>(val);
if (u.hasChild("base")) u.getChild("base")->setValue(static_cast<BaseLight*>(poi));
if (u.hasChild("constant")) u.getChild("constant")->setValue(poi->getConstant());
if (u.hasChild("linear")) u.getChild("linear")->setValue(poi->getLinear());
if (u.hasChild("exponent")) u.getChild("exponent")->setValue(poi->getExponent());
if (u.hasChild("position")) u.getChild("position")->setValue(poi->getTransform()->getWorldPosition());
if (u.hasChild("range")) u.getChild("range")->setValue(poi->getRange());
};
setCallbacks["SpotLight"] = [](void* val, Uniform& u){
SpotLight* spot = static_cast<SpotLight*>(val);
//.........这里部分代码省略.........