Skip to content

Commit

Permalink
Replace TriangleFan as poorly supported
Browse files Browse the repository at this point in the history
  • Loading branch information
numberZero authored and lhofhansl committed Nov 26, 2020
1 parent 560627e commit d7cf40a
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/client/sky.cpp
Expand Up @@ -209,7 +209,7 @@ void Sky::render()

const f32 t = 1.0f;
const f32 o = 0.0f;
static const u16 indices[4] = {0, 1, 2, 3};
static const u16 indices[6] = {0, 1, 2, 0, 2, 3};
video::S3DVertex vertices[4];

driver->setMaterial(m_materials[1]);
Expand Down Expand Up @@ -251,7 +251,7 @@ void Sky::render()
vertex.Pos.rotateXZBy(180);
}
}
driver->drawIndexedTriangleFan(&vertices[0], 4, indices, 2);
driver->drawIndexedTriangleList(&vertices[0], 4, indices, 2);
}
}

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

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

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

// Draw bottom far cloudy fog thing in front of sun, moon and stars
Expand All @@ -353,7 +353,7 @@ void Sky::render()
vertices[1] = video::S3DVertex( 1, -1.0, -1, 0, 1, 0, c, o, t);
vertices[2] = video::S3DVertex( 1, -1.0, 1, 0, 1, 0, c, o, o);
vertices[3] = video::S3DVertex(-1, -1.0, 1, 0, 1, 0, c, t, o);
driver->drawIndexedTriangleFan(&vertices[0], 4, indices, 2);
driver->drawIndexedTriangleList(&vertices[0], 4, indices, 2);
}
}
}
Expand Down Expand Up @@ -597,7 +597,7 @@ void Sky::draw_sun(video::IVideoDriver *driver, float sunsize, const video::SCol
* wicked_time_of_day: current time of day, to know where should be the sun in the sky
*/
{
static const u16 indices[4] = {0, 1, 2, 3};
static const u16 indices[] = {0, 1, 2, 0, 2, 3};
std::array<video::S3DVertex, 4> vertices;
if (!m_sun_texture) {
driver->setMaterial(m_materials[1]);
Expand All @@ -615,7 +615,7 @@ void Sky::draw_sun(video::IVideoDriver *driver, float sunsize, const video::SCol
for (int i = 0; i < 4; i++) {
draw_sky_body(vertices, -sunsizes[i], sunsizes[i], colors[i]);
place_sky_body(vertices, 90, wicked_time_of_day * 360 - 90);
driver->drawIndexedTriangleFan(&vertices[0], 4, indices, 2);
driver->drawIndexedTriangleList(&vertices[0], 4, indices, 2);
}
} else {
driver->setMaterial(m_materials[3]);
Expand All @@ -627,7 +627,7 @@ void Sky::draw_sun(video::IVideoDriver *driver, float sunsize, const video::SCol
c = video::SColor(255, 255, 255, 255);
draw_sky_body(vertices, -d, d, c);
place_sky_body(vertices, 90, wicked_time_of_day * 360 - 90);
driver->drawIndexedTriangleFan(&vertices[0], 4, indices, 2);
driver->drawIndexedTriangleList(&vertices[0], 4, indices, 2);
}
}

Expand All @@ -644,7 +644,7 @@ void Sky::draw_moon(video::IVideoDriver *driver, float moonsize, const video::SC
* the sky
*/
{
static const u16 indices[4] = {0, 1, 2, 3};
static const u16 indices[] = {0, 1, 2, 0, 2, 3};
std::array<video::S3DVertex, 4> vertices;
if (!m_moon_texture) {
driver->setMaterial(m_materials[1]);
Expand All @@ -668,7 +668,7 @@ void Sky::draw_moon(video::IVideoDriver *driver, float moonsize, const video::SC
for (int i = 0; i < 4; i++) {
draw_sky_body(vertices, moonsizes_1[i], moonsizes_2[i], colors[i]);
place_sky_body(vertices, -90, wicked_time_of_day * 360 - 90);
driver->drawIndexedTriangleFan(&vertices[0], 4, indices, 2);
driver->drawIndexedTriangleList(&vertices[0], 4, indices, 2);
}
} else {
driver->setMaterial(m_materials[4]);
Expand Down

0 comments on commit d7cf40a

Please sign in to comment.