Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2005-12-06 13:55:30 +0300
committerTon Roosendaal <ton@blender.org>2005-12-06 13:55:30 +0300
commitd024452ebf97c0926b1601371d2ee802bd754f3c (patch)
treeb6afebbe0b0cb682062bed92acbf33fe33b09aae /source/blender/render
parent863234481e751ae94dd77b18d65ea76df65ec4b1 (diff)
Orange branch: Revived hidden treasure, the Groups!
Previous experiment (in 2000) didn't satisfy, it had even some primitive NLA option in groups... so, cleaned up the old code (removed most) and integrated it back in a more useful way. Usage: - CTRL+G gives menu to add group, add to existing group, or remove from groups. - In Object buttons, a new (should become first) Panel was added, showing not only Object "ID button" and Parent, but also the Groups the Object Belongs to. These buttons also allow rename, assigning or removing. - To indicate Objects are grouped, they're drawn in a (not theme yet, so temporal?) green wire color. - Use ALT+SHIFT mouse-select to (de)select an entire group But, the real power of groups is in the following features: -> Particle Force field and Guide control In the "Particle Motion" Panel, you can indicate a Group name, this then limits force fields or guides to members of that Group. (Note that layers still work on top of that... not sure about that). -> Light Groups In the Material "Shaders" Panel, you can indicate a Group name to limit lighting for the Material to lamps in this group. The Lights in a Group do need to be 'visible' for the Scene to be rendered (as usual). -> Group Duplicator In the Object "Anim" Panel, you can set any Object (use Empty!) to duplicate an entire Group. It will make copies of all Objects in that Group. Also works for animated Objects, but it will copy the current positions or deforms. Control over 'local timing' (so we can do Massive anims!) will be added later. (Note; this commit won't render Group duplicators yet, a fix in bf-blender will enable that, next commit will sync) -> Library Appending In the SHIFT-F1 or SHIFT+F4 browsers, you can also find the Groups listed. By appending or linking the Group itself, and use the Group Duplicator, you now can animate and position linked Objects. The nice thing is that the local saved file itself will only store the Group name that was linked, so on a next file read, the Group Objects will be re-read as stored (changed) in the Library file. (Note; current implementation also "gives a base" to linked Group Objects, to show them as Objects in the current Scene. Need that now for testing purposes, but probably will be removed later). -> Outliner Outliner now shows Groups as optio too, nice to organize your data a bit too! In General, Groups have a very good potential... for example, it could become default for MetaBall Objects too (jiri, I can help you later on how this works). All current 'layer relationships' in Blender should be dropped in time, I guess...
Diffstat (limited to 'source/blender/render')
-rw-r--r--source/blender/render/extern/include/render_types.h1
-rw-r--r--source/blender/render/intern/source/envmap.c7
-rw-r--r--source/blender/render/intern/source/initrender.c29
-rw-r--r--source/blender/render/intern/source/pixelshading.c9
-rw-r--r--source/blender/render/intern/source/renderPreAndPost.c9
-rw-r--r--source/blender/render/intern/source/rendercore.c35
6 files changed, 41 insertions, 49 deletions
diff --git a/source/blender/render/extern/include/render_types.h b/source/blender/render/extern/include/render_types.h
index ea3463f96ae..531a7fc5ceb 100644
--- a/source/blender/render/extern/include/render_types.h
+++ b/source/blender/render/extern/include/render_types.h
@@ -146,6 +146,7 @@ typedef struct RE_Render
int totvlak, totvert, tothalo, totlamp;
/* internal, fortunately */
+ ListBase lights;
struct LampRen **la;
struct VlakRen **blovl;
struct VertRen **blove;
diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c
index f3d8ef94d8e..f7c31fa099a 100644
--- a/source/blender/render/intern/source/envmap.c
+++ b/source/blender/render/intern/source/envmap.c
@@ -50,7 +50,7 @@
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h" /* for rectcpy */
-#include "DNA_texture_types.h"
+#include "DNA_group_types.h"
#include "DNA_image_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
@@ -271,6 +271,7 @@ static void envmap_transmatrix(float mat[][4], int part)
static void env_rotate_scene(float mat[][4], int mode)
{
+ GroupObject *go;
VlakRen *vlr = NULL;
VertRen *ver = NULL;
LampRen *lar = NULL;
@@ -326,8 +327,8 @@ static void env_rotate_scene(float mat[][4], int mode)
set_normalflags();
- for(a=0; a<R.totlamp; a++) {
- lar= R.la[a];
+ for(go=R.lights.first; go; go= go->next) {
+ lar= go->lampren;
/* removed here some horrible code of someone in NaN who tried to fix
prototypes... just solved by introducing a correct cmat[3][3] instead
diff --git a/source/blender/render/intern/source/initrender.c b/source/blender/render/intern/source/initrender.c
index 54cfc1742e8..1f1ffc20cf5 100644
--- a/source/blender/render/intern/source/initrender.c
+++ b/source/blender/render/intern/source/initrender.c
@@ -466,33 +466,8 @@ static void free_filt_mask()
MEM_freeN(centmask);
}
-/* unused */
-
-#if 0
-void defaultlamp()
-{
- LampRen *lar;
-
- lar= (LampRen *)MEM_callocN(sizeof(LampRen),"lampren");
- R.la[R.totlamp++]=lar;
-
- lar->type= LA_SUN;
- lar->vec[0]= -R.viewmat[2][0];
- lar->vec[1]= -R.viewmat[2][1];
- lar->vec[2]= -R.viewmat[2][2];
- Normalise(lar->vec);
- lar->r= 1.0;
- lar->g= 1.0;
- lar->b= 1.0;
- lar->lay= 65535;
-}
-#endif
-
-
-
/* ********************* init calls *********************** */
-
static void init_def_material(void)
{
Material *ma;
@@ -511,7 +486,6 @@ void RE_init_render_data(void)
R.blove= (VertRen **)MEM_callocN(sizeof(void *)*(TABLEINITSIZE),"Blove");
R.blovl= (VlakRen **)MEM_callocN(sizeof(void *)*(TABLEINITSIZE),"Blovl");
R.bloha= (HaloRen **)MEM_callocN(sizeof(void *)*(TABLEINITSIZE),"Bloha");
- R.la= (LampRen **)MEM_mallocN(LAMPINITSIZE*sizeof(void *),"renderlamparray");
init_def_material();
init_filt_mask();
@@ -525,8 +499,7 @@ void RE_free_render_data()
R.blovl= NULL;
MEM_freeN(R.bloha);
R.bloha= NULL;
- MEM_freeN(R.la);
- R.la= NULL;
+
if(R.rectot) MEM_freeN(R.rectot);
if(R.rectftot) MEM_freeN(R.rectftot);
if(R.rectz) MEM_freeN(R.rectz);
diff --git a/source/blender/render/intern/source/pixelshading.c b/source/blender/render/intern/source/pixelshading.c
index 9d6e7b421d5..6bb0ce04533 100644
--- a/source/blender/render/intern/source/pixelshading.c
+++ b/source/blender/render/intern/source/pixelshading.c
@@ -45,6 +45,7 @@
#include "MTC_vectorops.h"
#include "DNA_camera_types.h"
+#include "DNA_group_types.h"
#include "DNA_material_types.h"
#include "DNA_object_types.h"
#include "DNA_image_types.h"
@@ -160,10 +161,10 @@ extern float hashvectf[];
static void render_lighting_halo(HaloRen *har, float *colf)
{
+ GroupObject *go;
LampRen *lar;
float i, inp, inpr, rco[3], dco[3], lv[3], lampdist, ld, t, *vn;
float ir, ig, ib, shadfac, soft, lacol[3];
- int a;
ir= ig= ib= 0.0;
@@ -172,8 +173,8 @@ static void render_lighting_halo(HaloRen *har, float *colf)
vn= har->no;
- for(a=0; a<R.totlamp; a++) {
- lar= R.la[a];
+ for(go=R.lights.first; go; go= go->next) {
+ lar= go->lampren;
/* test for lamplayer */
if(lar->mode & LA_LAYER) if((lar->lay & har->lay)==0) continue;
@@ -496,7 +497,7 @@ void shadeHaloFloat(HaloRen *har, float *col, int zz,
if(har->mat) {
if(har->mat->mode & MA_HALO_SHADE) {
/* we test for lights because of preview... */
- if(R.totlamp) render_lighting_halo(har, col);
+ if(R.lights.first) render_lighting_halo(har, col);
}
/* Next, we do the line and ring factor modifications. */
diff --git a/source/blender/render/intern/source/renderPreAndPost.c b/source/blender/render/intern/source/renderPreAndPost.c
index defb6b97ff6..0753a73276b 100644
--- a/source/blender/render/intern/source/renderPreAndPost.c
+++ b/source/blender/render/intern/source/renderPreAndPost.c
@@ -34,6 +34,8 @@
#include "MEM_guardedalloc.h"
+#include "DNA_group_types.h"
+
#include "render.h"
#include "renderPreAndPost.h"
#include "RE_callbacks.h"
@@ -52,15 +54,16 @@
*/
void prepareScene()
{
- int a;
+ GroupObject *go;
extern void makeoctree(void);
RE_local_get_renderdata();
/* SHADOW BUFFER */
- for(a=0; a<R.totlamp; a++) {
+ for(go=R.lights.first; go; go= go->next) {
+ LampRen *lar= go->lampren;
+ if(lar->shb) makeshadowbuf(lar);
if(RE_local_test_break()) break;
- if(R.la[a]->shb) makeshadowbuf(R.la[a]);
}
/* yafray: 'direct' radiosity, environment maps and octree init not needed for yafray render */
diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c
index 4d29ffe3b43..99e9384f5b8 100644
--- a/source/blender/render/intern/source/rendercore.c
+++ b/source/blender/render/intern/source/rendercore.c
@@ -42,12 +42,13 @@
#include "BKE_utildefines.h"
+#include "DNA_camera_types.h"
+#include "DNA_group_types.h"
+#include "DNA_image_types.h"
+#include "DNA_lamp_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
-#include "DNA_image_types.h"
#include "DNA_object_types.h"
-#include "DNA_camera_types.h"
-#include "DNA_lamp_types.h"
#include "DNA_texture_types.h"
#include "BKE_global.h"
@@ -406,14 +407,15 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens)
static void renderspothalo(ShadeInput *shi, float *col, float alpha)
{
+ GroupObject *go;
LampRen *lar;
float i;
- int a;
if(alpha==0.0f) return;
- for(a=0; a<R.totlamp; a++) {
- lar= R.la[a];
+ for(go=R.lights.first; go; go= go->next) {
+ lar= go->lampren;
+
if(lar->type==LA_SPOT && (lar->mode & LA_HALO) && lar->haint>0) {
spothalo(lar, shi, &i);
@@ -1354,11 +1356,12 @@ static void ambient_occlusion(World *wrld, ShadeInput *shi, ShadeResult *shr)
void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
{
LampRen *lar;
+ GroupObject *go;
Material *ma= shi->mat;
VlakRen *vlr= shi->vlr;
+ ListBase *lights;
float i, inp, inpr, is, t, lv[3], vnor[3], lacol[3], lampdist, ld = 0;
float lvrot[3], *vn, *view, shadfac[4], soft, phongcorr; // shadfac = rgba
- int a;
vn= shi->vn;
view= shi->view;
@@ -1371,6 +1374,12 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
shi->har= ma->har;
if((ma->mode & MA_RAYMIRROR)==0) shi->ray_mirror= 0.0;
+ /* lights */
+ if(ma->group)
+ lights= &ma->group->gobject;
+ else
+ lights= &R.lights;
+
/* separate loop */
if(ma->mode & MA_ONLYSHADOW) {
float ir;
@@ -1378,8 +1387,10 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
if(R.r.mode & R_SHADOW) {
shadfac[3]= ir= 0.0;
- for(a=0; a<R.totlamp; a++) {
- lar= R.la[a];
+ for(go=lights->first; go; go= go->next) {
+ lar= go->lampren;
+ if(lar==NULL) continue;
+
/* yafray: ignore shading by photonlights, not used in Blender */
if (lar->type==LA_YF_PHOTON) continue;
@@ -1505,8 +1516,10 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
ambient_occlusion(&R.wrld, shi, shr);
- for(a=0; a<R.totlamp; a++) {
- lar= R.la[a];
+ for(go=lights->first; go; go= go->next) {
+ lar= go->lampren;
+ if(lar==NULL) continue;
+
/* yafray: ignore shading by photonlights, not used in Blender */
if (lar->type==LA_YF_PHOTON) continue;