From 30512d7c5586189d02e2b2e71d0d5257b0713a16 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Wed, 20 Nov 2013 19:09:24 +0100 Subject: Blender Internal: * Remove Stars feature. This was a quite minimalistic feature and there are better alternatives with more control (particles for example). Removal discussed during BCon13 developer meeting and already years before, time to do it.. Reviewed By: brecht Differential Revision: http://developer.blender.org/D17 --- source/blender/blenkernel/intern/ipo.c | 11 -- source/blender/blenkernel/intern/world.c | 2 - source/blender/editors/space_view3d/view3d_draw.c | 9 -- source/blender/makesdna/DNA_ipo_types.h | 1 + source/blender/makesdna/DNA_world_types.h | 7 +- source/blender/makesrna/intern/rna_world.c | 59 ------- source/blender/render/extern/include/RE_pipeline.h | 4 - .../blender/render/intern/source/convertblender.c | 176 --------------------- 8 files changed, 5 insertions(+), 264 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index ecc4a03d255..8ef3b7ef23d 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -712,17 +712,6 @@ static const char *world_adrcodes_to_paths(int adrcode, int *array_index) return "mist.start"; case WO_MISTHI: return "mist.height"; - - case WO_STAR_R: - case WO_STAR_G: - case WO_STAR_B: - printf("WARNING: WO_STAR_R/G/B deprecated\n"); - return NULL; - - case WO_STARDIST: - return "stars.min_distance"; - case WO_STARSIZE: - return "stars.size"; default: /* for now, we assume that the others were MTex channels */ return mtex_adrcodes_to_paths(adrcode, array_index); diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c index 206f829eaa8..c5a932e4173 100644 --- a/source/blender/blenkernel/intern/world.c +++ b/source/blender/blenkernel/intern/world.c @@ -92,8 +92,6 @@ World *add_world(Main *bmain, const char *name) wrld->zeng = 0.01f; wrld->zenb = 0.01f; wrld->skytype = 0; - wrld->stardist = 15.0f; - wrld->starsize = 2.0f; wrld->exp = 0.0f; wrld->exposure = wrld->range = 1.0f; diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 1bf137e5787..abdf017c6ee 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -64,7 +64,6 @@ #include "BKE_movieclip.h" #include "RE_engine.h" -#include "RE_pipeline.h" /* make_stars */ #include "IMB_imbuf_types.h" #include "IMB_imbuf.h" @@ -3279,14 +3278,6 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) { drawfloor(scene, v3d, grid_unit); } - if (rv3d->persp == RV3D_CAMOB) { - if (scene->world) { - if (scene->world->mode & WO_STARS) { - RE_make_stars(NULL, scene, star_stuff_init_func, star_stuff_vertex_func, - star_stuff_term_func); - } - } - } } else { if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) { diff --git a/source/blender/makesdna/DNA_ipo_types.h b/source/blender/makesdna/DNA_ipo_types.h index 2699c6e576e..b4088cc5a5d 100644 --- a/source/blender/makesdna/DNA_ipo_types.h +++ b/source/blender/makesdna/DNA_ipo_types.h @@ -308,6 +308,7 @@ typedef struct Ipo { #define WO_MISTSTA 10 #define WO_MISTHI 11 +/* Stars are deprecated */ #define WO_STAR_R 12 #define WO_STAR_G 13 #define WO_STAR_B 14 diff --git a/source/blender/makesdna/DNA_world_types.h b/source/blender/makesdna/DNA_world_types.h index a0863b18cca..44f7813bda0 100644 --- a/source/blender/makesdna/DNA_world_types.h +++ b/source/blender/makesdna/DNA_world_types.h @@ -96,8 +96,9 @@ typedef struct World { float misi, miststa, mistdist, misthi; float starr DNA_DEPRECATED, starg DNA_DEPRECATED, starb DNA_DEPRECATED, stark DNA_DEPRECATED; /* Deprecated */ - float starsize, starmindist; - float stardist, starcolnoise; + + float starsize DNA_DEPRECATED, starmindist DNA_DEPRECATED; + float stardist DNA_DEPRECATED, starcolnoise DNA_DEPRECATED; /* unused now: DOF */ short dofsta, dofend, dofmin, dofmax; @@ -142,7 +143,7 @@ typedef struct World { /* mode */ #define WO_MIST 1 -#define WO_STARS 2 +#define WO_STARS 2 /* deprecated */ /*#define WO_DOF 4*/ #define WO_ACTIVITY_CULLING 8 #define WO_ENV_LIGHT 16 diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c index b689a82c231..c7997bebedb 100644 --- a/source/blender/makesrna/intern/rna_world.c +++ b/source/blender/makesrna/intern/rna_world.c @@ -56,10 +56,6 @@ static PointerRNA rna_World_lighting_get(PointerRNA *ptr) return rna_pointer_inherit_refine(ptr, &RNA_WorldLighting, ptr->id.data); } -static PointerRNA rna_World_stars_get(PointerRNA *ptr) -{ - return rna_pointer_inherit_refine(ptr, &RNA_WorldStarsSettings, ptr->id.data); -} static PointerRNA rna_World_mist_get(PointerRNA *ptr) { @@ -114,14 +110,6 @@ static void rna_World_draw_mist_update(Main *UNUSED(bmain), Scene *UNUSED(scene) WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL); } -static void rna_World_stars_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) -{ - World *wo = ptr->id.data; - - DAG_id_tag_update(&wo->id, 0); - WM_main_add_notifier(NC_WORLD | ND_WORLD_STARS, wo); -} - static void rna_World_use_nodes_update(bContext *C, PointerRNA *ptr) { World *wrld = (World *)ptr->data; @@ -450,46 +438,6 @@ static void rna_def_world_mist(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_World_update"); } -static void rna_def_world_stars(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "WorldStarsSettings", NULL); - RNA_def_struct_sdna(srna, "World"); - RNA_def_struct_nested(brna, srna, "World"); - RNA_def_struct_ui_text(srna, "World Stars", "Stars settings for a World data-block"); - - prop = RNA_def_property(srna, "use_stars", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_STARS); - RNA_def_property_ui_text(prop, "Use Stars", "Enable starfield generation"); - RNA_def_property_update(prop, 0, "rna_World_stars_update"); - - prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "starsize"); - RNA_def_property_range(prop, 0, 10); - RNA_def_property_ui_text(prop, "Size", "Average screen dimension of stars"); - RNA_def_property_update(prop, 0, "rna_World_draw_update"); /* use normal update since this isn't visualized */ - - prop = RNA_def_property(srna, "distance_min", PROP_FLOAT, PROP_DISTANCE); - RNA_def_property_float_sdna(prop, NULL, "starmindist"); - RNA_def_property_range(prop, 0, 1000); - RNA_def_property_ui_text(prop, "Minimum Distance", "Minimum distance to the camera for stars"); - RNA_def_property_update(prop, 0, "rna_World_stars_update"); - - prop = RNA_def_property(srna, "average_separation", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "stardist"); - RNA_def_property_range(prop, 2, 1000); - RNA_def_property_ui_text(prop, "Average Separation", "Average distance between any two stars"); - RNA_def_property_update(prop, 0, "rna_World_stars_update"); - - prop = RNA_def_property(srna, "color_random", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "starcolnoise"); - RNA_def_property_range(prop, 0, 1); - RNA_def_property_ui_text(prop, "Color Randomization", "Randomize star colors"); - RNA_def_property_update(prop, 0, "rna_World_stars_update"); -} - void RNA_def_world(BlenderRNA *brna) { StructRNA *srna; @@ -568,12 +516,6 @@ void RNA_def_world(BlenderRNA *brna) RNA_def_property_pointer_funcs(prop, "rna_World_mist_get", NULL, NULL, NULL); RNA_def_property_ui_text(prop, "Mist", "World mist settings"); - prop = RNA_def_property(srna, "star_settings", PROP_POINTER, PROP_NONE); - RNA_def_property_flag(prop, PROP_NEVER_NULL); - RNA_def_property_struct_type(prop, "WorldStarsSettings"); - RNA_def_property_pointer_funcs(prop, "rna_World_stars_get", NULL, NULL, NULL); - RNA_def_property_ui_text(prop, "Stars", "World stars settings"); - /* nodes */ prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "nodetree"); @@ -588,7 +530,6 @@ void RNA_def_world(BlenderRNA *brna) rna_def_lighting(brna); rna_def_world_mist(brna); - rna_def_world_stars(brna); rna_def_world_mtex(brna); } diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h index 79826a63690..109524c9814 100644 --- a/source/blender/render/extern/include/RE_pipeline.h +++ b/source/blender/render/extern/include/RE_pipeline.h @@ -247,10 +247,6 @@ int RE_WriteEnvmapResult(struct ReportList *reports, struct Scene *scene, struct /* do a full sample buffer compo */ void RE_MergeFullSample(struct Render *re, struct Main *bmain, struct Scene *sce, struct bNodeTree *ntree); -/* ancient stars function... go away! */ -void RE_make_stars(struct Render *re, struct Scene *scenev3d, void (*initfunc)(void), - void (*vertexfunc)(const float *), void (*termfunc)(void)); - /* display and event callbacks */ void RE_display_init_cb (struct Render *re, void *handle, void (*f)(void *handle, RenderResult *rr)); void RE_display_clear_cb(struct Render *re, void *handle, void (*f)(void *handle, RenderResult *rr)); diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index b4873e7d310..c5c804e9700 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -160,175 +160,6 @@ static HaloRen *initstar(Render *re, ObjectRen *obr, const float vec[3], float h return har; } -/* there must be a 'fixed' amount of stars generated between - * near and far - * all stars must by preference lie on the far and solely - * differ in clarity/color - */ - -void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void), - void (*vertexfunc)(const float *), void (*termfunc)(void)) -{ - extern unsigned char hash[512]; - ObjectRen *obr= NULL; - World *wrld= NULL; - HaloRen *har; - Scene *scene; - Object *camera; - Camera *cam; - RNG *rng; - double dblrand, hlfrand; - float vec[4], fx, fy, fz; - float fac, starmindist, clipend; - float mat[4][4], stargrid, maxrand, maxjit, force, alpha; - int x, y, z, sx, sy, sz, ex, ey, ez, done = FALSE; - unsigned int totstar= 0; - - if (initfunc) { - scene= scenev3d; - wrld= scene->world; - } - else { - scene= re->scene; - wrld= &(re->wrld); - } - - stargrid = wrld->stardist; /* distance between stars */ - maxrand = 2.0; /* amount a star can be shifted (in grid units) */ - maxjit = (wrld->starcolnoise); /* amount a color is being shifted */ - - /* size of stars */ - force = ( wrld->starsize ); - - /* minimal free space (starting at camera) */ - starmindist= wrld->starmindist; - - if (stargrid <= 0.10f) return; - - if (re) re->flag |= R_HALO; - else stargrid *= 1.0f; /* then it draws fewer */ - - if (re) invert_m4_m4(mat, re->viewmat); - else unit_m4(mat); - - /* BOUNDING BOX CALCULATION - * bbox goes from z = loc_near_var | loc_far_var, - * x = -z | +z, - * y = -z | +z - */ - - camera= re ? RE_GetCamera(re) : scene->camera; - - if (camera==NULL || camera->type != OB_CAMERA) - return; - - cam = camera->data; - clipend = cam->clipend; - - /* convert to grid coordinates */ - - sx = ((mat[3][0] - clipend) / stargrid) - maxrand; - sy = ((mat[3][1] - clipend) / stargrid) - maxrand; - sz = ((mat[3][2] - clipend) / stargrid) - maxrand; - - ex = ((mat[3][0] + clipend) / stargrid) + maxrand; - ey = ((mat[3][1] + clipend) / stargrid) + maxrand; - ez = ((mat[3][2] + clipend) / stargrid) + maxrand; - - dblrand = maxrand * stargrid; - hlfrand = 2.0 * dblrand; - - if (initfunc) { - initfunc(); - } - - if (re) /* add render object for stars */ - obr= RE_addRenderObject(re, NULL, NULL, 0, 0, 0); - - rng = BLI_rng_new(0); - - for (x = sx, fx = sx * stargrid; x <= ex; x++, fx += stargrid) { - for (y = sy, fy = sy * stargrid; y <= ey; y++, fy += stargrid) { - for (z = sz, fz = sz * stargrid; z <= ez; z++, fz += stargrid) { - - BLI_rng_seed(rng, (hash[z & 0xff] << 24) + (hash[y & 0xff] << 16) + (hash[x & 0xff] << 8)); - vec[0] = fx + (hlfrand * BLI_rng_get_double(rng)) - dblrand; - vec[1] = fy + (hlfrand * BLI_rng_get_double(rng)) - dblrand; - vec[2] = fz + (hlfrand * BLI_rng_get_double(rng)) - dblrand; - vec[3] = 1.0; - - if (vertexfunc) { - if (done & 1) vertexfunc(vec); - done++; - } - else { - if (re) - mul_m4_v3(re->viewmat, vec); - - /* in vec are global coordinates - * calculate distance to camera - * and using that, define the alpha - */ - alpha = len_v3(vec); - - if (alpha >= clipend) alpha = 0.0; - else if (alpha <= starmindist) alpha = 0.0; - else if (alpha <= 2.0f * starmindist) { - alpha = (alpha - starmindist) / starmindist; - } - else { - alpha -= 2.0f * starmindist; - alpha /= (clipend - 2.0f * starmindist); - alpha = 1.0f - alpha; - } - - - if (alpha != 0.0f) { - fac = force * BLI_rng_get_double(rng); - - har = initstar(re, obr, vec, fac); - - if (har) { - har->alfa = sqrt(sqrt(alpha)); - har->add= 255; - har->r = har->g = har->b = 1.0; - if (maxjit) { - har->r += ((maxjit * BLI_rng_get_double(rng)) ) - maxjit; - har->g += ((maxjit * BLI_rng_get_double(rng)) ) - maxjit; - har->b += ((maxjit * BLI_rng_get_double(rng)) ) - maxjit; - } - har->hard = 32; - har->lay= -1; - har->type |= HA_ONLYSKY; - done++; - } - } - } - - /* break out of the loop if generating stars takes too long */ - if (re && !(totstar % 1000000)) { - if (re->test_break(re->tbh)) { - x= ex + 1; - y= ey + 1; - z= ez + 1; - } - } - - totstar++; - } - /* do not call blender_test_break() here, since it is used in UI as well, confusing the callback system */ - /* main cause is G.is_break of course, a global again... (ton) */ - } - } - if (termfunc) termfunc(); - - if (obr) - re->tothalo += obr->tothalo; - - BLI_rng_free(rng); -} - - /* ------------------------------------------------------------------------- */ /* tool functions/defines for ad hoc simplification and possible future * cleanup */ @@ -5370,13 +5201,6 @@ void RE_Database_Preprocess(Render *re) /* don't sort stars */ tothalo= re->tothalo; - if (!re->test_break(re->tbh)) { - if (re->wrld.mode & WO_STARS) { - re->i.infostr = IFACE_("Creating Starfield"); - re->stats_draw(re->sdh, &re->i); - RE_make_stars(re, NULL, NULL, NULL, NULL); - } - } sort_halos(re, tothalo); init_camera_inside_volumes(re); -- cgit v1.2.3