Fix upright sprite entities not animating
Some checks failed
android / build (push) Waiting to run
cpp_lint / clang_tidy (push) Waiting to run
linux / gcc_7 (push) Waiting to run
linux / gcc_14 (push) Waiting to run
linux / clang_7 (push) Waiting to run
linux / clang_18 (push) Waiting to run
linux / clang_11 (PROMETHEUS=1) (push) Waiting to run
macos / build (push) Waiting to run
whitespace_checks / tabs_lua_api_files (push) Waiting to run
whitespace_checks / trailing_whitespaces (push) Waiting to run
windows / MinGW cross-compiler (${{ matrix.bits }}-bit) (32) (push) Waiting to run
windows / MinGW cross-compiler (${{ matrix.bits }}-bit) (64) (push) Waiting to run
windows / VS 2019 ${{ matrix.config.arch }}-${{ matrix.type }} (map[arch:x64 generator:-G'Visual Studio 16 2019' -A x64 vcpkg_triplet:x64-windows], portable) (push) Waiting to run
windows / VS 2019 ${{ matrix.config.arch }}-${{ matrix.type }} (map[arch:x86 generator:-G'Visual Studio 16 2019' -A Win32 vcpkg_triplet:x86-windows], portable) (push) Waiting to run
lua_lint / Compile and run multiplayer tests (push) Has been cancelled
lua_lint / Builtin Luacheck and Unit Tests (push) Has been cancelled
lua_api_deploy / build (push) Has been cancelled

This commit is contained in:
Lars Müller 2024-09-06 12:11:16 +02:00 committed by GitHub
parent 041d67ceca
commit 9e5d6bc162
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 16 deletions

View File

@ -1264,6 +1264,16 @@ void GenericCAO::step(float dtime, ClientEnvironment *env)
}
}
static void setMeshBufferTextureCoords(scene::IMeshBuffer *buf, const v2f *uv, u32 count)
{
assert(buf->getVertexType() == video::EVT_STANDARD);
assert(buf->getVertexCount() == count);
auto *vertices = static_cast<video::S3DVertex *>(buf->getVertices());
for (u32 i = 0; i < count; i++)
vertices[i].TCoords = uv[i];
buf->setDirty(scene::EBT_VERTEX);
}
void GenericCAO::updateTexturePos()
{
if(m_spritenode)

View File

@ -18,6 +18,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/
#include "mesh.h"
#include "S3DVertex.h"
#include "debug.h"
#include "log.h"
#include <cmath>
@ -197,15 +198,6 @@ void setMeshColor(scene::IMesh *mesh, const video::SColor &color)
setMeshBufferColor(mesh->getMeshBuffer(j), color);
}
void setMeshBufferTextureCoords(scene::IMeshBuffer *buf, const v2f *uv, u32 count)
{
const u32 stride = getVertexPitchFromType(buf->getVertexType());
assert(buf->getVertexCount() >= count);
u8 *vertices = (u8 *) buf->getVertices();
for (u32 i = 0; i < count; i++)
((video::S3DVertex*) (vertices + i * stride))->TCoords = uv[i];
}
template <typename F>
static void applyToMesh(scene::IMesh *mesh, const F &fn)
{

View File

@ -59,13 +59,6 @@ void setMeshBufferColor(scene::IMeshBuffer *buf, const video::SColor &color);
*/
void setMeshColor(scene::IMesh *mesh, const video::SColor &color);
/*
Sets texture coords for vertices in the mesh buffer.
`uv[]` must have `count` elements
*/
void setMeshBufferTextureCoords(scene::IMeshBuffer *buf, const v2f *uv, u32 count);
/*
Set a constant color for an animated mesh
*/