src/scene.c

changeset 44
b3da4096c607
parent 43
5a8c31904e44
child 45
18de2af03531
equal deleted inserted replaced
43:5a8c31904e44 44:b3da4096c607
157 glClear(GL_COLOR_BUFFER_BIT); 157 glClear(GL_COLOR_BUFFER_BIT);
158 158
159 // ----------------------------------------- 159 // -----------------------------------------
160 // process the render groups for each camera 160 // process the render groups for each camera
161 // ----------------------------------------- 161 // -----------------------------------------
162 AscShaderProgram *shader;
162 cx_for_n(cam_id, ASC_SCENE_CAMERAS_MAX) { 163 cx_for_n(cam_id, ASC_SCENE_CAMERAS_MAX) {
163 // update camera parameters, first 164 // update camera parameters, first
164 AscCamera *camera = &scene->cameras[cam_id]; 165 AscCamera *camera = &scene->cameras[cam_id];
165 if (camera->update == NULL) continue; 166 if (camera->update == NULL) continue;
166 camera->update(camera); 167 camera->update(camera);
171 glClear(GL_DEPTH_BUFFER_BIT); 172 glClear(GL_DEPTH_BUFFER_BIT);
172 173
173 // Sprites 174 // Sprites
174 // ------- 175 // -------
175 // TODO: see if we can really always ignore the view matrix 176 // TODO: see if we can really always ignore the view matrix
176 glUseProgram(ASC_SHADER_SPRITE.base.id); 177 shader = &asc_context.active_window->glctx.shader.sprite;
177 glUniformMatrix4fv(ASC_SHADER_SPRITE.base.projection, 1, 178 glUseProgram(shader->id);
179 glUniformMatrix4fv(shader->projection, 1,
178 GL_FALSE, camera->projection); 180 GL_FALSE, camera->projection);
179 181
180 // render opaque sprites from front to back 182 // render opaque sprites from front to back
181 glDisable(GL_BLEND); 183 glDisable(GL_BLEND);
182 asc_scene_draw_render_group_reversed(scene->rg_sprites_opaque); 184 asc_scene_draw_render_group_reversed(scene->rg_sprites_opaque);

mercurial