mirror of
https://github.com/nunuhara/xsystem4.git
synced 2026-09-27 17:38:08 +03:00
DrawDungeon2: Do not use skybox
This commit is contained in:
@@ -19,10 +19,11 @@
|
||||
|
||||
#include <cglm/types.h>
|
||||
|
||||
enum draw_dungeon_version;
|
||||
struct dtx;
|
||||
struct skybox;
|
||||
|
||||
struct skybox *skybox_create(struct dtx *dtx);
|
||||
struct skybox *skybox_create(enum draw_dungeon_version version, struct dtx *dtx);
|
||||
void skybox_free(struct skybox *s);
|
||||
void skybox_render(struct skybox *s, const mat4 view_transform, const mat4 proj_transform);
|
||||
|
||||
|
||||
@@ -388,7 +388,7 @@ struct dungeon_renderer *dungeon_renderer_create(enum draw_dungeon_version versi
|
||||
if (po)
|
||||
init_polyobjs(r, po);
|
||||
|
||||
r->skybox = skybox_create(dtx);
|
||||
r->skybox = skybox_create(version, dtx);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
+11
-1
@@ -20,6 +20,7 @@
|
||||
#include "system4/cg.h"
|
||||
|
||||
#include "dungeon/dtx.h"
|
||||
#include "dungeon/dungeon.h"
|
||||
#include "dungeon/skybox.h"
|
||||
#include "gfx/gfx.h"
|
||||
|
||||
@@ -33,8 +34,13 @@ struct skybox {
|
||||
int nr_indices;
|
||||
};
|
||||
|
||||
struct skybox *skybox_create(struct dtx *dtx)
|
||||
struct skybox *skybox_create(enum draw_dungeon_version version, struct dtx *dtx)
|
||||
{
|
||||
if (version == DRAW_DUNGEON_2) {
|
||||
// Skybox is not used in Dungeons & Dolls.
|
||||
return NULL;
|
||||
};
|
||||
|
||||
struct skybox *s = xcalloc(1, sizeof(struct skybox));
|
||||
gfx_load_shader(&s->shader, "shaders/dungeon_skybox.v.glsl", "shaders/dungeon_skybox.f.glsl");
|
||||
s->proj_transform = glGetUniformLocation(s->shader.program, "proj_transform");
|
||||
@@ -103,6 +109,8 @@ struct skybox *skybox_create(struct dtx *dtx)
|
||||
|
||||
void skybox_free(struct skybox *s)
|
||||
{
|
||||
if (!s)
|
||||
return;
|
||||
glDeleteVertexArrays(1, &s->vao);
|
||||
glDeleteBuffers(1, &s->attr_buffer);
|
||||
glDeleteBuffers(1, &s->index_buffer);
|
||||
@@ -113,6 +121,8 @@ void skybox_free(struct skybox *s)
|
||||
|
||||
void skybox_render(struct skybox *s, const mat4 view_transform, const mat4 proj_transform)
|
||||
{
|
||||
if (!s)
|
||||
return;
|
||||
glDepthFunc(GL_LEQUAL);
|
||||
glUseProgram(s->shader.program);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user