VisionWorks Toolkit Reference

December 18, 2015 | 1.2 Release

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Render3D.hpp
Go to the documentation of this file.
1 /*
2 # Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved.
3 #
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions
6 # are met:
7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above copyright
10 # notice, this list of conditions and the following disclaimer in the
11 # documentation and/or other materials provided with the distribution.
12 # * Neither the name of NVIDIA CORPORATION nor the names of its
13 # contributors may be used to endorse or promote products derived
14 # from this software without specific prior written permission.
15 #
16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
17 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20 # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23 # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
24 # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28 
29 #ifndef NVXIO_RENDER_3D_HPP
30 #define NVXIO_RENDER_3D_HPP
31 
32 #include <string>
33 #include <vector>
34 
35 #include <NVX/nvx.h>
36 #include <NVXIO/Render.hpp>
37 
43 namespace nvxio {
44 
59 class Render3D
60 {
61 public:
62 
67  {
70  };
71 
79  struct PlaneStyle
80  {
83  };
84 
93  {
96  };
97 
102  {
110  };
111 
119  typedef void (*OnKeyboardEventCallback)(void* context, vx_char key, vx_uint32 x, vx_uint32 y);
127  typedef void (*OnMouseEventCallback)(void* context, MouseButtonEvent event, vx_uint32 x, vx_uint32 y);
128 
134  virtual void setOnKeyboardEventCallback(OnKeyboardEventCallback callback, void* context) = 0;
140  virtual void setOnMouseEventCallback(OnMouseEventCallback callback, void* context) = 0;
141 
150  virtual void putPlanes(vx_array planes, vx_matrix model, const PlaneStyle& style) = 0;
151 
158  virtual void putPointCloud(vx_array points, vx_matrix model, const PointCloudStyle& style) = 0;
159 
160 
165  virtual bool flush() = 0;
166 
170  virtual void close() = 0;
171 
177  virtual void setViewMatrix(vx_matrix view) = 0;
178 
184  virtual void getViewMatrix(vx_matrix view) const = 0;
185 
191  virtual void setProjectionMatrix(vx_matrix projection) = 0;
197  virtual void getProjectionMatrix(vx_matrix projection) const = 0;
198 
203  virtual void setDefaultFOV(float fov) = 0;
204 
210  virtual void enableDefaultKeyboardEventCallback() = 0;
214  virtual void disableDefaultKeyboardEventCallback() = 0;
219  virtual bool useDefaultKeyboardEventCallback() = 0;
220 
225  virtual vx_uint32 getWidth() const = 0;
230  virtual vx_uint32 getHeight() const = 0;
231 
236  virtual void putImage(vx_image image) = 0;
237 
243  virtual void putText(const std::string& text, const nvxio::Render::TextBoxStyle& style) = 0;
244 
248  virtual ~Render3D()
249  {}
250 
251 protected:
252  Render3D(TargetType type = Render3D::UNKNOWN_RENDER, const std::string& name = "Undefined"):
253  targetType(type),
254  renderName(name)
255  {}
256 
258  const std::string renderName;
259 };
260 
273 std::unique_ptr<Render3D> createDefaultRender3D(vx_context context, int xPos, int yPos,const std::string& title, vx_uint32 width, vx_uint32 height);
274 }
275 
276 #endif
struct _vx_image * vx_image
An opaque reference to an image.
Definition: vx_types.h:186
const TargetType targetType
Definition: Render3D.hpp:257
virtual void setOnKeyboardEventCallback(OnKeyboardEventCallback callback, void *context)=0
Sets the keyboard event callback.
virtual void setProjectionMatrix(vx_matrix projection)=0
Sets the projection matrix.
vx_float32 maxDistance
Holds the maximal distance that a point can have.
Definition: Render3D.hpp:95
struct _vx_array * vx_array
The Array Object. Array is a strongly-typed container for other data structures.
Definition: vx_types.h:279
TargetType
Defines Render3D types.
Definition: Render3D.hpp:66
Render3D(TargetType type=Render3D::UNKNOWN_RENDER, const std::string &name="Undefined")
Definition: Render3D.hpp:252
vx_float32 minDistance
Holds the minimal distance that a plane can have.
Definition: Render3D.hpp:81
void(* OnMouseEventCallback)(void *context, MouseButtonEvent event, vx_uint32 x, vx_uint32 y)
Callback for mouse events.
Definition: Render3D.hpp:127
virtual void close()=0
Closes the render.
vx_float32 maxDistance
Holds the maximal distance that a plane can have.
Definition: Render3D.hpp:82
std::unique_ptr< Render3D > createDefaultRender3D(vx_context context, int xPos, int yPos, const std::string &title, vx_uint32 width, vx_uint32 height)
Creates Render3D.
NVIDIA VisionWorks Framework and Primitives API.
virtual void putPointCloud(vx_array points, vx_matrix model, const PointCloudStyle &style)=0
Puts the point cloud to the render.
Indicates the left mouse button has been pressed down.
Definition: Render3D.hpp:103
char vx_char
An 8 bit ASCII character.
Definition: vx_types.h:85
float vx_float32
A 32-bit float value.
Definition: vx_types.h:138
Indicates a stub render.
Definition: Render3D.hpp:68
Holds the point cloud style.
Definition: Render3D.hpp:92
Render3D interface.
Definition: Render3D.hpp:59
struct _vx_context * vx_context
An opaque reference to the implementation context.
Definition: vx_types.h:222
virtual void setOnMouseEventCallback(OnMouseEventCallback callback, void *context)=0
Sets mouse event callback.
Indicates a middle mouse button has been pressed down.
Definition: Render3D.hpp:105
Indicates the middle mouse button has been released.
Definition: Render3D.hpp:106
Indicates Render3D.
Definition: Render3D.hpp:69
virtual void disableDefaultKeyboardEventCallback()=0
Disables default keyboard event handler.
virtual void putText(const std::string &text, const nvxio::Render::TextBoxStyle &style)=0
Puts a message box on the image.
Indicates the right mouse button has been released.
Definition: Render3D.hpp:108
virtual bool flush()=0
Renders all primitives.
virtual ~Render3D()
Destructor.
Definition: Render3D.hpp:248
Holds the plane style.
Definition: Render3D.hpp:79
The Render interface and utility functions.
virtual vx_uint32 getHeight() const =0
Gets the height.
void(* OnKeyboardEventCallback)(void *context, vx_char key, vx_uint32 x, vx_uint32 y)
Callback for keyboard events.
Definition: Render3D.hpp:119
Indicates the mouse has been moved.
Definition: Render3D.hpp:109
virtual void setViewMatrix(vx_matrix view)=0
Sets view matrix.
virtual void putImage(vx_image image)=0
Puts the image to the render.
virtual void getViewMatrix(vx_matrix view) const =0
Gets view matrix.
MouseButtonEvent
Defines mouse events.
Definition: Render3D.hpp:101
const std::string renderName
Definition: Render3D.hpp:258
virtual void enableDefaultKeyboardEventCallback()=0
Enables the default keyboard event handler.
Indicates the left mouse button has been released.
Definition: Render3D.hpp:104
Defines the text box parameters.
Definition: Render.hpp:80
uint32_t vx_uint32
A 32-bit unsigned value.
Definition: vx_types.h:100
virtual bool useDefaultKeyboardEventCallback()=0
Gets the flag indicating if the default keyboard event handler is enabled.
virtual vx_uint32 getWidth() const =0
Gets the width.
vx_float32 minDistance
Holds the minimal distance that a point can have.
Definition: Render3D.hpp:94
virtual void setDefaultFOV(float fov)=0
Sets the field of view.
struct _vx_matrix * vx_matrix
The Matrix Object. An MxN matrix of some unit type.
Definition: vx_types.h:249
virtual void putPlanes(vx_array planes, vx_matrix model, const PlaneStyle &style)=0
Puts the surface to the render.
virtual void getProjectionMatrix(vx_matrix projection) const =0
Gets the projection matrix.
Indicates the right mouse button has been pressed down.
Definition: Render3D.hpp:107