Moka controlers
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros
parameter-eye-position.cc
Go to the documentation of this file.
1 /*
2  * lib-controler : Un contrôleur générique de scène 3D.
3  * Copyright (C) 2004, Moka Team, Université de Poitiers, Laboratoire SIC
4  * http://www.sic.sp2mi.univ-poitiers.fr/
5  * Copyright (C) 2009, Guillaume Damiand, CNRS, LIRIS,
6  * guillaume.damiand@liris.cnrs.fr, http://liris.cnrs.fr/
7  *
8  * This file is part of lib-controler
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU Lesser General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 //******************************************************************************
25 #include "controler-types.hh"
28 #include <cassert>
29 #include <cstring>
30 using namespace std;
31 //******************************************************************************
33  CParameter(ANbRef)
34 {
35  reinit();
36 }
37 //******************************************************************************
40  CParameter (AParam),
41  FRotationAlpha(AParam.FRotationAlpha),
42  FRotationBeta (AParam.FRotationBeta),
43  FDistance (AParam.FDistance),
44  FPasAvancement (AParam.FPasAvancement),
45  FAngleRotation (AParam.FAngleRotation)
46 {}
47 //******************************************************************************
49 {}
50 //******************************************************************************
52 { return new CParameterEyePosition(*this); }
53 //******************************************************************************
54 void CParameterEyePosition::save(ostream& AStream)
55 { AStream<<(*this); }
56 //------------------------------------------------------------------------------
57 void CParameterEyePosition::load(istream& AStream)
58 { AStream>>(*this); }
59 //------------------------------------------------------------------------------
61 {
62  FRotationAlpha = DEFAULT_EYE_POSITION_ROTATION_ALPHA;
63  FRotationBeta = DEFAULT_EYE_POSITION_ROTATION_BETA;
65  FPasAvancement = DEFAULT_EYE_POSITION_PAS_AVANCEMENT;
66  FAngleRotation = DEFAULT_EYE_POSITION_ANGLE_ROTATION;
68 }
69 //******************************************************************************
70 ostream& operator<<(ostream& AStream,
71  const CParameterEyePosition & AParameter)
72 {
73  AStream<<"CParameterEyePosition:"<<endl;
74  AStream<<" RotationAlpha: "<<AParameter.FRotationAlpha<<endl
75  <<" RotationBeta: "<<AParameter.FRotationBeta<<endl
76  <<" Distance: "<<AParameter.FDistance<<endl
77  <<" PasAvancement: "<<AParameter.FPasAvancement<<endl
78  <<" AngleRotation: "<<AParameter.FAngleRotation<<endl;
79  AStream<<endl;
80 
81  return AStream;
82 }
83 //------------------------------------------------------------------------------
84 istream& operator>>(istream& AStream,
85  CParameterEyePosition & AParameter)
86 {
87  char tmp[256];
88 
89  AStream>>tmp; assert ( !strcmp(tmp, "CParameterEyePosition:") );
90 
91  AStream>>tmp; assert ( !strcmp(tmp, "RotationAlpha:") );
92  AStream>>AParameter.FRotationAlpha;
93 
94  AStream>>tmp; assert ( !strcmp(tmp, "RotationBeta:") );
95  AStream>>AParameter.FRotationBeta;
96 
97  AStream>>tmp; assert ( !strcmp(tmp, "Distance:") );
98  AStream>>AParameter.FDistance;
99 
100  AStream>>tmp; assert( !strcmp(tmp, "PasAvancement:") );
101  AStream>>AParameter.FPasAvancement;
102 
103  AStream>>tmp; assert( !strcmp(tmp, "AngleRotation:") );
104  AStream>>AParameter.FAngleRotation;
105 
106  AParameter.putAllNeedToUpdate();
107 
108  return AStream;
109 }
110 //******************************************************************************
112 { return FRotationAlpha; }
113 //******************************************************************************
115 { FRotationAlpha= ARotation; }
116 //******************************************************************************
118 { return FRotationBeta; }
119 //******************************************************************************
121 { FRotationBeta= ARotation; }
122 //******************************************************************************
124 { return FDistance; }
125 //******************************************************************************
127 { FDistance= ADistance; }
128 //******************************************************************************
130 { FRotationAlpha+= ADelta; }
131 //******************************************************************************
133 { FRotationBeta+= ADelta; }
134 //******************************************************************************
136 { FDistance+= ADelta; }
137 //******************************************************************************
139 { return PARAMETER_EYE_POSITION; }
140 //******************************************************************************
142 { return FPasAvancement; }
143 //******************************************************************************
145 { FPasAvancement = pas; }
146 //******************************************************************************
148 { return FAngleRotation; }
149 //******************************************************************************
151 { FAngleRotation = angle; }
152 //******************************************************************************