1 /*
2  * NodeSphereSensor.cpp
3  *
4  * Copyright (C) 1999 Stephen F. White
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program (see the file "COPYING" for details); if
18  * not, write to the Free Software Foundation, Inc., 675 Mass Ave,
19  * Cambridge, MA 02139, USA.
20  */
21 
22 #include <stdio.h>
23 #include "stdafx.h"
24 
25 #include "NodeSphereSensor.h"
26 #include "Proto.h"
27 #include "FieldValue.h"
28 #include "SFBool.h"
29 #include "SFRotation.h"
30 #include "Field.h"
31 
32 
ProtoSphereSensor(Scene * scene)33 ProtoSphereSensor::ProtoSphereSensor(Scene *scene)
34   : WonderlandExportProto(scene, "SphereSensor")
35 {
36     autoOffset.set(
37           addExposedField(SFBOOL, "autoOffset", new SFBool(true)));
38     description.set(
39           addExposedField(SFSTRING, "description", new SFString("")));
40     setFieldFlags(description, FF_X3D_ONLY);
41     enabled.set(
42           addExposedField(SFBOOL, "enabled", new SFBool(true)));
43     offset.set(
44           addExposedField(SFROTATION, "offset",
45                           new SFRotation(0.0f, 1.0f, 0.0f, 0.0f)));
46     addEventOut(SFBOOL, "isActive");
47     addEventOut(SFBOOL, "isOver", FF_X3D_ONLY);
48     addEventOut(SFROTATION, "rotation_changed", EOF_RECOMMENDED);
49     addEventOut(SFVEC3F, "trackPoint_changed");
50 }
51 
52 Node *
create(Scene * scene)53 ProtoSphereSensor::create(Scene *scene)
54 {
55     return new NodeSphereSensor(scene, this);
56 }
57 
NodeSphereSensor(Scene * scene,Proto * def)58 NodeSphereSensor::NodeSphereSensor(Scene *scene, Proto *def)
59   : Node(scene, def)
60 {
61 }
62 
63