gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] libvob doc/pegboard/vobn--tjl/peg.rst include/v...


From: Tuomas J. Lukka
Subject: [Gzz-commits] libvob doc/pegboard/vobn--tjl/peg.rst include/v...
Date: Thu, 29 May 2003 04:00:21 -0400

CVSROOT:        /cvsroot/libvob
Module name:    libvob
Changes by:     Tuomas J. Lukka <address@hidden>        03/05/29 04:00:20

Modified files:
        doc/pegboard/vobn--tjl: peg.rst 
        include/vob    : Renderer.hxx Vec23.hxx Vob.hxx 
        include/vob/geom: Quadrics.hxx 
        include/vob/jni: Generate.hxx Types.hxx 
        lava/blob      : fshape.py 
        org/nongnu/libvob: AbstractVob.java Vob.java VobPlacer.java 
                           VobScene.java 
        org/nongnu/libvob/gl: GL.java 
        org/nongnu/libvob/impl: DefaultVobMap.java 
        org/nongnu/libvob/impl/gl: GLVobMap.java 
        src/jni        : Main.cxx Modules Render.cxx 
        src/lines      : Lines.cxx 
        src/main       : Renderer.cxx 
Added files:
        include/vob/geom: Fillets.hxx 
        include/vob/vobs: Debug.hxx Fillet.hxx 
        vob/demo       : multifil.py 

Log message:
        A couple of days work on the laptop: Accept and Implement vobn, do 
first version of new fillet code for jvk

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/doc/pegboard/vobn--tjl/peg.rst.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/Renderer.hxx.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/Vec23.hxx.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/Vob.hxx.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/geom/Fillets.hxx?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/geom/Quadrics.hxx.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/jni/Generate.hxx.diff?tr1=1.21&tr2=1.22&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/jni/Types.hxx.diff?tr1=1.22&tr2=1.23&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/vobs/Debug.hxx?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/vobs/Fillet.hxx?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/lava/blob/fshape.py.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/AbstractVob.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/Vob.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/VobPlacer.java.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/VobScene.java.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/gl/GL.java.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/impl/DefaultVobMap.java.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/impl/gl/GLVobMap.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/jni/Main.cxx.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/jni/Modules.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/jni/Render.cxx.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/lines/Lines.cxx.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/main/Renderer.cxx.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/vob/demo/multifil.py?rev=1.1

Patches:
Index: libvob/doc/pegboard/vobn--tjl/peg.rst
diff -u libvob/doc/pegboard/vobn--tjl/peg.rst:1.1 
libvob/doc/pegboard/vobn--tjl/peg.rst:1.2
--- libvob/doc/pegboard/vobn--tjl/peg.rst:1.1   Thu May 22 05:17:45 2003
+++ libvob/doc/pegboard/vobn--tjl/peg.rst       Thu May 29 04:00:19 2003
@@ -3,9 +3,9 @@
 =============================================================
 
 :Author:   Tuomas J. Lukka
-:Last-Modified: $Date: 2003/05/22 09:17:45 $
-:Revision: $Revision: 1.1 $
-:Status:   Incomplete
+:Last-Modified: $Date: 2003/05/29 08:00:19 $
+:Revision: $Revision: 1.2 $
+:Status:   Implemented
 
 For the fillet tests (and probably also other things)
 we need N-coordinate system Vobs as a generalization
@@ -18,6 +18,11 @@
 
 Issues
 ======
+
+- Will the current 1, 2, 3 -cs methods be removed?
+
+    RESOLVED: No. They will remain for simplicity and
+    efficiency.
 
 Changes
 =======
Index: libvob/include/vob/Renderer.hxx
diff -u libvob/include/vob/Renderer.hxx:1.2 libvob/include/vob/Renderer.hxx:1.3
--- libvob/include/vob/Renderer.hxx:1.2 Sat Apr 19 15:37:32 2003
+++ libvob/include/vob/Renderer.hxx     Thu May 29 04:00:20 2003
@@ -29,11 +29,12 @@
 
     static bool sceneMoving;
 
-    static const int RENDERABLE0 = 0x0800000;
-    static const int RENDERABLE1 = 0x1000000;
-    static const int RENDERABLE2 = 0x2000000;
-    static const int RENDERABLE3 = 0x3000000;
-    static const int RMASK = 0xf800000;
+    static const int RENDERABLE0 = 0x1000000;
+    static const int RENDERABLE1 = 0x2000000;
+    static const int RENDERABLE2 = 0x3000000;
+    static const int RENDERABLE3 = 0x4000000;
+    static const int RENDERABLEN = 0x5000000;
+    static const int RMASK = 0x7000000;
 
     static void setStandardCoordinates(Vec wh);
     static void fpsTick();
@@ -59,7 +60,9 @@
                            ObjectStorer<Vob0> &r0s,
                            ObjectStorer<Vob1> &r1s,
                            ObjectStorer<Vob2> &r2s,
-                           ObjectStorer<Vob> &r3s) ;
+                           ObjectStorer<Vob3> &r3s,
+                           ObjectStorer<Vob> &rNs
+                           ) ;
 };
 
 
Index: libvob/include/vob/Vec23.hxx
diff -u libvob/include/vob/Vec23.hxx:1.7 libvob/include/vob/Vec23.hxx:1.8
--- libvob/include/vob/Vec23.hxx:1.7    Fri May 16 11:13:10 2003
+++ libvob/include/vob/Vec23.hxx        Thu May 29 04:00:20 2003
@@ -92,14 +92,27 @@
        Vector operator-(const Vector<T>&v) const { return Vector(x-v.x, 
y-v.y); }
        /** Return a vector like this, but rotated 90 degrees clockwise.
         */
-       Vector cw90() { return Vector(y, -x); }
+       Vector cw90() const { return Vector(y, -x); }
        /** Return the length of this vector.
         */
-       double length() { return hypot(x, y); }
+       double length() const { return hypot(x, y); }
 
        /** Dot this vector with another.
         */
        double dot(const Vector<T> &v) const { return x * v.x + y * v.y; }
+
+       /** Cross this 2D vector with another - 
+        * gives the sine of the angle between the two,
+        * multiplied by the lengths.
+        * Useful for telling which side of a given vector you are.
+        */
+       double cross(const Vector<T> &v) const {
+           return x * v.y - y * v.x;
+       }
+
+       double atan() const {
+           return atan2(x, y);
+       }
     };
 
     /** Multiply vector by scalar.
@@ -301,6 +314,7 @@
        HPoint2() {}
        HPoint2(T x, T y, T w) : x(x), y(y), w(w) { }
        HPoint2(ZPt p) : x(p.x), y(p.y), w(1) { }
+       HPoint2(Pt p) : x(p.x), y(p.y), w(1) { }
 
        HLine2<T> line(HPoint2 p) {
            T a, b, c;
@@ -354,6 +368,13 @@
 
     template<class T> T dot(Vector<T> a, Vector<T> b) { return a.dot(b); }
 
+
+    /** Give the direction vector for a given angle:
+     * (sin angle, cos angle).
+     */
+    inline Vec dirVec(float angle) {
+       return Vec(sin(angle), cos(angle));
+    }
 }
 
 // Export some to Vob
@@ -363,5 +384,6 @@
 using Vec23::Pt;
 using Vec23::Vec;
 using Vec23::lerp;
+using Vec23::dirVec;
 }
 #endif
Index: libvob/include/vob/Vob.hxx
diff -u libvob/include/vob/Vob.hxx:1.8 libvob/include/vob/Vob.hxx:1.9
--- libvob/include/vob/Vob.hxx:1.8      Sat Apr 19 15:37:32 2003
+++ libvob/include/vob/Vob.hxx  Thu May 29 04:00:20 2003
@@ -89,6 +89,22 @@
        virtual void render2(const Transform &t0, const Transform &t1) const = 
0;
     };
 
+    /** A vob which uses two coordinate systems. A specialization
+     * of Vob for efficiency.
+     */
+    class Vob3 : public Vob {
+    public:
+       virtual ~Vob3() {}
+       virtual int nCoordsys() const { return 3; };
+       virtual void render(const Transform **t, int n) const { 
+           render3(*(t[0]), *(t[1]), *(t[2])); 
+       }
+       virtual void render3(const Transform &t0, 
+                       const Transform &t1,
+                       const Transform &t2) const = 0;
+    };
+
+
     /** A template class which implements Vob, given a class with a render() 
method.
      * Used by the code generation mechanism to decouple defining Vobs from the
      * actual Vob interface.
@@ -124,6 +140,37 @@
        }
        virtual const char* getVobName() const { return name; }
     };
+
+    /** A template class which implements Vob, given a class with a render(t0, 
t1, t2) method.
+     * Used by the code generation mechanism to decouple defining Vobs from the
+     * actual Vob interface.
+     */
+    template<class VobSeed> class Vob3Maker : public Vob3, public VobSeed {
+       static char* name;
+       virtual void render3(const Transform &t0, 
+               const Transform &t1,
+               const Transform &t2
+               ) const {
+           VobSeed::render(t0, t1, t2);
+       }
+       virtual const char* getVobName() const { return name; }
+    };
+
+    /** A template class which implements Vob, given a class with a render(t 
**, n) method.
+     * Used by the code generation mechanism to decouple defining Vobs from the
+     * actual Vob interface.
+     */
+    template<class VobSeed> class VobNMaker : public Vob, public VobSeed {
+       static char* name;
+       virtual int nCoordsys() const {
+           return -1;
+       };
+       virtual void render(const Transform **t, int n) const {
+           VobSeed::render(t, n);
+       }
+       virtual const char* getVobName() const { return name; }
+    };
+
 
 }
 //@Include: Transform.hxx
Index: libvob/include/vob/geom/Quadrics.hxx
diff -u libvob/include/vob/geom/Quadrics.hxx:1.2 
libvob/include/vob/geom/Quadrics.hxx:1.3
--- libvob/include/vob/geom/Quadrics.hxx:1.2    Fri Apr  4 07:34:59 2003
+++ libvob/include/vob/geom/Quadrics.hxx        Thu May 29 04:00:20 2003
@@ -11,9 +11,12 @@
      * @param p the projection center
      * @param ctr The center of the circle
      * @param rad The radius of the circle
+     * @param ansdir -1 or 1 : 1 = take further-away answer
+     * @param success Optional, the pointer to a boolean set if the projection 
was possible.
      * @return The projected point, or if not possible, the original pt.
      */
-    inline Vec project2circle(Vec pt, Vec p, Vec ctr, float rad) {
+    inline Vec project2circle(Vec pt, Vec p, Vec ctr, float rad, int ansdir = 
1,
+           bool *success = 0) {
        Vec ao = pt - ctr;
        Vec ap = pt - p;
 
@@ -25,11 +28,42 @@
        // determinant of the equation
        float det = b*b - 4*a*c;
 
-       float ans = (det > 0 ? (-b + sqrt(det)) / (2*a) : 0);
+       float ans = (det > 0 ? (-b + ansdir * sqrt(det)) / (2*a) : 0);
+       if(success) *success = (det > 0);
 
        return pt + ans * ap;
 
     }
+
+    /** Given a point and a normal there and a circle,
+     * find the circle that passes through the point
+     * with the given normal (normal pointing to *center* 
+     * of circle) and is tangential to the circle.
+     * Norm must be normalized.
+     */
+    inline Vec circle__point_norm_circle(
+           Vec pt,
+           Vec norm,
+           Vec ctr,
+           float r,
+           bool *success = 0) {
+       Vec q = pt - r * norm;
+       Vec c = lerp(ctr, q, .5);
+       using namespace Vec23;
+       HL lc =  HPt(c).line(HPt(c + (q - ctr).cw90()));
+       HL ln =  HPt(q).line(pt);
+       HPt it = lc.intersection(ln);
+       if(it.finite()) {
+           if(success)
+               *success = 1;
+           return (Vec)it;
+       } else {
+           if(success)
+               *success = 0;
+           return pt;
+       }
+    }
+
 
 }
 }
Index: libvob/include/vob/jni/Generate.hxx
diff -u libvob/include/vob/jni/Generate.hxx:1.21 
libvob/include/vob/jni/Generate.hxx:1.22
--- libvob/include/vob/jni/Generate.hxx:1.21    Wed May 14 18:03:30 2003
+++ libvob/include/vob/jni/Generate.hxx Thu May 29 04:00:20 2003
@@ -122,14 +122,21 @@
     };
 
     template<class VobSeed> struct VobJNIGenerator {
+       string ntrans;
 
        std::string tclass(std::string name) {
-           static char buf[100];
-           sprintf(buf, "Vob%dMaker", VobSeed::NTrans);
-           return std::string(buf) + "<"+name+">";
+           return std::string("") + "Vob" + ntrans + "Maker<"+name+">";
        }
 
        VobJNIGenerator(std::string name) {
+           if(VobSeed::NTrans < 0) 
+               ntrans = "N";
+           else {
+               static char buf[100];
+               sprintf(buf, "%d", VobSeed::NTrans);
+               ntrans = buf;
+           }
+
            std::cout << "\t" << name << "\n" ;
            VobJavaParamList pl;
            VobSeed().params(pl);
@@ -141,7 +148,7 @@
            makerName + "<"+name +">";
 
            VOB_JAVASTREAM << "static public class "<<name<<
-                   " extends GL.Renderable"<<VobSeed::NTrans<<"JavaObject "<<
+                   " extends GL.Renderable"<<ntrans<<"JavaObject "<<
                    " { private "<<name<<"(int i) { super(i); }\n"
                    <<pl.javaStructS<<
                            "}\n";
@@ -168,7 +175,7 @@
                << pl.jniStructCodeS <<"\n"
                << makerName <<" *p_ = new " << makerName <<";\n"
                << "_.env_ = env_; p_->params(_);\n"
-               << "return vob"<<VobSeed::NTrans<<"s.add(p_);\n"
+               << "return vob"<<ntrans<<"s.add(p_);\n"
                <<"\n}\n";
            VOB_JNISTREAM << "\n" ;
        }
Index: libvob/include/vob/jni/Types.hxx
diff -u libvob/include/vob/jni/Types.hxx:1.22 
libvob/include/vob/jni/Types.hxx:1.23
--- libvob/include/vob/jni/Types.hxx:1.22       Tue Apr 29 20:33:56 2003
+++ libvob/include/vob/jni/Types.hxx    Thu May 29 04:00:20 2003
@@ -66,7 +66,8 @@
     extern ObjectStorer<Vob0> vob0s;
     extern ObjectStorer<Vob1> vob1s;
     extern ObjectStorer<Vob2> vob2s;
-    extern ObjectStorer<Vob> vob3s;
+    extern ObjectStorer<Vob3> vob3s;
+    extern ObjectStorer<Vob> vobNs;
     extern ObjectStorer<Os::RenderingSurface> windows;
     extern ObjectStorer<ByteVector> bytevectors;
 
@@ -205,6 +206,31 @@
     START_VOB_JNI_CONVERSION_IDDED(::Vob::Paper::Paper *, 
                "Paper")
        out = papers[in];
+    END_VOB_JNI_CONVERSION
+
+    START_VOB_JNI_CONVERSION_IDDED(::Vob::Vob3 *, 
+               "GL.Renderable3JavaObject")
+       out = vob3s[in];
+    END_VOB_JNI_CONVERSION
+
+    START_VOB_JNI_CONVERSION_IDDED(::Vob::Vob2 *, 
+               "GL.Renderable2JavaObject")
+       out = vob2s[in];
+    END_VOB_JNI_CONVERSION
+
+    START_VOB_JNI_CONVERSION_IDDED(::Vob::Vob1 *, 
+               "GL.Renderable1JavaObject")
+       out = vob1s[in];
+    END_VOB_JNI_CONVERSION
+
+    START_VOB_JNI_CONVERSION_IDDED(::Vob::Vob0 *, 
+               "GL.Renderable0JavaObject")
+       out = vob0s[in];
+    END_VOB_JNI_CONVERSION
+
+    START_VOB_JNI_CONVERSION_IDDED(::Vob::Vob *, 
+               "GL.RenderableNJavaObject")
+       out = vobNs[in];
     END_VOB_JNI_CONVERSION
 
 }
Index: libvob/lava/blob/fshape.py
diff -u libvob/lava/blob/fshape.py:1.4 libvob/lava/blob/fshape.py:1.5
--- libvob/lava/blob/fshape.py:1.4      Sat May 24 14:18:28 2003
+++ libvob/lava/blob/fshape.py  Thu May 29 04:00:20 2003
@@ -42,11 +42,10 @@
     return sqrt(((xright-xleft)**2) * xweight ** 2 +  (rright-rleft)**2)
 
 def U(xleft, xright, rleft, rright):
-
     return areaweight * A(xleft, xright, rleft, rright) +3* L(xleft, xright, 
rleft, rright)
 
 
-def pot(x, r):
+def pot(x, r, U):
     xleft = x[:-1]
     xright = x[1:]
     rleft = r[:-1]
@@ -77,8 +76,8 @@
 
     return (u, dudx, dudr)
 
-def minfunc(v):
-    (u, dux, dur) = pot(v[0:v.shape[0]/2], v[v.shape[0]/2:])
+def minfunc(v, U):
+    (u, dux, dur) = pot(v[0:v.shape[0]/2], v[v.shape[0]/2:], U)
     g = v * 0
     g[0:v.shape[0]/2] = dux
     g[v.shape[0]/2:] = dur
@@ -110,30 +109,42 @@
 # geomview.close()
 
 class MomGrad:
-    def __init__(self, func, x):
+    def __init__(self, func, x, constraint, v):
        self.func = func
+       self.constraint = constraint
+       self.constraintv = v
        self.mom = x * 0
        self.x = x
        self.step = 0.02
        self.brake = 0.990
     def round(self):
        (u, g) = self.func(self.x)
+
+       self.constraintv = areatarget
+
+       (c, cg) = self.constraint(self.x)
+       cg = cg / sqrt(add.reduce(cg*cg))
+
+       dot = add.reduce(cg * g)
+       print u, c
+
        self.u = u
-       self.mom += g
+       self.mom += g + (.1 * (self.constraintv - c) - dot) * cg
+
        l = add.reduce(self.mom*self.mom)
        self.x += -self.step / sqrt(l) * self.mom
        # self.x = maximum(self.x, 0)
        self.mom *= self.brake
 
 sur = []
-for l in (1, 2, 3, 4):
+for l in (1,):
     tl = l * length
     print "TL",tl
     x = zeros(2*tl, Float)
     x[0:tl] = arange(tl) * 1.0 / tl * l
     x[tl] = 2
     x[-1] = 2
-    mi = MomGrad(minfunc, x)
+    mi = MomGrad(lambda v: minfunc(v, L), x, lambda v: minfunc(v, A), 0)
     sur.append(mi)
 
 def slider(obj, name, var, default, from_, to, resolution=0.001):
@@ -149,15 +160,14 @@
        Frame.__init__(self, master)
        self.pack(expand=1, fill="both")
        Button(self, text="Start", command = self.idle).pack()
-       slider(self, "areaweight", DoubleVar(), 1, 0, 10);
-       slider(self, "xweight", DoubleVar(), 1, 0, 10);
+       slider(self, "areatarget", DoubleVar(), 1, 0, 8);
+       slider(self, "xweight", DoubleVar(), 1, 0, 8);
 
     def idle(self):
        print "Start idle"
-       global areaweight
-       global xweight
+       global areatarget, xweight
        for i in range(0, len(sur)):
-           areaweight = ui.areaweight.get()
+           areatarget = ui.areatarget.get()
            xweight = ui.xweight.get()
            for rou in range(0,100): sur[i].round()
            print "Pot:",sur[i].u
Index: libvob/org/nongnu/libvob/AbstractVob.java
diff -u libvob/org/nongnu/libvob/AbstractVob.java:1.1 
libvob/org/nongnu/libvob/AbstractVob.java:1.2
--- libvob/org/nongnu/libvob/AbstractVob.java:1.1       Tue Apr  8 16:25:02 2003
+++ libvob/org/nongnu/libvob/AbstractVob.java   Thu May 29 04:00:20 2003
@@ -47,7 +47,7 @@
  */
 
 public abstract class AbstractVob implements Vob {
-public static final String rcsid = "$Id: AbstractVob.java,v 1.1 2003/04/08 
20:25:02 tjl Exp $";
+public static final String rcsid = "$Id: AbstractVob.java,v 1.2 2003/05/29 
08:00:20 tjl Exp $";
     public static boolean dbg = false;
     private static void pa(String s) { System.err.println(s); }
 
@@ -109,6 +109,9 @@
     }
     public int putGL(VobScene vs, int cs1, int cs2, int cs3) {
        throw new Error("Wrong # coordsys: 3 for " + this);
+    }
+    public int putGL(VobScene vs, int[] cs) {
+       throw new Error("Wrong # coordsys: N for " + this);
     }
 
 
Index: libvob/org/nongnu/libvob/Vob.java
diff -u libvob/org/nongnu/libvob/Vob.java:1.3 
libvob/org/nongnu/libvob/Vob.java:1.4
--- libvob/org/nongnu/libvob/Vob.java:1.3       Tue Apr  8 16:25:02 2003
+++ libvob/org/nongnu/libvob/Vob.java   Thu May 29 04:00:20 2003
@@ -47,7 +47,7 @@
  */
 
 public interface Vob {
-String rcsid = "$Id: Vob.java,v 1.3 2003/04/08 20:25:02 tjl Exp $";
+String rcsid = "$Id: Vob.java,v 1.4 2003/05/29 08:00:20 tjl Exp $";
 
     boolean intersect(int x, int y, RenderInfo info1, RenderInfo info2) ;
 
@@ -78,6 +78,7 @@
     int putGL(VobScene vs, int cs1) ;
     int putGL(VobScene vs, int cs1, int cs2) ;
     int putGL(VobScene vs, int cs1, int cs2, int cs3) ;
+    int putGL(VobScene vs, int[] cs) ;
 
     /** An interface which provides information about the current 
      * rendering context.
Index: libvob/org/nongnu/libvob/VobPlacer.java
diff -u libvob/org/nongnu/libvob/VobPlacer.java:1.2 
libvob/org/nongnu/libvob/VobPlacer.java:1.3
--- libvob/org/nongnu/libvob/VobPlacer.java:1.2 Fri Mar  7 06:38:21 2003
+++ libvob/org/nongnu/libvob/VobPlacer.java     Thu May 29 04:00:20 2003
@@ -56,5 +56,7 @@
      *         obtained from the VobCoorder
      */
     void put(Vob vob, int coordsys1, int coordsys2);
+
+    void put(Vob vob, int[] cs);
 }
 
Index: libvob/org/nongnu/libvob/VobScene.java
diff -u libvob/org/nongnu/libvob/VobScene.java:1.6 
libvob/org/nongnu/libvob/VobScene.java:1.7
--- libvob/org/nongnu/libvob/VobScene.java:1.6  Thu Apr 24 14:46:39 2003
+++ libvob/org/nongnu/libvob/VobScene.java      Thu May 29 04:00:20 2003
@@ -293,6 +293,7 @@
     public void put(Vob vob) { map.put(vob); }
     public void put(Vob vob, int cs) { map.put(vob, cs); }
     public void put(Vob vob, int cs1, int cs2) { map.put(vob, cs1, cs2); }
+    public void put(Vob vob, int[] cs ) { map.put(vob, cs); }
        
 
     public void dump() {
Index: libvob/org/nongnu/libvob/gl/GL.java
diff -u libvob/org/nongnu/libvob/gl/GL.java:1.14 
libvob/org/nongnu/libvob/gl/GL.java:1.15
--- libvob/org/nongnu/libvob/gl/GL.java:1.14    Fri May 16 07:02:41 2003
+++ libvob/org/nongnu/libvob/gl/GL.java Thu May 29 04:00:20 2003
@@ -129,16 +129,19 @@
      * C++, or'ed together with the ID, indicating
      * a zero-argument renderable.
      */
-    public static final int RENDERABLE0 = 0x0800000;
+    public static final int RENDERABLE0 = 0x1000000;
     /** See RENDERABLE0.
      */
-    public static final int RENDERABLE1 = 0x1000000;
+    public static final int RENDERABLE1 = 0x2000000;
     /** See RENDERABLE0.
      */
-    public static final int RENDERABLE2 = 0x2000000;
+    public static final int RENDERABLE2 = 0x3000000;
     /** See RENDERABLE0.
      */
-    public static final int RENDERABLE3 = 0x3000000;
+    public static final int RENDERABLE3 = 0x4000000;
+    /** See RENDERABLE0.
+     */
+    public static final int RENDERABLEN = 0x5000000;
 
     static ArrayList queue = new ArrayList();
 
@@ -249,7 +252,7 @@
     }
     static private native void deleteRenderable2(int id);
 
-    /** The Java proxy representing a Renderable2 object.
+    /** The Java proxy representing a Renderable3 object.
      */
     static public abstract class Renderable3JavaObject extends JavaObject {
        public Renderable3JavaObject(int id) { super(id); }
@@ -261,6 +264,20 @@
        }
     }
     static private native void deleteRenderable3(int id);
+
+    /** The Java proxy representing a RenderableN object.
+     */
+    static public abstract class RenderableNJavaObject extends JavaObject {
+       public RenderableNJavaObject(int id) { super(id); }
+       public int putGL(VobScene vs, int[] cs) {
+           return getId();
+       }
+       protected void deleteObj() {
+           deleteRenderableN(getId());
+       }
+    }
+    static private native void deleteRenderableN(int id);
+
 
 //--------- Renderable surface
     static public class RenderingSurface extends NonRenderableJavaObject {
Index: libvob/org/nongnu/libvob/impl/DefaultVobMap.java
diff -u libvob/org/nongnu/libvob/impl/DefaultVobMap.java:1.5 
libvob/org/nongnu/libvob/impl/DefaultVobMap.java:1.6
--- libvob/org/nongnu/libvob/impl/DefaultVobMap.java:1.5        Fri Apr 25 
07:17:54 2003
+++ libvob/org/nongnu/libvob/impl/DefaultVobMap.java    Thu May 29 04:00:20 2003
@@ -32,7 +32,7 @@
 /** An implementation of VobMap.
  */
 public class DefaultVobMap implements VobMap {
-public static final String rcsid = "$Id: DefaultVobMap.java,v 1.5 2003/04/25 
11:17:54 tjl Exp $";
+public static final String rcsid = "$Id: DefaultVobMap.java,v 1.6 2003/05/29 
08:00:20 tjl Exp $";
     public static boolean dbg = false;
     private static void pa(String s) { System.err.println(s); }
 
@@ -123,6 +123,9 @@
            vstart[coordsys] = nvobs-1;
            */
        }
+    }
+    public void put(Vob vob, int [] cs) {
+       throw new Error("Unimplemented in AWT");
     }
 
     public void clear() {
Index: libvob/org/nongnu/libvob/impl/gl/GLVobMap.java
diff -u libvob/org/nongnu/libvob/impl/gl/GLVobMap.java:1.1 
libvob/org/nongnu/libvob/impl/gl/GLVobMap.java:1.2
--- libvob/org/nongnu/libvob/impl/gl/GLVobMap.java:1.1  Sat Mar  8 08:26:10 2003
+++ libvob/org/nongnu/libvob/impl/gl/GLVobMap.java      Thu May 29 04:00:20 2003
@@ -31,7 +31,7 @@
 import java.awt.*;
 
 public class GLVobMap implements VobMap {
-public static final String rcsid = "$Id: GLVobMap.java,v 1.1 2003/03/08 
13:26:10 tjl Exp $";
+public static final String rcsid = "$Id: GLVobMap.java,v 1.2 2003/05/29 
08:00:20 tjl Exp $";
     public static boolean dbg = false;
     private static void pa(String s) { System.err.println(s); }
 
@@ -60,6 +60,18 @@
        nvobs = 0;
     }
 
+    public void put(Vob vob, int[] scs) {
+       if(dbg) pa("Add to GLVobMap "+this+":  "+vob+" "+cs+" "+cs.length);
+       int ind = vob.putGL(vs, cs);
+       if(ind == 0) return;
+       // Now, stash it away.
+       cs[nvobs] = scs[0];
+       vobs[nvobs++] = vob;
+       list[curs++] = (GL.RENDERABLEN | ind);
+       list[curs++] = scs.length;
+       for(int i=0; i<scs.length; i++) 
+           list[curs++] = scs[i];
+    }
     public void put(Vob vob, int coordsys1, int coordsys2, int coordsys3) {
        if(dbg) pa("Add to GLVobMap "+this+":  "+vob+" "+coordsys1+" "
                   +coordsys2+" "+coordsys3+" curs: "+curs);
Index: libvob/src/jni/Main.cxx
diff -u libvob/src/jni/Main.cxx:1.14 libvob/src/jni/Main.cxx:1.15
--- libvob/src/jni/Main.cxx:1.14        Fri May 16 07:02:41 2003
+++ libvob/src/jni/Main.cxx     Thu May 29 04:00:20 2003
@@ -46,7 +46,8 @@
 ObjectStorer<Vob0> vob0s("Vob0");
 ObjectStorer<Vob1> vob1s("Vob1");
 ObjectStorer<Vob2> vob2s("Vob2");
-ObjectStorer<Vob> vob3s("Vob3(none)");
+ObjectStorer<Vob3> vob3s("Vob3(none)");
+ObjectStorer<Vob> vobNs("VobN");
 
 Os::WindowSystem *ws;
 
@@ -286,6 +287,12 @@
   (JNIEnv *, jclass, jint id) {
       DBG(dbg) << "Delete renderable3 "<<id<<"\n";
       vob3s.remove(id);
+  }
+
+jf(void, deleteRenderableN)
+  (JNIEnv *, jclass, jint id) {
+      DBG(dbg) << "Delete renderableN "<<id<<"\n";
+      vobNs.remove(id);
   }
 
 
Index: libvob/src/jni/Modules
diff -u libvob/src/jni/Modules:1.4 libvob/src/jni/Modules:1.5
--- libvob/src/jni/Modules:1.4  Tue Apr 29 20:33:56 2003
+++ libvob/src/jni/Modules      Thu May 29 04:00:20 2003
@@ -13,6 +13,8 @@
        Irregu                          \
        Program                         \
        GLState                         \
-       Lines
+       Lines                           \
+       Fillet                          \
+       Debug
 
 
Index: libvob/src/jni/Render.cxx
diff -u libvob/src/jni/Render.cxx:1.5 libvob/src/jni/Render.cxx:1.6
--- libvob/src/jni/Render.cxx:1.5       Tue May 13 07:48:21 2003
+++ libvob/src/jni/Render.cxx   Thu May 29 04:00:20 2003
@@ -112,7 +112,7 @@
        GLERR
 
       DBG(dbg_render) << "Did stdcoords\n";
-      renderer.renderScene((int *)codes, vob0s, vob1s, vob2s, vob3s);
+      renderer.renderScene((int *)codes, vob0s, vob1s, vob2s, vob3s, vobNs);
       DBG(dbg_render) << "Did renderscene\n";
       windows.get(window)->swapBuffers();
       DBG(dbg_render) << "Did swapbuffers\n";
@@ -194,7 +194,7 @@
       double t0 = getTime();
       for(int iter = 0; iter < iters; iter++) {
          DBG(dbg_render) << "Did stdcoords\n";
-         renderer.renderScene((int *)codes, vob0s, vob1s, vob2s, vob3s);
+         renderer.renderScene((int *)codes, vob0s, vob1s, vob2s, vob3s, vobNs);
          DBG(dbg_render) << "Did renderscene\n";
          if(swapbuf) {
              windows.get(window)->swapBuffers();
Index: libvob/src/lines/Lines.cxx
diff -u libvob/src/lines/Lines.cxx:1.3 libvob/src/lines/Lines.cxx:1.4
--- libvob/src/lines/Lines.cxx:1.3      Tue Apr 29 20:33:56 2003
+++ libvob/src/lines/Lines.cxx  Thu May 29 04:00:20 2003
@@ -94,7 +94,7 @@
     ContinuousLine::ContinuousLine(GLuint textId, float lineWidth,
                                   int joinStyle,  bool chain,
                                    float * points, int size) {
-        ContinuousLine(textId, joinStyle, lineWidth, chain);
+        ContinuousLine(textId, lineWidth, joinStyle, chain);
 
         if ( (size % 3) != 0) {
             cerr << "Lines error:: Size not divisible by three (x,y,z)!\n";
Index: libvob/src/main/Renderer.cxx
diff -u libvob/src/main/Renderer.cxx:1.7 libvob/src/main/Renderer.cxx:1.8
--- libvob/src/main/Renderer.cxx:1.7    Tue May 13 07:48:21 2003
+++ libvob/src/main/Renderer.cxx        Thu May 29 04:00:20 2003
@@ -17,6 +17,7 @@
 
     namespace Vobs {
        DBGVAR(dbg_irregularquad, "IrregularQuad");
+       DBGVAR(dbg_vfillets, "VFillets");
 
        std::string testStateRetainCorrect;
     }
@@ -33,6 +34,10 @@
        DBGVAR(dbg_irregu, "Irregu");
     }
 
+    namespace Geom {
+       DBGVAR(dbg_fillets, "Fillets");
+    }
+
 namespace CurrentFPS {
     // bool showFPS;
     double current_fps;
@@ -70,7 +75,9 @@
                        ObjectStorer<Vob0> &r0s,
                        ObjectStorer<Vob1> &r1s,
                        ObjectStorer<Vob2> &r2s,
-                       ObjectStorer<Vob> &r3s) {
+                       ObjectStorer<Vob3> &r3s,
+                       ObjectStorer<Vob> &rNs
+                       ) {
     int i=0; 
     DBG(dbg_renderer) << "renderScene\n";
     while(codes[i] != 0) {
@@ -99,17 +106,27 @@
            i += 3;
        }
        else if((codes[i] & RMASK) == RENDERABLE3) {
-           Transform *cs1 = coordset.get(codes[i+1]);
-           Transform *cs2 = coordset.get(codes[i+2]);
-           Transform *cs3 = coordset.get(codes[i+3]);
+           const Transform *t[3];
+           t[0] = coordset.get(codes[i+1]);
+           t[1] = coordset.get(codes[i+2]);
+           t[2] = coordset.get(codes[i+3]);
            DBG(dbg_renderer) << "rend3 "<<r3s[code]->getVobName()<<" 
"<<r3s[code]<<": "
-                             <<codes[i+1]<<" "<<cs1<<" "<<codes[i+2]<<" 
"<<cs2<<" " 
-                             <<cs3<<" "<<codes[i+3]<<"\n";
-           /* XXX
-           if(cs1 && cs2 && cs3)
-               r3s[code]->render(*cs1, *cs2, *cs3);
-           */
+                             <<codes[i+1]<<" "<<t[0]<<" "<<codes[i+2]<<" 
"<<t[1]<<" " 
+                             <<t[2]<<" "<<codes[i+3]<<"\n";
+           if(t[0] && t[1] && t[2])
+               r3s[code]->render(t, 3);
            i += 4;
+       }
+       else if((codes[i] & RMASK) == RENDERABLEN) {
+           int ncs = codes[i+1];
+           const Transform *t[ncs];
+           for(int c = 0; c<ncs; c++) {
+               t[c] = coordset.get(codes[i+2+c]);
+               if(t[c] == 0) goto SKIP;
+           }
+           rNs[code]->render(t, ncs);
+       SKIP:
+           i += 2 + ncs;
        }
        else {
            // We have a problem




reply via email to

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