aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstujones11 <stujones111@gmail.com>2018-08-04 18:46:39 +0100
committerParamat <paramat@users.noreply.github.com>2018-08-04 18:46:39 +0100
commitc5a137c29c455d05de971b1447349346b16a8793 (patch)
tree81863f3f4320f1dc499500a2fe58acca0ebd99c5
parent3b9d49b3c7607cf5f01c7b169f84e312eb0fd99d (diff)
downloadminetest-c5a137c29c455d05de971b1447349346b16a8793.tar.gz
minetest-c5a137c29c455d05de971b1447349346b16a8793.tar.bz2
minetest-c5a137c29c455d05de971b1447349346b16a8793.zip
Fix sky objects not rendering with ogles (#7598)
-rw-r--r--src/sky.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/sky.cpp b/src/sky.cpp
index 6ac27afc4..fb4f135a5 100644
--- a/src/sky.cpp
+++ b/src/sky.cpp
@@ -44,7 +44,11 @@ Sky::Sky(s32 id, ITextureSource *tsrc):
video::SMaterial mat;
mat.Lighting = false;
+#ifdef __ANDROID__
+ mat.ZBuffer = video::ECFN_DISABLED;
+#else
mat.ZBuffer = video::ECFN_NEVER;
+#endif
mat.ZWriteEnable = false;
mat.AntiAliasing = 0;
mat.TextureLayer[0].TextureWrapU = video::ETC_CLAMP_TO_EDGE;
@@ -449,6 +453,34 @@ void Sky::render()
video::SColor starcolor(255, f * 90, f * 90, f * 90);
if (starcolor.getBlue() < m_skycolor.getBlue())
break;
+#ifdef __ANDROID__
+ u16 indices[SKY_STAR_COUNT * 3];
+ video::S3DVertex vertices[SKY_STAR_COUNT * 3];
+ for (u32 i = 0; i < SKY_STAR_COUNT; i++) {
+ indices[i * 3 + 0] = i * 3 + 0;
+ indices[i * 3 + 1] = i * 3 + 1;
+ indices[i * 3 + 2] = i * 3 + 2;
+ v3f p = m_stars[i];
+ core::CMatrix4<f32> a;
+ a.buildRotateFromTo(v3f(0, 1, 0), v3f(d, 1 + d, -d / 2));
+ v3f p1 = p;
+ a.rotateVect(p1);
+ a.buildRotateFromTo(v3f(0, 1, 0), v3f(d, 1 - d, d / 2));
+ v3f p2 = p;
+ a.rotateVect(p2);
+ p.rotateXYBy(wicked_time_of_day * 360 - 90);
+ p1.rotateXYBy(wicked_time_of_day * 360 - 90);
+ p2.rotateXYBy(wicked_time_of_day * 360 - 90);
+ vertices[i * 3 + 0].Pos = p;
+ vertices[i * 3 + 0].Color = starcolor;
+ vertices[i * 3 + 1].Pos = p1;
+ vertices[i * 3 + 1].Color = starcolor;
+ vertices[i * 3 + 2].Pos = p2;
+ vertices[i * 3 + 2].Color = starcolor;
+ }
+ driver->drawIndexedTriangleList(vertices, SKY_STAR_COUNT * 3,
+ indices, SKY_STAR_COUNT);
+#else
u16 indices[SKY_STAR_COUNT * 4];
video::S3DVertex vertices[SKY_STAR_COUNT * 4];
for (u32 i = 0; i < SKY_STAR_COUNT; i++) {
@@ -483,6 +515,7 @@ void Sky::render()
driver->drawVertexPrimitiveList(vertices, SKY_STAR_COUNT * 4,
indices, SKY_STAR_COUNT, video::EVT_STANDARD,
scene::EPT_QUADS, video::EIT_16BIT);
+#endif
} while(false);
// Draw far cloudy fog thing below east and west horizons