diff options
author | Kahrl <kahrl@gmx.net> | 2011-09-21 18:37:29 +0200 |
---|---|---|
committer | Kahrl <kahrl@gmx.net> | 2011-09-21 18:37:29 +0200 |
commit | 3e012122d1607a6269af4e4522305d8b5efcd9d4 (patch) | |
tree | 62682ee2228d2cf76e3d90c7f8360c9148802417 /src/utility.cpp | |
parent | a4a2c348318139ae9605cf0d7477fe93e8aa2651 (diff) | |
download | minetest-3e012122d1607a6269af4e4522305d8b5efcd9d4.tar.gz minetest-3e012122d1607a6269af4e4522305d8b5efcd9d4.tar.bz2 minetest-3e012122d1607a6269af4e4522305d8b5efcd9d4.zip |
Simplistic wielded tool lighting, added setMeshVerticesColor to utility.h and refactored some other code into calls of that
Diffstat (limited to 'src/utility.cpp')
-rw-r--r-- | src/utility.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/utility.cpp b/src/utility.cpp index 9c1edc8a9..3c6c2f286 100644 --- a/src/utility.cpp +++ b/src/utility.cpp @@ -156,6 +156,25 @@ void mysrand(unsigned seed) next = seed; } +// Sets the color of all vertices in the mesh +void setMeshVerticesColor(scene::IMesh* mesh, video::SColor& color) +{ + if(mesh == NULL) + return; + + u16 mc = mesh->getMeshBufferCount(); + for(u16 j=0; j<mc; j++) + { + scene::IMeshBuffer *buf = mesh->getMeshBuffer(j); + video::S3DVertex *vertices = (video::S3DVertex*)buf->getVertices(); + u16 vc = buf->getVertexCount(); + for(u16 i=0; i<vc; i++) + { + vertices[i].Color = color; + } + } +} + /* blockpos: position of block in block coordinates camera_pos: position of camera in nodes |