[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37528] branches/soc-2011-salad: merge with trunk -r37527

Ryakiotakis Antonis kalast at gmail.com
Thu Jun 16 00:14:53 CEST 2011


Revision: 37528
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37528
Author:   psy-fi
Date:     2011-06-15 22:14:53 +0000 (Wed, 15 Jun 2011)
Log Message:
-----------
merge with trunk -r37527

Revision Links:
--------------
    http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37527

Modified Paths:
--------------
    branches/soc-2011-salad/release/scripts/startup/bl_ui/space_userpref.py
    branches/soc-2011-salad/source/blender/editors/interface/resources.c
    branches/soc-2011-salad/source/blender/gpu/GPU_draw.h
    branches/soc-2011-salad/source/blender/gpu/intern/gpu_draw.c
    branches/soc-2011-salad/source/blender/makesdna/DNA_userdef_types.h
    branches/soc-2011-salad/source/blender/makesrna/intern/rna_userdef.c
    branches/soc-2011-salad/source/blender/windowmanager/intern/wm_init_exit.c
    branches/soc-2011-salad/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
    branches/soc-2011-salad/source/gameengine/Ketsji/BL_Texture.cpp

Property Changed:
----------------
    branches/soc-2011-salad/
    branches/soc-2011-salad/build_files/cmake/Modules/FindOpenEXR.cmake


Property changes on: branches/soc-2011-salad
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/soc-2010-jwilkins:28499-37009
/branches/soc-2010-nicolasbishop:28448-30783
/branches/soc-2011-cucumber:36829-36994
/branches/soc-2011-onion:36833-37387
/branches/soc-2011-pepper:36830-37151
/branches/soc-2011-tomato:36831-37517
/trunk/blender:36834-37515
   + /branches/soc-2010-jwilkins:28499-37009
/branches/soc-2010-nicolasbishop:28448-30783
/branches/soc-2011-cucumber:36829-36994
/branches/soc-2011-onion:36833-37387
/branches/soc-2011-pepper:36830-37151
/branches/soc-2011-tomato:36831-37517
/trunk/blender:36834-37527


Property changes on: branches/soc-2011-salad/build_files/cmake/Modules/FindOpenEXR.cmake
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Modified: branches/soc-2011-salad/release/scripts/startup/bl_ui/space_userpref.py
===================================================================
--- branches/soc-2011-salad/release/scripts/startup/bl_ui/space_userpref.py	2011-06-15 22:07:54 UTC (rev 37527)
+++ branches/soc-2011-salad/release/scripts/startup/bl_ui/space_userpref.py	2011-06-15 22:14:53 UTC (rev 37528)
@@ -440,6 +440,8 @@
         col.prop(system, "gl_clip_alpha", slider=True)
         col.prop(system, "use_mipmaps")
         col.prop(system, "use_highres_tex")
+        col.label(text="Anisotropic Filtering")
+        col.prop(system, "anisotropic_filter", text="")
         col.prop(system, "use_vertex_buffer_objects")
         #Anti-aliasing is disabled as it breaks broder/lasso select
         #col.prop(system, "use_antialiasing")

Modified: branches/soc-2011-salad/source/blender/editors/interface/resources.c
===================================================================
--- branches/soc-2011-salad/source/blender/editors/interface/resources.c	2011-06-15 22:07:54 UTC (rev 37527)
+++ branches/soc-2011-salad/source/blender/editors/interface/resources.c	2011-06-15 22:14:53 UTC (rev 37528)
@@ -1624,6 +1624,8 @@
 		U.dragthreshold= 5;
 	if (U.widget_unit==0)
 		U.widget_unit= (U.dpi * 20 + 36)/72;
+	if (U.anisotropic_filter <= 0)
+		U.anisotropic_filter = 1;
 
 	/* funny name, but it is GE stuff, moves userdef stuff to engine */
 // XXX	space_set_commmandline_options();

Modified: branches/soc-2011-salad/source/blender/gpu/GPU_draw.h
===================================================================
--- branches/soc-2011-salad/source/blender/gpu/GPU_draw.h	2011-06-15 22:07:54 UTC (rev 37527)
+++ branches/soc-2011-salad/source/blender/gpu/GPU_draw.h	2011-06-15 22:14:53 UTC (rev 37528)
@@ -112,6 +112,11 @@
 void GPU_set_linear_mipmap(int linear);
 void GPU_paint_set_mipmap(int mipmap);
 
+/* Anisotropic filtering settings
+ * - these will free textures on changes */
+void GPU_set_anisotropic(float value);
+float GPU_get_anisotropic(void);
+
 /* Image updates and free
  * - these deal with images bound as opengl textures */
 

Modified: branches/soc-2011-salad/source/blender/gpu/intern/gpu_draw.c
===================================================================
--- branches/soc-2011-salad/source/blender/gpu/intern/gpu_draw.c	2011-06-15 22:07:54 UTC (rev 37527)
+++ branches/soc-2011-salad/source/blender/gpu/intern/gpu_draw.c	2011-06-15 22:14:53 UTC (rev 37528)
@@ -245,8 +245,9 @@
 	int domipmap, linearmipmap;
 
 	int alphamode;
+	float anisotropic;
 	MTFace *lasttface;
-} GTS = {0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 1, 0, -1, NULL};
+} GTS = {0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 1, 0, -1, 1.f, NULL};
 
 /* Mipmap settings */
 
@@ -291,6 +292,26 @@
 	}
 }
 
+/* Anisotropic filtering settings */
+void GPU_set_anisotropic(float value)
+{
+	if (GTS.anisotropic != value)
+	{
+		GPU_free_images();
+
+		/* Clamp value to the maximum value the graphics card supports */
+		if (value > GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT)
+			value = GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT;
+
+		GTS.anisotropic = value;
+	}
+}
+
+float GPU_get_anisotropic()
+{
+	return GTS.anisotropic;
+}
+
 /* Set OpenGL state for an MTFace */
 
 static void gpu_make_repbind(Image *ima)
@@ -597,6 +618,8 @@
 		ima->tpageflag |= IMA_MIPMAP_COMPLETE;
 	}
 
+	if (GLEW_EXT_texture_filter_anisotropic)
+		glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, GPU_get_anisotropic());
 	/* set to modulate with vertex color */
 	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
 		

Modified: branches/soc-2011-salad/source/blender/makesdna/DNA_userdef_types.h
===================================================================
--- branches/soc-2011-salad/source/blender/makesdna/DNA_userdef_types.h	2011-06-15 22:07:54 UTC (rev 37527)
+++ branches/soc-2011-salad/source/blender/makesdna/DNA_userdef_types.h	2011-06-15 22:14:53 UTC (rev 37528)
@@ -381,7 +381,8 @@
 	short scrcastwait;		/* milliseconds between screencast snapshots */
 	
 	short widget_unit;		/* defaults to 20 for 72 DPI setting */
-	short hirestex, pad[4];
+	short anisotropic_filter;
+	short hirestex, pad8;
 
 	char versemaster[160];
 	char verseuser[160];
@@ -391,7 +392,6 @@
 	short autokey_flag;		/* flags for autokeying */
 	
 	short text_render, pad9;		/*options for text rendering*/
-	float pad10;
 
 	struct ColorBand coba_weight;	/* from texture.h */
 

Modified: branches/soc-2011-salad/source/blender/makesrna/intern/rna_userdef.c
===================================================================
--- branches/soc-2011-salad/source/blender/makesrna/intern/rna_userdef.c	2011-06-15 22:07:54 UTC (rev 37527)
+++ branches/soc-2011-salad/source/blender/makesrna/intern/rna_userdef.c	2011-06-15 22:14:53 UTC (rev 37528)
@@ -117,6 +117,12 @@
 	rna_userdef_update(bmain, scene, ptr);
 }
 
+static void rna_userdef_anisotropic_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+	GPU_set_anisotropic(U.anisotropic_filter);
+	rna_userdef_update(bmain, scene, ptr);
+}
+
 static void rna_userdef_gl_texture_limit_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
 	GPU_free_images();
@@ -2410,6 +2416,14 @@
 		{128, "CLAMP_128", 0, "128", ""},
 		{0, NULL, 0, NULL, NULL}};
 
+	static EnumPropertyItem anisotropic_items[]  ={
+		{1, "FILTER_0", 0, "Off", ""},
+		{2, "FILTER_2", 0, "2x", ""},
+		{4, "FILTER_4", 0, "4x", ""},
+		{8, "FILTER_8", 0, "8x", ""},
+		{16, "FILTER_16", 0, "16x", ""},
+		{0, NULL, 0, NULL, NULL}};
+
 	static EnumPropertyItem audio_mixing_samples_items[] = {
 		{256, "SAMPLES_256", 0, "256", "Set audio mixing buffer size to 256 samples"},
 		{512, "SAMPLES_512", 0, "512", "Set audio mixing buffer size to 512 samples"},
@@ -2637,6 +2651,13 @@
 	prop= RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflags", USER_DISABLE_AA);
 	RNA_def_property_ui_text(prop, "Anti-aliasing", "Use anti-aliasing for the 3D view (may impact redraw performance)");
+
+	prop= RNA_def_property(srna, "anisotropic_filter", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_sdna(prop, NULL, "anisotropic_filter");
+	RNA_def_property_enum_items(prop, anisotropic_items);
+	RNA_def_property_enum_default(prop, 1);
+	RNA_def_property_ui_text(prop, "Anisotropic Filter", "The quality of the anisotropic filtering (values greater than 1.0 enable anisotropic filtering)");
+	RNA_def_property_update(prop, 0, "rna_userdef_anisotropic_update");
 	
 	prop= RNA_def_property(srna, "gl_texture_limit", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "glreslimit");

Modified: branches/soc-2011-salad/source/blender/windowmanager/intern/wm_init_exit.c
===================================================================
--- branches/soc-2011-salad/source/blender/windowmanager/intern/wm_init_exit.c	2011-06-15 22:07:54 UTC (rev 37527)
+++ branches/soc-2011-salad/source/blender/windowmanager/intern/wm_init_exit.c	2011-06-15 22:14:53 UTC (rev 37528)
@@ -169,6 +169,7 @@
 	if (!G.background) {
 		GPU_extensions_init();
 		GPU_set_mipmap(!(U.gameflags & USER_DISABLE_MIPMAP));
+		GPU_set_anisotropic(U.anisotropic_filter);
 	
 		UI_init();
 	}

Modified: branches/soc-2011-salad/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
===================================================================
--- branches/soc-2011-salad/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp	2011-06-15 22:07:54 UTC (rev 37527)
+++ branches/soc-2011-salad/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp	2011-06-15 22:14:53 UTC (rev 37528)
@@ -450,6 +450,9 @@
 	U.audioformat = 0x24;
 	U.audiochannels = 2;
 
+	// XXX this one too
+	U.anisotropic_filter = 2;
+
 	sound_init_once();
 
 	/* if running blenderplayer the last argument can't be parsed since it has to be the filename. */
@@ -705,6 +708,8 @@
 		{
 			GPU_set_mipmap(0);
 		}
+
+		GPU_set_anisotropic(U.anisotropic_filter);
 		
 		// Create the system
 		if (GHOST_ISystem::createSystem() == GHOST_kSuccess)

Modified: branches/soc-2011-salad/source/gameengine/Ketsji/BL_Texture.cpp
===================================================================
--- branches/soc-2011-salad/source/gameengine/Ketsji/BL_Texture.cpp	2011-06-15 22:07:54 UTC (rev 37527)
+++ branches/soc-2011-salad/source/gameengine/Ketsji/BL_Texture.cpp	2011-06-15 22:14:53 UTC (rev 37528)
@@ -28,6 +28,7 @@
 #define spit(x) std::cout << x << std::endl;
 
 #include "MEM_guardedalloc.h"
+#include "GPU_draw.h"
 
 extern "C" {
 	// envmaps
@@ -175,6 +176,8 @@
 		glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, x, y, 0, GL_RGBA, GL_UNSIGNED_BYTE, pix );
 	}
 
+	if (GLEW_EXT_texture_filter_anisotropic)
+		glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, GPU_get_anisotropic());
 	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
 }
 
@@ -199,6 +202,9 @@
 		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 		glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, nx, ny, 0, GL_RGBA, GL_UNSIGNED_BYTE, newPixels );
 	}
+
+	if (GLEW_EXT_texture_filter_anisotropic)
+		glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, GPU_get_anisotropic());
 	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
 	free(newPixels);
 }




More information about the Bf-blender-cvs mailing list