mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-22 17:18:39 +00:00
Split CIndexBuffer from CMeshBuffer
This commit is contained in:
parent
5d6e15bc49
commit
47e4c33a50
13 changed files with 197 additions and 104 deletions
|
@ -831,8 +831,9 @@ void Sky::updateStars()
|
|||
m_star_params.count = 0x4000;
|
||||
}
|
||||
auto &vertices = m_stars->Vertices->Data;
|
||||
auto &indices = m_stars->Indices->Data;
|
||||
vertices.reserve(4 * m_star_params.count);
|
||||
m_stars->Indices.reserve(6 * m_star_params.count);
|
||||
indices.reserve(6 * m_star_params.count);
|
||||
|
||||
video::SColor fallback_color = m_star_params.starcolor; // used on GLES 2 “without shaders”
|
||||
PcgRandom rgen(m_seed);
|
||||
|
@ -859,12 +860,12 @@ void Sky::updateStars()
|
|||
vertices.push_back(video::S3DVertex(p3, {}, fallback_color, {}));
|
||||
}
|
||||
for (u16 i = 0; i < m_star_params.count; i++) {
|
||||
m_stars->Indices.push_back(i * 4 + 0);
|
||||
m_stars->Indices.push_back(i * 4 + 1);
|
||||
m_stars->Indices.push_back(i * 4 + 2);
|
||||
m_stars->Indices.push_back(i * 4 + 2);
|
||||
m_stars->Indices.push_back(i * 4 + 3);
|
||||
m_stars->Indices.push_back(i * 4 + 0);
|
||||
indices.push_back(i * 4 + 0);
|
||||
indices.push_back(i * 4 + 1);
|
||||
indices.push_back(i * 4 + 2);
|
||||
indices.push_back(i * 4 + 2);
|
||||
indices.push_back(i * 4 + 3);
|
||||
indices.push_back(i * 4 + 0);
|
||||
}
|
||||
m_stars->setHardwareMappingHint(scene::EHM_STATIC);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue