Compare commits

..

No commits in common. "df0b7f55985d157733aa65a9c6c89bc4e8c46649" and "7042cdb21054d307f00723ebffca9e72466f87c6" have entirely different histories.

18 changed files with 330 additions and 205 deletions

1
.gitignore vendored
View File

@ -22,4 +22,3 @@ minecraft/region*.dump
minecraft/gen/map.txt minecraft/gen/map.txt
test.pack test.pack
pack_main pack_main
.gdb_history

View File

@ -5,13 +5,14 @@ OBJCOPY=$(PREFIX)objcopy
OBJARCH = elf64-x86-64 OBJARCH = elf64-x86-64
OPT = -Og -march=x86-64-v3 OPT = -O2 -march=x86-64-v3
DEBUG = -g #DEBUG = -g
CSTD = -std=gnu23 CSTD = -std=gnu23
CXXSTD = -std=gnu++23 CXXSTD = -std=gnu++23
CFLAGS += -fpic CFLAGS += -fpic
CFLAGS += -I./include
CFLAGS += -Wall -Werror -Wfatal-errors -Wno-error=unused-variable -Wno-error=unused-but-set-variable CFLAGS += -Wall -Werror -Wfatal-errors -Wno-error=unused-variable -Wno-error=unused-but-set-variable
CFLAGS += -Wno-error=unknown-pragmas -Wno-unknown-pragmas CFLAGS += -Wno-error=unknown-pragmas -Wno-unknown-pragmas
CFLAGS += -Wno-error=unused-function CFLAGS += -Wno-error=unused-function
@ -20,8 +21,6 @@ CFLAGS += -fno-strict-aliasing
ifdef READ_PACK_FILE ifdef READ_PACK_FILE
CFLAGS += -DREAD_PACK_FILE CFLAGS += -DREAD_PACK_FILE
endif endif
CFLAGS += -I./include
CFLAGS += -I../SDL3-dist/include
LDFLAGS += -lm LDFLAGS += -lm
@ -68,7 +67,7 @@ ifdef READ_PACK_FILE
OBJS += test.pack.o OBJS += test.pack.o
endif endif
all: main all: test.so
%.o: %.c %.o: %.c
$(CC) $(ARCH) $(CSTD) $(CFLAGS) $(OPT) $(DEBUG) -c $< -o $@ $(CC) $(ARCH) $(CSTD) $(CFLAGS) $(OPT) $(DEBUG) -c $< -o $@
@ -89,7 +88,7 @@ test.so: $(OBJS)
test.dll: $(OBJS) test.dll: $(OBJS)
$(CXX) $(ARCH) $(OPT) -mthreads -static -mdll -static-libstdc++ -static-libgcc $(DEBUG) $^ -o $@ -L. -lSDL3 $(WINDOWS) $(CXX) $(ARCH) $(OPT) -mthreads -static -mdll -static-libstdc++ -static-libgcc $(DEBUG) $^ -o $@ -L. -lSDL3 $(WINDOWS)
main: $(OBJS) src/main.o ../SDL3-dist/lib64/libSDL3.a main: $(OBJS) src/main.o
$(CC) $(ARCH) $(LDFLAGS) $(OPT) $(DEBUG) $^ -o $@ $(CC) $(ARCH) $(LDFLAGS) $(OPT) $(DEBUG) $^ -o $@
clean: clean:

14
include/declarations.h Normal file
View File

@ -0,0 +1,14 @@
#pragma once
#ifdef _WIN32
#ifdef _MSC_VER
#define EXPORT __declspec(dllexport)
#define DECL __cdecl
#else
#define EXPORT __attribute__((dllexport))
#define DECL __attribute__((__cdecl__))
#endif
#else
#define EXPORT
#define DECL
#endif

18
include/lua_api.h Normal file
View File

@ -0,0 +1,18 @@
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
int draw_font_start();
int draw_font(int font_ix, char const * text, int x, int y);
void draw_line_quad_start();
void draw_line(int x1, int y1, int x2, int y2);
void draw_set_color(float r, float g, float b);
void draw_quad(int x1, int y1, int x2, int y2,
int x3, int y3, int x4, int y4);
#ifdef __cplusplus
}
#endif

12
include/pixel_line_art.h Normal file
View File

@ -0,0 +1,12 @@
#pragma once
namespace pixel_line_art {
void load();
void draw_line_quad_start();
void draw_line(int x1, int y1, int x2, int y2);
void draw_set_color(float r, float g, float b);
void draw_quad(int x1, int y1, int x2, int y2,
int x3, int y3, int x4, int y4);
}

View File

@ -1,25 +1,28 @@
#pragma once #pragma once
#include "declarations.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
void load(const char * source_path); EXPORT void DECL load(const char * source_path);
void draw(); EXPORT void DECL draw();
void love2d_state_load(); EXPORT void DECL love2d_state_load();
void love2d_state_restore(); EXPORT void DECL love2d_state_restore();
void update_keyboard(int up, int down, int left, int right, EXPORT void DECL update_keyboard(int up, int down, int left, int right,
int w, int s, int a, int d, int w, int s, int a, int d,
int t, int g, int f, int h, int t, int g, int f, int h,
int i, int k, int j, int l, int i, int k, int j, int l,
int q, int e); int q, int e);
void update_mouse(int x, int y); EXPORT void DECL update_mouse(int x, int y);
void update_joystick(float lx, float ly, float rx, float ry, float tl, float tr, EXPORT void DECL update_joystick(int joystick_index,
int up, int down, int left, int right, float lx, float ly, float rx, float ry, float tl, float tr,
int a, int b, int x, int y, int up, int down, int left, int right,
int leftshoulder, int rightshoulder, int a, int b, int x, int y,
int start); int leftshoulder, int rightshoulder,
void update(float time); int start);
EXPORT void DECL update(float time);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -1,5 +1,7 @@
#pragma once #pragma once
#include "declarations.h"
namespace window { namespace window {
extern float width; extern float width;
extern float height; extern float height;
@ -8,7 +10,7 @@ namespace window {
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
void update_window(int width, int height); EXPORT void DECL update_window(int width, int height);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -1,3 +0,0 @@
cmake ../SDL3-3.4.2/ -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../SDL3-dist
cmake --build . --config Debug
cmake --install . --config Debug

View File

@ -506,6 +506,7 @@ namespace collada::scene {
glUniform1i(layout.uniform.specular_sampler, 3); glUniform1i(layout.uniform.specular_sampler, 3);
} }
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_GREATER); glDepthFunc(GL_GREATER);
glDisable(GL_CULL_FACE); glDisable(GL_CULL_FACE);
//glCullFace(GL_FRONT); //glCullFace(GL_FRONT);

View File

@ -83,6 +83,7 @@ namespace flame {
glUseProgram(program); glUseProgram(program);
glBlendFunc(GL_ONE, GL_ZERO); glBlendFunc(GL_ONE, GL_ZERO);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_GREATER); glDepthFunc(GL_GREATER);
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);

View File

@ -244,6 +244,7 @@ namespace line_art {
glUseProgram(program); glUseProgram(program);
glBlendFunc(GL_ONE, GL_ZERO); glBlendFunc(GL_ONE, GL_ZERO);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_ALWAYS); glDepthFunc(GL_ALWAYS);
glBindVertexArray(vertex_array_object); glBindVertexArray(vertex_array_object);

45
src/lua_api.cpp Normal file
View File

@ -0,0 +1,45 @@
#include "font/bitmap.h"
#include "pixel_line_art.h"
#include "lua_api.h"
extern font::bitmap::font * terminus_fonts;
extern unsigned int empty_vertex_array_object;
extern unsigned int quad_index_buffer;
int draw_font_start()
{
int font_ix = font::bitmap::best_font(font::bitmap::terminus, font::bitmap::terminus_length);
font::bitmap::font const& ter_best = terminus_fonts[font_ix];
font::bitmap::draw_start(ter_best, empty_vertex_array_object, quad_index_buffer);
return font_ix;
}
int draw_font(int font_ix, char const * text, int x, int y)
{
font::bitmap::font const& ter_best = terminus_fonts[font_ix];
font::bitmap::draw_string(ter_best, text, x, y);
return ter_best.desc->glyph_height;
}
void draw_line_quad_start()
{
pixel_line_art::draw_line_quad_start();
}
void draw_line(int x1, int y1, int x2, int y2)
{
pixel_line_art::draw_line(x1, y1, x2, y2);
}
void draw_set_color(float r, float g, float b)
{
pixel_line_art::draw_set_color(r, g, b);
}
void draw_quad(int x1, int y1, int x2, int y2,
int x3, int y3, int x4, int y4)
{
pixel_line_art::draw_quad(x1, y1, x2, y2,
x3, y3, x4, y4);
}

53
src/main.c Normal file
View File

@ -0,0 +1,53 @@
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <stdbool.h>
#include "glad/gl.h"
#include <GLFW/glfw3.h>
extern void load();
extern void draw();
int main()
{
glfwInitHint(GLFW_PLATFORM, GLFW_PLATFORM_X11);
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
//glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GLFW_TRUE);
GLFWwindow* window = glfwCreateWindow(1024, 1024, "LearnOpenGL", NULL, NULL);
if (window == NULL) {
const char* description;
glfwGetError(&description);
printf("Failed to create GLFW window: %s\n", description);
glfwTerminate();
return -1;
}
glfwMakeContextCurrent(window);
gladLoadGL(glfwGetProcAddress);
glViewport(0, 0, 1024, 1024);
load();
while(!glfwWindowShouldClose(window)) {
if(glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
glfwSetWindowShouldClose(window, true);
draw();
glfwSwapBuffers(window);
glfwPollEvents();
}
glfwTerminate();
return 0;
}

View File

@ -1,165 +0,0 @@
#include <stdio.h>
#include <string.h>
#include <SDL3/SDL.h>
#include "glad/gl.h"
#include "test.h"
#include "window.h"
#include "view.h"
static int const max_gamepads = 16;
static SDL_Gamepad * gamepads[max_gamepads];
static int gamepad_count = 0;
void add_gamepad(SDL_JoystickID instance_id)
{
SDL_Gamepad * gamepad = SDL_OpenGamepad(instance_id);
char const * name = SDL_GetGamepadName(gamepad);
if (gamepad_count >= max_gamepads) {
printf("too many gamepads; ignoring gamepad %d %s\n", instance_id, name);
SDL_CloseGamepad(gamepad);
} else {
printf("add gamepad %d %s\n", instance_id, name);
gamepads[gamepad_count] = gamepad;
gamepad_count += 1;
}
}
void remove_gamepad(SDL_JoystickID instance_id)
{
for (int i = 0; i < gamepad_count; i++) {
if (SDL_GetGamepadID(gamepads[i]) == instance_id) {
int tail = (gamepad_count - i) - 1;
memcpy(&gamepads[i], &gamepads[i+1], tail * (sizeof (gamepads[0])));
return;
}
}
assert(!"remove_gamepad");
}
void update()
{
for (int i = 0; i < gamepad_count; i++) {
SDL_Gamepad * gamepad = gamepads[i];
int16_t leftx = SDL_GetGamepadAxis(gamepad, SDL_GAMEPAD_AXIS_LEFTX);
int16_t lefty = SDL_GetGamepadAxis(gamepad, SDL_GAMEPAD_AXIS_LEFTY);
int16_t rightx = SDL_GetGamepadAxis(gamepad, SDL_GAMEPAD_AXIS_RIGHTX);
int16_t righty = SDL_GetGamepadAxis(gamepad, SDL_GAMEPAD_AXIS_RIGHTY);
int16_t left_trigger = SDL_GetGamepadAxis(gamepad, SDL_GAMEPAD_AXIS_LEFT_TRIGGER);
int16_t right_trigger = SDL_GetGamepadAxis(gamepad, SDL_GAMEPAD_AXIS_RIGHT_TRIGGER);
bool dpad_up = SDL_GetGamepadButton(gamepad, SDL_GAMEPAD_BUTTON_DPAD_UP);
bool dpad_down = SDL_GetGamepadButton(gamepad, SDL_GAMEPAD_BUTTON_DPAD_DOWN);
bool dpad_left = SDL_GetGamepadButton(gamepad, SDL_GAMEPAD_BUTTON_DPAD_LEFT);
bool dpad_right = SDL_GetGamepadButton(gamepad, SDL_GAMEPAD_BUTTON_DPAD_RIGHT);
bool a = SDL_GetGamepadButton(gamepad, SDL_GAMEPAD_BUTTON_SOUTH);
bool b = SDL_GetGamepadButton(gamepad, SDL_GAMEPAD_BUTTON_EAST);
bool x = SDL_GetGamepadButton(gamepad, SDL_GAMEPAD_BUTTON_WEST);
bool y = SDL_GetGamepadButton(gamepad, SDL_GAMEPAD_BUTTON_NORTH);
bool left_shoulder = SDL_GetGamepadButton(gamepad, SDL_GAMEPAD_BUTTON_LEFT_SHOULDER);
bool right_shoulder = SDL_GetGamepadButton(gamepad, SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER);
bool start = SDL_GetGamepadButton(gamepad, SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER);
float scale = 1.0f / 32767.0f;
update_joystick((float)leftx * scale,
(float)lefty * scale,
(float)rightx * scale,
(float)righty * scale,
(float)left_trigger * scale,
(float)right_trigger * scale,
dpad_up, dpad_down, dpad_left, dpad_right,
a, b, x, y,
left_shoulder, right_shoulder,
start);
}
view::update_transforms();
}
int main()
{
SDL_SetAppMetadata("Bibliotheca", "1.0", "st.idk.bibliotheca");
bool ret;
SDL_InitFlags sdl_flags
= SDL_INIT_EVENTS
| SDL_INIT_VIDEO
| SDL_INIT_JOYSTICK
| SDL_INIT_GAMEPAD
| SDL_INIT_AUDIO
;
ret = SDL_Init(sdl_flags);
if (!ret) {
fprintf(stderr, "SDL_Init(SDL_INIT_VIDEO): %s\n", SDL_GetError());
return 1;
}
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
SDL_WindowFlags window_flags
= SDL_WINDOW_RESIZABLE
| SDL_WINDOW_OPENGL
;
SDL_Window * window = SDL_CreateWindow("Bibliotheca", 1024, 1024, window_flags);
if (window == NULL) {
fprintf(stderr, "SDL_CreateWindow: %s\n", SDL_GetError());
return 1;
}
SDL_GLContext context = SDL_GL_CreateContext(window);
if (context == NULL) {
fprintf(stderr, "SDL_GL_CreateContext: %s\n", SDL_GetError());
return 1;
}
int version = gladLoadGL((GLADloadfunc)SDL_GL_GetProcAddress);
if (version == 0) {
fprintf(stderr, "gladLoadGL\n");
}
load(".");
update_window(1024, 1024);
while (true) {
SDL_Event event;
while (SDL_PollEvent(&event)) {
switch (event.type) {
case SDL_EVENT_QUIT:
goto exit;
case SDL_EVENT_KEY_DOWN:
if (event.key.key == SDLK_ESCAPE)
goto exit;
break;
case SDL_EVENT_WINDOW_RESIZED:
printf("%d %d\n", event.window.data1, event.window.data2);
break;
case SDL_EVENT_GAMEPAD_ADDED:
add_gamepad(event.gdevice.which);
break;
case SDL_EVENT_GAMEPAD_REMOVED:
remove_gamepad(event.gdevice.which);
break;
}
}
update();
draw();
SDL_GL_SwapWindow(window);
}
exit:
SDL_GL_DestroyContext(context);
SDL_DestroyWindow(window);
SDL_Quit();
return 0;
}

View File

@ -284,6 +284,7 @@ namespace minecraft {
glUseProgram(program); glUseProgram(program);
glBlendFunc(GL_ONE, GL_ZERO); glBlendFunc(GL_ONE, GL_ZERO);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_GREATER); glDepthFunc(GL_GREATER);
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);

View File

@ -109,6 +109,7 @@ namespace non_block {
glUseProgram(program); glUseProgram(program);
glBlendFunc(GL_ONE, GL_ZERO); glBlendFunc(GL_ONE, GL_ZERO);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_GREATER); glDepthFunc(GL_GREATER);
XMVECTOR offset = view::state.at; XMVECTOR offset = view::state.at;

138
src/pixel_line_art.cpp Normal file
View File

@ -0,0 +1,138 @@
#include "glad/gl.h"
#include "directxmath/directxmath.h"
#include <stdio.h>
#include "opengl.h"
#include "window.h"
#include "pixel_line_art.h"
extern unsigned int quad_index_buffer;
namespace pixel_line_art {
struct layout {
struct {
unsigned int position;
} attribute;
struct {
unsigned int transform;
unsigned int base_color;
} uniform;
};
const layout layout = {
.attribute = {
.position = 0,
},
.uniform = {
.transform = 0,
.base_color = 1,
},
};
static unsigned int program;
static unsigned int vertex_array_object;
static unsigned int per_vertex_buffer;
static int const per_vertex_size = (sizeof (float)) * 2;
static void load_program()
{
program = compile_from_files("shader/pixel_line_art.vert",
nullptr,
"shader/pixel_line_art.frag");
}
static void load_vertex_attributes()
{
glGenVertexArrays(1, &vertex_array_object);
glBindVertexArray(vertex_array_object);
glVertexBindingDivisor(0, 0);
glEnableVertexAttribArray(layout.attribute.position);
glVertexAttribFormat(layout.attribute.position, 2, GL_FLOAT, GL_FALSE, 0);
glVertexAttribBinding(layout.attribute.position, 0);
glBindVertexArray(0);
}
static void load_per_vertex_buffer(int x1, int y1, int x2, int y2)
{
float vertex_data[] = {
(float)x1, (float)y1, (float)x2, (float)y2,
};
int vertex_data_size = (sizeof (vertex_data));
glBindBuffer(GL_ARRAY_BUFFER, per_vertex_buffer);
glBufferData(GL_ARRAY_BUFFER, vertex_data_size, vertex_data, GL_DYNAMIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
static void load_per_vertex_buffer2(int x1, int y1, int x2, int y2,
int x3, int y3, int x4, int y4)
{
float vertex_data[] = {
(float)x1, (float)y1, (float)x2, (float)y2,
(float)x3, (float)y3, (float)x4, (float)y4,
};
int vertex_data_size = (sizeof (vertex_data));
glBindBuffer(GL_ARRAY_BUFFER, per_vertex_buffer);
glBufferData(GL_ARRAY_BUFFER, vertex_data_size, vertex_data, GL_DYNAMIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
void load()
{
load_program();
load_vertex_attributes();
glGenBuffers(1, &per_vertex_buffer);
}
static void set_transform(XMMATRIX const & transform)
{
XMFLOAT4X4 float_transform;
XMStoreFloat4x4(&float_transform, transform);
glUniformMatrix4fv(layout.uniform.transform, 1, false, (float *)&float_transform);
}
void draw_line_quad_start()
{
glUseProgram(program);
glBlendFunc(GL_ONE, GL_ZERO);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_ALWAYS);
glBindVertexArray(vertex_array_object);
glBindVertexBuffer(0, per_vertex_buffer, 0, per_vertex_size);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, quad_index_buffer);
XMMATRIX transform
= XMMatrixScaling(2.0f / window::width, -2.0f / window::height, 0)
* XMMatrixTranslation(-1, 1, 0);
set_transform(transform);
}
void draw_line(int x1, int y1, int x2, int y2)
{
load_per_vertex_buffer(x1, y1, x2, y2);
glDrawArrays(GL_LINES, 0, 2);
}
void draw_quad(int x1, int y1, int x2, int y2,
int x3, int y3, int x4, int y4)
{
load_per_vertex_buffer2(x1, y1, x2, y2,
x3, y3, x4, y4);
glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_BYTE, (void *)0);
}
void draw_set_color(float r, float g, float b)
{
glUniform3f(layout.uniform.base_color, r, g, b);
}
}

View File

@ -2,8 +2,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <SDL3/SDL.h>
#include "geometry_buffer.h" #include "geometry_buffer.h"
#include "glad/gl.h" #include "glad/gl.h"
#include "opengl.h" #include "opengl.h"
@ -27,9 +25,11 @@
#include "collada/scene.h" #include "collada/scene.h"
#include "collada/types.h" #include "collada/types.h"
#include "collada/instance_types.h" #include "collada/instance_types.h"
#include "pixel_line_art.h"
#include "flame.h" #include "flame.h"
#include "new.h" #include "new.h"
#include "popcount.h" #include "popcount.h"
#include "declarations.h"
#include "world/entry_table.h" #include "world/entry_table.h"
#include "world/world.h" #include "world/world.h"
@ -116,12 +116,17 @@ void load_quad_program()
quad_program = program; quad_program = program;
} }
extern "C" void * DECL SDL_GL_GetProcAddress(const char *proc);
void load(const char * source_path) void load(const char * source_path)
{ {
file::source_path_length = strlen(source_path); file::source_path_length = strlen(source_path);
assert(source_path[file::source_path_length - 1] != '/'); assert(source_path[file::source_path_length - 1] != '/');
file::source_path = source_path; file::source_path = source_path;
fprintf(stderr, "getproc %p\n", SDL_GL_GetProcAddress);
gladLoadGL((GLADloadfunc)SDL_GL_GetProcAddress);
// //
glBindVertexArray(0); glBindVertexArray(0);
@ -152,6 +157,12 @@ void load(const char * source_path)
uncial_antiqua_fonts = New<font::outline::font>(font::outline::uncial_antiqua_length); uncial_antiqua_fonts = New<font::outline::font>(font::outline::uncial_antiqua_length);
font::outline::load_fonts(uncial_antiqua_fonts, font::outline::uncial_antiqua, font::outline::uncial_antiqua_length); font::outline::load_fonts(uncial_antiqua_fonts, font::outline::uncial_antiqua, font::outline::uncial_antiqua_length);
//////////////////////////////////////////////////////////////////////
// pixel_line_art
//////////////////////////////////////////////////////////////////////
pixel_line_art::load();
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// quad // quad
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
@ -202,13 +213,6 @@ void load(const char * source_path)
flame::load_program(); flame::load_program();
flame::load_texture(); flame::load_texture();
//////////////////////////////////////////////////////////////////////
// opengl state
//////////////////////////////////////////////////////////////////////
glEnable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
} }
void check_collisions(collision::Sphere const & sphere, XMVECTOR const & direction, void check_collisions(collision::Sphere const & sphere, XMVECTOR const & direction,
@ -355,9 +359,8 @@ void update_keyboard(int up, int down, int left, int right,
static int last_a = 0; static int last_a = 0;
void update_joystick(float lx, float ly, void update_joystick(int joystick_index,
float rx, float ry, float lx, float ly, float rx, float ry, float tl, float tr,
float tl, float tr,
int up, int down, int left, int right, int up, int down, int left, int right,
int a, int b, int x, int y, int a, int b, int x, int y,
int leftshoulder, int rightshoulder, int leftshoulder, int rightshoulder,
@ -410,6 +413,8 @@ void update(float time)
else else
view::state.at = XMVector3Transform(XMVectorZero(), node_at->world); view::state.at = XMVector3Transform(XMVectorZero(), node_at->world);
*/ */
view::update_transforms();
} }
void draw_quad() void draw_quad()