add midnightmeadow

This commit is contained in:
Zack Buhman 2026-03-19 23:12:20 -05:00
parent 16c0123627
commit 6017c96411
29 changed files with 836944 additions and 222781 deletions

View File

@ -20,6 +20,7 @@ LDFLAGS += $(shell pkg-config --libs glfw3)
MINECRAFT_OBJS = \
minecraft/love2dworld/inthash.o \
minecraft/grandlecturn/inthash.o \
minecraft/midnightmeadow/inthash.o \
src/minecraft.o \
src/world/world.o \
src/world/entry_table.o

View File

@ -8,6 +8,7 @@ extern "C" {
uint32_t love2dworld_hash(const int32_t key);
uint32_t grandlecturn_hash(const int32_t key);
uint32_t midnightmeadow_hash(const int32_t key);
#ifdef __cplusplus
}

View File

@ -22,6 +22,7 @@ namespace world {
enum {
LOVE2DWORLD = 0,
GRANDLECTURN = 1,
MIDNIGHTMEADOW = 2,
};
};

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,4 @@
/home/bilbo/MidnightMeadow/region/r.0.0.mcr
/home/bilbo/MidnightMeadow/region/r.-1.-1.mcr
/home/bilbo/MidnightMeadow/region/r.0.-1.mcr
/home/bilbo/MidnightMeadow/region/r.-1.0.mcr

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -25,6 +25,8 @@ void main()
vec4 color = texture(ColorSampler, PixelTexture.xy);
vec3 out_color = color.xyz * 0.1;
if (false) {
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);
@ -37,9 +39,11 @@ void main()
float attenuation = 1.0 / (1.0 + Quadratic * light_distance * light_distance);
out_color += color.xyz * attenuation * diffuse;
}
//vec3 light_direction = normalize(Eye.xyz - position.xyz);
//float diffuse = max(dot(normal.xyz, light_direction), 0.0);
} else {
vec3 light_direction = normalize(Eye.xyz - position.xyz);
float diffuse = max(dot(normal.xyz, light_direction), 0.0);
out_color += color.xyz * diffuse;
}
if (normal == vec4(0, 0, 0, 0))
out_color = color.xyz;

View File

@ -44,7 +44,7 @@ namespace minecraft {
static unsigned int texture;
static const int world_count = 2;
static const int world_count = 3;
static world::state world_state[world_count];
world::state * current_world;
@ -269,7 +269,7 @@ namespace minecraft {
continue;
per_world::load_world(&world::descriptors[i], world_state[i]);
}
current_world = &world_state[world::world_id::GRANDLECTURN];
current_world = &world_state[world::world_id::MIDNIGHTMEADOW];
}
static inline int popcount(int x)

View File

@ -104,7 +104,12 @@ namespace view {
state.direction = get_direction(); // on forward/normal/pitch change
// position
state.eye = XMVectorSet(4.71f, 65.30, 57.92, 1);
// grandlecturn
//state.eye = XMVectorSet(4.71f, 65.30, 57.92, 1);
// midnightmeadow
state.eye = XMVectorSet(13.71f, -3.36, 90.92, 1);
state.at = state.eye + state.direction * at_distance;
//state.at = XMVectorSet(0, 0, 0, 1);
//state.eye = XMVectorSet(0, -100, 0, 1);

View File

@ -16,6 +16,13 @@ namespace world {
{ "minecraft/grandlecturn/region.-1.-1.instance.vtx", "minecraft/grandlecturn/region.-1.-1.instance.cfg" },
};
static vtx_cfg const midnightmeadow_vertex_paths[] = {
{ "minecraft/midnightmeadow/region.0.0.instance.vtx", "minecraft/midnightmeadow/region.0.0.instance.cfg" },
{ "minecraft/midnightmeadow/region.-1.0.instance.vtx", "minecraft/midnightmeadow/region.-1.0.instance.cfg" },
{ "minecraft/midnightmeadow/region.0.-1.instance.vtx", "minecraft/midnightmeadow/region.0.-1.instance.cfg" },
{ "minecraft/midnightmeadow/region.-1.-1.instance.vtx", "minecraft/midnightmeadow/region.-1.-1.instance.cfg" },
};
descriptor const descriptors[] = {
[world_id::LOVE2DWORLD] = {
.region_count = 4,
@ -31,6 +38,13 @@ namespace world {
.lights_path = "minecraft/grandlecturn/global.lights.vtx",
.hash_func = grandlecturn_hash,
},
[world_id::MIDNIGHTMEADOW] = {
.region_count = 4,
.vertex_paths = midnightmeadow_vertex_paths,
.entry_table_path = "minecraft/midnightmeadow/global.dump",
.lights_path = "minecraft/midnightmeadow/global.lights.vtx",
.hash_func = midnightmeadow_hash,
},
};
int const descriptors_length = (sizeof (descriptors)) / (sizeof (descriptors[0]));
}