[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15868] branches/apricot/source: Apricot Branch

Brecht Van Lommel brechtvanlommel at pandora.be
Tue Jul 29 18:25:20 CEST 2008


Revision: 15868
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15868
Author:   blendix
Date:     2008-07-29 18:25:20 +0200 (Tue, 29 Jul 2008)

Log Message:
-----------
Apricot Branch
==============

svn merge -r15866:HEAD https://svn.blender.org/svnroot/bf-blender/trunk/blender

Alpha blending and sorting changes, but also include some initial
support for GLSL lamps in dupligroups (only one duplicate works at
the moment).

Modified Paths:
--------------
    branches/apricot/source/blender/blenkernel/BKE_blender.h
    branches/apricot/source/blender/blenloader/intern/readfile.c
    branches/apricot/source/blender/gpu/intern/gpu_material.c
    branches/apricot/source/blender/gpu/intern/gpu_shader_material.glsl
    branches/apricot/source/blender/gpu/intern/gpu_shader_material.glsl.c
    branches/apricot/source/blender/makesdna/DNA_meshdata_types.h
    branches/apricot/source/blender/src/buttons_editing.c
    branches/apricot/source/blender/src/drawview.c
    branches/apricot/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp
    branches/apricot/source/gameengine/Converter/BL_BlenderDataConversion.cpp
    branches/apricot/source/gameengine/Ketsji/BL_BlenderShader.cpp
    branches/apricot/source/gameengine/Ketsji/BL_Material.h
    branches/apricot/source/gameengine/Ketsji/BL_Texture.cpp
    branches/apricot/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
    branches/apricot/source/gameengine/Ketsji/KX_BlenderMaterial.h
    branches/apricot/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
    branches/apricot/source/gameengine/Ketsji/KX_PolygonMaterial.cpp
    branches/apricot/source/gameengine/Ketsji/KX_PolygonMaterial.h
    branches/apricot/source/gameengine/Ketsji/KX_Scene.cpp
    branches/apricot/source/gameengine/Rasterizer/RAS_BucketManager.cpp
    branches/apricot/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp
    branches/apricot/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h
    branches/apricot/source/gameengine/Rasterizer/RAS_IRasterizer.h
    branches/apricot/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
    branches/apricot/source/gameengine/Rasterizer/RAS_MaterialBucket.h
    branches/apricot/source/gameengine/Rasterizer/RAS_MeshObject.cpp
    branches/apricot/source/gameengine/Rasterizer/RAS_MeshObject.h
    branches/apricot/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
    branches/apricot/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
    branches/apricot/source/gameengine/Rasterizer/RAS_Polygon.cpp

Removed Paths:
-------------
    branches/apricot/source/gameengine/BlenderRoutines/KX_BlenderPolyMaterial.cpp
    branches/apricot/source/gameengine/BlenderRoutines/KX_BlenderPolyMaterial.h

Modified: branches/apricot/source/blender/blenkernel/BKE_blender.h
===================================================================
--- branches/apricot/source/blender/blenkernel/BKE_blender.h	2008-07-29 15:48:31 UTC (rev 15867)
+++ branches/apricot/source/blender/blenkernel/BKE_blender.h	2008-07-29 16:25:20 UTC (rev 15868)
@@ -41,7 +41,7 @@
 struct MemFile;
 
 #define BLENDER_VERSION			246
-#define BLENDER_SUBVERSION		0
+#define BLENDER_SUBVERSION		1
 
 #define BLENDER_MINVERSION		245
 #define BLENDER_MINSUBVERSION	15

Modified: branches/apricot/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/apricot/source/blender/blenloader/intern/readfile.c	2008-07-29 15:48:31 UTC (rev 15867)
+++ branches/apricot/source/blender/blenloader/intern/readfile.c	2008-07-29 16:25:20 UTC (rev 15868)
@@ -4899,6 +4899,49 @@
 	}
 }
 
+void alphasort_version_246(FileData *fd, Library *lib, Mesh *me)
+{
+	Material *ma;
+	MFace *mf;
+	MTFace *tf;
+	int a, b, texalpha;
+
+	/* verify we have a tface layer */
+	for(b=0; b<me->fdata.totlayer; b++)
+		if(me->fdata.layers[b].type == CD_MTFACE)
+			break;
+	
+	if(b == me->fdata.totlayer)
+		return;
+
+	/* if we do, set alpha sort if the game engine did it before */
+	for(a=0, mf=me->mface; a<me->totface; a++, mf++) {
+		if(mf->mat_nr < me->totcol) {
+			ma= newlibadr(fd, lib, me->mat[mf->mat_nr]);
+			texalpha = 0;
+
+			for(b=0; ma && b<MAX_MTEX; b++)
+				if(ma->mtex && ma->mtex[b] && ma->mtex[b]->mapto & MAP_ALPHA)
+					texalpha = 1;
+		}
+		else {
+			ma= NULL;
+			texalpha = 0;
+		}
+
+		for(b=0; b<me->fdata.totlayer; b++) {
+			if(me->fdata.layers[b].type == CD_MTFACE) {
+				tf = ((MTFace*)me->fdata.layers[b].data) + a;
+
+				tf->mode &= ~TF_ALPHASORT;
+				if(ma && (ma->mode & MA_ZTRA))
+					if(ELEM(tf->transp, TF_ALPHA, TF_ADD) || (texalpha && (tf->transp != TF_CLIP)))
+						tf->mode |= TF_ALPHASORT;
+			}
+		}
+	}
+}
+
 static void do_versions(FileData *fd, Library *lib, Main *main)
 {
 	/* WATCH IT!!!: pointers from libdata have not been converted */
@@ -7743,8 +7786,9 @@
 	}
 
 	/* sun/sky */
-	if ((main->versionfile < 246) ){
+	if(main->versionfile < 246) {
 		Lamp *la;
+
 		for(la=main->lamp.first; la; la= la->id.next) {
 			la->sun_effect_type = 0;
 			la->horizon_brightness = 1.0;
@@ -7760,6 +7804,13 @@
 		}
 	}
 
+	if(main->versionfile <= 246 && main->subversionfile < 1){
+		Mesh *me;
+
+		for(me=main->mesh.first; me; me= me->id.next)
+			alphasort_version_246(fd, lib, me);
+	}
+
 	/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
 	/* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */
 

Modified: branches/apricot/source/blender/gpu/intern/gpu_material.c
===================================================================
--- branches/apricot/source/blender/gpu/intern/gpu_material.c	2008-07-29 15:48:31 UTC (rev 15867)
+++ branches/apricot/source/blender/gpu/intern/gpu_material.c	2008-07-29 16:25:20 UTC (rev 15868)
@@ -44,6 +44,7 @@
 #include "DNA_view3d_types.h"
 #include "DNA_world_types.h"
 
+#include "BKE_anim.h"
 #include "BKE_colortools.h"
 #include "BKE_DerivedMesh.h"
 #include "BKE_global.h"
@@ -686,6 +687,25 @@
 			if(ob->gpulamp)
 				shade_one_light(shi, shr, ob->gpulamp);
 		}
+
+		if (ob->transflag & OB_DUPLI) {
+			DupliObject *dob;
+			ListBase *lb = object_duplilist(G.scene, ob);
+			
+			for(dob=lb->first; dob; dob=dob->next) {
+				Object *ob = dob->ob;
+				
+				if(ob->type==OB_LAMP) {
+					Mat4CpyMat4(ob->obmat, dob->mat);
+
+					GPU_lamp_from_blender(ob, ob->data);
+					if(ob->gpulamp)
+						shade_one_light(shi, shr, ob->gpulamp);
+				}
+			}
+			
+			free_object_duplilist(lb);
+		}
 	}
 }
 
@@ -1010,7 +1030,7 @@
 	GPUNodeLink *emit, *ulinfac, *ulogfac, *mistfac;
 	Material *ma= shi->mat;
 	World *world= mat->scene->world;
-	float linfac, logfac, misttype;
+	float linfac, logfac, misttype, one = 1.0f;
 
 	memset(shr, 0, sizeof(*shr));
 
@@ -1086,6 +1106,14 @@
 			shr->combined, &shr->combined);
 	}
 
+	if(!(ma->mode & MA_ZTRA)) {
+		if(world && (GPU_link_changed(shr->alpha) || ma->alpha != 1.0f))
+			GPU_link(mat, "shade_world_mix", shr->alpha, GPU_uniform(&world->horr),
+				shr->combined, &shr->combined);
+
+		GPU_link(mat, "set_value", GPU_uniform(&one), &shr->alpha);
+	}
+
 	GPU_link(mat, "mtex_alpha_to_col", shr->combined, shr->alpha, &shr->combined);
 
 	if(ma->shade_flag & MA_OBCOLOR) {

Modified: branches/apricot/source/blender/gpu/intern/gpu_shader_material.glsl
===================================================================
--- branches/apricot/source/blender/gpu/intern/gpu_shader_material.glsl	2008-07-29 15:48:31 UTC (rev 15867)
+++ branches/apricot/source/blender/gpu/intern/gpu_shader_material.glsl	2008-07-29 16:25:20 UTC (rev 15868)
@@ -1525,3 +1525,9 @@
 	outfac = (1.0-fac)*(1.0-misi);
 }
 
+void shade_world_mix(float fac, vec3 hor, vec4 col, out vec4 outcol)
+{
+	fac = clamp(fac, 0.0, 1.0);
+	outcol = vec4(mix(hor, col.rgb, fac), col.a);
+}
+

Modified: branches/apricot/source/blender/gpu/intern/gpu_shader_material.glsl.c
===================================================================
--- branches/apricot/source/blender/gpu/intern/gpu_shader_material.glsl.c	2008-07-29 15:48:31 UTC (rev 15867)
+++ branches/apricot/source/blender/gpu/intern/gpu_shader_material.glsl.c	2008-07-29 16:25:20 UTC (rev 15868)
@@ -1,311 +1,339 @@
 /* DataToC output of file <gpu_shader_material_glsl> */
 
-int datatoc_gpu_shader_material_glsl_size= 32252;
+int datatoc_gpu_shader_material_glsl_size= 32402;
 char datatoc_gpu_shader_material_glsl[]= {
- 10,102,108,111, 97,116, 32,101,120,112, 95, 98,108,101,110,100,101,114, 40,102,108,111, 97,116, 32,102, 41, 10,
-123, 10,  9,114,101,116,117,114,110, 32,112,111,119, 40, 50, 46, 55, 49, 56, 50, 56, 49, 56, 50, 56, 52, 54, 44, 32,102, 41, 59,
- 10,125, 10, 10,118,111,105,100, 32,114,103, 98, 95,116,111, 95,104,115,118, 40,118,101, 99, 52, 32,114,103, 98, 44, 32,111,117,
-116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,102,108,111, 97,116, 32, 99,109, 97,120, 44, 32, 99,109,
-105,110, 44, 32,104, 44, 32,115, 44, 32,118, 44, 32, 99,100,101,108,116, 97, 59, 10,  9,118,101, 99, 51, 32, 99, 59, 10, 10,  9,
- 99,109, 97,120, 32, 61, 32,109, 97,120, 40,114,103, 98, 91, 48, 93, 44, 32,109, 97,120, 40,114,103, 98, 91, 49, 93, 44, 32,114,
-103, 98, 91, 50, 93, 41, 41, 59, 10,  9, 99,109,105,110, 32, 61, 32,109,105,110, 40,114,103, 98, 91, 48, 93, 44, 32,109,105,110,
- 40,114,103, 98, 91, 49, 93, 44, 32,114,103, 98, 91, 50, 93, 41, 41, 59, 10,  9, 99,100,101,108,116, 97, 32, 61, 32, 99,109, 97,
-120, 45, 99,109,105,110, 59, 10, 10,  9,118, 32, 61, 32, 99,109, 97,120, 59, 10,  9,105,102, 32, 40, 99,109, 97,120, 33, 61, 48,
- 46, 48, 41, 10,  9,  9,115, 32, 61, 32, 99,100,101,108,116, 97, 47, 99,109, 97,120, 59, 10,  9,101,108,115,101, 32,123, 10,  9,
-  9,115, 32, 61, 32, 48, 46, 48, 59, 10,  9,  9,104, 32, 61, 32, 48, 46, 48, 59, 10,  9,125, 10, 10,  9,105,102, 32, 40,115, 32,
- 61, 61, 32, 48, 46, 48, 41, 32,123, 10,  9,  9,104, 32, 61, 32, 48, 46, 48, 59, 10,  9,125, 10,  9,101,108,115,101, 32,123, 10,
-  9,  9, 99, 32, 61, 32, 40,118,101, 99, 51, 40, 99,109, 97,120, 44, 32, 99,109, 97,120, 44, 32, 99,109, 97,120, 41, 32, 45, 32,
-114,103, 98, 46,120,121,122, 41, 47, 99,100,101,108,116, 97, 59, 10, 10,  9,  9,105,102, 32, 40,114,103, 98, 46,120, 61, 61, 99,
-109, 97,120, 41, 32,104, 32, 61, 32, 99, 91, 50, 93, 32, 45, 32, 99, 91, 49, 93, 59, 10,  9,  9,101,108,115,101, 32,105,102, 32,
- 40,114,103, 98, 46,121, 61, 61, 99,109, 97,120, 41, 32,104, 32, 61, 32, 50, 46, 48, 32, 43, 32, 99, 91, 48, 93, 32, 45, 32, 32,
- 99, 91, 50, 93, 59, 10,  9,  9,101,108,115,101, 32,104, 32, 61, 32, 52, 46, 48, 32, 43, 32, 99, 91, 49, 93, 32, 45, 32, 99, 91,
- 48, 93, 59, 10, 10,  9,  9,104, 32, 47, 61, 32, 54, 46, 48, 59, 10, 10,  9,  9,105,102, 32, 40,104, 60, 48, 46, 48, 41, 10,  9,
-  9,  9,104, 32, 43, 61, 32, 49, 46, 48, 59, 10,  9,125, 10, 10,  9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40,104,
- 44, 32,115, 44, 32,118, 44, 32,114,103, 98, 46,119, 41, 59, 10,125, 10, 10,118,111,105,100, 32,104,115,118, 95,116,111, 95,114,
-103, 98, 40,118,101, 99, 52, 32,104,115,118, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,
-  9,102,108,111, 97,116, 32,105, 44, 32,102, 44, 32,112, 44, 32,113, 44, 32,116, 44, 32,104, 44, 32,115, 44, 32,118, 59, 10,  9,
-118,101, 99, 51, 32,114,103, 98, 59, 10, 10,  9,104, 32, 61, 32,104,115,118, 91, 48, 93, 59, 10,  9,115, 32, 61, 32,104,115,118,
- 91, 49, 93, 59, 10,  9,118, 32, 61, 32,104,115,118, 91, 50, 93, 59, 10, 10,  9,105,102, 40,115, 61, 61, 48, 46, 48, 41, 32,123,
- 10,  9,  9,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32,118, 44, 32,118, 41, 59, 10,  9,125, 10,  9,101,108,115,101,
- 32,123, 10,  9,  9,105,102, 40,104, 61, 61, 49, 46, 48, 41, 10,  9,  9,  9,104, 32, 61, 32, 48, 46, 48, 59, 10,  9,  9, 10,  9,
-  9,104, 32, 42, 61, 32, 54, 46, 48, 59, 10,  9,  9,105, 32, 61, 32,102,108,111,111,114, 40,104, 41, 59, 10,  9,  9,102, 32, 61,
- 32,104, 32, 45, 32,105, 59, 10,  9,  9,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,102, 44, 32,102, 44, 32,102, 41, 59, 10,  9,
-  9,112, 32, 61, 32,118, 42, 40, 49, 46, 48, 45,115, 41, 59, 10,  9,  9,113, 32, 61, 32,118, 42, 40, 49, 46, 48, 45, 40,115, 42,
-102, 41, 41, 59, 10,  9,  9,116, 32, 61, 32,118, 42, 40, 49, 46, 48, 45, 40,115, 42, 40, 49, 46, 48, 45,102, 41, 41, 41, 59, 10,
-  9,  9, 10,  9,  9,105,102, 32, 40,105, 32, 61, 61, 32, 48, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44,
- 32,116, 44, 32,112, 41, 59, 10,  9,  9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 49, 46, 48, 41, 32,114,103, 98,
- 32, 61, 32,118,101, 99, 51, 40,113, 44, 32,118, 44, 32,112, 41, 59, 10,  9,  9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61,
- 61, 32, 50, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,112, 44, 32,118, 44, 32,116, 41, 59, 10,  9,  9,101,108,
-115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 51, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,112, 44, 32,113,
- 44, 32,118, 41, 59, 10,  9,  9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 52, 46, 48, 41, 32,114,103, 98, 32, 61,
- 32,118,101, 99, 51, 40,116, 44, 32,112, 44, 32,118, 41, 59, 10,  9,  9,101,108,115,101, 32,114,103, 98, 32, 61, 32,118,101, 99,

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list