]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/mesh.cpp
Add inventory right click drag and drop
[dragonfireclient.git] / src / mesh.cpp
index a98cb8bf4643455a2bc89133120fb0936ce1aa2f..3200d5fa6c2fd453fc44ab4bc97ca117e563e1f0 100644 (file)
@@ -18,8 +18,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 */
 
 #include "mesh.h"
+#include "debug.h"
 #include "log.h"
-#include <cassert>
 #include <iostream>
 #include <IAnimatedMesh.h>
 #include <SAnimatedMesh.h>
@@ -260,7 +260,7 @@ scene::IAnimatedMesh* createExtrudedMesh(video::ITexture *texture,
                video::IVideoDriver *driver, v3f scale)
 {
        scene::IAnimatedMesh *mesh = NULL;
-       core::dimension2d<u32> size = texture->getSize();
+       core::dimension2d<u32> size = texture->getOriginalSize();
        video::ECOLOR_FORMAT format = texture->getColorFormat();
        if (format == video::ECF_A8R8G8B8)
        {
@@ -280,15 +280,17 @@ scene::IAnimatedMesh* createExtrudedMesh(video::ITexture *texture,
 
                // img1 is in the texture's color format, convert to 8-bit ARGB
                video::IImage *img2 = driver->createImage(video::ECF_A8R8G8B8, size);
-               if (img2 != NULL)
+               if (img2 == NULL)
                {
-                       img1->copyTo(img2);
-
-                       mesh = extrudeARGB(size.Width, size.Height, (u8*) img2->lock());
-                       img2->unlock();
-                       img2->drop();
+                       img1->drop();
+                       return NULL;
                }
+
+               img1->copyTo(img2);
                img1->drop();
+               mesh = extrudeARGB(size.Width, size.Height, (u8*) img2->lock());
+               img2->unlock();
+               img2->drop();
        }
 
        // Set default material