[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36541] trunk/blender/source/blender: Apply part of [#21590] .dds textures: fix for DXT1n format

Nathan Letwory nathan at letworyinteractive.com
Sat May 7 22:53:49 CEST 2011


Revision: 36541
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36541
Author:   jesterking
Date:     2011-05-07 20:53:49 +0000 (Sat, 07 May 2011)
Log Message:
-----------
Apply part of [#21590] .dds textures: fix for DXT1n format
Submitted by Amorilia.

DXT1 .dds textures with 1-bit alpha channel have their alpha channel imported in Blender.

The patch also makes change to contact info for the patch submitter.

I left the sync with upstream nvtt for another commit.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_image/image_ops.c
    trunk/blender/source/blender/imbuf/intern/dds/BlockDXT.cpp
    trunk/blender/source/blender/imbuf/intern/dds/BlockDXT.h
    trunk/blender/source/blender/imbuf/intern/dds/Color.h
    trunk/blender/source/blender/imbuf/intern/dds/ColorBlock.cpp
    trunk/blender/source/blender/imbuf/intern/dds/ColorBlock.h
    trunk/blender/source/blender/imbuf/intern/dds/Common.h
    trunk/blender/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
    trunk/blender/source/blender/imbuf/intern/dds/DirectDrawSurface.h
    trunk/blender/source/blender/imbuf/intern/dds/Image.cpp
    trunk/blender/source/blender/imbuf/intern/dds/Image.h
    trunk/blender/source/blender/imbuf/intern/dds/PixelFormat.h
    trunk/blender/source/blender/imbuf/intern/dds/Stream.cpp
    trunk/blender/source/blender/imbuf/intern/dds/Stream.h
    trunk/blender/source/blender/imbuf/intern/dds/dds_api.cpp
    trunk/blender/source/blender/imbuf/intern/dds/dds_api.h
    trunk/blender/source/blender/makesrna/intern/rna_nodetree.c
    trunk/blender/source/blender/makesrna/intern/rna_scene.c

Modified: trunk/blender/source/blender/editors/space_image/image_ops.c
===================================================================
--- trunk/blender/source/blender/editors/space_image/image_ops.c	2011-05-07 18:15:28 UTC (rev 36540)
+++ trunk/blender/source/blender/editors/space_image/image_ops.c	2011-05-07 20:53:49 UTC (rev 36541)
@@ -645,6 +645,9 @@
 		{R_TARGA, "TARGA", 0, "Targa", ""},
 		{R_RAWTGA, "TARGA RAW", 0, "Targa Raw", ""},
 		{R_PNG, "PNG", 0, "PNG", ""},
+#ifdef WITH_DDS
+		{R_DDS, "DDS", 0, "DirectDraw Surface", ""},
+#endif
 		{R_BMP, "BMP", 0, "BMP", ""},
 		{R_JPEG90, "JPEG", 0, "Jpeg", ""},
 #ifdef WITH_OPENJPEG

Modified: trunk/blender/source/blender/imbuf/intern/dds/BlockDXT.cpp
===================================================================
--- trunk/blender/source/blender/imbuf/intern/dds/BlockDXT.cpp	2011-05-07 18:15:28 UTC (rev 36540)
+++ trunk/blender/source/blender/imbuf/intern/dds/BlockDXT.cpp	2011-05-07 20:53:49 UTC (rev 36541)
@@ -17,7 +17,7 @@
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
- * Contributors: Amorilia (amorilia at gamebox.net)
+ * Contributors: Amorilia (amorilia at users.sourceforge.net)
  *
  * ***** END GPL LICENSE BLOCK *****
  */

Modified: trunk/blender/source/blender/imbuf/intern/dds/BlockDXT.h
===================================================================
--- trunk/blender/source/blender/imbuf/intern/dds/BlockDXT.h	2011-05-07 18:15:28 UTC (rev 36540)
+++ trunk/blender/source/blender/imbuf/intern/dds/BlockDXT.h	2011-05-07 20:53:49 UTC (rev 36541)
@@ -17,7 +17,7 @@
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
- * Contributors: Amorilia (amorilia at gamebox.net)
+ * Contributors: Amorilia (amorilia at users.sourceforge.net)
  *
  * ***** END GPL LICENSE BLOCK *****
  */

Modified: trunk/blender/source/blender/imbuf/intern/dds/Color.h
===================================================================
--- trunk/blender/source/blender/imbuf/intern/dds/Color.h	2011-05-07 18:15:28 UTC (rev 36540)
+++ trunk/blender/source/blender/imbuf/intern/dds/Color.h	2011-05-07 20:53:49 UTC (rev 36541)
@@ -17,7 +17,7 @@
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
- * Contributors: Amorilia (amorilia at gamebox.net)
+ * Contributors: Amorilia (amorilia at users.sourceforge.net)
  *
  * ***** END GPL LICENSE BLOCK *****
  */

Modified: trunk/blender/source/blender/imbuf/intern/dds/ColorBlock.cpp
===================================================================
--- trunk/blender/source/blender/imbuf/intern/dds/ColorBlock.cpp	2011-05-07 18:15:28 UTC (rev 36540)
+++ trunk/blender/source/blender/imbuf/intern/dds/ColorBlock.cpp	2011-05-07 20:53:49 UTC (rev 36541)
@@ -17,7 +17,7 @@
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
- * Contributors: Amorilia (amorilia at gamebox.net)
+ * Contributors: Amorilia (amorilia at users.sourceforge.net)
  *
  * ***** END GPL LICENSE BLOCK *****
  */

Modified: trunk/blender/source/blender/imbuf/intern/dds/ColorBlock.h
===================================================================
--- trunk/blender/source/blender/imbuf/intern/dds/ColorBlock.h	2011-05-07 18:15:28 UTC (rev 36540)
+++ trunk/blender/source/blender/imbuf/intern/dds/ColorBlock.h	2011-05-07 20:53:49 UTC (rev 36541)
@@ -17,7 +17,7 @@
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
- * Contributors: Amorilia (amorilia at gamebox.net)
+ * Contributors: Amorilia (amorilia at users.sourceforge.net)
  *
  * ***** END GPL LICENSE BLOCK *****
  */

Modified: trunk/blender/source/blender/imbuf/intern/dds/Common.h
===================================================================
--- trunk/blender/source/blender/imbuf/intern/dds/Common.h	2011-05-07 18:15:28 UTC (rev 36540)
+++ trunk/blender/source/blender/imbuf/intern/dds/Common.h	2011-05-07 20:53:49 UTC (rev 36541)
@@ -17,7 +17,7 @@
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
- * Contributors: Amorilia (amorilia at gamebox.net)
+ * Contributors: Amorilia (amorilia at users.sourceforge.net)
  *
  * ***** END GPL LICENSE BLOCK *****
  */

Modified: trunk/blender/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
===================================================================
--- trunk/blender/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp	2011-05-07 18:15:28 UTC (rev 36540)
+++ trunk/blender/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp	2011-05-07 20:53:49 UTC (rev 36541)
@@ -17,7 +17,7 @@
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
- * Contributors: Amorilia (amorilia at gamebox.net)
+ * Contributors: Amorilia (amorilia at users.sourceforge.net)
  *
  * ***** END GPL LICENSE BLOCK *****
  */

Modified: trunk/blender/source/blender/imbuf/intern/dds/DirectDrawSurface.h
===================================================================
--- trunk/blender/source/blender/imbuf/intern/dds/DirectDrawSurface.h	2011-05-07 18:15:28 UTC (rev 36540)
+++ trunk/blender/source/blender/imbuf/intern/dds/DirectDrawSurface.h	2011-05-07 20:53:49 UTC (rev 36541)
@@ -17,7 +17,7 @@
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
- * Contributors: Amorilia (amorilia at gamebox.net)
+ * Contributors: Amorilia (amorilia at users.sourceforge.net)
  *
  * ***** END GPL LICENSE BLOCK *****
  */

Modified: trunk/blender/source/blender/imbuf/intern/dds/Image.cpp
===================================================================
--- trunk/blender/source/blender/imbuf/intern/dds/Image.cpp	2011-05-07 18:15:28 UTC (rev 36540)
+++ trunk/blender/source/blender/imbuf/intern/dds/Image.cpp	2011-05-07 20:53:49 UTC (rev 36541)
@@ -17,7 +17,7 @@
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
- * Contributors: Amorilia (amorilia at gamebox.net)
+ * Contributors: Amorilia (amorilia at users.sourceforge.net)
  *
  * ***** END GPL LICENSE BLOCK *****
  */

Modified: trunk/blender/source/blender/imbuf/intern/dds/Image.h
===================================================================
--- trunk/blender/source/blender/imbuf/intern/dds/Image.h	2011-05-07 18:15:28 UTC (rev 36540)
+++ trunk/blender/source/blender/imbuf/intern/dds/Image.h	2011-05-07 20:53:49 UTC (rev 36541)
@@ -17,7 +17,7 @@
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
- * Contributors: Amorilia (amorilia at gamebox.net)
+ * Contributors: Amorilia (amorilia at users.sourceforge.net)
  *
  * ***** END GPL LICENSE BLOCK *****
  */

Modified: trunk/blender/source/blender/imbuf/intern/dds/PixelFormat.h
===================================================================
--- trunk/blender/source/blender/imbuf/intern/dds/PixelFormat.h	2011-05-07 18:15:28 UTC (rev 36540)
+++ trunk/blender/source/blender/imbuf/intern/dds/PixelFormat.h	2011-05-07 20:53:49 UTC (rev 36541)
@@ -17,7 +17,7 @@
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
- * Contributors: Amorilia (amorilia at gamebox.net)
+ * Contributors: Amorilia (amorilia at users.sourceforge.net)
  *
  * ***** END GPL LICENSE BLOCK *****
  */

Modified: trunk/blender/source/blender/imbuf/intern/dds/Stream.cpp
===================================================================
--- trunk/blender/source/blender/imbuf/intern/dds/Stream.cpp	2011-05-07 18:15:28 UTC (rev 36540)
+++ trunk/blender/source/blender/imbuf/intern/dds/Stream.cpp	2011-05-07 20:53:49 UTC (rev 36541)
@@ -17,7 +17,7 @@
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
- * Contributors: Amorilia (amorilia at gamebox.net)
+ * Contributors: Amorilia (amorilia at users.sourceforge.net)
  *
  * ***** END GPL LICENSE BLOCK *****
  */

Modified: trunk/blender/source/blender/imbuf/intern/dds/Stream.h
===================================================================
--- trunk/blender/source/blender/imbuf/intern/dds/Stream.h	2011-05-07 18:15:28 UTC (rev 36540)
+++ trunk/blender/source/blender/imbuf/intern/dds/Stream.h	2011-05-07 20:53:49 UTC (rev 36541)
@@ -17,7 +17,7 @@
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
- * Contributors: Amorilia (amorilia at gamebox.net)
+ * Contributors: Amorilia (amorilia at users.sourceforge.net)
  *
  * ***** END GPL LICENSE BLOCK *****
  */

Modified: trunk/blender/source/blender/imbuf/intern/dds/dds_api.cpp
===================================================================
--- trunk/blender/source/blender/imbuf/intern/dds/dds_api.cpp	2011-05-07 18:15:28 UTC (rev 36540)
+++ trunk/blender/source/blender/imbuf/intern/dds/dds_api.cpp	2011-05-07 20:53:49 UTC (rev 36541)
@@ -17,7 +17,7 @@
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
- * Contributors: Amorilia (amorilia at gamebox.net)
+ * Contributors: Amorilia (amorilia at users.sourceforge.net)
  *
  * ***** END GPL LICENSE BLOCK *****
  */
@@ -106,10 +106,21 @@
 	}
 
 	/* convert DDS into ImBuf */
-	// TODO use the image RGB or RGBA tag to determine the bits per pixel
-	if (dds.hasAlpha()) bits_per_pixel = 32;
-	else bits_per_pixel = 24;
-	ibuf = IMB_allocImBuf(dds.width(), dds.height(), bits_per_pixel, 0);
+	dds.mipmap(&img, 0, 0); /* load first face, first mipmap */
+	pixels = img.pixels();
+	numpixels = dds.width() * dds.height();
+	bits_per_pixel = 24;
+	if (img.format() == Image::Format_ARGB) {
+		/* check that there is effectively an alpha channel */

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list