Rumba C++ SDK
RenderablePlugin.h
Go to the documentation of this file.
1 /* *
2  ***
3  *****
4  ********************* Mercenaries Engineering SARL
5  ***************** Copyright (C) 2020
6  *************
7  ********* http://www.mercenaries-engineering.com
8  ***********
9  **** ****
10  ** **
11 */
12 # pragma once
13 # include "Maquina/Macros.h"
14 
15 MAQUINA_IGNORE_WARNINGS_BEGIN
16 # include <ImathMatrix.h>
17 # include <ImathColor.h>
18 MAQUINA_IGNORE_WARNINGS_END
19 
20 # include "Maquina/NodePlugin.h"
21 # include "Maquina/RenderTargets.h"
22 
23 namespace maquina
24 {
29  enum class RenderTargetAttachment{ color = 0, ids = 1, position = 3, normal = 4 };
31  std::wstring env_map_path;
34  Imath::V4i viewport = Imath::V4i{0}; //x, y, width, height
38  uint64_t viewport_identifier = 0;
39  float near_clip = 0.1f;
40  float far_clip = 1000.f;
41  float time = 0;
42  uint8_t subdivision_level = 0; //0, 1 or 2
43  uint8_t shading_mode = 0; //WIREFRAME, WIREFRAME_ON_SHADED or SHADED
44  uint8_t select_mode = 0; //CONTROLLER, MANIPULATOR, GEOMETRY
45  uint8_t msaa_samples = 0;
46  bool smooth_shading = true;
47  bool use_textures = false;
48  uint8_t culling_mode = 0; //style_back_unless_double_sided, style_back, off
49  bool is_playing = false;
50  bool force_picking = false;
51  };
52 
53  struct PickingResult {
54  PickingResult() = default;
55  PickingResult( const std::string& path, float depth )
56  : node_delegate_path{ path }, normalized_depth{ depth }
57  {}
58  bool empty() const { return node_delegate_path.empty(); }
59  std::string node_delegate_path;
61  };
62 
64  {
65  public:
66  RenderablePlugin( Node* node ) : NodePlugin( node ) {}
67  virtual ~RenderablePlugin() {}
68 
70  virtual void release_GL_resources() {};
71 
72  virtual void render( const RenderParameters& parameters ) = 0;
79  virtual void pick( const RenderParameters& parameters, Imath::V2i position, std::vector< PickingResult >& picked );
87  virtual void select( const RenderParameters& parameters, const Imath::V4i& trap, std::vector< std::string >& delegate_paths );
94  static void cache( const Plug& plug );
96  static void uncache( const Plug& plug );
97  };
98 }
uint8_t select_mode
Definition: RenderablePlugin.h:44
Imath::M44d world_to_camera
Definition: RenderablePlugin.h:33
Imath::Color4f background_color
Definition: RenderablePlugin.h:36
virtual void release_GL_resources()
The OpenGL resources allocated by the renderer plug-in must be released during this callback...
Definition: RenderablePlugin.h:70
bool smooth_shading
Definition: RenderablePlugin.h:46
Definition: RenderablePlugin.h:27
Definition: RenderablePlugin.h:27
Definition: ImathColor.h:120
Definition: ImathFrame.h:43
bool force_picking
Definition: RenderablePlugin.h:50
bool use_textures
Definition: RenderablePlugin.h:47
uint8_t msaa_samples
Definition: RenderablePlugin.h:45
uint8_t shading_mode
Definition: RenderablePlugin.h:43
Derive this class to create your own Node type.
Definition: NodePlugin.h:28
bool is_playing
Definition: RenderablePlugin.h:49
CullingType
Definition: RenderablePlugin.h:28
RenderablePlugin(Node *node)
Definition: RenderablePlugin.h:66
Definition: RenderablePlugin.h:26
MAQUINA_EXPORT void select(const std::vector< Node > &nodes, SelectionMode mode=SelectionMode::Replace)
Update the active selection with a list of nodes according to the selection mode. ...
SelectType
Definition: RenderablePlugin.h:27
Definition: ImathVec.h:63
This version of the SDK is unstable, i-e, it may change with no warning.
Definition: AddCurveAction.h:20
virtual ~RenderablePlugin()
Definition: RenderablePlugin.h:67
RenderTargets render_targets
Definition: RenderablePlugin.h:37
uint64_t viewport_identifier
Definition: RenderablePlugin.h:38
Imath::V4i viewport
Definition: RenderablePlugin.h:34
std::string node_delegate_path
Definition: RenderablePlugin.h:59
Definition: RenderTargets.h:5
PickingResult(const std::string &path, float depth)
Definition: RenderablePlugin.h:55
#define MAQUINA_EXPORT
Definition: Export.h:31
A node plug.
Definition: Plug.h:52
Definition: RenderablePlugin.h:53
float time
Definition: RenderablePlugin.h:41
Definition: ImathVec.h:61
RenderPass
Definition: RenderablePlugin.h:30
float near_clip
Definition: RenderablePlugin.h:39
Definition: RenderablePlugin.h:26
Imath::Color4f ambient_light
Definition: RenderablePlugin.h:35
float normalized_depth
Definition: RenderablePlugin.h:60
Definition: RenderablePlugin.h:63
Definition: RenderablePlugin.h:27
Definition: RenderablePlugin.h:26
Imath::M44d camera_projection
Definition: RenderablePlugin.h:32
ShadingType
Definition: RenderablePlugin.h:26
uint8_t culling_mode
Definition: RenderablePlugin.h:48
uint8_t subdivision_level
Definition: RenderablePlugin.h:42
Definition: RenderablePlugin.h:25
float far_clip
Definition: RenderablePlugin.h:40
bool empty() const
Definition: RenderablePlugin.h:58
std::wstring env_map_path
Definition: RenderablePlugin.h:31
RenderTargetAttachment
Definition: RenderablePlugin.h:29
Base class of all Rumba nodes.
Definition: Node.h:36