[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13585] trunk/blender/source/blender: Reverting some other changes zaghaghi made

Joshua Leung aligorith at gmail.com
Tue Feb 5 22:09:39 CET 2008


Revision: 13585
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13585
Author:   aligorith
Date:     2008-02-05 22:09:38 +0100 (Tue, 05 Feb 2008)

Log Message:
-----------
Reverting some other changes zaghaghi made

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/BLI_arithb.h
    trunk/blender/source/blender/blenlib/intern/arithb.c
    trunk/blender/source/blender/makesdna/DNA_lamp_types.h
    trunk/blender/source/blender/render/intern/include/pixelshading.h
    trunk/blender/source/blender/render/intern/include/render_types.h
    trunk/blender/source/blender/render/intern/source/convertblender.c
    trunk/blender/source/blender/render/intern/source/pixelshading.c
    trunk/blender/source/blender/render/intern/source/rendercore.c
    trunk/blender/source/blender/src/buttons_shading.c

Modified: trunk/blender/source/blender/blenlib/BLI_arithb.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_arithb.h	2008-02-05 21:02:16 UTC (rev 13584)
+++ trunk/blender/source/blender/blenlib/BLI_arithb.h	2008-02-05 21:09:38 UTC (rev 13585)
@@ -319,9 +319,6 @@
 void ycc_to_rgb(float y, float cb, float cr, float *lr, float *lg, float *lb);
 void rgb_to_ycc(float r, float g, float b, float *ly, float *lcb, float *lcr);
 void rgb_to_hsv(float r, float g, float b, float *lh, float *ls, float *lv);
-void xyz_to_rgb(float x, float y, float z, float *r, float *g, float *b);
-int constrain_rgb(float *r, float *g, float *b);
-void gamma_correct_rgb(float *r, float *g, float *b);
 unsigned int hsv_to_cpack(float h, float s, float v);
 unsigned int rgb_to_cpack(float r, float g, float b);
 void cpack_to_rgb(unsigned int col, float *r, float *g, float *b);

Modified: trunk/blender/source/blender/blenlib/intern/arithb.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/arithb.c	2008-02-05 21:02:16 UTC (rev 13584)
+++ trunk/blender/source/blender/blenlib/intern/arithb.c	2008-02-05 21:09:38 UTC (rev 13585)
@@ -3354,67 +3354,7 @@
 	*lv = v;
 }
 
-/*http://brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
- * SMPTE-C XYZ to RGB matrix*/
-void xyz_to_rgb(float xc, float yc, float zc, float *r, float *g, float *b)
-{
-	*r = (3.50570	* xc) + (-1.73964	* yc) + (-0.544011	* zc);
-	*g = (-1.06906	* xc) + (1.97781	* yc) + (0.0351720	* zc);
-	*b = (0.0563117	* xc) + (-0.196994	* yc) + (1.05005	* zc);
-}
 
-/*If the requested RGB shade contains a negative weight for
-  one of the primaries, it lies outside the colour gamut 
-  accessible from the given triple of primaries.  Desaturate
-  it by adding white, equal quantities of R, G, and B, enough
-  to make RGB all positive.  The function returns 1 if the
-  components were modified, zero otherwise.*/
-int constrain_rgb(float *r, float *g, float *b)
-{
-	float w;
-
-    /* Amount of white needed is w = - min(0, *r, *g, *b) */
-    
-    w = (0 < *r) ? 0 : *r;
-    w = (w < *g) ? w : *g;
-    w = (w < *b) ? w : *b;
-    w = -w;
-
-    /* Add just enough white to make r, g, b all positive. */
-    
-    if (w > 0) {
-        *r += w;  *g += w; *b += w;
-        return 1;                     /* Colour modified to fit RGB gamut */
-    }
-
-    return 0;                         /* Colour within RGB gamut */
-}
-
-/*Transform linear RGB values to nonlinear RGB values. Rec.
-  709 is ITU-R Recommendation BT. 709 (1990) ``Basic
-  Parameter Values for the HDTV Standard for the Studio and
-  for International Programme Exchange'', formerly CCIR Rec.
-  709.*/
-void gamma_correct(float *c)
-{
-	/* Rec. 709 gamma correction. */
-	float cc = 0.018;
-	
-	if (*c < cc) {
-	    *c *= ((1.099 * pow(cc, 0.45)) - 0.099) / cc;
-	} else {
-	    *c = (1.099 * pow(*c, 0.45)) - 0.099;
-	}
-}
-
-void gamma_correct_rgb(float *r, float *g, float *b)
-{
-    gamma_correct(r);
-    gamma_correct(g);
-    gamma_correct(b);
-}
-
-
 /* we define a 'cpack' here as a (3 byte color code) number that can be expressed like 0xFFAA66 or so.
    for that reason it is sensitive for endianness... with this function it works correctly
 */

Modified: trunk/blender/source/blender/makesdna/DNA_lamp_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_lamp_types.h	2008-02-05 21:02:16 UTC (rev 13584)
+++ trunk/blender/source/blender/makesdna/DNA_lamp_types.h	2008-02-05 21:09:38 UTC (rev 13585)
@@ -79,20 +79,6 @@
 	/* texact is for buttons */
 	short texact, shadhalostep;
 	
-	/* atmosphere */
-	short sun_effect_type;
-	short atm_pad[3];
-    float horizon_brightness;
-    float spread;
-    float sun_brightness;
-    float sun_size;
-    float backscattered_light;
-	float atm_turbidity;
-    float atm_inscattering_factor;
-    float atm_extinction_factor;
-    float atm_distance_factor;
-    float atm_distance_over_sky;
-    
 	/* yafray: photonlight params */
 	int YF_numphotons, YF_numsearch;
 	short YF_phdepth, YF_useqmc, YF_bufsize, YF_pad;
@@ -140,11 +126,6 @@
 /* Since it is used with LOCAL lamp, can't use LA_SHAD */
 #define LA_YF_SOFT		16384
 
-/* sun effect type*/
-#define LA_SUN_EFFECT_SKY			1
-#define LA_SUN_EFFECT_AP			2
-#define LA_SUN_EFFECT_AP_OVER_SKY	4
-
 /* falloff_type */
 #define LA_FALLOFF_CONSTANT		0
 #define LA_FALLOFF_INVLINEAR		1

Modified: trunk/blender/source/blender/render/intern/include/pixelshading.h
===================================================================
--- trunk/blender/source/blender/render/intern/include/pixelshading.h	2008-02-05 21:02:16 UTC (rev 13584)
+++ trunk/blender/source/blender/render/intern/include/pixelshading.h	2008-02-05 21:09:38 UTC (rev 13585)
@@ -55,7 +55,6 @@
  */
 void shadeSkyPixel(float *collector, float fx, float fy);
 void shadeSkyView(float *colf, float *rco, float *view, float *dxyview);
-void shadeAtmPixel(struct SunSky *sunsky, float *collector, float fx, float fy, float intensity, float distance);
 
 /* ------------------------------------------------------------------------- */
 

Modified: trunk/blender/source/blender/render/intern/include/render_types.h
===================================================================
--- trunk/blender/source/blender/render/intern/include/render_types.h	2008-02-05 21:02:16 UTC (rev 13584)
+++ trunk/blender/source/blender/render/intern/include/render_types.h	2008-02-05 21:09:38 UTC (rev 13585)
@@ -43,8 +43,6 @@
 #include "RE_pipeline.h"
 #include "RE_shader_ext.h"	/* TexResult, ShadeResult, ShadeInput */
 
-#include "sunsky.h"
-
 struct Object;
 struct MemArena;
 struct VertTableNode;
@@ -450,8 +448,6 @@
 	float area_size, area_sizey, area_sizez;
 	float adapt_thresh;
 
-	/* atmosphere */
-	struct SunSky *sunsky;
 	struct ShadBuf *shb;
 	float *jitter;
 	QMCSampler *qsa;

Modified: trunk/blender/source/blender/render/intern/source/convertblender.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/convertblender.c	2008-02-05 21:02:16 UTC (rev 13584)
+++ trunk/blender/source/blender/render/intern/source/convertblender.c	2008-02-05 21:09:38 UTC (rev 13585)
@@ -3320,7 +3320,6 @@
 	LampRen *lar;
 	GroupObject *go;
 	float mat[4][4], angle, xn, yn;
-	float vec[3];
 	int c;
 
 	/* previewrender sets this to zero... prevent accidents */
@@ -3404,9 +3403,7 @@
 	
 	lar->adapt_thresh= la->adapt_thresh;
 	
-	lar->sunsky = NULL;
-	
-	if( ELEM(lar->type, LA_SPOT, LA_LOCAL)) {
+	if( ELEM3(lar->type, LA_SPOT, LA_SUN, LA_LOCAL)) {
 		lar->ray_totsamp= lar->ray_samp*lar->ray_samp;
 		lar->area_shape = LA_AREA_SQUARE;
 		lar->area_sizey= lar->area_size;
@@ -3436,26 +3433,6 @@
 		area_lamp_vectors(lar);
 		init_jitter_plane(lar);	// subsamples
 	}
-	else if(lar->type==LA_SUN){
-		lar->ray_totsamp= lar->ray_samp*lar->ray_samp;
-		lar->area_shape = LA_AREA_SQUARE;
-		lar->area_sizey= lar->area_size;
-
-		if((la->sun_effect_type & LA_SUN_EFFECT_SKY) ||
-				(la->sun_effect_type & LA_SUN_EFFECT_AP)){
-			lar->sunsky = (struct SunSky*)MEM_callocN(sizeof(struct SunSky), "sunskyren");
-			lar->sunsky->effect_type = la->sun_effect_type;
-		
-			VECCOPY(vec,ob->obmat[2]);
-		    Normalize(vec);
-		    
-			InitSunSky(lar->sunsky, la->atm_turbidity, vec, la->horizon_brightness, 
-					la->spread, la->sun_brightness, la->sun_size, la->backscattered_light);
-			
-			InitAtmosphere(lar->sunsky, 1.0, 1.0, la->atm_inscattering_factor, la->atm_extinction_factor,
-					la->atm_distance_factor, la->atm_distance_over_sky);
-		}
-	}
 	else lar->ray_totsamp= 0;
 	
 #ifndef DISABLE_YAFRAY
@@ -4174,7 +4151,6 @@
 		freeshadowbuf(lar);
 		if(lar->jitter) MEM_freeN(lar->jitter);
 		if(lar->shadsamp) MEM_freeN(lar->shadsamp);
-		if(lar->sunsky) MEM_freeN(lar->sunsky);
 		if(lar->qsa) free_lamp_qmcsampler(lar);
 		curvemapping_free(lar->curfalloff);
 	}

Modified: trunk/blender/source/blender/render/intern/source/pixelshading.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/pixelshading.c	2008-02-05 21:02:16 UTC (rev 13584)
+++ trunk/blender/source/blender/render/intern/source/pixelshading.c	2008-02-05 21:09:38 UTC (rev 13585)
@@ -519,59 +519,12 @@
 	}
 }
 
-/* shade sky according to sun lamps and mix it with sky color, all parameters are like shadeSkyView except sunsky*/
-void shadeSunView(struct SunSky *sunsky, float *colf, float *rco, float *view, float *dxyview)
-{
-	float sunAngle;
-	float colorxyz[3];
-	float sunColor[3];
-	float  sunDir[3],scale;
-			
-	sunAngle = sqrt(sunsky->sunSolidAngle / M_PI);
-
-	sunDir[0] = sunsky->toSun[0];
-	sunDir[1] = sunsky->toSun[1];
-	sunDir[2] = sunsky->toSun[2];
-			
-	ConvertSpectrumDataToCIEXYZ(sunsky->sunSpectralRaddata, colorxyz);
-	
-	scale = MAX3(colorxyz[0], colorxyz[1], colorxyz[2]);
-	colorxyz[0] /= scale;
-	colorxyz[1] /= scale;
-	colorxyz[2] /= scale;
-	xyz_to_rgb(colorxyz[0], colorxyz[1], colorxyz[2], &sunColor[0], &sunColor[1], &sunColor[2]);
-	
-
-	Normalize(view);
-	MTC_Mat3MulVecfl(R.imat, view);
-	if (view[2] < 0.0)
-		view[2] = 0.0;
-	Normalize(view);
-	GetSkyXYZRadiancef(sunsky, view, colorxyz);
-	scale = MAX3(colorxyz[0], colorxyz[1], colorxyz[2]);
-	colorxyz[0] /= scale;
-	colorxyz[1] /= scale;
-	colorxyz[2] /= scale;
-	
-	xyz_to_rgb(colorxyz[0], colorxyz[1], colorxyz[2], &colf[0], &colf[1], &colf[2]);
-	if(acos(Inpf(view, sunDir)) < sunAngle)
-	{
-		colf[0] = 0.8*colf[0] + 0.2*sunColor[0];
-		colf[1] = 0.8*colf[1] + 0.2*sunColor[1];
-		colf[2] = 0.8*colf[2] + 0.2*sunColor[2];
-	}
-	ClipColour(colf);
-}
-
 /*
   Stuff the sky color into the collector.
  */
 void shadeSkyPixel(float *collector, float fx, float fy) 
 {
 	float view[3], dxyview[2];
-	float sun_collector[3], mix_facor;
-	GroupObject *go;
-	LampRen *lar;
 	
 	/*
 	  The rules for sky:
@@ -584,6 +537,7 @@
 	/* 1. Do a backbuffer image: */ 
 	if(R.r.bufflag & 1) {
 		fillBackgroundImage(collector, fx, fy);
+		return;
 	} 
 	else if((R.wrld.skytype & (WO_SKYBLEND+WO_SKYTEX))==0) {
 		/* 2. solid color */
@@ -618,34 +572,7 @@
 		shadeSkyView(collector, NULL, view, dxyview);
 		collector[3] = 0.0f;
 	}
-	
-	mix_facor = 0.5;
-	
-	for(go=R.lights.first; go; go= go->next) {
-		lar= go->lampren;
-		if(lar->type==LA_SUN &&	lar->sunsky && (lar->sunsky->effect_type & LA_SUN_EFFECT_SKY)){
-
-			calc_view_vector(view, fx, fy);

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list