[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47156] branches/soc-2012-swiss_cheese: Committing the VBO/Multi-UV patch from Cucumber.

Mitchell Stokes mogurijin at gmail.com
Tue May 29 09:12:12 CEST 2012


Revision: 47156
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47156
Author:   moguri
Date:     2012-05-29 07:12:12 +0000 (Tue, 29 May 2012)
Log Message:
-----------
Committing the VBO/Multi-UV patch from Cucumber. I'm putting this here since it still requires a little bit more work before going into trunk (according to Kupoman). However, I'd like to get the major Rasterizer restructuring for storage modes into this branch before people get too crazy with OpenGL refactoring. Also, I'll be making some changes to the converter soon that I hope to use the Multi-UV part of the patch to build from.

Modified Paths:
--------------
    branches/soc-2012-swiss_cheese/release/scripts/startup/bl_ui/properties_game.py
    branches/soc-2012-swiss_cheese/source/blender/makesdna/DNA_scene_types.h
    branches/soc-2012-swiss_cheese/source/blender/makesrna/intern/rna_scene.c
    branches/soc-2012-swiss_cheese/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
    branches/soc-2012-swiss_cheese/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp
    branches/soc-2012-swiss_cheese/source/gameengine/Converter/BL_BlenderDataConversion.cpp
    branches/soc-2012-swiss_cheese/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
    branches/soc-2012-swiss_cheese/source/gameengine/Ketsji/BL_Action.cpp
    branches/soc-2012-swiss_cheese/source/gameengine/Ketsji/BL_BlenderShader.cpp
    branches/soc-2012-swiss_cheese/source/gameengine/Ketsji/BL_Material.cpp
    branches/soc-2012-swiss_cheese/source/gameengine/Ketsji/BL_Material.h
    branches/soc-2012-swiss_cheese/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
    branches/soc-2012-swiss_cheese/source/gameengine/Ketsji/KX_VertexProxy.cpp
    branches/soc-2012-swiss_cheese/source/gameengine/Rasterizer/RAS_IRasterizer.h
    branches/soc-2012-swiss_cheese/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
    branches/soc-2012-swiss_cheese/source/gameengine/Rasterizer/RAS_MeshObject.cpp
    branches/soc-2012-swiss_cheese/source/gameengine/Rasterizer/RAS_MeshObject.h
    branches/soc-2012-swiss_cheese/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt
    branches/soc-2012-swiss_cheese/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp
    branches/soc-2012-swiss_cheese/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.h
    branches/soc-2012-swiss_cheese/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
    branches/soc-2012-swiss_cheese/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
    branches/soc-2012-swiss_cheese/source/gameengine/Rasterizer/RAS_TexVert.cpp
    branches/soc-2012-swiss_cheese/source/gameengine/Rasterizer/RAS_TexVert.h
    branches/soc-2012-swiss_cheese/source/gameengine/Rasterizer/RAS_texmatrix.cpp

Added Paths:
-----------
    branches/soc-2012-swiss_cheese/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_IStorage.h
    branches/soc-2012-swiss_cheese/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageIM.cpp
    branches/soc-2012-swiss_cheese/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageIM.h
    branches/soc-2012-swiss_cheese/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.cpp
    branches/soc-2012-swiss_cheese/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.h
    branches/soc-2012-swiss_cheese/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.cpp
    branches/soc-2012-swiss_cheese/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.h

Removed Paths:
-------------
    branches/soc-2012-swiss_cheese/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp
    branches/soc-2012-swiss_cheese/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.h

Modified: branches/soc-2012-swiss_cheese/release/scripts/startup/bl_ui/properties_game.py
===================================================================
--- branches/soc-2012-swiss_cheese/release/scripts/startup/bl_ui/properties_game.py	2012-05-29 07:09:11 UTC (rev 47155)
+++ branches/soc-2012-swiss_cheese/release/scripts/startup/bl_ui/properties_game.py	2012-05-29 07:12:12 UTC (rev 47156)
@@ -394,18 +394,24 @@
         layout = self.layout
 
         gs = context.scene.game_settings
+        col = layout.column()
+        row = col.row()
+        col = row.column()
+        col.prop(gs, "use_frame_rate")
+        col.prop(gs, "restrict_animation_updates")
+        col = row.column()
+        col.prop(gs, "use_display_lists")
+        col.active = gs.raster_storage != 'VERTEX_BUFFER_OBJECT'
+		
         row = layout.row()
-        row.prop(gs, "use_frame_rate")
-        row.prop(gs, "restrict_animation_updates")
-
+        row.prop(gs, "raster_storage")
+        
         row = layout.row()
-        row.prop(gs, "use_display_lists")
-
-        row = layout.row()
         row.label("Exit Key")
         row.prop(gs, "exit_key", text="", event=True)
 
 
+
 class RENDER_PT_game_display(RenderButtonsPanel, Panel):
     bl_label = "Display"
     COMPAT_ENGINES = {'BLENDER_GAME'}

Modified: branches/soc-2012-swiss_cheese/source/blender/makesdna/DNA_scene_types.h
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/makesdna/DNA_scene_types.h	2012-05-29 07:09:11 UTC (rev 47155)
+++ branches/soc-2012-swiss_cheese/source/blender/makesdna/DNA_scene_types.h	2012-05-29 07:12:12 UTC (rev 47156)
@@ -624,7 +624,10 @@
 	short exitkey, pad;
 	short ticrate, maxlogicstep, physubstep, maxphystep;
 	short obstacleSimulation, pad1;
+	short raster_storage;
+	short pad3;
 	float levelHeight;
+	float pad2;
 } GameData;
 
 #define STEREO_NOSTEREO		1
@@ -649,6 +652,12 @@
 #define OBSTSIMULATION_TOI_rays		1
 #define OBSTSIMULATION_TOI_cells	2
 
+/* Raster storage */
+#define RAS_STORE_AUTO		0
+#define RAS_STORE_IMMEDIATE	1
+#define RAS_STORE_VA		2
+#define RAS_STORE_VBO		3
+
 /* GameData.flag */
 #define GAME_RESTRICT_ANIM_UPDATES			(1 << 0)
 #define GAME_ENABLE_ALL_FRAMES				(1 << 1)

Modified: branches/soc-2012-swiss_cheese/source/blender/makesrna/intern/rna_scene.c
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/makesrna/intern/rna_scene.c	2012-05-29 07:09:11 UTC (rev 47155)
+++ branches/soc-2012-swiss_cheese/source/blender/makesrna/intern/rna_scene.c	2012-05-29 07:12:12 UTC (rev 47156)
@@ -2395,6 +2395,13 @@
 		{0, NULL, 0, NULL, NULL}
 	};
 
+	static EnumPropertyItem storage_items[] ={
+		{RAS_STORE_AUTO, "AUTO", 0, "Auto Select", "Chooses the best supported mode"},
+		{RAS_STORE_IMMEDIATE, "IMMEDIATE", 0, "Immediate Mode", "Slowest performance, requires OpenGL (any version)"},
+		{RAS_STORE_VA, "VERTEX_ARRAY", 0, "Vertex Arrays", "Moderate performance, requires at least OpenGL 1.1"},
+		{RAS_STORE_VBO, "VERTEX_BUFFER_OBJECT", 0, "Vertex Buffer Objects", "Best performance, requires at least OpenGL 1.4"},
+		{0, NULL, 0, NULL, NULL}};
+
 	srna = RNA_def_struct(brna, "SceneGameData", NULL);
 	RNA_def_struct_sdna(srna, "GameData");
 	RNA_def_struct_nested(brna, srna, "Scene");
@@ -2430,6 +2437,12 @@
 	RNA_def_property_ui_text(prop, "Exit Key",  "The key that exits the Game Engine");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 	
+	prop= RNA_def_property(srna, "raster_storage", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_sdna(prop, NULL, "raster_storage");
+	RNA_def_property_enum_items(prop, storage_items);
+	RNA_def_property_ui_text(prop, "Storage",  "Sets the storage mode used by the rasterizer");
+	RNA_def_property_update(prop, NC_SCENE, NULL);
+	
 	/* Do we need it here ? (since we already have it in World */
 	prop = RNA_def_property(srna, "frequency", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "freqplay");

Modified: branches/soc-2012-swiss_cheese/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
===================================================================
--- branches/soc-2012-swiss_cheese/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp	2012-05-29 07:09:11 UTC (rev 47155)
+++ branches/soc-2012-swiss_cheese/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp	2012-05-29 07:12:12 UTC (rev 47156)
@@ -58,7 +58,6 @@
 
 #include "RAS_GLExtensionManager.h"
 #include "RAS_OpenGLRasterizer.h"
-#include "RAS_VAOpenGLRasterizer.h"
 #include "RAS_ListRasterizer.h"
 
 #include "NG_LoopBackNetworkDeviceInterface.h"
@@ -130,7 +129,7 @@
 	return bfd;
 }
 
-int BL_KetsjiNextFrame(struct KX_KetsjiEngine* ketsjiengine, struct bContext *C, struct wmWindow* win, struct Scene* scene, struct ARegion *ar,
+int BL_KetsjiNextFrame(class KX_KetsjiEngine* ketsjiengine, struct bContext *C, struct wmWindow* win, struct Scene* scene, struct ARegion *ar,
                     KX_BlenderKeyboardDevice* keyboarddevice, KX_BlenderMouseDevice* mousedevice, int draw_letterbox)
 {
     int exitrequested;
@@ -298,16 +297,12 @@
 		RAS_IRenderTools* rendertools = new KX_BlenderRenderTools();
 		RAS_IRasterizer* rasterizer = NULL;
 		
-		if (displaylists) {
-			if (GLEW_VERSION_1_1 && !novertexarrays)
-				rasterizer = new RAS_ListRasterizer(canvas, true, true);
-			else
-				rasterizer = new RAS_ListRasterizer(canvas);
-		}
-		else if (GLEW_VERSION_1_1 && !novertexarrays)
-			rasterizer = new RAS_VAOpenGLRasterizer(canvas, false);
+		//Don't use displaylists with VBOs
+		//If auto starts using VBOs, make sure to check for that here
+		if (displaylists && startscene->gm.raster_storage != RAS_STORE_VBO)
+			rasterizer = new RAS_ListRasterizer(canvas, true, startscene->gm.raster_storage);
 		else
-			rasterizer = new RAS_OpenGLRasterizer(canvas);
+			rasterizer = new RAS_OpenGLRasterizer(canvas, startscene->gm.raster_storage);
 		
 		// create the inputdevices
 		KX_BlenderKeyboardDevice* keyboarddevice = new KX_BlenderKeyboardDevice();

Modified: branches/soc-2012-swiss_cheese/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp
===================================================================
--- branches/soc-2012-swiss_cheese/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp	2012-05-29 07:09:11 UTC (rev 47155)
+++ branches/soc-2012-swiss_cheese/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp	2012-05-29 07:12:12 UTC (rev 47156)
@@ -50,6 +50,7 @@
 #include "STR_String.h"
 
 #include "GPU_draw.h"
+#include "GPU_utility.h"
 
 #include "KX_BlenderGL.h" // for text printing
 #include "KX_BlenderRenderTools.h"
@@ -297,6 +298,7 @@
 										 int width,
 										 int height)
 {
+	GPU_STRING_MARKER("RenderText2D");
 	if (mode == RAS_IRenderTools::RAS_TEXT_PADDED)
 		BL_print_gamedebug_line_padded(text, xco, yco, width, height);
 	else

Modified: branches/soc-2012-swiss_cheese/source/gameengine/Converter/BL_BlenderDataConversion.cpp
===================================================================
--- branches/soc-2012-swiss_cheese/source/gameengine/Converter/BL_BlenderDataConversion.cpp	2012-05-29 07:09:11 UTC (rev 47155)
+++ branches/soc-2012-swiss_cheese/source/gameengine/Converter/BL_BlenderDataConversion.cpp	2012-05-29 07:12:12 UTC (rev 47156)
@@ -777,33 +777,27 @@
 		// No material - old default TexFace properties
 		material->ras_mode |= USE_LIGHT;
 	}
-	MT_Point2 uv[4];
-	MT_Point2 uv2[4];
-	const char *uvName = "", *uv2Name = "";
 
-	
-	uv2[0]= uv2[1]= uv2[2]= uv2[3]= MT_Point2(0.0f, 0.0f);
+	MT_Point2 uvs[4][MAXTEX];
 
 	/* No material, what to do? let's see what is in the UV and set the material accordingly
 	 * light and visible is always on */
 	if ( validface ) {
 		material->tile	= tface->tile;
 			
-		uv[0].setValue(tface->uv[0]);
-		uv[1].setValue(tface->uv[1]);
-		uv[2].setValue(tface->uv[2]);
+		uvs[0][0].setValue(tface->uv[0]);
+		uvs[1][0].setValue(tface->uv[1]);
+		uvs[2][0].setValue(tface->uv[2]);
 
 		if (mface->v4) 
-			uv[3].setValue(tface->uv[3]);
-
-		uvName = tfaceName;
+			uvs[3][0].setValue(tface->uv[3]);
 	} 
 	else {
 		// nothing at all
 		material->alphablend	= GEMAT_SOLID;
 		material->tile		= 0;
 		
-		uv[0]= uv[1]= uv[2]= uv[3]= MT_Point2(0.0f, 0.0f);
+		uvs[0][0]= uvs[1][0]= uvs[2][0]= uvs[3][0]= MT_Point2(0.0f, 0.0f);
 	}
 
 	if (validmat && validface) {
@@ -823,51 +817,43 @@
 	// get uv sets
 	if (validmat) 
 	{
-		bool isFirstSet = true;
-
-		// only two sets implemented, but any of the eight 
-		// sets can make up the two layers
 		for (int vind = 0; vind<material->num_enabled; vind++)
 		{
 			BL_Mapping &map = material->mapping[vind];
 
-			if (map.uvCoName.IsEmpty())
-				isFirstSet = false;
-			else
+			//If no UVSet is specified, try grabbing one from the UV/Image editor
+			if (map.uvCoName.IsEmpty() && validface)
+			{			
+				uvs[0][vind].setValue(tface->uv[0]);
+				uvs[1][vind].setValue(tface->uv[1]);
+				uvs[2][vind].setValue(tface->uv[2]);
+
+				if (mface->v4) 
+					uvs[3][vind].setValue(tface->uv[3]);
+
+				continue;
+			}
+
+
+			for (int lay=0; lay<MAX_MTFACE; lay++)
 			{
-				for (int lay=0; lay<MAX_MTFACE; lay++)
+				MTF_localLayer& layer = layers[lay];
+				if (layer.face == 0) break;
+
+				if (map.uvCoName.IsEmpty() || strcmp(map.uvCoName.ReadPtr(), layer.name)==0)
 				{
-					MTF_localLayer& layer = layers[lay];
-					if (layer.face == 0) break;
+					MT_Point2 uvSet[4];
 
-					if (strcmp(map.uvCoName.ReadPtr(), layer.name)==0)
-					{
-						MT_Point2 uvSet[4];
+					uvs[0][vind].setValue(layer.face->uv[0]);
+					uvs[1][vind].setValue(layer.face->uv[1]);
+					uvs[2][vind].setValue(layer.face->uv[2]);
 
-						uvSet[0].setValue(layer.face->uv[0]);
-						uvSet[1].setValue(layer.face->uv[1]);
-						uvSet[2].setValue(layer.face->uv[2]);
+					if (mface->v4) 
+						uvs[3][vind].setValue(layer.face->uv[3]);
+					else
+						uvs[3][vind].setValue(0.0f, 0.0f);
 
-						if (mface->v4) 
-							uvSet[3].setValue(layer.face->uv[3]);
-						else
-							uvSet[3].setValue(0.0f, 0.0f);
-
-						if (isFirstSet)
-						{
-							uv[0] = uvSet[0]; uv[1] = uvSet[1];
-							uv[2] = uvSet[2]; uv[3] = uvSet[3];
-							isFirstSet = false;
-							uvName = layer.name;
-						}
-						else if (strcmp(layer.name, uvName) != 0)
-						{
-							uv2[0] = uvSet[0]; uv2[1] = uvSet[1];
-							uv2[2] = uvSet[2]; uv2[3] = uvSet[3];
-							map.mapping |= USECUSTOMUV;
-							uv2Name = layer.name;
-						}
-					}

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list