Skip to content

Commit d7cf40a

Browse files
numberZerolhofhansl
authored andcommittedNov 26, 2020
Replace TriangleFan as poorly supported
1 parent 560627e commit d7cf40a

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed
 

‎src/client/sky.cpp

+11-11
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ void Sky::render()
209209

210210
const f32 t = 1.0f;
211211
const f32 o = 0.0f;
212-
static const u16 indices[4] = {0, 1, 2, 3};
212+
static const u16 indices[6] = {0, 1, 2, 0, 2, 3};
213213
video::S3DVertex vertices[4];
214214

215215
driver->setMaterial(m_materials[1]);
@@ -251,7 +251,7 @@ void Sky::render()
251251
vertex.Pos.rotateXZBy(180);
252252
}
253253
}
254-
driver->drawIndexedTriangleFan(&vertices[0], 4, indices, 2);
254+
driver->drawIndexedTriangleList(&vertices[0], 4, indices, 2);
255255
}
256256
}
257257

@@ -277,7 +277,7 @@ void Sky::render()
277277
// Switch from -Z (south) to +Z (north)
278278
vertex.Pos.rotateXZBy(-180);
279279
}
280-
driver->drawIndexedTriangleFan(&vertices[0], 4, indices, 2);
280+
driver->drawIndexedTriangleList(&vertices[0], 4, indices, 2);
281281
}
282282
}
283283

@@ -308,7 +308,7 @@ void Sky::render()
308308
// Switch from -Z (south) to -X (west)
309309
vertex.Pos.rotateXZBy(-90);
310310
}
311-
driver->drawIndexedTriangleFan(&vertices[0], 4, indices, 2);
311+
driver->drawIndexedTriangleList(&vertices[0], 4, indices, 2);
312312
}
313313

314314
// Draw sun
@@ -344,7 +344,7 @@ void Sky::render()
344344
// Switch from -Z (south) to +Z (north)
345345
vertex.Pos.rotateXZBy(-180);
346346
}
347-
driver->drawIndexedTriangleFan(&vertices[0], 4, indices, 2);
347+
driver->drawIndexedTriangleList(&vertices[0], 4, indices, 2);
348348
}
349349

350350
// Draw bottom far cloudy fog thing in front of sun, moon and stars
@@ -353,7 +353,7 @@ void Sky::render()
353353
vertices[1] = video::S3DVertex( 1, -1.0, -1, 0, 1, 0, c, o, t);
354354
vertices[2] = video::S3DVertex( 1, -1.0, 1, 0, 1, 0, c, o, o);
355355
vertices[3] = video::S3DVertex(-1, -1.0, 1, 0, 1, 0, c, t, o);
356-
driver->drawIndexedTriangleFan(&vertices[0], 4, indices, 2);
356+
driver->drawIndexedTriangleList(&vertices[0], 4, indices, 2);
357357
}
358358
}
359359
}
@@ -597,7 +597,7 @@ void Sky::draw_sun(video::IVideoDriver *driver, float sunsize, const video::SCol
597597
* wicked_time_of_day: current time of day, to know where should be the sun in the sky
598598
*/
599599
{
600-
static const u16 indices[4] = {0, 1, 2, 3};
600+
static const u16 indices[] = {0, 1, 2, 0, 2, 3};
601601
std::array<video::S3DVertex, 4> vertices;
602602
if (!m_sun_texture) {
603603
driver->setMaterial(m_materials[1]);
@@ -615,7 +615,7 @@ void Sky::draw_sun(video::IVideoDriver *driver, float sunsize, const video::SCol
615615
for (int i = 0; i < 4; i++) {
616616
draw_sky_body(vertices, -sunsizes[i], sunsizes[i], colors[i]);
617617
place_sky_body(vertices, 90, wicked_time_of_day * 360 - 90);
618-
driver->drawIndexedTriangleFan(&vertices[0], 4, indices, 2);
618+
driver->drawIndexedTriangleList(&vertices[0], 4, indices, 2);
619619
}
620620
} else {
621621
driver->setMaterial(m_materials[3]);
@@ -627,7 +627,7 @@ void Sky::draw_sun(video::IVideoDriver *driver, float sunsize, const video::SCol
627627
c = video::SColor(255, 255, 255, 255);
628628
draw_sky_body(vertices, -d, d, c);
629629
place_sky_body(vertices, 90, wicked_time_of_day * 360 - 90);
630-
driver->drawIndexedTriangleFan(&vertices[0], 4, indices, 2);
630+
driver->drawIndexedTriangleList(&vertices[0], 4, indices, 2);
631631
}
632632
}
633633

@@ -644,7 +644,7 @@ void Sky::draw_moon(video::IVideoDriver *driver, float moonsize, const video::SC
644644
* the sky
645645
*/
646646
{
647-
static const u16 indices[4] = {0, 1, 2, 3};
647+
static const u16 indices[] = {0, 1, 2, 0, 2, 3};
648648
std::array<video::S3DVertex, 4> vertices;
649649
if (!m_moon_texture) {
650650
driver->setMaterial(m_materials[1]);
@@ -668,7 +668,7 @@ void Sky::draw_moon(video::IVideoDriver *driver, float moonsize, const video::SC
668668
for (int i = 0; i < 4; i++) {
669669
draw_sky_body(vertices, moonsizes_1[i], moonsizes_2[i], colors[i]);
670670
place_sky_body(vertices, -90, wicked_time_of_day * 360 - 90);
671-
driver->drawIndexedTriangleFan(&vertices[0], 4, indices, 2);
671+
driver->drawIndexedTriangleList(&vertices[0], 4, indices, 2);
672672
}
673673
} else {
674674
driver->setMaterial(m_materials[4]);

0 commit comments

Comments
 (0)
Please sign in to comment.