mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 18:13:46 +01:00
Fix upright sprite entities not animating
This commit is contained in:
parent
336f8d4dc7
commit
4e3b8db2b9
@ -1267,6 +1267,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()
|
void GenericCAO::updateTexturePos()
|
||||||
{
|
{
|
||||||
if(m_spritenode)
|
if(m_spritenode)
|
||||||
|
@ -18,6 +18,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mesh.h"
|
#include "mesh.h"
|
||||||
|
#include "S3DVertex.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
@ -197,15 +198,6 @@ void setMeshColor(scene::IMesh *mesh, const video::SColor &color)
|
|||||||
setMeshBufferColor(mesh->getMeshBuffer(j), 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>
|
template <typename F>
|
||||||
static void applyToMesh(scene::IMesh *mesh, const F &fn)
|
static void applyToMesh(scene::IMesh *mesh, const F &fn)
|
||||||
{
|
{
|
||||||
|
@ -59,13 +59,6 @@ void setMeshBufferColor(scene::IMeshBuffer *buf, const video::SColor &color);
|
|||||||
*/
|
*/
|
||||||
void setMeshColor(scene::IMesh *mesh, 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
|
Set a constant color for an animated mesh
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user