geoprop.H

Go to the documentation of this file.
00001 /*
00002  * This file is part of the "Archon" framework.
00003  * (http://files3d.sourceforge.net)
00004  *
00005  * Copyright © 2002 by Kristian Spangsege and Brian Kristiansen.
00006  *
00007  * Permission to use, copy, modify, and distribute this software and
00008  * its documentation under the terms of the GNU General Public License is
00009  * hereby granted. No representations are made about the suitability of
00010  * this software for any purpose. It is provided "as is" without express
00011  * or implied warranty. See the GNU General Public License
00012  * (http://www.gnu.org/copyleft/gpl.html) for more details.
00013  *
00014  * The characters in this file are ISO8859-1 encoded.
00015  *
00016  * The documentation in this file is in "Doxygen" style
00017  * (http://www.doxygen.org).
00018  */
00019 
00020 #ifndef ARCHON_X3D_GEOPROP_H
00021 #define ARCHON_X3D_GEOPROP_H
00022 
00029 #include <vector>
00030 
00031 #include <archon/math/vector.H>
00032 
00033 #include <archon/x3d/server/core.H>
00034 
00035 namespace Archon
00036 {
00037   namespace X3D
00038   {
00039     using namespace Math;
00040 
00041 
00045     struct GeometricPropertyNode: virtual Node
00046     {
00047       static const NodeType *type;
00048 
00049     protected:
00050       GeometricPropertyNode() {}
00051     };
00052 
00053 
00057     struct ColorNode: GeometricPropertyNode
00058     {
00059       static const NodeType *type;
00060 
00061     protected:
00062       ColorNode() {}
00063     };
00064 
00065 
00069     struct CoordinateNode: GeometricPropertyNode
00070     {
00071       static const NodeType *type;
00072 
00073     protected:
00074       CoordinateNode() {}
00075     };
00076 
00077 
00081     struct NormalNode: GeometricPropertyNode
00082     {
00083       static const NodeType *type;
00084 
00085     protected:
00086       NormalNode() {}
00087     };
00088 
00089 
00093     struct Color: ColorNode
00094     {
00095       static Ref<NodeBase> instantiate(BackRef<ExecutionContext> c)
00096       {
00097         return new Color(c);
00098       }
00099 
00100       static const NodeType *type;
00101       const NodeType *getType() const { return type; }
00102 
00103       Color(BackRef<ExecutionContext> c): NodeBase(c) {}
00104 
00105       const vector<Vector3> &getColor() const { return color; }
00106 
00107     private:
00108       friend void initializeGeopropComponent();
00109 
00110       vector<Vector3>  color;
00111 
00112       EventSource colorChanged;
00113 
00114       Time colorStamp;
00115     };
00116 
00117 
00118 
00119 
00123     struct ColorRGBA: ColorNode
00124     {
00125       static Ref<NodeBase> instantiate(BackRef<ExecutionContext> c)
00126       {
00127         return new ColorRGBA(c);
00128       }
00129 
00130       static const NodeType *type;
00131       const NodeType *getType() const { return type; }
00132 
00133       ColorRGBA(BackRef<ExecutionContext> c): NodeBase(c) {}
00134 
00135       const vector<Vector4> &getColor() const { return color; }
00136 
00137     private:
00138       friend void initializeGeopropComponent();
00139 
00140       vector<Vector4>  color;
00141 
00142       EventSource colorChanged;
00143 
00144       Time colorStamp;
00145     };
00146 
00147 
00151     struct Coordinate: CoordinateNode
00152     {
00153       static Ref<NodeBase> instantiate(BackRef<ExecutionContext> c)
00154       {
00155         return new Coordinate(c);
00156       }
00157 
00158       static const NodeType *type;
00159       const NodeType *getType() const { return type; }
00160 
00161       Coordinate(BackRef<ExecutionContext> c): NodeBase(c) {}
00162 
00163       const vector<Vector3> &getPoint() const { return point; }
00164 
00165     private:
00166       friend void initializeGeopropComponent();
00167 
00168       vector<Vector3>  point;
00169 
00170       EventSource pointChanged;
00171 
00172       Time pointStamp;
00173     };
00174 
00175 
00179     struct Normal: NormalNode
00180     {
00181       static Ref<NodeBase> instantiate(BackRef<ExecutionContext> c)
00182       {
00183         return new Normal(c);
00184       }
00185 
00186       static const NodeType *type;
00187       const NodeType *getType() const { return type; }
00188 
00189       Normal(BackRef<ExecutionContext> c): NodeBase(c) {}
00190 
00191       const vector<Vector3> &getNormal() const { return normal; }
00192 
00193     private:
00194       friend void initializeGeopropComponent();
00195 
00196       vector<Vector3> normal; // The X3D specification names this 'vector', but that clashes with the std::vector<>
00197 
00198       EventSource normalChanged;
00199 
00200       Time normalStamp;
00201     };
00202   }
00203 }
00204 
00205 #endif // ARCHON_X3D_GEOPROP_H

Generated on Sun Jul 30 22:55:49 2006 for Archon by  doxygen 1.4.4