Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/tform/driveInterface.I

Go to the documentation of this file.
00001 // Filename: driveInterface.I
00002 // Created by:  drose (12Mar02)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 
00020 ////////////////////////////////////////////////////////////////////
00021 //     Function: DriveInterface::set_forward_speed
00022 //       Access: Published
00023 //  Description: Sets the speed of full forward motion, when the mouse
00024 //               is at the very top of the window.  This is in units
00025 //               (e.g. feet) per second.
00026 ////////////////////////////////////////////////////////////////////
00027 INLINE void DriveInterface::
00028 set_forward_speed(float speed) {
00029   _forward_speed = speed;
00030 }
00031 
00032 ////////////////////////////////////////////////////////////////////
00033 //     Function: DriveInterface::get_forward_speed
00034 //       Access: Published
00035 //  Description: Returns the speed of full forward motion, when the
00036 //               mouse is at the very top of the window.  This is in
00037 //               units (e.g. feet) per second.
00038 ////////////////////////////////////////////////////////////////////
00039 INLINE float DriveInterface::
00040 get_forward_speed() const {
00041   return _forward_speed;
00042 }
00043 
00044 ////////////////////////////////////////////////////////////////////
00045 //     Function: DriveInterface::set_reverse_speed
00046 //       Access: Published
00047 //  Description: Sets the speed of full reverse motion, when the mouse
00048 //               is at the very bottom of the window.  This is in
00049 //               units (e.g. feet) per second.
00050 ////////////////////////////////////////////////////////////////////
00051 INLINE void DriveInterface::
00052 set_reverse_speed(float speed) {
00053   _reverse_speed = speed;
00054 }
00055 
00056 ////////////////////////////////////////////////////////////////////
00057 //     Function: DriveInterface::get_reverse_speed
00058 //       Access: Published
00059 //  Description: Returns the speed of full reverse motion, when the
00060 //               mouse is at the very bottom of the window.  This is
00061 //               in units (e.g. feet) per second.
00062 ////////////////////////////////////////////////////////////////////
00063 INLINE float DriveInterface::
00064 get_reverse_speed() const {
00065   return _reverse_speed;
00066 }
00067 
00068 ////////////////////////////////////////////////////////////////////
00069 //     Function: DriveInterface::set_rotate_speed
00070 //       Access: Published
00071 //  Description: Sets the maximum rate at which the user can rotate
00072 //               left or right, when the mouse is at the very edge of
00073 //               the window.  This is in degrees per second.
00074 ////////////////////////////////////////////////////////////////////
00075 INLINE void DriveInterface::
00076 set_rotate_speed(float speed) {
00077   _rotate_speed = speed;
00078 }
00079 
00080 ////////////////////////////////////////////////////////////////////
00081 //     Function: DriveInterface::get_rotate_speed
00082 //       Access: Published
00083 //  Description: Returns the maximum rate at which the user can rotate
00084 //               left or right, when the mouse is at the very edge of
00085 //               the window.  This is in degrees per second.
00086 ////////////////////////////////////////////////////////////////////
00087 INLINE float DriveInterface::
00088 get_rotate_speed() const {
00089   return _rotate_speed;
00090 }
00091 
00092 ////////////////////////////////////////////////////////////////////
00093 //     Function: DriveInterface::set_vertical_dead_zone
00094 //       Access: Published
00095 //  Description: Sets the size of the horizontal bar in the center of
00096 //               the screen that represents the "dead zone" of
00097 //               vertical motion: the region in which the mouse does
00098 //               not report vertical motion.  This is in a fraction of
00099 //               the window height, so 0.5 will set a dead zone as
00100 //               large as half the screen.
00101 ////////////////////////////////////////////////////////////////////
00102 INLINE void DriveInterface::
00103 set_vertical_dead_zone(float speed) {
00104   _vertical_dead_zone = speed;
00105 }
00106 
00107 ////////////////////////////////////////////////////////////////////
00108 //     Function: DriveInterface::get_vertical_dead_zone
00109 //       Access: Published
00110 //  Description: Returns the size of the horizontal bar in the center
00111 //               of the screen that represents the "dead zone" of
00112 //               vertical motion: the region in which the mouse does
00113 //               not report vertical motion.  This is in a fraction of
00114 //               the window height, so 0.5 will set a dead zone as
00115 //               large as half the screen.
00116 ////////////////////////////////////////////////////////////////////
00117 INLINE float DriveInterface::
00118 get_vertical_dead_zone() const {
00119   return _vertical_dead_zone;
00120 }
00121 
00122 ////////////////////////////////////////////////////////////////////
00123 //     Function: DriveInterface::set_horizontal_dead_zone
00124 //       Access: Published
00125 //  Description: Sets the size of the vertical bar in the center of
00126 //               the screen that represents the "dead zone" of
00127 //               horizontal motion: the region in which the mouse does
00128 //               not report horizontal motion.  This is in a fraction of
00129 //               the window width, so 0.5 will set a dead zone as
00130 //               large as half the screen.
00131 ////////////////////////////////////////////////////////////////////
00132 INLINE void DriveInterface::
00133 set_horizontal_dead_zone(float speed) {
00134   _horizontal_dead_zone = speed;
00135 }
00136 
00137 ////////////////////////////////////////////////////////////////////
00138 //     Function: DriveInterface::get_horizontal_dead_zone
00139 //       Access: Published
00140 //  Description: Returns the size of the vertical bar in the center
00141 //               of the screen that represents the "dead zone" of
00142 //               horizontal motion: the region in which the mouse does
00143 //               not report horizontal motion.  This is in a fraction of
00144 //               the window width, so 0.5 will set a dead zone as
00145 //               large as half the screen.
00146 ////////////////////////////////////////////////////////////////////
00147 INLINE float DriveInterface::
00148 get_horizontal_dead_zone() const {
00149   return _horizontal_dead_zone;
00150 }
00151 
00152 ////////////////////////////////////////////////////////////////////
00153 //     Function: DriveInterface::set_vertical_ramp_up_time
00154 //       Access: Published
00155 //  Description: Sets the amount of time, in seconds, it takes between
00156 //               the time an up or down arrow key is pressed and the
00157 //               time it registers full forward or backward motion.
00158 ////////////////////////////////////////////////////////////////////
00159 INLINE void DriveInterface::
00160 set_vertical_ramp_up_time(float ramp_up_time) {
00161   _vertical_ramp_up_time = ramp_up_time;
00162 }
00163 
00164 ////////////////////////////////////////////////////////////////////
00165 //     Function: DriveInterface::get_vertical_ramp_up_time
00166 //       Access: Published
00167 //  Description: Returns the amount of time, in seconds, it takes
00168 //               between the time an up or down arrow key is pressed
00169 //               and the time it registers full forward or backward
00170 //               motion.
00171 ////////////////////////////////////////////////////////////////////
00172 INLINE float DriveInterface::
00173 get_vertical_ramp_up_time() const {
00174   return _vertical_ramp_up_time;
00175 }
00176 
00177 ////////////////////////////////////////////////////////////////////
00178 //     Function: DriveInterface::set_vertical_ramp_down_time
00179 //       Access: Published
00180 //  Description: Sets the amount of time, in seconds, it takes between
00181 //               the time an up or down arrow key is released and the
00182 //               time it registers no motion.
00183 ////////////////////////////////////////////////////////////////////
00184 INLINE void DriveInterface::
00185 set_vertical_ramp_down_time(float ramp_down_time) {
00186   _vertical_ramp_down_time = ramp_down_time;
00187 }
00188 
00189 ////////////////////////////////////////////////////////////////////
00190 //     Function: DriveInterface::get_vertical_ramp_down_time
00191 //       Access: Published
00192 //  Description: Returns the amount of time, in seconds, it takes
00193 //               between the time an up or down arrow key is released
00194 //               and the time it registers no motion.
00195 ////////////////////////////////////////////////////////////////////
00196 INLINE float DriveInterface::
00197 get_vertical_ramp_down_time() const {
00198   return _vertical_ramp_down_time;
00199 }
00200 
00201 ////////////////////////////////////////////////////////////////////
00202 //     Function: DriveInterface::set_horizontal_ramp_up_time
00203 //       Access: Published
00204 //  Description: Sets the amount of time, in seconds, it takes between
00205 //               the time a left or right arrow key is pressed and the
00206 //               time it registers full rotation.
00207 ////////////////////////////////////////////////////////////////////
00208 INLINE void DriveInterface::
00209 set_horizontal_ramp_up_time(float ramp_up_time) {
00210   _horizontal_ramp_up_time = ramp_up_time;
00211 }
00212 
00213 ////////////////////////////////////////////////////////////////////
00214 //     Function: DriveInterface::get_horizontal_ramp_up_time
00215 //       Access: Published
00216 //  Description: Returns the amount of time, in seconds, it takes
00217 //               between the time a left or right arrow key is pressed
00218 //               and the time it registers full rotation.
00219 ////////////////////////////////////////////////////////////////////
00220 INLINE float DriveInterface::
00221 get_horizontal_ramp_up_time() const {
00222   return _horizontal_ramp_up_time;
00223 }
00224 
00225 ////////////////////////////////////////////////////////////////////
00226 //     Function: DriveInterface::set_horizontal_ramp_down_time
00227 //       Access: Published
00228 //  Description: Sets the amount of time, in seconds, it takes between
00229 //               the time a left or right arrow key is released and the
00230 //               time it registers no motion.
00231 ////////////////////////////////////////////////////////////////////
00232 INLINE void DriveInterface::
00233 set_horizontal_ramp_down_time(float ramp_down_time) {
00234   _horizontal_ramp_down_time = ramp_down_time;
00235 }
00236 
00237 ////////////////////////////////////////////////////////////////////
00238 //     Function: DriveInterface::get_horizontal_ramp_down_time
00239 //       Access: Published
00240 //  Description: Returns the amount of time, in seconds, it takes
00241 //               between the time a left or right arrow key is released
00242 //               and the time it registers no motion.
00243 ////////////////////////////////////////////////////////////////////
00244 INLINE float DriveInterface::
00245 get_horizontal_ramp_down_time() const {
00246   return _horizontal_ramp_down_time;
00247 }
00248 
00249 ////////////////////////////////////////////////////////////////////
00250 //     Function: DriveInterface::get_speed
00251 //       Access: Published
00252 //  Description: Returns the speed of the previous update in units/sec
00253 ////////////////////////////////////////////////////////////////////
00254 INLINE float DriveInterface::
00255 get_speed() const {
00256   return _speed;
00257 }
00258 
00259 ////////////////////////////////////////////////////////////////////
00260 //     Function: DriveInterface::get_rot_speed
00261 //       Access: Published
00262 //  Description: Returns the rot_speed of the previous update in units/sec
00263 ////////////////////////////////////////////////////////////////////
00264 INLINE float DriveInterface::
00265 get_rot_speed() const {
00266   return _rot_speed;
00267 }
00268 
00269 ////////////////////////////////////////////////////////////////////
00270 //     Function: DriveInterface::get_pos
00271 //       Access: Published
00272 //  Description: Returns the driver's position.
00273 ////////////////////////////////////////////////////////////////////
00274 INLINE const LPoint3f &DriveInterface::
00275 get_pos() const {
00276   return _xyz;
00277 }
00278 
00279 INLINE float DriveInterface::
00280 get_x() const {
00281   return _xyz[0];
00282 }
00283 
00284 INLINE float DriveInterface::
00285 get_y() const {
00286   return _xyz[1];
00287 }
00288 
00289 INLINE float DriveInterface::
00290 get_z() const {
00291   return _xyz[2];
00292 }
00293 
00294 
00295 ////////////////////////////////////////////////////////////////////
00296 //     Function: DriveInterface::set_pos
00297 //       Access: Published
00298 //  Description: Directly sets the driver's position.
00299 ////////////////////////////////////////////////////////////////////
00300 INLINE void DriveInterface::
00301 set_pos(const LVecBase3f &vec) {
00302   _xyz = vec;
00303 }
00304 
00305 INLINE void DriveInterface::
00306 set_pos(float x, float y, float z) {
00307   _xyz.set(x, y, z);
00308 }
00309 
00310 INLINE void DriveInterface::
00311 set_x(float x) {
00312   _xyz[0] = x;
00313 }
00314 
00315 INLINE void DriveInterface::
00316 set_y(float y) {
00317   _xyz[1] = y;
00318 }
00319 
00320 INLINE void DriveInterface::
00321 set_z(float z) {
00322   _xyz[2] = z;
00323 }
00324 
00325 
00326 ////////////////////////////////////////////////////////////////////
00327 //     Function: DriveInterface::get_hpr
00328 //       Access: Published
00329 //  Description: Returns the driver's orientation.
00330 ////////////////////////////////////////////////////////////////////
00331 INLINE const LVecBase3f &DriveInterface::
00332 get_hpr() const {
00333   return _hpr;
00334 }
00335 
00336 INLINE float DriveInterface::
00337 get_h() const {
00338   return _hpr[0];
00339 }
00340 
00341 INLINE float DriveInterface::
00342 get_p() const {
00343   return _hpr[1];
00344 }
00345 
00346 INLINE float DriveInterface::
00347 get_r() const {
00348   return _hpr[2];
00349 }
00350 
00351 
00352 ////////////////////////////////////////////////////////////////////
00353 //     Function: DriveInterface::set_hpr
00354 //       Access: Published
00355 //  Description: Directly sets the driver's orientation.
00356 ////////////////////////////////////////////////////////////////////
00357 INLINE void DriveInterface::
00358 set_hpr(const LVecBase3f &hpr) {
00359   set_hpr(hpr[0], hpr[1], hpr[2]);
00360 }
00361 
00362 INLINE void DriveInterface::
00363 set_hpr(float h, float p, float r) {
00364   set_h(h);
00365   set_p(p);
00366   set_r(r);
00367 }
00368 
00369 INLINE void DriveInterface::
00370 set_h(float h) {
00371   _hpr[0] = _hpr_quantize * floor(h / _hpr_quantize + 0.5f);
00372 }
00373 
00374 INLINE void DriveInterface::
00375 set_p(float p) {
00376   _hpr[1] = _hpr_quantize * floor(p / _hpr_quantize + 0.5f);
00377 }
00378 
00379 INLINE void DriveInterface::
00380 set_r(float r) {
00381   _hpr[2] = _hpr_quantize * floor(r / _hpr_quantize + 0.5f);
00382 }
00383 
00384 ////////////////////////////////////////////////////////////////////
00385 //     Function: DriveInterface::set_ignore_mouse
00386 //       Access: Published
00387 //  Description: Changes the state of the ignore_mouse flag.  If this
00388 //               flag is true, the DriveInterface will ignore mouse
00389 //               down button events (but still recognize mouse up
00390 //               button events); the user will not be able to start
00391 //               the DriveInterface going again if it is stopped, but
00392 //               if the user is currently holding down a mouse button
00393 //               it will not stop immediately until the user
00394 //               eventually releases the button.
00395 ////////////////////////////////////////////////////////////////////
00396 INLINE void DriveInterface::
00397 set_ignore_mouse(bool ignore_mouse) {
00398   _ignore_mouse = ignore_mouse;
00399 }
00400 
00401 ////////////////////////////////////////////////////////////////////
00402 //     Function: DriveInterface::get_ignore_mouse
00403 //       Access: Published
00404 //  Description: Returns the current setting of the ignore_mouse flag.
00405 //               See set_ignore_mouse().
00406 ////////////////////////////////////////////////////////////////////
00407 INLINE bool DriveInterface::
00408 get_ignore_mouse() const {
00409   return _ignore_mouse;
00410 }
00411 
00412 ////////////////////////////////////////////////////////////////////
00413 //     Function: DriveInterface::set_force_mouse
00414 //       Access: Published
00415 //  Description: Changes the state of the force_mouse flag.  If this
00416 //               flag is true, the mouse button need not be held down
00417 //               in order to drive the avatar around.
00418 ////////////////////////////////////////////////////////////////////
00419 INLINE void DriveInterface::
00420 set_force_mouse(bool force_mouse) {
00421   _force_mouse = force_mouse;
00422 }
00423 
00424 ////////////////////////////////////////////////////////////////////
00425 //     Function: DriveInterface::get_force_mouse
00426 //       Access: Published
00427 //  Description: Returns the current setting of the force_mouse flag.
00428 //               See set_force_mouse().
00429 ////////////////////////////////////////////////////////////////////
00430 INLINE bool DriveInterface::
00431 get_force_mouse() const {
00432   return _force_mouse;
00433 }
00434 
00435 ////////////////////////////////////////////////////////////////////
00436 //     Function: DriveInterface::set_stop_this_frame
00437 //       Access: Published
00438 //  Description: If stop_this_frame is true, the next time the frame
00439 //               is computed no motion will be allowed, and then the
00440 //               flag is reset to false.  This can be used to prevent
00441 //               too much movement when we know a long time has
00442 //               artificially elapsed, for instance when we take a
00443 //               screenshot, without munging the clock for everything
00444 //               else.
00445 ////////////////////////////////////////////////////////////////////
00446 INLINE void DriveInterface::
00447 set_stop_this_frame(bool stop_this_frame) {
00448   _stop_this_frame = stop_this_frame;
00449 }
00450 
00451 ////////////////////////////////////////////////////////////////////
00452 //     Function: DriveInterface::get_stop_this_frame
00453 //       Access: Published
00454 //  Description: Returns the current setting of the stop_this_frame
00455 //               flag.  See set_stop_this_frame().
00456 ////////////////////////////////////////////////////////////////////
00457 INLINE bool DriveInterface::
00458 get_stop_this_frame() const {
00459   return _stop_this_frame;
00460 }

Generated on Fri May 2 00:44:26 2003 for Panda by doxygen1.3