texture.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_TEXTURE_H
00021 #define ARCHON_X3D_TEXTURE_H
00022 
00033 #include <archon/util/image.H>
00034 
00035 #include <archon/x3d/server/network.H>
00036 #include <archon/x3d/server/geoprop.H>
00037 
00038 namespace Archon
00039 {
00040   namespace X3D
00041   {
00045     struct TextureCoordinateNode: GeometricPropertyNode
00046     {
00047       static const NodeType *type;
00048 
00049     protected:
00050       TextureCoordinateNode() {}
00051     };
00052 
00053 
00057     struct TextureCoordinate: TextureCoordinateNode
00058     {
00059       static Ref<NodeBase> instantiate(BackRef<ExecutionContext> c)
00060       {
00061         return new TextureCoordinate(c);
00062       }
00063 
00064       static const NodeType *type;
00065       const NodeType *getType() const { return type; }
00066 
00067       TextureCoordinate(BackRef<ExecutionContext> c): NodeBase(c) {}
00068 
00069       const vector<Vector2> &getPoint() const { return point; }
00070 
00071     private:
00072       friend void initializeTextureComponent();
00073 
00074       vector<Vector2> point;
00075 
00076       EventSource pointChanged;
00077 
00078       Time pointStamp;
00079     };
00080 
00081 
00094     struct AppearanceChildNode: virtual Node
00095     {
00096       static const NodeType *type;
00097 
00098     protected:
00099       AppearanceChildNode() {}
00100     };
00101 
00102 
00106     struct TextureTransformNode: AppearanceChildNode
00107     { 
00108       static const NodeType *type;
00109 
00110     protected:
00111       TextureTransformNode() {}
00112     };
00113 
00114 
00118     struct TextureTransform: TextureTransformNode
00119     {
00120       static Ref<NodeBase> instantiate(BackRef<ExecutionContext> c)
00121       {
00122         return new TextureTransform(c);
00123       }
00124 
00125       static const NodeType *type;
00126       const NodeType *getType() const { return type; }
00127 
00128       TextureTransform(BackRef<ExecutionContext> c):
00129         NodeBase(c),
00130         center(0, 0), rotation(0),
00131         scale(1, 1), translation(0, 0) {}
00132 
00133       const Vector2 &getCenter()            const { return center; }
00134       const double getRotation()            const { return rotation; }
00135       const Vector2 &getScale()             const { return scale; }
00136       const Vector2 &getTranslation()       const { return translation; }
00137 
00138     private:
00139       friend void initializeTextureComponent();
00140 
00141       Vector2 center;
00142       double rotation;
00143       Vector2 scale;
00144       Vector2 translation;
00145 
00146       EventSource centerChanged;
00147       EventSource rotationChanged;
00148       EventSource scaleChanged;
00149       EventSource translationChanged;
00150 
00151       Time centerStamp;
00152       Time rotationStamp;
00153       Time scaleStamp;
00154       Time translationStamp;
00155     };
00156 
00157 
00161     struct TextureNode: AppearanceChildNode
00162     { 
00163       static const NodeType *type;
00164 
00165     protected:
00166       TextureNode() {}
00167     };
00168 
00169 
00173     struct Texture2DNode: TextureNode
00174     {
00175       static const NodeType *type;
00176 
00177       bool getRepeatS() const { return repeatS; }
00178       bool getRepeatT() const { return repeatT; }
00179 
00180     protected:
00181       Texture2DNode(): repeatS(true), repeatT(true) {}
00182 
00183     private:
00184       friend void initializeTextureComponent();
00185 
00186       bool repeatS;
00187       bool repeatT;
00188     };
00189 
00190 
00194     struct ImageTexture: Texture2DNode, UrlObject
00195     {
00196       static Ref<NodeBase> instantiate(BackRef<ExecutionContext> c)
00197       {
00198         return new ImageTexture(c);
00199       }
00200 
00201       static const NodeType *type;
00202       const NodeType *getType() const { return type; }
00203 
00204       ImageTexture(BackRef<ExecutionContext> c): NodeBase(c) {}
00205 
00206     private:
00207       friend void initializeTextureComponent();
00208 
00209       Loader::UriType getUriType() const
00210       {
00211         return Loader::uriType_Image;
00212       }
00213     };
00214 
00215 
00219     /*
00220     struct MovieTexture: Texture2DNode, UrlObject
00221     {
00222       static Ref<NodeBase> instantiate(BackRef<ExecutionContext> c)
00223       {
00224         return new MovieTexture(c);
00225       }
00226 
00227       static const NodeType *type;
00228       const NodeType *getType() const { return type; }
00229 
00230       MovieTexture(BackRef<ExecutionContext> c):
00231         NodeBase(c), loop(false), speed(1), isActive(0) {}
00232 
00233     private:
00234       friend void initializeTextureComponent();
00235 
00236       bool        loop;
00237       double      speed;
00238       Time        startTime;
00239       Time        stopTime;
00240       Time        duration;
00241       bool        isActive;
00242 
00243       EventSource loopChanged;
00244       EventSource speedChanged;
00245       EventSource startTimeChanged;
00246       EventSource stopTimeChanged;
00247       EventSource durationChanged;
00248       EventSource isActiveChanged;
00249 
00250       Time loopStamp;
00251       Time speedStamp;
00252       Time startTimeStamp;
00253       Time stopTimeStamp;
00254 
00255       Loader::UriType getUriType() const
00256       {
00257         return Loader::uriType_Movie;
00258       }
00259     };
00260     */
00261 
00262 
00266     struct PixelTexture: Texture2DNode
00267     {
00268       static Ref<NodeBase> instantiate(BackRef<ExecutionContext> c)
00269       {
00270         return new PixelTexture(c);
00271       }
00272 
00273       static const NodeType *type;
00274       const NodeType *getType() const { return type; }
00275 
00276       PixelTexture(BackRef<ExecutionContext> c): NodeBase(c) {}
00277 
00278     private:
00279       friend void initializeTextureComponent();
00280 
00281       Image image;
00282 
00283       EventSource imageChanged;
00284 
00285       Time imageStamp;
00286     };
00287   }
00288 }
00289 
00290 #endif // ARCHON_X3D_TEXTURE_H

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