amino
Lightweight Robot Utility Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
scene_win.h
Go to the documentation of this file.
1 /* -*- mode: C; c-basic-offset: 4; -*- */
2 /* ex: set shiftwidth=4 tabstop=4 expandtab: */
3 /*
4  * Copyright (c) 2015, Rice University
5  * All rights reserved.
6  *
7  * Author(s): Neil T. Dantam <ntd@rice.edu>
8  *
9  * Redistribution and use in source and binary forms, with or
10  * without modification, are permitted provided that the following
11  * conditions are met:
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/or other materials provided
17  * with the distribution.
18  * * Neither the name of copyright holder the names of its
19  * contributors may be used to endorse or promote products derived
20  * from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
23  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
24  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
27  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
30  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
31  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  *
36  */
37 
38 #ifndef AMINO_RX_SCENE_WIN_H
39 #define AMINO_RX_SCENE_WIN_H
40 
56 AA_API struct aa_rx_win *
58  const char* title,
59  int x_pos,
60  int y_pos,
61  int width,
62  int height,
63  Uint32 flags );
64 
72 AA_API struct aa_rx_win *
74  const char* title, int width, int height );
75 
76 
80 AA_API void
81 aa_rx_win_destroy( struct aa_rx_win * win);
82 
93 AA_API struct aa_gl_globals *
94 aa_rx_win_gl_globals( struct aa_rx_win * win);
95 
96 
104 AA_API void
105 aa_rx_win_set_sg( struct aa_rx_win * win,
106  const struct aa_rx_sg *sg );
107 
108 AA_API const struct aa_rx_sg *
109 aa_rx_win_get_sg( struct aa_rx_win * win );
110 
114 AA_API void
115 aa_rx_win_display_sg_config( struct aa_rx_win *win, struct aa_sdl_display_params *params,
116  const struct aa_rx_sg *scenegraph,
117  size_t n_q, const double *q );
118 
119 
120 AA_API void
121 aa_rx_win_display_sg_tf( struct aa_rx_win *win, struct aa_sdl_display_params *params,
122  const struct aa_rx_sg *scenegraph,
123  size_t n_tf, const double *tf_abs, size_t ld_tf );
124 
131 AA_API void
132 aa_rx_win_set_config( struct aa_rx_win * win,
133  size_t n,
134  const double *q );
135 
136 
150 AA_API void
151 aa_rx_win_set_display( struct aa_rx_win * win,
152  aa_sdl_win_display_fun display,
153  void *context,
154  void (*destructor)(void*) );
155 
156 
157 AA_API void
158 aa_rx_win_set_display_plan( struct aa_rx_win * win,
159  struct aa_rx_sg *sg,
160  size_t n_plan_elements,
161  const double *plan );
162 
163 struct aa_rx_mp_seq;
164 
165 AA_API void
166 aa_rx_win_set_display_seq( struct aa_rx_win * win, struct aa_rx_mp_seq *mp_seq);
167 
175 AA_API void aa_rx_win_display_loop( struct aa_rx_win * window );
176 
177 
178 
182 AA_API void
183 aa_rx_win_start( struct aa_rx_win * win );
184 
185 
186 /*
187  * Asynchronous display using new thread and default rendering
188  * function.
189  *
190  * This function renders the previously set scenegraph and and
191  * configuration vector. The configuration vector may be updated
192  * while the asynchronous thread is running.
193  *
194  * @see aa_rx_win_set_sg()
195  * @see aa_rx_win_set_config()
196  */
197 //AA_API void
198 //aa_rx_win_default_start( struct aa_rx_win * win );
199 
208 AA_API void
209 aa_rx_win_stop( struct aa_rx_win * win );
210 
214 AA_API void
215 aa_rx_win_stop_on_quit( struct aa_rx_win * win, int value );
216 
222 AA_API void
223 aa_rx_win_join( struct aa_rx_win * win );
224 
228 AA_API void
229 aa_rx_win_pause( struct aa_rx_win * win, int paused );
230 
237 AA_API void
238 aa_rx_win_lock( struct aa_rx_win * win );
239 
243 AA_API void
244 aa_rx_win_unlock( struct aa_rx_win * win );
245 
251 AA_API void
252 aa_rx_win_sg_gl_init( struct aa_rx_win * win,
253  struct aa_rx_sg *sg );
254 
255 
262 AA_API void
263 aa_rx_win_get_tf_cam( struct aa_rx_win * win, double *E );
264 
271 AA_API void
272 aa_rx_win_set_tf_cam( struct aa_rx_win * win, const double *E );
273 
274 
275 #endif /*AMINO_RX_SCENE_WIN_H*/
AA_API void aa_rx_win_pause(struct aa_rx_win *win, int paused)
Pause rendering.
AA_API void aa_rx_win_start(struct aa_rx_win *win)
Start a thread to asynchronously render the window.
AA_API struct aa_gl_globals * aa_rx_win_gl_globals(struct aa_rx_win *win)
Return a pointer to the window's GL globals struct.
AA_API void aa_rx_win_display_loop(struct aa_rx_win *window)
Synchronous display using current thread.
Opaque type for a scene_graph.
AA_API void aa_rx_win_set_sg(struct aa_rx_win *win, const struct aa_rx_sg *sg)
Set a scenegraph for the window.
AA_API void aa_rx_win_join(struct aa_rx_win *win)
Join the asynchronous display thread.
AA_API void aa_rx_win_stop(struct aa_rx_win *win)
Instruct the rendering thread to stop.
AA_API void aa_rx_win_lock(struct aa_rx_win *win)
Lock the window.
#define AA_API
calling and name mangling convention for functions
Definition: amino.h:96
AA_API void aa_rx_win_set_display(struct aa_rx_win *win, aa_sdl_win_display_fun display, void *context, void(*destructor)(void *))
Set the window's display function.
AA_API void aa_rx_win_set_config(struct aa_rx_win *win, size_t n, const double *q)
Set the configuration vector for the window.
Opaque type for a window.
Definition: rxtype.h:67
AA_API void aa_rx_win_unlock(struct aa_rx_win *win)
Unlock the window.
AA_API void aa_rx_win_set_tf_cam(struct aa_rx_win *win, const double *E)
Set the camera pose.
AA_API struct aa_rx_win * aa_rx_win_create(const char *title, int x_pos, int y_pos, int width, int height, Uint32 flags)
Create a new SDL / OpenGL window.
Parameters for SDL display function.
Definition: rxtype.h:74
AA_API void aa_rx_win_destroy(struct aa_rx_win *win)
Destroy SDL / OpenGL window.
AA_API void aa_rx_win_get_tf_cam(struct aa_rx_win *win, double *E)
Return the current camera pose.
AA_API void aa_rx_win_display_sg_config(struct aa_rx_win *win, struct aa_sdl_display_params *params, const struct aa_rx_sg *scenegraph, size_t n_q, const double *q)
Render a scenegraph at the given configuration in the window.
int(* aa_sdl_win_display_fun)(struct aa_rx_win *win, void *context, struct aa_sdl_display_params *params)
Display handler function for amino windows to call in SDL loop.
Definition: rxtype.h:101
AA_API void aa_rx_win_sg_gl_init(struct aa_rx_win *win, struct aa_rx_sg *sg)
Initialize scenegraph GL values for the given window.
AA_API struct aa_rx_win * aa_rx_win_default_create(const char *title, int width, int height)
Create a new SDL / OpenGL window with default parameters.
AA_API void aa_rx_win_stop_on_quit(struct aa_rx_win *win, int value)
Instruct the rendering thread to stop when the user closes the window.