Revision: 18090
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18090
Author:   eman
Date:     2008-12-27 00:29:38 +0100 (Sat, 27 Dec 2008)

Log Message:
-----------
Fix for a bug introduced with new drawmode stuff.
A fix from Laurynas or a bug where clamped/unclamped curves were not respected 
after extrusion.
Temporary fix for Isoline drawing glitches (does not respect occlude geometry 
yet)
TODO: Ctrl-F (skinning) needs to be fixed

Modified Paths:
--------------
    branches/nurbs/blender/intern/nurbana/intern/Object_NURBS.cpp
    branches/nurbs/blender/intern/nurbana/intern/Object_NURBS.h
    branches/nurbs/blender/intern/nurbana/intern/Object_Primitives.cpp
    branches/nurbs/blender/source/blender/src/drawobject.c

Modified: branches/nurbs/blender/intern/nurbana/intern/Object_NURBS.cpp
===================================================================
--- branches/nurbs/blender/intern/nurbana/intern/Object_NURBS.cpp       
2008-12-26 20:50:06 UTC (rev 18089)
+++ branches/nurbs/blender/intern/nurbana/intern/Object_NURBS.cpp       
2008-12-26 23:29:38 UTC (rev 18090)
@@ -281,11 +281,19 @@
   return(UV) ? *_OrderUV[1] : *_OrderUV[0];
 } //eof Object_NURBS::Order()
 
+void Object_NURBS::setEndType(bool UV, short t) {
+       if (NURBS_KV_Periodic == t)
+               Cyclic (UV, 1);
+       else if (NURBS_KV_Open == t)
+               *(_FlagUV [UV]) = 2;//: 0);
+       KnotType(UV, t);
+}
 
+
 void Object_NURBS::KnotType(bool UV, short t) {
-  *_KnotTypeUV[UV]= t;
-       if(t != NURBS_KV_Custom)
-               _RecalculateKnotVector= 1;
+    *_KnotTypeUV[UV] = t;
+    if(t != NURBS_KV_Custom)
+        _RecalculateKnotVector = 1;
 } //eof Object_NURBS::KnotType()
 
 

Modified: branches/nurbs/blender/intern/nurbana/intern/Object_NURBS.h
===================================================================
--- branches/nurbs/blender/intern/nurbana/intern/Object_NURBS.h 2008-12-26 
20:50:06 UTC (rev 18089)
+++ branches/nurbs/blender/intern/nurbana/intern/Object_NURBS.h 2008-12-26 
23:29:38 UTC (rev 18090)
@@ -46,7 +46,9 @@
     void               SetIsoDensity(int V);
 
     void               Order(bool UV, short v);
-    int                        Order(int UV);    
+    int                        Order(int UV);
+    
+    void        setEndType(bool UV, short t);
 
     void               KnotType(bool UV, short t);
     short              KnotType(bool UV);

Modified: branches/nurbs/blender/intern/nurbana/intern/Object_Primitives.cpp
===================================================================
--- branches/nurbs/blender/intern/nurbana/intern/Object_Primitives.cpp  
2008-12-26 20:50:06 UTC (rev 18089)
+++ branches/nurbs/blender/intern/nurbana/intern/Object_Primitives.cpp  
2008-12-26 23:29:38 UTC (rev 18090)
@@ -15,7 +15,7 @@
        Object_NURBS &no = *ptr;
        no.Order(0, 4);
        no.Order(1, 4);
-       no.KnotType(0, NURBS_KV_Open);
+    no.setEndType(0, NURBS_KV_Open);
        
        no.SetLengthRef(lengthU, lengthV);
        no.Length(0, lengthU);
@@ -46,8 +46,8 @@
        ctlPts++;
     }
     
-    NURBS_Generate::KnotVector(ptr);
-    no.RecalculateKnotVector(1);
+    NURBS_Generate::KnotVector(ptr, 0);
+    no.RecalculateKnotVector(0);
 }
 
 
@@ -57,8 +57,8 @@
     Object_NURBS &no = *ptr;
        no.Order(0, 4);
        no.Order(1, 4);
-       no.KnotType(0, NURBS_KV_Open);
-       no.KnotType(1, NURBS_KV_Open);
+    no.setEndType(0, NURBS_KV_Open);
+    no.setEndType(1, NURBS_KV_Open);
        
        no.SetLengthRef(lengthU, lengthV);
        no.Length(0, lengthU);
@@ -99,9 +99,9 @@
        const int lengthV = 1;
        const nbReal radius = 1;
        Object_NURBS &no = *ptr;
-       no.KnotType(0, NURBS_KV_Periodic);
+    no.setEndType(0, NURBS_KV_Periodic);
        no.Order(0, 4);
-       no.Cyclic(0, 1);
+//     no.Cyclic(0, 1);
 
        no.SetLengthRef(lengthU, lengthV);
 
@@ -129,11 +129,11 @@
     const int lengthV = 2;
     const nbReal radius = 1;
     Object_NURBS &no = *ptr;
-    no.KnotType(0, NURBS_KV_Periodic);
-    no.KnotType(1, NURBS_KV_Open);
+    no.setEndType(0, NURBS_KV_Periodic);
+    no.setEndType(1, NURBS_KV_Open);
     no.Order(0, 4);
     no.Order(1, 2);
-    no.Cyclic(0, 1);
+//    no.Cyclic(0, 1);
 
     no.SetLengthRef(lengthU, lengthV);
 
@@ -168,10 +168,10 @@
        Object_NURBS &no = *ptr;
        no.Order(0, 4);
        no.Order(1, 4);
-       no.Cyclic(0, 1);
-       no.Cyclic(1, 1);
-    no.KnotType(0, NURBS_KV_Periodic);
-    no.KnotType(1, NURBS_KV_Periodic);
+//     no.Cyclic(0, 1);
+//     no.Cyclic(1, 1);
+    no.setEndType(0, NURBS_KV_Periodic);
+    no.setEndType(1, NURBS_KV_Periodic);
        no.SetLengthRef(lengthU, lengthV);
     no.Length(0, lengthU);
     no.Length(1, lengthV);
@@ -206,9 +206,9 @@
     const int lengthV = 5;
     const nbReal radius = 1;
     Object_NURBS &no = *ptr;
-    no.Cyclic(0, 1);
-    no.KnotType(0, NURBS_KV_Periodic);
-    no.KnotType(1, NURBS_KV_Open);
+//    no.Cyclic(0, 1);
+    no.setEndType(0, NURBS_KV_Periodic);
+    no.setEndType(1, NURBS_KV_Open);
     no.Order(0, 4);
     no.Order(1, 3);
     no.SetLengthRef(lengthU, lengthV);

Modified: branches/nurbs/blender/source/blender/src/drawobject.c
===================================================================
--- branches/nurbs/blender/source/blender/src/drawobject.c      2008-12-26 
20:50:06 UTC (rev 18089)
+++ branches/nurbs/blender/source/blender/src/drawobject.c      2008-12-26 
23:29:38 UTC (rev 18090)
@@ -3828,7 +3828,7 @@
        float vec[3];
        float imat[4][4];
        View3D *v3d= G.vd;
-GLUquadricObj *qobj = gluNewQuadric(); 
+       GLUquadricObj *qobj = gluNewQuadric(); 
 
        if(nu->hide) return;
 
@@ -3842,9 +3842,9 @@
        size= BIF_GetThemeValuef(TH_VERTEX_SIZE);
        glPointSize(size);
 
-       bglBegin(GL_POINTS);
 
        if((nu->type & 7)==1) {
+               bglBegin(GL_POINTS);
 
                bezt= nu->bezt;
                a= nu->pntsu;
@@ -3861,20 +3861,23 @@
 
                        bezt++;
                }
+               bglEnd();
        }
        else {
                bp= nu->bp;
                a= nu->pntsu*nu->pntsv;
                while(a--) {
                        if(bp->hide==0) {
+               bglBegin(GL_POINTS);
                                if((bp->f1 & SELECT)==sel) 
bglVertex3fv(bp->vec);
+               bglEnd();
                        }
 
                        Mat4CpyMat4(imat,G.vd->viewinv);// 
ob->obmat);//G.vd->viewinv);
                
                        Normalize(imat[0]);
                        Normalize(imat[1]);
-                       Mat4MulVecfl(imat,ob->rot);
+                       //Mat4MulVecfl(imat,ob->rot);
                        pixsize= v3d->persmat[0][3]*ob->obmat[3][0]+ 
v3d->persmat[1][3]*ob->obmat[3][1]+ v3d->persmat[2][3]*ob->obmat[3][2]+ 
v3d->persmat[3][3];
                        pixsize*= v3d->pixsize;
                        dotSize= pixsize*(size);//*0.4f);
@@ -3889,21 +3892,27 @@
                                // Old style CP vertex draw
                                if(0)
                                {
+                                       glPushMatrix();
                                        bglBegin(GL_POINTS);
                                        bglVertex3fv(bp->vec);
                                        bglEnd();
+                                       glPopMatrix();
                                }
                                else
                                {
                                        // Not sure why it doesn't work without 
this - eman
-                                       glBegin(GL_POLYGON);
-                                       glEnd();
+                               //      glBegin(GL_POLYGON);
+                               //      glEnd();
 
+                                       glPushMatrix();
                                        // Disable writing to the depth mask, 
this allows nested spheres to draw correctly, but also be occluded by geometry
                                        glDepthMask(GL_FALSE);
-                                       glPushMatrix();
 
+                                       glPointSize(3);
                                        bglPolygonOffset(1.0);
+                               //      bglBegin(GL_POINTS);
+                               //      bglVertex3fv(bp->vec);
+                               //      bglEnd();
                                        glTranslatef(vec[0], vec[1], vec[2]);
                                        dotSize *= 1.5;
                                        glScalef(dotSize, dotSize, dotSize);
@@ -3921,10 +3930,10 @@
                                        gluSphere(qobj, 0.7, 8, 5);
 
                                        bglPolygonOffset(0.0);
-                                       glPopMatrix();
                                        
                                        // Re-enable depth masking
                                        glDepthMask(GL_TRUE);
+                                       glPopMatrix();
                                }
                                bp++;
 
@@ -3932,7 +3941,6 @@
                }
        }
 
-       bglEnd();
        glPointSize(1.0);
        gluDeleteQuadric(qobj); 
 }
@@ -4071,6 +4079,9 @@
 
 
        DispList *dl;
+       if(G.vd->zbuf) glDisable(GL_DEPTH_TEST);
+glDepthMask(GL_FALSE);
+   
        nu= nurb;
        while(nu) {
                if(nu->hide==0) {
@@ -4128,6 +4139,8 @@
                nu= nu->next;
        }
        
+       glDepthMask(GL_FALSE);
+       glEnable(GL_DEPTH_TEST);
 }
 
 static void drawnurb(Base *base, Nurb *nurb, int dt)


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to