cgv
Loading...
Searching...
No Matches
drawable.h
1#pragma once
2
3#include <cgv/base/base.h>
4#include <cgv/base/traverser.h>
5#include <cgv/render/context.h>
6#include <cgv/math/fray.h>
7#include <cgv/render/view.h>
8
9#include "lib_begin.h"
10
11namespace cgv {
12 namespace render {
13
15class CGV_API drawable : public base::traverse_policy
16{
17private:
19 context* ctx;
20public:
22 drawable();
23
25 void hide();
27 void show();
29 bool is_visible() const;
30
32 context* get_context() const;
34 void set_context(context* _ctx);
36
37 view* find_view_as_node(size_t view_idx = 0) const;
39
41 bool get_world_location(int x, int y, const view& V, dvec3& world_location, double* window_z_ptr = 0) const;
43 cgv::ray3 get_world_ray(int x, int y, view* view_ptr, const cgv::dmat4& modelview_projection_window_matrix) const;
45 void post_redraw();
47 void force_redraw();
48
50 virtual bool init(context&);
52 virtual void resize(unsigned int w, unsigned int h);
54 virtual void init_frame(context&);
56 virtual void draw(context&);
58 virtual void finish_draw(context&);
60 virtual void finish_frame(context&);
62 virtual void after_finish(context&);
64 virtual void clear(context&);
66 virtual void destruct(context&) final;
67};
68
70class CGV_API multi_pass_drawable : public drawable
71{
72protected:
73 // mark current render pass
74 int current_render_pass;
75 // store recursion depth on which render passes are initiated
76 unsigned render_pass_recursion_depth;
77public:
81 bool initiate_render_pass_recursion(context& ctx);
83 void perform_render_pass(context& ctx, int rp_idx, RenderPass rp = RP_USER_DEFINED, int excluded_flags = RPF_HANDLE_SCREEN_SHOT, int included_flags = 0);
85 void initiate_terminal_render_pass(int rp_idx);
87 bool multi_pass_ignore_finish(const context& ctx);
89 bool multi_pass_terminate(const context& ctx);
90};
91
92 } // namespace render
93} // namespace cgv
94
95#include <cgv/config/lib_end.h>
nodes should inherit from this policy class to allow selective tree traversals
Definition traverser.h:24
matrix of fixed size dimensions
Definition fmat.h:23
base class for all drawables, which is independent of the used rendering API.
Definition context.h:670
base class for all drawables, which is independent of the used rendering API.
Definition drawable.h:16
helper class to control multiple render passes in init_frame and after_finish methods of drawable.
Definition drawable.h:71
defines a symmetric view with the following quantities:
Definition view.h:22
RenderPass
Enumeration of different render passes, which can be queried from the context and used to specify a n...
Definition context.h:133
@ RP_USER_DEFINED
user defined renderpass
Definition context.h:142
@ RPF_HANDLE_SCREEN_SHOT
whether to perform a screen shot if this was scheduled
Definition context.h:177
this header is dependency free
Definition print.h:11
Struct template for fixed n-dimensional rays with arbitrary data type defined by origin and direction...
Definition fray.h:11