gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] libvob include/vob/vobs/Fillet.hxx vob/fillet/l...


From: Janne V. Kujala
Subject: [Gzz-commits] libvob include/vob/vobs/Fillet.hxx vob/fillet/l...
Date: Wed, 13 Aug 2003 09:36:21 -0400

CVSROOT:        /cvsroot/libvob
Module name:    libvob
Branch:         
Changes by:     Janne V. Kujala <address@hidden>        03/08/13 09:36:21

Modified files:
        include/vob/vobs: Fillet.hxx 
        vob/fillet     : light3d.py 

Log message:
        enable multifil rendering of unconnected nodes

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/vobs/Fillet.hxx.diff?tr1=1.49&tr2=1.50&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/vob/fillet/light3d.py.diff?tr1=1.33&tr2=1.34&r1=text&r2=text

Patches:
Index: libvob/include/vob/vobs/Fillet.hxx
diff -u libvob/include/vob/vobs/Fillet.hxx:1.49 
libvob/include/vob/vobs/Fillet.hxx:1.50
--- libvob/include/vob/vobs/Fillet.hxx:1.49     Thu Jul 10 08:09:36 2003
+++ libvob/include/vob/vobs/Fillet.hxx  Wed Aug 13 09:36:21 2003
@@ -126,16 +126,17 @@
 /** A vob which is used for graph rendering: given a number of coordinate 
systems,
  * it calls its child vob for each
  * @param single The child vob to call
+ * @param single0 The child vob to call in case of no non-const coordsyses
  * @param nconst The number of constant coordinate systems (minus one) to pass 
forth to the child.
  */
 struct IterConnections {
     enum { NTrans = -1 };
 
-    Vob *single;
+    Vob *single, *single0;
     int nconst;
 
     template<class F> void params(F &f) {
-       f(single, nconst);
+       f(single, single0, nconst);
     }
 
     void render(const Transform **t, int n) const {
@@ -145,6 +146,9 @@
 
        ct[nconst] = t[nconst + 0]; 
 
+       if (single0 && nconst + 1 == n)
+           single0->render(ct, nconst + 1);
+
        for(int i=nconst + 1; i<n; i++) {
            ct[nconst + 1] = t[i], 
            single->render(ct, nconst + 2);
@@ -563,7 +567,52 @@
        return ZVec(0,0,0);
     }
 
-    void render(const Transform **t, int) const {
+    vector<Vec> computeNormals(const vector<Vec> &v) const {
+       vector<Vec> n(v.size());
+
+       size_t i;
+       n[0] = (v[1] - v[0]).cw90().normalized();
+       for (i = 1; i < v.size() - 1; i++)
+           n[i] = (v[i+1] - v[i-1]).cw90().normalized();
+       n[v.size() - 1] = (v[v.size()-1] - v[v.size()-2]).cw90().normalized();
+       
+       return n;
+    }
+
+    void render(const Transform &t0) const {
+       ZVec p0 = t0.transform(0.5 * t0.getSqSize());
+       float r = crad(t0);
+       CircularNode node(ZVec(0,0,0), r);
+       CircularNodeSpan f0(node, 0, M_PI);
+       
+       int i;
+       vector<Vec> v;
+
+       for (i = 0; i <= ndice; i++)
+           v.push_back(f0.point((float)i / ndice));
+
+       ZVec e0 = (t0.transform(ZVec(0,0,1)) - 
t0.transform(ZVec(0,0,0))).normalized();
+       ZVec e1 = (t0.transform(ZVec(0,1,0)) - 
t0.transform(ZVec(0,0,0))).normalized();
+       ZVec e2 = (t0.transform(ZVec(1,0,0)) - 
t0.transform(ZVec(0,0,0))).normalized();
+
+       float mat[16] = {
+           e0.x, e0.y, e0.z, 0,
+           e1.x, e1.y, e1.z, 0,
+           e2.x, e2.y, e2.z, 0,
+           p0.x, p0.y, p0.z, 1,
+       };
+       glPushMatrix();
+       glMultMatrixf(mat);
+       render(v, computeNormals(v));
+       glPopMatrix();
+    }
+
+    void render(const Transform **t, int ntrans) const {
+       if (ntrans == 3) {
+           render(*t[2]);
+           return;
+       }
+
        const Transform &thick_t = *t[0];
        const Transform &angle_t = *t[1];
 
@@ -594,15 +643,6 @@
        for (i = 0; i <= ndice; i++)
            v.push_back(f0.point((float)i / ndice));
 
-       vector<Vec> n(v.size());
-
-       {
-           size_t i;
-           n[0] = (v[1] - v[0]).cw90().normalized();
-           for (i = 1; i < v.size() - 1; i++)
-               n[i] = (v[i+1] - v[i-1]).cw90().normalized();
-           n[v.size() - 1] = (v[v.size()-1] - 
v[v.size()-2]).cw90().normalized();
-       }
        
        ZVec ref = t0.transform(ZVec(0,0,1)) - t0.transform(ZVec(0,0,0));
        ZVec e0 = (p1 - p0).normalized();
@@ -617,7 +657,7 @@
        };
        glPushMatrix();
        glMultMatrixf(mat);
-       render(v, n);
+       render(v, computeNormals(v));
        glPopMatrix();
     }
 
Index: libvob/vob/fillet/light3d.py
diff -u libvob/vob/fillet/light3d.py:1.33 libvob/vob/fillet/light3d.py:1.34
--- libvob/vob/fillet/light3d.py:1.33   Sat Aug  9 10:39:45 2003
+++ libvob/vob/fillet/light3d.py        Wed Aug 13 09:36:21 2003
@@ -85,8 +85,9 @@
     float4 pos: POSITION,
     float3 norm: NORMAL,
     float4 tex0: TEXCOORD0,
+    float4 col: COLOR,
     out float4 opos: POSITION,
-    out float4 col: COLOR,
+    out float4 ocol: COLOR,
     out float4 otex0: TEXCOORD0
 ) {
     opos = mul(glstate.matrix.mvp, pos);
@@ -112,12 +113,13 @@
     float4 lighting = lit(diffuse, specular, 10);
 
 
-    col.rgb = lighting.y * diffusemat + lighting.z * specularmat
-              + max(diffuse2, 0) * diffusemat2;
+    ocol.rgb = lighting.y * diffusemat + lighting.z * specularmat
+              + max(diffuse2, 0) * diffusemat2
+              ;//+ max(-normvec.z, 0) * col;
     // Fog
     // float t = 8*mul(glstate.matrix.mvp, pos).z;
-    // col.rgb = col.rgb * (1 - t) + float3(1,.5,.2) * t;
-    col.a = 1;
+    // ocol.rgb = ocol.rgb * (1 - t) + float3(1,.5,.2) * t;
+    ocol.a = 1;
 
     otex0 = tex0 * float4(20, 20, 0, 1);
 }
@@ -299,9 +301,9 @@
                                     128 * self.sectors),
            2)
 
-        conns3d = GLRen.createIterConnections(
-           GLRen.createFillet3D(border, self.dice, 1),
-           2)
+        f3d = GLRen.createFillet3D(border, self.dice, 1);
+
+        conns3d = GLRen.createIterConnections(f3d, f3d, 2);
 
         conns3dblend = GLRen.createFillet3DBlend(self.dice, self.dicelen, 
self.tblsize, self.mode);
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]