]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/client/mesh.cpp
Remove unused ITextSceneNode header (#11476)
[dragonfireclient.git] / src / client / mesh.cpp
index 91781373c55284394ab39adc0929f7590b61c984..e4313921895505f64594fe403306641f16db3bc5 100644 (file)
@@ -27,14 +27,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include <SAnimatedMesh.h>
 #include <IAnimatedMeshSceneNode.h>
 
-// In Irrlicht 1.8 the signature of ITexture::lock was changed from
-// (bool, u32) to (E_TEXTURE_LOCK_MODE, u32).
-#if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR <= 7
-#define MY_ETLM_READ_ONLY true
-#else
-#define MY_ETLM_READ_ONLY video::ETLM_READ_ONLY
-#endif
-
 inline static void applyShadeFactor(video::SColor& color, float factor)
 {
        color.setRed(core::clamp(core::round32(color.getRed()*factor), 0, 255));
@@ -203,6 +195,15 @@ 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)
 {
@@ -341,7 +342,7 @@ bool checkMeshNormals(scene::IMesh *mesh)
                // hurting the performance and covering only really weird broken models.
                f32 length = buffer->getNormal(0).getLength();
 
-               if (!isfinite(length) || fabs(length) < 1e-10)
+               if (!std::isfinite(length) || length < 1e-10f)
                        return false;
        }