add midnightmeadow
This commit is contained in:
parent
16c0123627
commit
6017c96411
1
Makefile
1
Makefile
@ -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
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -22,6 +22,7 @@ namespace world {
|
||||
enum {
|
||||
LOVE2DWORLD = 0,
|
||||
GRANDLECTURN = 1,
|
||||
MIDNIGHTMEADOW = 2,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
24
minecraft/gen/midnightmeadow.sh
Normal file
24
minecraft/gen/midnightmeadow.sh
Normal 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
|
||||
1032878
minecraft/love2dworld/map.txt
1032878
minecraft/love2dworld/map.txt
File diff suppressed because it is too large
Load Diff
4
minecraft/midnightmeadow/all_regions.txt
Normal file
4
minecraft/midnightmeadow/all_regions.txt
Normal 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
|
||||
BIN
minecraft/midnightmeadow/global.dump
Normal file
BIN
minecraft/midnightmeadow/global.dump
Normal file
Binary file not shown.
0
minecraft/midnightmeadow/global.lights.vtx
Normal file
0
minecraft/midnightmeadow/global.lights.vtx
Normal file
26761
minecraft/midnightmeadow/inthash.c
Normal file
26761
minecraft/midnightmeadow/inthash.c
Normal file
File diff suppressed because it is too large
Load Diff
BIN
minecraft/midnightmeadow/region.-1.-1.dump
Normal file
BIN
minecraft/midnightmeadow/region.-1.-1.dump
Normal file
Binary file not shown.
BIN
minecraft/midnightmeadow/region.-1.-1.instance.cfg
Normal file
BIN
minecraft/midnightmeadow/region.-1.-1.instance.cfg
Normal file
Binary file not shown.
BIN
minecraft/midnightmeadow/region.-1.-1.instance.vtx
Normal file
BIN
minecraft/midnightmeadow/region.-1.-1.instance.vtx
Normal file
Binary file not shown.
0
minecraft/midnightmeadow/region.-1.-1.lights.vtx
Normal file
0
minecraft/midnightmeadow/region.-1.-1.lights.vtx
Normal file
BIN
minecraft/midnightmeadow/region.-1.0.dump
Normal file
BIN
minecraft/midnightmeadow/region.-1.0.dump
Normal file
Binary file not shown.
BIN
minecraft/midnightmeadow/region.-1.0.instance.cfg
Normal file
BIN
minecraft/midnightmeadow/region.-1.0.instance.cfg
Normal file
Binary file not shown.
BIN
minecraft/midnightmeadow/region.-1.0.instance.vtx
Normal file
BIN
minecraft/midnightmeadow/region.-1.0.instance.vtx
Normal file
Binary file not shown.
0
minecraft/midnightmeadow/region.-1.0.lights.vtx
Normal file
0
minecraft/midnightmeadow/region.-1.0.lights.vtx
Normal file
BIN
minecraft/midnightmeadow/region.0.-1.dump
Normal file
BIN
minecraft/midnightmeadow/region.0.-1.dump
Normal file
Binary file not shown.
BIN
minecraft/midnightmeadow/region.0.-1.instance.cfg
Normal file
BIN
minecraft/midnightmeadow/region.0.-1.instance.cfg
Normal file
Binary file not shown.
BIN
minecraft/midnightmeadow/region.0.-1.instance.vtx
Normal file
BIN
minecraft/midnightmeadow/region.0.-1.instance.vtx
Normal file
Binary file not shown.
0
minecraft/midnightmeadow/region.0.-1.lights.vtx
Normal file
0
minecraft/midnightmeadow/region.0.-1.lights.vtx
Normal file
BIN
minecraft/midnightmeadow/region.0.0.dump
Normal file
BIN
minecraft/midnightmeadow/region.0.0.dump
Normal file
Binary file not shown.
BIN
minecraft/midnightmeadow/region.0.0.instance.cfg
Normal file
BIN
minecraft/midnightmeadow/region.0.0.instance.cfg
Normal file
Binary file not shown.
BIN
minecraft/midnightmeadow/region.0.0.instance.vtx
Normal file
BIN
minecraft/midnightmeadow/region.0.0.instance.vtx
Normal file
Binary file not shown.
0
minecraft/midnightmeadow/region.0.0.lights.vtx
Normal file
0
minecraft/midnightmeadow/region.0.0.lights.vtx
Normal file
@ -25,22 +25,26 @@ void main()
|
||||
vec4 color = texture(ColorSampler, PixelTexture.xy);
|
||||
|
||||
vec3 out_color = color.xyz * 0.1;
|
||||
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);
|
||||
|
||||
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);
|
||||
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;
|
||||
}
|
||||
} else {
|
||||
vec3 light_direction = normalize(Eye.xyz - 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 += color.xyz * diffuse;
|
||||
}
|
||||
|
||||
//vec3 light_direction = normalize(Eye.xyz - position.xyz);
|
||||
//float diffuse = max(dot(normal.xyz, light_direction), 0.0);
|
||||
|
||||
if (normal == vec4(0, 0, 0, 0))
|
||||
out_color = color.xyz;
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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]));
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user