mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-02 16:38:41 +00:00
Speedup mapblock_mesh
This commit is contained in:
parent
625489dff4
commit
f0db6c4423
4 changed files with 113 additions and 99 deletions
21
src/tile.h
21
src/tile.h
|
@ -27,6 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#include <IrrlichtDevice.h>
|
||||
#include "threads.h"
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
class IGameDef;
|
||||
|
||||
|
@ -106,6 +107,7 @@ public:
|
|||
virtual bool isKnownSourceImage(const std::string &name)=0;
|
||||
virtual video::ITexture* generateTextureFromMesh(
|
||||
const TextureFromMeshParams ¶ms)=0;
|
||||
virtual video::ITexture* getNormalTexture(const std::string &name)=0;
|
||||
};
|
||||
|
||||
class IWritableTextureSource : public ITextureSource
|
||||
|
@ -127,6 +129,7 @@ public:
|
|||
virtual void processQueue()=0;
|
||||
virtual void insertSourceImage(const std::string &name, video::IImage *img)=0;
|
||||
virtual void rebuildImagesAndTextures()=0;
|
||||
virtual video::ITexture* getNormalTexture(const std::string &name)=0;
|
||||
};
|
||||
|
||||
IWritableTextureSource* createTextureSource(IrrlichtDevice *device);
|
||||
|
@ -175,11 +178,25 @@ enum MaterialType{
|
|||
This fully defines the looks of a tile.
|
||||
The SMaterial of a tile is constructed according to this.
|
||||
*/
|
||||
struct FrameSpec
|
||||
{
|
||||
FrameSpec():
|
||||
texture_id(0),
|
||||
texture(NULL),
|
||||
normal_texture(NULL)
|
||||
{
|
||||
}
|
||||
u32 texture_id;
|
||||
video::ITexture *texture;
|
||||
video::ITexture *normal_texture;
|
||||
};
|
||||
|
||||
struct TileSpec
|
||||
{
|
||||
TileSpec():
|
||||
texture_id(0),
|
||||
texture(NULL),
|
||||
normal_texture(NULL),
|
||||
alpha(255),
|
||||
material_type(TILE_MATERIAL_BASIC),
|
||||
material_flags(
|
||||
|
@ -243,6 +260,8 @@ struct TileSpec
|
|||
|
||||
u32 texture_id;
|
||||
video::ITexture *texture;
|
||||
video::ITexture *normal_texture;
|
||||
|
||||
// Vertex alpha (when MATERIAL_ALPHA_VERTEX is used)
|
||||
u8 alpha;
|
||||
// Material parameters
|
||||
|
@ -252,6 +271,8 @@ struct TileSpec
|
|||
// Animation parameters
|
||||
u8 animation_frame_count;
|
||||
u16 animation_frame_length_ms;
|
||||
std::map<u32, FrameSpec> frames;
|
||||
|
||||
u8 rotation;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue