Compare commits

..

No commits in common. "823092ad9582a5e377cb55431e15a485de327ccf" and "248a256559f8b7fe80c89e79b757c75f39eff951" have entirely different histories.

323 changed files with 129 additions and 1482494 deletions

12
game/.gitignore vendored
View File

@ -1,12 +0,0 @@
.~*
.\#*
\#*
*~
*.o
main
*.so
*.dylib
__pycache__
minecraft/region*.lights.vtx
minecraft/region*.dump
minecraft/gen/map.txt

View File

@ -1,80 +0,0 @@
#PREFIX = x86_64-w64-mingw32-
CC=$(PREFIX)gcc
CXX=$(PREFIX)g++
OPT = -O0 -march=x86-64-v3
CSTD = -std=gnu23
CXXSTD = -std=gnu++23
CFLAGS += -g
CFLAGS += -fpic
CFLAGS += -I./include
CFLAGS += -Wall -Werror -Wfatal-errors -Wno-error=unused-variable -Wno-error=unused-but-set-variable
CFLAGS += -Wno-error=unknown-pragmas -Wno-unknown-pragmas
CFLAGS += $(shell pkg-config --cflags glfw3)
CFLAGS += -fno-strict-aliasing
LDFLAGS += -lm
LDFLAGS += $(shell pkg-config --libs glfw3)
MINECRAFT_OBJS = \
minecraft/love2dworld/inthash.o \
minecraft/grandlecturn/inthash.o \
src/minecraft.o \
src/world/world.o \
src/world/entry_table.o
OBJS = \
src/gl.o \
src/opengl.o \
src/test.o \
src/font.o \
src/window.o \
src/bresenham.o \
src/file.o \
src/non_block.o \
src/view.o \
src/hud.o \
src/lighting.o \
src/collision_scene.o \
src/line_art.o \
src/boids.o \
src/boids_scene.o \
src/dds_validate.o \
src/collada/scene.o \
src/collada/effect.o \
src/collada/node_state.o \
src/collada/animate.o \
data/scenes/ship20/ship20.o \
data/scenes/noodle/noodle.o \
data/scenes/shadow_test/shadow_test.o \
data/scenes/book/book.o \
$(MINECRAFT_OBJS)
all: test.so
%.o: %.c
$(CC) $(ARCH) $(CSTD) $(CFLAGS) $(OPT) -c $< -o $@
%.o: %.cpp
$(CXX) $(ARCH) $(CXXSTD) $(CFLAGS) $(OPT) -c $< -o $@
test.so: $(OBJS)
$(CC) $(ARCH) $(OPT) -shared -g $^ -o $@ -lSDL3
main: $(OBJS) src/main.o
$(CC) $(ARCH) $(LDFLAGS) $(OPT) -g $^ -o $@
clean:
find . -type f ! -name "*.*" -delete
.SUFFIXES:
.INTERMEDIATE:
.SECONDARY:
.PHONY: all clean phony
%: RCS/%,v
%: RCS/%
%: %,v
%: s.%
%: SCCS/s.%

View File

Before

Width:  |  Height:  |  Size: 280 B

After

Width:  |  Height:  |  Size: 280 B

View File

Before

Width:  |  Height:  |  Size: 496 B

After

Width:  |  Height:  |  Size: 496 B

View File

Before

Width:  |  Height:  |  Size: 557 B

After

Width:  |  Height:  |  Size: 557 B

View File

Before

Width:  |  Height:  |  Size: 643 B

After

Width:  |  Height:  |  Size: 643 B

View File

Before

Width:  |  Height:  |  Size: 575 B

After

Width:  |  Height:  |  Size: 575 B

View File

Before

Width:  |  Height:  |  Size: 639 B

After

Width:  |  Height:  |  Size: 639 B

View File

Before

Width:  |  Height:  |  Size: 643 B

After

Width:  |  Height:  |  Size: 643 B

View File

Before

Width:  |  Height:  |  Size: 739 B

After

Width:  |  Height:  |  Size: 739 B

View File

Before

Width:  |  Height:  |  Size: 719 B

After

Width:  |  Height:  |  Size: 719 B

View File

Before

Width:  |  Height:  |  Size: 653 B

After

Width:  |  Height:  |  Size: 653 B

View File

Before

Width:  |  Height:  |  Size: 609 B

After

Width:  |  Height:  |  Size: 609 B

View File

Before

Width:  |  Height:  |  Size: 557 B

After

Width:  |  Height:  |  Size: 557 B

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -1,35 +0,0 @@
set -eux
PYTHONPATH=~/d3d10 python -m collada.main \
~/love-demo/scene/noodle/noodle.DAE \
data/scenes/noodle/noodle.cpp \
data/scenes/noodle/noodle.vtx \
data/scenes/noodle/noodle.vjw \
data/scenes/noodle/noodle.idx
PYTHONPATH=~/d3d10 python -m collada.main \
include/data/scenes/noodle.h
# shadow_test
PYTHONPATH=~/d3d10 python -m collada.main \
~/love-demo/scene/shadow_test/shadow_test.DAE \
data/scenes/shadow_test/shadow_test.cpp \
data/scenes/shadow_test/shadow_test.vtx \
data/scenes/shadow_test/shadow_test.vjw \
data/scenes/shadow_test/shadow_test.idx
PYTHONPATH=~/d3d10 python -m collada.main \
include/data/scenes/shadow_test.h
# book
PYTHONPATH=~/d3d10 python -m collada.main \
~/Downloads/book.DAE \
data/scenes/book/book.cpp \
data/scenes/book/book.vtx \
data/scenes/book/book.vjw \
data/scenes/book/book.idx
PYTHONPATH=~/d3d10 python -m collada.main \
include/data/scenes/book.h

View File

@ -16,17 +16,16 @@ function love.conf(t)
t.accelerometerjoystick = false
t.externalstorage = false
t.graphics.gammacorrect = false
t.graphics.excluderenderers = {"vulkan", "metal"}
t.audio.mic = false
t.audio.mixwithsystem = true
t.window.title = "test"
t.window.icon = nil
t.window.width = 1024
t.window.height = 1024
t.window.width = 960
t.window.height = 720
t.window.borderless = false
t.window.resizable = true
t.window.resizable = false
t.window.minwidth = 10
t.window.minheight = 9
t.window.fullscreen = false

View File

@ -0,0 +1,17 @@
[
{
"index" : 200,
"texture" : "asset/image/sample/javascript-racer-master/images/sprites/column.png",
"offset" : -0.1
},
{
"index" : 200,
"texture" : "asset/image/sample/javascript-racer-master/images/sprites/cactus.png",
"offset" : 4
},
{
"index" : 150,
"texture" : "asset/image/sample/javascript-racer-master/images/sprites/stump.png",
"offset" : 0
}
]

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

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.

File diff suppressed because it is too large Load Diff

View File

@ -1,429 +0,0 @@
#include "collada/types.h"
#include "data/scenes/ship20.h"
namespace ship20 {
using namespace collada::types;
light const light_environmentambientlight = {
.type = light_type::AMBIENT,
.color = { 0.0f, 0.0f, 0.0f },
};
light const light_omni002_light = {
.type = light_type::POINT,
.color = { 1.0f, 1.0f, 1.0f },
};
light const light_omni003_light = {
.type = light_type::POINT,
.color = { 1.0f, 1.0f, 1.0f },
};
// shipple2_png
image const image_shipple2_png = {
.uri = "data/scenes/ship20/shipple2.dds",
};
image const * const images[] = {
&image_shipple2_png,
};
effect const effect_diffusetexture = {
.type = effect_type::BLINN,
.blinn = {
.emission = {
.type = color_or_texture_type::COLOR,
.color = {0.0f, 0.0f, 0.0f, 1.0f},
},
.ambient = {
.type = color_or_texture_type::COLOR,
.color = {0.588f, 0.588f, 0.588f, 1.0f},
},
.diffuse = {
.type = color_or_texture_type::TEXTURE,
.texture = { .image_index = 0 }, // shipple2_png
},
.specular = {
.type = color_or_texture_type::COLOR,
.color = {0.5f, 0.5f, 0.5f, 1.0f},
},
.shininess = 10.0f,
.reflective = {
.type = color_or_texture_type::COLOR,
.color = {0.0f, 0.0f, 0.0f, 1.0f},
},
.reflectivity = 0.0f,
.transparent = {
.type = color_or_texture_type::COLOR,
.color = {1.0f, 1.0f, 1.0f, 1.0f},
},
.transparency = 1.0f,
.index_of_refraction = 0.0f,
}
};
effect const effect_cyanengine = {
.type = effect_type::BLINN,
.blinn = {
.emission = {
.type = color_or_texture_type::COLOR,
.color = {0.0f, 0.9647059f, 1.0f, 1.0f},
},
.ambient = {
.type = color_or_texture_type::COLOR,
.color = {0.0f, 0.0f, 0.0f, 1.0f},
},
.diffuse = {
.type = color_or_texture_type::COLOR,
.color = {0.0f, 0.0f, 0.0f, 1.0f},
},
.specular = {
.type = color_or_texture_type::COLOR,
.color = {0.0f, 0.0f, 0.0f, 1.0f},
},
.shininess = 10.0f,
.reflective = {
.type = color_or_texture_type::COLOR,
.color = {0.0f, 0.0f, 0.0f, 1.0f},
},
.reflectivity = 0.0f,
.transparent = {
.type = color_or_texture_type::COLOR,
.color = {1.0f, 1.0f, 1.0f, 1.0f},
},
.transparency = 1.0f,
.index_of_refraction = 0.0f,
}
};
effect const effect_emissivetexture = {
.type = effect_type::BLINN,
.blinn = {
.emission = {
.type = color_or_texture_type::TEXTURE,
.texture = { .image_index = 0 }, // shipple2_png
},
.ambient = {
.type = color_or_texture_type::COLOR,
.color = {0.588f, 0.588f, 0.588f, 1.0f},
},
.diffuse = {
.type = color_or_texture_type::TEXTURE,
.texture = { .image_index = 0 }, // shipple2_png
},
.specular = {
.type = color_or_texture_type::COLOR,
.color = {0.0f, 0.0f, 0.0f, 1.0f},
},
.shininess = 10.0f,
.reflective = {
.type = color_or_texture_type::COLOR,
.color = {0.0f, 0.0f, 0.0f, 1.0f},
},
.reflectivity = 0.0f,
.transparent = {
.type = color_or_texture_type::COLOR,
.color = {1.0f, 1.0f, 1.0f, 1.0f},
},
.transparency = 1.0f,
.index_of_refraction = 0.0f,
}
};
material const material_diffusetexture_material = {
.effect = &effect_diffusetexture,
};
material const material_cyanengine_material = {
.effect = &effect_cyanengine,
};
material const material_emissivetexture_material = {
.effect = &effect_emissivetexture,
};
input_element const input_elements_position_0_3_normal_0_3_texcoord_0_3[] = {
{
.semantic = "POSITION",
.semantic_index = 0,
.format = input_format::FLOAT3,
},
{
.semantic = "NORMAL",
.semantic_index = 0,
.format = input_format::FLOAT3,
},
{
.semantic = "TEXCOORD",
.semantic_index = 0,
.format = input_format::FLOAT3,
},
};
triangles const triangles_geom_ship[] = {
{
.count = 2949, // triangles
.index_offset = 0, // indices
.inputs_index = 0, // index into inputs_list
},
{
.count = 60, // triangles
.index_offset = 8847, // indices
.inputs_index = 0, // index into inputs_list
},
{
.count = 239, // triangles
.index_offset = 9027, // indices
.inputs_index = 0, // index into inputs_list
},
};
geometry const geometry_geom_ship = {
.mesh = {
.triangles = triangles_geom_ship,
.triangles_count = 3,
.vertex_buffer_offset = 0,
.vertex_buffer_size = 133272,
.index_buffer_offset = 0,
.index_buffer_size = 38976,
}
};
geometry const * const geometries[] = {
&geometry_geom_ship,
};
transform const transforms_node_environmentambientlight[] = {
};
instance_geometry const instance_geometries_node_environmentambientlight[] = {
};
instance_controller const instance_controllers_node_environmentambientlight[] = {
};
instance_light const instance_lights_node_environmentambientlight[] = {
{
.light = &light_environmentambientlight,
}
};
channel const * const node_channels_node_environmentambientlight[] = {};
node const node_node_environmentambientlight = {
.parent_index = -1,
.type = node_type::NODE,
.transforms = transforms_node_environmentambientlight,
.transforms_count = 0,
.instance_geometries = instance_geometries_node_environmentambientlight,
.instance_geometries_count = 0,
.instance_controllers = instance_controllers_node_environmentambientlight,
.instance_controllers_count = 0,
.instance_lights = instance_lights_node_environmentambientlight,
.instance_lights_count = 1,
.channels = node_channels_node_environmentambientlight,
.channels_count = 0,
};
transform const transforms_node_ship[] = {
{
.type = transform_type::ROTATE,
.rotate = {0.0f, 0.0f, 1.0f, -180.0f},
},
};
instance_material const instance_geometry_instance_materials_node_ship_0[] = {
{
.element_index = 1, // an index into mesh.triangles
.material = &material_cyanengine_material,
.emission = { .input_set = -1 },
.ambient = { .input_set = -1 },
.diffuse = { .input_set = -1 },
.specular = { .input_set = -1 },
},
{
.element_index = 0, // an index into mesh.triangles
.material = &material_diffusetexture_material,
.emission = { .input_set = -1 },
.ambient = { .input_set = -1 },
.diffuse = { .input_set = 0 },
.specular = { .input_set = -1 },
},
{
.element_index = 2, // an index into mesh.triangles
.material = &material_emissivetexture_material,
.emission = { .input_set = 0 },
.ambient = { .input_set = -1 },
.diffuse = { .input_set = 0 },
.specular = { .input_set = -1 },
},
};
instance_geometry const instance_geometries_node_ship[] = {
{
.geometry = &geometry_geom_ship,
.instance_materials = instance_geometry_instance_materials_node_ship_0,
.instance_materials_count = 3,
},
};
instance_controller const instance_controllers_node_ship[] = {
};
instance_light const instance_lights_node_ship[] = {
};
channel const * const node_channels_node_ship[] = {
};
node const node_node_ship = {
.parent_index = -1,
.type = node_type::NODE,
.transforms = transforms_node_ship,
.transforms_count = 1,
.instance_geometries = instance_geometries_node_ship,
.instance_geometries_count = 1,
.instance_controllers = instance_controllers_node_ship,
.instance_controllers_count = 0,
.instance_lights = instance_lights_node_ship,
.instance_lights_count = 0,
.channels = node_channels_node_ship,
.channels_count = 0,
};
transform const transforms_node_omni002[] = {
{
.type = transform_type::TRANSLATE,
.translate = {-286.5521f, 395.7583f, 161.5579f},
},
};
instance_geometry const instance_geometries_node_omni002[] = {
};
instance_controller const instance_controllers_node_omni002[] = {
};
instance_light const instance_lights_node_omni002[] = {
{
.light = &light_omni002_light,
}
};
channel const * const node_channels_node_omni002[] = {
};
node const node_node_omni002 = {
.parent_index = -1,
.type = node_type::NODE,
.transforms = transforms_node_omni002,
.transforms_count = 1,
.instance_geometries = instance_geometries_node_omni002,
.instance_geometries_count = 0,
.instance_controllers = instance_controllers_node_omni002,
.instance_controllers_count = 0,
.instance_lights = instance_lights_node_omni002,
.instance_lights_count = 1,
.channels = node_channels_node_omni002,
.channels_count = 0,
};
transform const transforms_node_omni003[] = {
{
.type = transform_type::TRANSLATE,
.translate = {333.2103f, -314.4593f, 161.5578f},
},
};
instance_geometry const instance_geometries_node_omni003[] = {
};
instance_controller const instance_controllers_node_omni003[] = {
};
instance_light const instance_lights_node_omni003[] = {
{
.light = &light_omni003_light,
}
};
channel const * const node_channels_node_omni003[] = {
};
node const node_node_omni003 = {
.parent_index = -1,
.type = node_type::NODE,
.transforms = transforms_node_omni003,
.transforms_count = 1,
.instance_geometries = instance_geometries_node_omni003,
.instance_geometries_count = 0,
.instance_controllers = instance_controllers_node_omni003,
.instance_controllers_count = 0,
.instance_lights = instance_lights_node_omni003,
.instance_lights_count = 1,
.channels = node_channels_node_omni003,
.channels_count = 0,
};
node const * const nodes[] = {
&node_node_environmentambientlight, // 0
&node_node_ship, // 1
&node_node_omni002, // 2
&node_node_omni003, // 3
};
inputs const inputs_list[] = {
{
.elements = input_elements_position_0_3_normal_0_3_texcoord_0_3,
.elements_count = 3,
},
};
collada::types::descriptor const descriptor = {
.nodes = nodes,
.nodes_count = (sizeof (nodes)) / (sizeof (nodes[0])),
.inputs_list = inputs_list,
.inputs_list_count = (sizeof (inputs_list)) / (sizeof (inputs_list[0])),
.images = images,
.images_count = (sizeof (images)) / (sizeof (images[0])),
.position_normal_texture_buffer = "data/scenes/ship20/ship20.vtx",
.joint_weight_buffer = "data/scenes/ship20/ship20.vjw",
.index_buffer = "data/scenes/ship20/ship20.idx",
};
}

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More