From a8ef804146751f8b5ec0f83b411f4ab7d041ed84 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Wed, 30 Jun 2004 18:54:09 +0000 Subject: NEW: Ramp shades for diffuse and specular http://www.blender3d.org/cms/Ramp_Shaders.348.0.html Material color and specular now can be defined by a Colorband. The actual color then is defined during shading based on: - shade value (like dotproduct) - energy value (dot product plus light) - normal - result of all shading (useful for adding stuff in the end) Special request from [A]ndy! :) --- source/blender/blenloader/intern/readfile.c | 19 ++++++++++++++++--- source/blender/blenloader/intern/writefile.c | 5 ++++- 2 files changed, 20 insertions(+), 4 deletions(-) (limited to 'source/blender/blenloader') diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 0723b8175fc..361ac3666a0 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -1920,7 +1920,11 @@ static void direct_link_material(FileData *fd, Material *ma) for(a=0; a<8; a++) { ma->mtex[a]= newdataadr(fd, ma->mtex[a]); } - ma->ren= 0; /* should not be needed, nevertheless... */ + + ma->ramp_col= newdataadr(fd, ma->ramp_col); + ma->ramp_spec= newdataadr(fd, ma->ramp_spec); + + ma->ren= NULL; /* should not be needed, nevertheless... */ } /* ************ READ MESH ***************** */ @@ -4229,8 +4233,17 @@ static void do_versions(Main *main) } } - - + if(main->versionfile <= 233) { + Material *ma= main->mat.first; + + while(ma) { + if(ma->rampfac_col==0.0) ma->rampfac_col= 1.0; + if(ma->rampfac_spec==0.0) ma->rampfac_spec= 1.0; + if(ma->pr_lamp==0) ma->pr_lamp= 3; + ma= ma->id.next; + } + } + /* don't forget to set version number in blender.c! */ } diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 32249c1c46b..d1d66ae2e63 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -912,7 +912,10 @@ static void write_materials(WriteData *wd, ListBase *idbase) for(a=0; a<8; a++) { if(ma->mtex[a]) writestruct(wd, DATA, "MTex", 1, ma->mtex[a]); } - + + if(ma->ramp_col) writestruct(wd, DATA, "ColorBand", 1, ma->ramp_col); + if(ma->ramp_spec) writestruct(wd, DATA, "ColorBand", 1, ma->ramp_spec); + write_scriptlink(wd, &ma->scriptlink); } ma= ma->id.next; -- cgit v1.2.3