1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
/*=========================================================================
Program: Visualization Toolkit
Module: vtkVRMenuRepresentation.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/**
* @class vtkVRMenuRepresentation
* @brief Widget representation for vtkVRMenuWidget
* Implementation of the popup panel representation for the
* vtkVRMenuWidget.
* This representation is rebuilt every time the selected/hovered prop changes.
* Its position is set according to the camera orientation and is placed at a
* distance defined in meters in the BuildRepresentation() method.
*
* WARNING: The panel might be occluded by other props.
* TODO: Improve placement method.
**/
#ifndef vtkVRMenuRepresentation_h
#define vtkVRMenuRepresentation_h
#include "vtkRenderingVRModule.h" // For export macro
#include "vtkWidgetRepresentation.h"
#include <deque> // for ivar
VTK_ABI_NAMESPACE_BEGIN
class VTKRENDERINGVR_EXPORT vtkVRMenuRepresentation : public vtkWidgetRepresentation
{
public:
/**
* Instantiate the class.
*/
static vtkVRMenuRepresentation* New();
///@{
/**
* Standard methods for the class.
*/
vtkTypeMacro(vtkVRMenuRepresentation, vtkWidgetRepresentation);
void PrintSelf(ostream& os, vtkIndent indent) override;
///@}
///@{
/**
* Methods to interface with the vtkVRMenuWidget.
*/
void BuildRepresentation() override;
void StartComplexInteraction(vtkRenderWindowInteractor* iren, vtkAbstractWidget* widget,
unsigned long event, void* calldata) override;
void ComplexInteraction(vtkRenderWindowInteractor* iren, vtkAbstractWidget* widget,
unsigned long event, void* calldata) override;
void EndComplexInteraction(vtkRenderWindowInteractor* iren, vtkAbstractWidget* widget,
unsigned long event, void* calldata) override;
///@}
///@{
/**
* Methods supporting the rendering process.
*/
void ReleaseGraphicsResources(vtkWindow*) override;
vtkTypeBool HasTranslucentPolygonalGeometry() override;
int RenderOverlay(vtkViewport*) override;
///@}
///@{
/**
* Methods to add/remove items to the menu, called by the menu widget
*/
void PushFrontMenuItem(const char* name, const char* text, vtkCommand* cmd);
void RenameMenuItem(const char* name, const char* text);
void RemoveMenuItem(const char* name);
void RemoveAllMenuItems();
///@}
vtkGetMacro(CurrentOption, double);
protected:
vtkVRMenuRepresentation();
~vtkVRMenuRepresentation() override;
class InternalElement;
std::deque<InternalElement*> Menus;
double CurrentOption; // count from start of the list
double PlacedPos[3];
double PlacedDOP[3];
double PlacedVUP[3];
double PlacedVRight[3];
double PlacedOrientation[3];
private:
vtkVRMenuRepresentation(const vtkVRMenuRepresentation&) = delete;
void operator=(const vtkVRMenuRepresentation&) = delete;
};
VTK_ABI_NAMESPACE_END
#endif
|