]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
added loadtextureimagebumpasnmap
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 2 Dec 2002 01:33:33 +0000 (01:33 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 2 Dec 2002 01:33:33 +0000 (01:33 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2667 d7cf8633-e32d-0410-b094-e92efae38249

image.c
image.h

diff --git a/image.c b/image.c
index 2b17283d38236d1c9181dedd2815e5646d5f9705..8bb3d4d7df418ef68dc470306ac6deb7bc3f8602 100644 (file)
--- a/image.c
+++ b/image.c
@@ -723,6 +723,22 @@ rtexture_t *loadtextureimagewithmaskandnmap (rtexturepool_t *pool, const char *f
        return rt;
 }
 
+rtexture_t *loadtextureimagebumpasnmap (rtexturepool_t *pool, const char *filename, int matchwidth, int matchheight, qboolean complain, int flags, float bumpscale)
+{
+       qbyte *data, *data2;
+       rtexture_t *rt;
+       if (!(data = loadimagepixels (filename, complain, matchwidth, matchheight)))
+               return 0;
+       data2 = Mem_Alloc(tempmempool, image_width * image_height * 4);
+
+       Image_HeightmapToNormalmap(data, data2, image_width, image_height, (flags & TEXF_CLAMP) != 0, bumpscale);
+       rt = R_LoadTexture2D(pool, filename, image_width, image_height, data2, TEXTYPE_RGBA, flags, NULL);
+
+       Mem_Free(data2);
+       Mem_Free(data);
+       return rt;
+}
+
 qboolean Image_WriteTGARGB_preflipped (const char *filename, int width, int height, const qbyte *data)
 {
        qboolean ret;
diff --git a/image.h b/image.h
index 5ff67384fa8350a3960ff052a85c1478e01d694d..2d26d29ed1368e32fea6620e0c3e820e1695e340 100644 (file)
--- a/image.h
+++ b/image.h
@@ -28,6 +28,7 @@ rtexture_t *image_masktex;
 rtexture_t *image_nmaptex;
 rtexture_t *loadtextureimagewithmask (rtexturepool_t *pool, const char *filename, int matchwidth, int matchheight, qboolean complain, int flags);
 rtexture_t *loadtextureimagewithmaskandnmap (rtexturepool_t *pool, const char *filename, int matchwidth, int matchheight, qboolean complain, int flags, float bumpscale);
+rtexture_t *loadtextureimagebumpasnmap (rtexturepool_t *pool, const char *filename, int matchwidth, int matchheight, qboolean complain, int flags, float bumpscale);
 
 // writes a RGB TGA that is already upside down (which TGA wants)
 qboolean Image_WriteTGARGB_preflipped (const char *filename, int width, int height, const qbyte *data);