remove sticky coords from blender and the internal render engine.

This commit is contained in:
Campbell Barton 2012-09-21 11:37:51 +00:00
parent f9467d28b9
commit 3d1cdfbb38
14 changed files with 11 additions and 156 deletions

View File

@ -271,28 +271,6 @@ static void layerInterp_mdeformvert(void **sources, const float *weights,
BLI_linklist_free(dest_dw, linklist_free_simple);
}
static void layerInterp_msticky(void **sources, const float *weights,
const float *UNUSED(sub_weights), int count, void *dest)
{
float co[2], w;
MSticky *mst;
int i;
co[0] = co[1] = 0.0f;
for (i = 0; i < count; i++) {
w = weights ? weights[i] : 1.0f;
mst = (MSticky *)sources[i];
madd_v2_v2fl(co, mst->co, w);
}
/* delay writing to the destination incase dest is in sources */
mst = (MSticky *)dest;
copy_v2_v2(mst->co, co);
}
static void layerCopy_tface(const void *source, void *dest, int count)
{
const MTFace *source_tf = (const MTFace *)source;
@ -1055,8 +1033,8 @@ static void layerInterp_mvert_skin(void **sources, const float *weights,
static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
/* 0: CD_MVERT */
{sizeof(MVert), "MVert", 1, NULL, NULL, NULL, NULL, NULL, NULL},
/* 1: CD_MSTICKY */
{sizeof(MSticky), "MSticky", 1, NULL, NULL, NULL, layerInterp_msticky, NULL,
/* 1: CD_MSTICKY */ /* DEPRECATED */
{sizeof(float) * 2, "", 1, NULL, NULL, NULL, NULL, NULL,
NULL},
/* 2: CD_MDEFORMVERT */
{sizeof(MDeformVert), "MDeformVert", 1, NULL, layerCopy_mdeformvert,

View File

@ -941,7 +941,7 @@ static void do_init_render_material(Material *ma, int r_mode, float *amb)
if (ma->texco & (TEXCO_ORCO | TEXCO_REFL | TEXCO_NORM | TEXCO_STRAND | TEXCO_STRESS)) needuv = 1;
else if (ma->texco & (TEXCO_GLOB | TEXCO_UV | TEXCO_OBJECT | TEXCO_SPEED)) needuv = 1;
else if (ma->texco & (TEXCO_LAVECTOR | TEXCO_VIEW | TEXCO_STICKY)) needuv = 1;
else if (ma->texco & (TEXCO_LAVECTOR | TEXCO_VIEW)) needuv = 1;
if ((ma->mapto & MAP_NORM) && (mtex->normapspace == MTEX_NSPACE_TANGENT))
needtang = 1;

View File

@ -7992,7 +7992,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
int a;
for (a = 0; a < MAX_MTEX; a++) {
if (ma->mtex[a]) {
if (ma->mtex[a]->texco == TEXCO_STICKY) {
if (ma->mtex[a]->texco == TEXCO_STICKY_) {
ma->mtex[a]->texco = TEXCO_UV;
}
}

View File

@ -765,9 +765,6 @@ static int mesh_customdata_clear_exec__internal(bContext *C,
DAG_id_tag_update(&me->id, 0);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, me);
/* clears points such as me->sticky */
mesh_update_customdata_pointers(me, FALSE);
return OPERATOR_FINISHED;
}

View File

@ -74,7 +74,7 @@ typedef struct CustomData {
/* CustomData.type */
#define CD_MVERT 0
#define CD_MSTICKY 1
#define CD_MSTICKY 1 /* DEPRECATED */
#define CD_MDEFORMVERT 2
#define CD_MEDGE 3
#define CD_MFACE 4
@ -118,7 +118,7 @@ typedef struct CustomData {
/* Bits for CustomDataMask */
#define CD_MASK_MVERT (1 << CD_MVERT)
#define CD_MASK_MSTICKY (1 << CD_MSTICKY)
#define CD_MASK_MSTICKY (1 << CD_MSTICKY) /* DEPRECATED */
#define CD_MASK_MDEFORMVERT (1 << CD_MDEFORMVERT)
#define CD_MASK_MEDGE (1 << CD_MEDGE)
#define CD_MASK_MFACE (1 << CD_MFACE)

View File

@ -339,7 +339,7 @@ typedef struct Material {
#define TEXCO_OBJECT 32
#define TEXCO_LAVECTOR 64
#define TEXCO_VIEW 128
#define TEXCO_STICKY 256 // DEPRECATED
#define TEXCO_STICKY_ 256 // DEPRECATED
#define TEXCO_OSA 512
#define TEXCO_WINDOW 1024
#define NEED_UV 2048

View File

@ -146,13 +146,9 @@ typedef struct MLoopCol {
mcol__tmp->a = mloopcol__tmp->a; \
} (void)0
typedef struct MSticky {
float co[2];
} MSticky;
typedef struct MSelect {
int index;
int type; /* EDITVERT/EDITEDGE/EDITFACE */
int type; /* ME_VSEL/ME_ESEL/ME_FSEL */
} MSelect;
/*tessellation uv face data*/

View File

@ -45,7 +45,6 @@ static EnumPropertyItem prop_texture_coordinates_items[] = {
{TEXCO_ORCO, "ORCO", 0, "Generated", "Use the original undeformed coordinates of the object"},
{TEXCO_STRAND, "STRAND", 0, "Strand / Particle",
"Use normalized strand texture coordinate (1D) or particle age (X) and trail position (Y)"},
// {TEXCO_STICKY, "STICKY", 0, "Sticky", "Use mesh's sticky coordinates for the texture coordinates"},
{TEXCO_WINDOW, "WINDOW", 0, "Window", "Use screen coordinates as texture coordinates"},
{TEXCO_NORM, "NORMAL", 0, "Normal", "Use normal vector as texture coordinates"},
{TEXCO_REFL, "REFLECTION", 0, "Reflection", "Use reflection vector as texture coordinates"},
@ -303,7 +302,6 @@ static EnumPropertyItem *rna_Material_texture_coordinates_itemf(bContext *UNUSED
else if (ELEM3(ma->material_type, MA_TYPE_SURFACE, MA_TYPE_HALO, MA_TYPE_WIRE)) {
RNA_enum_items_add_value(&item, &totitem, prop_texture_coordinates_items, TEXCO_UV);
RNA_enum_items_add_value(&item, &totitem, prop_texture_coordinates_items, TEXCO_STRAND);
RNA_enum_items_add_value(&item, &totitem, prop_texture_coordinates_items, TEXCO_STICKY);
RNA_enum_items_add_value(&item, &totitem, prop_texture_coordinates_items, TEXCO_WINDOW);
RNA_enum_items_add_value(&item, &totitem, prop_texture_coordinates_items, TEXCO_NORM);
RNA_enum_items_add_value(&item, &totitem, prop_texture_coordinates_items, TEXCO_REFL);

View File

@ -134,7 +134,7 @@ typedef struct ShadeInput {
int har; /* hardness */
/* texture coordinates */
float lo[3], gl[3], ref[3], orn[3], winco[3], sticky[3], vcol[4];
float lo[3], gl[3], ref[3], orn[3], winco[3], vcol[4];
float refcol[4], displace[3];
float strandco, tang[3], nmapnorm[3], nmaptang[4], stress, winspeed[4];
float duplilo[3], dupliuv[3];
@ -150,7 +150,6 @@ typedef struct ShadeInput {
float dxno[3], dyno[3], dxview, dyview;
float dxlv[3], dylv[3];
float dxwin[3], dywin[3];
float dxsticky[3], dysticky[3];
float dxrefract[3], dyrefract[3];
float dxstrand, dystrand;

View File

@ -55,7 +55,6 @@ struct RadFace;
typedef struct VertTableNode {
struct VertRen *vert;
float *rad;
float *sticky;
float *strand;
float *tangent;
float *stress;
@ -110,7 +109,6 @@ struct ObjectRen *RE_addRenderObject(struct Render *re, struct Object *ob, struc
struct ObjectInstanceRen *RE_addRenderInstance(struct Render *re, struct ObjectRen *obr, struct Object *ob, struct Object *par, int index, int psysindex, float mat[][4], int lay);
void RE_makeRenderInstances(struct Render *re);
float *RE_vertren_get_sticky(struct ObjectRen *obr, struct VertRen *ver, int verify);
float *RE_vertren_get_stress(struct ObjectRen *obr, struct VertRen *ver, int verify);
float *RE_vertren_get_rad(struct ObjectRen *obr, struct VertRen *ver, int verify);
float *RE_vertren_get_strand(struct ObjectRen *obr, struct VertRen *ver, int verify);

View File

@ -2261,14 +2261,6 @@ static void displace_render_vert(Render *re, ObjectRen *obr, ShadeInput *shi, Ve
if ((texco & TEXCO_ORCO) && (vr->orco)) {
copy_v3_v3(shi->lo, vr->orco);
}
if (texco & TEXCO_STICKY) {
float *sticky= RE_vertren_get_sticky(obr, vr, 0);
if (sticky) {
shi->sticky[0]= sticky[0];
shi->sticky[1]= sticky[1];
shi->sticky[2]= 0.0f;
}
}
if (texco & TEXCO_GLOB) {
copy_v3_v3(shi->gl, shi->co);
mul_m4_v3(re->viewinv, shi->gl);
@ -3250,7 +3242,6 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
VlakRen *vlr; //, *vlr1;
VertRen *ver;
Material *ma;
MSticky *ms = NULL;
DerivedMesh *dm;
CustomDataMask mask;
float xn, yn, zn, imat[3][3], mat[4][4]; //nor[3],
@ -3335,8 +3326,6 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
if (do_autosmooth && me->totvert==totvert && me->totface==dm->getNumTessFaces(dm))
use_original_normals= TRUE;
ms = NULL; /* STICKY_TODO */
ma= give_render_material(re, ob, 1);
@ -3355,16 +3344,11 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
normalize_v3(ver->n);
negate_v3(ver->n);
}
if (orco) {
ver->orco= orco;
orco+=3;
}
if (ms) {
float *sticky= RE_vertren_get_sticky(obr, ver, 1);
copy_v2_v2(sticky, ms->co);
ms++;
}
}
if (!timeoffset) {

View File

@ -2153,9 +2153,6 @@ void do_material_tex(ShadeInput *shi, Render *re)
co= shi->lo; dx= shi->dxlo; dy= shi->dylo;
}
}
else if (mtex->texco==TEXCO_STICKY) {
co= shi->sticky; dx= shi->dxsticky; dy= shi->dysticky;
}
else if (mtex->texco==TEXCO_OBJECT) {
Object *ob= mtex->object;
if (ob) {

View File

@ -97,8 +97,6 @@
* the index */
/* NOTE! the hardcoded table size 256 is used still in code for going quickly over vertices/faces */
#define RE_STICKY_ELEMS 2
#define RE_STRESS_ELEMS 1
#define RE_RAD_ELEMS 4
#define RE_STRAND_ELEMS 1
@ -113,21 +111,6 @@
#define RE_FACE_ELEMS 1
#define RE_NMAP_TANGENT_ELEMS 16
float *RE_vertren_get_sticky(ObjectRen *obr, VertRen *ver, int verify)
{
float *sticky;
int nr= ver->index>>8;
sticky= obr->vertnodes[nr].sticky;
if (sticky==NULL) {
if (verify)
sticky= obr->vertnodes[nr].sticky= MEM_mallocN(256*RE_STICKY_ELEMS*sizeof(float), "sticky table");
else
return NULL;
}
return sticky + (ver->index & 255)*RE_STICKY_ELEMS;
}
float *RE_vertren_get_stress(ObjectRen *obr, VertRen *ver, int verify)
{
float *stress;
@ -217,12 +200,7 @@ VertRen *RE_vertren_copy(ObjectRen *obr, VertRen *ver)
*v1= *ver;
v1->index= index;
fp1= RE_vertren_get_sticky(obr, ver, 0);
if (fp1) {
fp2= RE_vertren_get_sticky(obr, v1, 1);
memcpy(fp2, fp1, RE_STICKY_ELEMS*sizeof(float));
}
fp1= RE_vertren_get_stress(obr, ver, 0);
if (fp1) {
fp2= RE_vertren_get_stress(obr, v1, 1);
@ -739,8 +717,6 @@ void free_renderdata_vertnodes(VertTableNode *vertnodes)
if (vertnodes[a].rad)
MEM_freeN(vertnodes[a].rad);
if (vertnodes[a].sticky)
MEM_freeN(vertnodes[a].sticky);
if (vertnodes[a].strand)
MEM_freeN(vertnodes[a].strand);
if (vertnodes[a].tangent)

View File

@ -574,10 +574,6 @@ void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert
shi->dywin[1] = 0.0f;
}
}
if (texco & TEXCO_STICKY) {
/* not supported */
}
}
if (shi->do_manage) {
@ -1236,70 +1232,6 @@ void shade_input_set_shade_texco(ShadeInput *shi)
shi->dywin[0] = shi->dywin[2] = 0.0f;
}
}
if (texco & TEXCO_STICKY) {
float *s1, *s2, *s3;
s1 = RE_vertren_get_sticky(obr, v1, 0);
s2 = RE_vertren_get_sticky(obr, v2, 0);
s3 = RE_vertren_get_sticky(obr, v3, 0);
if (s1 && s2 && s3) {
float obwinmat[4][4], winmat[4][4], ho1[4], ho2[4], ho3[4];
float Zmulx, Zmuly;
float hox, hoy, l, dl, u, v;
float s00, s01, s10, s11, detsh;
/* old globals, localized now */
Zmulx = ((float)R.winx) / 2.0f; Zmuly = ((float)R.winy) / 2.0f;
zbuf_make_winmat(&R, winmat);
if (shi->obi->flag & R_TRANSFORMED)
mult_m4_m4m4(obwinmat, winmat, obi->mat);
else
copy_m4_m4(obwinmat, winmat);
zbuf_render_project(obwinmat, v1->co, ho1);
zbuf_render_project(obwinmat, v2->co, ho2);
zbuf_render_project(obwinmat, v3->co, ho3);
s00 = ho3[0] / ho3[3] - ho1[0] / ho1[3];
s01 = ho3[1] / ho3[3] - ho1[1] / ho1[3];
s10 = ho3[0] / ho3[3] - ho2[0] / ho2[3];
s11 = ho3[1] / ho3[3] - ho2[1] / ho2[3];
detsh = s00 * s11 - s10 * s01;
detsh = (detsh != 0.0f) ? 1.0f / detsh : 0.0f;
s00 *= detsh; s01 *= detsh;
s10 *= detsh; s11 *= detsh;
/* recalc u and v again */
hox = x / Zmulx - 1.0f;
hoy = y / Zmuly - 1.0f;
u = (hox - ho3[0] / ho3[3]) * s11 - (hoy - ho3[1] / ho3[3]) * s10;
v = (hoy - ho3[1] / ho3[3]) * s00 - (hox - ho3[0] / ho3[3]) * s01;
l = 1.0f + u + v;
shi->sticky[0] = l * s3[0] - u * s1[0] - v * s2[0];
shi->sticky[1] = l * s3[1] - u * s1[1] - v * s2[1];
shi->sticky[2] = 0.0f;
if (shi->osatex) {
float dxuv[2], dyuv[2];
dxuv[0] = s11 / Zmulx;
dxuv[1] = -s01 / Zmulx;
dyuv[0] = -s10 / Zmuly;
dyuv[1] = s00 / Zmuly;
dl = dxuv[0] + dxuv[1];
shi->dxsticky[0] = dl * s3[0] - dxuv[0] * s1[0] - dxuv[1] * s2[0];
shi->dxsticky[1] = dl * s3[1] - dxuv[0] * s1[1] - dxuv[1] * s2[1];
dl = dyuv[0] + dyuv[1];
shi->dysticky[0] = dl * s3[0] - dyuv[0] * s1[0] - dyuv[1] * s2[0];
shi->dysticky[1] = dl * s3[1] - dyuv[0] * s1[1] - dyuv[1] * s2[1];
}
}
}
}
/* else {
* Note! For raytracing winco is not set,