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 00027 #ifndef ARCHON_X3D_AUX_H 00028 #define ARCHON_X3D_AUX_H 00029 00030 #include <archon/x3d/server/geometry.H> 00031 00032 namespace Archon 00033 { 00034 namespace X3D 00035 { 00058 struct Torus: Geometry3DNode 00059 { 00060 static Ref<NodeBase> instantiate(BackRef<ExecutionContext> c) 00061 { 00062 return new Torus(c); 00063 } 00064 00065 static const NodeType *type; 00066 const NodeType *getType() const { return type; } 00067 00068 Torus(BackRef<ExecutionContext> c): 00069 NodeBase(c), majorRadius(1), minorRadius(0.5) {} 00070 00071 double getMajorRadius() const { return majorRadius; } 00072 double getMinorRadius() const { return minorRadius; } 00073 00074 int intersect(const Math::Ray3 &, double &dist) const; 00075 00076 void getNormalAndTexCoord(Vector3 hitPoint, int where, 00077 const Shape *, 00078 Vector3 *hitNormal, 00079 Vector2 *hitTexCoord) const; 00080 00081 void render(bool texture, 00082 const Shape *shape, 00083 const RenderConfig *); 00084 00085 private: 00086 friend void initializeAuxComponent(); 00087 00088 double majorRadius; 00089 double minorRadius; 00090 }; 00091 } 00092 } 00093 00094 #endif // ARCHON_X3D_AUX_H