[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22155] branches/blender2.5/blender/source /blender/editors/space_view3d/drawobject.c: Smoke: 2 preview fixes

Daniel Genrich daniel.genrich at gmx.net
Sun Aug 2 21:40:25 CEST 2009


Revision: 22155
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22155
Author:   genscher
Date:     2009-08-02 21:40:25 +0200 (Sun, 02 Aug 2009)

Log Message:
-----------
Smoke: 2 preview fixes
a) take first position lamp into accountn for smoke ligthning (still no realtime shading when you move the lamp - you have to simulate another frame for now)
b) fix front/back "looking throurgh" issue by reordering the billboards

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/space_view3d/drawobject.c

Modified: branches/blender2.5/blender/source/blender/editors/space_view3d/drawobject.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_view3d/drawobject.c	2009-08-02 19:39:33 UTC (rev 22154)
+++ branches/blender2.5/blender/source/blender/editors/space_view3d/drawobject.c	2009-08-02 19:40:25 UTC (rev 22155)
@@ -5344,7 +5344,7 @@
 			int x, y, z, i;
 			float viewnormal[3];
 			int mainaxis[3] = {0,0,0};
-			float align = 0;
+			float align = 0, signed_align = 0;
 			int max_textures = 0, counter_textures = 0;
 			float *buffer = NULL;
 			int res[3];
@@ -5386,6 +5386,7 @@
 				{
 					mainaxis[0] = i;
 					align = ABS(viewnormal[i]);
+					signed_align = viewnormal[i];
 				}
 			}
 			mainaxis[1] = (mainaxis[0] + 1) % 3;
@@ -5438,8 +5439,23 @@
 			
 			if(new > 1)
 			{
-				float light[3] = {0.0,0.0,2.0};
-				
+				float light[3] = {0.0,0.0,2.0}; // TODO: take real LAMP coordinates - dg
+				Base *base_tmp = NULL;
+
+				for(base_tmp = scene->base.first; base_tmp; base_tmp= base_tmp->next) 
+				{
+					if(base_tmp->object->type == OB_LAMP) 
+					{
+						Lamp *la = (Lamp *)base_tmp->object->data;
+						
+						if(la->type == LA_LOCAL)
+						{
+							VECCOPY(light, base_tmp->object->obmat[3]);
+							break;
+						}
+					}
+				}
+
 				if(!big && !(smd->domain->viewsettings & MOD_SMOKE_VIEW_SMALL))
 				{
 					smoke_prepare_View(smd, light);
@@ -5486,8 +5502,18 @@
 
 				mod_texture = MAX3(1, smd->domain->visibility, (int)(res[mainaxis[0]] / smd->domain->max_textures ));
 				
-				for (z = 0; z < res[mainaxis[0]]; z++) // 2
+				// align order of billboards to be front or backview (e.g. +x or -x axis)
+				if(signed_align < 0)
 				{
+					z = res[mainaxis[0]] - 1;
+				}
+				else
+				{
+					z = 0;
+				}
+
+				for (; signed_align > 0 ? (z < res[mainaxis[0]]) : (z >= 0); signed_align > 0 ? z++ : z--) // 2
+				{
 					float quad[4][3];
 
 					if(new)





More information about the Bf-blender-cvs mailing list