cgkit-commits Mailing List for Python Computer Graphics Kit (Page 47)
Brought to you by:
mbaas
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(54) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(40) |
Feb
(69) |
Mar
(43) |
Apr
(81) |
May
(92) |
Jun
(56) |
Jul
(35) |
Aug
(59) |
Sep
(41) |
Oct
(26) |
Nov
(15) |
Dec
(12) |
2006 |
Jan
(20) |
Feb
(23) |
Mar
(47) |
Apr
(87) |
May
(43) |
Jun
(7) |
Jul
(20) |
Aug
(5) |
Sep
(29) |
Oct
(83) |
Nov
(34) |
Dec
(16) |
2007 |
Jan
(11) |
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
(3) |
Feb
(24) |
Mar
(2) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(4) |
Sep
(8) |
Oct
(2) |
Nov
(1) |
Dec
|
2009 |
Jan
(8) |
Feb
(22) |
Mar
(5) |
Apr
(10) |
May
(9) |
Jun
(8) |
Jul
(2) |
Aug
(13) |
Sep
(10) |
Oct
|
Nov
|
Dec
(1) |
2010 |
Jan
(3) |
Feb
(1) |
Mar
(4) |
Apr
(2) |
May
(3) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
(7) |
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(1) |
Nov
(4) |
Dec
(5) |
2013 |
Jan
|
Feb
(5) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Matthias B. <mb...@us...> - 2005-01-20 10:30:33
|
Update of /cvsroot/cgkit/cgkit2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29293 Modified Files: changelog.txt Log Message: Update Index: changelog.txt =================================================================== RCS file: /cvsroot/cgkit/cgkit2/changelog.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** changelog.txt 17 Jan 2005 21:52:33 -0000 1.5 --- changelog.txt 20 Jan 2005 10:30:24 -0000 1.6 *************** *** 7,13 **** - New module "glove" that wraps the 5DT Data Glove SDK - - The viewer generates SpaceMouse/SpaceBall and tablet events - New module "wintab" that wraps the Wintab API - New module "spacedevice" that wraps the 3Dconnexion 3DXWare SDK - New class: FreeCamera - STL importer added (ASCII and binary) --- 7,13 ---- - New module "glove" that wraps the 5DT Data Glove SDK - New module "wintab" that wraps the Wintab API - New module "spacedevice" that wraps the 3Dconnexion 3DXWare SDK + - The viewer generates SpaceMouse/SpaceBall and tablet events - New class: FreeCamera - STL importer added (ASCII and binary) *************** *** 22,25 **** --- 22,30 ---- Bugfixes: + - The view transformation of the camera was using the local transform instead + of the world transform (i.e. attaching the camera to other objects didn't + work as expected) + - ODEDynamics: The time step was only taken during initialization and + could be wrong if it was changed afterwards. - 3DS import: Meshes without corresponding Node (as generated by Wings 3D, for example) will now be imported, too. *************** *** 28,31 **** --- 33,39 ---- - OGRE-Viewer: Compile fixes for Linux (gcc). Bugfix: The viewer crashed when using non-OpenGL light sources. + - supportlib: When a new controller for a slot was set, there were + situations where the onValueChanged() notification was issued twice. + This should be fixed now. |
From: Matthias B. <mb...@us...> - 2005-01-20 10:27:39
|
Update of /cvsroot/cgkit/cgkit2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28530 Modified Files: config_template.cfg Log Message: Now mentions the MACROS variable Index: config_template.cfg =================================================================== RCS file: /cvsroot/cgkit/cgkit2/config_template.cfg,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** config_template.cfg 17 Jan 2005 21:52:36 -0000 1.4 --- config_template.cfg 20 Jan 2005 10:27:28 -0000 1.5 *************** *** 17,20 **** --- 17,24 ---- # - LIBS: This list contains the libraries that should be used # during linking. + # - MACROS: This list contains 2-tuples (<name>, <value>) that define + # preprocessor macros which should be set. <value> can be + # None if you only want to define the symbol. Example: + # MACROS += [("GCC_3_1", None)] # # Note: Always *add* items to one of the lists instead of replacing *************** *** 61,80 **** ###################################################################### ! # Libd3DS #LIB3DS_AVAILABLE = True #LIB3DS_PATH = r"C:\Programme\Programmieren\lib3ds-1.2.0" #LIB3DS_LIBNAME = "lib3ds-120s" ! # CyberX3D #CYBERX3D_AVAILABLE = True #CYBERX3D_PATH = r"" #XERCES_PATH = r"" ! # Ogre3D #OGRE_AVAILABLE = False #INC_DIRS += [] #LIB_DIRS += [] ! # 3DXWare SpaceMouse/SpaceBall SDK #THREEDXWARE_AVAILABLE = True #INC_DIRS += [] --- 65,88 ---- ###################################################################### ! ####### Libd3DS ####### ! #LIB3DS_AVAILABLE = True #LIB3DS_PATH = r"C:\Programme\Programmieren\lib3ds-1.2.0" #LIB3DS_LIBNAME = "lib3ds-120s" ! ####### CyberX3D ####### ! #CYBERX3D_AVAILABLE = True #CYBERX3D_PATH = r"" #XERCES_PATH = r"" ! ####### Ogre3D ####### ! #OGRE_AVAILABLE = False #INC_DIRS += [] #LIB_DIRS += [] ! ####### 3DXWare SpaceMouse/SpaceBall SDK ####### ! #THREEDXWARE_AVAILABLE = True #INC_DIRS += [] *************** *** 82,86 **** #LIBS += ["siapp"] ! # Wintab #WINTAB_AVAILABLE = True #INC_DIRS += [] --- 90,95 ---- #LIBS += ["siapp"] ! ####### Wintab ####### ! #WINTAB_AVAILABLE = True #INC_DIRS += [] *************** *** 88,92 **** #LIBS += ["wintab32"] ! # Data Glove. # The variable GLOVESDK_DLL must contain the name of the glove dll. # It can either be the full path or filename only in which case it's --- 97,102 ---- #LIBS += ["wintab32"] ! ####### Data Glove ####### ! # The variable GLOVESDK_DLL must contain the name of the glove dll. # It can either be the full path or filename only in which case it's |
From: Matthias B. <mb...@us...> - 2005-01-20 10:25:56
|
Update of /cvsroot/cgkit/cgkit2/supportlib/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28124/supportlib/include Modified Files: slot.h Log Message: When a new controller was set, it could happen that a onValueChanged() notification was sent twice. This is fixed now. Index: slot.h =================================================================== RCS file: /cvsroot/cgkit/cgkit2/supportlib/include/slot.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** slot.h 21 Dec 2004 10:22:51 -0000 1.2 --- slot.h 20 Jan 2005 10:25:46 -0000 1.3 *************** *** 724,732 **** if (controller!=0) controller->removeDependent(this); - // ...and connect to new one - ctrl->addDependent(this); controller = newctrl; flags &= ~CACHE_VALID; notifyDependents(); } --- 724,732 ---- if (controller!=0) controller->removeDependent(this); + // ...and connect to new one controller = newctrl; flags &= ~CACHE_VALID; + ctrl->addDependent(this); notifyDependents(); } |
From: Matthias B. <mb...@us...> - 2005-01-18 17:13:37
|
Update of /cvsroot/cgkit/cgkit2/wrappers/glove In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23122/wrappers/glove Modified Files: py_glove.cpp Log Message: Build fixes for MSVC7.1 The return type of getThresholdAll() was wrong Index: py_glove.cpp =================================================================== RCS file: /cvsroot/cgkit/cgkit2/wrappers/glove/py_glove.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** py_glove.cpp 17 Jan 2005 21:52:55 -0000 1.1 --- py_glove.cpp 18 Jan 2005 17:13:20 -0000 1.2 *************** *** 7,11 **** #include <boost/python.hpp> ! #include <iostream.h> #include <exception> #include <stdlib.h> --- 7,11 ---- #include <boost/python.hpp> ! #include <iostream> #include <exception> #include <stdlib.h> *************** *** 75,79 **** int getNumGestures(); int getGesture(); ! list getThresholdAll(); tuple getThreshold(int sensor); void setThresholdAll(list lower, list upper); --- 75,79 ---- int getNumGestures(); int getGesture(); ! tuple getThresholdAll(); tuple getThreshold(int sensor); void setThresholdAll(list lower, list upper); *************** *** 522,526 **** \return (Lower, Upper) ----------------------------------------------------------------------*/ ! list DataGlove::getThresholdAll() { if (glovePtr==NULL) --- 522,526 ---- \return (Lower, Upper) ----------------------------------------------------------------------*/ ! tuple DataGlove::getThresholdAll() { if (glovePtr==NULL) |
From: Matthias B. <mb...@us...> - 2005-01-18 16:56:14
|
Update of /cvsroot/cgkit/cgkit2/doc/tex In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18472/tex Modified Files: building.tex cgkit.tex spacedevice.tex Added Files: freecamera.tex glove.tex Log Message: Updated docs --- NEW FILE: freecamera.tex --- % FreeCamera \section{\class{FreeCamera} --- Free camera} The \class{FreeCamera} class can be freely positioned and oriented in the scene. \begin{classdesc}{FreeCamera}{name = "FreeCamera",\\ fov = 45.0,\\ target = None,\\ focallength = 0,\\ fstop = 0\\ } \var{fov} is the field of view in degrees. \var{target} is the point that the camera will initially look at. If no target is specified the camera remains in its default orientation. Note that the target is only used to compute an initial orientation. The orientation will not be updated if the camera moves (use a \class{TargetCamera} if you want that behavior). \var{focallength} is the focal length of the camera and \var{fstop} the aperture number that determines the lens diameter. These values are used to turn on depth of field. Depth of field is activated if both attributes are set to a value different from 0 (note however, that not every renderer supports depth of field). The focal distance is set so that the target point will always be in focus. \end{classdesc} The \class{FreeCamera} class has the following slots (in addition to the slots of the \class{WorldObject} base class): \begin{tableiv}{l|l|c|l}{code}{Slot}{Type}{Access}{Description} \lineiv{fov_slot}{float}{rw}{Field of view in degrees} \lineiv{focallength_slot}{float}{rw}{Focal length of the camera} \lineiv{fstop_slot}{float}{rw}{Aperture number} \end{tableiv} Index: building.tex =================================================================== RCS file: /cvsroot/cgkit/cgkit2/doc/tex/building.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** building.tex 13 Dec 2004 10:56:50 -0000 1.1 --- building.tex 18 Jan 2005 16:56:00 -0000 1.2 *************** *** 15,23 **** \item \ulink{Boost}{http://www.boost.org/} (v1.31) \item \ulink{SCons}{http://www.scons.org/} (v0.96.1) ! \item \ulink{lib3ds}{http://lib3ds.sourceforge.net/} (v1.3.0) - Optional ! \item \ulink{CyberX3D}{http://www.cybergarage.org/vrml/cx3d/cx3dcc/index.html} - Optional ! \item \ulink{OGRE}{http://www.ogre3d.org/} - Optional \item \ulink{STLport}{http://www.stlport.com/} - Only required on Windows when you want to use OGRE. \end{itemize} --- 15,26 ---- \item \ulink{Boost}{http://www.boost.org/} (v1.31) \item \ulink{SCons}{http://www.scons.org/} (v0.96.1) ! \item \ulink{lib3ds}{http://lib3ds.sourceforge.net/} (v1.3.0) - {\bf Optional}. You need this if you want to import/export 3DS files. ! \item \ulink{CyberX3D}{http://www.cybergarage.org/vrml/cx3d/cx3dcc/index.html} - {\bf Optional}. You need this if you want to import/export VRML or X3D files. ! \item \ulink{OGRE}{http://www.ogre3d.org/} - {\bf Optional}. You need this if you want to use the OGRE-Viewer. \item \ulink{STLport}{http://www.stlport.com/} - Only required on Windows when you want to use OGRE. + \item \ulink{3DxWare SDK}{http://www.3dconnexion.com/sdk.htm} - {\bf Optional} (currently Windows only). You need this if you want to use a SpaceMouse or SpaceBall. + \item \ulink{Wintab Programmer's Kit}{http://www.pointing.com/} - {\bf Optional} (Windows only). You need this if you want to use a tablet (or similar device). + \item \ulink{GloveSDK}{http://www.5dt.com/} - {\bf Optional}. You need this if you want to use a data glove. {\bf Note}: Download the version 2 SDK from the Ultra series, this can also be used with older gloves. You could also use version 1, but some functionality won't be available then. \end{itemize} Index: spacedevice.tex =================================================================== RCS file: /cvsroot/cgkit/cgkit2/doc/tex/spacedevice.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** spacedevice.tex 9 Jan 2005 20:13:07 -0000 1.1 --- spacedevice.tex 18 Jan 2005 16:56:01 -0000 1.2 *************** *** 8,11 **** --- 8,21 ---- SpaceMouse or SpaceBall devices. + % available() + \begin{funcdesc}{available}{} + Returns \code{True} if the module functionality is available. Currently, + this function will only return \code{True} under Windows and if the + functionality was enabled during compilation. + + If this function returns \code{False}, an exception will be raised + whenever you try to instantiate a class from this module. + \end{funcdesc} + \begin{classdesc}{SpaceDevice}{} --- NEW FILE: glove.tex --- \section{\module{glove} --- Wrapper around the 5DT Data Glove SDK} \declaremodule{extension}{cgkit.glove} \modulesynopsis{Wrapper around the 5DT Data Glove SDK} This module contains a wrapper around the Data Glove SDK by \ulink{Fifth Dimension Technologies}{http://www.5dt.com/}. The underlying SDK can either be version 1 or version 2. Note that some methods are only implemented if the module was compiled with version 2 of the SDK. All the functions from the SDK are wrapped as methods of the \class{DataGlove} class. Most methods require that a connection to a glove device was previously established via the \method{open()} method. % available() \begin{funcdesc}{available}{} Returns \code{True} if the Data Glove functionality is available. If this function returns \code{False}, an exception will be raised whenever you try to instantiate a class from this module. \end{funcdesc} %------------------------------------------------------------------ \begin{classdesc}{DataGlove}{} This class encapsulates the data glove handle and contains the functions from the SDK as methods. Before you can use most of the methods, you have to establish a connection to a data glove by calling the \method{open()} method. \end{classdesc} % isConnected \begin{methoddesc}{isConnected}{} Returns \code{True} if a connection to a data glove was established (i.e. if \method{open()} was successfully called). \end{methoddesc} % open \begin{methoddesc}{open}{port} Establish a connection to the data glove at the specified port. \var{port} is a string containing the serial port to use. For example, under Windows you might specify \code{"COM1"}, \code{"COM2"}, etc. \end{methoddesc} % close \begin{methoddesc}{close}{} Disconnect from the glove. The return value is a boolean indicating if there was an error. Calling \method{close()} while there is no connection established is not considered an error. \end{methoddesc} % getGloveHand \begin{methoddesc}{getGloveHand}{} Return the handedness of the glove. The return value is either \code{FD_HAND_LEFT} or \code{FD_HAND_RIGHT}. If you want a string representation of the handedness you can use the return value as key for the dictionary \code{HANDEDNESS}. \end{methoddesc} % getGloveType \begin{methoddesc}{getGloveType}{} Return the type of the data glove. The return value is one of the following: \begin{tableii}{l|l}{code}{Type}{Description} \lineii{FD_GLOVENONE}{No data glove} \lineii{FD_GLOVE5U}{Data Glove 5 Ultra serial} \lineii{FD_GLOVE5UW}{Data Glove 5 Ultra serial, wireless} \lineii{FD_GLOVE5U_USB}{Data Glove 5 Ultra USB} \lineii{FD_GLOVE7}{Data Glove 5} \lineii{FD_GLOVE7W}{Data Glove 5, wireless} \lineii{FD_GLOVE16}{Data Glove 16} \lineii{FD_GLOVE16W}{Data Glove 16, wireless} \lineii{FD_GLOVE14U}{Data Glove 14 Ultra serial} \lineii{FD_GLOVE14UW}{Data Glove 14 Ultra serial, wireless} \lineii{FD_GLOVE14U_USB}{Data Glove 14 Ultra USB} \end{tableii} If you want the string representation of the glove type you can use the return value as key for the dictionary \code{GLOVETYPE}. Todo: The above are only the return values of the v2 SDK. \end{methoddesc} % getNumSensors \begin{methoddesc}{getNumSensors}{} Return the number of sensors. \end{methoddesc} % getNumGestures \begin{methoddesc}{getNumGestures}{} Return the number of available gestures. \end{methoddesc} % getSensorRawAll \begin{methoddesc}{getSensorRawAll}{} Return a list with the raw sensor values of all sensors. \end{methoddesc} % getSensorRaw \begin{methoddesc}{getSensorRaw}{sensor} Return the raw sensor value of the specified sensor. \var{sensor} is an integer in the range between 0 and \method{getNumSensors()}-1. \end{methoddesc} % setSensorRawAll \begin{methoddesc}{setSensorRawAll}{data} \end{methoddesc} \begin{methoddesc}{setSensorRaw}{sensor, raw} \end{methoddesc} % getSensorScaledAll \begin{methoddesc}{getSensorScaledAll}{} Return a list of the scaled sensor values of all sensors. \end{methoddesc} % getSensorScaled \begin{methoddesc}{getSensorScaled}{sensor} Return the scaled sensor value of the specified sensor. \var{sensor} is an integer in the range between 0 and \method{getNumSensors()}-1. \end{methoddesc} % getCalibrationAll \begin{methoddesc}{getCalibrationAll}{} Return the current auto-calibration settings for all sensors. The return value is a 2-tuple (\var{lower}, \var{upper}) where \var{lower} is a list with the minimum values and \var{upper} a list with maximum values. \end{methoddesc} % getCalibration \begin{methoddesc}{getCalibration}{sensor} Return the auto-calibration for one particular sensor. The return value is a 2-tuple (\var{lower}, \var{upper}) that contains the minimum and maximum value. \end{methoddesc} % setCalibrationAll \begin{methoddesc}{setCalibrationAll}{lower, upper} Set the auto-calibration settings. \var{lower} is a list with the minimum sensor values and \var{upper} is a list with the maximum values. \end{methoddesc} % setCalibration \begin{methoddesc}{setCalibration}{sensor, lower, upper} Set the auto-calibration values for one sensor. \var{lower} is the minimum sensor value and \var{upper} is the maximum value. \end{methoddesc} % getSensorMaxAll \begin{methoddesc}{getSensorMaxAll}{} Return a list with the maximum scaled values of the sensors. \end{methoddesc} % getSensorMax \begin{methoddesc}{getSensorMax}{sensor} Return a maximum scaled sensor value for one particular sensor. \end{methoddesc} % setSensorMaxAll \begin{methoddesc}{setSensorMaxAll}{max} Set the maximum scaled sensor values. \var{max} is a list with the values. \end{methoddesc} % setSensorMax \begin{methoddesc}{setSensorMax}{sensor, max} Set the maximum scaled sensor value for one sensor. \end{methoddesc} % resetCalibration \begin{methoddesc}{resetCalibration}{[sensor]} Reset the auto-calibration values. In version 2 of the SDK you can pass an optional sensor index which will only reset that particular sensor. \end{methoddesc} % getGesture \begin{methoddesc}{getGesture}{} Return the current gesture. \end{methoddesc} % getThresholdAll \begin{methoddesc}{getThresholdAll}{} Return the current gesture recognition threshold values. The return value is a 2-tuple (\var{lower}, \var{upper}) that contains the lower and upper threshold values. \end{methoddesc} % getThreshold \begin{methoddesc}{getThreshold}{sensor} Return the gesture recognition threshold values for one sensor. The return value is a 2-tuple (\var{lower}, \var{upper}) that contains the lower and upper threshold value. \end{methoddesc} % setThresholdAll \begin{methoddesc}{setThresholdAll}{lower, upper} Set the gesture recognition threshold values for all sensors. \var{lower} is a list with the lower threshold values and \var{upper} is a list with the upper threshold values. \end{methoddesc} % setThreshold \begin{methoddesc}{setThreshold}{sensor, lower, upper} Set the gesture recognition threshold values for one sensor. \var{lower} is the lower threshold value and \var{upper} is the upper threshold value. \end{methoddesc} % getGloveInfo \begin{methoddesc}{getGloveInfo}{} Return a string with glove information. \end{methoddesc} % getDriverInfo \begin{methoddesc}{getDriverInfo}{} Return a string with driver information. \end{methoddesc} % scanUSB \begin{methoddesc}{scanUSB}{} Scans the USB for available gloves. The return value is a list with product IDs of the gloves found. The product IDs can be one of \code{DG14U_R}, \code{DG14U_L}, \code{DG5U_R} and \code{DG5U_R}.\\ Availability: {\bf V2} \end{methoddesc} % setCallback \begin{methoddesc}{setCallback}{callback} Set a callback function that gets called when a new packet was received. \var{callback} must be a callable object.\\ Availability: {\bf V2} \end{methoddesc} % getPacketRate \begin{methoddesc}{getPacketRate}{} Return the current packet rate in Hertz.\\ Availability: {\bf V2} \end{methoddesc} % newData \begin{methoddesc}{newData}{} Returns a boolean that indicates whether new data is available or not.\\ Availability: {\bf V2} \end{methoddesc} % getFWVersionMajor \begin{methoddesc}{getFWVersionMajor}{} Return the major version of the glove's firmware. This is only implemented for the Data Glove 14 Ultra. Other gloves will always return 0.\\ Availability: {\bf V2} \end{methoddesc} % getFWVersionMinor \begin{methoddesc}{getFWVersionMinor}{} Return the minor version of the glove's firmware. This is only implemented for the Data Glove 14 Ultra. Other gloves will always return 0.\\ Availability: {\bf V2} \end{methoddesc} % getAutoCalibrate \begin{methoddesc}{getAutoCalibrate}{} Returns \code{True} if auto calibration is activated.\\ Availability: {\bf V2} \end{methoddesc} % setAutoCalibrate \begin{methoddesc}{setAutoCalibrate}{flag} Enable or disable auto-calibration. If \var{flag} is \code{True} auto-calibration is enabled.\\ Availability: {\bf V2} \end{methoddesc} % saveCalibration \begin{methoddesc}{saveCalibration}{filename} Save the current calibration data to disk.\\ Availability: {\bf V2} \end{methoddesc} % loadCalibration \begin{methoddesc}{loadCalibration}{filename} Load the calibration settings from a file.\\ Availability: {\bf V2} \end{methoddesc} \begin{notice}[note] The module uses the SDK by Fifth Dimension Technologies (5DT) which can be found at \url{http://www.5dt.com/}. The following is the copyright information of the SDK: {\em Copyright (C) 2000-2004, 5DT <Fifth Dimension Technologies>} \end{notice} Index: cgkit.tex =================================================================== RCS file: /cvsroot/cgkit/cgkit2/doc/tex/cgkit.tex,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** cgkit.tex 9 Jan 2005 20:13:07 -0000 1.4 --- cgkit.tex 18 Jan 2005 16:56:00 -0000 1.5 *************** *** 100,103 **** --- 100,104 ---- \input{spacedevice.tex} \input{wintab.tex} + \input{glove.tex} %--- *************** *** 158,161 **** --- 159,163 ---- \input{group.tex} \input{targetcamera.tex} + \input{freecamera.tex} \input{glpointlight.tex} \input{gltargetspotlight.tex} |
From: Matthias B. <mb...@us...> - 2005-01-17 21:53:31
|
Update of /cvsroot/cgkit/cgkit2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21834 Modified Files: changelog.txt config_template.cfg setup.py Log Message: Wrapper around the 5DT Data Glove SDK added Index: config_template.cfg =================================================================== RCS file: /cvsroot/cgkit/cgkit2/config_template.cfg,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** config_template.cfg 11 Jan 2005 16:37:21 -0000 1.3 --- config_template.cfg 17 Jan 2005 21:52:36 -0000 1.4 *************** *** 87,88 **** --- 87,100 ---- #LIB_DIRS += [] #LIBS += ["wintab32"] + + # Data Glove. + # The variable GLOVESDK_DLL must contain the name of the glove dll. + # It can either be the full path or filename only in which case it's + # assumed to be located in GLOVESDK_BASE\dll. + + #GLOVESDK_AVAILABLE = True + #GLOVESDK_BASE = "" + #GLOVESDK_DLL = "fglove.dll" + #INC_DIRS += [] + #LIB_DIRS += [] + #LIBS += ["fglove"] Index: changelog.txt =================================================================== RCS file: /cvsroot/cgkit/cgkit2/changelog.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** changelog.txt 9 Jan 2005 20:13:05 -0000 1.4 --- changelog.txt 17 Jan 2005 21:52:33 -0000 1.5 *************** *** 6,12 **** New features: - The viewer generates SpaceMouse/SpaceBall and tablet events ! - New module wintab that wraps the Wintab API ! - SpaceMouse/SpaceBall support - New class: FreeCamera - STL importer added (ASCII and binary) --- 6,13 ---- New features: + - New module "glove" that wraps the 5DT Data Glove SDK - The viewer generates SpaceMouse/SpaceBall and tablet events ! - New module "wintab" that wraps the Wintab API ! - New module "spacedevice" that wraps the 3Dconnexion 3DXWare SDK - New class: FreeCamera - STL importer added (ASCII and binary) Index: setup.py =================================================================== RCS file: /cvsroot/cgkit/cgkit2/setup.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** setup.py 10 Jan 2005 08:42:46 -0000 1.5 --- setup.py 17 Jan 2005 21:52:37 -0000 1.6 *************** *** 145,148 **** --- 145,150 ---- THREEDXWARE_AVAILABLE = False WINTAB_AVAILABLE = False + GLOVESDK_AVAILABLE = False + GLOVESDK_BASE = None BOOST_BASE = None BOOST_DLL = "boost_python.dll" *************** *** 387,390 **** --- 389,414 ---- ,define_macros=MACROS)] + # Data glove + if GLOVESDK_AVAILABLE: + if GLOVESDK_BASE!=None: + INC_DIRS += [os.path.join(GLOVESDK_BASE, "inc")] + LIB_DIRS += [os.path.join(GLOVESDK_BASE, "lib")] + + if sys.platform=="win32": + MACROS += [("GLOVESDK_2_0", None)] + if os.path.isabs(GLOVESDK_DLL): + packageDLL(GLOVESDK_DLL) + else: + packageDLL(os.path.join(GLOVESDK_BASE, "dll", GLOVESDK_DLL)) + + MACROS += [("LIB3DS_AVAILABLE", None)] + ext_modules += [Extension("_glove", ["wrappers/glove/py_glove.cpp"] + ,libraries=LIBS + ,include_dirs=INC_DIRS + ,library_dirs=LIB_DIRS + ,extra_compile_args=CC_ARGS + ,extra_link_args=LINK_ARGS + ,define_macros=MACROS)] + # Infos... *************** *** 396,399 **** --- 420,424 ---- print "3DXWare: %s"%(enabledStr(THREEDXWARE_AVAILABLE)) print "Wintab: %s"%(enabledStr(WINTAB_AVAILABLE)) + print "Glove module: %s"%(enabledStr(GLOVESDK_AVAILABLE)) print 70*"=" *************** *** 411,415 **** PACKAGE_NAME+".Interfaces", PACKAGE_NAME+".wintab", ! PACKAGE_NAME+".spacedevice"], # Stick all extension modules into the main package --- 436,441 ---- PACKAGE_NAME+".Interfaces", PACKAGE_NAME+".wintab", ! PACKAGE_NAME+".spacedevice", ! PACKAGE_NAME+".glove"], # Stick all extension modules into the main package |
From: Matthias B. <mb...@us...> - 2005-01-17 21:53:30
|
Update of /cvsroot/cgkit/cgkit2/cgkit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21834/cgkit Modified Files: .cvsignore Log Message: Wrapper around the 5DT Data Glove SDK added Index: .cvsignore =================================================================== RCS file: /cvsroot/cgkit/cgkit2/cgkit/.cvsignore,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** .cvsignore 11 Jan 2005 16:38:29 -0000 1.3 --- .cvsignore 17 Jan 2005 21:52:46 -0000 1.4 *************** *** 5,7 **** _wintab.pyd _spacedevice.pyd ! --- 5,7 ---- _wintab.pyd _spacedevice.pyd ! _glove.pyd |
From: Matthias B. <mb...@us...> - 2005-01-17 21:53:05
|
Update of /cvsroot/cgkit/cgkit2/cgkit/glove In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21834/cgkit/glove Added Files: .cvsignore __init__.py constants.py Log Message: Wrapper around the 5DT Data Glove SDK added --- NEW FILE: .cvsignore --- *.pyc --- NEW FILE: __init__.py --- ########################################################################### # cgkit - Python Computer Graphics Kit # Copyright (C) 2004 Matthias Baas (ba...@ir...) # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # cgkit homepage: http://cgkit.sourceforge.net ########################################################################### # $Id: __init__.py,v 1.1 2005/01/17 21:52:55 mbaas Exp $ from constants import * try: # The glove wrapper is in the root cgkit directory so that the # boost dll can be found. from cgkit._glove import * _glove_available = True except: _glove_available = False # Define dummy classes/functions: class DataGlove: def __init__(self): raise RuntimeError("The data glove driver is not available") def available(): """Returns True if the glove functionality is available. """ return _glove_available --- NEW FILE: constants.py --- ########################################################################### # cgkit - Python Computer Graphics Kit # Copyright (C) 2004 Matthias Baas (ba...@ir...) # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # cgkit homepage: http://cgkit.sourceforge.net ########################################################################### # $Id: constants.py,v 1.1 2005/01/17 21:52:55 mbaas Exp $ # Glove handedness FD_HAND_LEFT = 0 FD_HAND_RIGHT = 1 HANDEDNESS = { FD_HAND_LEFT : "Left", FD_HAND_RIGHT : "Right" } # Glove type FD_GLOVENONE = 0 FD_GLOVE5U = 1 # DG5 Ultra serial FD_GLOVE5UW = 2 # DG5 Ultra serial, wireless FD_GLOVE5U_USB = 3 # DG5 Ultra USB FD_GLOVE7 = 4 # 7-sensor FD_GLOVE7W = 5 # 7-sensor, wireless FD_GLOVE16 = 6 # 16-sensor FD_GLOVE16W = 7 # 16-sensor, wireless FD_GLOVE14U = 8 # DG14 Ultra serial FD_GLOVE14UW = 9 # DG14 Ultra serial, wireless FD_GLOVE14U_USB = 10 # DG14 Ultra USB GLOVETYPE = { FD_GLOVENONE : "none", FD_GLOVE5U : "Data Glove 5 Ultra serial", FD_GLOVE5UW : "Data Glove 5 Ultra serial, wireless", FD_GLOVE5U_USB : "Data Glove 5 Ultra USB", FD_GLOVE7 : "Data Glove 5", FD_GLOVE7W : "Data Glove 5, wireless", FD_GLOVE16 : "Data Glove 16", FD_GLOVE16W : "Data Glove 16, wireless", FD_GLOVE14U : "Data Glove 14 Ultra serial", FD_GLOVE14UW : "Data Glove 14 Ultra serial, wireless", FD_GLOVE14U_USB : "Data Glove 14 Ultra USB" } # the following are the glove type values of the 1.x SDK #FD_GLOVENONE = 0 # no glove #FD_GLOVE7 = 1 # 7-sensor #FD_GLOVE7W = 2 # 7-sensor, wireless #FD_GLOVE16 = 3 # 16-sensor #FD_GLOVE16W = 4 # 16-sensor, wireless # Sensors FD_THUMBNEAR = 0 FD_THUMBFAR = 1 FD_THUMBINDEX = 2 FD_INDEXNEAR = 3 FD_INDEXFAR = 4 FD_INDEXMIDDLE = 5 FD_MIDDLENEAR = 6 FD_MIDDLEFAR = 7 FD_MIDDLERING = 8 FD_RINGNEAR = 9 FD_RINGFAR = 10 FD_RINGLITTLE = 11 FD_LITTLENEAR = 12 FD_LITTLEFAR = 13 FD_THUMBPALM = 14 FD_WRISTBEND = 15 FD_PITCH = 16 FD_ROLL = 17 # Product IDs for USB Gloves DG14U_R = 0x00 DG14U_L = 0x01 DG5U_R = 0x10 DG5U_L = 0x11 |
From: Matthias B. <mb...@us...> - 2005-01-17 21:53:05
|
Update of /cvsroot/cgkit/cgkit2/wrappers/glove In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21834/wrappers/glove Added Files: py_glove.cpp Log Message: Wrapper around the 5DT Data Glove SDK added --- NEW FILE: py_glove.cpp --- /* 5DT Data Glove SDK wrapper This file can be used to wrap the SDK v1 and v2. For v2 the variable GLOVESDK_2_0 has to be defined. */ #include <boost/python.hpp> #include <iostream.h> #include <exception> #include <stdlib.h> #ifdef WIN32 // windows.h is included so that LPVOID is defined (which is used in fglove.h // from the SDK v2) #include <windows.h> #endif #include <fglove.h> using namespace boost::python; // Exception class class GloveException : public std::exception { public: std::string msg; GloveException(std::string amsg="") : msg(amsg) {} ~GloveException() throw() {} /// Return exception message. const char* what() const throw() { return msg.c_str(); } }; /** This class contains the driver functions as methods. */ class DataGlove { private: /// Glove handle fdGlove* glovePtr; /// Number of sensors int numSensors; /// Buffer for glove info unsigned char gloveInfo[32]; /// Buffer for driver info unsigned char driverInfo[32]; /// Buffer for sensor values (and other stuff) // Size = Max. number of sensor values * sizeof(float) * 2 // (is also used for the integer values) void* sensorBuf; public: // Callback function (Python callable) object callback; public: DataGlove(); ~DataGlove(); bool isConnected(); void open(std::string port); bool close(); int getGloveHand(); int getGloveType(); int getNumSensors(); int getNumGestures(); int getGesture(); list getThresholdAll(); tuple getThreshold(int sensor); void setThresholdAll(list lower, list upper); void setThreshold(int sensor, float lower, float upper); boost::python::str getGloveInfo(); boost::python::str getDriverInfo(); list getSensorRawAll(); unsigned short getSensorRaw(int sensor); void setSensorRawAll(list data); void setSensorRaw(int sensor, unsigned short raw); list getSensorScaledAll(); float getSensorScaled(int sensor); tuple getCalibrationAll(); tuple getCalibration(int sensor); void setCalibrationAll(list lower, list upper); void setCalibration(int sensor, unsigned short lower, unsigned short upper); void resetCalibration(); list getSensorMaxAll(); float getSensorMax(int sensor); void setSensorMaxAll(list max); void setSensorMax(int sensor, float max); // Version 2.0 SDK #ifdef GLOVESDK_2_0 void resetCalibration(int sensor); list scanUSB(); int getPacketRate(); bool newData(); int getFWVersionMajor(); int getFWVersionMinor(); bool getAutoCalibrate(); bool setAutoCalibrate(bool flag); void saveCalibration(std::string filename); void loadCalibration(std::string filename); void setCallback(object acallback); #endif }; /**--------------------------------------------------------------------- Constructor. ----------------------------------------------------------------------*/ DataGlove::DataGlove() : glovePtr(NULL), numSensors(0), sensorBuf(NULL), callback() { } /**--------------------------------------------------------------------- Destructor. ----------------------------------------------------------------------*/ DataGlove::~DataGlove() { close(); } /**--------------------------------------------------------------------- Returns true if there's a connection to a data glove. \return True, if the connection exists ----------------------------------------------------------------------*/ bool DataGlove::isConnected() { return glovePtr!=NULL; } /**--------------------------------------------------------------------- Connect to a glove. \param port Port name ("COM1", ...) \return False, bei einem Fehler. ----------------------------------------------------------------------*/ void DataGlove::open(std::string port) { // Initialize glove device glovePtr = fdOpen((char*)(port.c_str())); if (glovePtr==NULL) throw GloveException("Connecting to a glove device at port "+port+" failed."); numSensors = fdGetNumSensors(glovePtr); // Allocate the buffer for the sensor values... sensorBuf = malloc(2*sizeof(float)*numSensors); if (sensorBuf==NULL) { fdClose(glovePtr); glovePtr = NULL; throw GloveException("Out of memory"); } } /**--------------------------------------------------------------------- Disconnect from glove. \return False if an error occured. ----------------------------------------------------------------------*/ bool DataGlove::close() { int res; if (glovePtr==NULL) return true; res = fdClose(glovePtr); free(sensorBuf); glovePtr = NULL; sensorBuf = NULL; numSensors = 0; return res!=0; } /**--------------------------------------------------------------------- Obtain the handedness of the glove. \return 0=Left, 1=Right ----------------------------------------------------------------------*/ int DataGlove::getGloveHand() { if (glovePtr==NULL) throw GloveException("No connection to a data glove established."); return fdGetGloveHand(glovePtr); } /**--------------------------------------------------------------------- Return the type of the data glove. \return Glove type as integer (FD_GLOVENONE, ...) ----------------------------------------------------------------------*/ int DataGlove::getGloveType() { if (glovePtr==NULL) throw GloveException("No connection to a data glove established."); return fdGetGloveType(glovePtr); } /**--------------------------------------------------------------------- Return the number of sensors. \return Number of sensors. ----------------------------------------------------------------------*/ int DataGlove::getNumSensors() { if (glovePtr==NULL) throw GloveException("No connection to a data glove established."); return numSensors; } /**--------------------------------------------------------------------- Return the raw sensor values. \return List with all sensor values (each in the range from 0-4095) ----------------------------------------------------------------------*/ list DataGlove::getSensorRawAll() { if (glovePtr==NULL) throw GloveException("No connection to a data glove established."); unsigned short* buf = (unsigned short*)sensorBuf; list res; fdGetSensorRawAll(glovePtr, buf); for(int i=0; i<numSensors; i++) { res.append(buf[i]); } return res; } /**--------------------------------------------------------------------- Return a raw sensor value. \param sensor Sensor index (0,1,...) ----------------------------------------------------------------------*/ unsigned short DataGlove::getSensorRaw(int sensor) { if (glovePtr==NULL) throw GloveException("No connection to a data glove established."); if ((sensor<0) || (sensor>=numSensors)) throw GloveException("Sensor index out of range"); return fdGetSensorRaw(glovePtr, sensor); } /**--------------------------------------------------------------------- Set the raw sensor values. ----------------------------------------------------------------------*/ void DataGlove::setSensorRawAll(list data) { if (glovePtr==NULL) throw GloveException("No connection to a data glove established."); unsigned short* pData = (unsigned short*)sensorBuf; if (data.attr("__len__")()!=numSensors) throw GloveException("Invalid number of sensor values."); for(int i=0; i<numSensors; i++) { pData[i] = extract<unsigned short>(data[i]); } fdSetSensorRawAll(glovePtr, pData); } /**--------------------------------------------------------------------- Set a raw sensor value. \param sensor Sensor index (0,1,...) \param raw Sensor value ----------------------------------------------------------------------*/ void DataGlove::setSensorRaw(int sensor, unsigned short raw) { if (glovePtr==NULL) throw GloveException("No connection to a data glove established."); if ((sensor<0) || (sensor>=numSensors)) throw GloveException("Sensor index out of range"); fdSetSensorRaw(glovePtr, sensor, raw); } /**--------------------------------------------------------------------- Return the scaled sensor values. \return List with all sensor values (as floats) ----------------------------------------------------------------------*/ list DataGlove::getSensorScaledAll() { if (glovePtr==NULL) throw GloveException("No connection to a data glove established."); float* buf = (float*)sensorBuf; list res; fdGetSensorScaledAll(glovePtr, buf); for(int i=0; i<numSensors; i++) { res.append(buf[i]); } return res; } /**--------------------------------------------------------------------- Return a scaled sensor value. \param sensor Sensor index (0,1,...) ----------------------------------------------------------------------*/ float DataGlove::getSensorScaled(int sensor) { if (glovePtr==NULL) throw GloveException("No connection to a data glove established."); if ((sensor<0) || (sensor>=numSensors)) throw GloveException("Sensor index out of range"); return fdGetSensorScaled(glovePtr, sensor); } /**--------------------------------------------------------------------- Return the current auto-calibration settings. \return Tuple (LowerValues, UpperValues) ----------------------------------------------------------------------*/ tuple DataGlove::getCalibrationAll() { if (glovePtr==NULL) throw GloveException("No connection to a data glove established."); unsigned short* upper = (unsigned short*)sensorBuf; unsigned short* lower = ((unsigned short*)(sensorBuf))+numSensors; list resU, resL; fdGetCalibrationAll(glovePtr, upper, lower); for(int i=0; i<numSensors; i++) { resU.append(upper[i]); resL.append(lower[i]); } return make_tuple(resL, resU); } /**--------------------------------------------------------------------- Return the auto-calibration settings for one particular sensor. \param sensor Sensor index (0,1,...) \return Tuple (lower, upper) ----------------------------------------------------------------------*/ tuple DataGlove::getCalibration(int sensor) { if (glovePtr==NULL) throw GloveException("No connection to a data glove established."); if ((sensor<0) || (sensor>=numSensors)) throw GloveException("Sensor index out of range"); unsigned short lower, upper; fdGetCalibration(glovePtr, sensor, &upper, &lower); return make_tuple(lower, upper); } /**--------------------------------------------------------------------- Set the auto-calibration settings. ----------------------------------------------------------------------*/ void DataGlove::setCalibrationAll(list lower, list upper) { if (glovePtr==NULL) throw GloveException("No connection to a data glove established."); unsigned short* pupper = (unsigned short*)sensorBuf; unsigned short* plower = ((unsigned short*)sensorBuf)+numSensors; if ((lower.attr("__len__")()!=numSensors) || (upper.attr("__len__")()!=numSensors)) { throw GloveException("Invalid number of calibration values."); } for(int i=0; i<numSensors; i++) { plower[i] = extract<unsigned short>(lower[i]); pupper[i] = extract<unsigned short>(upper[i]); } fdSetCalibrationAll(glovePtr, pupper, plower); } /**--------------------------------------------------------------------- Set the auto-calibration settings for one particular sensor. \param sensor Sensor index (0,1,...) \param lower Minimum value \param upper Maximum value ----------------------------------------------------------------------*/ void DataGlove::setCalibration(int sensor, unsigned short lower, unsigned short upper) { if (glovePtr==NULL) throw GloveException("No connection to a data glove established."); if ((sensor<0) || (sensor>=numSensors)) throw GloveException("Sensor index out of range"); fdSetCalibration(glovePtr, sensor, upper, lower); } /**--------------------------------------------------------------------- Reset auto-calibration values. ----------------------------------------------------------------------*/ void DataGlove::resetCalibration() { if (glovePtr==NULL) throw GloveException("No connection to a data glove established."); fdResetCalibration(glovePtr); } /**--------------------------------------------------------------------- Return the maximum scaled values of the sensors. \return List with all maximum sensor values (as floats) ----------------------------------------------------------------------*/ list DataGlove::getSensorMaxAll() { if (glovePtr==NULL) throw GloveException("No connection to a data glove established."); float* buf = (float*)sensorBuf; list res; fdGetSensorMaxAll(glovePtr, buf); for(int i=0; i<numSensors; i++) { res.append(buf[i]); } return res; } /**--------------------------------------------------------------------- Return a maximum scaled sensor value for one particular sensor. \param sensor Sensor index (0,1,...) ----------------------------------------------------------------------*/ float DataGlove::getSensorMax(int sensor) { if (glovePtr==NULL) throw GloveException("No connection to a data glove established."); if ((sensor<0) || (sensor>=numSensors)) throw GloveException("Sensor index out of range"); return fdGetSensorMax(glovePtr, sensor); } /**--------------------------------------------------------------------- Set the maximum scaled sensor values. ----------------------------------------------------------------------*/ void DataGlove::setSensorMaxAll(list max) { if (glovePtr==NULL) throw GloveException("No connection to a data glove established."); float* pMax = (float*)sensorBuf; if (max.attr("__len__")()!=numSensors) throw GloveException("Invalid number of maximum sensor values."); for(int i=0; i<numSensors; i++) { pMax[i] = extract<float>(max[i]); } fdSetSensorMaxAll(glovePtr, pMax); } /**--------------------------------------------------------------------- Set the maximum scaled sensor value. \param sensor Sensor index (0,1,...) \param max Maximum sensor value ----------------------------------------------------------------------*/ void DataGlove::setSensorMax(int sensor, float max) { if (glovePtr==NULL) throw GloveException("No connection to a data glove established."); if ((sensor<0) || (sensor>=numSensors)) throw GloveException("Sensor index out of range"); fdSetSensorMax(glovePtr, sensor, max); } /**--------------------------------------------------------------------- Return the number of available gestures. \return Number of gestures ----------------------------------------------------------------------*/ int DataGlove::getNumGestures() { if (glovePtr==NULL) throw GloveException("No connection to a data glove established."); return fdGetNumGestures(glovePtr); } /**--------------------------------------------------------------------- Returns the current gesture recognition threshold values. \return (Lower, Upper) ----------------------------------------------------------------------*/ list DataGlove::getThresholdAll() { if (glovePtr==NULL) throw GloveException("No connection to a data glove established."); float* upper = (float*)sensorBuf; float* lower = ((float*)sensorBuf)+numSensors; list resL, resU; fdGetThresholdAll(glovePtr, upper, lower); for(int i=0; i<numSensors; i++) { resU.append(upper[i]); resL.append(lower[i]); } return make_tuple(resL, resU); } /**--------------------------------------------------------------------- Return the gesture recognition threshold values. \param sensor Sensor index (0,1,...) \return Tuple (lower, upper) ----------------------------------------------------------------------*/ tuple DataGlove::getThreshold(int sensor) { if (glovePtr==NULL) throw GloveException("No connection to a data glove established."); if ((sensor<0) || (sensor>=numSensors)) throw GloveException("Sensor index out of range"); float lower, upper; fdGetThreshold(glovePtr, sensor, &upper, &lower); return make_tuple(lower, upper); } /**--------------------------------------------------------------------- Set the gesture recognition threshold values. ----------------------------------------------------------------------*/ void DataGlove::setThresholdAll(list lower, list upper) { if (glovePtr==NULL) throw GloveException("No connection to a data glove established."); float* pupper = (float*)sensorBuf; float* plower = ((float*)sensorBuf)+numSensors; if ((lower.attr("__len__")()!=numSensors) || (upper.attr("__len__")()!=numSensors)) { throw GloveException("Invalid number of threshold values."); } for(int i=0; i<numSensors; i++) { plower[i] = extract<float>(lower[i]); pupper[i] = extract<float>(upper[i]); } fdSetThresholdAll(glovePtr, pupper, plower); } /**--------------------------------------------------------------------- Set the gesture recognition threshold values. \param sensor Sensor index (0,1,...) ----------------------------------------------------------------------*/ void DataGlove::setThreshold(int sensor, float lower, float upper) { if (glovePtr==NULL) throw GloveException("No connection to a data glove established."); if ((sensor<0) || (sensor>=numSensors)) throw GloveException("Sensor index out of range"); fdSetThreshold(glovePtr, sensor, upper, lower); } /**--------------------------------------------------------------------- Return the current gesture. \return Gesture ----------------------------------------------------------------------*/ int DataGlove::getGesture() { if (glovePtr==NULL) throw GloveException("No connection to a data glove established."); return fdGetGesture(glovePtr); } /**--------------------------------------------------------------------- Return glove information. \return Info string. ----------------------------------------------------------------------*/ boost::python::str DataGlove::getGloveInfo() { if (glovePtr==NULL) throw GloveException("No connection to a data glove established."); fdGetGloveInfo(glovePtr, gloveInfo); return boost::python::str((const char*)gloveInfo); } /**--------------------------------------------------------------------- Return driver information. \return Driver info (string). ----------------------------------------------------------------------*/ boost::python::str DataGlove::getDriverInfo() { if (glovePtr==NULL) throw GloveException("No connection to a data glove established."); fdGetDriverInfo(glovePtr, driverInfo); return boost::python::str((const char*)driverInfo); } ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// // SDK 2.0 methods ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// #ifdef GLOVESDK_2_0 /**--------------------------------------------------------------------- Reset auto-calibration values for one sensor. ----------------------------------------------------------------------*/ void DataGlove::resetCalibration(int sensor) { if (glovePtr==NULL) throw GloveException("No connection to a data glove established."); if ((sensor<0) || (sensor>=numSensors)) throw GloveException("Sensor index out of range"); fdResetCalibration(glovePtr, sensor); } /**--------------------------------------------------------------------- Scans the USB for available gloves. Returns a list of product IDs of the gloves found. ----------------------------------------------------------------------*/ list DataGlove::scanUSB() { list res; unsigned short pid[10]; int numMax = 10; int n; n = fdScanUSB(pid, numMax); for(int i=0; i<n; i++) { res.append(pid[i]); } return res; } /**--------------------------------------------------------------------- Return the packet rate. ----------------------------------------------------------------------*/ int DataGlove::getPacketRate() { if (glovePtr==NULL) throw GloveException("No connection to a data glove established."); return fdGetPacketRate(glovePtr); } /**--------------------------------------------------------------------- Check if new data is available. ----------------------------------------------------------------------*/ bool DataGlove::newData() { if (glovePtr==NULL) throw GloveException("No connection to a data glove established."); return fdNewData(glovePtr); } /**--------------------------------------------------------------------- Get the major version of the glove's firmware. ----------------------------------------------------------------------*/ int DataGlove::getFWVersionMajor() { if (glovePtr==NULL) throw GloveException("No connection to a data glove established."); return fdGetFWVersionMajor(glovePtr); } /**--------------------------------------------------------------------- Get the minor version of the glove's firmware. ----------------------------------------------------------------------*/ int DataGlove::getFWVersionMinor() { if (glovePtr==NULL) throw GloveException("No connection to a data glove established."); return fdGetFWVersionMinor(glovePtr); } /**--------------------------------------------------------------------- Check if auto calibrate is on. ----------------------------------------------------------------------*/ bool DataGlove::getAutoCalibrate() { if (glovePtr==NULL) throw GloveException("No connection to a data glove established."); return fdGetAutoCalibrate(glovePtr); } /**--------------------------------------------------------------------- Enable/disable auto calibration. ----------------------------------------------------------------------*/ bool DataGlove::setAutoCalibrate(bool flag) { if (glovePtr==NULL) throw GloveException("No connection to a data glove established."); return fdSetAutoCalibrate(glovePtr, flag); } /**--------------------------------------------------------------------- Save calibration data. ----------------------------------------------------------------------*/ void DataGlove::saveCalibration(std::string filename) { if (glovePtr==NULL) throw GloveException("No connection to a data glove established."); if (!fdSaveCalibration(glovePtr, filename.c_str())) throw GloveException("Could not save calibration file \""+filename+"\"."); } /**--------------------------------------------------------------------- Load calibration data. ----------------------------------------------------------------------*/ void DataGlove::loadCalibration(std::string filename) { if (glovePtr==NULL) throw GloveException("No connection to a data glove established."); if (!fdLoadCalibration(glovePtr, filename.c_str())) throw GloveException("Could not load calibration file \""+filename+"\"."); } // Dispatcher function. // This function is used as actual callback function. arg is a pointer // to the DataGlove object that activated the callback. This function will // then call the callback function stored in the DataGlove object. void dispatcher(void* arg) { object& f = ((DataGlove*)arg)->callback; f(); } /**--------------------------------------------------------------------- Set a callback function that gets called when a new packet was received. ----------------------------------------------------------------------*/ void DataGlove::setCallback(object acallback) { if (glovePtr==NULL) throw GloveException("No connection to a data glove established."); // Is callback None? if (acallback==object()) { fdSetCallback(glovePtr, NULL, NULL); return; } callback = acallback; fdSetCallback(glovePtr, (void*)dispatcher, this); } #endif // GLOVESDK_2_0 ////////////////////////////////////////////////////////////////////// BOOST_PYTHON_MODULE(_glove) { void (DataGlove::*resetCalibrationAll)() = &DataGlove::resetCalibration; #ifdef GLOVESDK_2_0 void (DataGlove::*resetCalibration)(int) = &DataGlove::resetCalibration; #endif class_<DataGlove>("DataGlove") .def("isConnected", &DataGlove::isConnected) .def("open", &DataGlove::open) .def("close", &DataGlove::close) .def("getGloveHand", &DataGlove::getGloveHand) .def("getGloveType", &DataGlove::getGloveType) .def("getNumSensors", &DataGlove::getNumSensors) .def("getNumGestures", &DataGlove::getNumGestures) .def("getGloveInfo", &DataGlove::getGloveInfo) .def("getDriverInfo", &DataGlove::getDriverInfo) .def("getSensorRawAll", &DataGlove::getSensorRawAll) .def("getSensorRaw", &DataGlove::getSensorRaw) .def("setSensorRawAll", &DataGlove::setSensorRawAll) .def("setSensorRaw", &DataGlove::setSensorRaw) .def("getSensorScaledAll", &DataGlove::getSensorScaledAll) .def("getSensorScaled", &DataGlove::getSensorScaled) .def("getCalibrationAll", &DataGlove::getCalibrationAll) .def("getCalibration", &DataGlove::getCalibration) .def("setCalibrationAll", &DataGlove::setCalibrationAll) .def("setCalibration", &DataGlove::setCalibration) .def("getSensorMaxAll", &DataGlove::getSensorMaxAll) .def("getSensorMax", &DataGlove::getSensorMax) .def("setSensorMaxAll", &DataGlove::setSensorMaxAll) .def("setSensorMax", &DataGlove::setSensorMax) .def("resetCalibration", resetCalibrationAll) .def("getGesture", &DataGlove::getGesture) .def("getThresholdAll", &DataGlove::getThresholdAll) .def("getThreshold", &DataGlove::getThreshold) .def("setThresholdAll", &DataGlove::setThresholdAll) .def("setThreshold", &DataGlove::setThreshold) // version 2.0 SDK #ifdef GLOVESDK_2_0 .def("resetCalibration", resetCalibration) .def("scanUSB", &DataGlove::scanUSB) .def("setCallback", &DataGlove::setCallback) .def("getPacketRate", &DataGlove::getPacketRate) .def("newData", &DataGlove::newData) .def("getFWVersionMajor", &DataGlove::getFWVersionMajor) .def("getFWVersionMinor", &DataGlove::getFWVersionMinor) .def("getAutoCalibrate", &DataGlove::getAutoCalibrate) .def("setAutoCalibrate", &DataGlove::setAutoCalibrate) .def("saveCalibration", &DataGlove::saveCalibration) .def("loadCalibration", &DataGlove::loadCalibration) #endif ; } |
From: Matthias B. <mb...@us...> - 2005-01-17 21:49:16
|
Update of /cvsroot/cgkit/cgkit2/cgkit/glove In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21168/cgkit/glove Log Message: Directory /cvsroot/cgkit/cgkit2/cgkit/glove added to the repository |
From: Matthias B. <mb...@us...> - 2005-01-17 21:49:15
|
Update of /cvsroot/cgkit/cgkit2/wrappers/glove In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21168/wrappers/glove Log Message: Directory /cvsroot/cgkit/cgkit2/wrappers/glove added to the repository |
From: Matthias B. <mb...@us...> - 2005-01-17 09:03:23
|
Update of /cvsroot/cgkit/cgkit2/cgkit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4886/cgkit Modified Files: odedynamics.py Log Message: Bugfix: The time step was only taken during initialization Index: odedynamics.py =================================================================== RCS file: /cvsroot/cgkit/cgkit2/cgkit/odedynamics.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** odedynamics.py 12 Dec 2004 14:31:11 -0000 1.1.1.1 --- odedynamics.py 17 Jan 2005 09:03:13 -0000 1.2 *************** *** 104,110 **** self.contactgroup = ode.JointGroup() - # Time step - self.dt = scene.timer().timestep - # A dictionary with WorldObjects as keys and ODEBodies as values self.body_dict = {} --- 104,107 ---- *************** *** 316,320 **** # Sim loop... ! subdt = self.dt/self.substeps for i in range(self.substeps): self.numcontacts = 0 --- 313,317 ---- # Sim loop... ! subdt = getScene().timer().timestep/self.substeps for i in range(self.substeps): self.numcontacts = 0 |
From: Matthias B. <mb...@us...> - 2005-01-17 09:02:19
|
Update of /cvsroot/cgkit/cgkit2/cgkit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4666/cgkit Modified Files: freecamera.py targetcamera.py Log Message: Bugfix: The view transformation of the camera was using the local transform instead of the world transform Index: targetcamera.py =================================================================== RCS file: /cvsroot/cgkit/cgkit2/cgkit/targetcamera.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** targetcamera.py 12 Dec 2004 14:31:27 -0000 1.1.1.1 --- targetcamera.py 17 Jan 2005 09:02:06 -0000 1.2 *************** *** 103,107 **** # viewTransformation def viewTransformation(self): ! return self.transform.inverse() ## protected: --- 103,107 ---- # viewTransformation def viewTransformation(self): ! return self.worldtransform.inverse() ## protected: Index: freecamera.py =================================================================== RCS file: /cvsroot/cgkit/cgkit2/cgkit/freecamera.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** freecamera.py 9 Jan 2005 20:13:06 -0000 1.1 --- freecamera.py 17 Jan 2005 09:02:00 -0000 1.2 *************** *** 92,96 **** # viewTransformation def viewTransformation(self): ! return self.transform.inverse() ## protected: --- 92,96 ---- # viewTransformation def viewTransformation(self): ! return self.worldtransform.inverse() ## protected: |
From: Matthias B. <mb...@us...> - 2005-01-11 16:39:14
|
Update of /cvsroot/cgkit/cgkit2/wrappers/spacedevice In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5087/wrappers/spacedevice Modified Files: py_spacedevice.cpp Log Message: Fixed _spacedevice module name. The viewer will now continue if no 3D input device is present Index: py_spacedevice.cpp =================================================================== RCS file: /cvsroot/cgkit/cgkit2/wrappers/spacedevice/py_spacedevice.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** py_spacedevice.cpp 9 Jan 2005 20:13:07 -0000 1.1 --- py_spacedevice.cpp 11 Jan 2005 16:38:29 -0000 1.2 *************** *** 285,289 **** ! BOOST_PYTHON_MODULE(spacedevice) { register_exception_translator<SpaceDeviceException>(&ExceptionTranslator); --- 285,289 ---- ! BOOST_PYTHON_MODULE(_spacedevice) { register_exception_translator<SpaceDeviceException>(&ExceptionTranslator); |
From: Matthias B. <mb...@us...> - 2005-01-11 16:39:11
|
Update of /cvsroot/cgkit/cgkit2/cgkit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5087/cgkit Modified Files: .cvsignore Log Message: Fixed _spacedevice module name. The viewer will now continue if no 3D input device is present Index: .cvsignore =================================================================== RCS file: /cvsroot/cgkit/cgkit2/cgkit/.cvsignore,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** .cvsignore 9 Jan 2005 20:13:06 -0000 1.2 --- .cvsignore 11 Jan 2005 16:38:29 -0000 1.3 *************** *** 4,7 **** cgkitinfo.py _wintab.pyd ! spacedevice.pyd --- 4,7 ---- cgkitinfo.py _wintab.pyd ! _spacedevice.pyd |
From: Matthias B. <mb...@us...> - 2005-01-11 16:38:41
|
Update of /cvsroot/cgkit/cgkit2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5087 Modified Files: viewer.py Log Message: Fixed _spacedevice module name. The viewer will now continue if no 3D input device is present Index: viewer.py =================================================================== RCS file: /cvsroot/cgkit/cgkit2/viewer.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** viewer.py 10 Jan 2005 08:42:46 -0000 1.4 --- viewer.py 11 Jan 2005 16:38:29 -0000 1.5 *************** *** 366,376 **** print "of pygame. Please upgrade to v1.6.2 or later." else: ! self.spacedevice.open("viewer.py", hwnd) ! self.spacedevice.setUIMode(True) ! if self.options.verbose: ! typ,btns,degs,beep,firmware = self.spacedevice.getDeviceInfo() ! print "3D input device:",firmware ! print "%s: %d buttons, %d degrees of freedom"%(typ,btns,degs) ! pygame.event.set_allowed(SYSWMEVENT) # Open Wintab context --- 366,381 ---- print "of pygame. Please upgrade to v1.6.2 or later." else: ! try: ! self.spacedevice.open("viewer.py", hwnd) ! self.spacedevice.setUIMode(True) ! if self.options.verbose: ! typ,btns,degs,beep,firmware = self.spacedevice.getDeviceInfo() ! print "3D input device:",firmware ! print "%s: %d buttons, %d degrees of freedom"%(typ,btns,degs) ! pygame.event.set_allowed(SYSWMEVENT) ! except RuntimeError, e: ! print "SpaceDevice:",e ! print "SpaceMouse/SpaceBall support is disabled." ! self.spacedevice = None # Open Wintab context |
From: Matthias B. <mb...@us...> - 2005-01-11 16:37:31
|
Update of /cvsroot/cgkit/cgkit2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4893 Modified Files: config_template.cfg Log Message: Wintab section added Index: config_template.cfg =================================================================== RCS file: /cvsroot/cgkit/cgkit2/config_template.cfg,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** config_template.cfg 9 Jan 2005 20:13:05 -0000 1.2 --- config_template.cfg 11 Jan 2005 16:37:21 -0000 1.3 *************** *** 82,83 **** --- 82,88 ---- #LIBS += ["siapp"] + # Wintab + #WINTAB_AVAILABLE = True + #INC_DIRS += [] + #LIB_DIRS += [] + #LIBS += ["wintab32"] |
From: Matthias B. <mb...@us...> - 2005-01-10 08:42:55
|
Update of /cvsroot/cgkit/cgkit2/cgkit/spacedevice In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25910/cgkit/spacedevice Added Files: .cvsignore __init__.py Log Message: Reorganized the spacedevice module so that it is always available, even when 3DXWare was not compiled --- NEW FILE: .cvsignore --- *.pyc --- NEW FILE: __init__.py --- ########################################################################### # cgkit - Python Computer Graphics Kit # Copyright (C) 2004 Matthias Baas (ba...@ir...) # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # cgkit homepage: http://cgkit.sourceforge.net ########################################################################### # $Id: __init__.py,v 1.1 2005/01/10 08:42:46 mbaas Exp $ try: # The 3DxWare wrapper is in the root cgkit directory so that the # boost dll can be found. from cgkit._spacedevice import * _spacedevice_available = True except: _spacedevice_available = False # Define dummy classes/functions: class SpaceDevice: def __init__(self): raise RuntimeError("The spacedevice module is not available") def available(): """Returns True if the spacedevice functionality is available. """ return _spacedevice_available |
From: Matthias B. <mb...@us...> - 2005-01-10 08:42:55
|
Update of /cvsroot/cgkit/cgkit2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25910 Modified Files: setup.py viewer.py Log Message: Reorganized the spacedevice module so that it is always available, even when 3DXWare was not compiled Index: setup.py =================================================================== RCS file: /cvsroot/cgkit/cgkit2/setup.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** setup.py 9 Jan 2005 20:13:05 -0000 1.4 --- setup.py 10 Jan 2005 08:42:46 -0000 1.5 *************** *** 369,373 **** # 3DXWare SpaceMouse/SpaceBall if THREEDXWARE_AVAILABLE: ! ext_modules += [Extension("spacedevice", ["wrappers/spacedevice/py_spacedevice.cpp"] ,libraries=LIBS ,include_dirs=INC_DIRS --- 369,373 ---- # 3DXWare SpaceMouse/SpaceBall if THREEDXWARE_AVAILABLE: ! ext_modules += [Extension("_spacedevice", ["wrappers/spacedevice/py_spacedevice.cpp"] ,libraries=LIBS ,include_dirs=INC_DIRS *************** *** 410,414 **** PACKAGE_NAME+".GUI", PACKAGE_NAME+".Interfaces", ! PACKAGE_NAME+".wintab"], # Stick all extension modules into the main package --- 410,415 ---- PACKAGE_NAME+".GUI", PACKAGE_NAME+".Interfaces", ! PACKAGE_NAME+".wintab", ! PACKAGE_NAME+".spacedevice"], # Stick all extension modules into the main package Index: viewer.py =================================================================== RCS file: /cvsroot/cgkit/cgkit2/viewer.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** viewer.py 9 Jan 2005 20:13:05 -0000 1.3 --- viewer.py 10 Jan 2005 08:42:46 -0000 1.4 *************** *** 259,267 **** # Initialize SpaceMouse/SpaceBall ! if self.enable_spacedevice: try: self.spacedevice = cgkit.spacedevice.SpaceDevice() except RuntimeError, e: print "3DxWare exception:",e # Initialize Wintab context --- 259,270 ---- # Initialize SpaceMouse/SpaceBall ! if self.enable_spacedevice and cgkit.spacedevice.available(): try: self.spacedevice = cgkit.spacedevice.SpaceDevice() except RuntimeError, e: print "3DxWare exception:",e + else: + if self.options.verbose and self.enable_spacedevice: + print "SpaceMouse/SpaceBall module (spacedevice) not available" # Initialize Wintab context |
From: Matthias B. <mb...@us...> - 2005-01-10 08:41:15
|
Update of /cvsroot/cgkit/cgkit2/cgkit/spacedevice In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25537/cgkit/spacedevice Log Message: Directory /cvsroot/cgkit/cgkit2/cgkit/spacedevice added to the repository |
From: Matthias B. <mb...@us...> - 2005-01-09 20:13:19
|
Update of /cvsroot/cgkit/cgkit2/cgkit/wintab In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28239/cgkit/wintab Added Files: .cvsignore __init__.py constants.py Log Message: New: STL importer / New: Wintab wrapper / New: 3DxWare wrapper (SpaceMouse/SpaceBall) / Tablet/SpaceMouse support in the viewer / New: FreeCamera / Bugfix: 3DS importer will also import meshes without corresponding node (as produced by Wings 3D) --- NEW FILE: .cvsignore --- *.pyc --- NEW FILE: __init__.py --- ########################################################################### # cgkit - Python Computer Graphics Kit # Copyright (C) 2004 Matthias Baas (ba...@ir...) # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # cgkit homepage: http://cgkit.sourceforge.net ########################################################################### # $Id: __init__.py,v 1.1 2005/01/09 20:13:06 mbaas Exp $ from constants import * try: # The wintab wrapper is in the root cgkit directory so that the # boost dll can be found. from cgkit._wintab import * _wintab_available = True except: _wintab_available = False # Define dummy classes/functions: class Context: def __init__(self): raise RuntimeError("The Wintab driver is not installed") def info(category): raise RuntimeError("The Wintab driver is not installed") def available(): """Returns True if the Wintab functionality is available. """ return _wintab_available --- NEW FILE: constants.py --- ########################################################################### # cgkit - Python Computer Graphics Kit # Copyright (C) 2004 Matthias Baas (ba...@ir...) # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # cgkit homepage: http://cgkit.sourceforge.net ########################################################################### # $Id: constants.py,v 1.1 2005/01/09 20:13:06 mbaas Exp $ # Information categories WTI_INTERFACE = 1 WTI_STATUS = 2 WTI_DEFCONTEXT = 3 WTI_DEFSYSCTX = 4 WTI_DDCTXS = 400 WTI_DSCTXS = 500 WTI_DEVICES = 100 WTI_CURSORS = 200 WTI_EXTENSIONS = 300 # Hardware capabilities HWC_INTEGRATED = 0x0001 HWC_TOUCH = 0x0002 HWC_HARDPROX = 0x0004 HWC_PHYSID_CURSORS = 0x0008 # Unit specifiers TU_NONE = 0 TU_INCHES = 1 TU_CENTIMETERS = 2 TU_CIRCLE = 3 # Cursor capabilities CRC_MULTIMODE = 0x0001 CRC_AGGREGATE = 0x0002 CRC_INVERT = 0x0004 # System button assignment values SBN_NONE = 0x00 SBN_LCLICK = 0x01 SBN_LDBLCLICK = 0x02 SBN_LDRAG = 0x03 SBN_RCLICK = 0x04 SBN_RDBLCLICK = 0x05 SBN_RDRAG = 0x06 SBN_MCLICK = 0x07 SBN_MDBLCLICK = 0x08 SBN_MDRAG = 0x09 # for Pen Windows SBN_PTCLICK = 0x10 SBN_PTDBLCLICK = 0x20 SBN_PTDRAG = 0x30 SBN_PNCLICK = 0x40 SBN_PNDBLCLICK = 0x50 SBN_PNDRAG = 0x60 SBN_P1CLICK = 0x70 SBN_P1DBLCLICK = 0x80 SBN_P1DRAG = 0x90 SBN_P2CLICK = 0xA0 SBN_P2DBLCLICK = 0xB0 SBN_P2DRAG = 0xC0 SBN_P3CLICK = 0xD0 SBN_P3DBLCLICK = 0xE0 SBN_P3DRAG = 0xF0 # Context option values CXO_SYSTEM = 0x0001 CXO_PEN = 0x0002 CXO_MESSAGES = 0x0004 CXO_MARGIN = 0x8000 CXO_MGNINSIDE = 0x4000 CXO_CSRMESSAGES = 0x0008 # Context status values CXS_DISABLED = 0x0001 CXS_OBSCURED = 0x0002 CXS_ONTOP = 0x0004 # Context lock values CXL_INSIZE = 0x0001 CXL_INASPECT = 0x0002 CXL_SENSITIVITY = 0x0004 CXL_MARGIN = 0x0008 CXL_SYSOUT = 0x0010 # WTPKT bits PK_CONTEXT = 0x0001 # reporting context PK_STATUS = 0x0002 # status bits PK_TIME = 0x0004 # time stamp PK_CHANGED = 0x0008 # change bit vector PK_SERIAL_NUMBER = 0x0010 # packet serial number PK_CURSOR = 0x0020 # reporting cursor PK_BUTTONS = 0x0040 # button information PK_X = 0x0080 # x axis PK_Y = 0x0100 # y axis PK_Z = 0x0200 # z axis PK_NORMAL_PRESSURE = 0x0400 # normal or tip pressure PK_TANGENT_PRESSURE = 0x0800 # tangential or barrel pressure PK_ORIENTATION = 0x1000 # orientation info: tilts */ PK_ROTATION = 0x2000 # rotation info; 1.1 # Packet status values TPS_PROXIMITY = 0x0001 TPS_QUEUE_ERR = 0x0002 TPS_MARGIN = 0x0004 TPS_GRAB = 0x0008 TPS_INVERT = 0x0010 # Relative buttons TBN_NONE = 0 TBN_UP = 1 TBN_DOWN = 2 |
From: Matthias B. <mb...@us...> - 2005-01-09 20:13:19
|
Update of /cvsroot/cgkit/cgkit2/doc/tex In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28239/doc/tex Modified Files: cgkit.tex events.tex geomobject.tex viewer.tex Added Files: spacedevice.tex stlimport.tex wintab.tex Log Message: New: STL importer / New: Wintab wrapper / New: 3DxWare wrapper (SpaceMouse/SpaceBall) / Tablet/SpaceMouse support in the viewer / New: FreeCamera / Bugfix: 3DS importer will also import meshes without corresponding node (as produced by Wings 3D) --- NEW FILE: stlimport.tex --- % STL import \subsection{STL import} The STL import plugin reads StereoLithography files (both ASCII and binary versions). --- NEW FILE: spacedevice.tex --- \section{\module{spacedevice} --- Wrapper around the 3Dconnexion Developer's Kits} \declaremodule{extension}{cgkit.spacedevice} \modulesynopsis{Wrapper around the 3Dconnexion Developer's Kits} The \module{spacedevice} module allows applications to support SpaceMouse or SpaceBall devices. \begin{classdesc}{SpaceDevice}{} \end{classdesc} \begin{methoddesc}{open}{appname, hwnd} \end{methoddesc} \begin{methoddesc}{close}{} \end{methoddesc} \begin{methoddesc}{translateWin32Event}{msgid, wparam, lparam} Translates a Win32 event into a SpaceDevice event. The return value is a tuple (\var{RetVal}, \var{EventType}, \var{Data}). The contents of the data part depend on the event type. \begin{tableii}{l|l}{code}{Event type}{Data} \lineii{BUTTON_EVENT}{(pressed, released)} \lineii{MOTION_EVENT}{(rotation, translation, period)} \lineii{ZERO_EVENT}{\code{None}} \lineii{EXCEPTION_EVENT}{\code{None}} \end{tableii} \end{methoddesc} \begin{methoddesc}{beep}{s} \end{methoddesc} \begin{methoddesc}{getDeviceID}{} Return the device id. \end{methoddesc} \begin{methoddesc}{getDeviceInfo}{} Return information about the device. The return value is a 5-tuple (\var{device type}, \var{numButtons}, \var{numDegrees}, \var{canBeep}, \var{firmware}). \end{methoddesc} \begin{methoddesc}{getDriverInfo}{} Return version information about the driver. The return value is a 5-tuple (\var{major}, \var{minor}, \var{build}, \var{versionstr}, \var{datestr}). \end{methoddesc} \begin{methoddesc}{getNumDevices}{} Return the number of devices. \end{methoddesc} \begin{methoddesc}{rezero}{} \end{methoddesc} \begin{methoddesc}{setUIMode}{show} \end{methoddesc} \begin{notice}[note] The module uses the SDK by 3Dconnexion which can be found at \url{http://www.3dconnexion.com/sdk.htm}. The following is the copyright information of the SDK: {\em (C) 1998-2001 3Dconnexion Permission to use, copy, modify, and distribute this software for all purposes and without fees is hereby granted provided that this copyright notice appears in all copies. Permission to modify this software is granted and 3Dconnexion will support such modifications only if said modifications are approved by 3Dconnexion} \end{notice} --- NEW FILE: wintab.tex --- \section{\module{wintab} --- Wrapper around the Wintab{\texttrademark} Developer Kit} \declaremodule{extension}{cgkit.wintab} \modulesynopsis{Wrapper around the Wintab Developer Kit} The Wintab{\texttrademark} specification is an open industry standard interface that provides access to pointing devices such as a pen tablet, for example. The API was developed by \ulink{LCS/Telegraphics}{http://www.pointing.com/}. The \module{wintab} module is a wrapper around the Wintab{\texttrademark} Developer Kit and can be used to add tablet support to your Python application. Before you can get any data from the tablet you have to create an instance of the \class{Context} class, set the desired parameters and open the context. Once the context is open you will either receive messages from the tablet driver or you can poll the current tablet state. Either way, you will receive the tablet data via \class{Packet} objects that contain all the data that was generated by the tablet. See also the {\em Wintab Interface Specification} at \url{http://www.pointing.com/} for more detailed usage information. The constants used in this module are either available in the \module{wintab} module or in the \module{wintab.constants} module. The latter can be used if you want to import only the constants into your namespace. % available() \begin{funcdesc}{available}{} Returns \code{True} if the Wintab functionality is available. As the Wintab Developer Kit is only available on Windows, this function will always return \code{False} on other operating systems. On Windows, this function can still return \code{False} if either the Wintab drivers are not installed or cgkit was compiled without Wintab support. If this function returns \code{False}, an exception will be raised whenever you try to call another function or instantiate a class from this module. \end{funcdesc} % info() \begin{funcdesc}{info}{category} This function returns a dictionary with global information about the interface. \var{category} specifies the category from which information is being requested. It can be one of the values in the following table: \begin{tableii}{l|l}{code}{Category}{Description} \lineii{WTI_INTERFACE}{Global interface identification and capability information} \lineii{WTI_STATUS}{Current interface resource usage statistics} \lineii{WTI_DEFCONTEXT}{...} \lineii{WTI_DEFSYSCTX}{...} \lineii{WTI_DEVICES+n}{Capability and status information for a device} \lineii{WTI_CURSORS+n}{Capability and status information for a cursor} \lineii{WTI_EXTENSIONS+n}{Descriptive information and defaults for an extension} \lineii{WTI_DDCTXS}{...} \lineii{WTI_DSCTXS}{...} \end{tableii} \end{funcdesc} \begin{notice}[note] The module uses the Wintab{\texttrademark} Programmer's Kit which can be found at \url{http://www.pointing.com/}. {\em The Wintab Programmer's Kit is copyright 1991-1998 by LCS/Telegraphics.} \end{notice} %------------------------------------------------------------------ \subsection{Context class} The \class{Context} class provides the interface to the tablet driver. \begin{classdesc}{Context}{} The class takes no parameters. All the context attributes will be initialized with the default values as provided by the driver. \end{classdesc} Context attributes: \begin{memberdesc}{name} Context name. \end{memberdesc} \begin{memberdesc}{options} Specifies options for the context and must be a combination of the following flags: \begin{tableii}{l|l}{code}{Option}{Description} \lineii{CXO_SYSTEM}{The context is a system cursor context} \lineii{CXO_PEN}{The context is a Pen Windows (and system cursor) context} \lineii{CXO_MESSAGES}{The context sends WT_PACKET messages to its owner} \lineii{CXO_MARGIN}{The input context will have a margin} \lineii{CXO_MGNINSIDE}{The margin will be inside the specified context} \lineii{CXO_CSRMESSAGES}{The context sends WT_CSRCHANGE messages to its owner} \end{tableii} \end{memberdesc} \begin{memberdesc}{status} Specifies current status conditions for the context. The status value is a combination of the following bits: \begin{tableii}{l|l}{code}{Status bit}{Description} \lineii{CXS_DISABLED}{The context has been disabled} \lineii{CXS_OBSCURED}{The context is at least partially obscured by another context} \lineii{CXS_ONTOP}{The context is the topmost context} \end{tableii} \end{memberdesc} \begin{memberdesc}{locks} Specifies which attributes of the context the application wishes to be locked. The value can be a combination of the following bits: \begin{tableii}{l|l}{code}{Lock}{Description} \lineii{CXL_INSIZE}{The input size cannot be changed} \lineii{CXL_INASPECT}{The input aspect ration cannot be changed} \lineii{CXL_MARGIN}{The margin options cannot be changed} \lineii{CXL_SENSITIVITY}{The sensitivity settings for x, y and z cannot be changed} \lineii{CXL_SYSOUT}{The system pointing control variables cannot be changed} \end{tableii} \end{memberdesc} \begin{memberdesc}{msgbase} Base number for the message IDs. \end{memberdesc} \begin{memberdesc}{device} Specifies the device whose input the context processes. \end{memberdesc} \begin{memberdesc}{pktrate} Specifies the desired packet report rate in Hertz. Once the context is open, this field will contain the actual report rate. \end{memberdesc} \begin{memberdesc}{pktdata} Specifies which optional data items will be in packets returned from the context. \end{memberdesc} \begin{memberdesc}{pktmode} Specifies whether the packet data items will be returned in absolute or relative mode. If the item's bit is set in this field, the item will be returned in relative mode. \end{memberdesc} \begin{memberdesc}{movemask} Specifies which packet data items can generate move events in the context. \end{memberdesc} \begin{memberdesc}{btndnmask} Specifies the buttons for which button press events will be processed in the context. \end{memberdesc} \begin{memberdesc}{btnupmask} Specifies the buttons for which button release events will be processed in the context. \end{memberdesc} \begin{memberdesc}{inorgx} Specifies the origin of the context's input area in the tablet's native coordinates along the x axis. \end{memberdesc} \begin{memberdesc}{inorgy} Specifies the origin of the context's input area in the tablet's native coordinates along the y axis. \end{memberdesc} \begin{memberdesc}{inorgz} Specifies the origin of the context's input area in the tablet's native coordinates along the z axis. \end{memberdesc} \begin{memberdesc}{inextx} Specifies the extent of the context's input area in the tablet's native coordinates along the x axis. \end{memberdesc} \begin{memberdesc}{inexty} Specifies the extent of the context's input area in the tablet's native coordinates along the y axis. \end{memberdesc} \begin{memberdesc}{inextz} Specifies the extent of the context's input area in the tablet's native coordinates along the z axis. \end{memberdesc} \begin{memberdesc}{outorgx} Specifies the extent of the context's output area in context output coordinates along the x axis. \end{memberdesc} \begin{memberdesc}{outorgy} Specifies the extent of the context's output area in context output coordinates along the y axis. \end{memberdesc} \begin{memberdesc}{outorgz} Specifies the extent of the context's output area in context output coordinates along the z axis. \end{memberdesc} \begin{memberdesc}{outextx} Specifies the extent of the context's output area in context output coordinates along the x axis. \end{memberdesc} \begin{memberdesc}{outexty} Specifies the extent of the context's output area in context output coordinates along the y axis. \end{memberdesc} \begin{memberdesc}{outextz} Specifies the extent of the context's output area in context output coordinates along the z axis. \end{memberdesc} \begin{memberdesc}{sensx} Specifies the relative-mode sensitivity factor for the x axis. \end{memberdesc} \begin{memberdesc}{sensy} Specifies the relative-mode sensitivity factor for the y axis. \end{memberdesc} \begin{memberdesc}{sensz} Specifies the relative-mode sensitivity factor for the z axis. \end{memberdesc} \begin{memberdesc}{sysmode} Specifies the system cursor tracking mode. \code{True} specifies absolute, \code{False} means relative. \end{memberdesc} \begin{memberdesc}{sysorgx} Specifies the origin in screen coordinates of the screen mapping area for system cursor tracking. \end{memberdesc} \begin{memberdesc}{sysorgy} Specifies the origin in screen coordinates of the screen mapping area for system cursor tracking. \end{memberdesc} \begin{memberdesc}{sysextx} Specifies the extent in screen coordinates of the screen mapping area for system cursor tracking. \end{memberdesc} \begin{memberdesc}{sysexty} Specifies the extent in screen coordinates of the screen mapping area for system cursor tracking. \end{memberdesc} \begin{memberdesc}{syssensx} Specifies the system-cursor relative-mode sensitivity factor for the x axis. \end{memberdesc} \begin{memberdesc}{syssensy} Specifies the system-cursor relative-mode sensitivity factor for the y axis. \end{memberdesc} Other attributes: \begin{memberdesc}{queuesize} The number of packets the context's queue can hole. Setting this attribute may result in an exception if the queue size could not be set. In such a case, you must try again with a smaller value. \end{memberdesc} \begin{memberdesc}{id_packet} The final id of the WT_PACKET message. \end{memberdesc} \begin{memberdesc}{id_csrchange} The final id of the WT_CSRCHANGE message. \end{memberdesc} \begin{memberdesc}{id_ctxopen} The final id of the WT_CTXOPEN message. \end{memberdesc} \begin{memberdesc}{id_ctxclose} The final id of the WT_CTXCLOSE message. \end{memberdesc} \begin{memberdesc}{id_ctxupdate} The final id of the WT_CTXUPDATE message. \end{memberdesc} \begin{memberdesc}{id_ctxoverlap} The final id of the WT_CTXOVERLAP message. \end{memberdesc} \begin{memberdesc}{id_proximity} The final id of the WT_PROXIMITY message. \end{memberdesc} \begin{memberdesc}{id_infochange} The final id of the WT_INFOCHANGE message. \end{memberdesc} Methods: \begin{methoddesc}{open}{hwnd, enable} Opens the context. \var{hwnd} is the window handle (as integer) of the window that owns the context and that receives messages from the context. \var{enable} is a boolean that specifies whether the context will immediately begin processing input data. Set the context attributes to the desired values before calling this method. Modifying context attributes after the context was opened is possible with the \method{set()} method. \end{methoddesc} \begin{methoddesc}{restore}{hwnd, saveinfo, enable} This method is equivalent to the \method{open()} method with the only difference that it takes the context attributes via the binary \var{saveinfo} string which was returned by the \method{save()} method in a previous session. \end{methoddesc} \begin{methoddesc}{close}{} Closes the context if it was open (or do nothing if it was already closed or if it was not open at all). \end{methoddesc} \begin{methoddesc}{save}{} Returns a binary \var{saveinfo} string containing the current context state. This string can be used as argument to the \method{restore()} method. \end{methoddesc} \begin{methoddesc}{packet}{serial} Returns the packet with the specified serial number. \end{methoddesc} \begin{methoddesc}{enable}{flag} If \var{flag} is \code{True} the context is enabled, otherwise it is disabled. Returns \code{True} if the operation was successful. \end{methoddesc} \begin{methoddesc}{overlap}{totop} If \var{totop} is \code{True} the context will become the topmost context, otherwise it will be send to the bottom. Returns \code{True} if the operation was successful. \end{methoddesc} \begin{methoddesc}{config}{hwnd=0} Prompts the user for changes to the context via a dialog box. \var{hwnd} is the window handle of the window that will be parent of the dialog. If it is 0, the context owning window will be used. The return value is \code{True} if the context was changed. \end{methoddesc} \begin{methoddesc}{get}{} Update the local context attributes. \end{methoddesc} \begin{methoddesc}{set}{} Update the tablet context with the settings stored in the local context attributes. \end{methoddesc} \begin{methoddesc}{packetsGet}{maxpkts} Return the next \var{maxpkts} packets and remove them from the queue. \end{methoddesc} \begin{methoddesc}{packetsPeek}{maxpkts} Return the next \var{maxpkts} packets without removing them from the queue. \end{methoddesc} \begin{methoddesc}{dataGet}{begin, end, maxpkts} Return all packets with serial numbers between \var{begin} and \var{end} inclusive and remove them from the queue. However, no more than \var{maxpkts} packets are returned. The return value is a 2-tuple (\var{numpackets}, \var{packet list}) where \var{numpackets} is the total number of packets found in the queue between \var{begin} and \var{end}. \end{methoddesc} \begin{methoddesc}{dataPeek}{begin, end, maxpkts} This is the same as \method{dataGet()} but it doesn't remove the packets from the queue. \end{methoddesc} \begin{methoddesc}{queuePacketsEx}{} Returns the serial numbers of the oldest and newest packets currently in the queue. \end{methoddesc} %------------------------------------------------------------------ \subsection{Packet class} \begin{classdesc}{Packet}{} \end{classdesc} \begin{memberdesc}{pktdata} This is a copy of the \code{pktdata} attribute of the corresponding context, i.e. this attribute determines which of the following attributes are actually valid. \end{memberdesc} \begin{memberdesc}{context} Specifies the context that generated the event. \end{memberdesc} \begin{memberdesc}{status} Contains a combination of the following status and error conditions: \begin{tableii}{l|l}{code}{Status bit}{Description} \lineii{TPS_PROXIMITY}{The cursor is out of the context} \lineii{TPS_QUEUE_ERR}{The event queue for the context has overflowed} \lineii{TPS_MARGIN}{The cursor is in the margin of the context} \lineii{TPS_GRAB}{The cursor is out of the context, but the context has grabbed input} \lineii{TPS_INVERT}{The cursor is in its inverted state} \end{tableii} \end{memberdesc} \begin{memberdesc}{time} In absolute mode, specifies the system time at which the event was posted. In relative mode, specifies the elapsed time in milliseconds since the last packet. \end{memberdesc} \begin{memberdesc}{changed} Specifies which of the included packet data items have changed since the previously posted event. \end{memberdesc} \begin{memberdesc}{serial} Contains a serial number assigned to the packet by the context. \end{memberdesc} \begin{memberdesc}{cursor} Specifies which cursor type generated the packet. \end{memberdesc} \begin{memberdesc}{buttons} In absolute, contains the current button state. In relative mode, the low word contains a button number and the high word contains one of the following codes: \code{TBN_NONE} if there was no change in button state, \code{TBN_UP} if the button was released or \code{TBN_DOWN} if the button was pressed. \end{memberdesc} \begin{memberdesc}{x} In absolute mode, contains the scaled cursor location along the x axis. In relative mode, contains the scaled change in cursor position. \end{memberdesc} \begin{memberdesc}{y} In absolute mode, contains the scaled cursor location along the y axis. In relative mode, contains the scaled change in cursor position. \end{memberdesc} \begin{memberdesc}{z} In absolute mode, contains the scaled cursor location along the z axis. In relative mode, contains the scaled change in cursor position. \end{memberdesc} \begin{memberdesc}{normalpressure} In absolute mode, contains the adjusted state of the normal pressure. In relative mode, contains the change in adjusted pressure state. \end{memberdesc} \begin{memberdesc}{tangentpressure} In absolute mode, contains the adjusted state of the tangential pressure. In relative mode, contains the change in adjusted pressure state. \end{memberdesc} \begin{memberdesc}{orient_azimuth} Specifies the clockwise rotation of the cursor about the z axis through a full circular range. \end{memberdesc} \begin{memberdesc}{orient_altitude} Specifies the angle with the x-y plane through a signed, semicircular range. \end{memberdesc} \begin{memberdesc}{orient_twist} Specifies the clockwise rotation of the cursor about its own major axis. \end{memberdesc} \begin{memberdesc}{rot_pitch} Specifies the pitch of the cursor. \end{memberdesc} \begin{memberdesc}{rot_roll} Specifies the roll of the cursor. \end{memberdesc} \begin{memberdesc}{rot_yaw} Specifies the yaw of the cursor. \end{memberdesc} Index: viewer.tex =================================================================== RCS file: /cvsroot/cgkit/cgkit2/doc/tex/viewer.tex,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** viewer.tex 12 Dec 2004 14:31:58 -0000 1.1.1.1 --- viewer.tex 9 Jan 2005 20:13:07 -0000 1.2 *************** *** 110,112 **** --- 110,120 ---- by using one of the three mouse buttons. + \item[\code{-X} / \code{--disable-spacedevice}] + Disables support for SpaceMouse/SpaceBall. This option can be used if there + are any problems with the driver or initialization takes too long. + + \item[\code{-T} / \code{--disable-wintab}] + Disables tablet support. This option can be used if there are any + problems with the driver or initialization takes too long. + \end{description} Index: events.tex =================================================================== RCS file: /cvsroot/cgkit/cgkit2/doc/tex/events.tex,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** events.tex 12 Dec 2004 14:31:45 -0000 1.1.1.1 --- events.tex 9 Jan 2005 20:13:07 -0000 1.2 *************** *** 101,104 **** --- 101,130 ---- + \begin{datadesc}{SPACE_MOTION} + A SpaceMouse/SpaceBall was moved or rotated. The callback function receives a + \class{SpaceMotionEvent} object as argument. + \end{datadesc} + + \begin{datadesc}{SPACE_BUTTON_DOWN} + A SpaceMouse/SpaceBall button was pressed. The callback function receives a + \class{SpaceButtonEvent} object as argument. + \end{datadesc} + + \begin{datadesc}{SPACE_BUTTON_UP} + A SpaceMouse/SpaceBall button was released. The callback function receives a + \class{SpaceButtonEvent} object as argument. + \end{datadesc} + + \begin{datadesc}{SPACE_BUTTON_ZERO} + The user stopped moving/rotating the SpaceMouse/SpaceBall. The event takes + no arguments. + \end{datadesc} + + + \begin{datadesc}{TABLET} + A tablet (or similar pointing device) generated an event. + \end{datadesc} + + \begin{notice}[note] It actually depends on the application used to process a scene if a *************** *** 234,235 **** --- 260,272 ---- \begin{classdesc}{JoystickButtonEvent}{joystick, button} \end{classdesc} + + %----------- + \subsection{SpaceMotionEvent object} + + \begin{classdesc}{SpaceMotionEvent}{translation, rotation, period} + \end{classdesc} + + \subsection{SpaceButtonEvent object} + + \begin{classdesc}{SpaceButtonEvent}{button} + \end{classdesc} Index: cgkit.tex =================================================================== RCS file: /cvsroot/cgkit/cgkit2/doc/tex/cgkit.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cgkit.tex 20 Dec 2004 18:20:24 -0000 1.3 --- cgkit.tex 9 Jan 2005 20:13:07 -0000 1.4 *************** *** 98,101 **** --- 98,103 ---- \input{sltokenize.tex} \input{slparams.tex} + \input{spacedevice.tex} + \input{wintab.tex} %--- *************** *** 203,206 **** --- 205,209 ---- \input{ifsimport.tex} \input{objimport.tex} + \input{stlimport.tex} %--------------------------------------------------------- Index: geomobject.tex =================================================================== RCS file: /cvsroot/cgkit/cgkit2/doc/tex/geomobject.tex,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** geomobject.tex 12 Dec 2004 14:31:46 -0000 1.1.1.1 --- geomobject.tex 9 Jan 2005 20:13:07 -0000 1.2 *************** *** 101,107 **** \begin{methoddesc}{convert}{targetgeom} ! Convert the geometry into another type of geometry. \var{targetgeom} is ! another \class{GeomObject} that will receive the result of the conversion. ! If the conversion is not possible, a \exception{???} exception is thrown. In the following example, a box geometry is converted into a triangle --- 101,108 ---- \begin{methoddesc}{convert}{targetgeom} ! Convert the geometry into another type of geometry. \var{targetgeom} ! is another \class{GeomObject} that will receive the result of the ! conversion. If the conversion is not possible, a ! \exception{NotImplementedError} exception is thrown. In the following example, a box geometry is converted into a triangle |
From: Matthias B. <mb...@us...> - 2005-01-09 20:13:18
|
Update of /cvsroot/cgkit/cgkit2/cgkit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28239/cgkit Modified Files: .cvsignore __init__.py camcontrol.py dddsimport.py events.py tool.py Added Files: freecamera.py stlimport.py Log Message: New: STL importer / New: Wintab wrapper / New: 3DxWare wrapper (SpaceMouse/SpaceBall) / Tablet/SpaceMouse support in the viewer / New: FreeCamera / Bugfix: 3DS importer will also import meshes without corresponding node (as produced by Wings 3D) Index: .cvsignore =================================================================== RCS file: /cvsroot/cgkit/cgkit2/cgkit/.cvsignore,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** .cvsignore 12 Dec 2004 14:30:54 -0000 1.1.1.1 --- .cvsignore 9 Jan 2005 20:13:06 -0000 1.2 *************** *** 3,5 **** --- 3,7 ---- _core.pyd cgkitinfo.py + _wintab.pyd + spacedevice.pyd --- NEW FILE: stlimport.py --- ########################################################################### # cgkit - Python Computer Graphics Kit # Copyright (C) 2004 Matthias Baas (ba...@ir...) # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # cgkit homepage: http://cgkit.sourceforge.net ########################################################################### # $Id: stlimport.py,v 1.1 2005/01/09 20:13:06 mbaas Exp $ import os.path, sys, struct from cgtypes import * from trimesh import TriMesh import pluginmanager # STLReader class STLReader: def __init__(self, filename): self.filename = filename # read def read(self): if self.isASCII(): self.read_ascii() else: self.read_bin() # read_bin def read_bin(self): """Read a binary STL file. """ f = file(self.filename, "rb") s = f.read(80) objname = s.split("\000")[0] s = f.read(4) numfaces = struct.unpack("<i", s)[0] self.begin(objname) for i in range(numfaces): s = f.read(50) normal = vec3(struct.unpack("<fff", s[:12])) v = struct.unpack("<fffffffff", s[12:48]) verts = [vec3(v[0:3]), vec3(v[3:6]), vec3(v[6:9])] self.triangle(normal, verts) self.end(objname) # read_ascii def read_ascii(self): """Read a ASCII STL file. """ f = file(self.filename) objname = "unnamed" normal = vec3() verts = [] state = 0 linenr = 0 for s in f: linenr+=1 a = s.split() if len(a)==0: continue # Begin of file if state==0: if a[0]=="solid": if len(a)>1: objname = a[1] self.begin(objname) state = 1 else: raise SyntaxError, 'Keyword "solid" expected in line %d'%linenr # Begin of a triangle ("facet") or end of file ("endsolid") elif state==1: if a[0]=="facet": if len(a)!=5 or a[1]!="normal": raise SyntaxError, 'Syntax error in line %d'%linenr normal = vec3(float(a[2]), float(a[3]), float(a[4])) verts = [] state = 2 elif a[0]=="endsolid": self.end(objname) state = 0 else: raise SyntaxError, 'Syntax error in line %d. Facet or end of solid expected.'%linenr # "outer loop" elif state==2: if len(a)!=2 or a[0]!="outer" or a[1]!="loop": raise SyntaxError, 'Keyword "outer loop" expected in line %d.'%linenr state = 3 # A vertex definition elif state==3: if len(a)!=4 or a[0]!="vertex": raise SyntaxError, 'Syntax error in line %d: Vertex expected'%linenr v = vec3(float(a[1]), float(a[2]), float(a[3])) verts.append(v) if len(verts)==3: state = 4 # "endloop" elif state==4: if a[0]!="endloop": raise SyntaxError, 'Keyword "endloop" expected in line %d.'%linenr state = 5 # "endfacet" elif state==5: if a[0]!="endfacet": raise SyntaxError, 'Keyword "endfacet" expected in line %d.'%linenr self.triangle(normal, verts) state = 1 # isASCII def isASCII(self): f = file(self.filename) s1 = f.readline().strip() s2 = f.readline().strip() f.close() if s1[:5]!="solid": return False if s2[:5]!="facet": return False return True # begin def begin(self, name): """Solid begin callback. This callback is called before the triangles are read. """ pass # end def end(self, name): """Solid begin callback. This callback is called after the triangles were read. """ pass # triangle def triangle(self, normal, verts): """Triangle callback. normal is the normal vector as vec3 and verts is a list with the three vertices (vec3s). """ pass # STLImport class STLImport(STLReader): def __init__(self, filename): STLReader.__init__(self, filename) self.verts = [] self.numfaces = 0 # begin def begin(self, name): pass # end def end(self, name): faces = [] for i in range(self.numfaces): faces.append(range(i*3, i*3+3)) TriMesh(name=name, verts=self.verts, faces=faces) # triangle def triangle(self, normal, verts): """Triangle callback. normal is the normal vector as vec3 and verts is a list with the three vertices (vec3s). """ self.numfaces += 1 self.verts += verts # STLImporter class STLImporter: _protocols = ["Import"] # extension def extension(): """Return the file extensions for this format.""" return ["stl"] extension = staticmethod(extension) # description def description(self): """Return a short description for the file dialog.""" return "StereoLithography" description = staticmethod(description) # importFile def importFile(self, filename): """Import a STL file.""" reader = STLImport(filename) reader.read() ###################################################################### # Register the Importer class as a plugin class pluginmanager.register(STLImporter) Index: __init__.py =================================================================== RCS file: /cvsroot/cgkit/cgkit2/cgkit/__init__.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** __init__.py 12 Dec 2004 14:31:32 -0000 1.1.1.1 --- __init__.py 9 Jan 2005 20:13:06 -0000 1.2 *************** *** 79,82 **** --- 79,83 ---- # Camera/light from targetcamera import TargetCamera + from freecamera import FreeCamera from lookat import LookAt from glpointlight import GLPointLight *************** *** 128,131 **** --- 129,133 ---- import ifsimport import objimport + import stlimport # Exporter import ribexport Index: events.py =================================================================== RCS file: /cvsroot/cgkit/cgkit2/cgkit/events.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** events.py 12 Dec 2004 14:31:00 -0000 1.1.1.1 --- events.py 9 Jan 2005 20:13:06 -0000 1.2 *************** *** 53,57 **** MOUSE_WHEEL = "MouseWheel" - JOYSTICK_AXIS = "JoystickAxis" JOYSTICK_BALL = "JoystickBall" --- 53,56 ---- *************** *** 60,63 **** --- 59,69 ---- JOYSTICK_BUTTON_UP = "JoystickButtonUp" + SPACE_MOTION = "SpaceMotion" + SPACE_BUTTON_DOWN = "SpaceButtonDown" + SPACE_BUTTON_UP = "SpaceButtonUp" + SPACE_ZERO = "SpaceZero" + + TABLET = "Tablet" + # KeyEvent class KeyEvent: *************** *** 266,267 **** --- 272,313 ---- def __str__(self): return "<JoystickButtonEvent joystick:#%d button:#%d>"%(self.joystick, self.button) + + + # SpaceMotion + class SpaceMotionEvent: + """SpaceMotion event. + + This event is created when a SpaceMouse or SpaceBall is moved or rotated. + """ + + def __init__(self, translation, rotation, period): + """Constructor. + + \param translation (\c vec3) Translation vector + \param rotation (\c vec3) Rotation vector + \param period (\c int) Time in milliseconds since the last event + """ + self.translation = translation + self.rotation = rotation + self.period = period + + def __str__(self): + return "<SpaceMotion t:%s r:%s period:%d>"%(self.translation, self.rotation, self.period) + + # SpaceButton + class SpaceButtonEvent: + """SpaceButton event. + + This event is generated when a SpaceMouse or SpaceBall button was + pressed or released. + """ + + def __init__(self, button): + """Constructor. + + \param button (\c int) Bútton number (1-29) + """ + self.button = button + + def __str__(self): + return "<SpaceButton button:%d>"%(self.button) Index: tool.py =================================================================== RCS file: /cvsroot/cgkit/cgkit2/cgkit/tool.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tool.py 19 Dec 2004 21:32:12 -0000 1.2 --- tool.py 9 Jan 2005 20:13:06 -0000 1.3 *************** *** 85,88 **** --- 85,96 ---- self.options, self.args = self.optparser.parse_args(values=defaultopts) + # Print default options + if self.options.verbose: + if defaultoptionvar!=None: + if defaultoptionvar in os.environ: + print "Default options in %s: %s"%(defaultoptionvar, os.environ[defaultoptionvar]) + else: + print "Environment variable %s not set."%defaultoptionvar + # Determine screen resolution... self._no_resolution_specified = False Index: camcontrol.py =================================================================== RCS file: /cvsroot/cgkit/cgkit2/cgkit/camcontrol.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** camcontrol.py 12 Dec 2004 14:30:55 -0000 1.1.1.1 --- camcontrol.py 9 Jan 2005 20:13:06 -0000 1.2 *************** *** 26,30 **** import component import eventmanager ! import scene from events import * from keydefs import * --- 26,30 ---- import component import eventmanager ! from scene import getScene from events import * from keydefs import * *************** *** 75,78 **** --- 75,79 ---- em.connect(MOUSE_MOVE, self) em.connect(MOUSE_WHEEL, self) + em.connect(SPACE_MOTION, self) def panCondition(self): *************** *** 210,214 **** T = self.cam.transform pivot = self.cam.target ! up = scene.getScene().up R = mat4(1).rotation(-dx, up) dp = self.cam.pos-pivot --- 211,215 ---- T = self.cam.transform pivot = self.cam.target ! up = getScene().up R = mat4(1).rotation(-dx, up) dp = self.cam.pos-pivot *************** *** 233,234 **** --- 234,271 ---- # self.cam.target += delta + + # onSpaceMotion + def onSpaceMotion(self, e): + """ + this is still somewhat experimental + (should distinguish between the camera types as it's meant to be + used with a FreeCamera) + """ + + scene = getScene() + + tr = 0.001*e.translation + rot = e.rotation + + if scene.handedness=='r': + tr.x = -tr.x + rot.y = -rot.y + rot.z = -rot.z + + M = mat4().translation(tr) + + if rot!=vec3(0): + a = 0.0002*rot.length() + M = M*mat4().rotation(a, rot) + + T = self.cam.transform*M + # Align camera to up direction + R = T.getMat3() + bz = vec3(tuple(T.getColumn(2))[:3]) + by = scene.up + bx = by.cross(bz) + by = bz.cross(bx) + R = mat3(bx.normalize(), by.normalize(), bz.normalize()) + T.setMat3(R) + + self.cam.transform = T Index: dddsimport.py =================================================================== RCS file: /cvsroot/cgkit/cgkit2/cgkit/dddsimport.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dddsimport.py 20 Dec 2004 20:19:08 -0000 1.2 --- dddsimport.py 9 Jan 2005 20:13:06 -0000 1.3 *************** *** 85,92 **** --- 85,112 ---- self.ddds.eval(f) + # Create a dictionary containing all available meshes. + # Key is the mesh name. This is used to check if all meshes have + # been processed (i.e. if there were corresponding nodes). + self.meshes = {} + m = self.ddds.meshes() + while m!=None: + if self.meshes.has_key(m.name): + print "Warning: Duplicate mesh names in 3ds file" + self.meshes[m.name] = m + m = m.next() + + # Create objects... self.materials = {} self.createObject(self.ddds.nodes(), parent=parent, flags=flags) del self.materials + # Create TriMeshes for all left over meshes... + for n in self.meshes: + mesh = self.meshes[n] + tm = TriMeshGeom() + mesh.initGeom(tm, flags) + worldobj = TriMesh(name = mesh.name, parent=parent) + worldobj.geom = tm + self.ddds.free() *************** *** 114,117 **** --- 134,139 ---- data = node.object_data mesh = self.ddds.meshByName(node.name) + if self.meshes.has_key(mesh.name): + del self.meshes[mesh.name] # print "###",node.name,"###" # print "Node matrix:" --- NEW FILE: freecamera.py --- ########################################################################### # cgkit - Python Computer Graphics Kit # Copyright (C) 2004 Matthias Baas (ba...@ir...) # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # cgkit homepage: http://cgkit.sourceforge.net ########################################################################### # $Id: freecamera.py,v 1.1 2005/01/09 20:13:06 mbaas Exp $ ## \file freecamera.py ## Contains the FreeCamera class. """This module contains the FreeCamera class.""" from Interfaces import * import protocols import slots import scene from cgtypes import * from worldobject import WorldObject import sys # FreeCamera class FreeCamera(WorldObject): """A camera object that is free to move and rotate. """ protocols.advise(instancesProvide=[ISceneItem, ICamera]) def __init__(self, name = "FreeCamera", target = None, fov = 45.0, fstop = 0, focallength = 0, **params): WorldObject.__init__(self, name=name, **params) # FOV self.fov_slot = slots.DoubleSlot(fov) self.addSlot("fov", self.fov_slot) # fstop self.fstop_slot = slots.DoubleSlot(fstop) self.addSlot("fstop", self.fstop_slot) # focal length self.focallength_slot = slots.DoubleSlot(focallength) self.addSlot("focallength", self.focallength_slot) # Initial targeting if target!=None: up = scene.getScene().up self.transform = mat4().lookAt(self.pos, vec3(target), up) def protocols(self): return [ISceneItem, IComponent, IWorldObject, ICamera] def destroy(self): # self.fov_slot.setController(None) # self.target_slot.setController(None) # self._lookat.pos_slot.setController(None) # self._lookat.target_slot.setController(None) # self.transform_slot.setController(None) # self.pos_slot.setController(None) # self.rot_slot.setController(None) # self.scale_slot.setController(None) del self.fov_slot del self.fstop_slot del self.focallength_slot # projection def projection(self, width, height, near, far): return mat4().perspective(self.fov, float(width)/height, near, far) # viewTransformation def viewTransformation(self): return self.transform.inverse() ## protected: exec slots.slotPropertyCode("fstop") exec slots.slotPropertyCode("focallength") # "fov" property... def _getFOV(self): """Return the current field of view. This method is used for retrieving the \a fov property. \return Field of view in angles (\c float) """ return self.fov_slot.getValue() def _setFOV(self, fov): """Set the field of view. This method is used for setting the \a fov property. \param fov (\c float) Field of view in angles (0-180) """ fov = float(fov) if fov<0: fov = 0.0 if fov>180: fov = 180.0 self.fov_slot.setValue(fov) fov = property(_getFOV, _setFOV, None, "Field of view (in angles)") |
From: Matthias B. <mb...@us...> - 2005-01-09 20:13:17
|
Update of /cvsroot/cgkit/cgkit2/wrappers/spacedevice In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28239/wrappers/spacedevice Added Files: py_spacedevice.cpp Log Message: New: STL importer / New: Wintab wrapper / New: 3DxWare wrapper (SpaceMouse/SpaceBall) / Tablet/SpaceMouse support in the viewer / New: FreeCamera / Bugfix: 3DS importer will also import meshes without corresponding node (as produced by Wings 3D) --- NEW FILE: py_spacedevice.cpp --- /* 3DXWare wrapper */ #include <boost/python.hpp> #include <iostream> #include <exception> #ifdef WIN32 #define OS_WIN32 #endif extern "C" { #include <spwmacro.h> #include <si.h> #include <siapp.h> } using namespace boost::python; // Exception class class SpaceDeviceException : public std::exception { SpwRetVal retval; public: SpaceDeviceException(long aretval) : retval(SpwRetVal(aretval)) {} ~SpaceDeviceException() throw() {} /// Return exception message. const char* what() const throw() { return SpwErrorString(retval); } }; /** Wrapper around the 3Dconnexion SDK. */ class SpaceDevice { // SpaceMouse/SpaceBall handle SiHdl device; public: SpaceDevice() : device(0) { // std::cout<<"SiInitialize()"<<std::endl; SiInitialize(); } ~SpaceDevice() { // std::cout<<"SiTerminate()"<<std::endl; close(); SiTerminate(); } ////////////////////////////////////////////////////////////////////// /** Connect to a device. appname is the application name and hWnd the window handle of the window that should receive the events. */ void open(std::string appname, int hwnd) { SiOpenData data; SiOpenWinInit(&data, (HWND)hwnd); device = SiOpen((char*)appname.c_str(), SI_ANY_DEVICE, SI_NO_MASK, SI_EVENT, &data); if (device==0) { // the error should be in SpwErrorVal, but this variable isn't there...? // std::cout<<"ERROR: could not open device"<<std::endl; throw SpaceDeviceException(SPW_ERROR); } } ////////////////////////////////////////////////////////////////////// /** Close the device. */ SpwRetVal close() { SpwRetVal res = SPW_NO_ERROR; if (device!=0) { res = (SpwRetVal)SiClose(device); device = 0; } return res; } ////////////////////////////////////////////////////////////////////// /** Translaste a Win32 event into a SpaceDevice event. Returns a tuple (RetVal, EventType, Data) */ tuple translateWin32Event(long msgid, long wparam, long lparam) { SiGetEventData eventdata; SiSpwEvent event; /* result of the translation */ SiGetEventWinInit(&eventdata, msgid, wparam, lparam); SpwRetVal res = SpwRetVal(SiGetEvent(device, 0, &eventdata, &event)); if (res==SI_IS_EVENT) { switch(event.type) { // Button press or release? case SI_BUTTON_EVENT: return make_tuple(res, SiEventType(event.type), make_tuple(buttonList(event.u.spwData.bData.pressed), buttonList(event.u.spwData.bData.released))); // Motion? case SI_MOTION_EVENT: { tuple t; /* translation */ tuple r; /* rotation */ t = make_tuple(event.u.spwData.mData[SI_TX], event.u.spwData.mData[SI_TY], event.u.spwData.mData[SI_TZ]); r = make_tuple(-event.u.spwData.mData[SI_RX], -event.u.spwData.mData[SI_RY], -event.u.spwData.mData[SI_RZ]); return make_tuple(res, SiEventType(event.type), make_tuple(t, r, event.u.spwData.period)); } // Zero? case SI_ZERO_EVENT: return make_tuple(res, SiEventType(event.type), object()); // Exception? case SI_EXCEPTION_EVENT: return make_tuple(res, SiEventType(event.type), object()); } return make_tuple(res, SiEventType(event.type), object()); } else /* no valid space mouse event */ { return make_tuple(res, object(), object()); } } ////////////////////////////////////////////////////////////////////// /** Causes the device to emit a sequence of tones and pauses. Lowercase letters represent a tone, uppercase letters represent a pause. The closer the letter is to the beginning of the alphabet the shorter the pause or tone. */ void beep(std::string s) { long res = SiBeep(device, (char*)(s.c_str())); if (res!=SPW_NO_ERROR) throw SpaceDeviceException(res); } ////////////////////////////////////////////////////////////////////// /** Get the device ID. */ long getDeviceID() { return SiGetDeviceID(device); } ////////////////////////////////////////////////////////////////////// /** Get infos about the device. Returns a tuple (device type, numButtons, numDegrees, canBeep, firmware). */ tuple getDeviceInfo() { SiDevInfo info; long res = SiGetDeviceInfo(device, &info); if (res!=SPW_NO_ERROR) throw SpaceDeviceException(res); return make_tuple(SiDevType(info.devType), info.numButtons, info.numDegrees, bool(info.canBeep), info.firmware); } ////////////////////////////////////////////////////////////////////// /** Get version infos about the driver. Returns a tuple (major, minor, build, versionstr, datestr) */ tuple getDriverInfo() { SiVerInfo info; long res = SiGetDriverInfo(&info); if (res!=SPW_NO_ERROR) throw SpaceDeviceException(res); return make_tuple(info.major, info.minor, info.build, info.version, info.date); } ////////////////////////////////////////////////////////////////////// /** Get the number of devices. */ int getNumDevices() { return SiGetNumDevices(); } ////////////////////////////////////////////////////////////////////// /** Rezero. */ void rezero() { long res = SiRezero(device); if (res!=SPW_NO_ERROR) throw SpaceDeviceException(res); } ////////////////////////////////////////////////////////////////////// /** setUIMode. */ void setUIMode(bool show) { long res; if (show) res = SiSetUiMode(device, SI_UI_ALL_CONTROLS); else res = SiSetUiMode(device, SI_UI_NO_CONTROLS); if (res!=SPW_NO_ERROR) throw SpaceDeviceException(res); } private: ////////////////////////////////////////////////////////////////////// /** Convert a button "mask" into a list of button numbers. Bit 2 is button 1, bit 3 -> button 2, ... */ list buttonList(int buttons) { list res; int nr = 1; buttons >>= 1; while(nr<30) { if (buttons & 0x01) { res.append(nr); } nr += 1; buttons >>= 1; } return res; } }; // Exception translator function void ExceptionTranslator(const SpaceDeviceException& exc) { PyErr_SetString(PyExc_RuntimeError, exc.what()); } BOOST_PYTHON_MODULE(spacedevice) { register_exception_translator<SpaceDeviceException>(&ExceptionTranslator); enum_<SpwRetVal>("RetVal") .value("NO_ERROR", SPW_NO_ERROR) .value("ERROR", SPW_ERROR) .value("BAD_HANDLE", SI_BAD_HANDLE) .value("BAD_ID", SI_BAD_ID) .value("BAD_VALUE", SI_BAD_VALUE) .value("IS_EVENT", SI_IS_EVENT) .value("SKIP_EVENT", SI_SKIP_EVENT) .value("NOT_EVENT", SI_NOT_EVENT) .value("NO_DRIVER", SI_NO_DRIVER) .value("NO_RESPONSE", SI_NO_RESPONSE) .value("UNSUPPORTED", SI_UNSUPPORTED) .value("UNINITIALIZED", SI_UNINITIALIZED) .value("WRONG_DRIVER", SI_WRONG_DRIVER) .value("INTERNAL_ERROR", SI_INTERNAL_ERROR) ; enum_<SiEventType>("EventType") .value("BUTTON_EVENT", SI_BUTTON_EVENT) .value("MOTION_EVENT", SI_MOTION_EVENT) .value("COMBO_EVENT", SI_COMBO_EVENT) .value("ZERO_EVENT", SI_ZERO_EVENT) .value("EXCEPTION_EVENT", SI_EXCEPTION_EVENT) .value("OUT_OF_BAND", SI_OUT_OF_BAND) .value("ORIENTATION_EVENT", SI_ORIENTATION_EVENT) .value("KEYBOARD_EVENT", SI_KEYBOARD_EVENT) .value("LPFK_EVENT", SI_LPFK_EVENT) ; enum_<SiDevType>("DevType") .value("UNKNOWN_DEVICE", SI_UNKNOWN_DEVICE) .value("SPACEBALL_2003", SI_SPACEBALL_2003) .value("SPACEBALL_3003", SI_SPACEBALL_3003) .value("SPACE_CONTROLLER", SI_SPACE_CONTROLLER) .value("AVENGER", SI_AVENGER) .value("SPACEORB_360", SI_SPACEORB_360) .value("NAVIGATOR", SI_NAVIGATOR) .value("SPACEBALL_2003A", SI_SPACEBALL_2003A) .value("SPACEBALL_2003B", SI_SPACEBALL_2003B) .value("SPACEBALL_2003C", SI_SPACEBALL_2003C) .value("SPACEBALL_3003A", SI_SPACEBALL_3003A) .value("SPACEBALL_3003B", SI_SPACEBALL_3003B) .value("SPACEBALL_3003C", SI_SPACEBALL_3003C) .value("SPACEBALL_4000", SI_SPACEBALL_4000) .value("SPACEMOUSE_CLASSIC", SI_SPACEMOUSE_CLASSIC) .value("SPACEMOUSE_PLUS", SI_SPACEMOUSE_PLUS) .value("SPACEMOUSE_XT", SI_SPACEMOUSE_XT) .value("CYBERMAN", SI_CYBERMAN) .value("CADMAN", SI_CADMAN) .value("SPACEMOUSE_CLASSIC_PROMO", SI_SPACEMOUSE_CLASSIC_PROMO) .value("SERIAL_CADMAN", SI_SERIAL_CADMAN) .value("SPACEBALL_5000", SI_SPACEBALL_5000) .value("TEST_NO_DEVICE", SI_TEST_NO_DEVICE) .value("3DX_KEYBOARD_BLACK", SI_3DX_KEYBOARD_BLACK) .value("3DX_KEYBOARD_WHITE", SI_3DX_KEYBOARD_WHITE) .value("TRAVELER", SI_TRAVELER) .value("TRAVELER1", SI_TRAVELER1) .value("SPACEBALL_5000A", SI_SPACEBALL_5000A) ; class_<SpaceDevice>("SpaceDevice", init<>()) .def("open", &SpaceDevice::open, (arg("appname"), arg("hwnd"))) .def("close", &SpaceDevice::close) .def("translateWin32Event", &SpaceDevice::translateWin32Event, (arg("msgid"), arg("wparam"), arg("lparam"))) .def("beep", &SpaceDevice::beep, arg("s")) .def("getDeviceID", &SpaceDevice::getDeviceID) .def("getDeviceInfo", &SpaceDevice::getDeviceInfo) .def("getDriverInfo", &SpaceDevice::getDriverInfo) .def("getNumDevices", &SpaceDevice::getNumDevices) .def("rezero", &SpaceDevice::rezero) .def("setUIMode", &SpaceDevice::setUIMode, arg("show")) ; } |
From: Matthias B. <mb...@us...> - 2005-01-09 20:13:17
|
Update of /cvsroot/cgkit/cgkit2/wrappers/wintab In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28239/wrappers/wintab Added Files: py_wintab.cpp Log Message: New: STL importer / New: Wintab wrapper / New: 3DxWare wrapper (SpaceMouse/SpaceBall) / Tablet/SpaceMouse support in the viewer / New: FreeCamera / Bugfix: 3DS importer will also import meshes without corresponding node (as produced by Wings 3D) --- NEW FILE: py_wintab.cpp --- /* Wintab wrapper */ #include <boost/python.hpp> #include <iostream> #include <exception> #include <windows.h> #include "wintab.h" // Set all bits to get the maximum size of the PACKET structure #define PACKETDATA 0xffffffff #include "pktdef.h" using namespace boost::python; // Exception class class WintabException : public std::exception [...1267 lines suppressed...] .def_readonly("id_proximity", &Context::id_proximity) .def_readonly("id_infochange", &Context::id_infochange) .def("open", &Context::open, (arg("hwnd"), arg("enable"))) .def("restore", &Context::restore, (arg("hwnd"), arg("saveinfo"), arg("enable"))) .def("close", &Context::close) .def("packet", &Context::packet, arg("serial")) .def("enable", &Context::enable) .def("overlap", &Context::overlap) .def("config", &Context::config, arg("hwnd")=0) .def("get", &Context::get) .def("set", &Context::set) .def("save", &Context::save) .def("packetsGet", &Context::packetsGet, arg("maxpkts")) .def("packetsPeek", &Context::packetsPeek, arg("maxpkts")) .def("dataGet", &Context::dataGet, (arg("begin"), arg("end"), arg("maxpkts"))) .def("dataPeek", &Context::dataPeek, (arg("begin"), arg("end"), arg("maxpkts"))) .def("queuePacketsEx", &Context::queuePacketsEx) ; } |