mirror of
https://github.com/luanti-org/luanti.git
synced 2025-09-15 18:57:08 +00:00
Irrlicht cleanups (mostly getting rid of core::array
)
Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
This commit is contained in:
parent
5acc2736db
commit
5d226268df
45 changed files with 308 additions and 1227 deletions
|
@ -184,15 +184,15 @@ void Clouds::updateMesh()
|
|||
const u32 index_count = quad_count * 6;
|
||||
|
||||
// reserve memory
|
||||
mb->Vertices.reallocate(vertex_count);
|
||||
mb->Indices.reallocate(index_count);
|
||||
mb->Vertices.reserve(vertex_count);
|
||||
mb->Indices.reserve(index_count);
|
||||
}
|
||||
|
||||
#define GETINDEX(x, z, radius) (((z)+(radius))*(radius)*2 + (x)+(radius))
|
||||
#define INAREA(x, z, radius) \
|
||||
((x) >= -(radius) && (x) < (radius) && (z) >= -(radius) && (z) < (radius))
|
||||
|
||||
mb->Vertices.set_used(0);
|
||||
mb->Vertices.clear();
|
||||
for (s16 zi0= -m_cloud_radius_i; zi0 < m_cloud_radius_i; zi0++)
|
||||
for (s16 xi0= -m_cloud_radius_i; xi0 < m_cloud_radius_i; xi0++)
|
||||
{
|
||||
|
@ -322,7 +322,7 @@ void Clouds::updateMesh()
|
|||
const u32 index_count = quad_count * 6;
|
||||
// rewrite index array as needed
|
||||
if (mb->getIndexCount() > index_count) {
|
||||
mb->Indices.set_used(index_count);
|
||||
mb->Indices.resize(index_count);
|
||||
mb->setDirty(scene::EBT_INDEX);
|
||||
} else if (mb->getIndexCount() < index_count) {
|
||||
const u32 start = mb->getIndexCount() / 6;
|
||||
|
|
|
@ -119,27 +119,28 @@ Hud::Hud(Client *client, LocalPlayer *player,
|
|||
}
|
||||
|
||||
// Prepare mesh for compass drawing
|
||||
m_rotation_mesh_buffer.Vertices.set_used(4);
|
||||
m_rotation_mesh_buffer.Indices.set_used(6);
|
||||
auto &b = m_rotation_mesh_buffer;
|
||||
b.Vertices.resize(4);
|
||||
b.Indices.resize(6);
|
||||
|
||||
video::SColor white(255, 255, 255, 255);
|
||||
v3f normal(0.f, 0.f, 1.f);
|
||||
|
||||
m_rotation_mesh_buffer.Vertices[0] = video::S3DVertex(v3f(-1.f, -1.f, 0.f), normal, white, v2f(0.f, 1.f));
|
||||
m_rotation_mesh_buffer.Vertices[1] = video::S3DVertex(v3f(-1.f, 1.f, 0.f), normal, white, v2f(0.f, 0.f));
|
||||
m_rotation_mesh_buffer.Vertices[2] = video::S3DVertex(v3f( 1.f, 1.f, 0.f), normal, white, v2f(1.f, 0.f));
|
||||
m_rotation_mesh_buffer.Vertices[3] = video::S3DVertex(v3f( 1.f, -1.f, 0.f), normal, white, v2f(1.f, 1.f));
|
||||
b.Vertices[0] = video::S3DVertex(v3f(-1.f, -1.f, 0.f), normal, white, v2f(0.f, 1.f));
|
||||
b.Vertices[1] = video::S3DVertex(v3f(-1.f, 1.f, 0.f), normal, white, v2f(0.f, 0.f));
|
||||
b.Vertices[2] = video::S3DVertex(v3f( 1.f, 1.f, 0.f), normal, white, v2f(1.f, 0.f));
|
||||
b.Vertices[3] = video::S3DVertex(v3f( 1.f, -1.f, 0.f), normal, white, v2f(1.f, 1.f));
|
||||
|
||||
m_rotation_mesh_buffer.Indices[0] = 0;
|
||||
m_rotation_mesh_buffer.Indices[1] = 1;
|
||||
m_rotation_mesh_buffer.Indices[2] = 2;
|
||||
m_rotation_mesh_buffer.Indices[3] = 2;
|
||||
m_rotation_mesh_buffer.Indices[4] = 3;
|
||||
m_rotation_mesh_buffer.Indices[5] = 0;
|
||||
b.Indices[0] = 0;
|
||||
b.Indices[1] = 1;
|
||||
b.Indices[2] = 2;
|
||||
b.Indices[3] = 2;
|
||||
b.Indices[4] = 3;
|
||||
b.Indices[5] = 0;
|
||||
|
||||
m_rotation_mesh_buffer.getMaterial().Lighting = false;
|
||||
m_rotation_mesh_buffer.getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||
m_rotation_mesh_buffer.setHardwareMappingHint(scene::EHM_STATIC);
|
||||
b.getMaterial().Lighting = false;
|
||||
b.getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||
b.setHardwareMappingHint(scene::EHM_STATIC);
|
||||
}
|
||||
|
||||
void Hud::readScalingSetting()
|
||||
|
|
|
@ -602,7 +602,7 @@ void PartialMeshBuffer::beforeDraw() const
|
|||
void PartialMeshBuffer::afterDraw() const
|
||||
{
|
||||
// Take the data back
|
||||
m_vertex_indexes = m_buffer->Indices.steal();
|
||||
m_vertex_indexes = std::move(m_buffer->Indices);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -555,8 +555,8 @@ v3f Minimap::getYawVec()
|
|||
scene::SMeshBuffer *Minimap::getMinimapMeshBuffer()
|
||||
{
|
||||
scene::SMeshBuffer *buf = new scene::SMeshBuffer();
|
||||
buf->Vertices.set_used(4);
|
||||
buf->Indices.set_used(6);
|
||||
buf->Vertices.resize(4);
|
||||
buf->Indices.resize(6);
|
||||
static const video::SColor c(255, 255, 255, 255);
|
||||
|
||||
buf->Vertices[0] = video::S3DVertex(-1, -1, 0, 0, 0, 1, c, 0, 1);
|
||||
|
|
|
@ -830,8 +830,8 @@ void Sky::updateStars()
|
|||
warningstream << "Requested " << m_star_params.count << " stars but " << 0x4000 << " is the max\n";
|
||||
m_star_params.count = 0x4000;
|
||||
}
|
||||
m_stars->Vertices.reallocate(4 * m_star_params.count);
|
||||
m_stars->Indices.reallocate(6 * m_star_params.count);
|
||||
m_stars->Vertices.reserve(4 * m_star_params.count);
|
||||
m_stars->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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue