mouse.C

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 
00026 #include <archon/x3d/server/field_type.H>
00027 #include <archon/x3d/server/field.H>
00028 #include <archon/x3d/server/mouse.H>
00029 
00030 namespace Archon
00031 {
00032   namespace X3D
00033   {
00034     const NodeType *PointingDeviceSensorNode::type = 0;
00035     const NodeType *DragSensorNode::type = 0;
00036     const NodeType *PlaneSensor::type = 0;
00037     const NodeType *SphereSensor::type = 0;
00038     const NodeType *CylinderSensor::type = 0;
00039     const NodeType *TouchSensorNode::type = 0;
00040     const NodeType *TouchSensor::type = 0;
00041 
00042     void initializeMouseComponent()
00043     {
00044       vector<const FieldBase *> fields;
00045 
00046 
00047       // PointingDeviceSensorNode
00048 
00049       fields.push_back(newExposedField("description", SFString::type,
00050                                        &PointingDeviceSensorNode::description,
00051                                        &PointingDeviceSensorNode::descriptionChanged,
00052                                        &PointingDeviceSensorNode::descriptionStamp));
00053       fields.push_back(newEventOut("isOver", SFBool::type,
00054                                    &PointingDeviceSensorNode::isOver,
00055                                    &PointingDeviceSensorNode::isOverChanged));
00056       PointingDeviceSensorNode::type =
00057         NodeType::newAbstract("PointingDeviceSensorNode", false, &fields,
00058                               SensorNode::type);
00059 
00060       fields.clear();
00061 
00062 
00063       // DragSensorNode
00064 
00065       fields.push_back(newExposedField("autoOffset", SFBool::type,
00066                                        &DragSensorNode::autoOffset,
00067                                        &DragSensorNode::autoOffsetChanged,
00068                                        &DragSensorNode::autoOffsetStamp));
00069       fields.push_back(newEventOut("trackPoint_changed", SFVec3f::type,
00070                                    &DragSensorNode::trackPoint,
00071                                    &DragSensorNode::trackPointChanged));
00072       DragSensorNode::type =
00073         NodeType::newAbstract("DragSensorNode", false, &fields,
00074                               PointingDeviceSensorNode::type);
00075 
00076       fields.clear();
00077 
00078 
00079       // PlaneSensor
00080 
00081       fields.push_back(newExposedField("maxPosition", SFVec2f::type,
00082                                        &PlaneSensor::maxPosition,
00083                                        &PlaneSensor::maxPositionChanged,
00084                                        &PlaneSensor::maxPositionStamp));
00085       fields.push_back(newExposedField("minPosition", SFVec2f::type,
00086                                        &PlaneSensor::minPosition,
00087                                        &PlaneSensor::minPositionChanged,
00088                                        &PlaneSensor::minPositionStamp));
00089       fields.push_back(newExposedField("offset", SFVec3f::type,
00090                                        &PlaneSensor::offset,
00091                                        &PlaneSensor::offsetChanged,
00092                                        &PlaneSensor::offsetStamp));
00093       fields.push_back(newEventOut("translation_changed", SFVec3f::type,
00094                                    &PlaneSensor::translation,
00095                                    &PlaneSensor::translationChanged));
00096       PlaneSensor::type =
00097         NodeType::newConcrete("PlaneSensor", "children",
00098                               PlaneSensor::instantiate, &fields,
00099                               DragSensorNode::type);
00100 
00101       fields.clear();
00102 
00103 
00104       // SphereSensor
00105 
00106       fields.push_back(newExposedField("offset", SFRotation::type,
00107                                        &SphereSensor::offset,
00108                                        &SphereSensor::offsetChanged,
00109                                        &SphereSensor::offsetStamp));
00110       fields.push_back(newEventOut("rotation_changed", SFRotation::type,
00111                                    &SphereSensor::rotation,
00112                                    &SphereSensor::rotationChanged));
00113       SphereSensor::type =
00114         NodeType::newConcrete("SphereSensor", "children",
00115                               SphereSensor::instantiate, &fields,
00116                               DragSensorNode::type);
00117 
00118       fields.clear();
00119 
00120 
00121       // CylinderSensor
00122 
00123       fields.push_back(newExposedField("diskAngle", SFFloat::type,
00124                                        &CylinderSensor::diskAngle,
00125                                        &CylinderSensor::diskAngleChanged,
00126                                        &CylinderSensor::diskAngleStamp));
00127       fields.push_back(newExposedField("maxAngle", SFFloat::type,
00128                                        &CylinderSensor::maxAngle,
00129                                        &CylinderSensor::maxAngleChanged,
00130                                        &CylinderSensor::maxAngleStamp));
00131       fields.push_back(newExposedField("minAngle", SFFloat::type,
00132                                        &CylinderSensor::minAngle,
00133                                        &CylinderSensor::minAngleChanged,
00134                                        &CylinderSensor::minAngleStamp));
00135       fields.push_back(newExposedField("offset", SFFloat::type,
00136                                        &CylinderSensor::offset,
00137                                        &CylinderSensor::offsetChanged,
00138                                        &CylinderSensor::offsetStamp));
00139       fields.push_back(newEventOut("rotation_changed", SFRotation::type,
00140                                    &CylinderSensor::rotation,
00141                                    &CylinderSensor::rotationChanged));
00142       CylinderSensor::type =
00143         NodeType::newConcrete("CylinderSensor", "children",
00144                               CylinderSensor::instantiate, &fields,
00145                               DragSensorNode::type);
00146 
00147       fields.clear();
00148 
00149 
00150       // TouchSensorNode
00151 
00152       fields.push_back(newEventOut("touchTime", SFTime::type,
00153                                    &TouchSensorNode::touchTime,
00154                                    &TouchSensorNode::touchTimeChanged));
00155       TouchSensorNode::type =
00156         NodeType::newAbstract("TouchSensorNode", false, &fields,
00157                               PointingDeviceSensorNode::type);
00158 
00159       fields.clear();
00160 
00161 
00162       // TouchSensor
00163 
00164       fields.push_back(newEventOut("hitNormal_changed", SFVec3f::type,
00165                                    &TouchSensor::hitNormal,
00166                                    &TouchSensor::hitNormalChanged));
00167       fields.push_back(newEventOut("hitPoint_changed", SFVec3f::type,
00168                                    &TouchSensor::hitPoint,
00169                                    &TouchSensor::hitPointChanged));
00170       fields.push_back(newEventOut("hitTexCoord_changed", SFVec2f::type,
00171                                    &TouchSensor::hitTexCoord,
00172                                    &TouchSensor::hitTexCoordChanged));
00173       TouchSensor::type =
00174         NodeType::newConcrete("TouchSensor", "children",
00175                               TouchSensor::instantiate, &fields,
00176                               TouchSensorNode::type);
00177 
00178       fields.clear();
00179     }
00180 
00181     void PointingDeviceSensorNode::onDisable()
00182     {
00183       if(!isOver) return;
00184       isOver = false;
00185       Event e(new SimpleValue<bool>(SFBool::type, isOver), enabledStamp);
00186       isOverChanged.cascadeEvent(&e);
00187     }
00188   }
00189 }

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