Provides a render area in the user control/widget to enable visualization of the current model data and overlay items. More...
Public Member Functions | |
View () | |
Constructs a view object. More... | |
const Viewer * | attachedViewer () const |
Returns this view's attached viewer. More... | |
void | attachToViewer (Viewer *viewer) |
Attaches this view to the specified viewer. More... | |
void | detachFromViewer () |
Detaches the view from the current viewer. More... | |
size_t | modelCount () const |
Returns number of models. More... | |
size_t | modelIndex (const Model *model) const |
Returns index of the specified model. More... | |
Model * | model (size_t modelIndex) |
Returns the model at the given index. More... | |
void | addModel (Model *model) |
Adds a model to the view. More... | |
void | removeAllModels () |
Removes all models from view. More... | |
void | removeModel (Model *model) |
Removes specified model from view. More... | |
void | setModelOpenGLCapabilitiesFromView (Model *model) const |
Sets the OpenGL capabilities from a given model. More... | |
void | addSecondPassModel (Model *model) |
Adds a model to the second render pass of the view. More... | |
const Overlay & | overlay () const |
Returns the Overlay object. More... | |
Overlay & | overlay () |
Returns the Overlay object. More... | |
const Clipping & | clipping () const |
Returns the Clipping object. More... | |
Clipping & | clipping () |
Returns the Clipping object. More... | |
const Camera & | camera () const |
Returns the view's camera. More... | |
Camera & | camera () |
Returns the view's camera. More... | |
BoundingBox | boundingBox () |
Returns the bounding box. More... | |
Background | background () const |
Returns the background. More... | |
void | setBackground (const Background &background) |
Sets the background color(s) More... | |
Color3f | haloColor () const |
Returns the color of the halo. More... | |
void | setHaloColor (const Color3f &color) |
Sets the color of the halo. More... | |
bool | isDropShadowEnabled () const |
Returns true if Drop Shadow rendering is enabled in the view. More... | |
bool | enableDropShadow (bool enable) |
Turns on/off the display of a drop shadow in the view. More... | |
TransparencyMode | transparencyMode () const |
Returns the current transparency mode. More... | |
void | setTransparencyMode (const TransparencyMode &transparency) |
Sets which transparency mode to use. More... | |
bool | renderToImage (unsigned int width, unsigned int height, Image *image) |
Renders the contents of the view to an image. More... | |
bool | renderToImage (Image *image) |
Renders the contents of the view to an image. More... | |
void | renderViewInAttachedViewer () |
Core render method for the view, render using the attached viewer. More... | |
void | lastRenderingPerformanceInfo (PerformanceInfo *info) const |
Gets the last rendering performance information in info. More... | |
void | requestRedraw () |
Triggers a redraw in the view. More... | |
void | requestImmediateRedraw () |
Redraws the view now, not waiting on a normal requestRedraw. More... | |
bool | regionClosestVertex (int x, int y, unsigned int width, unsigned int height, Vec3d *vertex) |
Finds the vertex closest to the front clipping plane in the given region. More... | |
void * | framebufferData () |
Returns the framebuffer data as an array of RGB values. (8 bit components) More... | |
![]() | |
void | addRef () const |
Increments the reference count for this object. More... | |
void | release () const |
Decrements the reference count for this object. More... | |
int | refCount () const |
Returns the reference count for this object. More... | |
void | setRefCountZero () const |
Sets the ref count to zero, but DOES NOT delete the object. More... | |
Provides a render area in the user control/widget to enable visualization of the current model data and overlay items.
Each view must be attached to a system specific Viewer that enables the OpenGL rendering to be shown in the applications system.
A view can contain any number of models and overlay items. The figure below contains one UnstructGridModel, a colorlegend overlay, a navigation cube overlay and a text box overlay. The view is set up with a gradient color using the Background class.
A model is a visual setup and presentation of your data. Ceetron Desktop Components offers 3 types of models; GeometryModel, UnstructGridModel and MarkupModel. (Read more about the different model types under the model topic). Each view can contain one or more models to be visualized. (One model can also be visualized in several views.) Add a model to a view using addModel().
The camera provides support for camera manipulation in the view. The camera contains the lookat vectors, type of perspective and defines the viewport. The camera also manages the input handler, which can either one of the built-in handlers or a custom made. Each view has its own camera object which can be accessed through camera().
The view offers several types of overlay items. These are visual elements drawn as an overlay in front of the model in the view, for instance, the color legend for scalar results. Overlay items are added and managed using the class Overlay.
Available overlay item types are:
To get the current view rendered to an image object, call renderToImage() with the wanted width and height. The image object contains raw RGBA colors and can easily be read from any image exporter tools.
The bounding box surrounding all currently visible models in the view can be found using boundingBox().
cee::vis::View::View | ( | ) |
Constructs a view object.
void cee::vis::View::addModel | ( | Model * | model | ) |
Adds a model to the view.
void cee::vis::View::addSecondPassModel | ( | Model * | model | ) |
Adds a model to the second render pass of the view.
Adds a model to the view, but it will be drawn after all the normal models, and the depth buffer will be cleared before this second pass, making all models added to the second pass overdraw the normal models.
const Viewer * cee::vis::View::attachedViewer | ( | ) | const |
Returns this view's attached viewer.
void cee::vis::View::attachToViewer | ( | Viewer * | viewer | ) |
Attaches this view to the specified viewer.
Background cee::vis::View::background | ( | ) | const |
Returns the background.
cee::BoundingBox cee::vis::View::boundingBox | ( | ) |
Returns the bounding box.
The bounding box will always be the smallest possible surrounding all models in the view.
Note: Models with use2dPixelProjection() set to true will not be considered by this method.
const Camera & cee::vis::View::camera | ( | ) | const |
Returns the view's camera.
Camera & cee::vis::View::camera | ( | ) |
Returns the view's camera.
const Clipping & cee::vis::View::clipping | ( | ) | const |
Clipping & cee::vis::View::clipping | ( | ) |
void cee::vis::View::detachFromViewer | ( | ) |
Detaches the view from the current viewer.
bool cee::vis::View::enableDropShadow | ( | bool | enable | ) |
Turns on/off the display of a drop shadow in the view.
If enabled, a shadow of the current model will be displayed on a plane in the bottom of the view.
void * cee::vis::View::framebufferData | ( | ) |
Returns the framebuffer data as an array of RGB values. (8 bit components)
Color3f cee::vis::View::haloColor | ( | ) | const |
Returns the color of the halo.
bool cee::vis::View::isDropShadowEnabled | ( | ) | const |
Returns true if Drop Shadow rendering is enabled in the view.
void cee::vis::View::lastRenderingPerformanceInfo | ( | PerformanceInfo * | info | ) | const |
Gets the last rendering performance information in info.
Model * cee::vis::View::model | ( | size_t | modelIndex | ) |
Returns the model at the given index.
size_t cee::vis::View::modelCount | ( | ) | const |
Returns number of models.
size_t cee::vis::View::modelIndex | ( | const Model * | model | ) | const |
Returns index of the specified model.
Returns UNDEFINED_SIZE_T if model could not be found
const Overlay & cee::vis::View::overlay | ( | ) | const |
Overlay & cee::vis::View::overlay | ( | ) |
bool cee::vis::View::regionClosestVertex | ( | int | x, |
int | y, | ||
unsigned int | width, | ||
unsigned int | height, | ||
Vec3d * | vertex | ||
) |
Finds the vertex closest to the front clipping plane in the given region.
The x and y coordinates must be specified in OpenGL style coordinates, which means a right handed coordinate system with the origin in the lower left corner of the window. The width and height is in pixels.
If any vertex was found (method returning true), it will be set in the vertex parameter. The vertex is in world coordinates.
Returns true if a vertex was found. False if not.
void cee::vis::View::removeAllModels | ( | ) |
Removes all models from view.
void cee::vis::View::removeModel | ( | Model * | model | ) |
Removes specified model from view.
bool cee::vis::View::renderToImage | ( | unsigned int | width, |
unsigned int | height, | ||
Image * | image | ||
) |
Renders the contents of the view to an image.
Will do off-screen rendering of the view contents and return the resulting image in image.
Note! Overlay items specified using pixel size (for instance color legend), will not be scaled when changing width and height.
Note! The image width must be a multiple of 4. If it isn't, the specified width will be adjusted automatically before image creation.
bool cee::vis::View::renderToImage | ( | Image * | image | ) |
Renders the contents of the view to an image.
Grabs the current frame buffer so the size of the image will be the same as the viewport of of the current camera.
Note! The image width must be a multiple of 4. If it isn't, the specified width will be adjusted automatically before image creation.
void cee::vis::View::renderViewInAttachedViewer | ( | ) |
Core render method for the view, render using the attached viewer.
This method should not be called directly, but should typically be used as part of a redraw operation from the GUI system (typically from a derived Viewer) To trigger a redraw on a view, please use requestRedraw()
void cee::vis::View::requestImmediateRedraw | ( | ) |
Redraws the view now, not waiting on a normal requestRedraw.
This will do an immediate update of the window, and not wait for the message processing that is the normal case for requestRedraw(). This is useful for updating the view multiple times in application code without the application message pump being processed.
Examples that use this is the camera animation (e.g. for the navigation cube) and per frame update of the unstruct grid model.
void cee::vis::View::requestRedraw | ( | ) |
Triggers a redraw in the view.
This will call requestRedraw() in the attached viewer, which will typically invalidate the 3D window, but not necessarily redraw it immediately.
void cee::vis::View::setBackground | ( | const Background & | background | ) |
Sets the background color(s)
void cee::vis::View::setHaloColor | ( | const Color3f & | color | ) |
Sets the color of the halo.
void cee::vis::View::setModelOpenGLCapabilitiesFromView | ( | Model * | model | ) | const |
Sets the OpenGL capabilities from a given model.
You should add the model to the view before adding contents to the model. If you want to add content to a model without adding it to a view, call setModelOpenGLCapabilitiesFromView() for the given model.
void cee::vis::View::setTransparencyMode | ( | const TransparencyMode & | transparency | ) |
Sets which transparency mode to use.
Note: All modes except SIMPLE require shader support, so the OpenGL context needs to support shaders. Also, you cannot disable shader support with ModelSettings::setUseShaderPrograms(false) if you use any other mode than SIMPLE.
TransparencyMode cee::vis::View::transparencyMode | ( | ) | const |
Returns the current transparency mode.