gfx: scene_render cleanup

main
Dominik Madarász 2024-04-12 19:53:46 +02:00
parent fd6b9ef639
commit b01ac27fca
3 changed files with 9 additions and 78 deletions

View File

@ -375859,40 +375859,19 @@ light_t* scene_index_light(unsigned light_index) {
return &last_scene->lights[light_index]; return &last_scene->lights[light_index];
} }
void scene_render(int flags) { void scene_render(int flags) {
camera_t *cam = camera_get_active(); camera_t *cam = camera_get_active();
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glActiveTexture(GL_TEXTURE0);
if(flags & SCENE_BACKGROUND) { if(flags & SCENE_BACKGROUND) {
if(last_scene->skybox.program) { if(last_scene->skybox.program) {
skybox_push_state(&last_scene->skybox, cam->proj, cam->view); skybox_push_state(&last_scene->skybox, cam->proj, cam->view);
mesh_render(&last_scene->skybox.geometry);
glDisable(GL_DEPTH_TEST); skybox_pop_state();
// glDepthFunc(GL_LESS);
// glActiveTexture(GL_TEXTURE0);
// (flags & SCENE_CULLFACE ? glEnable : glDisable)(GL_CULL_FACE); glCullFace(GL_BACK); glFrontFace(GL_CCW);
// glPolygonMode( GL_FRONT_AND_BACK, flags & SCENE_WIREFRAME ? GL_LINE : GL_FILL );
mesh_render(&last_scene->skybox.geometry);
skybox_pop_state();
} }
ddraw_flush(); ddraw_flush();
} }
glDepthFunc(GL_LESS);
glActiveTexture(GL_TEXTURE0);
// @fixme: CW ok for one-sided rendering. CCW ok for FXs. we need both
(flags & SCENE_CULLFACE ? glEnable : glDisable)(GL_CULL_FACE); glCullFace(GL_BACK); glFrontFace(GL_CCW);
glPolygonMode( GL_FRONT_AND_BACK, flags & SCENE_WIREFRAME ? GL_LINE : GL_FILL );
// @todo alpha mode
// @todo texture mode
if( flags & SCENE_FOREGROUND ) { if( flags & SCENE_FOREGROUND ) {
bool do_relighting = 0; bool do_relighting = 0;
for (unsigned j = 0; j < array_count(last_scene->lights); ++j) { for (unsigned j = 0; j < array_count(last_scene->lights); ++j) {
@ -375950,8 +375929,6 @@ void scene_render(int flags) {
} }
glBindVertexArray(0); glBindVertexArray(0);
} }
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
} }
#line 0 #line 0

View File

@ -499,40 +499,19 @@ light_t* scene_index_light(unsigned light_index) {
return &last_scene->lights[light_index]; return &last_scene->lights[light_index];
} }
void scene_render(int flags) { void scene_render(int flags) {
camera_t *cam = camera_get_active(); camera_t *cam = camera_get_active();
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glActiveTexture(GL_TEXTURE0);
if(flags & SCENE_BACKGROUND) { if(flags & SCENE_BACKGROUND) {
if(last_scene->skybox.program) { if(last_scene->skybox.program) {
skybox_push_state(&last_scene->skybox, cam->proj, cam->view); skybox_push_state(&last_scene->skybox, cam->proj, cam->view);
mesh_render(&last_scene->skybox.geometry);
glDisable(GL_DEPTH_TEST); skybox_pop_state();
// glDepthFunc(GL_LESS);
// glActiveTexture(GL_TEXTURE0);
// (flags & SCENE_CULLFACE ? glEnable : glDisable)(GL_CULL_FACE); glCullFace(GL_BACK); glFrontFace(GL_CCW);
// glPolygonMode( GL_FRONT_AND_BACK, flags & SCENE_WIREFRAME ? GL_LINE : GL_FILL );
mesh_render(&last_scene->skybox.geometry);
skybox_pop_state();
} }
ddraw_flush(); ddraw_flush();
} }
glDepthFunc(GL_LESS);
glActiveTexture(GL_TEXTURE0);
// @fixme: CW ok for one-sided rendering. CCW ok for FXs. we need both
(flags & SCENE_CULLFACE ? glEnable : glDisable)(GL_CULL_FACE); glCullFace(GL_BACK); glFrontFace(GL_CCW);
glPolygonMode( GL_FRONT_AND_BACK, flags & SCENE_WIREFRAME ? GL_LINE : GL_FILL );
// @todo alpha mode
// @todo texture mode
if( flags & SCENE_FOREGROUND ) { if( flags & SCENE_FOREGROUND ) {
bool do_relighting = 0; bool do_relighting = 0;
for (unsigned j = 0; j < array_count(last_scene->lights); ++j) { for (unsigned j = 0; j < array_count(last_scene->lights); ++j) {
@ -590,6 +569,4 @@ void scene_render(int flags) {
} }
glBindVertexArray(0); glBindVertexArray(0);
} }
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
} }

View File

@ -22946,40 +22946,19 @@ light_t* scene_index_light(unsigned light_index) {
return &last_scene->lights[light_index]; return &last_scene->lights[light_index];
} }
void scene_render(int flags) { void scene_render(int flags) {
camera_t *cam = camera_get_active(); camera_t *cam = camera_get_active();
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glActiveTexture(GL_TEXTURE0);
if(flags & SCENE_BACKGROUND) { if(flags & SCENE_BACKGROUND) {
if(last_scene->skybox.program) { if(last_scene->skybox.program) {
skybox_push_state(&last_scene->skybox, cam->proj, cam->view); skybox_push_state(&last_scene->skybox, cam->proj, cam->view);
mesh_render(&last_scene->skybox.geometry);
glDisable(GL_DEPTH_TEST); skybox_pop_state();
// glDepthFunc(GL_LESS);
// glActiveTexture(GL_TEXTURE0);
// (flags & SCENE_CULLFACE ? glEnable : glDisable)(GL_CULL_FACE); glCullFace(GL_BACK); glFrontFace(GL_CCW);
// glPolygonMode( GL_FRONT_AND_BACK, flags & SCENE_WIREFRAME ? GL_LINE : GL_FILL );
mesh_render(&last_scene->skybox.geometry);
skybox_pop_state();
} }
ddraw_flush(); ddraw_flush();
} }
glDepthFunc(GL_LESS);
glActiveTexture(GL_TEXTURE0);
// @fixme: CW ok for one-sided rendering. CCW ok for FXs. we need both
(flags & SCENE_CULLFACE ? glEnable : glDisable)(GL_CULL_FACE); glCullFace(GL_BACK); glFrontFace(GL_CCW);
glPolygonMode( GL_FRONT_AND_BACK, flags & SCENE_WIREFRAME ? GL_LINE : GL_FILL );
// @todo alpha mode
// @todo texture mode
if( flags & SCENE_FOREGROUND ) { if( flags & SCENE_FOREGROUND ) {
bool do_relighting = 0; bool do_relighting = 0;
for (unsigned j = 0; j < array_count(last_scene->lights); ++j) { for (unsigned j = 0; j < array_count(last_scene->lights); ++j) {
@ -23037,8 +23016,6 @@ void scene_render(int flags) {
} }
glBindVertexArray(0); glBindVertexArray(0);
} }
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
} }
#line 0 #line 0