gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] libvob ./Makefile ./TODO include/vob/Disablable...


From: Tuomas J. Lukka
Subject: [Gzz-commits] libvob ./Makefile ./TODO include/vob/Disablable...
Date: Sun, 23 Mar 2003 15:15:59 -0500

CVSROOT:        /cvsroot/libvob
Module name:    libvob
Changes by:     Tuomas J. Lukka <address@hidden>        03/03/23 15:15:58

Modified files:
        .              : Makefile TODO 
        include/vob    : DisablablePrimitives.hxx 
                         FunctionalPrimitives.hxx LinearPrimitives.hxx 
                         Primitives.hxx Texture.hxx Vec23.hxx VecGL.hxx 
                         Vob.hxx 
        include/vob/util: Perlin.hxx 
        src/texture    : Makefile Texture.cxx Texture_gettexture.cxx 
                         Texture_pipetexture.cxx binmain.cxx 
        src/trans      : Coorder.cxx 
        src/util       : Perlin.cxx 
Removed files:
        org/nongnu/libvob/util: __init__$py.class dbg$py.class 

Log message:
        doccing

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/Makefile.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/TODO.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/DisablablePrimitives.hxx.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/FunctionalPrimitives.hxx.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/LinearPrimitives.hxx.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/Primitives.hxx.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/Texture.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.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/VecGL.hxx.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/Vob.hxx.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/util/Perlin.hxx.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/texture/Makefile.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/texture/Texture.cxx.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/texture/Texture_gettexture.cxx.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/texture/Texture_pipetexture.cxx.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/texture/binmain.cxx.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/trans/Coorder.cxx.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/util/Perlin.cxx.diff?tr1=1.1&tr2=1.2&r1=text&r2=text

Patches:
Index: libvob/Makefile
diff -u libvob/Makefile:1.15 libvob/Makefile:1.16
--- libvob/Makefile:1.15        Sun Mar 23 13:07:25 2003
+++ libvob/Makefile     Sun Mar 23 15:15:58 2003
@@ -10,6 +10,9 @@
 
 CLASSDIR=CLASSES/
 
+docxx:
+       doc++  -a --before-group --before-class --no-java-graphs 
--trivial-graphs  -H -F -d doc/docxx -u include/vob/Vob.hxx
+
 java:
        mkdir -p CLASSES
        $(JAVAC) $(DEBUG) -d $(CLASSDIR) $(RAWSRC) 
Index: libvob/TODO
diff -u libvob/TODO:1.15 libvob/TODO:1.16
--- libvob/TODO:1.15    Fri Mar 21 04:42:50 2003
+++ libvob/TODO Sun Mar 23 15:15:58 2003
@@ -1,29 +1,30 @@
 Tasks for libvob
 
 0.1alpha1: First separate release
-    tjl:
-       - make tests and make them work
     vegai:
        - .cvsignores
        - make sure libvob works right with kaffe
-   humppake:
-        - fix Culling
+    tjl:
+       - port the relevant PEGs.
+       - move Vec23 into util.
 
 0.1alpha2: Vital fixes for packages depending on this
     tjl:
        - document the template build system
        - go through " grep cout gfx/*/*.[ch]* "
          and deal with them.
-    tjl:
        - make benchmark work right with xgobi
        - work on the much needed partial ordering system for 
          GL.
            - using recursive vobscenes
+               - check PEG, fix
            - VobBatcher?
        - speedups to text rendering:
            - per-text-vob: from partial ordering system, avoiding
              init/deinit code
            - per-letter: better cs batching code; using GL transform if 
possible
+       - proper UpdateManager -- gfxapi interface PEG
+           - interpolation functions
     anybody:
        - get the vobthreading test from fenfire:
             org/fenfire/LibvobThreading.test   
@@ -36,6 +37,9 @@
          was compiled into the list when an error occurs.
        - fix the generator to pass on the parameter names
          defined in the "vob_defined" call somehow!
+   humppake:
+        - fix Culling: too much too long code inline right now.
+         separate box intersection into Util/.
 
 0.1alpha3: Pending fixes
     tjl:
@@ -52,10 +56,9 @@
            - slider min/max
            - ...
     tjl:
-       - docxx Vec23, 
-           - 4-dimensional homogeneous type?
-               - useful for projective coordinate transformations where 
texturing
-                 goes awry unless w is used
+       - 4-dimensional homogeneous type?
+           - useful for projective coordinate transformations where texturing
+             goes awry unless w is used
        - buoy circle -> ellipse
        - mipzip maker running instrs
        - change memorypartitioner focus scale:  0..1 is not good,
@@ -66,7 +69,6 @@
            - multiple instances of same cell visible as a buoy --> keys?
                - special matcher? or pp/VobKeyer?
                - really USE hierarchical keys
-       - proper UpdateManager -- gfxapi interface PEG
        + CoordSys::DistordCoords::canPerformGL() returns false.
           Define action (=complain in stderr?) when trying to use
          distorted coordsys with vobs calling directly CallGL.
@@ -92,10 +94,6 @@
           + Discuss with jvk about the current state and use
             of whole TexGenEmboss.
     anybody:
-       + move Image class (imageraster &c) out from Os-GLX.
-         Os-GLX should only contain methods to directly
-         load images into given memory buffers in given
-         formats.
        - make demo start screen size adjustable by environment vars
        - matrix inversion for point-to-point interpolating cs!
        - vobmatcher keymapping to work in both directions
@@ -148,12 +146,9 @@
          definitely not when magnifying (textures clamped to 1.0).
          Maybe rerendering each mipmap level by freetype?
 
-       + redesign mosaics to save memory and allow more internal
-         formats + at the same time, mipmapping improvements
+
        + implement getCachedTexture in gzz/gfx/gl/GLCache.java
          (current implementation is in gfx/libpaper/texcache.py)
-       - cleanup: remove x, y, z from HorizText: unnecessary now.
-         same for other coord-like things in renderables.
        + coordsys interpolation: clicks to interpolated coordsys
        + fillet implementation handling all connections from a node
          simultaneously.
Index: libvob/include/vob/DisablablePrimitives.hxx
diff -u libvob/include/vob/DisablablePrimitives.hxx:1.6 
libvob/include/vob/DisablablePrimitives.hxx:1.7
--- libvob/include/vob/DisablablePrimitives.hxx:1.6     Mon Mar 17 05:07:36 2003
+++ libvob/include/vob/DisablablePrimitives.hxx Sun Mar 23 15:15:58 2003
@@ -42,11 +42,18 @@
        
 DBGVAR(dbg_cull, "Vob.Primitives.Cull");
 
-    /** Base class for... */
+    /** A disablable identity transformation.
+     * A transformation which produces exactly the same output as 
+     * its parent, including the box size, but which may at setParams
+     * time disable itself.
+     * */
     class DisablableIdentity :
       public Box,
       public DisablablePrimitiveTransform {
     public:
+      /** The flag that determines whether this transformation
+       * is enabled.
+       */
       bool enabled;
 
       DisablableIdentity() : Box(Pt(1,1)) { }
Index: libvob/include/vob/FunctionalPrimitives.hxx
diff -u libvob/include/vob/FunctionalPrimitives.hxx:1.2 
libvob/include/vob/FunctionalPrimitives.hxx:1.3
--- libvob/include/vob/FunctionalPrimitives.hxx:1.2     Thu Mar 13 12:41:38 2003
+++ libvob/include/vob/FunctionalPrimitives.hxx Sun Mar 23 15:15:58 2003
@@ -38,6 +38,11 @@
 namespace Vob {
 namespace Primitives {
 
+    /** A transform which applies another transform
+     * to points before giving them to its parent transform.
+     * With the hierarchicaltransform, this becomes the way
+     * to concatenate a transformation to another.
+     */
     struct Concat :
            public PrimitiveTransform,
            public PotentiallyGLPerformablePrimitiveTransform,
@@ -66,6 +71,11 @@
 
     VOB_PRIMITIVETRANS_DEFINED(Concat, "concat");
 
+    /** A transform which applies the <em>inverse</em> of another transform
+     * to points before giving them to its parent transform.
+     * This can be used to generate inverse transforms in a way
+     * that does not clash with the primitivetransform ideas.
+     */
     struct ConcatInverse :
            public Concat
     {
Index: libvob/include/vob/LinearPrimitives.hxx
diff -u libvob/include/vob/LinearPrimitives.hxx:1.10 
libvob/include/vob/LinearPrimitives.hxx:1.11
--- libvob/include/vob/LinearPrimitives.hxx:1.10        Wed Mar 12 11:17:20 2003
+++ libvob/include/vob/LinearPrimitives.hxx     Sun Mar 23 15:15:58 2003
@@ -103,7 +103,14 @@
            vec.z = p[2];
        }
     };
+
+    /** An explicit translation by a 3D vector.
+     * Parameters: x, y, z.
+     */
     typedef Vec_Explicit<TranslateXYZ> TranslateXYZ_Explicit;
+    /** An explicit scale by a 3D vector.
+     * Parameters: sx, sy, sz.
+     */
     typedef Vec_Explicit<ScaleXYZ> ScaleXYZ_Explicit;
 
     VOB_PRIMITIVETRANS_DEFINED(TranslateXYZ_Explicit, "translate");
@@ -148,9 +155,13 @@
        }
     };
 
-    struct RotateXY_Explicit :
+    /** An explicit parametrization of clockwise rotation.
+     * Parameters: angle (in degrees)
+     */
+    class RotateXY_Explicit :
        public RotateXY,
        public ParametrizedPrimitiveTransform {
+    public:
 
        enum {NParams = 1 };
 
@@ -205,9 +216,10 @@
 
     /** The explicit parametrization of Box, with
      */
-    struct Box_Explicit : public Box,
+    class Box_Explicit : public Box,
            public ParametrizedPrimitiveTransform 
     {
+    public:
        enum { NParams = 2 };
 
        template<class Ptr> void setParams(Ptr p) {
@@ -218,7 +230,9 @@
     };
     VOB_PRIMITIVETRANS_DEFINED(Box_Explicit, "box");
 
-    struct RotateXYZ:
+    /** Rotation in 3-space.
+     */
+    class RotateXYZ:
            public PrimitiveTransform,
            public GLPerformablePrimitiveTransform
     {
@@ -256,10 +270,15 @@
        }
     };
 
-    struct RotateXYZ_Explicit :
+    /** Explicit parametrization of rotation in 3-space.
+     * Parameters: x, y, z, angle (in degrees).
+     * x,y,z are the vector to be rotated around.
+     */
+    class RotateXYZ_Explicit :
            public RotateXYZ,
            public ParametrizedPrimitiveTransform
     {
+    public:
        enum { NParams = 4 };
        template<class Ptr> void setParams(Ptr p) {
            vec.x = p[0];
@@ -320,12 +339,13 @@
     };
 
     /** Explicit parametrization of affine.
-     * Parameter layout: x, y, depth, xx, xy, yx, yy
+     * Parameters: x, y, depth, xx, xy, yx, yy
      */
-    struct AffineXY_Explicit : 
+    class AffineXY_Explicit : 
            public AffineXY,
            public ParametrizedPrimitiveTransform
     {
+    public:
        enum { NParams = 7 };
        template<class Ptr> void setParams(Ptr p) {
            offset.z = p[0];
@@ -381,10 +401,11 @@
     /** Explicit parametrization of ortho.
      * Parameter layout: depth, x, y, xx, yy
      */
-    struct Ortho_Explicit : 
+    class Ortho_Explicit : 
            public Ortho,
            public ParametrizedPrimitiveTransform
     {
+    public:
        enum { NParams = 5 };
        template<class Ptr> void setParams(Ptr p) {
            z = p[0];
@@ -396,6 +417,9 @@
     };
     VOB_PRIMITIVETRANS_DEFINED(Ortho_Explicit, "ortho");
 
+    /** Orthonormal transformation along with setting the box 
+     * size of the coordinate system.
+     */
     class OrthoBox :
            public Ortho,
            public BoxPrimitiveTransform
@@ -405,10 +429,14 @@
        Pt getSqSize() const { return box; }
     };
 
-    struct OrthoBox_Explicit :
+    /** Explicit parametrization of OrthoBox.
+     * Parameters: z, x, y, sx, sy, bx, by.
+     */
+    class OrthoBox_Explicit :
            public OrthoBox,
            public ParametrizedPrimitiveTransform
     {
+    public:
        enum { NParams = 7 };
        template<class Ptr> void setParams(Ptr p) {
            z = p[0];
@@ -425,11 +453,13 @@
     /** A coordinate system which has as its "unit square"
      * the box
      * of its parent.
+     * No parameters.
      */
-    struct UnitSqBox: 
+    class UnitSqBox: 
        public ScaleXYZ,
        public DependentPrimitiveTransform
     {
+    public:
        enum { NDepends = 1 }; // just parent
        template<class SPtr> void setParams(SPtr depends) {
            Pt p = depends[0]->getSqSize();
Index: libvob/include/vob/Primitives.hxx
diff -u libvob/include/vob/Primitives.hxx:1.15 
libvob/include/vob/Primitives.hxx:1.16
--- libvob/include/vob/Primitives.hxx:1.15      Mon Mar 17 05:07:36 2003
+++ libvob/include/vob/Primitives.hxx   Sun Mar 23 15:15:58 2003
@@ -33,107 +33,109 @@
 #include <boost/type_traits.hpp>
 
 namespace Vob {
+
+/** Primitive transformations and templates to allow their use hierarchically.
+ * All classes whose name ends in PrimitiveTransform are empty tag classes
+ * which allow primitive transformations to declare that they provide
+ * certain features.
+ */
 namespace Primitives {
 
-    /** A primitive transform, an interface
+
+    /** A primitive transform, implying an interface
      * used by the templates for building up 
      * transforms.
-     */
-    class PrimitiveTransform {
-    public:
-       /*
+     * Deriving from this class implies the following method:
+     * <pre>
+       void tr(const ZPt &from, ZPt &to) const 
        typedef InverseType ???;
-       void inverse(InverseType &into) {
-       }
-       */
-
-       void tr(const ZPt &from, ZPt &to) const { }
-
-       static const int X = 1;
-       static const int Y = 2;
-       static const int Z = 3;
-
-       /** Calculate the derivatives of this transformation.
-        * The default implementation uses a slow and inaccurate
-        * finite difference calculation.
-        */
-       void tr_d(const ZPt &at, ZPt *to_3, int which) const { 
-           const float eps = .01;
-           ZPt tmp1, tmp2;
-           tr(at, tmp1);
-           if(which & X) {
-               ZPt at2(at.x + eps, at.y, at.z);
-               tr(at2, tmp2);
-               to_3[0] = (tmp2-tmp1)/eps;
-           } 
-           if(which & Y) {
-               ZPt at2(at.x, at.y + eps, at.z);
-               tr(at2, tmp2);
-               to_3[1] = (tmp2-tmp1)/eps;
-           } 
-           if(which & Z) {
-               ZPt at2(at.x, at.y, at.z + eps);
-               tr(at2, tmp2);
-               to_3[2] = (tmp2-tmp1)/eps;
-           } 
-       }
-    };
-
-    /** A tag interface, implying for a primitive
-     * transform that there is shouldBeDrawn() method.
+       void inverse(InverseType &into) ;
+      </pre>
      */
-    class DisablablePrimitiveTransform {
-    public:
-      bool shouldBeDrawn() const { return true; }
+    class PrimitiveTransform {
     };
 
-    /** A tag interface, implying for a primitive
-     * transform that there are parameters.
+    /** A tag interface, implying that the primitive transform
+     * may switch off rendering of the vobs in it.
+     * This interface implies for a primitive
+     * transform that there is shouldBeDrawn() method:
+     * <pre>
+       bool shouldBeDrawn() const;
+      </pre>
+     */
+    class DisablablePrimitiveTransform { };
+
+    /** A tag interface, implying that the transform requires
+     * floating-point parameters.
+     * Implies the following interface in the inheriting class:
+     * <pre>
+       enum { NParams = ??? };
+       template<class Ptr> void setParams(Ptr p)
+       </pre>
+       Note that combining this with DependentPrimitiveTransform
+       adds more arguments to the setParams() call.
      */
-    class ParametrizedPrimitiveTransform {
-
-       /** The number of floating-point parameters.
-       enum { NParams = 0
-       };
-       template<class Ptr> void setParams(Ptr p) ;
-        */
-    };
+    class ParametrizedPrimitiveTransform { };
 
 
     /** A tag interface, for a transform which 
-     * depends on the parent transform(s)
-     */
-    class DependentPrimitiveTransform {
-       /*
-       typedef ??? BaseTransform;
-
-       template<class Ptr2> 
-           void setParams(Transform *others, Ptr2 paramsOut) ;
-       */
-    };
-
-    class GLPerformablePrimitiveTransform {
-    public:
+     * depends on some transform(s).
+     * This class unfortunately shows some abstraction through,
+     * because sometimes you want the transformation to depend
+     * on the real parent (UnitSqBox, Nadir), and sometimes not (cull).
+     * Thus, this class will know about the "first parent".
+     * Implies the following interface:
+     * <pre>
+       enum { NDepends = ??? }; // Number of parent coordsyses
+       template<class SPtr> void setParams(SPtr depends) ;
+       </pre>
+       Note that combining this with ParametrizedPrimitiveTransform
+       adds more arguments to the setParams() call.
+     */
+    class DependentPrimitiveTransform { };
+
+    /** A tag interface for transformations which can be performed
+     * by manipulating the OpenGL fixed-function vertex pipeline.
+     * For instance rotations and transformations can be performed faster by
+     * just letting OpenGL combine the transformations into a matrix.
+     * Implies the following method:
+       <pre>
        void performGL() { }
-    };
+       </pre>
+     *
+     */
+    class GLPerformablePrimitiveTransform { };
 
+    /** A tag interface for transformations which may <em>sometimes</em>
+     * be performed using OpenGL but sometimes not.
+     * Implies the following methods:
+      <pre>
+       bool canPerformGL() ;
+       bool performGL() ;
+      </pre>
+      with the same semantics as in address@hidden Vob::Transform}.
+     *
+     * @link Vob::Transform
+     */
     class PotentiallyGLPerformablePrimitiveTransform {
     public:
-       bool canPerformGL() { return false; }
-       bool performGL() { return false; }
     };
 
-    class NonlinearPrimitiveTransform {
-    public:
-       float nonlinearity(ZPt p, float radius) { return 0; }
-    };
+    /** A tag interface for transformations which may be nonlinear.
+     * Implies
+     * <pre>
+       float nonlinearity(ZPt p, float radius) ;
+       </pre>
+     */
+    class NonlinearPrimitiveTransform { };
 
     /** A tag for a primitive transform that sets a box size.
-     */
-    class BoxPrimitiveTransform {
-    public:
+     * Implies
+     * <pre>
        Pt getSqSize() { return Pt(1,1); }
-    };
+       </pre>
+     */
+    class BoxPrimitiveTransform { };
 
 
 
@@ -235,7 +237,8 @@
     /** A type of transform which exposes a vector of
      * float parameters and parent transformations.
      */
-    struct HierarchicalTransform : public Transform {
+    class HierarchicalTransform : public Transform {
+    public:
        virtual int getNParams() = 0;
        virtual int getNDepends() = 0;
        virtual void setParams(const Transform **depends, float *p) = 0;
Index: libvob/include/vob/Texture.hxx
diff -u libvob/include/vob/Texture.hxx:1.2 libvob/include/vob/Texture.hxx:1.3
--- libvob/include/vob/Texture.hxx:1.2  Mon Mar 10 04:49:31 2003
+++ libvob/include/vob/Texture.hxx      Sun Mar 23 15:15:58 2003
@@ -31,6 +31,8 @@
 
 #include <string>
 
+namespace Vob {
+
 /** Pre-rendered procedural textures.
  */
 namespace Texture {
@@ -63,6 +65,7 @@
   virtual ~Texture() = 0;
   static Texture *getTexture(const char *type);
 };
+}
 }
 
 #include "vob/util/Perlin.hxx"
Index: libvob/include/vob/Vec23.hxx
diff -u libvob/include/vob/Vec23.hxx:1.3 libvob/include/vob/Vec23.hxx:1.4
--- libvob/include/vob/Vec23.hxx:1.3    Wed Feb 26 07:11:26 2003
+++ libvob/include/vob/Vec23.hxx        Sun Mar 23 15:15:58 2003
@@ -31,79 +31,155 @@
 #include <iostream>
 #include <math.h>
 
+namespace Vob {
 /** Simple vectors for 2D / 3D graphics.
  */
-namespace Vob {
+namespace Vec23 {
     using std::ostream;
 
     template <class T>class Vector;
     template <class T>class Vector3;
 
+    /** A 2D vector.
+     */
     template <class T>class Vector {
     public:
        T x, y;
+       /** Null.
+        */
        Vector() : x(0), y(0) { }
+       /** Given components.
+        */
        Vector(T x, T y) : x(x), y(y) { }
+       /** Create from another Vector.
+        */
        template<class F>
            Vector(const Vector3<F> &v) : x(v.x), y(v.y) { }
+       /** Multiplication by scalar.
+        */
        Vector operator*(const double &s) const { return Vector(s * x, s * y); }
+       /** In-place multiplication by scalar.
+        */
        template<class U>const Vector &operator*=(const U &s) { x *= s; y *= s; 
return *this; }
-       Vector normalize() { return (1/length()) * *this ; }
 
+       /** Normalize the normalized version of this vector.
+        */
+       Vector normalized() const { return (1/length()) * *this ; }
+
+       /** Vector negation.
+        */
        Vector<T> operator-() { return Vector<T>(-x, -y); }
+       /** Vector addition.
+        */
        Vector operator+(const Vector<T>&v) const { return Vector(x+v.x, 
y+v.y); }
+       /** Vector subtraction.
+        */
        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); }
+       /** Return the length of this vector.
+        */
        double length() { return hypot(x, y); }
 
+       /** Dot this vector with another.
+        */
        double dot(const Vector<T> &v) const { return x * v.x + y * v.y; }
     };
+
+    /** Multiply vector by scalar.
+     */
     template<class T> Vector<T> operator*(const double &s, const Vector<T> &v) 
{
        return v * s;
     }
 
+    /** Print out a vector.
+     */
     template<class T> inline ostream& operator<<(ostream &o, const Vector<T> 
&p) {
        return o << "[vector "<<p.x<<" "<<p.y<<"]";
     };
 
+    /** A 3D vector.
+     */
     template <class T>class Vector3 {
     public:
        T x, y, z;
+       /** Null.
+        */
        Vector3() : x(0), y(0), z(0) { }
+       /** From components.
+        */
        Vector3(T x, T y, T z) : x(x), y(y), z(z) { }
+       /** From a 2D vector and an optional Z-component.
+        */
        Vector3(const Vector<T> &v, float z = 0) : x(v.x), y(v.y), z(z) { }
+       
+       /** Multiplication by scalar.
+        */
        Vector3 operator*(const double &s) const { return Vector3(s * x, s * y, 
s * z); } ;
 
+       /** Multiplication by scalar.
+        */
        template<class U> const Vector3 &operator*=(const U &s) { 
            x *= s; y *= s; z *= s;
            return *this; 
        } ;
+       /** Multiplication by reciprocal of a scalar.
+        */
        template<class U> const Vector3 &operator/=(const U &s) { 
            x /= s; y /= s; z /= s;
            return *this; 
        } ;
+
+       /** Multiplication by reciprocal of a scalar.
+        */
        template<class U> Vector3 operator/(const U &s) { 
            return Vector3(x/s, y/s, z/s);
        }
-       Vector3 normalize() const { return (1/length()) * *this ; }
+
+       /** Return the normalized version of this vector.
+        */
+       Vector3 normalized() const { return (1/length()) * *this ; }
+
+       /** Negation.
+        */
        Vector3<T> operator-() const { return Vector3<T>(-x, -y, -z); }
+
+       /** Addition.
+        */
        Vector3 operator+(const Vector3<T>&v) const { return Vector3(x+v.x, 
y+v.y, z+v.z); }
-       /** Member-wise!
+
+       /** Member-wise multiplication of vectors!
         */
        Vector3 operator*(const Vector3<T>&v) const { 
            return Vector3(x*v.x, y*v.y, z*v.z); }
 
+       /** Vector addition.
+        */
        const Vector3 &operator+=(const Vector3<T>&v) { x+=v.x; y+=v.y; z+=v.z; 
return *this; }
+       /** Vector subtraction.
+        */
        const Vector3 &operator-=(const Vector3<T>&v) { x-=v.x; y-=v.y; z-=v.z; 
return *this; }
+
+       /** Vector subtraction.
+        */
        Vector3 operator-(const Vector3<T>&v) const { return Vector3(x-v.x, 
y-v.y, z-v.z); }
+
        /** Return a vector like this, but rotated 90 degrees clockwise IN X 
AND Y.
         */
        Vector3 cw90() const { return Vector3(y, -x, z); }
+
+       /** Dot product with another 3-vector.
+        */
        double dot(const Vector3<T> &v) const { return x * v.x + y * v.y + z * 
v.z; }
+       /** Dot product of x and y components only.
+        */
        double dot2(const Vector3<T> &v) const { return x * v.x + y * v.y ; }
+       /** Length of this vector.
+        */
        double length() const { return hypot(hypot(x, y), z); }
+       /** Cross-product with another vector.
+        */
        Vector3 crossp(const Vector3<T> &v) const {
            return Vector3(
                    y * v.z - z * v.y,
@@ -111,42 +187,72 @@
                    x * v.y - y * v.x
                    );
        }
-       Vector3 normalized() { return (1/length()) * *this ; }
     };
+
+    /** Multiply vector by scalar.
+     */
     template<class T> Vector3<T> operator*(const double &s, const Vector3<T> 
&v) {
        return v * s;
     }
 
+    /** Output a 3-vector.
+     */
     template<class T> inline ostream& operator<<(ostream &o, const Vector3<T> 
&p) {
        return o << "[vector "<<p.x<<" "<<p.y<<" "<<p.z<<"]";
     };
 
 
-    /** Like java...
+    /** A rectangle.
      */
     template <class T>class Rectangle {
     public:
        T x, y, w, h;
+       /** Create a rectangle with the given components.
+        */
        Rectangle(T x, T y, T w, T h) : x(x), y(y), w(w), h(h) { }
+       /** Get the first X-coordinate.
+        */
        T x0() { return x; }
+       /** Get the last X-coordinate.
+        */
        T x1() { return x + w; }
+       /** Get the first Y-coordinate.
+        */
        T y0() { return y; }
+       /** Get the last Y-coordinate.
+        */
        T y1() { return y + h; }
 
+       /** Get the upper-left corner.
+        */
        Vector<T> ul() { return Vector<T>(x, y); }
+       /** Get the lower-right corner.
+        */
        Vector<T> lr() { return Vector<T>(x +w, y +h); }
     };
 
+    /** Output a rectangle.
+     */
     template<class T>inline ostream& operator<<(ostream &o, const Rectangle<T> 
&r) {
        return o << "[rect "<<r.x<<" "<<r.y<<" "<<r.w<<" "<<r.h<<"]";
     }
 
-
+    /** Shorthand.
+     */
     typedef Vector<float> Pt;
+    /** Shorthand.
+     */
     typedef Vector3<float> ZPt;
+    /** Shorthand.
+     */
     typedef Vector<float> Vec;
+    /** Shorthand.
+     */
     typedef Vector3<float> ZVec;
 
+    /** Linear interpolation.
+     * Returns a + fract*(b-a)
+     */
     template<class X, class Y> inline X lerp(X a, Y b, double fract) {
        return a + fract * (b-a);
     }
@@ -224,5 +330,14 @@
 
     template<class T> T dot(Vector<T> a, Vector<T> b) { return a.dot(b); }
 
+}
+
+// Export some to Vob
+
+using Vec23::ZPt;
+using Vec23::ZVec;
+using Vec23::Pt;
+using Vec23::Vec;
+using Vec23::lerp;
 }
 #endif
Index: libvob/include/vob/VecGL.hxx
diff -u libvob/include/vob/VecGL.hxx:1.2 libvob/include/vob/VecGL.hxx:1.3
--- libvob/include/vob/VecGL.hxx:1.2    Mon Mar 10 11:02:05 2003
+++ libvob/include/vob/VecGL.hxx        Sun Mar 23 15:15:58 2003
@@ -33,13 +33,21 @@
 #include <vob/Vec23.hxx>
 
 
+namespace Vob {
+
 /** Useful overloads for OpenGL routines using Vec23.
  */
-namespace Vob {
+namespace VecGL {
 
+    /** Call glVertex using a Vec23 ZVec.
+     */
     inline void glVertex(const ZVec &v) { 
        glVertex3f(v.x, v.y, v.z); 
     }
+}
 
 }
+
+
+
 #endif
Index: libvob/include/vob/Vob.hxx
diff -u libvob/include/vob/Vob.hxx:1.6 libvob/include/vob/Vob.hxx:1.7
--- libvob/include/vob/Vob.hxx:1.6      Sun Mar 16 12:58:49 2003
+++ libvob/include/vob/Vob.hxx  Sun Mar 23 15:15:58 2003
@@ -29,15 +29,33 @@
 
 #include <vob/Transform.hxx>
 
+/** The main namespace for libvob.
+ * All libvob symbols are placed in this namespace.
+ */
 namespace Vob {
 
-    struct Vob {
+    /** A vob: an object that knows how to render itself,
+     * given a number of coordinate transforms.
+     */
+    class Vob {
+    public:
        virtual ~Vob() { }
+       /** Get the number of transforms this Vob's render() call
+        * requires.
+        */
        virtual int nCoordsys() const = 0;
+       /** Render this Vob, given a number of transforms.
+        * @param t The transforms
+        * @param n The number of transforms in t.
+        */
        virtual void render(const Transform **t, int n) const = 0;
     };
 
-    struct Vob0 {
+    /** A vob which uses no coordinate systems. A specialization
+     * of Vob for efficiency.
+     */
+    class Vob0 : public Vob {
+    public:
        virtual ~Vob0() {}
        virtual int nCoordsys() const { return 0; };
        virtual void render(const Transform **t, int n) const { render0(); }
@@ -45,14 +63,22 @@
     };
 
 
-    struct Vob1 {
+    /** A vob which uses one coordinate system. A specialization
+     * of Vob for efficiency.
+     */
+    class Vob1 : public Vob {
+    public:
        virtual ~Vob1() {}
        virtual int nCoordsys() const { return 1; };
        virtual void render(const Transform **t, int n) const { 
render1(*(t[0])); }
        virtual void render1(const Transform &t) const = 0;
     };
 
-    struct Vob2 {
+    /** A vob which uses two coordinate systems. A specialization
+     * of Vob for efficiency.
+     */
+    class Vob2 : public Vob {
+    public:
        virtual ~Vob2() {}
        virtual int nCoordsys() const { return 2; };
        virtual void render(const Transform **t, int n) const { 
@@ -61,17 +87,30 @@
        virtual void render2(const Transform &t0, const Transform &t1) 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.
+     */
     template<class VobSeed> class Vob0Maker : public Vob0, public VobSeed {
        virtual void render0() const {
            VobSeed::render();
        }
     };
+
+    /** A template class which implements Vob, given a class with a render(t) 
method.
+     * Used by the code generation mechanism to decouple defining Vobs from the
+     * actual Vob interface.
+     */
     template<class VobSeed> class Vob1Maker : public Vob1, public VobSeed {
        virtual void render1(const Transform &t) const {
            VobSeed::render(t);
        }
     };
+
+    /** A template class which implements Vob, given a class with a render(t0, 
t1) method.
+     * Used by the code generation mechanism to decouple defining Vobs from the
+     * actual Vob interface.
+     */
     template<class VobSeed> class Vob2Maker : public Vob2, public VobSeed {
        virtual void render2(const Transform &t0, const Transform &t1) const {
            VobSeed::render(t0, t1);
@@ -79,5 +118,14 @@
     };
 
 }
+//@Include: Transform.hxx
+//@Include: Primitives.hxx
+//@Include: LinearPrimitives.hxx
+//@Include: FunctionalPrimitives.hxx
+//@Include: DisablablePrimitives.hxx
+//
+//@Include: util/Perlin.hxx
+//@Include: Vec23.hxx
+
 
 #endif
Index: libvob/include/vob/util/Perlin.hxx
diff -u libvob/include/vob/util/Perlin.hxx:1.1 
libvob/include/vob/util/Perlin.hxx:1.2
--- libvob/include/vob/util/Perlin.hxx:1.1      Mon Mar 10 04:50:21 2003
+++ libvob/include/vob/util/Perlin.hxx  Sun Mar 23 15:15:58 2003
@@ -29,6 +29,8 @@
 
 #ifndef GZZ_PERLIN_HXX
 #define GZZ_PERLIN_HXX
+
+namespace Vob {
 /** Perlin's noise function &amp; co.
  * This package contains various functions useful for procedural
  * texturing.
@@ -79,4 +81,6 @@
     }
 
 }
+}
+
 #endif
Index: libvob/src/texture/Makefile
diff -u libvob/src/texture/Makefile:1.2 libvob/src/texture/Makefile:1.3
--- libvob/src/texture/Makefile:1.2     Mon Mar 10 04:49:31 2003
+++ libvob/src/texture/Makefile Sun Mar 23 15:15:58 2003
@@ -13,10 +13,10 @@
        name=$${file%.texture}; \
        { echo "#include \"vob/Texture.hxx\""; \
          echo "#define GENERATE $$name::render"; \
-         echo "namespace Texture { struct $$name : Texture {"; \
+         echo "namespace Vob {namespace Texture { struct $$name : Texture {"; \
          echo "virtual void render(TextureParam *, int, int, int, int, float 
*);"; \
          echo "};"; echo "#line 1 \"$<\""; \
-         cat $<; echo "}"; } > $${name}_tmp.generated.cxx; \
+         cat $<; echo "}}"; } > $${name}_tmp.generated.cxx; \
        $(CXX) $(CXXFLAGS) -x c++ -c $${name}_tmp.generated.cxx -o $@        
 
 %.bin : %.texture binmain.o Texture.o Makefile
@@ -24,11 +24,11 @@
        name=$${file%.texture}; \
        { echo "#include \"vob/Texture.hxx\""; \
          echo "#define GENERATE $$name::render"; \
-         echo "namespace Texture { struct $$name : Texture {"; \
+         echo "namespace Vob {namespace Texture { struct $$name : Texture {"; \
          echo "virtual void render(TextureParam *, int, int, int, int, float 
*);"; \
          echo "};"; echo ""; \
          echo "Texture *bin_texture = new $$name();"; echo "#line 1 \"$<\""; \
-         cat $<; echo "}"; } > $${name}_tmp2.generated.cxx; \
+         cat $<; echo "}}"; } > $${name}_tmp2.generated.cxx; \
        $(CXX) $(CXXFLAGS) $${name}_tmp2.generated.cxx Texture.o binmain.o -o 
$@ ../util/Perlin.o 
 
 Texture_decl.generated.hxx: *.texture
Index: libvob/src/texture/Texture.cxx
diff -u libvob/src/texture/Texture.cxx:1.1 libvob/src/texture/Texture.cxx:1.2
--- libvob/src/texture/Texture.cxx:1.1  Mon Mar 10 00:38:19 2003
+++ libvob/src/texture/Texture.cxx      Sun Mar 23 15:15:58 2003
@@ -37,7 +37,7 @@
 
 #include "vob/Texture.hxx"
 
-namespace Texture {
+namespace Vob { namespace Texture {
 
 using std::string;
 
@@ -121,4 +121,4 @@
 }
 
 Texture::~Texture() { }
-}
+}}
Index: libvob/src/texture/Texture_gettexture.cxx
diff -u libvob/src/texture/Texture_gettexture.cxx:1.2 
libvob/src/texture/Texture_gettexture.cxx:1.3
--- libvob/src/texture/Texture_gettexture.cxx:1.2       Mon Mar 10 04:49:31 2003
+++ libvob/src/texture/Texture_gettexture.cxx   Sun Mar 23 15:15:58 2003
@@ -37,7 +37,7 @@
 
 #include "vob/Texture.hxx"
 
-namespace Texture {
+namespace Vob { namespace Texture {
 
 #include "Texture_decl.generated.hxx"
 
@@ -46,6 +46,6 @@
   cout << "Unknown texture type " << type << "\n";
   abort();
 }
-}
+}}
 
 
Index: libvob/src/texture/Texture_pipetexture.cxx
diff -u libvob/src/texture/Texture_pipetexture.cxx:1.2 
libvob/src/texture/Texture_pipetexture.cxx:1.3
--- libvob/src/texture/Texture_pipetexture.cxx:1.2      Mon Mar 10 04:49:31 2003
+++ libvob/src/texture/Texture_pipetexture.cxx  Sun Mar 23 15:15:58 2003
@@ -38,7 +38,7 @@
 
 #include "vob/Texture.hxx"
 
-namespace Texture {
+namespace Vob { namespace Texture {
 
 
 
@@ -84,7 +84,7 @@
     return new PipeTexture(string(type));
 }
 
-}
+}}
 
 
 
Index: libvob/src/texture/binmain.cxx
diff -u libvob/src/texture/binmain.cxx:1.2 libvob/src/texture/binmain.cxx:1.3
--- libvob/src/texture/binmain.cxx:1.2  Mon Mar 10 04:49:31 2003
+++ libvob/src/texture/binmain.cxx      Sun Mar 23 15:15:58 2003
@@ -32,10 +32,10 @@
 
 #include "vob/Texture.hxx"
 
-namespace Texture {
+namespace Vob { namespace Texture {
     extern Texture *bin_texture;
-}
-using namespace Texture;
+}}
+using namespace Vob::Texture;
 
 bool bytes = false;
 
Index: libvob/src/trans/Coorder.cxx
diff -u libvob/src/trans/Coorder.cxx:1.2 libvob/src/trans/Coorder.cxx:1.3
--- libvob/src/trans/Coorder.cxx:1.2    Mon Mar 10 11:02:05 2003
+++ libvob/src/trans/Coorder.cxx        Sun Mar 23 15:15:58 2003
@@ -9,6 +9,8 @@
 
 namespace Vob {
 
+using namespace VecGL;
+
 /** A transform that interpolates between
  * two transforms pointwise.
  */
Index: libvob/src/util/Perlin.cxx
diff -u libvob/src/util/Perlin.cxx:1.1 libvob/src/util/Perlin.cxx:1.2
--- libvob/src/util/Perlin.cxx:1.1      Mon Mar 10 04:50:56 2003
+++ libvob/src/util/Perlin.cxx  Sun Mar 23 15:15:58 2003
@@ -44,7 +44,7 @@
 
 #include "vob/util/Perlin.hxx"
 
-namespace Perlin {
+namespace Vob { namespace Perlin {
 
     float bias(float a, float b)
     {
@@ -525,4 +525,4 @@
        }
        return res;
     }
-}
+}}




reply via email to

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