home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Virtual Reality Zone
/
VRZONE.ISO
/
mac
/
PC
/
PCGLOVE
/
O2GLOVE
/
OOPGLOVE.DOC
< prev
next >
Wrap
Text File
|
1995-04-04
|
9KB
|
191 lines
============================================================================
Credits:
----------------------------------------------------------------------------
Originally "power.c" (c) manfredo 9/91
Address: manfredo@opal.cs.tu-berlin.de
----------------------------------------------------------------------------
Ported to PC compatibles by Greg Alt 10/91
Address: galt@peruvian.utah.edu or galt@es.dsd.com
----------------------------------------------------------------------------
Substantially rewritten by Dave Stampe (c) 1991: PWRFILT.C
No cash, no warranty, no flames. This stuff works great, so gimme credit.
Address: dstamp@watserv1.uwaterloo.ca 17/10/91
----------------------------------------------------------------------------
Converted to C++ by Mitch Allen 11/91
Address: 76040.2757@compuserve.com
This source was adapted from theGlove.c contained in pglove.zip
It is suggested that you download that file for instructions on
how to build an interface for the Power Glove to your PC.
When posting copies, please also post pglove.zip as well.
(THEGLOVE.DOC and PGPINS.GIF contain all necessary information
on connecting the glove to a parallel port. -MTP)
Significant enhancements:
- Glove code now contained in a class.
- In theory multiple glove objects could be spawned easily.
Helpful if someone ever invents one for we lefties.
- Derived glove classes may be developed.
===========================================================================
Compilation:
----------------------------------------------------------------------------
The graphics are geared for Borland/Turbo C++. I've included a project
file, which I also ran through PRJ2MAK to generate the sample MAKE file.
Obviously the directories are geared for my machine.
The code consists of three files:
cf_glove.hpp - Glove class prototype.
cf_glove.cpp - Glove member functions.
uf_glove.cpp - Sample unit test.
Also, the glove class drawing routines are geared for 640 x 480 VGA
graphics.
============================================================================
// Made more object-oriented by Mark Pflaging 5/29/92.
// Compuserve 72033, 1552
// If you want to send money, send me an e-mail message and
// ask for my address. That would be very kind of you, but
// it is unneccessary. Just let me read YOUR code, alright?
//
// ReDesigned for a 486/33. I am trying to paramaterize the
// timing constraints so that it will be easy for "someone"
// or "something" to adjust them for the particular computer
// it is running on. These parameters appear in calls to 'Channel'
// constructors, see "SMOOTH.HPP".
//
// I spent some time experimenting with the hardwired values in
// the fdelay calls, and making calls to fdelay. See "MYDELAY.C".
//
// The graphics are now autodeteced and autoscaled depending on your
// hardware's highest res graphics! I'm developing this on
// a hercules graphics card while I await a 24-bit color card.
// (boy that's an upgrade!) If you don't have a graphics card,
// leave me an email message, U don't know what U R missin'.
//
// Somebody still needs to do autodetection
// of the port that the glove is connected to. Compuserve
// files describe how to build the parallel port interface.
// Another goal was to break Mitch's big objects into smaller
// ones whose functions are more specific. I am probably going
// to move this thing to Windows, so the more object-oriented the
// better. But mostly, I'm gonna make these graphics a lot better.
//
// Summary of improvements to graphics:
// Inside the former recatangle appears a representation of the
// glove, movable fingers included. If you twist your wrist, the
// glove rotates too! This is accomplished using a "metagraphics"
// approach, which essentially takes a set of points describing
// the still hand and applies a mathematical translation to
// the "deglitched" glove input.
//
// I also made the buttons turn on and off certain features, these are
// documented in the on-line help.
//
// Some last-minute compile notes: There are 5 warnings when I compile,
// they are safe to ignore. I used Borland C++ 3.0 with 387
// floating point and '286 code generated. You will have
// to recompile and/or change some #defines for a non-486/33
// machine, but believe me its pretty simple.
//
// There's a lot more that can be done with this code!
//
// RELEASE 2 9/28/92 Mark Pflaging
// Many, many nice improvements have been made!
//
// Most importantly, the code is now machine independent!
// This was achieved by precisely computing delay constraints
// for the inner delay loops. Code has been tested on a slow
// 286 up to a 486/50 and should work for faster machines when
// they are available. Thanks to Kendall Bennett for the
// indispensable timer classes. I have included the full
// ZTIMER11.ZIP here although not all of it is used in this
// code. Also thanks to D. P. Research Company for providing
// guidance and the basic strategy for computing the timing
// constraints.
//
// Secondly, the glove sampling is now interrupt driven!
// I cannot give a full explanation of interrupts here for
// those not in the know. To put it simply, there is a way
// to set a chip on motherboard to generate an "interrupt"
// at an extremely predictable rate. Every time an interrupt
// occurs, a piece of code is called which samples the glove.
// The beauty of it is that the computer can be doing some-
// thing completely different between interrupts! The rate
// of sampling can be precisely controlled, and appears to
// take place in the "background." This code (ISR.CPP and
// ISR.HPP) is a C++ conversion of code in Dave Stampe's
// REND386 V3. So thanks go to him for making his source
// available, and giving me a clue as to how interrupts work.
// But boos to him for making it so sloppy. Additionally, the
// docs in these files are not too good but the code is pretty
// straightforward when you understand the strategy that was
// employed.
//
// Thirdly, MANY parameters that control both the driver and
// the demo program are read from the GLOVE.INI file which
// has a format many will recognize from MS Windows. The code
// for reading this file was written TOTALLY from scratch by
// ME! It is a GENERAL PURPOSE set of classes that is, dare I
// say, an example of rather advanced Object Oriented Programming.
// You may find these classes (INI.HPP and INI.CPP) useful in
// many other applications! It is a great way to allow users
// to change program parameters without recompiling or having
// to remember 16 billion command line switches. Also, it is
// a somewhat standard format. See INI.DOC for design notes,
// and GLOVE.INI for program specific parameter descriptions.
// TESTINI.CPP contains a sloppy test of the class.
//
// Some improvements have been made to the class hierarchy
// of the driver. It should now be easier to understand.
// The problem with the buttons has been fixed.
//
// In the intervening time between releases, I have learned a
// lot about how the glove behaves in different situations.
// If you are experiencing problems such as jumpiness or
// dimensions not responding, read HELPME!.DOC. GLITCHY
// RESPONSE IS NOT THE FAULT OF THIS CODE! There is VERY
// little I could do with software to eliminate the
// problems with shadowing. But you need NOT get used to it!
// My glove is responding near the accuracy of a mouse!!
// Yours can too! Read HELPME!.DOC!
//
// Well, sorry it took so long, but I hope you like it and/or
// find it useful. The next step is to add an event queue
// that holds glove, mouse, and keyboard events. Then I will
// add a module to interpret glove gestures and put them
// back into the queue. See GESTURE.TXT for more details.
// I am still NOT planning to make my work commercial
// or even shareware. This software is provided on an
// "as is" basis and the author shall not be held liable for
// any losses directly or indirectly related to the use of
// this code. All code not otherwise indicated has been
// written independently by Mark Pflaging. Credit has been
// given in those sections of the code which did not
// originate with me. Since the original parts of the code
// are copyrighted, you must credit Mark Pflaging in order
// to legally use the original code for ANY purpose.
// That's a lot easier than paying though, isn't it?
//
// P.S. Yes, my 24 bit video card has arrived. Whew! I used it
// to sample a GIF of myself, MTP.GIF, available on CServe
// Comart forum. See y'all in Cyberspace!
//
// !~\ /~!
// | \ / |
// ! \ / ! A"A |~~~\ | /
// | V | A___A |___/ |K
// ! ! A A | \ | \
// | | _____/ \______
// V V
// -^- -^-
//