8#ifndef OPEN_COVER_PLUGIN_SUPPORT
9#define OPEN_COVER_PLUGIN_SUPPORT
29#define _WIN32_WINNT 0x501
31#if (_MSC_VER >= 1300) && !(defined(MIDL_PASS) || defined(RC_INVOKED))
32#define POINTER_64 __ptr64
45#include <osg/Drawable>
46#include <osg/ClipNode>
47#include <osg/MatrixTransform>
48#include <osgViewer/GraphicsWindow>
49#include <osg/BoundingBox>
59#include <net/message_types.h>
79#define MAX_NUMBER_JOYSTICKS 64
165 unsigned int wasPressed(
unsigned int buttonMask=vrui::vruiButtons::ALL_BUTTONS)
const;
167 unsigned int wasReleased(
unsigned int buttonMask=vrui::vruiButtons::ALL_BUTTONS)
const;
175 const std::string &
name()
const;
179 void setState(
unsigned int);
181 unsigned int buttonStatus = 0;
182 unsigned int lastStatus = 0;
183 int wheelCount[2]={0,0};
215 __attribute__((format(printf, 3, 4)))
223 MAX_NUM_CLIP_PLANES = 6
233 return clipPlanes[num].get();
367 void sendMessage(
coVRPlugin *sender,
const char *destination,
int type,
int len,
const void *buf,
bool localonly =
false);
441 int isPointerLocked();
444 int sendBinMessage(
const char *keyword,
const char *data,
int len);
451 void personSwitched(
size_t personNumber);
453 ui::Manager *ui =
nullptr;
454 ui::Menu *fileMenu =
nullptr;
455 ui::Menu *viewOptionsMenu =
nullptr;
456 ui::Menu *visMenu =
nullptr;
457 ui::ButtonGroup *navGroup()
const;
458 ui::VruiView *vruiView =
nullptr;
460 osg::Matrix envCorrectMat;
461 osg::Matrix invEnvCorrectMat;
463 int registerPlayer(vrml::Player *player);
464 int unregisterPlayer(vrml::Player *player);
465 vrml::Player *usePlayer(
void (*playerUnavailableCB)());
466 int unusePlayer(
void (*playerUnavailableCB)());
469 unsigned char number_buttons[MAX_NUMBER_JOYSTICKS];
470 int *buttons[MAX_NUMBER_JOYSTICKS];
471 unsigned char number_axes[MAX_NUMBER_JOYSTICKS];
472 float *axes[MAX_NUMBER_JOYSTICKS];
473 unsigned char number_sliders[MAX_NUMBER_JOYSTICKS];
474 float *sliders[MAX_NUMBER_JOYSTICKS];
475 unsigned char number_POVs[MAX_NUMBER_JOYSTICKS];
476 float *POVs[MAX_NUMBER_JOYSTICKS];
478 osg::ref_ptr<osg::ColorMask> getNoFrameBuffer()
480 return NoFrameBuffer;
484 float getSqrDistance(osg::Node *n, osg::Vec3 &p, osg::MatrixTransform **path,
int pathLength)
const;
486 osg::Matrix *getWorldCoords(osg::Node *node)
const;
487 osg::Vec3 frontScreenCenter;
488 float frontHorizontalSize;
489 float frontVerticalSize;
490 int frontWindowHorizontalSize;
491 int frontWindowVerticalSize;
494 float getInteractorScale(osg::Vec3 &pos);
497 float getViewerScreenDistance();
500 osg::BoundingBox getBBox(osg::Node *node)
const;
503 bool restrictOn()
const;
508 enum MessageDestinations
527 bool sendGrMessage(
const grmsg::coGRMsg &grmsg,
int msgType = covise::COVISE_MESSAGE_UI)
const;
529 void setFrameRealTime(
double ft);
533 osg::Vec3 eyeToScreen;
535 osg::ref_ptr<osg::ColorMask> NoFrameBuffer;
537 osg::ref_ptr<osg::ClipPlane> clipPlanes[MAX_NUM_CLIP_PLANES];
541 mutable int invCalculated;
543 bool wasHandValid =
false;
544 osg::Matrix baseMatrix;
545 mutable osg::Matrix invBaseMatrix;
546 double lastFrameStartTime;
547 double frameStartTime, frameStartRealTime;
548 osgViewer::GraphicsWindow::MouseCursor currentCursor;
549 bool cursorVisible =
true;
550 vrml::Player *player =
nullptr;
551 std::set<void (*)()> playerUseList;
553 int activeClippingPlane;
555 osg::ref_ptr<osg::Geode> intersectedNode;
556 osg::ref_ptr<osg::Drawable> intersectedDrawable;
558 osg::NodePath intersectedNodePath;
559 osg::Vec3 intersectionHitPointWorld;
560 osg::Vec3 intersectionHitPointWorldNormal;
561 osg::Vec3 intersectionHitPointLocal;
562 osg::Vec3 intersectionHitPointLocalNormal;
563 osg::ref_ptr<osg::RefMatrix> intersectionMatrix;
570 double interactorScale = 1.;
577 std::vector<std::ostream *> m_notifyStream;
578 std::vector<NotifyBuf *> m_notifyBuf;
581COVEREXPORT covise::TokenBuffer &
operator<<(covise::TokenBuffer &buffer,
const osg::Matrixd &matrix);
582COVEREXPORT covise::TokenBuffer &
operator>>(covise::TokenBuffer &buffer, osg::Matrixd &matrix);
584COVEREXPORT covise::TokenBuffer &
operator<<(covise::TokenBuffer &buffer,
const osg::Vec3f &vec);
585COVEREXPORT covise::TokenBuffer &
operator>>(covise::TokenBuffer &buffer, osg::Vec3f &vec);
593inline C
coClamp(
const C a,
const C left,
const C right)
602extern COVEREXPORT coVRPluginSupport *
cover;
OpenCOVER plugin interface, derive plugins from coVRPlugin.
Definition: ARToolKit.h:33
COVEREXPORT covise::TokenBuffer & operator>>(covise::TokenBuffer &buffer, osg::Matrixd &matrix)
std::ostream & operator<<(std::ostream &os, const coCommandLine &cmd)
C coClamp(const C a, const C left, const C right)
Definition: coVRPluginSupport.h:593
COVEREXPORT coVRPluginSupport * cover
Definition: coClusterStat.h:29
Definition: coTabletUI.h:51
collaborative interface manager
Definition: coVRCommunication.h:41
Definition: coVRFileManager.h:44
NotificationLevel
Definition: coVRPluginSupport.h:138
@ Info
Definition: coVRPluginSupport.h:140
@ Error
Definition: coVRPluginSupport.h:142
@ Debug
Definition: coVRPluginSupport.h:139
@ Fatal
Definition: coVRPluginSupport.h:143
@ Warning
Definition: coVRPluginSupport.h:141
Definition: coIntersection.h:63
Definition: coVRMessageSender.h:9
Definition: coVRMSController.h:61
make sure to clean up properly in the plugin's dtor
Definition: coVRPlugin.h:73
Definition: coVRPluginSupport.h:114
IntersectionBits
Definition: coVRPluginSupport.h:116
@ Walk
Definition: coVRPluginSupport.h:119
@ Visible
Definition: coVRPluginSupport.h:122
@ ReceiveShadow
Definition: coVRPluginSupport.h:127
@ Collision
Definition: coVRPluginSupport.h:117
@ Left
Definition: coVRPluginSupport.h:124
@ Pick
Definition: coVRPluginSupport.h:121
@ NoMirror
Definition: coVRPluginSupport.h:123
@ Touch
Definition: coVRPluginSupport.h:120
@ Intersection
Definition: coVRPluginSupport.h:118
@ OsgEarthSecondary
Definition: coVRPluginSupport.h:129
@ Update
Definition: coVRPluginSupport.h:128
@ CastShadow
Definition: coVRPluginSupport.h:126
@ Right
Definition: coVRPluginSupport.h:125
Definition: coVRPluginSupport.h:151
int getWheel(size_t idx=0) const
accumulated number of wheel events
bool notPressed() const
is no button pressed
unsigned int wasPressed(unsigned int buttonMask=vrui::vruiButtons::ALL_BUTTONS) const
buttons pressed since last frame
unsigned int oldState() const
unsigned int wasReleased(unsigned int buttonMask=vrui::vruiButtons::ALL_BUTTONS) const
buttons released since last frame
coPointerButton(const std::string &name)
void setWheel(size_t idx, int count)
set number wheel events
unsigned int getState() const
const std::string & name() const
button name
Definition: coVRPluginSupport.h:192
void setRenderStrategy(osg::Drawable *draw, bool dynamic=false)
void sendMessage(coVRPlugin *sender, const char *destination, int type, int len, const void *buf, bool localonly=false)
send a message to a named plugins
vrui::coMenu * getMenu()
returns the COVER Menu (Pinboard)
coVRPlugin * getPlugin(const char *name)
get plugin called name
void setCursorVisible(bool visible)
make the cursor visible or invisible
float getSceneSize() const
get the scene size defined in covise.config
osgViewer::GraphicsWindow::MouseCursor getCurrentCursor() const
get the number of the active cursor shape
bool isClippingOn() const
returns true if clipping is on
void watchFileDescriptor(int fd)
register filedescriptor fd for watching so that scene will be re-rendererd when it is ready
osg::MatrixTransform * getObjectsScale() const
get the MatrixTransform for objects scaling
float getScale() const
get the scale factor of the scale node
INTERNAL int getNumClipPlanes()
return the number of clipPlanes reserved for the kernel, others are available to VRML ClippingPlane N...
void setScale(float s)
set the scale matrix of the scale node
INTERNAL INTERNAL vrui::coToolboxMenu * getToolBar(bool create=false)
bool debugLevel(int level) const
returns true if level <= debugLevel
void releaseViewer(coVRPlugin *)
release control over viewer position
osg::ClipPlane * getClipPlane(int num)
return pointer to a clipping plane
Definition: coVRPluginSupport.h:231
bool removeNode(osg::Node *node, bool isGroup=false)
remove node from the scene graph,
bool grabViewer(coVRPlugin *)
let plugin request control over viewer position
coPointerButton * getMouseButton() const
returns a pointer to a coPointerButton object representing the mouse buttons state
void setActiveClippingPlane(int plane)
set number of clipping plane user is possibly interacting with
int removePlugin(const char *name)
remove a plugin by name
void unwatchFileDescriptor(int fd)
remove fd from filedescriptors to watch
opencover::coVRMessageSender * getSender()
const osg::Matrix & getBaseMat() const
transformation matrix from object coordinates to world coordinates
Definition: coVRPluginSupport.h:290
static double currentTime()
const osg::Matrix & getRelativeMat() const
get matrix for relative input (identity if no input)
coPointerButton * getPointerButton() const
returns a pointer to a coPointerButton object for the main button device
const osg::Matrix & getInvBaseMat() const
transformation from world coordinates to object coordinates
coVRPlugin * addPlugin(const char *name)
load a new plugin
bool sendGrMessage(const grmsg::coGRMsg &grmsg, int msgType=covise::COVISE_MESSAGE_UI) const
osg::MatrixTransform * getPointer() const
get the MatrixTransform node of the hand
bool isViewerGrabbed() const
whether a plugins controls viewer position
coPointerButton * getRelativeButton() const
returns a pointer to a coPointerButton object representing the buttons state on the relative input de...
double frameRealTime() const
const osg::Vec3 & getIntersectionHitPointWorld() const
get world coordinates of intersection hit point
void preparePluginUnload()
double frameDuration() const
bool sendVrbMessage(const covise::MessageBase *msg) const
send a message either via COVISE connection or via tcp to VRB
bool isKeyboardGrabbed()
check if keyboard is grabbed
osg::ClipNode * getObjectsRoot() const
get the group node for all COVISE and model geometry
int getActiveClippingPlane() const
return number of clipping plane user is possibly interacting with
void removePlugin(coVRPlugin *)
remove the plugin by pointer
const osg::Vec3 & getIntersectionHitPointWorldNormal() const
get normal of intersection hit
const osg::Matrix & getPointerMat() const
get matrix of hand transform (same as getPointer()->getMatrix())
osg::MatrixTransform * getObjectsXform() const
get the MatrixTransform for objects translation and rotation
vrui::coUpdateManager * getUpdateManager() const
osg::Group * getMenuGroup() const
return group node of menus
osg::Node * getIntersectedNode() const
get node currently intersected by pointer
bool grabKeyboard(coVRPlugin *)
grab keyboard input
osg::Matrix updateInteractorTransform(osg::Matrix mat, bool usePointer) const
update matrix of an interactor, honouring snapping, ...
osg::Group * getScene() const
get scene group node
const osg::Matrix & getXformMat() const
same as getObjectsXform()->getMatrix()
void setToolBar(vrui::coToolboxMenu *tb)
const osg::NodePath & getIntersectedNodePath() const
get path to node currently intersected by pointer
void sendMessage(coVRPlugin *sender, int toWhom, int type, int len, const void *buf)
send a message to other plugins
std::ostream & notify(Notify::NotificationLevel level=Notify::Info) const
void setCurrentCursor(osgViewer::GraphicsWindow::MouseCursor type)
void releaseKeyboard(coVRPlugin *)
release keyboard input, all plugins will get key events
const osg::Matrix & getMouseMat() const
void setNodesIsectable(osg::Node *n, bool isect)
search geodes under node and set Visible bit in node mask
void setFrameTime(double ft)
use only during coVRPlugin::update()
const osg::Matrix & getViewerMat() const
get the position and orientation of the user in world coordinates
void setXformMat(const osg::Matrix &mat)
same as getObjectsXform()->setMatrix()
bool isHighQuality() const
favor high-quality rendering instead of interactivity
std::ostream & notify(Notify::NotificationLevel level, const char *format,...) const
void addedNode(osg::Node *node, coVRPlugin *myPlugin)
informs other plugins that this plugin extended the scene graph
void protectScenegraph()
forbid saving of scenegraph
Definition: OpenCOVER.h:61
Definition: coToolboxMenu.h:40
Definition: coUpdateManager.h:42