mirror of
https://github.com/minetest/minetest.git
synced 2024-11-30 03:23:45 +01:00
Fix texture matrix handling in our shaders
This commit is contained in:
parent
4e3b8db2b9
commit
e27757fa3a
@ -91,7 +91,7 @@ float directional_ambient(vec3 normal)
|
|||||||
|
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
varTexCoord = (mTexture * inTexCoord0).st;
|
varTexCoord = (mTexture * vec4(inTexCoord0.xy, 1.0, 1.0)).st;
|
||||||
gl_Position = mWorldViewProj * inVertexPosition;
|
gl_Position = mWorldViewProj * inVertexPosition;
|
||||||
|
|
||||||
vPosition = gl_Position.xyz;
|
vPosition = gl_Position.xyz;
|
||||||
|
@ -1125,8 +1125,11 @@ void COpenGL3DriverBase::setMaterial(const SMaterial &material)
|
|||||||
OverrideMaterial.apply(Material);
|
OverrideMaterial.apply(Material);
|
||||||
|
|
||||||
for (u32 i = 0; i < Feature.MaxTextureUnits; ++i) {
|
for (u32 i = 0; i < Feature.MaxTextureUnits; ++i) {
|
||||||
CacheHandler->getTextureCache().set(i, material.getTexture(i));
|
auto *texture = material.getTexture(i);
|
||||||
setTransform((E_TRANSFORMATION_STATE)(ETS_TEXTURE_0 + i), material.getTextureMatrix(i));
|
CacheHandler->getTextureCache().set(i, texture);
|
||||||
|
if (texture) {
|
||||||
|
setTransform((E_TRANSFORMATION_STATE)(ETS_TEXTURE_0 + i), material.getTextureMatrix(i));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@ public:
|
|||||||
m_world_view_proj.set(worldViewProj, services);
|
m_world_view_proj.set(worldViewProj, services);
|
||||||
|
|
||||||
if (driver->getDriverType() == video::EDT_OGLES2 || driver->getDriverType() == video::EDT_OPENGL3) {
|
if (driver->getDriverType() == video::EDT_OGLES2 || driver->getDriverType() == video::EDT_OPENGL3) {
|
||||||
core::matrix4 texture = driver->getTransform(video::ETS_TEXTURE_0);
|
auto &texture = driver->getTransform(video::ETS_TEXTURE_0);
|
||||||
m_world_view.set(worldView, services);
|
m_world_view.set(worldView, services);
|
||||||
m_texture.set(texture, services);
|
m_texture.set(texture, services);
|
||||||
}
|
}
|
||||||
@ -573,6 +573,7 @@ ShaderInfo ShaderSource::generateShader(const std::string &name,
|
|||||||
} else {
|
} else {
|
||||||
shaders_header << "#version 100\n";
|
shaders_header << "#version 100\n";
|
||||||
}
|
}
|
||||||
|
// cf. EVertexAttributes.h for the predefined ones
|
||||||
vertex_header = R"(
|
vertex_header = R"(
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
@ -582,7 +583,7 @@ ShaderInfo ShaderSource::generateShader(const std::string &name,
|
|||||||
|
|
||||||
attribute highp vec4 inVertexPosition;
|
attribute highp vec4 inVertexPosition;
|
||||||
attribute lowp vec4 inVertexColor;
|
attribute lowp vec4 inVertexColor;
|
||||||
attribute mediump vec4 inTexCoord0;
|
attribute mediump vec2 inTexCoord0;
|
||||||
attribute mediump vec3 inVertexNormal;
|
attribute mediump vec3 inVertexNormal;
|
||||||
attribute mediump vec4 inVertexTangent;
|
attribute mediump vec4 inVertexTangent;
|
||||||
attribute mediump vec4 inVertexBinormal;
|
attribute mediump vec4 inVertexBinormal;
|
||||||
|
Loading…
Reference in New Issue
Block a user