39 |
39 |
40 #include <GL/glew.h> |
40 #include <GL/glew.h> |
41 |
41 |
42 #include <assert.h> |
42 #include <assert.h> |
43 |
43 |
44 void asc_scene_init(AscScene *scene, AscCameraParams camera_params) { |
44 void asc_scene_init_(AscScene *scene, struct asc_camera_init_args args) { |
45 if (scene->root != NULL) { |
45 if (scene->root != NULL) { |
46 asc_wprintf("Scene %"PRIxPTR" is already initialized - initialization skipped.", (uintptr_t) scene); |
46 asc_wprintf("Scene %"PRIxPTR" is already initialized - initialization skipped.", (uintptr_t) scene); |
47 return; |
47 return; |
48 } |
48 } |
49 asc_camera_init(&scene->camera, camera_params); |
49 asc_camera_init_(&scene->camera, args); |
50 scene->root = asc_scene_node_empty(); |
50 scene->root = asc_scene_node_empty(); |
51 |
51 |
52 asc_dprintf("Initialized scene %"PRIxPTR, (uintptr_t) scene); |
52 asc_dprintf("Initialized scene %"PRIxPTR, (uintptr_t) scene); |
53 } |
53 } |
54 |
54 |
147 scene->camera.viewport.pos.x, |
147 scene->camera.viewport.pos.x, |
148 -scene->camera.viewport.pos.y, |
148 -scene->camera.viewport.pos.y, |
149 scene->camera.viewport.size.width, |
149 scene->camera.viewport.size.width, |
150 scene->camera.viewport.size.height |
150 scene->camera.viewport.size.height |
151 ); |
151 ); |
|
152 if (scene->camera.viewport_clear) { |
|
153 glScissor( |
|
154 scene->camera.viewport.pos.x, |
|
155 -scene->camera.viewport.pos.y, |
|
156 scene->camera.viewport.size.width, |
|
157 scene->camera.viewport.size.height |
|
158 ); |
|
159 glEnable(GL_SCISSOR_TEST); |
|
160 const asc_col4f col = scene->camera.clear_color; |
|
161 glClearColor(col.red, col.green, col.blue, col.alpha); |
|
162 glClear(GL_COLOR_BUFFER_BIT); |
|
163 glDisable(GL_SCISSOR_TEST); |
|
164 } |
152 |
165 |
153 // ------------------------- |
166 // ------------------------- |
154 // process the render groups |
167 // process the render groups |
155 // ------------------------- |
168 // ------------------------- |
156 CxIterator render_iter; |
169 CxIterator render_iter; |