gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] libvob include/vob/DisablablePrimitives.hxx inc...


From: Asko Soukka
Subject: [Gzz-commits] libvob include/vob/DisablablePrimitives.hxx inc...
Date: Fri, 14 Mar 2003 06:47:11 -0500

CVSROOT:        /cvsroot/libvob
Module name:    libvob
Changes by:     Asko Soukka <address@hidden>    03/03/14 06:46:47

Modified files:
        include/vob    : DisablablePrimitives.hxx Primitives.hxx 
        test/vob/gl    : glvobcoorder.test 

Log message:
        almost there, probably :)

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/DisablablePrimitives.hxx.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/Primitives.hxx.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/test/vob/gl/glvobcoorder.test.diff?tr1=1.5&tr2=1.6&r1=text&r2=text

Patches:
Index: libvob/include/vob/DisablablePrimitives.hxx
diff -u libvob/include/vob/DisablablePrimitives.hxx:1.1 
libvob/include/vob/DisablablePrimitives.hxx:1.2
--- libvob/include/vob/DisablablePrimitives.hxx:1.1     Thu Mar 13 12:41:38 2003
+++ libvob/include/vob/DisablablePrimitives.hxx Fri Mar 14 06:46:00 2003
@@ -37,80 +37,39 @@
 
 namespace Vob {
 namespace Primitives {
-    
-    /** A tag interface, implying for a primitive
-     * transform that there are parameters.
-     */
-    class DisablablePrimitiveTransform {
+       
+    /** Base class for... */
+    class DisablableIdentity :
+      public PrimitiveTransform,
+      public DisablablePrimitiveTransform {
     public:
-      bool disabled;
+      bool enabled;
+
+      typedef DisablableIdentity InverseType;
+      void inverse(InverseType &into) const { }
     };
-    
+
     /** Culling transform can decide not to be drawn when its
      * parents' boxes do not intersect.
      */
     class Cull : 
-      public PrimitiveTransform,
-      public DisablablePrimitiveTransform
+       public DisablableIdentity
     {
     public:
-      const Transform *parent;
-      const Transform *test;
-      const Transform *clip;
-      
       enum { NDepends = 3 };
-      template<class SPtr> void setParams(SPtr depends) {
-       parent = depends[0];
-       test = depends[1];
-       clip = depends[2];
 
-       if (shouldBeDrawn()) disabled = false;
-       else disabled = true;
-      }
-      
-      virtual ZPt transform(const ZPt &p) const {
-       return parent->transform(p);
-      }
-      
-      virtual void vertex(const ZPt &p) const {
-       parent->vertex(p);
-      }
-      
-      virtual bool canPerformGL() const {
-       return parent->canPerformGL();
-      }
-      
-      virtual bool performGL() const {
-       return parent->performGL();
-      }
-      
-      virtual float nonlinearity(const ZPt &p, float radius) const { 
-       float n1 = parent->nonlinearity(p, radius);
-       float n2 = clip->nonlinearity(parent->transform(p), radius);
-       return (n1 > n2 ? n1 : n2);
-      }
-
-      typedef Cull InverseType;
-      void inverse(InverseType &into) const {
-       into.parent = parent;
-       into.test = test;
-       into.clip = clip;
-       into.disabled = disabled;
-      }
-
-      virtual void dump(std::ostream &out) const {
-       out << " CULL ";
+      template<class SPtr> void setParams(SPtr depends) {
+       if (shouldBeDrawn(depends[1], depends[2])) enabled = false;
+       else enabled = true;
       }
 
-      virtual Pt getSqSize() const { 
-       return parent->getSqSize();
-      }
+      bool shouldBeDrawn() const { return enabled; }
 
       /** Cull transforms' shouldBeDrawn() returns true always when boxes 
        * of its test and clip coordinate systems do intersect. When
        * the boxes don't intersect, it should retun false.  
        */
-      virtual bool shouldBeDrawn() const {
+      bool shouldBeDrawn(const Transform *test, const Transform *clip) const {
        Pt box;
        float hyp;
        /** Lower left and upper right points of bounding boxes for
Index: libvob/include/vob/Primitives.hxx
diff -u libvob/include/vob/Primitives.hxx:1.13 
libvob/include/vob/Primitives.hxx:1.14
--- libvob/include/vob/Primitives.hxx:1.13      Wed Mar 12 11:17:20 2003
+++ libvob/include/vob/Primitives.hxx   Fri Mar 14 06:46:01 2003
@@ -80,6 +80,14 @@
     };
 
     /** A tag interface, implying for a primitive
+     * transform that there is shouldBeDrawn() method.
+     */
+    class DisablablePrimitiveTransform {
+    public:
+      bool shouldBeDrawn() const { return true; }
+    };
+
+    /** A tag interface, implying for a primitive
      * transform that there are parameters.
      */
     class ParametrizedPrimitiveTransform {
@@ -267,6 +275,13 @@
            return false;
        }
 
+       bool shouldBeDrawn(const DisablablePrimitiveTransform *_) const {
+           return t.shouldBeDrawn();
+       }
+       bool shouldBeDrawn(const void *_) const {
+           return true;
+       }
+
        float selfNonlinearity(const NonlinearPrimitiveTransform *_,
                    const ZPt &p, float radius) const {
            return t.nonlinearity(p, radius);
@@ -372,10 +387,8 @@
            return s + su; // XXX !!!
        }
 
-       virtual bool shouldBeDrawn() const {
-           return true;
-       }
-
+        virtual bool shouldBeDrawn() const { return shouldBeDrawn(&t); }
+ 
        virtual const Transform &getInverse() const {
            if(!this->inverse)  {
                InverseHierarchicalTransform<typename Primitive::InverseType> 
*inv 
Index: libvob/test/vob/gl/glvobcoorder.test
diff -u libvob/test/vob/gl/glvobcoorder.test:1.5 
libvob/test/vob/gl/glvobcoorder.test:1.6
--- libvob/test/vob/gl/glvobcoorder.test:1.5    Thu Mar 13 12:41:39 2003
+++ libvob/test/vob/gl/glvobcoorder.test        Fri Mar 14 06:46:14 2003
@@ -197,13 +197,12 @@
     failIf(boxwh[1] != 10.0, "%s != 10.0" % (boxwh[1]))
 
 #test translation forward
-#    cs4 = c.affine(0, 0, 0, 0, 100, 0, 0, 100)
-#    cs4clip = c.affine(0, 0, 50, 50, 10, 0, 0, 10)
+    cs4 = c.affine(0, 0, 0, 0, 100, 0, 0, 100)
+    cs4clip = c.affine(0, 0, 50, 50, 10, 0, 0, 10)
+    cs4cull = c.cull(cs4, cs4clip)
+    checkTrans(vs, cs4cull, [0, 0, 0, 1, 1, 1, 2, 2, 2], [0, 0, 0, 100, 100, 
1, 200, 200, 2])
 
-#    cs4cull = c.cull(cs4, cs4clip)
-#    checkTrans(vs, cs4cull, [0, 0, 0, 1, 1, 1, 2, 2, 2], [0, 0, 0, 100, 100, 
1, 200, 200, 2])
-
-#Why is that? Culling hasn't ever affected translation.
+#Why is that? AFAIK, culling hasn't ever affected translation.
 #    c.setAffineParams(cs4clip, 0, 1500, 1500, 10, 0, 0, 10)
 #    checkNoTrans(vs, cs4cull)
 




reply via email to

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