Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gamestate/renderer simulation #1497

Merged
merged 101 commits into from
Apr 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
e671881
renderer: Camera zoom level calibration.
heinezen Jan 29, 2023
5294985
render: Storage objects for .sprite format info.
heinezen May 12, 2021
73e354c
render: Parse sprite format.
heinezen May 16, 2021
f58e893
doc: Add new '.texture' format definition.
heinezen May 17, 2021
fef785b
doc: Adjust `.terrain` format and add more meta information to `.text…
heinezen May 21, 2021
7f91da6
render: Parse '.texture' format.
heinezen May 21, 2021
9a128a6
render: Store image path in Texture2dInfo.
heinezen May 22, 2021
a576212
export: Texture metadata format.
heinezen May 24, 2021
4cb81e0
export: Create texture metadata files.
heinezen May 24, 2021
20a65fe
render: Fix missing attributes in parser.
heinezen May 24, 2021
29c645e
render: getter for image file path.
heinezen May 24, 2021
a3e5854
render: Test texture parsing.
heinezen May 24, 2021
2cbcd6f
render: Fix sprite parser.
heinezen May 24, 2021
5b1af3d
render: Test sprite parsing.
heinezen May 24, 2021
9e2bca6
convert: Use relative module imports.
heinezen May 24, 2021
12fbb2a
render: Test drawing texture from parsed animation file.
heinezen May 28, 2021
e3156a5
export: Change the way the command bit is handled.
heinezen May 31, 2021
796814d
render: Change filter for mangnifying to GL_NEAREST.
heinezen May 31, 2021
a6bb969
render: Improve animation parser demo.
heinezen May 31, 2021
d584464
parser: Speedup parsing with constexpr maps for keywords and basic er…
heinezen May 31, 2021
b1972c1
render: Scale subtexture relative to texture size instead of window s…
heinezen May 31, 2021
d416163
render: Remove CSV metafile loading.
heinezen May 31, 2021
a8829ac
render: Better pth for input files.
heinezen May 31, 2021
553d47c
test: Add files for renderer test 1.
heinezen May 31, 2021
80a66db
doc: Add parser namespace to docs.
heinezen May 31, 2021
6dc6246
fix copyright years
heinezen May 31, 2021
fb18462
parser: Throw error if file cannot be found.
heinezen Jun 2, 2021
024f5b2
doc: Wording in comments.
heinezen Aug 22, 2021
105371b
renderer: Remove SDL2 code.
heinezen Feb 7, 2023
f1154ea
curve: Discrete curve for fixed intervals.
heinezen Feb 7, 2023
c18d38a
util: Fixed point modulus operation.
heinezen Feb 12, 2023
04ba44e
sim: Clock speed.
heinezen Feb 12, 2023
8344d54
curve: Cache last element on insert.
heinezen Feb 13, 2023
fe17b4c
curve: Use time of last element for mod calculations.
heinezen Feb 13, 2023
1407794
curve: Rename DiscreteRing to DiscreteMod.
heinezen Feb 13, 2023
4449822
curve: Use parent methods after mod calculations.
heinezen Feb 13, 2023
9cea842
util: Fix fied-point division and modulo operations.
heinezen Feb 14, 2023
6923162
curve: Save interval time for DiscreteMod.
heinezen Feb 14, 2023
c251151
curve: Tests for DiscreteMod.
heinezen Feb 14, 2023
046e178
renderer: Instructions for demo 3.
heinezen Feb 14, 2023
27daaea
event: Change returned clock time from ms to seconds.
heinezen Feb 14, 2023
b193fd5
renderer: Simple test for simulation clock.
heinezen Feb 15, 2023
4d0869a
event: Set maximum tick time for clock. Require manual update.
heinezen Feb 16, 2023
cb74133
renderer: Log "real" simulation time.
heinezen Feb 16, 2023
ce53a0b
renderer: Change angle/frame info references to shared_ptr.
heinezen Feb 16, 2023
5cbfb05
renderer: Demo for timed animation with clock.
heinezen Feb 17, 2023
640d02b
event: Support multhithreading Clock.
heinezen Feb 17, 2023
e2d3418
renderer: Move test textures to unified folder.
heinezen Feb 17, 2023
bcd2b8b
renderer: Remove unused variables.
heinezen Feb 17, 2023
ab0143c
renderer: Move demo shader sources into files.
heinezen Feb 17, 2023
26f5789
event: Get clock state from method.
heinezen Feb 17, 2023
d3f430a
event: Fix deadlock when updating simulation time.
heinezen Feb 17, 2023
d24f73c
renderer: Allow toggle between animation speeds in demo.
heinezen Feb 17, 2023
90f3fec
renderer: Data classes for terrain.
heinezen Feb 19, 2023
11af225
renderer: Remove unnecessary includes.
heinezen Feb 19, 2023
340a0c6
renderer: Move animation resources into subfolder.
heinezen Feb 19, 2023
9021399
parser: Change argument types to 'const &'.
heinezen Feb 19, 2023
8a859f7
parser: Switch const map with unordered_map.
heinezen Feb 19, 2023
20624ea
renderer: Palette info data class.
heinezen Feb 20, 2023
0949c58
fix copyright years.
heinezen Feb 20, 2023
8e1bae0
parser: More const maps replaced.
heinezen Feb 20, 2023
0cf465c
renderer: Make blend table optional as defined in spec.
heinezen Feb 20, 2023
a700ba9
parser: Parsers for terrain formats.
heinezen Feb 20, 2023
d5bbd8a
parser: Palette files.
heinezen Feb 20, 2023
ac36d8b
parser: Parse 'version' argument as common value.
heinezen Feb 20, 2023
d617565
event: Differentiate between stop() and pause().
heinezen Feb 23, 2023
51373d0
main: Thread for event loop and clock.
heinezen Feb 23, 2023
d9ad734
event: Move loop and clock into dedicated Simulation class.
heinezen Feb 23, 2023
2922efa
event: Multithreaded loop.
heinezen Feb 23, 2023
870b77f
fix comments
heinezen Feb 23, 2023
2b037ba
convert: Fix HD texture format export.
heinezen Feb 23, 2023
2cbd691
datastruct: Clarify use case of ConstMap.
heinezen Feb 23, 2023
ff56389
renderer: Use optional type for texture info path.
heinezen Feb 24, 2023
2c423c7
renderer: Remove outdated csv loading.
heinezen Feb 24, 2023
ae91b21
input: Move controller to input section.
heinezen Feb 25, 2023
91ab627
convert: Cache game version dependent read and conversion values.
heinezen Feb 25, 2023
dcfa6d8
input: Mark old input classes as legacy.
heinezen Feb 25, 2023
385763c
presenter: Control event simulation with presenter.
heinezen Feb 26, 2023
aa857ef
renderer: Load asset formats with asset manager.
heinezen Feb 26, 2023
50e0e45
parser: Use cached resources if available.
heinezen Feb 26, 2023
5002a07
fix problems with clang build.
heinezen Feb 26, 2023
f64caf2
renderer: Make caching actually work.
heinezen Feb 27, 2023
4bce506
renderer: Use asset manager in all subrenders.
heinezen Feb 27, 2023
ea88e21
assets: Move gaben and missing to test dir.
heinezen Feb 27, 2023
3a28f1f
assets: Create definition files for all test assets.
heinezen Feb 27, 2023
9ece3e5
doc: Fix missing parameter in .terrain quick reference.
heinezen Feb 27, 2023
0482638
parser: Fix size check.
heinezen Feb 27, 2023
824c07d
parser: Check if cache exists.
heinezen Feb 27, 2023
6997f02
renderer: Pass asset definitions from gamestate->renderer.
heinezen Feb 27, 2023
74142a2
renderer: Update current frame with frame timings.
heinezen Feb 27, 2023
27cb65a
event: Implement missing simulation methods.
heinezen Feb 27, 2023
4b501c3
renderer: Pass clock to subrenderer.
heinezen Feb 27, 2023
1e0c90b
doc: Fix .terrain quick reference.
heinezen Feb 27, 2023
757883a
parser: TODO for avoiding double lookup.
heinezen Feb 27, 2023
dc5c6b5
read: Clarify openage usage of alpha values.
heinezen Feb 27, 2023
b2b00e3
parser: Remove nullptr as return value.
heinezen Mar 1, 2023
0ef4be0
parser: Fix testing if a cache exists.
heinezen Mar 1, 2023
ea01d87
renderer: Pass renderables as const vector.
heinezen Mar 1, 2023
56e7966
renderer: Use correct clock methods in demo 4.
heinezen Mar 1, 2023
3c7604e
curve: Fix mod curve if interval is 0 seconds long.
heinezen Apr 1, 2023
ecc6e48
renderer: Fix log output description.
heinezen Apr 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions assets/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@ add_subdirectory(shaders/)
add_subdirectory(test/)
add_subdirectory(textures/)


install(FILES
"missing.png"
"gaben.png"
DESTINATION "${ASSET_DIR}"
)

install(DIRECTORY "qml"
DESTINATION "${ASSET_DIR}"
)
Expand Down
1 change: 0 additions & 1 deletion assets/shaders/world.vert.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@ float height = offset_tile.w - offset_tile.z;

void main() {
gl_Position = proj * view * model * vec4(position, 0.0, 1.0);
// gl_Position = vec4(position, 0.0, 1.0);
v_uv = vec2((uv.x * width) + offset_tile.x, (((1.0 - uv.y) * height) + offset_tile.z));
}
10 changes: 10 additions & 0 deletions assets/test/shaders/demo_0_display.frag.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#version 330

uniform sampler2D color_texture;

in vec2 v_uv;
out vec4 col;

void main() {
col = texture(color_texture, v_uv);
}
10 changes: 10 additions & 0 deletions assets/test/shaders/demo_0_display.vert.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#version 330

layout(location=0) in vec2 position;
layout(location=1) in vec2 uv;
out vec2 v_uv;

void main() {
gl_Position = vec4(position, 0.0, 1.0);
v_uv = uv;
}
17 changes: 17 additions & 0 deletions assets/test/shaders/demo_0_obj.frag.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#version 330

in vec2 v_uv;
uniform sampler2D tex;
uniform uint u_id;

layout(location=0) out vec4 col;
layout(location=1) out uint id;

void main() {
vec4 tex_val = texture(tex, v_uv);
if (tex_val.a == 0) {
discard;
}
col = tex_val;
id = u_id;
}
12 changes: 12 additions & 0 deletions assets/test/shaders/demo_0_obj.vert.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#version 330

layout(location=0) in vec2 position;
layout(location=1) in vec2 uv;
uniform mat4 mv;
uniform mat4 proj;
out vec2 v_uv;

void main() {
gl_Position = proj * mv * vec4(position, 0.0, 1.0);
v_uv = vec2(uv.x, 1.0 - uv.y);
}
10 changes: 10 additions & 0 deletions assets/test/shaders/demo_1_display.frag.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#version 330

uniform sampler2D color_texture;

in vec2 v_uv;
out vec4 col;

void main() {
col = texture(color_texture, v_uv);
}
10 changes: 10 additions & 0 deletions assets/test/shaders/demo_1_display.vert.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#version 330

layout(location=0) in vec2 position;
layout(location=1) in vec2 uv;
out vec2 v_uv;

void main() {
gl_Position = vec4(position, 0.0, 1.0);
v_uv = uv;
}
31 changes: 31 additions & 0 deletions assets/test/shaders/demo_1_obj.frag.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#version 330

in vec2 v_uv;
uniform sampler2D tex;
uniform uint u_id;

layout(location=0) out vec4 col;
layout(location=1) out uint id;

void main() {
vec4 tex_val = texture(tex, v_uv);
int alpha = int(round(tex_val.a * 255));
switch (alpha) {
case 0:
discard;
break;
case 254:
col = vec4(1.0f, 0.0f, 0.0f, 1.0f);
break;
case 252:
col = vec4(0.0f, 1.0f, 0.0f, 1.0f);
break;
case 250:
col = vec4(0.0f, 0.0f, 1.0f, 1.0f);
break;
default:
col = tex_val;
break;
}
id = u_id;
}
18 changes: 18 additions & 0 deletions assets/test/shaders/demo_1_obj.vert.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#version 330

layout(location=0) in vec2 position;
layout(location=1) in vec2 uv;

uniform mat4 mv;
uniform mat4 proj;
uniform vec4 offset_tile;

float width = offset_tile.y - offset_tile.x;
float height = offset_tile.w - offset_tile.z;

out vec2 v_uv;

void main() {
gl_Position = proj * mv * vec4(position, 0.0, 1.0);
v_uv = vec2((uv.x * width) + offset_tile.x, (((1.0 - uv.y) * height) + offset_tile.z));
}
7 changes: 7 additions & 0 deletions assets/test/shaders/demo_2_display.frag.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#version 330

out vec4 col;

void main() {
col = vec4(1.0, 0.4, 0.0, 0.8);
}
7 changes: 7 additions & 0 deletions assets/test/shaders/demo_2_display.vert.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#version 330

layout(location=0) in vec2 position;

void main() {
gl_Position = vec4(position, 0.0, 1.0);
}
10 changes: 10 additions & 0 deletions assets/test/shaders/demo_4_display.frag.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#version 330

uniform sampler2D color_texture;

in vec2 v_uv;
out vec4 col;

void main() {
col = texture(color_texture, v_uv);
}
10 changes: 10 additions & 0 deletions assets/test/shaders/demo_4_display.vert.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#version 330

layout(location=0) in vec2 position;
layout(location=1) in vec2 uv;
out vec2 v_uv;

void main() {
gl_Position = vec4(position, 0.0, 1.0);
v_uv = uv;
}
31 changes: 31 additions & 0 deletions assets/test/shaders/demo_4_obj.frag.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#version 330

in vec2 v_uv;
uniform sampler2D tex;
uniform uint u_id;

layout(location=0) out vec4 col;
layout(location=1) out uint id;

void main() {
vec4 tex_val = texture(tex, v_uv);
int alpha = int(round(tex_val.a * 255));
switch (alpha) {
case 0:
discard;
break;
case 254:
col = vec4(1.0f, 0.0f, 0.0f, 1.0f);
break;
case 252:
col = vec4(0.0f, 1.0f, 0.0f, 1.0f);
break;
case 250:
col = vec4(0.0f, 0.0f, 1.0f, 1.0f);
break;
default:
col = tex_val;
break;
}
id = u_id;
}
18 changes: 18 additions & 0 deletions assets/test/shaders/demo_4_obj.vert.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#version 330

layout(location=0) in vec2 position;
layout(location=1) in vec2 uv;

uniform mat4 mv;
uniform mat4 proj;
uniform vec4 offset_tile;

float width = offset_tile.y - offset_tile.x;
float height = offset_tile.w - offset_tile.z;

out vec2 v_uv;

void main() {
gl_Position = proj * mv * vec4(position, 0.0, 1.0);
v_uv = vec2((uv.x * width) + offset_tile.x, (((1.0 - uv.y) * height) + offset_tile.z));
}
File renamed without changes
File renamed without changes
31 changes: 31 additions & 0 deletions assets/test/textures/test_animation.sprite
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright 2021-2021 the openage authors. See copying.md for legal info.
# openage sprite definition file

version 2

texture 0 "test_texture.texture"

scalefactor 1

layer 0 mode=loop position=20 time_per_frame=0.125

angle 0

frame 0 0 0 0 0
frame 1 0 0 0 1
frame 2 0 0 0 2
frame 3 0 0 0 3
frame 4 0 0 0 4
frame 5 0 0 0 5
frame 6 0 0 0 6
frame 7 0 0 0 7
frame 8 0 0 0 8
frame 9 0 0 0 9
frame 10 0 0 0 10
frame 11 0 0 0 11
frame 12 0 0 0 12
frame 13 0 0 0 13
frame 14 0 0 0 14
frame 15 0 0 0 15
frame 16 0 0 0 16
frame 17 0 0 0 17
14 changes: 14 additions & 0 deletions assets/test/textures/test_gaben.sprite
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2023-2023 the openage authors. See copying.md for legal info.
# openage sprite definition file

version 2

texture 0 "test_gaben.texture"

scalefactor 1

layer 0 mode=once

angle 0

frame 0 0 0 0 0
12 changes: 12 additions & 0 deletions assets/test/textures/test_gaben.texture
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright 2023-2023 the openage authors.
# openage texture definition file

version 1

imagefile "gaben.png"

size 719 1073

pxformat rgba8 cbits=True

subtex 0 0 719 1073 359 536
14 changes: 14 additions & 0 deletions assets/test/textures/test_missing.sprite
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2023-2023 the openage authors. See copying.md for legal info.
# openage sprite definition file

version 2

texture 0 "test_missing.texture"

scalefactor 1

layer 0 mode=once

angle 0

frame 0 0 0 0 0
12 changes: 12 additions & 0 deletions assets/test/textures/test_missing.texture
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright 2023-2023 the openage authors.
# openage texture definition file

version 1

imagefile "missing.png"

size 32 32

pxformat rgba8 cbits=True

subtex 0 0 32 32 16 16
12 changes: 12 additions & 0 deletions assets/test/textures/test_terrain.terrain
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright 2023-2023 the openage authors. See copying.md for legal info.
# openage terrain definition file

version 2

texture 0 "test_terrain.texture"

scalefactor 1

layer 0

frame 0 0 0 0
12 changes: 12 additions & 0 deletions assets/test/textures/test_terrain.texture
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright 2023-2023 the openage authors.
# openage texture definition file

version 1

imagefile "test_terrain.png"

size 500 500

pxformat rgba8 cbits=True

subtex 0 0 500 500 0 0
Binary file added assets/test/textures/test_texture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions assets/test/textures/test_texture.texture
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# The image file was adapted from the "Elemental Ground Monk" sprite pack,
# Copyright 2021-2021 by chierit.
#
# It's licensed under the terms of the Creative Commons Attribution v4.0 International license.
# (https://creativecommons.org/licenses/by/4.0/)
#
# The original version can be found at:
# https://chierit.itch.io/elementals-ground-monk
#
# Modifications by us:
# - Extracted sprites from the "3_atk" animation
# - Added an outline to the monk with the openage outline colour command (RGBA: 0,0,0,252)
# - Changed orange colour (239,105,47,255) with the openage playercolor colour command (RGBA: 239,105,47,254)
#
# Copyright 2021-2021 the openage authors.
# See copying.md for further legal info.

# openage texture definition file

version 1

imagefile "test_texture.png"

size 208 160

pxformat rgba8 cbits=True

subtex 0 0 28 39 0 0
subtex 28 0 27 37 0 0
subtex 55 0 36 38 0 0
subtex 91 0 40 36 0 0
subtex 91 36 42 37 0 0
subtex 0 73 33 42 0 0
subtex 33 73 36 46 0 0
subtex 69 73 35 37 0 0
subtex 131 0 28 33 0 0
subtex 133 33 27 45 0 0
subtex 104 78 28 46 0 0
subtex 0 124 47 31 0 0
subtex 160 0 48 41 0 0
subtex 160 41 48 41 0 0
subtex 132 82 48 41 0 0
subtex 47 123 51 37 0 0
subtex 0 41 55 31 0 0
subtex 132 123 48 31 0 0
Loading