td->ext = NULL;
td->tdi = NULL;
td->val = NULL;
+ td->tdmir= NULL;
}
+ /* *********************** CrazySpace correction. Now without doing subsurf optimal ****************** */
+
static void make_vertexcos__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s)
{
float *vec = userData;
EditMesh *em = G.editMesh;
EditVert *eve, *prev;
EditFace *efa;
- float q1[4], q2[4];
- float *v1, *v2, *v3, *quatp;
+ float *v1, *v2, *v3, *v4;
int index= 0;
- /* 2 abused locations in vertices */
+ /* two abused locations in vertices */
for(eve= em->verts.first; eve; eve= eve->next, index++) {
- eve->vn= NULL;
+ eve->tmp.fp = NULL;
eve->prev= (EditVert *)index;
}
- quatp= quats;
+ /* first store two sets of tangent vectors in vertices, we derive it just from the face-edges */
for(efa= em->faces.first; efa; efa= efa->next) {
- /* vertex f1 flags were set for transform */
- if( (efa->v1->f1 && efa->v1->tmp.fp==NULL) ||
- (efa->v2->f1 && efa->v2->tmp.fp==NULL) ||
- (efa->v3->f1 && efa->v3->tmp.fp==NULL) ||
- (efa->v4 && efa->v4->f1 && efa->v4->tmp.fp==NULL) ) {
+ /* retrieve mapped coordinates */
+ v1= mappedcos + 3*( (int)(efa->v1->prev) );
+ v2= mappedcos + 3*( (int)(efa->v2->prev) );
+ v3= mappedcos + 3*( (int)(efa->v3->prev) );
- triatoquat(efa->v1->co, efa->v2->co, efa->v3->co, q1);
-
- /* retrieve mapped coordinates */
- v1= mappedcos + 3*( (int)(efa->v1->prev) );
- v2= mappedcos + 3*( (int)(efa->v2->prev) );
- v3= mappedcos + 3*( (int)(efa->v3->prev) );
- triatoquat(v1, v2, v3, q2);
-
- QuatSub(quatp, q2, q1);
- if(efa->v2->vn==NULL && efa->v2->f1) {
++ if(efa->v2->tmp.fp==NULL && efa->v2->f1) {
+ set_crazy_vertex_quat(quats, efa->v2->co, efa->v3->co, efa->v1->co, v2, v3, v1);
- efa->v2->vn= (EditVert *)(quats);
++ efa->v2->tmp.fp= quats;
+ quats+= 4;
+ }
+
+ if(efa->v4) {
+ v4= mappedcos + 3*( (int)(efa->v4->prev) );
- if(efa->v1->f1) quatp= crazy_quat_blend(efa->v1, quatp);
- if(efa->v2->f1) quatp= crazy_quat_blend(efa->v2, quatp);
- if(efa->v3->f1) quatp= crazy_quat_blend(efa->v3, quatp);
- if(efa->v4 && efa->v4->f1) quatp= crazy_quat_blend(efa->v4, quatp);
- if(efa->v1->vn==NULL && efa->v1->f1) {
++ if(efa->v1->tmp.fp==NULL && efa->v1->f1) {
+ set_crazy_vertex_quat(quats, efa->v1->co, efa->v2->co, efa->v4->co, v1, v2, v4);
- efa->v1->vn= (EditVert *)(quats);
++ efa->v1->tmp.fp= quats;
+ quats+= 4;
+ }
- if(efa->v3->vn==NULL && efa->v3->f1) {
++ if(efa->v3->tmp.fp==NULL && efa->v3->f1) {
+ set_crazy_vertex_quat(quats, efa->v3->co, efa->v4->co, efa->v2->co, v3, v4, v2);
- efa->v3->vn= (EditVert *)(quats);
++ efa->v3->tmp.fp= quats;
+ quats+= 4;
+ }
- if(efa->v4->vn==NULL && efa->v4->f1) {
++ if(efa->v4->tmp.fp==NULL && efa->v4->f1) {
+ set_crazy_vertex_quat(quats, efa->v4->co, efa->v1->co, efa->v3->co, v4, v1, v3);
- efa->v4->vn= (EditVert *)(quats);
++ efa->v4->tmp.fp= quats;
+ quats+= 4;
+ }
+ }
+ else {
- if(efa->v1->vn==NULL && efa->v1->f1) {
++ if(efa->v1->tmp.fp==NULL && efa->v1->f1) {
+ set_crazy_vertex_quat(quats, efa->v1->co, efa->v2->co, efa->v3->co, v1, v2, v3);
- efa->v1->vn= (EditVert *)(quats);
++ efa->v1->tmp.fp= quats;
+ quats+= 4;
+ }
- if(efa->v3->vn==NULL && efa->v3->f1) {
++ if(efa->v3->tmp.fp==NULL && efa->v3->f1) {
+ set_crazy_vertex_quat(quats, efa->v3->co, efa->v1->co, efa->v2->co, v3, v1, v2);
- efa->v3->vn= (EditVert *)(quats);
++ efa->v3->tmp.fp= quats;
+ quats+= 4;
+ }
}
}