NEW! Blender now displays flipped (negative scaled) Objects correctly in
OpenGL draw. (BTW: the previous commit also solves raytrace errors with negative scaled objects...) Further a cleanup of displaylist flags and object/base flags. The #define ACTIVE is moved to filesel.c (only used here). The GONNA_MOVE #define got a OB_ added in front.
This commit is contained in:
@@ -35,6 +35,7 @@
|
|||||||
#ifndef BKE_DISPLIST_H
|
#ifndef BKE_DISPLIST_H
|
||||||
#define BKE_DISPLIST_H
|
#define BKE_DISPLIST_H
|
||||||
|
|
||||||
|
/* dl->type */
|
||||||
#define DL_POLY 0
|
#define DL_POLY 0
|
||||||
#define DL_SEGM 1
|
#define DL_SEGM 1
|
||||||
#define DL_SURF 2
|
#define DL_SURF 2
|
||||||
@@ -46,7 +47,9 @@
|
|||||||
#define DL_NORS 8
|
#define DL_NORS 8
|
||||||
#define DL_MESH 9
|
#define DL_MESH 9
|
||||||
|
|
||||||
/* EVIL: #define DL_SURFINDEX(cyclu, cyclv, sizeu, sizev) */
|
/* dl->flag */
|
||||||
|
#define DL_CYCL_U 1
|
||||||
|
#define DL_CYCL_V 2
|
||||||
|
|
||||||
/* prototypes */
|
/* prototypes */
|
||||||
|
|
||||||
|
|||||||
@@ -790,7 +790,7 @@ void addnormalsDispList(Object *ob, ListBase *lb)
|
|||||||
|
|
||||||
for(a=0; a<dl->parts; a++) {
|
for(a=0; a<dl->parts; a++) {
|
||||||
|
|
||||||
DL_SURFINDEX(dl->flag & 1, dl->flag & 2, dl->nr, dl->parts);
|
DL_SURFINDEX(dl->flag & DL_CYCL_U, dl->flag & DL_CYCL_V, dl->nr, dl->parts);
|
||||||
|
|
||||||
v1= vdata+ 3*p1;
|
v1= vdata+ 3*p1;
|
||||||
n1= ndata+ 3*p1;
|
n1= ndata+ 3*p1;
|
||||||
@@ -850,6 +850,7 @@ void shadeDispList(Object *ob)
|
|||||||
|
|
||||||
Mat4Invert(tmat, mat);
|
Mat4Invert(tmat, mat);
|
||||||
Mat3CpyMat4(imat, tmat);
|
Mat3CpyMat4(imat, tmat);
|
||||||
|
if(ob->transflag & OB_NEG_SCALE) Mat3MulFloat((float *)imat, -1.0);
|
||||||
|
|
||||||
/* we extract dl_verts, deform info */
|
/* we extract dl_verts, deform info */
|
||||||
dldeform= find_displist(&ob->disp, DL_VERTS);
|
dldeform= find_displist(&ob->disp, DL_VERTS);
|
||||||
@@ -1543,7 +1544,7 @@ static void bevels_to_filledpoly(Curve *cu, ListBase *dispbase)
|
|||||||
dl= dispbase->first;
|
dl= dispbase->first;
|
||||||
while(dl) {
|
while(dl) {
|
||||||
if(dl->type==DL_SURF) {
|
if(dl->type==DL_SURF) {
|
||||||
if(dl->flag==2) {
|
if(dl->flag == DL_CYCL_V) {
|
||||||
if(cu->flag & CU_BACK) {
|
if(cu->flag & CU_BACK) {
|
||||||
dlnew= MEM_callocN(sizeof(DispList), "filldisp");
|
dlnew= MEM_callocN(sizeof(DispList), "filldisp");
|
||||||
BLI_addtail(&front, dlnew);
|
BLI_addtail(&front, dlnew);
|
||||||
@@ -1736,14 +1737,14 @@ void makeDispList(Object *ob)
|
|||||||
if(draw==0) {
|
if(draw==0) {
|
||||||
dl->parts= nu->pntsv;
|
dl->parts= nu->pntsv;
|
||||||
dl->nr= nu->pntsu;
|
dl->nr= nu->pntsu;
|
||||||
if(nu->flagu & 1) dl->flag|= 1;
|
if(nu->flagu & 1) dl->flag|= DL_CYCL_U;
|
||||||
if(nu->flagv & 1) dl->flag|= 2;
|
if(nu->flagv & 1) dl->flag|= DL_CYCL_V;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dl->parts= nu->resolu; /* in reverse, because makeNurbfaces works that way */
|
dl->parts= nu->resolu; /* in reverse, because makeNurbfaces works that way */
|
||||||
dl->nr= nu->resolv;
|
dl->nr= nu->resolv;
|
||||||
if(nu->flagv & 1) dl->flag|= 1; /* reverse too! */
|
if(nu->flagv & 1) dl->flag|= DL_CYCL_U; /* reverse too! */
|
||||||
if(nu->flagu & 1) dl->flag|= 2;
|
if(nu->flagu & 1) dl->flag|= DL_CYCL_V;
|
||||||
}
|
}
|
||||||
dl->col= nu->mat_nr;
|
dl->col= nu->mat_nr;
|
||||||
|
|
||||||
@@ -1837,8 +1838,8 @@ void makeDispList(Object *ob)
|
|||||||
|
|
||||||
dl->type= DL_SURF;
|
dl->type= DL_SURF;
|
||||||
dl->flag= 0;
|
dl->flag= 0;
|
||||||
if(dlb->type==DL_POLY) dl->flag++;
|
if(dlb->type==DL_POLY) dl->flag |= DL_CYCL_U;
|
||||||
if(bl->poly>=0) dl->flag+=2;
|
if(bl->poly>=0) dl->flag |= DL_CYCL_V;
|
||||||
|
|
||||||
dl->parts= bl->nr;
|
dl->parts= bl->nr;
|
||||||
dl->nr= dlb->nr;
|
dl->nr= dlb->nr;
|
||||||
@@ -1897,6 +1898,7 @@ void makeDispList(Object *ob)
|
|||||||
tex_space_curve(cu);
|
tex_space_curve(cu);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1178,7 +1178,7 @@ void where_is_object_time(Object *ob, float ctime)
|
|||||||
{
|
{
|
||||||
Object *par;
|
Object *par;
|
||||||
float *fp1, *fp2, slowmat[4][4] = MAT4_UNITY;
|
float *fp1, *fp2, slowmat[4][4] = MAT4_UNITY;
|
||||||
float stime, fac1, fac2;
|
float stime, fac1, fac2, vec[3];
|
||||||
int a;
|
int a;
|
||||||
int pop;
|
int pop;
|
||||||
|
|
||||||
@@ -1258,6 +1258,11 @@ void where_is_object_time(Object *ob, float ctime)
|
|||||||
if(ob->scriptlink.totscript && !during_script()) {
|
if(ob->scriptlink.totscript && !during_script()) {
|
||||||
BPY_do_pyscript((ID *)ob, SCRIPT_REDRAW);
|
BPY_do_pyscript((ID *)ob, SCRIPT_REDRAW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* set negative scale flag in object */
|
||||||
|
Crossf(vec, ob->obmat[0], ob->obmat[1]);
|
||||||
|
if( Inpf(vec, ob->obmat[2]) < 0.0 ) ob->transflag |= OB_NEG_SCALE;
|
||||||
|
else ob->transflag &= ~OB_NEG_SCALE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void solve_parenting (Object *ob, Object *par, float slowmat[][4], int simul)
|
static void solve_parenting (Object *ob, Object *par, float slowmat[][4], int simul)
|
||||||
|
|||||||
@@ -195,12 +195,6 @@ extern Object workob;
|
|||||||
|
|
||||||
/* used many places... should be specialized */
|
/* used many places... should be specialized */
|
||||||
#define SELECT 1
|
#define SELECT 1
|
||||||
#define ACTIVE 2
|
|
||||||
#define GONNA_MOVE 32 /* temporary, for figuring what stuff needs
|
|
||||||
* updating during transform due to parenting
|
|
||||||
* or constraints... do not rely on this value
|
|
||||||
* unless you are me (CW).
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* type */
|
/* type */
|
||||||
#define OB_EMPTY 0
|
#define OB_EMPTY 0
|
||||||
@@ -235,6 +229,7 @@ extern Object workob;
|
|||||||
/* char! transflag */
|
/* char! transflag */
|
||||||
#define OB_OFFS_LOCAL 1
|
#define OB_OFFS_LOCAL 1
|
||||||
#define OB_QUAT 2
|
#define OB_QUAT 2
|
||||||
|
#define OB_NEG_SCALE 4
|
||||||
#define OB_DUPLI (8+16)
|
#define OB_DUPLI (8+16)
|
||||||
#define OB_DUPLIFRAMES 8
|
#define OB_DUPLIFRAMES 8
|
||||||
#define OB_DUPLIVERTS 16
|
#define OB_DUPLIVERTS 16
|
||||||
@@ -291,12 +286,14 @@ extern Object workob;
|
|||||||
#define OB_BOUND_POLYH 4
|
#define OB_BOUND_POLYH 4
|
||||||
|
|
||||||
/* also needed for base!!!!! or rather, thy interfere....*/
|
/* also needed for base!!!!! or rather, thy interfere....*/
|
||||||
/* base->flag en ob->flag */
|
/* base->flag and ob->flag */
|
||||||
#define BA_WASSEL 2
|
#define BA_WASSEL 2
|
||||||
#define BA_PARSEL 4
|
#define BA_PARSEL 4
|
||||||
#define BA_WHERE_UPDATE 8
|
#define BA_WHERE_UPDATE 8
|
||||||
#define BA_DISP_UPDATE 16
|
#define BA_DISP_UPDATE 16
|
||||||
#define BA_DO_IPO 32
|
#define BA_DO_IPO 32
|
||||||
|
#define OB_GONNA_MOVE 32
|
||||||
|
|
||||||
#define BA_FROMSET 128
|
#define BA_FROMSET 128
|
||||||
#define OB_DO_IMAT 256
|
#define OB_DO_IMAT 256
|
||||||
#define OB_FROMDUPLI 512
|
#define OB_FROMDUPLI 512
|
||||||
|
|||||||
@@ -360,18 +360,7 @@ typedef struct Scene {
|
|||||||
#define RAD_PHASE_PATCHES 1
|
#define RAD_PHASE_PATCHES 1
|
||||||
#define RAD_PHASE_FACES 2
|
#define RAD_PHASE_FACES 2
|
||||||
|
|
||||||
/* base->flag and ob->flag */
|
/* base->flag is in DNA_object_types.h */
|
||||||
#define BA_WASSEL 2
|
|
||||||
#define BA_PARSEL 4
|
|
||||||
#define BA_WHERE_UPDATE 8
|
|
||||||
#define BA_DISP_UPDATE 16
|
|
||||||
#define BA_DO_IPO 32
|
|
||||||
#define BA_FROMSET 128
|
|
||||||
#define OB_DO_IMAT 256
|
|
||||||
#define OB_FROMDUPLI 512
|
|
||||||
#define OB_DONE 1024
|
|
||||||
#define OB_RADIO 2048
|
|
||||||
#define OB_FROMGROUP 4096
|
|
||||||
|
|
||||||
/* sce->flag */
|
/* sce->flag */
|
||||||
#define SCE_ADDSCENAME 1
|
#define SCE_ADDSCENAME 1
|
||||||
|
|||||||
@@ -1297,7 +1297,7 @@ static void drawDispListwire(ListBase *dlbase)
|
|||||||
parts= dl->parts;
|
parts= dl->parts;
|
||||||
while(parts--) {
|
while(parts--) {
|
||||||
nr= dl->nr;
|
nr= dl->nr;
|
||||||
if(dl->flag & 1) glBegin(GL_LINE_LOOP);
|
if(dl->flag & DL_CYCL_U) glBegin(GL_LINE_LOOP);
|
||||||
else glBegin(GL_LINE_STRIP);
|
else glBegin(GL_LINE_STRIP);
|
||||||
|
|
||||||
while(nr--) {
|
while(nr--) {
|
||||||
@@ -1311,7 +1311,7 @@ static void drawDispListwire(ListBase *dlbase)
|
|||||||
while(nr--) {
|
while(nr--) {
|
||||||
data= ( dl->verts )+3*nr;
|
data= ( dl->verts )+3*nr;
|
||||||
parts= dl->parts;
|
parts= dl->parts;
|
||||||
if(dl->flag & 2) glBegin(GL_LINE_LOOP);
|
if(dl->flag & DL_CYCL_V) glBegin(GL_LINE_LOOP);
|
||||||
else glBegin(GL_LINE_STRIP);
|
else glBegin(GL_LINE_STRIP);
|
||||||
|
|
||||||
while(parts--) {
|
while(parts--) {
|
||||||
@@ -1374,9 +1374,14 @@ static void drawDispListsolid(ListBase *lb, Object *ob)
|
|||||||
int drawsmooth= !(G.f & G_BACKBUFSEL);
|
int drawsmooth= !(G.f & G_BACKBUFSEL);
|
||||||
|
|
||||||
if(lb==0) return;
|
if(lb==0) return;
|
||||||
|
|
||||||
|
/* drawsmooth abused here, except for Mesh this draws with smooth default */
|
||||||
if (drawsmooth) {
|
if (drawsmooth) {
|
||||||
glShadeModel(GL_SMOOTH);
|
glShadeModel(GL_SMOOTH);
|
||||||
glEnable(GL_LIGHTING);
|
glEnable(GL_LIGHTING);
|
||||||
|
|
||||||
|
if(ob->transflag & OB_NEG_SCALE) glFrontFace(GL_CW);
|
||||||
|
else glFrontFace(GL_CCW);
|
||||||
}
|
}
|
||||||
|
|
||||||
dl= lb->first;
|
dl= lb->first;
|
||||||
@@ -1389,7 +1394,7 @@ static void drawDispListsolid(ListBase *lb, Object *ob)
|
|||||||
if(!drawsmooth) {
|
if(!drawsmooth) {
|
||||||
for(a=0; a<dl->parts; a++) {
|
for(a=0; a<dl->parts; a++) {
|
||||||
|
|
||||||
DL_SURFINDEX(dl->flag & 1, dl->flag & 2, dl->nr, dl->parts);
|
DL_SURFINDEX(dl->flag & DL_CYCL_U, dl->flag & DL_CYCL_V, dl->nr, dl->parts);
|
||||||
|
|
||||||
v1= data+ 3*p1;
|
v1= data+ 3*p1;
|
||||||
v2= data+ 3*p2;
|
v2= data+ 3*p2;
|
||||||
@@ -1420,7 +1425,7 @@ static void drawDispListsolid(ListBase *lb, Object *ob)
|
|||||||
|
|
||||||
for(a=0; a<dl->parts; a++) {
|
for(a=0; a<dl->parts; a++) {
|
||||||
|
|
||||||
DL_SURFINDEX(dl->flag & 1, dl->flag & 2, dl->nr, dl->parts);
|
DL_SURFINDEX(dl->flag & DL_CYCL_U, dl->flag & DL_CYCL_V, dl->nr, dl->parts);
|
||||||
|
|
||||||
v1= data+ 3*p1;
|
v1= data+ 3*p1;
|
||||||
v2= data+ 3*p2;
|
v2= data+ 3*p2;
|
||||||
@@ -1560,6 +1565,7 @@ static void drawDispListsolid(ListBase *lb, Object *ob)
|
|||||||
if(drawsmooth) {
|
if(drawsmooth) {
|
||||||
glShadeModel(GL_FLAT);
|
glShadeModel(GL_FLAT);
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
|
glFrontFace(GL_CCW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1588,7 +1594,7 @@ static void drawDispListshaded(ListBase *lb, Object *ob)
|
|||||||
|
|
||||||
for(a=0; a<dl->parts; a++) {
|
for(a=0; a<dl->parts; a++) {
|
||||||
|
|
||||||
DL_SURFINDEX(dl->flag & 1, dl->flag & 2, dl->nr, dl->parts);
|
DL_SURFINDEX(dl->flag & DL_CYCL_U, dl->flag & DL_CYCL_V, dl->nr, dl->parts);
|
||||||
|
|
||||||
v1= data+ 3*p1;
|
v1= data+ 3*p1;
|
||||||
v2= data+ 3*p2;
|
v2= data+ 3*p2;
|
||||||
@@ -1714,7 +1720,11 @@ static void drawmeshsolid(Object *ob, float *nors)
|
|||||||
if( (G.f & G_BACKBUFSEL)==0 ) {
|
if( (G.f & G_BACKBUFSEL)==0 ) {
|
||||||
glEnable(GL_LIGHTING);
|
glEnable(GL_LIGHTING);
|
||||||
init_gl_materials(ob);
|
init_gl_materials(ob);
|
||||||
|
|
||||||
two_sided( me->flag & ME_TWOSIDED );
|
two_sided( me->flag & ME_TWOSIDED );
|
||||||
|
|
||||||
|
if(ob->transflag & OB_NEG_SCALE) glFrontFace(GL_CW);
|
||||||
|
else glFrontFace(GL_CCW);
|
||||||
}
|
}
|
||||||
|
|
||||||
mface= me->mface;
|
mface= me->mface;
|
||||||
@@ -1917,7 +1927,7 @@ static void drawmeshsolid(Object *ob, float *nors)
|
|||||||
glDisable(GL_CULL_FACE);
|
glDisable(GL_CULL_FACE);
|
||||||
}
|
}
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
|
glFrontFace(GL_CCW);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void drawmeshshaded(Object *ob, unsigned int *col1, unsigned int *col2)
|
static void drawmeshshaded(Object *ob, unsigned int *col1, unsigned int *col2)
|
||||||
|
|||||||
@@ -2913,13 +2913,13 @@ void clear_gonna_move(void) {
|
|||||||
|
|
||||||
/* clear the gonna move flag */
|
/* clear the gonna move flag */
|
||||||
for (base= FIRSTBASE; base; base= base->next) {
|
for (base= FIRSTBASE; base; base= base->next) {
|
||||||
base->object->flag &= ~GONNA_MOVE;
|
base->object->flag &= ~OB_GONNA_MOVE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int is_parent_gonna_move(Object *ob) {
|
int is_parent_gonna_move(Object *ob) {
|
||||||
if ( (ob->parent) &&
|
if ( (ob->parent) &&
|
||||||
(ob->parent->flag & GONNA_MOVE) ) {
|
(ob->parent->flag & OB_GONNA_MOVE) ) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -2932,7 +2932,7 @@ int is_constraint_target_gonna_move(Object *ob) {
|
|||||||
|
|
||||||
for (con = ob->constraints.first; con; con=con->next) {
|
for (con = ob->constraints.first; con; con=con->next) {
|
||||||
if ( (tarOb = get_con_target(con)) ) {
|
if ( (tarOb = get_con_target(con)) ) {
|
||||||
if (tarOb->flag & GONNA_MOVE )
|
if (tarOb->flag & OB_GONNA_MOVE )
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2941,7 +2941,7 @@ int is_constraint_target_gonna_move(Object *ob) {
|
|||||||
for (chan = ob->pose->chanbase.first; chan; chan=chan->next){
|
for (chan = ob->pose->chanbase.first; chan; chan=chan->next){
|
||||||
for (con = chan->constraints.first; con; con=con->next) {
|
for (con = chan->constraints.first; con; con=con->next) {
|
||||||
if ( (tarOb = get_con_target(con)) ) {
|
if ( (tarOb = get_con_target(con)) ) {
|
||||||
if (tarOb->flag & GONNA_MOVE )
|
if (tarOb->flag & OB_GONNA_MOVE )
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2963,19 +2963,19 @@ void flag_moving_objects(void) {
|
|||||||
oldnumgonnamove = numgonnamove;
|
oldnumgonnamove = numgonnamove;
|
||||||
numgonnamove = 0;
|
numgonnamove = 0;
|
||||||
for (base= FIRSTBASE; base; base= base->next) {
|
for (base= FIRSTBASE; base; base= base->next) {
|
||||||
if (base->object->flag & GONNA_MOVE) {
|
if (base->object->flag & OB_GONNA_MOVE) {
|
||||||
++numgonnamove;
|
++numgonnamove;
|
||||||
}
|
}
|
||||||
else if (base->flag & SELECT) {
|
else if (base->flag & SELECT) {
|
||||||
base->object->flag |= GONNA_MOVE;
|
base->object->flag |= OB_GONNA_MOVE;
|
||||||
++numgonnamove;
|
++numgonnamove;
|
||||||
}
|
}
|
||||||
else if (is_parent_gonna_move(base->object)) {
|
else if (is_parent_gonna_move(base->object)) {
|
||||||
base->object->flag |= GONNA_MOVE;
|
base->object->flag |= OB_GONNA_MOVE;
|
||||||
++numgonnamove;
|
++numgonnamove;
|
||||||
}
|
}
|
||||||
else if (is_constraint_target_gonna_move(base->object)) {
|
else if (is_constraint_target_gonna_move(base->object)) {
|
||||||
base->object->flag |= GONNA_MOVE;
|
base->object->flag |= OB_GONNA_MOVE;
|
||||||
++numgonnamove;
|
++numgonnamove;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3007,8 +3007,8 @@ static int pose_do_update_flag(Object *ob) {
|
|||||||
for (base= FIRSTBASE; base; base= base->next) {
|
for (base= FIRSTBASE; base; base= base->next) {
|
||||||
if (is_ob_constraint_target(base->object,
|
if (is_ob_constraint_target(base->object,
|
||||||
&chan->constraints)) {
|
&chan->constraints)) {
|
||||||
if( (base->object->flag & GONNA_MOVE) ||
|
if( (base->object->flag & OB_GONNA_MOVE) ||
|
||||||
(ob->flag & GONNA_MOVE)) {
|
(ob->flag & OB_GONNA_MOVE)) {
|
||||||
Bone *bone;
|
Bone *bone;
|
||||||
/* If this armature is selected, or if the
|
/* If this armature is selected, or if the
|
||||||
* object that is the target of a constraint
|
* object that is the target of a constraint
|
||||||
|
|||||||
@@ -118,9 +118,12 @@
|
|||||||
#define FILESELHEAD 60
|
#define FILESELHEAD 60
|
||||||
#define FILESEL_DY 16
|
#define FILESEL_DY 16
|
||||||
|
|
||||||
|
/* for events */
|
||||||
#define NOTACTIVE 0
|
#define NOTACTIVE 0
|
||||||
#define ACTIVATE 1
|
#define ACTIVATE 1
|
||||||
#define INACTIVATE 2
|
#define INACTIVATE 2
|
||||||
|
/* for state of file */
|
||||||
|
#define ACTIVE 2
|
||||||
|
|
||||||
#define STARTSWITH(x, y) (strncmp(x, y, sizeof(x) - 1) == 0)
|
#define STARTSWITH(x, y) (strncmp(x, y, sizeof(x) - 1) == 0)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user