Merge branch 'master' of github.com:supertuxkart/stk-code
This commit is contained in:
commit
8db34bed3c
@ -1,16 +1,18 @@
|
||||
uniform sampler2D tex;
|
||||
uniform float low;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
vec3 getCIEYxy(vec3 rgbColor);
|
||||
vec3 getRGBFromCIEXxy(vec3 YxyColor);
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 uv = gl_FragCoord.xy / 512;
|
||||
vec3 col = texture(tex, uv).xyz;
|
||||
float luma = getCIEYxy(col).x;
|
||||
vec3 Yxy = getCIEYxy(col);
|
||||
vec3 WhiteYxy = getCIEYxy(vec3(1.));
|
||||
|
||||
col *= smoothstep(1., 10., luma);
|
||||
FragColor = vec4(col, 1.0);
|
||||
Yxy.x = smoothstep(WhiteYxy.x, WhiteYxy.x * 4, Yxy.x);
|
||||
|
||||
FragColor = vec4(getRGBFromCIEXxy(Yxy), 1.0);
|
||||
}
|
||||
|
@ -3,10 +3,12 @@
|
||||
|
||||
vec3 getCIEYxy(vec3 rgbColor)
|
||||
{
|
||||
mat3 sRGB2XYZ = transpose(mat3(
|
||||
mat3 RGB2XYZ = transpose(mat3(
|
||||
vec3(.4125, .2126, .0193),
|
||||
vec3(.3576, .7152, .1192),
|
||||
vec3(.1805, .0722, .9505)));
|
||||
|
||||
return sRGB2XYZ * rgbColor;
|
||||
vec3 xYz = RGB2XYZ * rgbColor;
|
||||
float tmp = xYz.x + xYz.y + xYz.z;
|
||||
return vec3(xYz.y, xYz.xy / tmp);
|
||||
}
|
||||
|
@ -6,12 +6,12 @@ vec3 getRGBFromCIEXxy(vec3 YxyColor)
|
||||
float Yovery = YxyColor.x / YxyColor.z;
|
||||
vec3 XYZ = vec3(YxyColor.y * Yovery, YxyColor.x, (1. - YxyColor.y - YxyColor.z) * Yovery);
|
||||
|
||||
mat3 XYZ2sRGB = transpose(mat3(
|
||||
mat3 XYZ2RGB = transpose(mat3(
|
||||
vec3(3.2405, -.9693, .0556),
|
||||
vec3(-1.5371, 1.8760, -.2040),
|
||||
vec3(-.4985, .0416, 1.0572)));
|
||||
|
||||
vec3 sRGBColor = XYZ2sRGB * XYZ;
|
||||
return max(sRGBColor, vec3(0.));//vec3(pow(sRGBColor.x, 2.2), pow(sRGBColor.y, 2.2), pow(sRGBColor.z, 2.2));
|
||||
vec3 RGBColor = XYZ2RGB * XYZ;
|
||||
return max(RGBColor, vec3(0.));
|
||||
}
|
||||
|
||||
|
@ -341,6 +341,11 @@ Material::Material(const XMLNode *node, bool deprecated)
|
||||
// ---- End backwards compatibility
|
||||
}
|
||||
|
||||
if (m_shader_type == SHADERTYPE_SOLID)
|
||||
{
|
||||
node->get("normal-map", &m_normal_map_tex);
|
||||
}
|
||||
|
||||
if (m_disable_z_write && m_shader_type != SHADERTYPE_ALPHA_BLEND && m_shader_type != SHADERTYPE_ADDITIVE)
|
||||
{
|
||||
Log::debug("material", "Disabling writes to z buffer only makes sense when compositing is blending or additive (for %s)", m_texname.c_str());
|
||||
@ -967,13 +972,13 @@ void Material::adjustForFog(scene::ISceneNode* parent, video::SMaterial *m,
|
||||
// above fog and thus unaffected by it
|
||||
if (use_fog && !m_fog && m_shader_type != SHADERTYPE_ALPHA_BLEND && m_shader_type != SHADERTYPE_ADDITIVE)
|
||||
{
|
||||
m->ZWriteEnable = true;
|
||||
m->MaterialType = video::EMT_ONETEXTURE_BLEND;
|
||||
m->MaterialTypeParam =
|
||||
pack_textureBlendFunc(video::EBF_SRC_ALPHA,
|
||||
video::EBF_ONE_MINUS_SRC_ALPHA,
|
||||
video::EMFN_MODULATE_1X,
|
||||
video::EAS_TEXTURE | video::EAS_VERTEX_COLOR);
|
||||
//m->ZWriteEnable = true;
|
||||
//m->MaterialType = video::EMT_ONETEXTURE_BLEND;
|
||||
//m->MaterialTypeParam =
|
||||
// pack_textureBlendFunc(video::EBF_SRC_ALPHA,
|
||||
// video::EBF_ONE_MINUS_SRC_ALPHA,
|
||||
// video::EMFN_MODULATE_1X,
|
||||
// video::EAS_TEXTURE | video::EAS_VERTEX_COLOR);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1435,6 +1435,7 @@ namespace FullScreenShader
|
||||
Program = LoadProgram(OBJECT,
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getCIEXYZ.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getRGBfromCIEXxy.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/bloom.frag").c_str());
|
||||
AssignUniforms();
|
||||
|
||||
|
@ -153,21 +153,16 @@ scene::IMesh* STKTextBillboard::getTextMesh(core::stringw text, gui::ScalableFon
|
||||
return Mesh;
|
||||
}
|
||||
|
||||
void STKTextBillboard::OnRegisterSceneNode()
|
||||
void STKTextBillboard::updateNoGL()
|
||||
{
|
||||
if (IsVisible)
|
||||
{
|
||||
SceneManager->registerNodeForRendering(this, scene::ESNRP_SOLID);
|
||||
scene::ICameraSceneNode* curr_cam = irr_driver->getSceneManager()->getActiveCamera();
|
||||
core::vector3df cam_pos = curr_cam->getPosition();
|
||||
core::vector3df text_pos = this->getAbsolutePosition();
|
||||
float angle = atan2(text_pos.X - cam_pos.X, text_pos.Z - cam_pos.Z);
|
||||
this->setRotation(core::vector3df(0.0f, angle * 180.0f / M_PI, 0.0f));
|
||||
updateAbsolutePosition();
|
||||
|
||||
scene::ICameraSceneNode* curr_cam = irr_driver->getSceneManager()->getActiveCamera();
|
||||
core::vector3df cam_pos = curr_cam->getPosition();
|
||||
core::vector3df text_pos = this->getAbsolutePosition();
|
||||
float angle = atan2(text_pos.X - cam_pos.X, text_pos.Z - cam_pos.Z);
|
||||
this->setRotation(core::vector3df(0.0f, angle * 180.0f / M_PI, 0.0f));
|
||||
updateAbsolutePosition();
|
||||
}
|
||||
|
||||
ISceneNode::OnRegisterSceneNode();
|
||||
STKMeshSceneNode::updateNoGL();
|
||||
}
|
||||
|
||||
void STKTextBillboard::collectChar(video::ITexture* texture,
|
||||
|
@ -56,7 +56,7 @@ public:
|
||||
const irr::core::vector3df& position,
|
||||
const irr::core::vector3df& size);
|
||||
|
||||
virtual void OnRegisterSceneNode() OVERRIDE;
|
||||
virtual void updateNoGL() OVERRIDE;
|
||||
|
||||
virtual void collectChar(irr::video::ITexture* texture,
|
||||
const irr::core::rect<irr::s32>& destRect,
|
||||
|
Loading…
x
Reference in New Issue
Block a user