cgv
Loading...
Searching...
No Matches
callback_drawable.h
1#pragma once
2
3#include <cgv/base/node.h>
4#include <cgv/render/drawable.h>
5#include <cgv/signal/bool_signal.h>
6
7#include "lib_begin.h"
8
9namespace cgv {
10 namespace render {
11
16 struct CGV_API callback_drawable : public cgv::base::node, public cgv::render::drawable
17 {
18 public:
20 cgv::signal::signal<unsigned, unsigned> resize_callback;
22 cgv::signal::bool_signal<cgv::render::context&> init_callback;
24 cgv::signal::signal<cgv::render::context&> clear_callback;
26 cgv::signal::signal<cgv::render::context&> init_frame_callback;
28 cgv::signal::signal<cgv::render::context&> draw_callback;
30 cgv::signal::signal<cgv::render::context&> finish_draw_callback;
32 cgv::signal::signal<cgv::render::context&> finish_frame_callback;
34 cgv::signal::signal<cgv::render::context&> after_finish_callback;
36 callback_drawable(const std::string& name);
38 void resize(unsigned w, unsigned h);
40 bool init(cgv::render::context& ctx);
42 void clear(cgv::render::context& ctx);
46 void draw(cgv::render::context& ctx);
53 };
54 }
55}
56
57#include <cgv/config/lib_end.h>
std::string name
store the name as a string
Definition named.h:25
The node class keeps a pointer to its parent.
Definition node.h:19
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
namespace for api independent GPU programming
this header is dependency free
Definition print.h:11
void init_frame(cgv::render::context &ctx)
this method is called in one pass over all drawables before the draw method
void draw(cgv::render::context &ctx)
overload to draw the content of this drawable
void finish_draw(cgv::render::context &ctx)
this method is called when the current drawable is left in a tree traversal that calls the draw metho...
void clear(cgv::render::context &ctx)
clear all objects living in the context like textures or display lists
void after_finish(cgv::render::context &ctx)
this method is called in one pass over all drawables after finish frame
void finish_frame(cgv::render::context &ctx)
this method is called in one pass over all drawables after drawing
bool init(cgv::render::context &ctx)
this method is called after creation or recreation of the context, return whether all necessary funct...