integration #7

Merged
fnicon merged 31 commits from integration into main 2026-03-22 18:07:22 +00:00
54 changed files with 234900 additions and 1311439 deletions
Showing only changes of commit 1dc045cbed - Show all commits

View File

@ -45,6 +45,8 @@ OBJS = \
src/collada/effect.o \
src/collada/node_state.o \
src/collada/animate.o \
src/lua_api.o \
src/pixel_line_art.o \
data/scenes/ship20/ship20.o \
data/scenes/noodle/noodle.o \
data/scenes/shadow_test/shadow_test.o \

View File

@ -64,5 +64,5 @@ namespace font {
void load_fonts(font * const fonts, font_desc const * const descs, int length);
int best_font(font_desc const * const descs, int length);
void draw_start(font const& font, unsigned int vertex_array_object, unsigned int index_buffer);
void draw_string(font const& font, char const * const s, int x, int y);
int draw_string(font const& font, char const * const s, int x, int y);
}

View File

@ -9,7 +9,6 @@ namespace lighting {
extern light_parameters global;
void load_program();
void load_light_uniform_buffer();
void draw();
void load();
void draw(unsigned int light_uniform_buffer, int light_count);
}

18
game/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

View File

@ -8,13 +8,15 @@ short index_buffer_configuration_offsets[] = {
768, 780, 798, 816, 840, 858, 882, 906,
936, 954, 978, 1002, 1032, 1056, 1086, 1116,
};
// generated from
struct {
short offset;
short count;
} index_buffer_custom_offsets[] = {
{1152, 12}, // tallgrass.obj
{1164, 36}, // fence.obj
{1200, 36}, // torch.obj
{1236, 24}, // wheat.obj
{1260, 1584}, // custom-mushroom.obj
{1152, 3180}, // candle.obj
{4332, 1584}, // custom_mushroom.obj
{5916, 36}, // fence.obj
{5952, 24}, // stair.obj
{5976, 12}, // tall_grass.obj
{5988, 2082}, // wall_torch.obj
};

View File

@ -8,7 +8,7 @@ extern "C" {
const char * geometry_path,
const char * fragment_path);
unsigned int load_uniform_buffer(char const * const path);
unsigned int load_uniform_buffer(char const * const path, int * out_size);
void load_dds_texture_2D(char const * const path);

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

@ -6,6 +6,8 @@ extern "C" {
void load(const char * source_path);
void draw();
void love2d_state_load();
void love2d_state_restore();
void update_keyboard(int up, int down, int left, int right,
int w, int s, int a, int d,
int t, int g, int f, int h,

View File

@ -25,8 +25,8 @@ namespace world {
};
};
// also update index_buffer_custom_offsets in data.inc
const int custom_block_types = 5;
// also update index_buffer_custom_offsets in include/minecraft_data.inc
const int custom_block_types = 6;
const int instance_cfg_length = 64 + custom_block_types;
struct instance_cfg_entry {
@ -42,8 +42,9 @@ namespace world {
struct state {
world::descriptor const * descriptor;
world::region * region; // malloc region_count
unsigned int light_uniform_buffer;
entry_table::global_entry_t * entry_table;
unsigned int light_uniform_buffer;
int light_count;
int entry_table_length;
};

View File

@ -2,12 +2,12 @@ local ffi = require 'ffi'
local joysticks
function init()
joysticks = love.joystick.getJoysticks()
for i, joystick in ipairs(joysticks) do
print(i, joystick:getName())
end
joysticks = love.joystick.getJoysticks()
for i, joystick in ipairs(joysticks) do
print(i, joystick:getName())
end
ffi.cdef[[
ffi.cdef[[
void load(const char * source_path);
void update_window(int width, int height);
void draw();
@ -23,122 +23,204 @@ void update_joystick(int joystick_index,
int leftshoulder, int rightshoulder,
int start);
void update(float time);
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);
]]
local source_path = love.filesystem.getSource()
test = ffi.load(source_path .. "/test.so")
test.load(source_path)
local source_path = love.filesystem.getSource()
test = ffi.load(source_path .. "/test.so")
test.load(source_path)
end
local update = function(time)
for joystick_index, joystick in ipairs(joysticks) do
if joystick_index > 8 then
break
end
local lx = joystick:getGamepadAxis("leftx")
local ly = joystick:getGamepadAxis("lefty")
local rx = joystick:getGamepadAxis("rightx")
local ry = joystick:getGamepadAxis("righty")
local tl = joystick:getGamepadAxis("triggerleft")
local tr = joystick:getGamepadAxis("triggerright")
local up = joystick:isGamepadDown("dpup")
local down = joystick:isGamepadDown("dpdown")
local left = joystick:isGamepadDown("dpleft")
local right = joystick:isGamepadDown("dpright")
local a = joystick:isGamepadDown("a")
local b = joystick:isGamepadDown("b")
local x = joystick:isGamepadDown("x")
local y = joystick:isGamepadDown("y")
local leftshoulder = joystick:isGamepadDown("leftshoulder")
local rightshoulder = joystick:isGamepadDown("rightshoulder")
local start = joystick:isGamepadDown("start")
--print("start", i, start)
test.update_joystick(joystick_index - 1,
lx, ly, rx, ry, tl, tr,
up, down, left, right,
a, b, x, y,
leftshoulder, rightshoulder,
start)
end
for joystick_index, joystick in ipairs(joysticks) do
if joystick_index > 8 then
break
end
local lx = joystick:getGamepadAxis("leftx")
local ly = joystick:getGamepadAxis("lefty")
local rx = joystick:getGamepadAxis("rightx")
local ry = joystick:getGamepadAxis("righty")
local tl = joystick:getGamepadAxis("triggerleft")
local tr = joystick:getGamepadAxis("triggerright")
local up = joystick:isGamepadDown("dpup")
local down = joystick:isGamepadDown("dpdown")
local left = joystick:isGamepadDown("dpleft")
local right = joystick:isGamepadDown("dpright")
local a = joystick:isGamepadDown("a")
local b = joystick:isGamepadDown("b")
local x = joystick:isGamepadDown("x")
local y = joystick:isGamepadDown("y")
local leftshoulder = joystick:isGamepadDown("leftshoulder")
local rightshoulder = joystick:isGamepadDown("rightshoulder")
local start = joystick:isGamepadDown("start")
--print("start", i, start)
test.update_joystick(joystick_index - 1,
lx, ly, rx, ry, tl, tr,
up, down, left, right,
a, b, x, y,
leftshoulder, rightshoulder,
start)
end
local up = love.keyboard.isDown("up")
local down = love.keyboard.isDown("down")
local left = love.keyboard.isDown("left")
local right = love.keyboard.isDown("right")
local w = love.keyboard.isDown("w")
local s = love.keyboard.isDown("s")
local a = love.keyboard.isDown("a")
local d = love.keyboard.isDown("d")
local t = love.keyboard.isDown("t")
local g = love.keyboard.isDown("g")
local f = love.keyboard.isDown("f")
local h = love.keyboard.isDown("h")
local i = love.keyboard.isDown("i")
local k = love.keyboard.isDown("k")
local j = love.keyboard.isDown("j")
local l = love.keyboard.isDown("l")
test.update_keyboard(up, down, left, right,
w, s, a, d,
t, g, f, h,
i, k, j, l);
local up = love.keyboard.isDown("up")
local down = love.keyboard.isDown("down")
local left = love.keyboard.isDown("left")
local right = love.keyboard.isDown("right")
local w = love.keyboard.isDown("w")
local s = love.keyboard.isDown("s")
local a = love.keyboard.isDown("a")
local d = love.keyboard.isDown("d")
local t = love.keyboard.isDown("t")
local g = love.keyboard.isDown("g")
local f = love.keyboard.isDown("f")
local h = love.keyboard.isDown("h")
local i = love.keyboard.isDown("i")
local k = love.keyboard.isDown("k")
local j = love.keyboard.isDown("j")
local l = love.keyboard.isDown("l")
test.update_keyboard(up, down, left, right,
w, s, a, d,
t, g, f, h,
i, k, j, l);
test.update(time)
test.update(time)
end
local draw = function()
test.draw()
test.draw()
end
local love_draw = function ()
love.graphics.setCanvas()
love.graphics.setShader()
love.graphics.push()
love.graphics.setColor(1,0,0,1)
love.graphics.print("A", 100, 100)
love.graphics.pop()
local nico_draw = function()
----------------------------------------------------------------------
-- font drawing
----------------------------------------------------------------------
-- call "draw_font_start()" prior each "group" of "draw_font()" calls
--
-- a "group" of draw_font() calls are back-to-back/consecutive,
-- with no non-font drawing between them.
--
-- For example:
local font_ix = test.draw_font_start()
local x = 512
local y = 50
y = y + test.draw_font(font_ix, "lua test", x, y)
y = y + test.draw_font(font_ix, "cool", x, y)
-- note that "font_ix" is the current "best font" as calculated
-- from the current window size, and might change next frame if the
-- window is resized.
--
-- Any of this of course could be changed to match your precise
-- requirements.
----------------------------------------------------------------------
-- line drawing
----------------------------------------------------------------------
-- call "draw_line_quad_start()" prior to each "group" of
-- "draw_line()" or "draw_quad()" calls
--
-- a "group" of draw_line()/draw_quad() calls are
-- back-to-back/consecutive, with no non-line/quad drawing between
-- them.
--
-- For example:
test.draw_line_quad_start()
test.draw_set_color(1.0, 0.0, 0.0) -- r, g, b (0.0 to 1.0)
test.draw_line(0, 0, 1024, 1024) -- x1, y1, x2, y2
test.draw_line(700, 300, 400, 500)
test.draw_set_color(0.0, 1.0, 0.0)
test.draw_line(700, 300, 400, 700)
-- x1, y1, x2, y2,
-- x3, y3, x4, y4,
--
-- vertices must be specified In "counter clockwise" order, as in:
--
-- 2──1
-- │ │ valid (counter clockwise)
-- 3──4
--
-- these can also be rotated, as in:
--
-- 3
-- ╱ ╲
-- 4 2 valid (counter clockwise)
-- ╲ ╱
-- 1
--
-- however "mirroring" is not valid, as in:
--
-- 1──2
-- │ │ not valid (clockwise)
-- 4──3
--
test.draw_set_color(0.0, 0.0, 1.0)
test.draw_quad(
600, 600, -- top right
500, 600, -- top left
500, 700, -- bottom left
600, 700 -- bottom right
)
test.draw_set_color(0.0, 0.5, 1.0)
test.draw_quad(
900, 900, -- bottom
950, 850, -- right
900, 800, -- top
850, 850 -- left
)
-- If you want to draw a large number of lines or quads in bulk
-- (e.g: 10,000+ lines/quads per frame), this interface might not be good
-- enough, and we should discuss this in more detail.
end
-- function love.run()
-- init()
function love.run()
init()
-- --love.timer.step()
return function()
love.event.pump()
for name, a,b,c,d,e,f,g,h in love.event.poll() do
if name == "quit" then
if c or not love.quit or not love.quit() then
return a or 0, b
end
end
end
-- return function()
-- love.event.pump()
-- for name, a,b,c,d,e,f,g,h in love.event.poll() do
-- if name == "quit" then
-- if c or not love.quit or not love.quit() then
-- return a or 0, b
-- end
-- end
-- end
local width
local height
local flags
width, height, flags = love.window.getMode()
test.update_window(width, height)
-- local width
-- local height
-- local flags
-- width, height, flags = love.window.getMode()
-- test.update_window(width, height)
local time = love.timer.getTime()
update(time)
-- --local dt = love.timer.step()
-- local time = love.timer.getTime()
-- update(time)
draw()
-- draw()
local mouse_down = love.mouse.isDown(1)
if mouse_down then
local x, y = love.mouse.getPosition()
test.update_mouse(x, y)
end
-- local mouse_down = love.mouse.isDown(1)
-- if mouse_down then
-- local x, y = love.mouse.getPosition()
-- test.update_mouse(x, y)
-- end
-- nico_draw()
-- print(love)
-- love_draw()
-- love.graphics.present()
-- love.timer.sleep(0.001)
-- --love.timer.sleep(0.1)
-- --local fps = love.timer.getFPS( )
-- --print(fps)
-- end
-- end
love.graphics.present()
love.timer.sleep(0.001)
end
end
-- function love.load(args)
-- init()
@ -166,43 +248,43 @@ end
-- end
local wm = require("world_map")
-- local wm = require("world_map")
world = {
["main_menu"] = require("love_src.src.world.main_menu")(),
["1_intro"] = require("love_src.src.world.1_intro")(),
["2_town_square"] = require("love_src.src.world.2_town_square")(),
["race"] = require("love_src.src.world.race")(),
["train"] = require("love_src.src.world.train")(),
};
-- world = {
-- ["main_menu"] = require("love_src.src.world.main_menu")(),
-- ["1_intro"] = require("love_src.src.world.1_intro")(),
-- ["2_town_square"] = require("love_src.src.world.2_town_square")(),
-- ["race"] = require("love_src.src.world.race")(),
-- ["train"] = require("love_src.src.world.train")(),
-- };
current = wm["2_town_square"]
-- current = wm["2_town_square"]
function load_world(world_to_load)
current = world_to_load
world[current]:reload()
end
-- function load_world(world_to_load)
-- current = world_to_load
-- world[current]:reload()
-- end
function love.load()
world[current]:load()
end
-- function love.load()
-- world[current]:load()
-- end
function love.update(dt)
world[current]:update(dt)
end
-- function love.update(dt)
-- world[current]:update(dt)
-- end
function love.draw()
world[current]:draw()
end
-- function love.draw()
-- world[current]:draw()
-- end
function love.keyreleased(key, scancode)
world[current]:keyreleased(key, scancode)
end
-- function love.keyreleased(key, scancode)
-- world[current]:keyreleased(key, scancode)
-- end
function love.keypressed(key, scancode, isrepeat)
world[current]:keypressed(key, scancode, isrepeat)
end
-- function love.keypressed(key, scancode, isrepeat)
-- world[current]:keypressed(key, scancode, isrepeat)
-- end
function love.mousereleased(x, y, button, istouch, presses)
world[current]:mousereleased(x, y, button, istouch, presses)
end
-- function love.mousereleased(x, y, button, istouch, presses)
-- world[current]:mousereleased(x, y, button, istouch, presses)
-- end

Binary file not shown.

View File

@ -5,16 +5,13 @@ Wooden Planks,5,,4,,,,"""linear texture index"" is invalid if unspecified"
Trunk,17,,5,,,,"""properties"" is (empty) if unspecified"
Trunk,17,1,5,,,,
Birch Block,17,2,6,,,,
Leaves,18,,12,,,,
Leaves,18,1,12,,,,
Leaves,18,2,12,,,,
Leaves,18,3,12,,,,
Leaves,18,"0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15",12,,,,
Unused,20,,11,,,,
Door Bottom,21,,18,,,,
Door Top,22,,17,,,,
Tall Grass,31,"0,1",22,tall_grass,,,
Tall Grass,31,"0,1",22,tall_grass,two_sided,,
Tan Block 1,35,1,2,,,,
White Block 2,35,5,6,,,,if you say so
White Block 2,35,5,6,,,,
Arch Bottom,35,6,10,,,,
Tan Block 2,35,8,3,,,,
White Block 1,35,9,21,,,,
@ -23,13 +20,14 @@ Unused,35,10,,,,,
Arch Top,35,14,9,,,,
Grey Bricks 1,35,15,8,,,,
White Block 3,35,,7,,,,
Lilac Grass,37,,15,tall_grass,,,
Spider Plant,38,,13,tall_grass,,,
Spider Plant,39,,13,tall_grass,,,
Lilac Grass,37,,15,tall_grass,two_sided,,
Spider Plant,38,,13,tall_grass,two_sided,,
Spider Plant,39,,13,tall_grass,two_sided,,
Red Mushroom,40,,14,custom_mushroom,,,
Start/Finish Line,45,,16,,,,
Shadow Block,49,,20,,,,
Wall Torch,50,"1,2,3,4",,wall_torch,emits_light,,
Candle,50,5,,candle,emits_light,,
Wall Torch,50,"1,2,3,4",62,wall_torch,"emits_light,torch_oriented",,
Candle,50,5,61,candle,emits_light,,
Stair,53,"0,1,2,3,4,5,6,7",4,stair,stair_oriented,,
Fence,85,0,4,fence,,,
Lamp Block,89,,19,,,,
1 name block id data linear texture index custom mesh properties notes
2 Grass 2 0,1 1 "data" is "0 (zero)" if unspecified
3 Dirt 3 1 "custom mesh" is "cube" if unspecified
4 Wooden Planks 5 4 "linear texture index" is invalid if unspecified
5 Trunk 17 5 "properties" is (empty) if unspecified
6 Trunk 17 1 5
7 Birch Block 17 2 6
8 Leaves 18 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 12
9 Unused 20 11
10 Door Bottom 21 18
11 Door Top 22 17
12 Tall Grass 31 0,1 22 tall_grass two_sided
13 Tan Block 1 35 1 2
14 White Block 2 35 5 6
15 Arch Bottom 35 6 10
16 Tan Block 2 35 8 3
17 White Block 1 35 9 21
18 Grey Bricks 35 10 8
19 Unused 35 10
20 Arch Top 35 14 9
21 Grey Bricks 1 35 15 8
22 White Block 3 35 7
23 Lilac Grass 37 15 tall_grass two_sided
24 Spider Plant 38 13 tall_grass two_sided
25 Spider Plant 39 13 tall_grass two_sided
26 Red Mushroom 40 14 custom_mushroom
27 Start/Finish Line 45 16
28 Shadow Block 49 20
29 Wall Torch 50 1,2,3,4 62 wall_torch emits_light,torch_oriented
30 Candle 50 5 61 candle emits_light
31 Stair 53 0,1,2,3,4,5,6,7 4 stair stair_oriented
32 Fence 85 0 4 fence
33 Lamp Block 89 19

View File

@ -77,5 +77,17 @@ def get_texture_id(block_id, block_data):
decl = by_id_data.get((block_id, block_data), default_decl)
return decl.linear_texture_index
def get_special(block_id, block_data):
decl = by_id_data.get((block_id, block_data), default_decl)
if "two_sided" in decl.properties:
return -1
if "torch_oriented" in decl.properties:
return 1
if "stair_oriented" in decl.properties:
return 2
return 0
if __name__ == "__main__":
print(sorted_custom_mesh)
from pprint import pprint
#print(sorted_custom_mesh)
pprint(sorted_decls)

File diff suppressed because it is too large Load Diff

View File

@ -1,20 +1,24 @@
set -eux
#cd ./minecraft/gen
PYTHON=pypy3.11
cat <<EOF > ../grandlecturn/all_regions.txt
CROP=-200,-150:300,200
ALL_REGIONS=../grandlecturn/all_regions.txt
cat <<EOF > $ALL_REGIONS
$HOME/GrandLecturn/region/r.0.0.mcr
$HOME/GrandLecturn/region/r.-1.-1.mcr
$HOME/GrandLecturn/region/r.0.-1.mcr
$HOME/GrandLecturn/region/r.-1.0.mcr
EOF
$PYTHON mc.py $HOME/GrandLecturn/region/r.0.0.mcr ../grandlecturn/region.0.0 ../grandlecturn/all_regions.txt &
$PYTHON mc.py $HOME/GrandLecturn/region/r.-1.-1.mcr ../grandlecturn/region.-1.-1 ../grandlecturn/all_regions.txt &
$PYTHON mc.py $HOME/GrandLecturn/region/r.0.-1.mcr ../grandlecturn/region.0.-1 ../grandlecturn/all_regions.txt &
$PYTHON mc.py $HOME/GrandLecturn/region/r.-1.0.mcr ../grandlecturn/region.-1.0 ../grandlecturn/all_regions.txt &
$PYTHON mc.py $HOME/GrandLecturn/region/r.0.0.mcr ../grandlecturn/region.0.0 $ALL_REGIONS $CROP &
$PYTHON mc.py $HOME/GrandLecturn/region/r.-1.-1.mcr ../grandlecturn/region.-1.-1 $ALL_REGIONS $CROP &
$PYTHON mc.py $HOME/GrandLecturn/region/r.0.-1.mcr ../grandlecturn/region.0.-1 $ALL_REGIONS $CROP &
$PYTHON mc.py $HOME/GrandLecturn/region/r.-1.0.mcr ../grandlecturn/region.-1.0 $ALL_REGIONS $CROP &
wait
cat ../grandlecturn/region*.lights.vtx > ../grandlecturn/global.lights.vtx
cat ../grandlecturn/region*.dump > ../grandlecturn/global.dump
$PYTHON intkeys.py ../grandlecturn/global.dump | $HOME/nbperf/nbperf -n grandlecturn_hash -I -a bpz -c 1.26 -m ../love2dworld/map.txt > ../grandlecturn/inthash.c
$PYTHON intkeys.py ../grandlecturn/global.dump | $HOME/nbperf/nbperf -n grandlecturn_hash -I -a bpz -c 1.24 -m ../love2dworld/map.txt > ../grandlecturn/inthash.c

View File

@ -42,7 +42,15 @@ def neighbor_exists(level_table, chunk_x, chunk_z, nx, ny, nz):
n_block_data = decode_block_data(level_table, chunk_x, chunk_z, n_block_index)
return block_ids.is_neighbor_block(n_block_id, n_block_data)
def block_neighbors(level_table, chunk_x, chunk_z, block_index):
def outside_crop(position, crop):
return (
position[0] < crop[0][0] or
position[2] < crop[0][1] or
position[0] > crop[1][0] or
position[2] > crop[1][1]
)
def block_neighbors(level_table, chunk_x, chunk_z, block_index, crop):
block_id = level_table[(chunk_x, chunk_z)].blocks[block_index]
if block_id == data.BlockID.AIR or block_id == data.BlockID.BEDROCK:
return
@ -51,6 +59,8 @@ def block_neighbors(level_table, chunk_x, chunk_z, block_index):
xyz = mcregion.xyz_from_block_index(block_index)
center_position = vec3.add(xyz, (chunk_x * 16, 0, chunk_z * 16))
if outside_crop(center_position, crop):
return # block is cropped
if not block_ids.is_cube_block(block_id, block_data):
yield center_position, block_id, block_data, None
@ -66,10 +76,10 @@ def block_neighbors(level_table, chunk_x, chunk_z, block_index):
if normal_indices:
yield center_position, block_id, block_data, normal_indices
def devoxelize_region(level_table, level_table_keys):
def devoxelize_region(level_table, level_table_keys, crop):
for chunk_x, chunk_z in level_table_keys:
for block_index in range(128 * 16 * 16):
yield from block_neighbors(level_table, chunk_x, chunk_z, block_index)
yield from block_neighbors(level_table, chunk_x, chunk_z, block_index, crop)
def build_level_table(level_table, mem, locations):
for location in locations:
@ -96,9 +106,11 @@ def build_block_configuration_table():
yield indices
def pack_instance_data(position, block_id, block_data, texture_id):
special = block_ids.get_special(block_id, block_data)
packed = struct.pack("<hhhhhhhh",
position[0], position[1], position[2], 0,
block_id, block_data, texture_id, 0)
block_id, block_data, texture_id, special)
return packed
def pack_light_data(position, block_id):
@ -116,8 +128,8 @@ def build_block_instances(blocks):
if block_ids.is_light_source(block_id, block_data):
light_sources.append((position, block_id, block_data))
if not block_ids.is_cube_block(block_id, block_data):
#custom_mesh_index = block_ids.get_custom_mesh_index(block_id, block_data)
#non_cube_blocks[custom_mesh_index].append((position, block_id, block_data))
custom_mesh_index = block_ids.get_custom_mesh_index(block_id, block_data)
non_cube_blocks[custom_mesh_index].append((position, block_id, block_data))
continue
configuration = normal_indices_as_block_configuration(normal_indices)
by_configuration[configuration].append((position, block_id, block_data))
@ -210,8 +222,9 @@ def dump_blocks(blocks):
assert(len(buf) == 8)
f.write(buf)
def main2(level_table, level_table_keys):
blocks = devoxelize_region(level_table, level_table_keys)
def main2(level_table, level_table_keys, crop):
print("crop", crop)
blocks = devoxelize_region(level_table, level_table_keys, crop)
blocks = list(blocks)
dump_blocks(blocks)
build_block_instances(blocks)
@ -222,7 +235,15 @@ def parse_all_paths(path):
buf = f.read()
return set(l.strip() for l in buf.split('\n') if l.strip())
def main(mcr_path, data_path, all_paths_path):
def parse_crop(crop):
min_xz, max_xz = crop.strip().split(":")
min_xz = tuple(int(c) for c in min_xz.split(","))
max_xz = tuple(int(c) for c in max_xz.split(","))
assert min_xz[0] < max_xz[0], crop
assert min_xz[1] < max_xz[1], crop
return min_xz, max_xz
def main(mcr_path, data_path, all_paths_path, crop):
all_paths = parse_all_paths(all_paths_path)
assert mcr_path in all_paths
level_table = {}
@ -232,10 +253,10 @@ def main(mcr_path, data_path, all_paths_path):
if path == mcr_path:
continue
level_table_from_path(level_table, path)
main2(level_table, level_table_keys)
main2(level_table, level_table_keys, parse_crop(crop))
mcr_path = sys.argv[1]
data_path = sys.argv[2]
all_paths_path = sys.argv[3]
main(mcr_path, data_path, all_paths_path)
crop = sys.argv[4]
main(mcr_path, data_path, all_paths_path, crop)

View File

@ -1,4 +1,4 @@
# Blender 4.5.7 LTS
# Blender 5.0.0
# www.blender.org
o Cube
v 1.000000 -1.000000 -1.000000

View File

@ -5,6 +5,8 @@ import obj_state
import obj_write
import sys
import block_ids
normals = [
(-1.0, 0.0, 0.0),
(0.0, -1.0, 0.0),
@ -49,11 +51,10 @@ def main():
build_configuration_index_buffers(cube_faces_by_normal, index_buffer)
# check mc.py `custom_blocks` for model order
obj_write.write_obj(vertex_buffer, index_buffer, index_lookup, "tallgrass.obj")
obj_write.write_obj(vertex_buffer, index_buffer, index_lookup, "fence.obj")
obj_write.write_obj(vertex_buffer, index_buffer, index_lookup, "torch.obj")
obj_write.write_obj(vertex_buffer, index_buffer, index_lookup, "wheat.obj")
obj_write.write_obj(vertex_buffer, index_buffer, index_lookup, "custom-mushroom.obj")
mesh_order = block_ids.sorted_custom_mesh
for mesh_name in mesh_order:
obj_write.write_obj(vertex_buffer, index_buffer, index_lookup, f"{mesh_name}.obj")
with open("../configuration.idx", "wb") as f:
obj_write.write_indices(f, "<H", index_buffer)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -7,6 +7,7 @@ uniform sampler2D ColorSampler;
uniform float Linear;
uniform float Quadratic;
uniform vec3 Eye;
uniform int LightCount;
layout (location = 0) out vec4 Color;
@ -24,20 +25,21 @@ void main()
vec4 color = texture(ColorSampler, PixelTexture.xy);
vec3 out_color = color.xyz * 0.1;
for (int i = 0; i < 82; i++) {
vec3 light_position = light[i].xzy;
for (int i = 0; i < LightCount; i++) {
vec3 light_position = light[i].xzy + vec3(0, 0, 0.5);
float light_distance = length(light_position - position.xyz);
vec3 light_direction = normalize(light_position - position.xyz);
float diffuse = max(dot(normal.xyz, light_direction), 0.0);
if (normal.w == 1.0) // two-sided
diffuse = 1.0;
//float attenuation = 1.0 / (1.0 + Linear * light_distance + Quadratic * light_distance * light_distance);
float attenuation = 1.0 / (1.0 + Quadratic * light_distance * light_distance);
//out_color += color.xyz * attenuation * diffuse;
//out_color = vec3(diffuse);
out_color += color.xyz * attenuation * diffuse;
}
vec3 light_direction = normalize(Eye.xyz - position.xyz);
float diffuse = max(dot(normal.xyz, light_direction), 0.0);
out_color = color.xyz * diffuse;
//vec3 light_direction = normalize(Eye.xyz - position.xyz);
//float diffuse = max(dot(normal.xyz, light_direction), 0.0);
Color = vec4(out_color, 1.0);
}

View File

@ -8,12 +8,13 @@ in VS_OUT {
flat int BlockID;
flat int Data;
flat int TextureID;
flat int Special;
} fs_in;
layout (location = 0) out vec3 Position;
layout (location = 1) out vec3 Normal;
layout (location = 1) out vec4 Normal;
layout (location = 2) out vec3 Color;
layout (location = 3) out vec3 Block;
layout (location = 3) out vec4 Block;
uniform sampler2D TerrainSampler;
uniform vec3 MousePosition;
@ -22,16 +23,6 @@ uniform vec3 MousePosition2;
void main()
{
int texture_id = fs_in.TextureID;
if (fs_in.BlockID == 2) // grass
texture_id = 0;
if (fs_in.BlockID == 50 && fs_in.Data == 0) // ?
texture_id = 61;
if (fs_in.BlockID == 18)
texture_id = 11;
if (fs_in.BlockID == 21)
texture_id = 17;
if (fs_in.BlockID == 22)
texture_id = 16;
int terrain_x = texture_id % 8;
int terrain_y = texture_id / 8;
@ -44,8 +35,11 @@ void main()
return;
}
Position = fs_in.BlockPosition.xzy;
Normal = normalize(fs_in.Normal.xzy);
float two_sided = float(fs_in.Special == -1); // special
//Position = fs_in.BlockPosition.xzy;
Position = fs_in.Position.xzy;
Normal = vec4(normalize(fs_in.Normal.xzy), two_sided);
Color = texture_color.xyz;
Block = vec3(fs_in.BlockID, fs_in.Data, fs_in.TextureID);
Block = vec4(fs_in.BlockID, fs_in.Data, fs_in.TextureID, fs_in.Special);
}

View File

@ -9,6 +9,7 @@ in vec3 BlockPosition;
in int BlockID;
in int Data;
in int TextureID;
in int Special;
out VS_OUT {
vec3 Position;
@ -18,13 +19,30 @@ out VS_OUT {
flat int BlockID;
flat int Data;
flat int TextureID;
flat int Special;
} vs_out;
uniform mat4 Transform;
vec3 orientation(vec3 position)
{
if (Special == 1) { // oriented torch
if (Data == 1) // "facing east"
return vec3(position.z, position.y, -position.x);
else if (Data == 2) // "facing west"
return vec3(-position.z, position.y, position.x);
else if (Data == 4) // "facing north"
return vec3(position.x, position.y, -position.z);
else // "facing south"
return position;
} else {
return position;
}
}
void main()
{
vec3 position = Position + BlockPosition; // world coordinates
vec3 position = orientation(Position) + BlockPosition; // world coordinates
vs_out.Position = position;
vs_out.BlockPosition = BlockPosition;
@ -33,6 +51,7 @@ void main()
vs_out.BlockID = BlockID;
vs_out.Data = Data;
vs_out.TextureID = TextureID;
vs_out.Special = Special;
gl_Position = Transform * vec4(position.xzy, 1.0);
}

View File

@ -7,12 +7,12 @@ in VS_OUT {
} fs_in;
layout (location = 0) out vec3 Position;
layout (location = 1) out vec3 Normal;
layout (location = 1) out vec4 Normal;
layout (location = 2) out vec3 Color;
void main()
{
Position = fs_in.Position;
Normal = normalize(fs_in.Normal);
Normal = vec4(normalize(fs_in.Normal), 0.0);
Color = vec3(0, 1, 1);
}

View File

@ -0,0 +1,10 @@
#version 430 core
out vec4 Color;
layout (location = 1) uniform vec3 BaseColor;
void main()
{
Color = vec4(BaseColor, 1);
}

View File

@ -0,0 +1,10 @@
#version 430 core
layout (location = 0) in vec2 Position;
layout (location = 0) uniform mat4 Transform;
void main()
{
gl_Position = Transform * vec4(Position, 0, 1);
}

View File

@ -123,8 +123,8 @@ namespace font {
inline static XMFLOAT4X4 glyph_transform(font const& font, int x, int y)
{
XMMATRIX transform =
XMMatrixScaling(font.desc->glyph_width, font.desc->glyph_height, 0)
XMMATRIX transform
= XMMatrixScaling(font.desc->glyph_width, font.desc->glyph_height, 0)
* XMMatrixTranslation(x, -y, 0)
* XMMatrixScaling(2.0f / window::width, 2.0f / window::height, 0)
* XMMatrixTranslation(-1, 1, 0);
@ -148,7 +148,7 @@ namespace font {
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, index_buffer);
}
void draw_string(font const& font, char const * const s, int x, int y)
int draw_string(font const& font, char const * const s, int x, int y)
{
int i = 0;
while (s[i] != 0) {
@ -164,5 +164,6 @@ namespace font {
x += font.desc->glyph_width;
}
return x;
}
}

View File

@ -36,7 +36,7 @@ namespace hud {
inline static float draw_vector(font::font const& ter_best, char * const buf, float y, char const * const label, XMVECTOR vec)
{
labeled_value<float>(buf, label, ": %5.2f %5.2f %5.2f", XMVectorGetX(vec), XMVectorGetY(vec), XMVectorGetZ(vec));
labeled_value<float>(buf, label, ": %5.2f %5.2f %5.2f %5.2f", XMVectorGetX(vec), XMVectorGetY(vec), XMVectorGetZ(vec), XMVectorGetW(vec));
font::draw_string(ter_best, buf, 10, y);
y += ter_best.desc->glyph_height;
return y;
@ -81,7 +81,6 @@ namespace hud {
int font_ix = font::best_font(font::terminus, font::terminus_length);
font::font const& ter_best = terminus_fonts[font_ix];
font::draw_start(ter_best, empty_vertex_array_object, quad_index_buffer);
labeled_value<float>(buf, "fov: ", "%.3f", view::state.fov);
@ -116,7 +115,7 @@ namespace hud {
font::draw_string(ter_best, "mouse:", 10, y);
y += ter_best.desc->glyph_height;
y = draw_vector(ter_best, buf, y, " position", XMLoadFloat3((XMFLOAT3*)mouse_position));
y = draw_vector(ter_best, buf, y, " block", XMLoadFloat3((XMFLOAT3*)mouse_block));
y = draw_vector(ter_best, buf, y, " position", XMLoadFloat4((XMFLOAT4*)mouse_position));
y = draw_vector(ter_best, buf, y, " block", XMLoadFloat4((XMFLOAT4*)mouse_block));
}
}

View File

@ -28,6 +28,7 @@ namespace lighting {
unsigned int quadratic;
unsigned int linear;
unsigned int eye;
unsigned int light_count;
unsigned int lights;
} uniform;
@ -38,7 +39,7 @@ namespace lighting {
static unsigned int program;
static location location;
void load_program()
static void load_program()
{
program = compile_from_files("shader/quad.vert",
NULL,
@ -50,25 +51,35 @@ namespace lighting {
location.uniform.quadratic = glGetUniformLocation(program, "Quadratic");
location.uniform.linear = glGetUniformLocation(program, "Linear");
location.uniform.eye = glGetUniformLocation(program, "Eye");
location.uniform.light_count = glGetUniformLocation(program, "LightCount");
location.uniform.lights = glGetUniformBlockIndex(program, "Lights");
fprintf(stderr, "lighting program:\n");
fprintf(stderr, " uniforms:\n position_sampler %u normal_sampler %u color_sampler %u lights %u\n",
fprintf(stderr, " uniforms:\n position_sampler %u normal_sampler %u color_sampler %u quadratic %u\n linear %u\n eye %u\n light_count %u\n lights %u\n",
location.uniform.position_sampler,
location.uniform.normal_sampler,
location.uniform.color_sampler,
location.uniform.quadratic,
location.uniform.linear,
location.uniform.eye,
location.uniform.light_count,
location.uniform.lights);
location.binding.lights = 0;
glUniformBlockBinding(program, location.uniform.lights, location.binding.lights);
}
void load()
{
load_program();
}
static inline bool near_zero(float a)
{
return (fabsf(a) < 0.00001f);
}
void draw()
void draw(unsigned int light_uniform_buffer, int light_count)
{
glUseProgram(program);
glDepthFunc(GL_ALWAYS);
@ -89,12 +100,12 @@ namespace lighting {
glUniform1f(location.uniform.quadratic, quadratic);
glUniform1f(location.uniform.linear, linear);
XMFLOAT3 eye;
XMStoreFloat3(&eye, view::state.eye);
glUniform3fv(location.uniform.eye, 1, (float*)&eye);
//glBindBufferBase(GL_UNIFORM_BUFFER, location.binding.lights, light_uniform_buffer);
glUniform1i(location.uniform.light_count, light_count);
glBindBufferBase(GL_UNIFORM_BUFFER, location.binding.lights, light_uniform_buffer);
glBindVertexArray(empty_vertex_array_object);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, quad_index_buffer);

45
game/src/lua_api.cpp Normal file
View File

@ -0,0 +1,45 @@
#include "font.h"
#include "pixel_line_art.h"
#include "lua_api.h"
extern font::font * terminus_fonts;
extern unsigned int empty_vertex_array_object;
extern unsigned int quad_index_buffer;
int draw_font_start()
{
int font_ix = font::best_font(font::terminus, font::terminus_length);
font::font const& ter_best = terminus_fonts[font_ix];
font::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::font const& ter_best = terminus_fonts[font_ix];
font::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);
}

View File

@ -23,6 +23,7 @@ namespace minecraft {
unsigned int block_id;
unsigned int data;
unsigned int texture_id;
unsigned int special;
} attrib;
struct {
unsigned int transform;
@ -61,15 +62,17 @@ namespace minecraft {
location.attrib.block_id = glGetAttribLocation(program, "BlockID");
location.attrib.data = glGetAttribLocation(program, "Data");
location.attrib.texture_id = glGetAttribLocation(program, "TextureID");
location.attrib.special = glGetAttribLocation(program, "Special");
printf("minecraft program:\n");
printf(" attributes:\n position %u\n normal %u\n texture %u\n block_position %u\n block_id %u\n data %u\n texture_id %u\n",
printf(" attributes:\n position %u\n normal %u\n texture %u\n block_position %u\n block_id %u\n data %u\n texture_id %u\n special %u\n",
location.attrib.position,
location.attrib.normal,
location.attrib.texture,
location.attrib.block_position,
location.attrib.block_id,
location.attrib.data,
location.attrib.texture_id);
location.attrib.texture_id,
location.attrib.special);
location.uniform.transform = glGetUniformLocation(program, "Transform");
location.uniform.terrain_sampler = glGetUniformLocation(program, "TerrainSampler");
@ -114,6 +117,10 @@ namespace minecraft {
glVertexAttribIFormat(location.attrib.texture_id, 1, GL_SHORT, 12);
glVertexAttribBinding(location.attrib.texture_id, 1);
glEnableVertexAttribArray(location.attrib.special);
glVertexAttribIFormat(location.attrib.special, 1, GL_SHORT, 14);
glVertexAttribBinding(location.attrib.special, 1);
glBindVertexArray(0);
}
@ -216,7 +223,9 @@ namespace minecraft {
state.region = New<world::region>(descriptor->region_count);
load_regions(descriptor, state.region);
state.light_uniform_buffer = load_uniform_buffer(descriptor->lights_path);
int light_buffer_size;
state.light_uniform_buffer = load_uniform_buffer(descriptor->lights_path, &light_buffer_size);
state.light_count = light_buffer_size / ((sizeof (float)) * 4);
// collision data
world::entry_table::load_entry_table(descriptor->entry_table_path,
@ -312,7 +321,6 @@ namespace minecraft {
//////////////////////////////////////////////////////////////////////
// custom blocks
//////////////////////////////////////////////////////////////////////
/*
for (int i = 0; i < world::custom_block_types; i++) {
int element_count = index_buffer_custom_offsets[i].count;
const void * indices = (void *)(2 * (ptrdiff_t)index_buffer_custom_offsets[i].offset);
@ -322,7 +330,6 @@ namespace minecraft {
continue;
glDrawElementsInstancedBaseInstance(GL_TRIANGLES, element_count, GL_UNSIGNED_SHORT, indices, instance_count, base_instance);
}
*/
}
}
}

View File

@ -109,7 +109,7 @@ unsigned int compile_from_files(char const * vertex_path,
return program;
}
unsigned int load_uniform_buffer(char const * const path)
unsigned int load_uniform_buffer(char const * const path, int * out_size)
{
unsigned int buffer;
glGenBuffers(1, &buffer);
@ -124,6 +124,8 @@ unsigned int load_uniform_buffer(char const * const path)
glBindBuffer(GL_UNIFORM_BUFFER, 0);
*out_size = data_size;
return buffer;
}

138
game/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

@ -24,6 +24,7 @@
#include "collada/scene.h"
#include "collada/types.h"
#include "collada/instance_types.h"
#include "pixel_line_art.h"
#include "world/entry_table.h"
#include "world/world.h"
@ -88,7 +89,6 @@ void load_quad_index_buffer()
glGenBuffers(1, &quad_index_buffer);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, quad_index_buffer);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, data_size, data, GL_STATIC_DRAW);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
}
@ -119,6 +119,12 @@ void load(const char * source_path)
fprintf(stderr, "getproc %p\n", SDL_GL_GetProcAddress);
gladLoadGL((GLADloadfunc)SDL_GL_GetProcAddress);
//
glBindVertexArray(0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
//////////////////////////////////////////////////////////////////////
// minecraft (drawing data)
//////////////////////////////////////////////////////////////////////
@ -140,6 +146,12 @@ void load(const char * source_path)
terminus_fonts = (font::font *)malloc((sizeof (font::font)) * font::terminus_length);
font::load_fonts(terminus_fonts, font::terminus, font::terminus_length);
//////////////////////////////////////////////////////////////////////
// pixel_line_art
//////////////////////////////////////////////////////////////////////
pixel_line_art::load();
//////////////////////////////////////////////////////////////////////
// quad
//////////////////////////////////////////////////////////////////////
@ -152,7 +164,7 @@ void load(const char * source_path)
// lighting
//////////////////////////////////////////////////////////////////////
lighting::load_program();
lighting::load();
//////////////////////////////////////////////////////////////////////
// non_block
@ -365,12 +377,11 @@ int clamp(int n, int high)
return n;
}
float mouse_position[3] = {};
float mouse_block[3] = {};
float mouse_position[4] = {};
float mouse_block[4] = {};
void update_mouse(int x, int y)
{
printf("update mouse %d %d\n", x, y);
x = clamp(x, geometry_buffer_pnc.width);
y = clamp(y, geometry_buffer_pnc.height);
@ -381,7 +392,7 @@ void update_mouse(int x, int y)
geometry_buffer_pnc.height - y,
1, // width
1, // height
GL_RGB,
GL_RGBA,
GL_FLOAT,
(void*)&mouse_position);
@ -390,7 +401,7 @@ void update_mouse(int x, int y)
geometry_buffer_pnc.height - y,
1, // width
1, // height
GL_RGB,
GL_RGBA,
GL_FLOAT,
(void*)&mouse_block);
}
@ -413,7 +424,9 @@ void draw()
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
lighting::draw();
lighting::draw(minecraft::current_world->light_uniform_buffer,
minecraft::current_world->light_count);
//draw_quad();
hud::draw();
} else {