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/render/view.h>
7
8#include "lib_begin.h"
9
10namespace cgv {
11 namespace render {
12
14class CGV_API drawable : public base::traverse_policy
15{
16private:
18 context* ctx;
19public:
21 drawable();
22
24 void hide();
26 void show();
28 bool is_visible() const;
29
31 context* get_context() const;
33 void set_context(context* _ctx);
35
36 view* find_view_as_node(size_t view_idx = 0) const;
38
40 bool get_world_location(int x, int y, const view& V, dvec3& world_location, double* window_z_ptr = 0) const;
42 void post_redraw();
44 void force_redraw();
45
47 virtual bool init(context&);
49 virtual void resize(unsigned int w, unsigned int h);
51 virtual void init_frame(context&);
53 virtual void draw(context&);
55 virtual void finish_draw(context&);
57 virtual void finish_frame(context&);
59 virtual void after_finish(context&);
61 virtual void clear(context&);
62};
63
65class CGV_API multi_pass_drawable : public drawable
66{
67protected:
68 // mark current render pass
69 int current_render_pass;
70 // store recursion depth on which render passes are initiated
71 unsigned render_pass_recursion_depth;
72public:
76 bool initiate_render_pass_recursion(context& ctx);
78 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);
80 void initiate_terminal_render_pass(int rp_idx);
82 bool multi_pass_ignore_finish(const context& ctx);
84 bool multi_pass_terminate(const context& ctx);
85};
86
87 } // namespace render
88} // namespace cgv
89
90#include <cgv/config/lib_end.h>
nodes should inherit from this policy class to allow selective tree traversals
Definition traverser.h:24
base class for all drawables, which is independent of the used rendering API.
Definition context.h:621
base class for all drawables, which is independent of the used rendering API.
Definition drawable.h:15
helper class to control multiple render passes in init_frame and after_finish methods of drawable.
Definition drawable.h:66
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:77
@ RP_USER_DEFINED
user defined renderpass
Definition context.h:86
@ RPF_HANDLE_SCREEN_SHOT
whether to perform a screen shot if this was scheduled
Definition context.h:121
the cgv namespace
Definition print.h:11