home *** CD-ROM | disk | FTP | other *** search
/ Virtual Reality Zone / VRZONE.ISO / mac / PC / PCGLOVE / O2GLOVE / OOPGLOVE.DOC < prev    next >
Text File  |  1995-04-04  |  9KB  |  191 lines

  1. ============================================================================
  2.   Credits:
  3. ----------------------------------------------------------------------------
  4.   Originally "power.c" (c) manfredo 9/91
  5.   Address: manfredo@opal.cs.tu-berlin.de
  6. ----------------------------------------------------------------------------
  7.   Ported to PC compatibles by Greg Alt 10/91
  8.   Address: galt@peruvian.utah.edu or galt@es.dsd.com
  9. ----------------------------------------------------------------------------
  10.   Substantially rewritten by Dave Stampe (c) 1991: PWRFILT.C
  11.   No cash, no warranty, no flames.  This stuff works great, so gimme credit.
  12.   Address: dstamp@watserv1.uwaterloo.ca                   17/10/91
  13. ----------------------------------------------------------------------------
  14.   Converted to C++ by Mitch Allen 11/91
  15.   Address: 76040.2757@compuserve.com
  16.  
  17.   This source was adapted from theGlove.c contained in pglove.zip
  18.   It is suggested that you download that file for instructions on
  19.   how to build an interface for the Power Glove to your PC.
  20.   When posting copies, please also post pglove.zip as well.
  21.  
  22. (THEGLOVE.DOC and PGPINS.GIF contain all necessary information
  23.  on connecting the glove to a parallel port.  -MTP)
  24.  
  25.   Significant enhancements:
  26.  
  27.   - Glove code now contained in a class.
  28.  
  29.   - In theory multiple glove objects could be spawned easily.
  30.  
  31.     Helpful if someone ever invents one for we lefties.
  32.  
  33.   - Derived glove classes may be developed.
  34.  
  35.  ===========================================================================
  36.   Compilation:
  37. ----------------------------------------------------------------------------
  38.   The graphics are geared for Borland/Turbo C++.  I've included a project
  39.   file, which I also ran through PRJ2MAK to generate the sample MAKE file.
  40.   Obviously the directories are geared for my machine.
  41.  
  42.   The code consists of three files:
  43.  
  44.     cf_glove.hpp    - Glove class prototype.
  45.     cf_glove.cpp    - Glove member functions.
  46.     uf_glove.cpp    - Sample unit test.
  47.  
  48.   Also, the glove class drawing routines are geared for 640 x 480 VGA
  49.   graphics.
  50. ============================================================================
  51.  
  52. // Made more object-oriented by Mark Pflaging 5/29/92.
  53. //    Compuserve 72033, 1552
  54. // If you want to send money, send me an e-mail message and
  55. // ask for my address.  That would be very kind of you, but
  56. // it is unneccessary.  Just let me read YOUR code, alright?
  57. //
  58. // ReDesigned for a 486/33.  I am trying to paramaterize the
  59. // timing constraints so that it will be easy for "someone"
  60. // or "something" to adjust them for the particular computer
  61. // it is running on.  These parameters appear in calls to 'Channel'
  62. // constructors, see "SMOOTH.HPP".
  63. //
  64. // I spent some time experimenting with the hardwired values in
  65. // the fdelay calls, and making calls to fdelay.  See "MYDELAY.C".
  66. //
  67. // The graphics are now autodeteced and autoscaled depending on your
  68. // hardware's highest res graphics!  I'm developing this on
  69. // a hercules graphics card while I await a 24-bit color card.
  70. // (boy that's an upgrade!)  If you don't have a graphics card,
  71. // leave me an email message, U don't know what U R missin'.
  72. //
  73. // Somebody still needs to do autodetection
  74. // of the port that the glove is connected to.  Compuserve
  75. // files describe how to build the parallel port interface.
  76. // Another goal was to break Mitch's big objects into smaller
  77. // ones whose functions are more specific.  I am probably going
  78. // to move this thing to Windows, so the more object-oriented the
  79. // better.  But mostly, I'm gonna make these graphics a lot better.
  80. //
  81. //  Summary of improvements to graphics:
  82. //      Inside the former recatangle appears a representation of the
  83. //  glove, movable fingers included.  If you twist your wrist, the
  84. //  glove rotates too!  This is accomplished using a "metagraphics"
  85. //  approach, which essentially takes a set of points describing
  86. //  the still hand and applies a mathematical translation to
  87. //  the "deglitched" glove input.
  88. //
  89. //  I also made the buttons turn on and off certain features, these are
  90. //  documented in the on-line help.
  91. //
  92. //  Some last-minute compile notes:  There are 5 warnings when I compile,
  93. //  they are safe to ignore.  I used Borland C++ 3.0 with 387
  94. //  floating point and '286 code generated.  You will have
  95. //  to recompile and/or change some #defines for a non-486/33
  96. //  machine, but believe me its pretty simple.
  97. //
  98. //   There's a lot more that can be done with this code!
  99. //
  100. // RELEASE 2 9/28/92   Mark Pflaging
  101. //   Many, many nice improvements have been made!
  102. //
  103. //   Most importantly, the code is now machine independent!
  104. //   This was achieved by precisely computing delay constraints
  105. //   for the inner delay loops.  Code has been tested on a slow
  106. //   286 up to a 486/50 and should work for faster machines when
  107. //   they are available.  Thanks to Kendall Bennett for the
  108. //   indispensable timer classes.  I have included the full
  109. //   ZTIMER11.ZIP here although not all of it is used in this
  110. //   code.  Also thanks to D. P. Research Company for providing
  111. //   guidance and the basic strategy for computing the timing
  112. //   constraints.
  113. //
  114. //   Secondly, the glove sampling is now interrupt driven!
  115. //   I cannot give a full explanation of interrupts here for
  116. //   those not in the know.  To put it simply, there is a way
  117. //   to set a chip on motherboard to generate an "interrupt"
  118. //   at an extremely predictable rate.  Every time an interrupt
  119. //   occurs, a piece of code is called which samples the glove.
  120. //   The beauty of it is that the computer can be doing some-
  121. //   thing completely different between interrupts!  The rate
  122. //   of sampling can be precisely controlled, and appears to
  123. //   take place in the "background."  This code (ISR.CPP and
  124. //   ISR.HPP) is a C++ conversion of code in Dave Stampe's
  125. //   REND386 V3.  So thanks go to him for making his source
  126. //   available, and giving me a clue as to how interrupts work.
  127. //   But boos to him for making it so sloppy.  Additionally, the
  128. //   docs in these files are not too good but the code is pretty
  129. //   straightforward when you understand the strategy that was
  130. //   employed.
  131. //
  132. //   Thirdly, MANY parameters that control both the driver and
  133. //   the demo program are read from the GLOVE.INI file which
  134. //   has a format many will recognize from MS Windows.  The code
  135. //   for reading this file was written TOTALLY from scratch by
  136. //   ME!  It is a GENERAL PURPOSE set of classes that is, dare I
  137. //   say, an example of rather advanced Object Oriented Programming.
  138. //   You may find these classes (INI.HPP and INI.CPP) useful in
  139. //   many other applications!  It is a great way to allow users
  140. //   to change program parameters without recompiling or having
  141. //   to remember 16 billion command line switches.  Also, it is
  142. //   a somewhat standard format.  See INI.DOC for design notes,
  143. //   and GLOVE.INI for program specific parameter descriptions.
  144. //   TESTINI.CPP contains a sloppy test of the class.
  145. //
  146. //   Some improvements have been made to the class hierarchy
  147. //   of the driver. It should now be easier to understand.
  148. //   The problem with the buttons has been fixed.
  149. //
  150. //   In the intervening time between releases, I have learned a
  151. //   lot about how the glove behaves in different situations.
  152. //   If you are experiencing problems such as jumpiness or
  153. //   dimensions not responding, read HELPME!.DOC.  GLITCHY
  154. //   RESPONSE IS NOT THE FAULT OF THIS CODE!  There is VERY
  155. //   little I could do with software to eliminate the
  156. //   problems with shadowing.  But you need NOT get used to it!
  157. //   My glove is responding near the accuracy of a mouse!!
  158. //   Yours can too!  Read HELPME!.DOC!
  159. //
  160. //   Well, sorry it took so long, but I hope you like it and/or
  161. //   find it useful.  The next step is to add an event queue
  162. //   that holds glove, mouse, and keyboard events.  Then I will
  163. //   add a module to interpret glove gestures and put them
  164. //   back into the queue.  See GESTURE.TXT for more details.
  165. //   I am still NOT planning to make my work commercial
  166. //   or even shareware.  This software is provided on an
  167. //   "as is" basis and the author shall not be held liable for
  168. //   any losses directly or indirectly related to the use of
  169. //   this code.  All code not otherwise indicated has been
  170. //   written independently by Mark Pflaging.  Credit has been
  171. //   given in those sections of the code which did not
  172. //   originate with me.  Since the original parts of the code
  173. //   are copyrighted, you must credit Mark Pflaging in order
  174. //   to legally use the original code for ANY purpose.
  175. //   That's a lot easier than paying though, isn't it?
  176. //
  177. //   P.S.  Yes, my 24 bit video card has arrived.  Whew!  I used it
  178. //   to sample a GIF of myself, MTP.GIF, available on CServe
  179. //   Comart forum.  See y'all in Cyberspace!
  180. //
  181. //      !~\         /~!
  182. //      |   \     /   |
  183. //      !     \ /     !    A"A  |~~~\ |  /
  184. //      |      V      |   A___A |___/ |K
  185. //      !             !   A   A | \   |  \
  186. //      |             |   _____/    \______
  187. //      V             V
  188. //     -^-           -^-
  189. //
  190.  
  191.