Compare commits

318 Commits

Author SHA1 Message Date
316441b954 merge upstream 2025-05-20 20:00:31 +00:00
9d7613be8f Update Binaries 2025-05-18 22:12:06 +00:00
c989f3254f Delete Krom/Krom.exe 2025-05-18 22:00:02 +00:00
f8d76929ae Delete Krom/Krom_opengl.exe 2025-05-18 21:59:54 +00:00
a51c28b607 Delete Krom/Krom 2025-05-18 21:59:44 +00:00
9142371f88 Merge pull request 'Update shader data and custom particles' (#53) from Onek8/LNXSDK:main into main
Reviewed-on: LeenkxTeam/LNXSDK#53
2025-05-17 08:45:06 +00:00
35f92341fa Update leenkx/blender/lnx/nodes_logic.py 2025-05-17 08:05:49 +00:00
a8d1eebdaf Merge branch 'main' into main 2025-05-17 03:21:14 +00:00
87922c9389 Upload files to "leenkx/blender/data" 2025-05-17 03:19:57 +00:00
38287f56b0 Delete leenkx/blender/data/lnx_data.blend 2025-05-17 03:18:52 +00:00
42ad5b01c1 Merge pull request 't3du - Fix NoiseTexture fac output for FBM and include params: detail and distortion' (#51) from Onek8/LNXSDK:main into main
Reviewed-on: LeenkxTeam/LNXSDK#51
2025-05-13 20:57:19 +00:00
2b46d6ebca Update leenkx/blender/lnx/material/cycles_nodes/nodes_texture.py 2025-05-13 20:55:03 +00:00
953ad8391c Update leenkx/blender/lnx/material/cycles_nodes/nodes_texture.py 2025-05-13 20:51:26 +00:00
1458ecd84f Update leenkx/blender/lnx/material/cycles_functions.py 2025-05-13 20:49:49 +00:00
288b085d0c Merge pull request 'moisesjpelaez - Add particles random size' (#50) from Onek8/LNXSDK:main into main
Reviewed-on: LeenkxTeam/LNXSDK#50
2025-05-13 20:03:56 +00:00
aa0b2b1b7e Update Kha/Backends/Krom/kha/audio2/Audio.hx 2025-05-13 19:53:49 +00:00
acede01167 Update Kha/Backends/Krom/kha/audio2/Audio.hx 2025-05-13 19:52:40 +00:00
92a2b0305e Update Kha/Backends/Krom/kha/SystemImpl.hx 2025-05-13 19:50:08 +00:00
4886953722 Update Kha/Backends/Krom/Krom.hx 2025-05-13 19:46:24 +00:00
601860b242 Update Kha/Sources/kha/Scheduler.hx 2025-05-13 19:41:30 +00:00
f00cef2e21 Update Kha/Sources/kha/Scheduler.hx 2025-05-13 19:40:30 +00:00
e733dca053 Update Kha/Backends/Krom/kha/krom/Graphics.hx 2025-05-13 19:37:45 +00:00
387be05826 Update Kha/Backends/Krom/kha/SystemImpl.hx 2025-05-13 19:35:50 +00:00
c5b21a9bb3 Update Kha/Backends/Krom/kha/Display.hx 2025-05-13 19:34:29 +00:00
5b2c7bfc84 Update Kha/Backends/Krom/Krom.hx 2025-05-13 19:33:41 +00:00
47d913ab64 moisesjpelaez - Add particles random size 2025-05-13 18:00:51 +00:00
878ce14254 moisesjpelaez - Add particles random size 2025-05-13 17:59:36 +00:00
9075931c51 moisesjpelaez - Add particles random size 2025-05-13 17:58:05 +00:00
39ab42f2da Merge pull request 'moisesjpelaez and T3du - Oimo Physics, Bloom condition, array index list, camera spawn fix' (#48) from Onek8/LNXSDK:main into main
Reviewed-on: LeenkxTeam/LNXSDK#48
2025-05-13 16:59:59 +00:00
30cab4d79b Update leenkx/Sources/leenkx/trait/physics/bullet/DebugDrawHelper.hx 2025-05-13 16:55:45 +00:00
8ee2aaa70a Update leenkx/Sources/leenkx/trait/physics/bullet/DebugDrawHelper.hx 2025-05-12 07:39:22 +00:00
2f9694632d Update leenkx/Sources/leenkx/trait/physics/bullet/DebugDrawHelper.hx 2025-05-12 07:31:37 +00:00
7b8d73cd84 Update leenkx/Sources/leenkx/trait/physics/bullet/DebugDrawHelper.hx 2025-05-12 07:29:05 +00:00
3d8bd77c59 Update leenkx/Sources/leenkx/trait/physics/bullet/DebugDrawHelper.hx 2025-05-12 04:08:17 +00:00
290289f413 Update leenkx/Sources/leenkx/trait/physics/bullet/PhysicsWorld.hx 2025-05-11 20:37:34 +00:00
2732210fc9 moisesjpelaez - Oimo Physics 2025-05-11 19:46:28 +00:00
68900fb992 moisesjpelaez - Fix Bloom condition 2025-05-11 19:43:09 +00:00
ef724ae323 moisesjpelaez - Oimo Physics 2025-05-11 19:41:09 +00:00
6d4c1a680b moisesjpelaez - Oimo Physics 2025-05-11 19:37:04 +00:00
8aeaa0368e moisesjpelaez - Oimo Physics 2025-05-11 17:50:43 +00:00
7969286fdc moisesjpelaez - Oimo Physics 2025-05-11 17:49:43 +00:00
cde2bead97 moisesjpelaez - Oimo Physics 2025-05-11 17:47:56 +00:00
c42e4c09a8 moisesjpelaez - Oimo Physics 2025-05-11 17:46:49 +00:00
b8c8ccad9d moisesjpelaez - Oimo Physics 2025-05-11 17:46:28 +00:00
335f3541f1 moisesjpelaez - Oimo Physics 2025-05-11 17:44:49 +00:00
808dcef817 moisesjpelaez - Oimo Physics 2025-05-11 17:41:38 +00:00
6ac06cc504 moisesjpelaez - Oimo Physics 2025-05-11 17:40:38 +00:00
86de9617f3 moisesjpelaez - Oimo Physics 2025-05-11 17:39:01 +00:00
29761ec9e6 moisesjpelaez - Oimo Physics 2025-05-11 17:38:02 +00:00
ea7cf849b8 t3du - Add ArrayIndexListNode.hx 2025-05-11 17:14:38 +00:00
5d559734b9 t3du - Add LN_array_index_list.py 2025-05-11 17:13:05 +00:00
939346c896 moisesjpelaez - Fix camera spawn position in Blender 4.2.x 2025-05-11 17:03:13 +00:00
f2dcfc0ffa Merge pull request 'main' (#47) from Onek8/LNXSDK:main into main
Reviewed-on: LeenkxTeam/LNXSDK#47
2025-05-10 16:32:31 +00:00
e78bd17d93 Update leenkx/blender/lnx/utils.py 2025-05-10 16:30:16 +00:00
f9a02f03cb Update leenkx.py 2025-05-10 16:27:51 +00:00
21a4ee0af7 Update leenkx.py 2025-05-10 16:25:06 +00:00
9bf83bc49f Update leenkx/blender/lnx/material/make_mesh.py 2025-04-18 22:52:53 +00:00
d88e1f0f42 Update leenkx/blender/lnx/material/make_cluster.py 2025-04-18 22:52:03 +00:00
96f4e29778 Update leenkx/blender/lnx/material/make_mesh.py 2025-04-12 08:49:04 +00:00
1d705d2ca2 Update leenkx/blender/lnx/material/make_cluster.py 2025-04-12 08:48:33 +00:00
0979cd976f Update leenkx/blender/lnx/write_data.py 2025-04-11 22:20:24 +00:00
db6d786ee4 merge upstream 2025-04-11 22:06:01 +00:00
06319131fd Update leenkx/blender/lnx/handlers.py 2025-04-11 21:16:04 +00:00
c08e1d3835 Update leenkx/Sources/leenkx/trait/physics/bullet/PhysicsWorld.hx 2025-04-11 21:04:00 +00:00
27bd360317 Update lib/haxebullet/hl/bullet.cpp 2025-04-11 16:28:33 +00:00
82a53a868a Merge pull request 'Debug Raycast Drawing' (#45) from Onek8/LNXSDK:main into main
Reviewed-on: LeenkxTeam/LNXSDK#45
2025-04-11 08:37:13 +00:00
94eaba7319 Update leenkx/Sources/leenkx/trait/physics/bullet/PhysicsWorld.hx 2025-04-11 08:22:17 +00:00
8d1c2c51bd Update leenkx/Sources/leenkx/trait/physics/bullet/PhysicsWorld.hx 2025-04-11 08:18:30 +00:00
07d98639f2 Update leenkx/Sources/leenkx/trait/physics/bullet/DebugDrawHelper.hx 2025-04-11 08:17:40 +00:00
1944fc97b8 Update leenkx/Sources/leenkx/trait/physics/bullet/PhysicsWorld.hx 2025-04-10 22:22:46 +00:00
d69e3438ff Update leenkx/Sources/leenkx/trait/physics/bullet/DebugDrawHelper.hx 2025-04-10 21:55:56 +00:00
62e52a7316 Update leenkx/Sources/leenkx/trait/physics/bullet/PhysicsWorld.hx 2025-04-10 21:45:24 +00:00
c4b48c2d87 Update leenkx/blender/lnx/exporter.py 2025-04-10 21:29:34 +00:00
96f69a7cfe Update leenkx/blender/lnx/props_ui.py 2025-04-10 21:23:53 +00:00
90950970f0 Update leenkx/blender/lnx/props.py 2025-04-10 21:21:21 +00:00
106e36e30d merge upstream 2025-04-10 17:16:12 +00:00
e71b0849b3 Merge pull request 'HashLeenkx Updates!' (#44) from Onek8/LNXSDK:main into main
Reviewed-on: LeenkxTeam/LNXSDK#44
2025-04-10 15:56:16 +00:00
e079c94832 Update leenkx/blender/lnx/make.py 2025-04-10 15:54:53 +00:00
5572494f3d Upload files to "Kha/Kinc/Tools/freebsd_x64" 2025-04-10 11:02:33 +00:00
8f03927391 Delete Kha/Kinc/Tools/freebsd_x64/icon.png 2025-04-10 11:02:20 +00:00
6586d90177 Upload files to "Kha/Kinc/Tools/linux_arm" 2025-04-10 11:02:04 +00:00
952cee36a3 Delete Kha/Kinc/Tools/linux_arm/icon.png 2025-04-10 11:01:52 +00:00
35bfdf3715 Upload files to "Kha/Kinc/Tools/linux_arm64" 2025-04-10 11:01:37 +00:00
135aaa0669 Delete Kha/Kinc/Tools/linux_arm64/icon.png 2025-04-10 11:01:22 +00:00
c6b776a329 Upload files to "Kha/Kinc/Tools/macos" 2025-04-10 11:01:09 +00:00
67c7443985 Delete Kha/Kinc/Tools/macos/icon.png 2025-04-10 11:00:57 +00:00
42273470c3 Upload files to "Kha/Kinc/Tools/linux_x64" 2025-04-10 11:00:38 +00:00
4dfc6be702 Delete Kha/Kinc/Tools/linux_x64/icon.png 2025-04-10 11:00:25 +00:00
92e1abcfdc Upload files to "Kha/Kinc/Tools/windows_x64" 2025-04-10 11:00:11 +00:00
764eefeb06 Delete Kha/Kinc/Tools/windows_x64/icon.png 2025-04-10 10:59:52 +00:00
979dfc605d Update leenkx/blender/lnx/make.py 2025-04-10 10:12:22 +00:00
55fb300901 Update Kha/Backends/Kinc-HL/kha/graphics4/FragmentShader.hx 2025-04-10 08:47:21 +00:00
c59e6a66d4 merge upstream 2025-04-10 07:48:11 +00:00
659802b888 Update Kha/Backends/Kinc-HL/kha/graphics4/FragmentShader.hx 2025-04-10 07:36:58 +00:00
33f6fcaaaf Merge pull request 'HashLeenkx' (#43) from Onek8/LNXSDK:main into main
Reviewed-on: LeenkxTeam/LNXSDK#43
2025-04-09 22:15:26 +00:00
d37b41b181 Update leenkx/Sources/iron/system/LnxPack.hx 2025-04-09 22:14:24 +00:00
70742b823f Update Kha/Backends/Kinc-HL/kinc-bridge/kinc.c.h 2025-04-09 22:09:15 +00:00
da8f9d23e4 Update lib/aura/Sources/aura/Aura.hx 2025-04-09 22:07:36 +00:00
ff886e6d46 Update Kha/Backends/Kinc-HL/kfile.js 2025-04-09 22:05:14 +00:00
70a603cf7a Update Kha/Backends/Kinc-HL/kinc-bridge/compute.c.h 2025-04-09 21:25:07 +00:00
bfc4c2644f Update leenkx/blender/lnx/props.py 2025-04-09 20:59:05 +00:00
f101124d24 Update leenkx/blender/lnx/utils.py 2025-04-09 20:44:54 +00:00
c6f672bd61 Update leenkx/blender/lnx/props.py 2025-04-09 20:35:42 +00:00
7f38b15fe7 Update leenkx/blender/lnx/make.py 2025-04-09 20:33:24 +00:00
2bb296028f merge upstream 2025-04-09 17:30:27 +00:00
5628493493 Merge pull request 'Transforms_and_Rotations' (#42) from Onek8/LNXSDK:Transforms_and_Rotations into main
Reviewed-on: LeenkxTeam/LNXSDK#42
2025-04-09 17:12:32 +00:00
f8a08a41b1 Update leenkx/Sources/iron/math/Quat.hx 2025-04-09 15:02:07 +00:00
2cd91f598c Update leenkx/blender/lnx/logicnode/lnx_sockets.py 2025-04-08 21:50:49 +00:00
a20d6b581c Update leenkx/blender/lnx/nodes_logic.py 2025-04-08 17:24:50 +00:00
e34ed0794f Update leenkx/Sources/leenkx/logicnode/RotationNode.hx 2025-04-08 17:20:50 +00:00
bdcf4c980b Update leenkx/blender/lnx/logicnode/lnx_sockets.py 2025-04-08 17:19:06 +00:00
25d7ba3e72 merge upstream 2025-04-08 06:33:53 +00:00
30e5acf9bf Update leenkx/blender/lnx/make_renderpath.py 2025-04-07 21:20:53 +00:00
c3435b9533 Update leenkx/blender/lnx/write_data.py 2025-04-07 21:19:28 +00:00
8765e894f5 Update leenkx/blender/lnx/props_ui.py 2025-04-07 21:17:23 +00:00
2c5c8d0e4f Update leenkx/blender/lnx/props_renderpath.py 2025-04-07 21:16:29 +00:00
4805dd06a7 Update leenkx/Shaders/compositor_pass/compositor_pass.frag.glsl 2025-04-07 21:14:52 +00:00
2bc2ab43a1 Update leenkx/Shaders/std/tonemap.glsl 2025-04-07 21:12:11 +00:00
bf7b4416ec Update leenkx/blender/lnx/make_renderpath.py 2025-04-07 17:29:09 +00:00
a2d03cfe6e Update leenkx/Shaders/std/light.glsl 2025-04-07 17:26:00 +00:00
95f0ecfc54 Update leenkx/Sources/leenkx/system/Starter.hx 2025-04-07 17:07:52 +00:00
07f59224fc Update leenkx/blender/lnx/write_data.py 2025-04-07 16:50:46 +00:00
02259985be Update leenkx/blender/lnx/props.py 2025-04-07 16:46:33 +00:00
6b8585c81a Update leenkx/blender/lnx/props_renderpath.py 2025-04-07 16:43:01 +00:00
5d78eabf94 Update leenkx/blender/lnx/material/cycles_nodes/nodes_texture.py 2025-04-07 16:39:49 +00:00
41c1459c4e Update leenkx/blender/lnx/material/make_voxel.py 2025-04-07 16:34:12 +00:00
304a497565 Update leenkx/blender/lnx/make_renderpath.py 2025-04-07 16:27:25 +00:00
9fa399371a Update leenkx/blender/lnx/material/make_mesh.py 2025-04-07 16:25:06 +00:00
4625fdb6b2 Update leenkx/blender/lnx/material/make_cluster.py 2025-04-07 16:13:16 +00:00
79553927aa Update leenkx/Shaders/water_pass/water_pass.frag.glsl 2025-04-07 16:06:53 +00:00
86661c1012 Update leenkx/Shaders/voxel_light/voxel_light.comp.glsl 2025-04-07 16:04:17 +00:00
03967c7a2b Update leenkx/Sources/leenkx/system/Starter.hx 2025-04-07 15:50:41 +00:00
61fd48a12f Update leenkx/Shaders/ssr_pass/ssr_pass.frag.glsl 2025-04-07 15:47:22 +00:00
519039b8b6 Update leenkx/Shaders/std/light.glsl 2025-04-07 15:45:04 +00:00
5244b1b3e8 Update leenkx/Sources/leenkx/renderpath/RenderPathForward.hx 2025-04-07 15:41:41 +00:00
7ae3bbe496 Update leenkx/Sources/leenkx/renderpath/RenderPathDeferred.hx 2025-04-07 15:39:38 +00:00
001be2f8da Update leenkx/Sources/leenkx/renderpath/Inc.hx 2025-04-07 15:35:22 +00:00
6a25b3c5d7 Update leenkx/Shaders/deferred_light/deferred_light.frag.glsl 2025-04-07 15:28:46 +00:00
8d4ac7251a Update leenkx/Shaders/voxel_temporal/voxel_temporal.comp.glsl 2025-04-07 15:22:49 +00:00
ae63b252c6 Update leenkx/Shaders/voxel_sdf_jumpflood/voxel_sdf_jumpflood.comp.glsl 2025-04-07 15:19:03 +00:00
ee73823206 Update leenkx/Shaders/voxel_resolve_specular/voxel_resolve_specular.comp.glsl 2025-04-07 15:17:43 +00:00
af2850e20c Update leenkx/Shaders/voxel_resolve_diffuse/voxel_resolve_diffuse.comp.glsl 2025-04-07 14:49:37 +00:00
bc4a31d415 Update leenkx/Shaders/voxel_resolve_ao/voxel_resolve_ao.comp.glsl 2025-04-07 14:47:58 +00:00
5303ad3ac6 Update leenkx/Shaders/ssrefr_pass/ssrefr_pass.frag.glsl 2025-04-07 14:44:14 +00:00
5153cff790 Update leenkx/Shaders/std/shadows.glsl 2025-04-07 14:41:53 +00:00
abe17870ce Update leenkx/Shaders/std/conetrace.glsl 2025-04-07 14:38:30 +00:00
c798f122d0 Merge pull request 'Transforms and rotations math' (#41) from Onek8/LNXSDK:main into main
Reviewed-on: LeenkxTeam/LNXSDK#41
2025-04-06 15:48:46 +00:00
d1edb1464e Update leenkx/Sources/iron/math/Quat.hx 2025-04-06 15:27:05 +00:00
ee8d3314b5 Update leenkx/Sources/leenkx/logicnode/TransformNode.hx 2025-04-06 15:25:39 +00:00
c6139282ed Update leenkx/blender/lnx/logicnode/lnx_sockets.py 2025-04-06 14:34:19 +00:00
559a3b8b39 Update leenkx/Sources/iron/math/Quat.hx 2025-04-06 14:30:52 +00:00
8d072ae481 Update leenkx/blender/lnx/logicnode/math/LN_rotation_math.py 2025-04-06 10:28:18 +00:00
293a612e9c Update leenkx/blender/lnx/logicnode/network/LN_network_event.py 2025-04-06 10:25:39 +00:00
8020599513 Update leenkx/blender/lnx/logicnode/native/LN_get_date_time.py 2025-04-06 10:25:01 +00:00
4fbc1aba7f Update leenkx/blender/lnx/logicnode/native/LN_call_haxe_static.py 2025-04-06 10:24:11 +00:00
1380585297 Update leenkx/blender/lnx/logicnode/miscellaneous/LN_group_output.py 2025-04-06 10:23:47 +00:00
beee036a3d Update leenkx/blender/lnx/logicnode/miscellaneous/LN_group_input.py 2025-04-06 10:23:01 +00:00
76b2ba8f80 Update leenkx/blender/lnx/logicnode/miscellaneous/LN_call_group.py 2025-04-06 10:22:41 +00:00
e7143cc740 Update leenkx/blender/lnx/logicnode/math/LN_vector_math.py 2025-04-06 10:22:15 +00:00
bd0886b1d7 Update leenkx/blender/lnx/logicnode/math/LN_quaternion_math.py 2025-04-06 10:20:29 +00:00
8eb8c0bd98 Update leenkx/blender/lnx/logicnode/math/LN_math_term.py 2025-04-06 10:19:19 +00:00
dd06e490a7 Update leenkx/blender/lnx/logicnode/math/LN_math_expression.py 2025-04-06 10:18:20 +00:00
5e4ac6dd0b Update leenkx/blender/lnx/logicnode/math/LN_math.py 2025-04-06 10:16:57 +00:00
be0a9149ad Update leenkx/blender/lnx/logicnode/math/LN_compare.py 2025-04-06 10:14:40 +00:00
7ab3398941 Update leenkx/blender/lnx/logicnode/map/LN_string_map.py 2025-04-06 10:14:02 +00:00
c10e988d2d Update leenkx/blender/lnx/logicnode/logic/LN_wait_for.py 2025-04-06 10:13:28 +00:00
caafeea2f1 Update leenkx/blender/lnx/logicnode/logic/LN_switch_output.py 2025-04-06 10:12:43 +00:00
2edee3fe68 Update leenkx/blender/lnx/logicnode/logic/LN_select.py 2025-04-06 10:11:19 +00:00
af147c9c63 Update leenkx/blender/lnx/logicnode/array/LN_array_remove_by_value.py 2025-04-06 10:10:23 +00:00
8e4c20647b Update leenkx/blender/lnx/lightmapper/utility/log.py 2025-04-06 10:09:42 +00:00
594cbeffbe Update leenkx/blender/lnx/logicnode/random/LN_random_output.py 2025-04-06 10:06:39 +00:00
e1d48e4289 Update leenkx/blender/lnx/logicnode/random/LN_probabilistic_output.py 2025-04-06 10:06:04 +00:00
7960ca94a6 Update leenkx/blender/lnx/logicnode/physics/LN_physics_constraint.py 2025-04-06 10:02:08 +00:00
72f14f59bf Update leenkx/blender/lnx/logicnode/physics/LN_add_physics_constraint.py 2025-04-06 10:01:08 +00:00
d994d040ef Update leenkx/blender/lnx/logicnode/network/LN_network_send_message.py 2025-04-06 09:54:19 +00:00
1e18795d29 Update leenkx/blender/lnx/logicnode/string/LN_concatenate_string.py 2025-04-06 09:40:14 +00:00
9557b82970 Update leenkx/blender/lnx/props_renderpath.py 2025-04-05 13:27:30 +00:00
88949c63c5 Update leenkx/Shaders/std/tonemap.glsl 2025-04-05 13:11:56 +00:00
7cab325397 Update leenkx/blender/lnx/props_renderpath.py 2025-04-05 13:10:44 +00:00
8792ef5cee Update leenkx/blender/lnx/props_renderpath.py 2025-04-05 10:54:48 +00:00
761b1832ad Update leenkx/Shaders/compositor_pass/compositor_pass.frag.glsl 2025-04-05 10:47:18 +00:00
074a51866f Update leenkx/blender/lnx/props_renderpath.py 2025-04-05 10:24:00 +00:00
c382460355 Update leenkx/blender/lnx/props_renderpath.py 2025-04-05 09:02:03 +00:00
4a3544b5d8 Update leenkx/Shaders/compositor_pass/compositor_pass.frag.glsl 2025-04-05 08:59:31 +00:00
7cebe8340f Update leenkx/blender/lnx/props_renderpath.py 2025-04-05 08:57:20 +00:00
ecaea8ad9d Merge pull request 'AgX color space' (#40) from Onek8/LNXSDK:main into main
Reviewed-on: LeenkxTeam/LNXSDK#40
2025-04-05 08:27:30 +00:00
cae7963b21 Update leenkx/Shaders/compositor_pass/compositor_pass.frag.glsl 2025-04-05 08:25:54 +00:00
7a2976ced1 Update leenkx/blender/lnx/props_renderpath.py 2025-04-05 08:18:32 +00:00
aae64aa8f8 Update leenkx/Shaders/std/tonemap.glsl 2025-04-05 08:12:43 +00:00
ef25d15aed Merge pull request 'Update leenkx/Shaders/voxel_resolve_specular/voxel_resolve_specular.comp.glsl' (#35) from Onek8/LNXSDK:main into main
Reviewed-on: LeenkxTeam/LNXSDK#35
2025-04-04 20:47:40 +00:00
01bcf029f9 Update leenkx/Shaders/voxel_resolve_specular/voxel_resolve_specular.comp.glsl 2025-04-04 20:42:41 +00:00
2b9baef712 Merge pull request 'Update' (#24) from Onek8/LNXSDK:main into main
Reviewed-on: LeenkxTeam/LNXSDK#24
2025-04-03 20:57:15 +00:00
489057018e Update leenkx/blender/lnx/material/cycles_nodes/nodes_shader.py 2025-04-03 16:59:29 +00:00
501a064d25 Update leenkx/Shaders/voxel_resolve_specular/voxel_resolve_specular.comp.glsl 2025-04-03 16:20:12 +00:00
9478e4e957 Merge pull request 'Audio flag to prevent crashing when audio is disabled' (#22) from Onek8/LNXSDK:main into main
Reviewed-on: LeenkxTeam/LNXSDK#22
2025-04-03 12:38:38 +00:00
32c6535f8a Update leenkx/Sources/leenkx/logicnode/StopSoundNode.hx 2025-04-03 12:36:33 +00:00
21c2abe67c Update leenkx/Sources/leenkx/logicnode/SetVolumeSoundNode.hx 2025-04-03 12:35:51 +00:00
2b1b56bc0a Update leenkx/Sources/leenkx/logicnode/SetSoundNode.hx 2025-04-03 12:35:02 +00:00
9e47c1db6d Update leenkx/Sources/leenkx/logicnode/PlaySoundRawNode.hx 2025-04-03 12:34:08 +00:00
6be977da7e Update leenkx/Sources/leenkx/logicnode/PlaySoundNode.hx 2025-04-03 12:30:45 +00:00
693fa36ee1 Update leenkx/Sources/leenkx/logicnode/PauseSoundNode.hx 2025-04-03 12:30:03 +00:00
6ec480930a Merge pull request 'More 4.4 updates' (#17) from Onek8/LNXSDK:main into main
Reviewed-on: LeenkxTeam/LNXSDK#17
2025-04-03 10:06:05 +00:00
a627a52d46 Update leenkx/blender/lnx/logicnode/logic/LN_output_sequence.py 2025-04-03 10:04:43 +00:00
be63323c09 Update leenkx/blender/lnx/logicnode/logic/LN_merge.py 2025-04-03 10:04:15 +00:00
38595db46b Update leenkx/blender/lnx/logicnode/logic/LN_gate.py 2025-04-03 10:03:25 +00:00
48d28f6873 Update leenkx/blender/lnx/logicnode/logic/LN_function.py 2025-04-03 10:02:33 +00:00
eb033149a0 Update leenkx/blender/lnx/logicnode/logic/LN_case_index.py 2025-04-03 10:01:30 +00:00
db1c3bdf4c Update leenkx/blender/lnx/logicnode/logic/LN_call_function.py 2025-04-03 09:59:20 +00:00
2b16b565a8 Update leenkx/blender/lnx/logicnode/logic/LN_alternate_output.py 2025-04-03 09:57:33 +00:00
8c758bf51f Update leenkx/blender/lnx/logicnode/input/LN_on_swipe.py 2025-04-03 09:46:41 +00:00
1764081740 Update leenkx/blender/lnx/logicnode/draw/LN_draw_polygon.py 2025-04-03 09:45:19 +00:00
c90bde8719 Update leenkx/blender/lnx/logicnode/draw/LN_draw_camera.py 2025-04-03 09:44:34 +00:00
bfb11275df Update leenkx/blender/lnx/logicnode/custom/LN_touch_pad.py 2025-04-03 09:43:48 +00:00
3185f61f39 Update leenkx/blender/lnx/logicnode/custom/LN_set_element_data.py 2025-04-03 09:43:13 +00:00
fb00ca88ff Update leenkx/blender/lnx/logicnode/custom/LN_seed_torrent.py 2025-04-03 09:42:15 +00:00
78109cfee2 Update leenkx/blender/lnx/logicnode/custom/LN_leenkx_send_message.py 2025-04-03 09:41:20 +00:00
fa65c02e8a Update leenkx/blender/lnx/logicnode/custom/LN_leenkx_event.py 2025-04-03 09:37:54 +00:00
cb93ede7d7 Update leenkx/blender/lnx/logicnode/custom/LN_create_torrent.py 2025-04-03 09:37:04 +00:00
2a3f8db0bc Update leenkx/blender/lnx/logicnode/custom/LN_create_style.py 2025-04-03 09:36:23 +00:00
3ab9123000 Update leenkx/blender/lnx/logicnode/custom/LN_call_wasm.py 2025-04-03 09:34:57 +00:00
d6b4b6eeea Update leenkx/blender/lnx/logicnode/custom/LN_add_torrent.py 2025-04-03 09:34:21 +00:00
2f1e6783a4 Update leenkx/blender/lnx/logicnode/array/LN_array_vector.py 2025-04-03 09:33:39 +00:00
603a976adf Update leenkx/blender/lnx/logicnode/array/LN_array_string.py 2025-04-03 09:32:59 +00:00
1e0d32a88d Update leenkx/blender/lnx/logicnode/array/LN_array_object.py 2025-04-03 09:32:27 +00:00
82a7075308 Update leenkx/blender/lnx/logicnode/array/LN_array_integer.py 2025-04-03 09:31:30 +00:00
de8f7d08ed Update leenkx/blender/lnx/logicnode/array/LN_array_float.py 2025-04-03 09:30:57 +00:00
caf95e2611 Update leenkx/blender/lnx/logicnode/array/LN_array_color.py 2025-04-03 09:30:04 +00:00
b639f06aba Update leenkx/blender/lnx/logicnode/array/LN_array_boolean.py 2025-04-03 09:29:40 +00:00
de41800e1c Update leenkx/blender/lnx/logicnode/array/LN_array_add.py 2025-04-03 09:28:34 +00:00
d2746fb087 Update leenkx/blender/lnx/logicnode/array/LN_array.py 2025-04-03 09:27:55 +00:00
62d3e65796 Update leenkx/blender/lnx/logicnode/animation/LN_switch_action_multi.py 2025-04-03 09:27:03 +00:00
74473087b5 Update leenkx/blender/lnx/logicnode/animation/LN_one_shot_action_multi.py 2025-04-03 09:26:00 +00:00
392da64d1f Update leenkx/blender/lnx/logicnode/animation/LN_blend_space_gpu.py 2025-04-03 09:24:45 +00:00
30748390ca Update Kha/Kinc/Backends/System/Linux/Sources/kinc/backend/sound.c.h 2025-04-03 06:41:21 +00:00
f9d463ca1d Update leenkx/blender/lnx/exporter.py 2025-03-31 21:06:33 +00:00
b8771e9d81 Update leenkx/blender/lnx/props.py 2025-03-31 20:17:15 +00:00
1f52eed66c Update leenkx/blender/lnx/material/cycles_nodes/nodes_shader.py 2025-03-31 16:18:28 +00:00
e562b626cb Merge pull request 'main' (#10) from Onek8/LNXSDK:main into main
Reviewed-on: LeenkxTeam/LNXSDK#10
2025-03-31 13:54:10 +00:00
ccb554ba16 Update leenkx/blender/lnx/utils.py 2025-03-31 13:51:58 +00:00
972775b432 Upload files to "Krom" 2025-03-31 11:28:16 +00:00
ee984c332e Update leenkx/Shaders/std/shadows.glsl 2025-03-31 10:07:41 +00:00
038e5123c9 Merge pull request 'Update leenkx/Sources/leenkx/logicnode/ApplyForceNode.hx' (#9) from Onek8/LNXSDK:main into main
Reviewed-on: LeenkxTeam/LNXSDK#9
2025-03-28 18:13:48 +00:00
b5575e5a48 Update leenkx/Sources/leenkx/logicnode/ApplyForceNode.hx 2025-03-28 18:12:17 +00:00
76d79e6e18 Merge pull request 'Update leenkx/Sources/iron/object/Animation.hx' (#8) from Onek8/LNXSDK:main into main
Reviewed-on: LeenkxTeam/LNXSDK#8
2025-03-27 21:22:55 +00:00
ca8fd0b357 Update leenkx/Sources/iron/object/Animation.hx 2025-03-27 21:20:54 +00:00
87fa82e3d3 Merge pull request 'main' (#6) from Onek8/LNXSDK:main into main
Reviewed-on: LeenkxTeam/LNXSDK#6
2025-03-25 23:36:02 +00:00
9fa58d9d7c Update leenkx/blender/lnx/logicnode/lnx_sockets.py 2025-03-25 23:34:47 +00:00
864568d66b Update leenkx/blender/lnx/node_utils.py 2025-03-25 23:29:22 +00:00
f3e96546ae Update leenkx/blender/lnx/logicnode/lnx_sockets.py 2025-03-25 19:52:50 +00:00
fcc114aed3 Update leenkx.py 2025-03-25 19:26:40 +00:00
df33848bee Merge pull request 'Animation fixes' (#5) from Onek8/LNXSDK:main into main
Reviewed-on: LeenkxTeam/LNXSDK#5
2025-03-24 16:30:58 +00:00
c17516a4e2 Update leenkx/blender/lnx/logicnode/animation/LN_blend_space_gpu.py 2025-03-24 16:28:49 +00:00
9b9acd5e15 Update leenkx/blender/lnx/logicnode/lnx_sockets.py 2025-03-24 16:27:16 +00:00
3b0eb0e075 Update leenkx/blender/lnx/logicnode/animation/LN_bone_ik.py 2025-03-24 16:25:00 +00:00
f5b3da3a15 Update leenkx/blender/lnx/logicnode/animation/LN_blend_action.py 2025-03-24 16:22:49 +00:00
b71275d0d5 Merge pull request 'Update leenkx/blender/lnx/make.py' (#4) from Onek8/LNXSDK:main into main
Reviewed-on: LeenkxTeam/LNXSDK#4
2025-03-23 16:47:47 +00:00
6aeb9b0f22 Update leenkx/blender/lnx/make.py 2025-03-23 16:46:18 +00:00
609477737e Update leenkx/blender/lnx/make.py 2025-03-23 13:17:06 +00:00
a747f89438 Update leenkx/blender/lnx/props.py 2025-03-19 16:26:03 +00:00
0bd0c57a00 Update leenkx/blender/lnx/write_data.py 2025-03-19 16:24:04 +00:00
f3ab801928 Update leenkx/blender/lnx/write_data.py 2025-03-19 12:36:00 +00:00
9b821d4b8e Update leenkx/blender/lnx/props.py 2025-03-19 12:34:18 +00:00
f2a0dbe36c Update leenkx/Shaders/std/shadows.glsl 2025-03-17 20:31:43 +00:00
12e66d8cf1 Update leenkx/Sources/leenkx/trait/physics/bullet/PhysicsWorld.hx 2025-03-15 21:23:07 +00:00
4b6424b702 Update leenkx/Shaders/ssrefr_pass/ssrefr_pass.frag.glsl 2025-03-15 15:44:22 +00:00
e66e082cc7 Update leenkx/blender/lnx/material/make_cluster.py 2025-03-15 07:22:49 +00:00
42eff22cbb Update leenkx/Shaders/std/shadows.glsl 2025-03-14 19:59:02 +00:00
448898a634 Update leenkx/blender/lnx/write_data.py 2025-03-14 17:33:00 +00:00
15ec41b1f0 Update leenkx/blender/lnx/material/make_mesh.py 2025-03-14 11:04:03 +00:00
c5a7746c84 Update leenkx/Sources/leenkx/logicnode/SetBoneTransformNode.hx 2025-03-12 13:02:09 +00:00
51aa8ea1d4 Upload files to "leenkx/Sources/leenkx/logicnode" 2025-03-12 13:00:54 +00:00
ccdfc4246f Upload files to "leenkx/blender/lnx/logicnode/animation" 2025-03-12 13:00:13 +00:00
aead4c4903 Update leenkx/Sources/leenkx/logicnode/SetParentBoneNode.hx 2025-03-11 19:00:35 +00:00
d2f4c0e221 Update leenkx/blender/lnx/logicnode/animation/LN_set_parent_bone.py 2025-03-11 18:59:58 +00:00
887eeebe27 Update leenkx/Sources/leenkx/logicnode/PlayActionFromNode.hx.backup 2025-03-11 18:57:52 +00:00
83077e3f15 Update leenkx/Sources/leenkx/logicnode/TouchPadNode.hx.backup 2025-03-11 18:57:25 +00:00
f5c20c5a13 Update leenkx/Sources/leenkx/logicnode/AudioHRTFPannerNode.hx 2025-03-11 18:56:39 +00:00
4bd4995b6e Update leenkx/Sources/leenkx/logicnode/SetParentBoneNode.hx 2025-03-11 11:27:26 +00:00
381744e678 Update leenkx/blender/lnx/logicnode/animation/LN_set_parent_bone.py 2025-03-11 11:26:34 +00:00
34c15c29cd Update leenkx/blender/lnx/props_ui.py 2025-03-07 11:15:32 +00:00
0346e27657 Update leenkx/blender/lnx/props_ui.py 2025-03-07 11:14:50 +00:00
9087b9c98c Update leenkx/Sources/zui/Zui.hx 2025-03-07 11:05:17 +00:00
f2cbcc88a7 moisesjpelaez - Enable touch input from mobile browsers #3129 2025-03-07 11:03:28 +00:00
b8d9ea2aff Update leenkx/Sources/leenkx/logicnode/GetBoneTransformNode.hx 2025-02-08 21:19:41 +00:00
37a09d0a21 Update leenkx/blender/lnx/keymap.py 2025-02-08 17:29:46 +00:00
ed932e3fa4 Update leenkx/blender/lnx/material/cycles_nodes/nodes_shader.py 2025-02-06 17:13:41 +00:00
f00edd882f Update leenkx/blender/lnx/material/cycles_nodes/nodes_shader.py 2025-02-06 17:08:33 +00:00
f403955fcd Update leenkx/blender/lnx/utils.py 2025-02-05 23:03:31 +00:00
a562af9b60 Update Kha/Backends/Kinc-HL/kinc-bridge/shader.c.h 2025-02-01 17:09:05 +00:00
bdd9b0197f Update lib/aura/Backends/hl/aura/math/FFT.h 2025-02-01 16:02:29 +00:00
f200933375 Update lib/aura/Backends/hl/aura/aurahl.c 2025-02-01 14:18:03 +00:00
829ef5f269 Update Kha/Kinc/Sources/kinc/input/gamepad.h 2025-02-01 14:10:05 +00:00
0d73133f36 Update Kha/Backends/Kinc-HL/kinc-bridge/system.c.h 2025-02-01 14:08:47 +00:00
181b860360 Update Kha/Backends/Kinc-HL/kinc-bridge/kinc.c.h 2025-02-01 13:53:43 +00:00
20db9cc24d Update Kha/Backends/Kinc-HL/kinc-bridge/compute.c.h 2025-02-01 12:16:54 +00:00
c67b38ea1e Update Compute Shader 2025-01-31 20:35:00 +00:00
adb95eab1e Hashlink Voxels Fix 2025-01-31 20:05:18 +00:00
93addd1200 Update Kha/Backends/Kinc-HL/hl/include/mbedtls/library/entropy_poll.c 2025-01-31 20:00:32 +00:00
7f9a7c9b4a Update leenkx/blender/lnx/material/make_mesh.py 2025-01-31 12:37:04 +00:00
7433409cda Anti aliasing only working with TAA 2025-01-31 08:56:57 +00:00
2a6e05aff1 Update new repo node links 2025-01-31 07:17:39 +00:00
348d7bf343 Merge pull request 'More 4.3 + support' (#3) from Onek8/LNXSDK:main into main
Reviewed-on: LeenkxTeam/LNXSDK#3
2025-01-30 13:43:29 +00:00
4c6df16aa7 Update leenkx/blender/lnx/write_data.py 2025-01-30 13:39:55 +00:00
8a7f5ee519 Update leenkx/blender/lnx/props_ui.py 2025-01-30 13:21:20 +00:00
1958342a74 Add leenkx/blender/lnx/logicnode/browser/LN_detect_mobile_browser.py 2025-01-29 08:11:04 +00:00
16e8e00783 Delete leenkx/blender/lnx/logicnode/native/LN_detect_mobile_browser.py 2025-01-29 08:10:15 +00:00
bcdcbfb106 Delete leenkx/blender/lnx/logicnode/native/LN_loadUrl.py 2025-01-29 08:09:43 +00:00
28afefbbf7 Add leenkx/blender/lnx/logicnode/browser/LN_loadUrl.py 2025-01-29 08:04:56 +00:00
3d2130e26a Delete leenkx/blender/lnx/logicnode/browser/LN_loadUrl.py 2025-01-27 11:58:52 +00:00
9761719dd5 Delete leenkx/blender/lnx/logicnode/browser/LN_detect_mobile_browser.py 2025-01-27 11:58:45 +00:00
b2a781c7c2 Update leenkx/blender/lnx/material/make_mesh.py 2025-01-24 11:45:21 +00:00
7121737297 Fix missing export 2025-01-24 11:41:47 +00:00
b0991a8928 Update README.md 2025-01-24 08:38:05 +00:00
b84fc93899 Update leenkx/blender/lnx/material/make_mesh.py 2025-01-24 08:03:17 +00:00
06c0c430a8 Update leenkx/blender/lnx/utils.py 2025-01-23 17:15:03 +00:00
0f0c67dc07 Update leenkx/blender/lnx/utils.py 2025-01-23 17:07:29 +00:00
3bb2d65faa Update leenkx.py 2025-01-23 17:05:07 +00:00
20e33afeac Merge pull request 'main' (#2) from Onek8/LNXSDK:main into main
Reviewed-on: LeenkxTeam/LNXSDK#2
2025-01-23 16:09:12 +00:00
165 changed files with 5034 additions and 4188 deletions

View File

@ -1,268 +1,268 @@
/*
* Platform-specific and custom entropy polling functions
*
* Copyright (C) 2006-2016, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is part of mbed TLS (https://tls.mbed.org)
*/
#if !defined(MBEDTLS_CONFIG_FILE)
#include "mbedtls/config.h"
#else
#include MBEDTLS_CONFIG_FILE
#endif
#if defined(MBEDTLS_ENTROPY_C)
#include "mbedtls/entropy.h"
#include "mbedtls/entropy_poll.h"
#if defined(MBEDTLS_TIMING_C)
#include <string.h>
#include "mbedtls/timing.h"
#endif
#if defined(MBEDTLS_HAVEGE_C)
#include "mbedtls/havege.h"
#endif
#if defined(MBEDTLS_ENTROPY_NV_SEED)
#include "mbedtls/platform.h"
#endif
#if !defined(MBEDTLS_NO_PLATFORM_ENTROPY)
#if !defined(unix) && !defined(__unix__) && !defined(__unix) && \
!defined(__APPLE__) && !defined(_WIN32)
#error "Platform entropy sources only work on Unix and Windows, see MBEDTLS_NO_PLATFORM_ENTROPY in config.h"
#endif
#if defined(_WIN32) && !defined(EFIX64) && !defined(EFI32)
#if !defined(_WIN32_WINNT)
#define _WIN32_WINNT 0x0400
#endif
#include <windows.h>
#include <wincrypt.h>
int mbedtls_platform_entropy_poll( void *data, unsigned char *output, size_t len,
size_t *olen )
{
HCRYPTPROV provider;
((void) data);
*olen = 0;
if( CryptAcquireContext( &provider, NULL, NULL,
PROV_RSA_FULL, CRYPT_VERIFYCONTEXT ) == FALSE )
{
return( MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
}
if( CryptGenRandom( provider, (DWORD) len, output ) == FALSE )
{
CryptReleaseContext( provider, 0 );
return( MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
}
CryptReleaseContext( provider, 0 );
*olen = len;
return( 0 );
}
#else /* _WIN32 && !EFIX64 && !EFI32 */
/*
* Test for Linux getrandom() support.
* Since there is no wrapper in the libc yet, use the generic syscall wrapper
* available in GNU libc and compatible libc's (eg uClibc).
*/
#if defined(__linux__) && defined(__GLIBC__)
#include <unistd.h>
#include <sys/syscall.h>
#if defined(SYS_getrandom)
#define HAVE_GETRANDOM
static int getrandom_wrapper( void *buf, size_t buflen, unsigned int flags )
{
/* MemSan cannot understand that the syscall writes to the buffer */
#if defined(__has_feature)
#if __has_feature(memory_sanitizer)
memset( buf, 0, buflen );
#endif
#endif
return( syscall( SYS_getrandom, buf, buflen, flags ) );
}
#include <sys/utsname.h>
/* Check if version is at least 3.17.0 */
static int check_version_3_17_plus( void )
{
int minor;
struct utsname un;
const char *ver;
/* Get version information */
uname(&un);
ver = un.release;
/* Check major version; assume a single digit */
if( ver[0] < '3' || ver[0] > '9' || ver [1] != '.' )
return( -1 );
if( ver[0] - '0' > 3 )
return( 0 );
/* Ok, so now we know major == 3, check minor.
* Assume 1 or 2 digits. */
if( ver[2] < '0' || ver[2] > '9' )
return( -1 );
minor = ver[2] - '0';
if( ver[3] >= '0' && ver[3] <= '9' )
minor = 10 * minor + ver[3] - '0';
else if( ver [3] != '.' )
return( -1 );
if( minor < 17 )
return( -1 );
return( 0 );
}
static int has_getrandom = -1;
#endif /* SYS_getrandom */
#endif /* __linux__ */
#include <stdio.h>
int mbedtls_platform_entropy_poll( void *data,
unsigned char *output, size_t len, size_t *olen )
{
FILE *file;
size_t read_len;
((void) data);
#if defined(HAVE_GETRANDOM)
if( has_getrandom == -1 )
has_getrandom = ( check_version_3_17_plus() == 0 );
if( has_getrandom )
{
int ret;
if( ( ret = getrandom_wrapper( output, len, 0 ) ) < 0 )
return( MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
*olen = ret;
return( 0 );
}
#endif /* HAVE_GETRANDOM */
*olen = 0;
file = fopen( "/dev/urandom", "rb" );
if( file == NULL )
return( MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
read_len = fread( output, 1, len, file );
if( read_len != len )
{
fclose( file );
return( MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
}
fclose( file );
*olen = len;
return( 0 );
}
#endif /* _WIN32 && !EFIX64 && !EFI32 */
#endif /* !MBEDTLS_NO_PLATFORM_ENTROPY */
#if defined(MBEDTLS_TEST_NULL_ENTROPY)
int mbedtls_null_entropy_poll( void *data,
unsigned char *output, size_t len, size_t *olen )
{
((void) data);
((void) output);
*olen = 0;
if( len < sizeof(unsigned char) )
return( 0 );
*olen = sizeof(unsigned char);
return( 0 );
}
#endif
#if defined(MBEDTLS_TIMING_C)
int mbedtls_hardclock_poll( void *data,
unsigned char *output, size_t len, size_t *olen )
{
unsigned long timer = mbedtls_timing_hardclock();
((void) data);
*olen = 0;
if( len < sizeof(unsigned long) )
return( 0 );
memcpy( output, &timer, sizeof(unsigned long) );
*olen = sizeof(unsigned long);
return( 0 );
}
#endif /* MBEDTLS_TIMING_C */
#if defined(MBEDTLS_HAVEGE_C)
int mbedtls_havege_poll( void *data,
unsigned char *output, size_t len, size_t *olen )
{
mbedtls_havege_state *hs = (mbedtls_havege_state *) data;
*olen = 0;
if( mbedtls_havege_random( hs, output, len ) != 0 )
return( MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
*olen = len;
return( 0 );
}
#endif /* MBEDTLS_HAVEGE_C */
#if defined(MBEDTLS_ENTROPY_NV_SEED)
int mbedtls_nv_seed_poll( void *data,
unsigned char *output, size_t len, size_t *olen )
{
unsigned char buf[MBEDTLS_ENTROPY_BLOCK_SIZE];
size_t use_len = MBEDTLS_ENTROPY_BLOCK_SIZE;
((void) data);
memset( buf, 0, MBEDTLS_ENTROPY_BLOCK_SIZE );
if( mbedtls_nv_seed_read( buf, MBEDTLS_ENTROPY_BLOCK_SIZE ) < 0 )
return( MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
if( len < use_len )
use_len = len;
memcpy( output, buf, use_len );
*olen = use_len;
return( 0 );
}
#endif /* MBEDTLS_ENTROPY_NV_SEED */
#endif /* MBEDTLS_ENTROPY_C */
/*
* Platform-specific and custom entropy polling functions
*
* Copyright (C) 2006-2016, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is part of mbed TLS (https://tls.mbed.org)
*/
#define _GNU_SOURCE
#if !defined(MBEDTLS_CONFIG_FILE)
#include "mbedtls/config.h"
#else
#include MBEDTLS_CONFIG_FILE
#endif
#if defined(MBEDTLS_ENTROPY_C)
#include "mbedtls/entropy.h"
#include "mbedtls/entropy_poll.h"
#if defined(MBEDTLS_TIMING_C)
#include <string.h>
#include "mbedtls/timing.h"
#endif
#if defined(MBEDTLS_HAVEGE_C)
#include "mbedtls/havege.h"
#endif
#if defined(MBEDTLS_ENTROPY_NV_SEED)
#include "mbedtls/platform.h"
#endif
#if !defined(MBEDTLS_NO_PLATFORM_ENTROPY)
#if !defined(unix) && !defined(__unix__) && !defined(__unix) && \
!defined(__APPLE__) && !defined(_WIN32)
#error "Platform entropy sources only work on Unix and Windows, see MBEDTLS_NO_PLATFORM_ENTROPY in config.h"
#endif
#if defined(_WIN32) && !defined(EFIX64) && !defined(EFI32)
#if !defined(_WIN32_WINNT)
#define _WIN32_WINNT 0x0400
#endif
#include <windows.h>
#include <wincrypt.h>
int mbedtls_platform_entropy_poll( void *data, unsigned char *output, size_t len,
size_t *olen )
{
HCRYPTPROV provider;
((void) data);
*olen = 0;
if( CryptAcquireContext( &provider, NULL, NULL,
PROV_RSA_FULL, CRYPT_VERIFYCONTEXT ) == FALSE )
{
return( MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
}
if( CryptGenRandom( provider, (DWORD) len, output ) == FALSE )
{
CryptReleaseContext( provider, 0 );
return( MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
}
CryptReleaseContext( provider, 0 );
*olen = len;
return( 0 );
}
#else /* _WIN32 && !EFIX64 && !EFI32 */
/*
* Test for Linux getrandom() support.
* Since there is no wrapper in the libc yet, use the generic syscall wrapper
* available in GNU libc and compatible libc's (eg uClibc).
*/
#if defined(__linux__) && defined(__GLIBC__)
#include <unistd.h>
#include <sys/syscall.h>
#if defined(SYS_getrandom)
#define HAVE_GETRANDOM
static int getrandom_wrapper( void *buf, size_t buflen, unsigned int flags )
{
/* MemSan cannot understand that the syscall writes to the buffer */
#if defined(__has_feature)
#if __has_feature(memory_sanitizer)
memset( buf, 0, buflen );
#endif
#endif
return( syscall( SYS_getrandom, buf, buflen, flags ) );
}
#include <sys/utsname.h>
/* Check if version is at least 3.17.0 */
static int check_version_3_17_plus( void )
{
int minor;
struct utsname un;
const char *ver;
/* Get version information */
uname(&un);
ver = un.release;
/* Check major version; assume a single digit */
if( ver[0] < '3' || ver[0] > '9' || ver [1] != '.' )
return( -1 );
if( ver[0] - '0' > 3 )
return( 0 );
/* Ok, so now we know major == 3, check minor.
* Assume 1 or 2 digits. */
if( ver[2] < '0' || ver[2] > '9' )
return( -1 );
minor = ver[2] - '0';
if( ver[3] >= '0' && ver[3] <= '9' )
minor = 10 * minor + ver[3] - '0';
else if( ver [3] != '.' )
return( -1 );
if( minor < 17 )
return( -1 );
return( 0 );
}
static int has_getrandom = -1;
#endif /* SYS_getrandom */
#endif /* __linux__ */
#include <stdio.h>
int mbedtls_platform_entropy_poll( void *data,
unsigned char *output, size_t len, size_t *olen )
{
FILE *file;
size_t read_len;
((void) data);
#if defined(HAVE_GETRANDOM)
if( has_getrandom == -1 )
has_getrandom = ( check_version_3_17_plus() == 0 );
if( has_getrandom )
{
int ret;
if( ( ret = getrandom_wrapper( output, len, 0 ) ) < 0 )
return( MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
*olen = ret;
return( 0 );
}
#endif /* HAVE_GETRANDOM */
*olen = 0;
file = fopen( "/dev/urandom", "rb" );
if( file == NULL )
return( MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
read_len = fread( output, 1, len, file );
if( read_len != len )
{
fclose( file );
return( MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
}
fclose( file );
*olen = len;
return( 0 );
}
#endif /* _WIN32 && !EFIX64 && !EFI32 */
#endif /* !MBEDTLS_NO_PLATFORM_ENTROPY */
#if defined(MBEDTLS_TEST_NULL_ENTROPY)
int mbedtls_null_entropy_poll( void *data,
unsigned char *output, size_t len, size_t *olen )
{
((void) data);
((void) output);
*olen = 0;
if( len < sizeof(unsigned char) )
return( 0 );
*olen = sizeof(unsigned char);
return( 0 );
}
#endif
#if defined(MBEDTLS_TIMING_C)
int mbedtls_hardclock_poll( void *data,
unsigned char *output, size_t len, size_t *olen )
{
unsigned long timer = mbedtls_timing_hardclock();
((void) data);
*olen = 0;
if( len < sizeof(unsigned long) )
return( 0 );
memcpy( output, &timer, sizeof(unsigned long) );
*olen = sizeof(unsigned long);
return( 0 );
}
#endif /* MBEDTLS_TIMING_C */
#if defined(MBEDTLS_HAVEGE_C)
int mbedtls_havege_poll( void *data,
unsigned char *output, size_t len, size_t *olen )
{
mbedtls_havege_state *hs = (mbedtls_havege_state *) data;
*olen = 0;
if( mbedtls_havege_random( hs, output, len ) != 0 )
return( MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
*olen = len;
return( 0 );
}
#endif /* MBEDTLS_HAVEGE_C */
#if defined(MBEDTLS_ENTROPY_NV_SEED)
int mbedtls_nv_seed_poll( void *data,
unsigned char *output, size_t len, size_t *olen )
{
unsigned char buf[MBEDTLS_ENTROPY_BLOCK_SIZE];
size_t use_len = MBEDTLS_ENTROPY_BLOCK_SIZE;
((void) data);
memset( buf, 0, MBEDTLS_ENTROPY_BLOCK_SIZE );
if( mbedtls_nv_seed_read( buf, MBEDTLS_ENTROPY_BLOCK_SIZE ) < 0 )
return( MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
if( len < use_len )
use_len = len;
memcpy( output, buf, use_len );
*olen = use_len;
return( 0 );
}
#endif /* MBEDTLS_ENTROPY_NV_SEED */
#endif /* MBEDTLS_ENTROPY_C */

View File

@ -9,6 +9,7 @@ if (platform == Platform.OSX) project.addDefine('KORE_DEBUGDIR="osx-hl"');
if (platform == Platform.iOS) project.addDefine('KORE_DEBUGDIR="ios-hl"');
if (platform !== Platform.Windows || audio !== AudioApi.DirectSound) {
project.addDefine('KORE_MULTITHREADED_AUDIO');
project.addDefine('KINC_MULTITHREADED_AUDIO');
}
project.addDefine('KORE');

View File

@ -1,31 +1,70 @@
package kha.graphics4;
import kha.Blob;
class FragmentShader {
public var _shader: Pointer;
public function new(sources: Array<Blob>, files: Array<String>) {
initShader(sources[0]);
}
function initShader(source: Blob): Void {
_shader = kinc_create_fragmentshader(source.bytes.getData(), source.bytes.getData().length);
}
public static function fromSource(source: String): FragmentShader {
var sh = new FragmentShader(null, null);
sh._shader = kinc_fragmentshader_from_source(StringHelper.convert(source));
return sh;
}
public function delete(): Void {}
@:hlNative("std", "kinc_create_fragmentshader") static function kinc_create_fragmentshader(data: hl.Bytes, length: Int): Pointer {
return null;
}
@:hlNative("std", "kinc_fragmentshader_from_source") static function kinc_fragmentshader_from_source(source: hl.Bytes): Pointer {
return null;
}
}
package kha.graphics4;
using StringTools;
import kha.Blob;
class FragmentShader {
public var _shader: Pointer;
public function new(sources: Array<Blob>, files: Array<String>) {
//initShader(sources[0]);
var shaderBlob: Blob = null;
var shaderFile: String = null;
#if kha_opengl
final expectedExtension = ".glsl";
#elseif kha_direct3d11
final expectedExtension = ".d3d11";
#elseif kha_direct3d12
final expectedExtension = ".d3d12";
#elseif kha_metal
final expectedExtension = ".metal";
#elseif kha_vulkan
final expectedExtension = ".spirv";
#else
final expectedExtension = ".glsl";
#end
if (sources != null && files != null) {
for (i in 0...files.length) {
if (files[i].endsWith(expectedExtension)) {
shaderBlob = sources[i];
shaderFile = files[i];
break;
}
}
}
if (shaderBlob == null && sources != null && sources.length > 0) {
trace('Warning: Could not find shader with extension ${expectedExtension}. Falling back to sources[0]: ${files != null && files.length > 0 ? files[0] : "Unknown"}');
shaderBlob = sources[0];
}
if (shaderBlob != null) {
initShader(shaderBlob);
} else {
trace('Error: No suitable fragment shader source found!');
}
}
function initShader(source: Blob): Void {
//_shader = kinc_create_fragmentshader(source.bytes.getData(), source.bytes.getData().length);
_shader = kinc_create_fragmentshader(source.bytes.getData(), source.length); // Use source.length here
}
public static function fromSource(source: String): FragmentShader {
var sh = new FragmentShader(null, null);
sh._shader = kinc_fragmentshader_from_source(StringHelper.convert(source));
return sh;
}
public function delete(): Void {}
@:hlNative("std", "kinc_create_fragmentshader") static function kinc_create_fragmentshader(data: hl.Bytes, length: Int): Pointer {
return null;
}
@:hlNative("std", "kinc_fragmentshader_from_source") static function kinc_fragmentshader_from_source(source: hl.Bytes): Pointer {
return null;
}
}

View File

@ -1,179 +1,38 @@
#include <kinc/compute/compute.h>
#include <kinc/graphics4/compute.h>
#include <kinc/graphics4/texture.h>
#include <hl.h>
vbyte *hl_kinc_compute_create_shader(vbyte *data, int length) {
kinc_compute_shader_t *shader = (kinc_compute_shader_t *)malloc(sizeof(kinc_compute_shader_t));
kinc_compute_shader_init(shader, data, length);
kinc_g4_compute_shader *shader = (kinc_g4_compute_shader *)malloc(sizeof(kinc_g4_compute_shader));
kinc_g4_compute_shader_init(shader, data, length);
return (vbyte *)shader;
}
void hl_kinc_compute_delete_shader(vbyte *shader) {
kinc_compute_shader_t *sh = (kinc_compute_shader_t *)shader;
kinc_compute_shader_destroy(sh);
kinc_g4_compute_shader *sh = (kinc_g4_compute_shader *)shader;
kinc_g4_compute_shader_destroy(sh);
free(sh);
}
vbyte *hl_kinc_compute_get_constantlocation(vbyte *shader, vbyte *name) {
kinc_compute_shader_t *sh = (kinc_compute_shader_t *)shader;
kinc_compute_constant_location_t *location = (kinc_compute_constant_location_t *)malloc(sizeof(kinc_compute_constant_location_t));
*location = kinc_compute_shader_get_constant_location(sh, (char *)name), sizeof(kinc_compute_constant_location_t);
kinc_g4_compute_shader *sh = (kinc_g4_compute_shader *)shader;
kinc_g4_constant_location_t *location = (kinc_g4_constant_location_t *)malloc(sizeof(kinc_g4_constant_location_t));
*location = kinc_g4_compute_shader_get_constant_location(sh, (char *)name);
return (vbyte *)location;
}
vbyte *hl_kinc_compute_get_textureunit(vbyte *shader, vbyte *name) {
kinc_compute_shader_t *sh = (kinc_compute_shader_t *)shader;
kinc_compute_texture_unit_t *unit = (kinc_compute_texture_unit_t *)malloc(sizeof(kinc_compute_texture_unit_t));
*unit = kinc_compute_shader_get_texture_unit(sh, (char *)name), sizeof(kinc_compute_texture_unit_t);
kinc_g4_compute_shader *sh = (kinc_g4_compute_shader *)shader;
kinc_g4_texture_unit_t *unit = (kinc_g4_texture_unit_t *)malloc(sizeof(kinc_g4_texture_unit_t));
*unit = kinc_g4_compute_shader_get_texture_unit(sh, (char *)name);
return (vbyte *)unit;
}
void hl_kinc_compute_set_bool(vbyte *location, bool value) {
kinc_compute_constant_location_t *loc = (kinc_compute_constant_location_t *)location;
kinc_compute_set_bool(*loc, value);
void hl_kinc_set_compute_shader(vbyte *shader) {
kinc_g4_set_compute_shader((kinc_g4_compute_shader *)shader);
}
void hl_kinc_compute_set_int(vbyte *location, int value) {
kinc_compute_constant_location_t *loc = (kinc_compute_constant_location_t *)location;
kinc_compute_set_int(*loc, value);
}
void hl_kinc_compute_set_float(vbyte *location, float value) {
kinc_compute_constant_location_t *loc = (kinc_compute_constant_location_t *)location;
kinc_compute_set_float(*loc, value);
}
void hl_kinc_compute_set_float2(vbyte *location, float value1, float value2) {
kinc_compute_constant_location_t *loc = (kinc_compute_constant_location_t *)location;
kinc_compute_set_float2(*loc, value1, value2);
}
void hl_kinc_compute_set_float3(vbyte *location, float value1, float value2, float value3) {
kinc_compute_constant_location_t *loc = (kinc_compute_constant_location_t *)location;
kinc_compute_set_float3(*loc, value1, value2, value3);
}
void hl_kinc_compute_set_float4(vbyte *location, float value1, float value2, float value3, float value4) {
kinc_compute_constant_location_t *loc = (kinc_compute_constant_location_t *)location;
kinc_compute_set_float4(*loc, value1, value2, value3, value4);
}
void hl_kinc_compute_set_floats(vbyte *location, vbyte *values, int count) {
kinc_compute_constant_location_t *loc = (kinc_compute_constant_location_t *)location;
kinc_compute_set_floats(*loc, (float *)values, count);
}
void hl_kinc_compute_set_matrix(vbyte *location, float _00, float _10, float _20, float _30, float _01, float _11, float _21, float _31, float _02, float _12,
float _22, float _32, float _03, float _13, float _23, float _33) {
kinc_compute_constant_location_t *loc = (kinc_compute_constant_location_t *)location;
kinc_matrix4x4_t value;
kinc_matrix4x4_set(&value, 0, 0, _00);
kinc_matrix4x4_set(&value, 0, 1, _01);
kinc_matrix4x4_set(&value, 0, 2, _02);
kinc_matrix4x4_set(&value, 0, 3, _03);
kinc_matrix4x4_set(&value, 1, 0, _10);
kinc_matrix4x4_set(&value, 1, 1, _11);
kinc_matrix4x4_set(&value, 1, 2, _12);
kinc_matrix4x4_set(&value, 1, 3, _13);
kinc_matrix4x4_set(&value, 2, 0, _20);
kinc_matrix4x4_set(&value, 2, 1, _21);
kinc_matrix4x4_set(&value, 2, 2, _22);
kinc_matrix4x4_set(&value, 2, 3, _23);
kinc_matrix4x4_set(&value, 3, 0, _30);
kinc_matrix4x4_set(&value, 3, 1, _31);
kinc_matrix4x4_set(&value, 3, 2, _32);
kinc_matrix4x4_set(&value, 3, 3, _33);
kinc_compute_set_matrix4(*loc, &value);
}
void hl_kinc_compute_set_matrix3(vbyte *location, float _00, float _10, float _20, float _01, float _11, float _21, float _02, float _12, float _22) {
kinc_compute_constant_location_t *loc = (kinc_compute_constant_location_t *)location;
kinc_matrix3x3_t value;
kinc_matrix3x3_set(&value, 0, 0, _00);
kinc_matrix3x3_set(&value, 0, 1, _01);
kinc_matrix3x3_set(&value, 0, 2, _02);
kinc_matrix3x3_set(&value, 1, 0, _10);
kinc_matrix3x3_set(&value, 1, 1, _11);
kinc_matrix3x3_set(&value, 1, 2, _12);
kinc_matrix3x3_set(&value, 2, 0, _20);
kinc_matrix3x3_set(&value, 2, 1, _21);
kinc_matrix3x3_set(&value, 2, 2, _22);
kinc_compute_set_matrix3(*loc, &value);
}
void hl_kinc_compute_set_texture(vbyte *unit, vbyte *texture, int access) {
kinc_compute_texture_unit_t *u = (kinc_compute_texture_unit_t *)unit;
kinc_g4_texture_t *tex = (kinc_g4_texture_t *)texture;
kinc_compute_set_texture(*u, tex, (kinc_compute_access_t)access);
}
void hl_kinc_compute_set_target(vbyte *unit, vbyte *renderTarget, int access) {
kinc_compute_texture_unit_t *u = (kinc_compute_texture_unit_t *)unit;
kinc_g4_render_target_t *rt = (kinc_g4_render_target_t *)renderTarget;
kinc_compute_set_render_target(*u, rt, (kinc_compute_access_t)access);
}
void hl_kinc_compute_set_sampled_texture(vbyte *unit, vbyte *texture) {
kinc_compute_texture_unit_t *u = (kinc_compute_texture_unit_t *)unit;
kinc_g4_texture_t *tex = (kinc_g4_texture_t *)texture;
kinc_compute_set_sampled_texture(*u, tex);
}
void hl_kinc_compute_set_sampled_target(vbyte *unit, vbyte *renderTarget) {
kinc_compute_texture_unit_t *u = (kinc_compute_texture_unit_t *)unit;
kinc_g4_render_target_t *rt = (kinc_g4_render_target_t *)renderTarget;
kinc_compute_set_sampled_render_target(*u, rt);
}
void hl_kinc_compute_set_sampled_depth_target(vbyte *unit, vbyte *renderTarget) {
kinc_compute_texture_unit_t *u = (kinc_compute_texture_unit_t *)unit;
kinc_g4_render_target_t *rt = (kinc_g4_render_target_t *)renderTarget;
kinc_compute_set_sampled_depth_from_render_target(*u, rt);
}
void hl_kinc_compute_set_sampled_cubemap_texture(vbyte *unit, vbyte *texture) {
kinc_compute_texture_unit_t *u = (kinc_compute_texture_unit_t *)unit;
kinc_g4_texture_t *tex = (kinc_g4_texture_t *)texture;
kinc_compute_set_sampled_texture(*u, tex);
}
void hl_kinc_compute_set_sampled_cubemap_target(vbyte *unit, vbyte *renderTarget) {
kinc_compute_texture_unit_t *u = (kinc_compute_texture_unit_t *)unit;
kinc_g4_render_target_t *rt = (kinc_g4_render_target_t *)renderTarget;
kinc_compute_set_sampled_render_target(*u, rt);
}
void hl_kinc_compute_set_sampled_cubemap_depth_target(vbyte *unit, vbyte *renderTarget) {
kinc_compute_texture_unit_t *u = (kinc_compute_texture_unit_t *)unit;
kinc_g4_render_target_t *rt = (kinc_g4_render_target_t *)renderTarget;
kinc_compute_set_sampled_depth_from_render_target(*u, rt);
}
void hl_kinc_compute_set_texture_parameters(vbyte *unit, int uAddressing, int vAddressing, int minificationFilter, int magnificationFilter, int mipmapFilter) {
kinc_compute_texture_unit_t *u = (kinc_compute_texture_unit_t *)unit;
kinc_compute_set_texture_addressing(*u, KINC_G4_TEXTURE_DIRECTION_U, (kinc_g4_texture_addressing_t)uAddressing);
kinc_compute_set_texture_addressing(*u, KINC_G4_TEXTURE_DIRECTION_V, (kinc_g4_texture_addressing_t)vAddressing);
kinc_compute_set_texture_minification_filter(*u, (kinc_g4_texture_filter_t)minificationFilter);
kinc_compute_set_texture_magnification_filter(*u, (kinc_g4_texture_filter_t)magnificationFilter);
kinc_compute_set_texture_mipmap_filter(*u, (kinc_g4_mipmap_filter_t)mipmapFilter);
}
void hl_kinc_compute_set_texture3d_parameters(vbyte *unit, int uAddressing, int vAddressing, int wAddressing, int minificationFilter, int magnificationFilter,
int mipmapFilter) {
kinc_compute_texture_unit_t *u = (kinc_compute_texture_unit_t *)unit;
kinc_compute_set_texture3d_addressing(*u, KINC_G4_TEXTURE_DIRECTION_U, (kinc_g4_texture_addressing_t)uAddressing);
kinc_compute_set_texture3d_addressing(*u, KINC_G4_TEXTURE_DIRECTION_V, (kinc_g4_texture_addressing_t)vAddressing);
kinc_compute_set_texture3d_addressing(*u, KINC_G4_TEXTURE_DIRECTION_W, (kinc_g4_texture_addressing_t)wAddressing);
kinc_compute_set_texture3d_minification_filter(*u, (kinc_g4_texture_filter_t)minificationFilter);
kinc_compute_set_texture3d_magnification_filter(*u, (kinc_g4_texture_filter_t)magnificationFilter);
kinc_compute_set_texture3d_mipmap_filter(*u, (kinc_g4_mipmap_filter_t)mipmapFilter);
}
void hl_kinc_compute_set_shader(vbyte *shader) {
kinc_compute_set_shader((kinc_compute_shader_t *)shader);
}
void hl_kinc_compute_compute(int x, int y, int z) {
kinc_compute(x, y, z);
void hl_kinc_compute(int x, int y, int z) {
kinc_g4_compute(x, y, z);
}

View File

@ -1,127 +1,129 @@
#include <kinc/audio2/audio.h>
#include <kinc/graphics4/graphics.h>
#include <kinc/io/filereader.h>
#include <kinc/log.h>
#include <kinc/system.h>
#include <kinc/window.h>
#include <hl.h>
void frame();
static bool visible = true;
static bool paused = false;
typedef void (*FN_AUDIO_CALL_CALLBACK)(int);
typedef float (*FN_AUDIO_READ_SAMPLE)(void);
void (*audioCallCallback)(int);
float (*audioReadSample)(void);
static void update(void *data) {
if (paused) {
return;
}
kinc_a2_update();
int windowCount = kinc_count_windows();
for (int windowIndex = 0; windowIndex < windowCount; ++windowIndex) {
if (visible) {
kinc_g4_begin(windowIndex);
frame();
kinc_g4_end(windowIndex);
}
}
if (!kinc_g4_swap_buffers()) {
kinc_log(KINC_LOG_LEVEL_ERROR, "Graphics context lost.");
}
}
static bool mixThreadregistered = false;
static void mix(kinc_a2_buffer_t *buffer, int samples) {
#ifdef KORE_MULTITHREADED_AUDIO
if (!mixThreadregistered) {
vdynamic *ret;
hl_register_thread(&ret);
mixThreadregistered = true;
}
hl_blocking(true);
#endif
audioCallCallback(samples);
for (int i = 0; i < samples; ++i) {
float value = audioReadSample();
*(float *)&buffer->data[buffer->write_location] = value;
buffer->write_location += 4;
if (buffer->write_location >= buffer->data_size) {
buffer->write_location = 0;
}
}
#ifdef KORE_MULTITHREADED_AUDIO
hl_blocking(false);
#endif
}
void hl_init_kore(vbyte *title, int width, int height, int samplesPerPixel, bool vSync, int windowMode, int windowFeatures) {
kinc_log(KINC_LOG_LEVEL_INFO, "Starting KincHL");
kinc_window_options_t win;
kinc_window_options_set_defaults(&win);
win.title = (char *)title;
win.width = width;
win.height = height;
win.x = -1;
win.y = -1;
win.mode = (kinc_window_mode_t)windowMode;
win.window_features = windowFeatures;
kinc_framebuffer_options_t frame;
kinc_framebuffer_options_set_defaults(&frame);
frame.vertical_sync = vSync;
frame.samples_per_pixel = samplesPerPixel;
kinc_init((char *)title, width, height, &win, &frame);
kinc_set_update_callback(update, NULL);
}
void hl_kinc_init_audio(vclosure *callCallback, vclosure *readSample, int *outSamplesPerSecond) {
audioCallCallback = *((FN_AUDIO_CALL_CALLBACK *)(&callCallback->fun));
audioReadSample = *((FN_AUDIO_READ_SAMPLE *)(&readSample->fun));
kinc_a2_set_callback(mix);
kinc_a2_init();
*outSamplesPerSecond = kinc_a2_samples_per_second;
}
void hl_run_kore(void) {
kinc_start();
}
vbyte *hl_kinc_file_contents(vbyte *name, int *size) {
int len;
int p = 0;
vbyte *content;
kinc_file_reader_t file;
if (!kinc_file_reader_open(&file, (char *)name, KINC_FILE_TYPE_ASSET)) {
return NULL;
}
hl_blocking(true);
len = (int)kinc_file_reader_size(&file);
if (size) {
*size = len;
}
hl_blocking(false);
content = (vbyte *)hl_gc_alloc_noptr(size ? len : len + 1);
hl_blocking(true);
if (!size) {
content[len] = 0; // final 0 for UTF8
}
kinc_file_reader_read(&file, content, len);
kinc_file_reader_close(&file);
hl_blocking(false);
return content;
}
#include <kinc/audio2/audio.h>
#include <kinc/graphics4/graphics.h>
#include <kinc/io/filereader.h>
#include <kinc/log.h>
#include <kinc/system.h>
#include <kinc/window.h>
#include <hl.h>
void frame();
static bool visible = true;
static bool paused = false;
typedef void (*FN_AUDIO_CALL_CALLBACK)(int);
typedef float (*FN_AUDIO_READ_SAMPLE)(void);
void (*audioCallCallback)(int);
float (*audioReadSample)(void);
static void update(void *data) {
if (paused) {
return;
}
kinc_a2_update();
int windowCount = kinc_count_windows();
for (int windowIndex = 0; windowIndex < windowCount; ++windowIndex) {
if (visible) {
kinc_g4_begin(windowIndex);
frame();
kinc_g4_end(windowIndex);
}
}
if (!kinc_g4_swap_buffers()) {
kinc_log(KINC_LOG_LEVEL_ERROR, "Graphics context lost.");
}
}
static bool mixThreadregistered = false;
static void mix(kinc_a2_buffer_t *buffer, uint32_t samples, void *userdata) {
#ifdef KINC_MULTITHREADED_AUDIO
if (!mixThreadregistered) {
vdynamic *ret;
hl_register_thread(&ret);
mixThreadregistered = true;
}
hl_blocking(true);
#endif
audioCallCallback(samples);
for (uint32_t i = 0; i < samples; i += 2) {
float left_value = audioReadSample();
float right_value = audioReadSample();
*(float *)&buffer->channels[0][buffer->write_location] = left_value;
*(float *)&buffer->channels[1][buffer->write_location] = right_value;
buffer->write_location += 1;
if (buffer->write_location >= buffer->data_size) {
buffer->write_location = 0;
}
}
#ifdef KINC_MULTITHREADED_AUDIO
hl_blocking(false);
#endif
}
void hl_init_kore(vbyte *title, int width, int height, int samplesPerPixel, bool vSync, int windowMode, int windowFeatures) {
kinc_log(KINC_LOG_LEVEL_INFO, "Starting KincHL");
kinc_window_options_t win;
kinc_window_options_set_defaults(&win);
win.title = (char *)title;
win.width = width;
win.height = height;
win.x = -1;
win.y = -1;
win.mode = (kinc_window_mode_t)windowMode;
win.window_features = windowFeatures;
kinc_framebuffer_options_t frame;
kinc_framebuffer_options_set_defaults(&frame);
frame.vertical_sync = vSync;
frame.samples_per_pixel = samplesPerPixel;
kinc_init((char *)title, width, height, &win, &frame);
kinc_set_update_callback(update, NULL);
}
void hl_kinc_init_audio(vclosure *callCallback, vclosure *readSample, int *outSamplesPerSecond) {
audioCallCallback = *((FN_AUDIO_CALL_CALLBACK *)(&callCallback->fun));
audioReadSample = *((FN_AUDIO_READ_SAMPLE *)(&readSample->fun));
kinc_a2_init();
kinc_a2_set_callback(mix, NULL);
*outSamplesPerSecond = kinc_a2_samples_per_second();
}
void hl_run_kore(void) {
kinc_start();
}
vbyte *hl_kinc_file_contents(vbyte *name, int *size) {
int len;
int p = 0;
vbyte *content;
kinc_file_reader_t file;
if (!kinc_file_reader_open(&file, (char *)name, KINC_FILE_TYPE_ASSET)) {
return NULL;
}
hl_blocking(true);
len = (int)kinc_file_reader_size(&file);
if (size) {
*size = len;
}
hl_blocking(false);
content = (vbyte *)hl_gc_alloc_noptr(size ? len : len + 1);
hl_blocking(true);
if (!size) {
content[len] = 0; // final 0 for UTF8
}
kinc_file_reader_read(&file, content, len);
kinc_file_reader_close(&file);
hl_blocking(false);
return content;
}

View File

@ -1,265 +1,265 @@
#include <kinc/graphics4/graphics.h>
#include <kinc/graphics4/pipeline.h>
#include <kinc/graphics4/shader.h>
#include <kinc/graphics4/vertexstructure.h>
#include <hl.h>
static kinc_g4_compare_mode_t convertCompareMode(int mode) {
switch (mode) {
case 0:
return KINC_G4_COMPARE_ALWAYS;
case 1:
return KINC_G4_COMPARE_NEVER;
case 2:
return KINC_G4_COMPARE_EQUAL;
case 3:
return KINC_G4_COMPARE_NOT_EQUAL;
case 4:
return KINC_G4_COMPARE_LESS;
case 5:
return KINC_G4_COMPARE_LESS_EQUAL;
case 6:
return KINC_G4_COMPARE_GREATER;
case 7:
default:
return KINC_G4_COMPARE_GREATER_EQUAL;
}
}
static kinc_g4_stencil_action_t convertStencilAction(int action) {
switch (action) {
case 0:
return KINC_G4_STENCIL_KEEP;
case 1:
return KINC_G4_STENCIL_ZERO;
case 2:
return KINC_G4_STENCIL_REPLACE;
case 3:
return KINC_G4_STENCIL_INCREMENT;
case 4:
return KINC_G4_STENCIL_INCREMENT_WRAP;
case 5:
return KINC_G4_STENCIL_DECREMENT;
case 6:
return KINC_G4_STENCIL_DECREMENT_WRAP;
case 7:
default:
return KINC_G4_STENCIL_INVERT;
}
}
static kinc_g4_render_target_format_t convertColorAttachment(int format) {
switch (format) {
case 0:
return KINC_G4_RENDER_TARGET_FORMAT_32BIT;
case 1:
return KINC_G4_RENDER_TARGET_FORMAT_8BIT_RED;
case 2:
return KINC_G4_RENDER_TARGET_FORMAT_128BIT_FLOAT;
case 3:
return KINC_G4_RENDER_TARGET_FORMAT_16BIT_DEPTH;
case 4:
return KINC_G4_RENDER_TARGET_FORMAT_64BIT_FLOAT;
case 5:
return KINC_G4_RENDER_TARGET_FORMAT_32BIT_RED_FLOAT;
case 6:
default:
return KINC_G4_RENDER_TARGET_FORMAT_16BIT_RED_FLOAT;
}
}
vbyte *hl_kinc_create_vertexshader(vbyte *data, int length) {
kinc_g4_shader_t *shader = (kinc_g4_shader_t *)malloc(sizeof(kinc_g4_shader_t));
kinc_g4_shader_init(shader, data, length, KINC_G4_SHADER_TYPE_VERTEX);
return (vbyte *)shader;
}
vbyte *hl_kinc_create_fragmentshader(vbyte *data, int length) {
kinc_g4_shader_t *shader = (kinc_g4_shader_t *)malloc(sizeof(kinc_g4_shader_t));
kinc_g4_shader_init(shader, data, length, KINC_G4_SHADER_TYPE_FRAGMENT);
return (vbyte *)shader;
}
vbyte *hl_kinc_create_geometryshader(vbyte *data, int length) {
kinc_g4_shader_t *shader = (kinc_g4_shader_t *)malloc(sizeof(kinc_g4_shader_t));
kinc_g4_shader_init(shader, data, length, KINC_G4_SHADER_TYPE_GEOMETRY);
return (vbyte *)shader;
}
vbyte *hl_kinc_create_tesscontrolshader(vbyte *data, int length) {
kinc_g4_shader_t *shader = (kinc_g4_shader_t *)malloc(sizeof(kinc_g4_shader_t));
kinc_g4_shader_init(shader, data, length, KINC_G4_SHADER_TYPE_TESSELLATION_CONTROL);
return (vbyte *)shader;
}
vbyte *hl_kinc_create_tessevalshader(vbyte *data, int length) {
kinc_g4_shader_t *shader = (kinc_g4_shader_t *)malloc(sizeof(kinc_g4_shader_t));
kinc_g4_shader_init(shader, data, length, KINC_G4_SHADER_TYPE_TESSELLATION_EVALUATION);
return (vbyte *)shader;
}
vbyte *hl_kinc_vertexshader_from_source(vbyte *source) {
kinc_g4_shader_t *shader = (kinc_g4_shader_t *)malloc(sizeof(kinc_g4_shader_t));
kinc_g4_shader_init_from_source(shader, (char *)source, KINC_G4_SHADER_TYPE_VERTEX);
return (vbyte *)shader;
}
vbyte *hl_kinc_fragmentshader_from_source(vbyte *source) {
kinc_g4_shader_t *shader = (kinc_g4_shader_t *)malloc(sizeof(kinc_g4_shader_t));
kinc_g4_shader_init_from_source(shader, (char *)source, KINC_G4_SHADER_TYPE_FRAGMENT);
return (vbyte *)shader;
}
vbyte *hl_kinc_geometryshader_from_source(vbyte *source) {
kinc_g4_shader_t *shader = (kinc_g4_shader_t *)malloc(sizeof(kinc_g4_shader_t));
kinc_g4_shader_init_from_source(shader, (char *)source, KINC_G4_SHADER_TYPE_GEOMETRY);
return (vbyte *)shader;
}
vbyte *hl_kinc_tesscontrolshader_from_source(vbyte *source) {
kinc_g4_shader_t *shader = (kinc_g4_shader_t *)malloc(sizeof(kinc_g4_shader_t));
kinc_g4_shader_init_from_source(shader, (char *)source, KINC_G4_SHADER_TYPE_TESSELLATION_CONTROL);
return (vbyte *)shader;
}
vbyte *hl_kinc_tessevalshader_from_source(vbyte *source) {
kinc_g4_shader_t *shader = (kinc_g4_shader_t *)malloc(sizeof(kinc_g4_shader_t));
kinc_g4_shader_init_from_source(shader, (char *)source, KINC_G4_SHADER_TYPE_TESSELLATION_EVALUATION);
return (vbyte *)shader;
}
vbyte *hl_kinc_create_pipeline() {
kinc_g4_pipeline_t *pipeline = (kinc_g4_pipeline_t *)malloc(sizeof(kinc_g4_pipeline_t));
kinc_g4_pipeline_init(pipeline);
return (vbyte *)pipeline;
}
void hl_kinc_delete_pipeline(vbyte *pipeline) {
kinc_g4_pipeline_t *pipe = (kinc_g4_pipeline_t *)pipeline;
kinc_g4_pipeline_destroy(pipe);
free(pipe);
}
void hl_kinc_pipeline_set_vertex_shader(vbyte *pipeline, vbyte *shader) {
kinc_g4_pipeline_t *pipe = (kinc_g4_pipeline_t *)pipeline;
kinc_g4_shader_t *sh = (kinc_g4_shader_t *)shader;
pipe->vertex_shader = sh;
}
void hl_kinc_pipeline_set_fragment_shader(vbyte *pipeline, vbyte *shader) {
kinc_g4_pipeline_t *pipe = (kinc_g4_pipeline_t *)pipeline;
kinc_g4_shader_t *sh = (kinc_g4_shader_t *)shader;
pipe->fragment_shader = sh;
}
void hl_kinc_pipeline_set_geometry_shader(vbyte *pipeline, vbyte *shader) {
kinc_g4_pipeline_t *pipe = (kinc_g4_pipeline_t *)pipeline;
kinc_g4_shader_t *sh = (kinc_g4_shader_t *)shader;
pipe->geometry_shader = sh;
}
void hl_kinc_pipeline_set_tesscontrol_shader(vbyte *pipeline, vbyte *shader) {
kinc_g4_pipeline_t *pipe = (kinc_g4_pipeline_t *)pipeline;
kinc_g4_shader_t *sh = (kinc_g4_shader_t *)shader;
pipe->tessellation_control_shader = sh;
}
void hl_kinc_pipeline_set_tesseval_shader(vbyte *pipeline, vbyte *shader) {
kinc_g4_pipeline_t *pipe = (kinc_g4_pipeline_t *)pipeline;
kinc_g4_shader_t *sh = (kinc_g4_shader_t *)shader;
pipe->tessellation_evaluation_shader = sh;
}
void hl_kinc_pipeline_compile(vbyte *pipeline, vbyte *structure0, vbyte *structure1, vbyte *structure2, vbyte *structure3) {
kinc_g4_pipeline_t *pipe = (kinc_g4_pipeline_t *)pipeline;
pipe->input_layout[0] = (kinc_g4_vertex_structure_t *)structure0;
pipe->input_layout[1] = (kinc_g4_vertex_structure_t *)structure1;
pipe->input_layout[2] = (kinc_g4_vertex_structure_t *)structure2;
pipe->input_layout[3] = (kinc_g4_vertex_structure_t *)structure3;
pipe->input_layout[4] = NULL;
kinc_g4_pipeline_compile(pipe);
}
void hl_kinc_pipeline_set_states(vbyte *pipeline, int cullMode, int depthMode, int stencilFrontMode, int stencilFrontBothPass, int stencilFrontDepthFail,
int stencilFrontFail, int stencilBackMode, int stencilBackBothPass, int stencilBackDepthFail, int stencilBackFail,
int blendSource, int blendDestination, int alphaBlendSource, int alphaBlendDestination, bool depthWrite,
int stencilReferenceValue, int stencilReadMask, int stencilWriteMask, bool colorWriteMaskRed, bool colorWriteMaskGreen,
bool colorWriteMaskBlue, bool colorWriteMaskAlpha, int colorAttachmentCount, int colorAttachment0, int colorAttachment1,
int colorAttachment2, int colorAttachment3, int colorAttachment4, int colorAttachment5, int colorAttachment6,
int colorAttachment7, int depthAttachmentBits, int stencilAttachmentBits, bool conservativeRasterization) {
kinc_g4_pipeline_t *pipe = (kinc_g4_pipeline_t *)pipeline;
switch (cullMode) {
case 0:
pipe->cull_mode = KINC_G4_CULL_CLOCKWISE;
break;
case 1:
pipe->cull_mode = KINC_G4_CULL_COUNTER_CLOCKWISE;
break;
case 2:
pipe->cull_mode = KINC_G4_CULL_NOTHING;
break;
}
pipe->depth_mode = convertCompareMode(depthMode);
pipe->depth_write = depthWrite;
pipe->stencil_front_mode = convertCompareMode(stencilFrontMode);
pipe->stencil_front_both_pass = convertStencilAction(stencilFrontBothPass);
pipe->stencil_front_depth_fail = convertStencilAction(stencilFrontDepthFail);
pipe->stencil_front_fail = convertStencilAction(stencilFrontFail);
pipe->stencil_back_mode = convertCompareMode(stencilBackMode);
pipe->stencil_back_both_pass = convertStencilAction(stencilBackBothPass);
pipe->stencil_back_depth_fail = convertStencilAction(stencilBackDepthFail);
pipe->stencil_back_fail = convertStencilAction(stencilBackFail);
pipe->stencil_reference_value = stencilReferenceValue;
pipe->stencil_read_mask = stencilReadMask;
pipe->stencil_write_mask = stencilWriteMask;
pipe->blend_source = (kinc_g4_blending_factor_t)blendSource;
pipe->blend_destination = (kinc_g4_blending_factor_t)blendDestination;
pipe->alpha_blend_source = (kinc_g4_blending_factor_t)alphaBlendSource;
pipe->alpha_blend_destination = (kinc_g4_blending_factor_t)alphaBlendDestination;
pipe->color_write_mask_red[0] = colorWriteMaskRed;
pipe->color_write_mask_green[0] = colorWriteMaskGreen;
pipe->color_write_mask_blue[0] = colorWriteMaskBlue;
pipe->color_write_mask_alpha[0] = colorWriteMaskAlpha;
pipe->color_attachment_count = colorAttachmentCount;
pipe->color_attachment[0] = convertColorAttachment(colorAttachment0);
pipe->color_attachment[1] = convertColorAttachment(colorAttachment1);
pipe->color_attachment[2] = convertColorAttachment(colorAttachment2);
pipe->color_attachment[3] = convertColorAttachment(colorAttachment3);
pipe->color_attachment[4] = convertColorAttachment(colorAttachment4);
pipe->color_attachment[5] = convertColorAttachment(colorAttachment5);
pipe->color_attachment[6] = convertColorAttachment(colorAttachment6);
pipe->color_attachment[7] = convertColorAttachment(colorAttachment7);
pipe->depth_attachment_bits = depthAttachmentBits;
pipe->stencil_attachment_bits = stencilAttachmentBits;
pipe->conservative_rasterization = conservativeRasterization;
}
void hl_kinc_pipeline_set(vbyte *pipeline) {
kinc_g4_pipeline_t *pipe = (kinc_g4_pipeline_t *)pipeline;
kinc_g4_set_pipeline(pipe);
}
vbyte *hl_kinc_pipeline_get_constantlocation(vbyte *pipeline, vbyte *name) {
kinc_g4_pipeline_t *pipe = (kinc_g4_pipeline_t *)pipeline;
kinc_g4_constant_location_t *location = (kinc_g4_constant_location_t *)malloc(sizeof(kinc_g4_constant_location_t));
*location = kinc_g4_pipeline_get_constant_location(pipe, (char *)name);
return (vbyte *)location;
}
vbyte *hl_kinc_pipeline_get_textureunit(vbyte *pipeline, vbyte *name) {
kinc_g4_pipeline_t *pipe = (kinc_g4_pipeline_t *)pipeline;
kinc_g4_texture_unit_t *unit = (kinc_g4_texture_unit_t *)malloc(sizeof(kinc_g4_texture_unit_t));
*unit = kinc_g4_pipeline_get_texture_unit(pipe, (char *)name);
return (vbyte *)unit;
}
#include <kinc/graphics4/graphics.h>
#include <kinc/graphics4/pipeline.h>
#include <kinc/graphics4/shader.h>
#include <kinc/graphics4/vertexstructure.h>
#include <hl.h>
static kinc_g4_compare_mode_t convertCompareMode(int mode) {
switch (mode) {
case 0:
return KINC_G4_COMPARE_ALWAYS;
case 1:
return KINC_G4_COMPARE_NEVER;
case 2:
return KINC_G4_COMPARE_EQUAL;
case 3:
return KINC_G4_COMPARE_NOT_EQUAL;
case 4:
return KINC_G4_COMPARE_LESS;
case 5:
return KINC_G4_COMPARE_LESS_EQUAL;
case 6:
return KINC_G4_COMPARE_GREATER;
case 7:
default:
return KINC_G4_COMPARE_GREATER_EQUAL;
}
}
static kinc_g4_stencil_action_t convertStencilAction(int action) {
switch (action) {
case 0:
return KINC_G4_STENCIL_KEEP;
case 1:
return KINC_G4_STENCIL_ZERO;
case 2:
return KINC_G4_STENCIL_REPLACE;
case 3:
return KINC_G4_STENCIL_INCREMENT;
case 4:
return KINC_G4_STENCIL_INCREMENT_WRAP;
case 5:
return KINC_G4_STENCIL_DECREMENT;
case 6:
return KINC_G4_STENCIL_DECREMENT_WRAP;
case 7:
default:
return KINC_G4_STENCIL_INVERT;
}
}
static kinc_g4_render_target_format_t convertColorAttachment(int format) {
switch (format) {
case 0:
return KINC_G4_RENDER_TARGET_FORMAT_32BIT;
case 1:
return KINC_G4_RENDER_TARGET_FORMAT_8BIT_RED;
case 2:
return KINC_G4_RENDER_TARGET_FORMAT_128BIT_FLOAT;
case 3:
return KINC_G4_RENDER_TARGET_FORMAT_16BIT_DEPTH;
case 4:
return KINC_G4_RENDER_TARGET_FORMAT_64BIT_FLOAT;
case 5:
return KINC_G4_RENDER_TARGET_FORMAT_32BIT_RED_FLOAT;
case 6:
default:
return KINC_G4_RENDER_TARGET_FORMAT_16BIT_RED_FLOAT;
}
}
vbyte *hl_kinc_create_vertexshader(vbyte *data, int length) {
kinc_g4_shader_t *shader = (kinc_g4_shader_t *)malloc(sizeof(kinc_g4_shader_t));
kinc_g4_shader_init(shader, data, length, KINC_G4_SHADER_TYPE_VERTEX);
return (vbyte *)shader;
}
vbyte *hl_kinc_create_fragmentshader(vbyte *data, int length) {
kinc_g4_shader_t *shader = (kinc_g4_shader_t *)malloc(sizeof(kinc_g4_shader_t));
kinc_g4_shader_init(shader, data, length, KINC_G4_SHADER_TYPE_FRAGMENT);
return (vbyte *)shader;
}
vbyte *hl_kinc_create_geometryshader(vbyte *data, int length) {
kinc_g4_shader_t *shader = (kinc_g4_shader_t *)malloc(sizeof(kinc_g4_shader_t));
kinc_g4_shader_init(shader, data, length, KINC_G4_SHADER_TYPE_GEOMETRY);
return (vbyte *)shader;
}
vbyte *hl_kinc_create_tesscontrolshader(vbyte *data, int length) {
kinc_g4_shader_t *shader = (kinc_g4_shader_t *)malloc(sizeof(kinc_g4_shader_t));
kinc_g4_shader_init(shader, data, length, KINC_G4_SHADER_TYPE_TESSELLATION_CONTROL);
return (vbyte *)shader;
}
vbyte *hl_kinc_create_tessevalshader(vbyte *data, int length) {
kinc_g4_shader_t *shader = (kinc_g4_shader_t *)malloc(sizeof(kinc_g4_shader_t));
kinc_g4_shader_init(shader, data, length, KINC_G4_SHADER_TYPE_TESSELLATION_EVALUATION);
return (vbyte *)shader;
}
vbyte *hl_kinc_vertexshader_from_source(vbyte *source) {
kinc_g4_shader_t *shader = (kinc_g4_shader_t *)malloc(sizeof(kinc_g4_shader_t));
kinc_g4_shader_init_from_source(shader, (char *)source, KINC_G4_SHADER_TYPE_VERTEX);
return (vbyte *)shader;
}
vbyte *hl_kinc_fragmentshader_from_source(vbyte *source) {
kinc_g4_shader_t *shader = (kinc_g4_shader_t *)malloc(sizeof(kinc_g4_shader_t));
kinc_g4_shader_init_from_source(shader, (char *)source, KINC_G4_SHADER_TYPE_FRAGMENT);
return (vbyte *)shader;
}
vbyte *hl_kinc_geometryshader_from_source(vbyte *source) {
kinc_g4_shader_t *shader = (kinc_g4_shader_t *)malloc(sizeof(kinc_g4_shader_t));
kinc_g4_shader_init_from_source(shader, (char *)source, KINC_G4_SHADER_TYPE_GEOMETRY);
return (vbyte *)shader;
}
vbyte *hl_kinc_tesscontrolshader_from_source(vbyte *source) {
kinc_g4_shader_t *shader = (kinc_g4_shader_t *)malloc(sizeof(kinc_g4_shader_t));
kinc_g4_shader_init_from_source(shader, (char *)source, KINC_G4_SHADER_TYPE_TESSELLATION_CONTROL);
return (vbyte *)shader;
}
vbyte *hl_kinc_tessevalshader_from_source(vbyte *source) {
kinc_g4_shader_t *shader = (kinc_g4_shader_t *)malloc(sizeof(kinc_g4_shader_t));
kinc_g4_shader_init_from_source(shader, (char *)source, KINC_G4_SHADER_TYPE_TESSELLATION_EVALUATION);
return (vbyte *)shader;
}
vbyte *hl_kinc_create_pipeline() {
kinc_g4_pipeline_t *pipeline = (kinc_g4_pipeline_t *)malloc(sizeof(kinc_g4_pipeline_t));
kinc_g4_pipeline_init(pipeline);
return (vbyte *)pipeline;
}
void hl_kinc_delete_pipeline(vbyte *pipeline) {
kinc_g4_pipeline_t *pipe = (kinc_g4_pipeline_t *)pipeline;
kinc_g4_pipeline_destroy(pipe);
free(pipe);
}
void hl_kinc_pipeline_set_vertex_shader(vbyte *pipeline, vbyte *shader) {
kinc_g4_pipeline_t *pipe = (kinc_g4_pipeline_t *)pipeline;
kinc_g4_shader_t *sh = (kinc_g4_shader_t *)shader;
pipe->vertex_shader = sh;
}
void hl_kinc_pipeline_set_fragment_shader(vbyte *pipeline, vbyte *shader) {
kinc_g4_pipeline_t *pipe = (kinc_g4_pipeline_t *)pipeline;
kinc_g4_shader_t *sh = (kinc_g4_shader_t *)shader;
pipe->fragment_shader = sh;
}
void hl_kinc_pipeline_set_geometry_shader(vbyte *pipeline, vbyte *shader) {
kinc_g4_pipeline_t *pipe = (kinc_g4_pipeline_t *)pipeline;
kinc_g4_shader_t *sh = (kinc_g4_shader_t *)shader;
pipe->geometry_shader = sh;
}
void hl_kinc_pipeline_set_tesscontrol_shader(vbyte *pipeline, vbyte *shader) {
kinc_g4_pipeline_t *pipe = (kinc_g4_pipeline_t *)pipeline;
kinc_g4_shader_t *sh = (kinc_g4_shader_t *)shader;
pipe->tessellation_control_shader = sh;
}
void hl_kinc_pipeline_set_tesseval_shader(vbyte *pipeline, vbyte *shader) {
kinc_g4_pipeline_t *pipe = (kinc_g4_pipeline_t *)pipeline;
kinc_g4_shader_t *sh = (kinc_g4_shader_t *)shader;
pipe->tessellation_evaluation_shader = sh;
}
void hl_kinc_pipeline_compile(vbyte *pipeline, vbyte *structure0, vbyte *structure1, vbyte *structure2, vbyte *structure3) {
kinc_g4_pipeline_t *pipe = (kinc_g4_pipeline_t *)pipeline;
pipe->input_layout[0] = (kinc_g4_vertex_structure_t *)structure0;
pipe->input_layout[1] = (kinc_g4_vertex_structure_t *)structure1;
pipe->input_layout[2] = (kinc_g4_vertex_structure_t *)structure2;
pipe->input_layout[3] = (kinc_g4_vertex_structure_t *)structure3;
pipe->input_layout[4] = NULL;
kinc_g4_pipeline_compile(pipe);
}
void hl_kinc_pipeline_set_states(vbyte *pipeline, int cullMode, int depthMode, int stencilFrontMode, int stencilFrontBothPass, int stencilFrontDepthFail,
int stencilFrontFail, int stencilBackMode, int stencilBackBothPass, int stencilBackDepthFail, int stencilBackFail,
int blendSource, int blendDestination, int alphaBlendSource, int alphaBlendDestination, bool depthWrite,
int stencilReferenceValue, int stencilReadMask, int stencilWriteMask, bool colorWriteMaskRed, bool colorWriteMaskGreen,
bool colorWriteMaskBlue, bool colorWriteMaskAlpha, int colorAttachmentCount, int colorAttachment0, int colorAttachment1,
int colorAttachment2, int colorAttachment3, int colorAttachment4, int colorAttachment5, int colorAttachment6,
int colorAttachment7, int depthAttachmentBits, int stencilAttachmentBits, bool conservativeRasterization) {
kinc_g4_pipeline_t *pipe = (kinc_g4_pipeline_t *)pipeline;
switch (cullMode) {
case 0:
pipe->cull_mode = KINC_G4_CULL_CLOCKWISE;
break;
case 1:
pipe->cull_mode = KINC_G4_CULL_COUNTER_CLOCKWISE;
break;
case 2:
pipe->cull_mode = KINC_G4_CULL_NOTHING;
break;
}
pipe->depth_mode = convertCompareMode(depthMode);
pipe->depth_write = depthWrite;
pipe->stencil_front_mode = convertCompareMode(stencilFrontMode);
pipe->stencil_front_both_pass = convertStencilAction(stencilFrontBothPass);
pipe->stencil_front_depth_fail = convertStencilAction(stencilFrontDepthFail);
pipe->stencil_front_fail = convertStencilAction(stencilFrontFail);
pipe->stencil_back_mode = convertCompareMode(stencilBackMode);
pipe->stencil_back_both_pass = convertStencilAction(stencilBackBothPass);
pipe->stencil_back_depth_fail = convertStencilAction(stencilBackDepthFail);
pipe->stencil_back_fail = convertStencilAction(stencilBackFail);
pipe->stencil_reference_value = stencilReferenceValue;
pipe->stencil_read_mask = stencilReadMask;
pipe->stencil_write_mask = stencilWriteMask;
pipe->blend_source = (kinc_g4_blending_factor_t)blendSource;
pipe->blend_destination = (kinc_g4_blending_factor_t)blendDestination;
pipe->alpha_blend_source = (kinc_g4_blending_factor_t)alphaBlendSource;
pipe->alpha_blend_destination = (kinc_g4_blending_factor_t)alphaBlendDestination;
pipe->color_write_mask_red[0] = colorWriteMaskRed;
pipe->color_write_mask_green[0] = colorWriteMaskGreen;
pipe->color_write_mask_blue[0] = colorWriteMaskBlue;
pipe->color_write_mask_alpha[0] = colorWriteMaskAlpha;
pipe->color_attachment_count = colorAttachmentCount;
pipe->color_attachment[0] = convertColorAttachment(colorAttachment0);
pipe->color_attachment[1] = convertColorAttachment(colorAttachment1);
pipe->color_attachment[2] = convertColorAttachment(colorAttachment2);
pipe->color_attachment[3] = convertColorAttachment(colorAttachment3);
pipe->color_attachment[4] = convertColorAttachment(colorAttachment4);
pipe->color_attachment[5] = convertColorAttachment(colorAttachment5);
pipe->color_attachment[6] = convertColorAttachment(colorAttachment6);
pipe->color_attachment[7] = convertColorAttachment(colorAttachment7);
pipe->depth_attachment_bits = depthAttachmentBits;
pipe->stencil_attachment_bits = stencilAttachmentBits;
pipe->conservative_rasterization = conservativeRasterization;
}
void hl_kinc_pipeline_set(vbyte *pipeline) {
kinc_g4_pipeline_t *pipe = (kinc_g4_pipeline_t *)pipeline;
kinc_g4_set_pipeline(pipe);
}
vbyte *hl_kinc_pipeline_get_constantlocation(vbyte *pipeline, vbyte *name) {
kinc_g4_pipeline_t *pipe = (kinc_g4_pipeline_t *)pipeline;
kinc_g4_constant_location_t *location = (kinc_g4_constant_location_t *)malloc(sizeof(kinc_g4_constant_location_t));
*location = kinc_g4_pipeline_get_constant_location(pipe, (char *)name);
return (vbyte *)location;
}
vbyte *hl_kinc_pipeline_get_textureunit(vbyte *pipeline, vbyte *name) {
kinc_g4_pipeline_t *pipe = (kinc_g4_pipeline_t *)pipeline;
kinc_g4_texture_unit_t *unit = (kinc_g4_texture_unit_t *)malloc(sizeof(kinc_g4_texture_unit_t));
*unit = kinc_g4_pipeline_get_texture_unit(pipe, (char *)name);
return (vbyte *)unit;
}

View File

@ -1,201 +1,201 @@
#include <kinc/input/acceleration.h>
#include <kinc/input/gamepad.h>
#include <kinc/input/keyboard.h>
#include <kinc/input/mouse.h>
#include <kinc/input/pen.h>
#include <kinc/input/rotation.h>
#include <kinc/input/surface.h>
#include <kinc/log.h>
#include <kinc/system.h>
#include <kinc/video.h>
#include <kinc/window.h>
#include <hl.h>
void hl_kinc_log(vbyte *v) {
kinc_log(KINC_LOG_LEVEL_INFO, (char *)v);
}
double hl_kinc_get_time(void) {
return kinc_time();
}
int hl_kinc_get_window_width(int window) {
return kinc_window_width(window);
}
int hl_kinc_get_window_height(int window) {
return kinc_window_height(window);
}
vbyte *hl_kinc_get_system_id(void) {
return (vbyte *)kinc_system_id();
}
void hl_kinc_vibrate(int ms) {
kinc_vibrate(ms);
}
vbyte *hl_kinc_get_language(void) {
return (vbyte *)kinc_language();
}
void hl_kinc_request_shutdown(void) {
kinc_stop();
}
void hl_kinc_mouse_lock(int windowId) {
kinc_mouse_lock(windowId);
}
void hl_kinc_mouse_unlock(void) {
kinc_mouse_unlock();
}
bool hl_kinc_can_lock_mouse(void) {
return kinc_mouse_can_lock();
}
bool hl_kinc_is_mouse_locked(void) {
return kinc_mouse_is_locked();
}
void hl_kinc_show_mouse(bool show) {
if (show) {
kinc_mouse_show();
}
else {
kinc_mouse_hide();
}
}
bool hl_kinc_system_is_fullscreen(void) {
return false; // kinc_is_fullscreen();
}
void hl_kinc_system_request_fullscreen(void) {
// kinc_change_resolution(display_width(), display_height(), true);
}
void hl_kinc_system_exit_fullscreen(int previousWidth, int previousHeight) {
// kinc_change_resolution(previousWidth, previousHeight, false);
}
void hl_kinc_system_change_resolution(int width, int height) {
// kinc_change_resolution(width, height, false);
}
void hl_kinc_system_set_keepscreenon(bool on) {
kinc_set_keep_screen_on(on);
}
void hl_kinc_system_load_url(vbyte *url) {
kinc_load_url((char *)url);
}
vbyte *hl_kinc_get_gamepad_id(int index) {
return (vbyte*)kinc_gamepad_product_name(index);
}
vbyte *hl_kinc_get_gamepad_vendor(int index) {
return (vbyte*)kinc_gamepad_vendor(index);
}
bool hl_kinc_gamepad_connected(int index) {
return kinc_gamepad_connected(index);
}
typedef void (*FN_KEY_DOWN)(int, void *);
typedef void (*FN_KEY_UP)(int, void *);
typedef void (*FN_KEY_PRESS)(unsigned int, void *);
void hl_kinc_register_keyboard(vclosure *keyDown, vclosure *keyUp, vclosure *keyPress) {
kinc_keyboard_set_key_down_callback(*((FN_KEY_DOWN *)(&keyDown->fun)), NULL);
kinc_keyboard_set_key_up_callback(*((FN_KEY_UP *)(&keyUp->fun)), NULL);
kinc_keyboard_set_key_press_callback(*((FN_KEY_PRESS *)(&keyPress->fun)), NULL);
}
typedef void (*FN_MOUSE_DOWN)(int, int, int, int, void *);
typedef void (*FN_MOUSE_UP)(int, int, int, int, void *);
typedef void (*FN_MOUSE_MOVE)(int, int, int, int, int, void *);
typedef void (*FN_MOUSE_WHEEL)(int, int, void *);
void hl_kinc_register_mouse(vclosure *mouseDown, vclosure *mouseUp, vclosure *mouseMove, vclosure *mouseWheel) {
kinc_mouse_set_press_callback(*((FN_MOUSE_DOWN *)(&mouseDown->fun)), NULL);
kinc_mouse_set_release_callback(*((FN_MOUSE_UP *)(&mouseUp->fun)), NULL);
kinc_mouse_set_move_callback(*((FN_MOUSE_MOVE *)(&mouseMove->fun)), NULL);
kinc_mouse_set_scroll_callback(*((FN_MOUSE_WHEEL *)(&mouseWheel->fun)), NULL);
}
typedef void (*FN_PEN_DOWN)(int, int, int, float);
typedef void (*FN_PEN_UP)(int, int, int, float);
typedef void (*FN_PEN_MOVE)(int, int, int, float);
void hl_kinc_register_pen(vclosure *penDown, vclosure *penUp, vclosure *penMove) {
kinc_pen_set_press_callback(*((FN_PEN_DOWN *)(&penDown->fun)));
kinc_pen_set_release_callback(*((FN_PEN_UP *)(&penUp->fun)));
kinc_pen_set_move_callback(*((FN_PEN_MOVE *)(&penMove->fun)));
}
typedef void (*FN_GAMEPAD_AXIS)(int, int, float);
typedef void (*FN_GAMEPAD_BUTTON)(int, int, float);
void hl_kinc_register_gamepad(vclosure *gamepadAxis, vclosure *gamepadButton) {
kinc_gamepad_set_axis_callback(*((FN_GAMEPAD_AXIS *)(&gamepadAxis->fun)));
kinc_gamepad_set_button_callback(*((FN_GAMEPAD_BUTTON *)(&gamepadButton->fun)));
}
typedef void (*FN_TOUCH_START)(int, int, int);
typedef void (*FN_TOUCH_END)(int, int, int);
typedef void (*FN_TOUCH_MOVE)(int, int, int);
void hl_kinc_register_surface(vclosure *touchStart, vclosure *touchEnd, vclosure *touchMove) {
kinc_surface_set_touch_start_callback(*((FN_TOUCH_START *)(&touchStart->fun)));
kinc_surface_set_touch_end_callback(*((FN_TOUCH_END *)(&touchEnd->fun)));
kinc_surface_set_move_callback(*((FN_TOUCH_MOVE *)(&touchMove->fun)));
}
typedef void (*FN_SENSOR_ACCELEROMETER)(float, float, float);
typedef void (*FN_SENSOR_GYROSCOPE)(float, float, float);
void hl_kinc_register_sensor(vclosure *accelerometerChanged, vclosure *gyroscopeChanged) {
kinc_acceleration_set_callback(*((FN_SENSOR_ACCELEROMETER *)(&accelerometerChanged->fun)));
kinc_rotation_set_callback(*((FN_SENSOR_GYROSCOPE *)(&gyroscopeChanged->fun)));
}
// typedef void(*FN_CB_ORIENTATION)(int);
typedef void (*FN_CB_FOREGROUND)(void *);
typedef void (*FN_CB_RESUME)(void *);
typedef void (*FN_CB_PAUSE)(void *);
typedef void (*FN_CB_BACKGROUND)(void *);
typedef void (*FN_CB_SHUTDOWN)(void *);
void hl_kinc_register_callbacks(vclosure *foreground, vclosure *resume, vclosure *pause, vclosure *background, vclosure *shutdown) {
// kinc_set_orientation_callback(orientation);
kinc_set_foreground_callback(*((FN_CB_FOREGROUND *)(&foreground->fun)), NULL);
kinc_set_resume_callback(*((FN_CB_RESUME *)(&resume->fun)), NULL);
kinc_set_pause_callback(*((FN_CB_PAUSE *)(&pause->fun)), NULL);
kinc_set_background_callback(*((FN_CB_BACKGROUND *)(&background->fun)), NULL);
kinc_set_shutdown_callback(*((FN_CB_SHUTDOWN *)(&shutdown->fun)), NULL);
}
typedef void (*FN_CB_DROPFILES)(wchar_t *);
void hl_kinc_register_dropfiles(vclosure *dropFiles) {
// todo: string convert
// kinc_set_drop_files_callback(*((FN_CB_DROPFILES*)(&dropFiles->fun)));
}
typedef char *(*FN_CB_COPY)(void *);
typedef char *(*FN_CB_CUT)(void *);
typedef void (*FN_CB_PASTE)(char *, void *);
void hl_kinc_register_copycutpaste(vclosure *copy, vclosure *cut, vclosure *paste) {
kinc_set_copy_callback(*((FN_CB_COPY *)(&copy->fun)), NULL);
kinc_set_cut_callback(*((FN_CB_CUT *)(&cut->fun)), NULL);
kinc_set_paste_callback(*((FN_CB_PASTE *)(&paste->fun)), NULL);
}
const char *hl_kinc_video_format(void) {
return kinc_video_formats()[0];
}
#include <kinc/input/acceleration.h>
#include <kinc/input/gamepad.h>
#include <kinc/input/keyboard.h>
#include <kinc/input/mouse.h>
#include <kinc/input/pen.h>
#include <kinc/input/rotation.h>
#include <kinc/input/surface.h>
#include <kinc/log.h>
#include <kinc/system.h>
#include <kinc/video.h>
#include <kinc/window.h>
#include <hl.h>
void hl_kinc_log(vbyte *v) {
kinc_log(KINC_LOG_LEVEL_INFO, (char *)v);
}
double hl_kinc_get_time(void) {
return kinc_time();
}
int hl_kinc_get_window_width(int window) {
return kinc_window_width(window);
}
int hl_kinc_get_window_height(int window) {
return kinc_window_height(window);
}
vbyte *hl_kinc_get_system_id(void) {
return (vbyte *)kinc_system_id();
}
void hl_kinc_vibrate(int ms) {
kinc_vibrate(ms);
}
vbyte *hl_kinc_get_language(void) {
return (vbyte *)kinc_language();
}
void hl_kinc_request_shutdown(void) {
kinc_stop();
}
void hl_kinc_mouse_lock(int windowId) {
kinc_mouse_lock(windowId);
}
void hl_kinc_mouse_unlock(void) {
kinc_mouse_unlock();
}
bool hl_kinc_can_lock_mouse(void) {
return kinc_mouse_can_lock();
}
bool hl_kinc_is_mouse_locked(void) {
return kinc_mouse_is_locked();
}
void hl_kinc_show_mouse(bool show) {
if (show) {
kinc_mouse_show();
}
else {
kinc_mouse_hide();
}
}
bool hl_kinc_system_is_fullscreen(void) {
return false; // kinc_is_fullscreen();
}
void hl_kinc_system_request_fullscreen(void) {
// kinc_change_resolution(display_width(), display_height(), true);
}
void hl_kinc_system_exit_fullscreen(int previousWidth, int previousHeight) {
// kinc_change_resolution(previousWidth, previousHeight, false);
}
void hl_kinc_system_change_resolution(int width, int height) {
// kinc_change_resolution(width, height, false);
}
void hl_kinc_system_set_keepscreenon(bool on) {
kinc_set_keep_screen_on(on);
}
void hl_kinc_system_load_url(vbyte *url) {
kinc_load_url((char *)url);
}
vbyte *hl_kinc_get_gamepad_id(int index) {
return (vbyte *)kinc_gamepad_product_name(index);
}
vbyte *hl_kinc_get_gamepad_vendor(int index) {
return (vbyte *)kinc_gamepad_vendor(index);
}
bool hl_kinc_gamepad_connected(int index) {
return kinc_gamepad_connected(index);
}
typedef void (*FN_KEY_DOWN)(int, void *);
typedef void (*FN_KEY_UP)(int, void *);
typedef void (*FN_KEY_PRESS)(unsigned int, void *);
void hl_kinc_register_keyboard(vclosure *keyDown, vclosure *keyUp, vclosure *keyPress) {
kinc_keyboard_set_key_down_callback(*((FN_KEY_DOWN *)(&keyDown->fun)), NULL);
kinc_keyboard_set_key_up_callback(*((FN_KEY_UP *)(&keyUp->fun)), NULL);
kinc_keyboard_set_key_press_callback(*((FN_KEY_PRESS *)(&keyPress->fun)), NULL);
}
typedef void (*FN_MOUSE_DOWN)(int, int, int, int, void *);
typedef void (*FN_MOUSE_UP)(int, int, int, int, void *);
typedef void (*FN_MOUSE_MOVE)(int, int, int, int, int, void *);
typedef void (*FN_MOUSE_WHEEL)(int, int, void *);
void hl_kinc_register_mouse(vclosure *mouseDown, vclosure *mouseUp, vclosure *mouseMove, vclosure *mouseWheel) {
kinc_mouse_set_press_callback(*((FN_MOUSE_DOWN *)(&mouseDown->fun)), NULL);
kinc_mouse_set_release_callback(*((FN_MOUSE_UP *)(&mouseUp->fun)), NULL);
kinc_mouse_set_move_callback(*((FN_MOUSE_MOVE *)(&mouseMove->fun)), NULL);
kinc_mouse_set_scroll_callback(*((FN_MOUSE_WHEEL *)(&mouseWheel->fun)), NULL);
}
typedef void (*FN_PEN_DOWN)(int, int, int, float);
typedef void (*FN_PEN_UP)(int, int, int, float);
typedef void (*FN_PEN_MOVE)(int, int, int, float);
void hl_kinc_register_pen(vclosure *penDown, vclosure *penUp, vclosure *penMove) {
kinc_pen_set_press_callback(*((FN_PEN_DOWN *)(&penDown->fun)));
kinc_pen_set_release_callback(*((FN_PEN_UP *)(&penUp->fun)));
kinc_pen_set_move_callback(*((FN_PEN_MOVE *)(&penMove->fun)));
}
typedef void (*FN_GAMEPAD_AXIS)(int, int, float, void *);
typedef void (*FN_GAMEPAD_BUTTON)(int, int, float, void *);
void hl_kinc_register_gamepad(vclosure *gamepadAxis, vclosure *gamepadButton) {
kinc_gamepad_set_axis_callback(*((FN_GAMEPAD_AXIS *)(&gamepadAxis->fun)), NULL);
kinc_gamepad_set_button_callback(*((FN_GAMEPAD_BUTTON *)(&gamepadButton->fun)), NULL);
}
typedef void (*FN_TOUCH_START)(int, int, int);
typedef void (*FN_TOUCH_END)(int, int, int);
typedef void (*FN_TOUCH_MOVE)(int, int, int);
void hl_kinc_register_surface(vclosure *touchStart, vclosure *touchEnd, vclosure *touchMove) {
kinc_surface_set_touch_start_callback(*((FN_TOUCH_START *)(&touchStart->fun)));
kinc_surface_set_touch_end_callback(*((FN_TOUCH_END *)(&touchEnd->fun)));
kinc_surface_set_move_callback(*((FN_TOUCH_MOVE *)(&touchMove->fun)));
}
typedef void (*FN_SENSOR_ACCELEROMETER)(float, float, float);
typedef void (*FN_SENSOR_GYROSCOPE)(float, float, float);
void hl_kinc_register_sensor(vclosure *accelerometerChanged, vclosure *gyroscopeChanged) {
kinc_acceleration_set_callback(*((FN_SENSOR_ACCELEROMETER *)(&accelerometerChanged->fun)));
kinc_rotation_set_callback(*((FN_SENSOR_GYROSCOPE *)(&gyroscopeChanged->fun)));
}
// typedef void(*FN_CB_ORIENTATION)(int);
typedef void (*FN_CB_FOREGROUND)(void *);
typedef void (*FN_CB_RESUME)(void *);
typedef void (*FN_CB_PAUSE)(void *);
typedef void (*FN_CB_BACKGROUND)(void *);
typedef void (*FN_CB_SHUTDOWN)(void *);
void hl_kinc_register_callbacks(vclosure *foreground, vclosure *resume, vclosure *pause, vclosure *background, vclosure *shutdown) {
// kinc_set_orientation_callback(orientation);
kinc_set_foreground_callback(*((FN_CB_FOREGROUND *)(&foreground->fun)), NULL);
kinc_set_resume_callback(*((FN_CB_RESUME *)(&resume->fun)), NULL);
kinc_set_pause_callback(*((FN_CB_PAUSE *)(&pause->fun)), NULL);
kinc_set_background_callback(*((FN_CB_BACKGROUND *)(&background->fun)), NULL);
kinc_set_shutdown_callback(*((FN_CB_SHUTDOWN *)(&shutdown->fun)), NULL);
}
typedef void (*FN_CB_DROPFILES)(wchar_t *);
void hl_kinc_register_dropfiles(vclosure *dropFiles) {
// todo: string convert
// kinc_set_drop_files_callback(*((FN_CB_DROPFILES*)(&dropFiles->fun)));
}
typedef char *(*FN_CB_COPY)(void *);
typedef char *(*FN_CB_CUT)(void *);
typedef void (*FN_CB_PASTE)(char *, void *);
void hl_kinc_register_copycutpaste(vclosure *copy, vclosure *cut, vclosure *paste) {
kinc_set_copy_callback(*((FN_CB_COPY *)(&copy->fun)), NULL);
kinc_set_cut_callback(*((FN_CB_CUT *)(&cut->fun)), NULL);
kinc_set_paste_callback(*((FN_CB_PASTE *)(&paste->fun)), NULL);
}
const char *hl_kinc_video_format(void) {
return kinc_video_formats()[0];
}

View File

@ -80,6 +80,7 @@ extern class Krom {
static function unloadImage(image: kha.Image): Void;
static function loadSound(file: String): Dynamic;
static function writeAudioBuffer(buffer: js.lib.ArrayBuffer, samples: Int): Void;
static function getSamplesPerSecond(): Int;
static function loadBlob(file: String): js.lib.ArrayBuffer;
static function init(title: String, width: Int, height: Int, samplesPerPixel: Int, vSync: Bool, windowMode: Int, windowFeatures: Int, kromApi: Int): Void;
@ -115,6 +116,7 @@ extern class Krom {
static function screenDpi(): Int;
static function systemId(): String;
static function requestShutdown(): Void;
static function displayFrequency(): Int;
static function displayCount(): Int;
static function displayWidth(index: Int): Int;
static function displayHeight(index: Int): Int;

View File

@ -79,7 +79,7 @@ class Display {
public var frequency(get, never): Int;
function get_frequency(): Int {
return 60;
return Krom.displayFrequency();
}
public var pixelsPerInch(get, never): Int;

View File

@ -1,343 +1,344 @@
package kha;
import kha.graphics4.TextureFormat;
import kha.input.Gamepad;
import kha.input.Keyboard;
import kha.input.Mouse;
import kha.input.MouseImpl;
import kha.input.Pen;
import kha.input.Surface;
import kha.System;
import haxe.ds.Vector;
class SystemImpl {
static var start: Float;
static var framebuffer: Framebuffer;
static var keyboard: Keyboard;
static var mouse: Mouse;
static var pen: Pen;
static var maxGamepads: Int = 4;
static var gamepads: Array<Gamepad>;
static var mouseLockListeners: Array<Void->Void> = [];
static function renderCallback(): Void {
Scheduler.executeFrame();
System.render([framebuffer]);
}
static function dropFilesCallback(filePath: String): Void {
System.dropFiles(filePath);
}
static function copyCallback(): String {
if (System.copyListener != null) {
return System.copyListener();
}
else {
return null;
}
}
static function cutCallback(): String {
if (System.cutListener != null) {
return System.cutListener();
}
else {
return null;
}
}
static function pasteCallback(data: String): Void {
if (System.pasteListener != null) {
System.pasteListener(data);
}
}
static function foregroundCallback(): Void {
System.foreground();
}
static function resumeCallback(): Void {
System.resume();
}
static function pauseCallback(): Void {
System.pause();
}
static function backgroundCallback(): Void {
System.background();
}
static function shutdownCallback(): Void {
System.shutdown();
}
static function keyboardDownCallback(code: Int): Void {
keyboard.sendDownEvent(cast code);
}
static function keyboardUpCallback(code: Int): Void {
keyboard.sendUpEvent(cast code);
}
static function keyboardPressCallback(charCode: Int): Void {
keyboard.sendPressEvent(String.fromCharCode(charCode));
}
static function mouseDownCallback(button: Int, x: Int, y: Int): Void {
mouse.sendDownEvent(0, button, x, y);
}
static function mouseUpCallback(button: Int, x: Int, y: Int): Void {
mouse.sendUpEvent(0, button, x, y);
}
static function mouseMoveCallback(x: Int, y: Int, mx: Int, my: Int): Void {
mouse.sendMoveEvent(0, x, y, mx, my);
}
static function mouseWheelCallback(delta: Int): Void {
mouse.sendWheelEvent(0, delta);
}
static function penDownCallback(x: Int, y: Int, pressure: Float): Void {
pen.sendDownEvent(0, x, y, pressure);
}
static function penUpCallback(x: Int, y: Int, pressure: Float): Void {
pen.sendUpEvent(0, x, y, pressure);
}
static function penMoveCallback(x: Int, y: Int, pressure: Float): Void {
pen.sendMoveEvent(0, x, y, pressure);
}
static function gamepadAxisCallback(gamepad: Int, axis: Int, value: Float): Void {
gamepads[gamepad].sendAxisEvent(axis, value);
}
static function gamepadButtonCallback(gamepad: Int, button: Int, value: Float): Void {
gamepads[gamepad].sendButtonEvent(button, value);
}
static function audioCallback(samples: Int): Void {
kha.audio2.Audio._callCallback(samples);
var buffer = @:privateAccess kha.audio2.Audio.buffer;
Krom.writeAudioBuffer(buffer.data.buffer, samples);
}
public static function init(options: SystemOptions, callback: Window->Void): Void {
Krom.init(options.title, options.width, options.height, options.framebuffer.samplesPerPixel, options.framebuffer.verticalSync,
cast options.window.mode, options.window.windowFeatures, Krom.KROM_API);
start = Krom.getTime();
haxe.Log.trace = function(v: Dynamic, ?infos: haxe.PosInfos) {
var message = haxe.Log.formatOutput(v, infos);
Krom.log(message);
};
new Window(0);
Scheduler.init();
Shaders.init();
var g4 = new kha.krom.Graphics();
framebuffer = new Framebuffer(0, null, null, g4);
framebuffer.init(new kha.graphics2.Graphics1(framebuffer), new kha.graphics4.Graphics2(framebuffer), g4);
Krom.setCallback(renderCallback);
Krom.setDropFilesCallback(dropFilesCallback);
Krom.setCutCopyPasteCallback(cutCallback, copyCallback, pasteCallback);
Krom.setApplicationStateCallback(foregroundCallback, resumeCallback, pauseCallback, backgroundCallback, shutdownCallback);
keyboard = new Keyboard();
mouse = new MouseImpl();
pen = new Pen();
gamepads = new Array<Gamepad>();
for (i in 0...maxGamepads) {
gamepads[i] = new Gamepad(i);
}
Krom.setKeyboardDownCallback(keyboardDownCallback);
Krom.setKeyboardUpCallback(keyboardUpCallback);
Krom.setKeyboardPressCallback(keyboardPressCallback);
Krom.setMouseDownCallback(mouseDownCallback);
Krom.setMouseUpCallback(mouseUpCallback);
Krom.setMouseMoveCallback(mouseMoveCallback);
Krom.setMouseWheelCallback(mouseWheelCallback);
Krom.setPenDownCallback(penDownCallback);
Krom.setPenUpCallback(penUpCallback);
Krom.setPenMoveCallback(penMoveCallback);
Krom.setGamepadAxisCallback(gamepadAxisCallback);
Krom.setGamepadButtonCallback(gamepadButtonCallback);
kha.audio2.Audio._init();
kha.audio1.Audio._init();
Krom.setAudioCallback(audioCallback);
Scheduler.start();
callback(Window.get(0));
}
public static function initEx(title: String, options: Array<WindowOptions>, windowCallback: Int->Void, callback: Void->Void): Void {}
static function translateWindowMode(value: Null<WindowMode>): Int {
if (value == null) {
return 0;
}
return switch (value) {
case Windowed: 0;
case Fullscreen: 1;
case ExclusiveFullscreen: 2;
}
}
public static function getScreenRotation(): ScreenRotation {
return ScreenRotation.RotationNone;
}
public static function getTime(): Float {
return Krom.getTime() - start;
}
public static function getVsync(): Bool {
return true;
}
public static function getRefreshRate(): Int {
return 60;
}
public static function getSystemId(): String {
return Krom.systemId();
}
public static function vibrate(ms: Int): Void {
// TODO: Implement
}
public static function getLanguage(): String {
return "en"; // TODO: Implement
}
public static function requestShutdown(): Bool {
Krom.requestShutdown();
return true;
}
public static function getMouse(num: Int): Mouse {
return mouse;
}
public static function getPen(num: Int): Pen {
return pen;
}
public static function getKeyboard(num: Int): Keyboard {
return keyboard;
}
public static function lockMouse(): Void {
if (!isMouseLocked()) {
Krom.lockMouse();
for (listener in mouseLockListeners) {
listener();
}
}
}
public static function unlockMouse(): Void {
if (isMouseLocked()) {
Krom.unlockMouse();
for (listener in mouseLockListeners) {
listener();
}
}
}
public static function canLockMouse(): Bool {
return Krom.canLockMouse();
}
public static function isMouseLocked(): Bool {
return Krom.isMouseLocked();
}
public static function notifyOfMouseLockChange(func: Void->Void, error: Void->Void): Void {
if (canLockMouse() && func != null) {
mouseLockListeners.push(func);
}
}
public static function removeFromMouseLockChange(func: Void->Void, error: Void->Void): Void {
if (canLockMouse() && func != null) {
mouseLockListeners.remove(func);
}
}
public static function hideSystemCursor(): Void {
Krom.showMouse(false);
}
public static function showSystemCursor(): Void {
Krom.showMouse(true);
}
static function unload(): Void {}
public static function canSwitchFullscreen(): Bool {
return false;
}
public static function isFullscreen(): Bool {
return false;
}
public static function requestFullscreen(): Void {}
public static function exitFullscreen(): Void {}
public static function notifyOfFullscreenChange(func: Void->Void, error: Void->Void): Void {}
public static function removeFromFullscreenChange(func: Void->Void, error: Void->Void): Void {}
public static function changeResolution(width: Int, height: Int): Void {}
public static function setKeepScreenOn(on: Bool): Void {}
public static function loadUrl(url: String): Void {}
public static function getGamepadId(index: Int): String {
return "unknown";
}
public static function getGamepadVendor(index: Int): String {
return "unknown";
}
public static function setGamepadRumble(index: Int, leftAmount: Float, rightAmount: Float): Void {}
public static function safeZone(): Float {
return 1.0;
}
public static function login(): Void {}
public static function automaticSafeZone(): Bool {
return true;
}
public static function setSafeZone(value: Float): Void {}
public static function unlockAchievement(id: Int): Void {}
public static function waitingForLogin(): Bool {
return false;
}
public static function disallowUserChange(): Void {}
public static function allowUserChange(): Void {}
}
package kha;
import kha.graphics4.TextureFormat;
import kha.input.Gamepad;
import kha.input.Keyboard;
import kha.input.Mouse;
import kha.input.MouseImpl;
import kha.input.Pen;
import kha.input.Surface;
import kha.System;
import haxe.ds.Vector;
class SystemImpl {
static var start: Float;
static var framebuffer: Framebuffer;
static var keyboard: Keyboard;
static var mouse: Mouse;
static var pen: Pen;
static var maxGamepads: Int = 4;
static var gamepads: Array<Gamepad>;
static var mouseLockListeners: Array<Void->Void> = [];
static function renderCallback(): Void {
Scheduler.executeFrame();
System.render([framebuffer]);
}
static function dropFilesCallback(filePath: String): Void {
System.dropFiles(filePath);
}
static function copyCallback(): String {
if (System.copyListener != null) {
return System.copyListener();
}
else {
return null;
}
}
static function cutCallback(): String {
if (System.cutListener != null) {
return System.cutListener();
}
else {
return null;
}
}
static function pasteCallback(data: String): Void {
if (System.pasteListener != null) {
System.pasteListener(data);
}
}
static function foregroundCallback(): Void {
System.foreground();
}
static function resumeCallback(): Void {
System.resume();
}
static function pauseCallback(): Void {
System.pause();
}
static function backgroundCallback(): Void {
System.background();
}
static function shutdownCallback(): Void {
System.shutdown();
}
static function keyboardDownCallback(code: Int): Void {
keyboard.sendDownEvent(cast code);
}
static function keyboardUpCallback(code: Int): Void {
keyboard.sendUpEvent(cast code);
}
static function keyboardPressCallback(charCode: Int): Void {
keyboard.sendPressEvent(String.fromCharCode(charCode));
}
static function mouseDownCallback(button: Int, x: Int, y: Int): Void {
mouse.sendDownEvent(0, button, x, y);
}
static function mouseUpCallback(button: Int, x: Int, y: Int): Void {
mouse.sendUpEvent(0, button, x, y);
}
static function mouseMoveCallback(x: Int, y: Int, mx: Int, my: Int): Void {
mouse.sendMoveEvent(0, x, y, mx, my);
}
static function mouseWheelCallback(delta: Int): Void {
mouse.sendWheelEvent(0, delta);
}
static function penDownCallback(x: Int, y: Int, pressure: Float): Void {
pen.sendDownEvent(0, x, y, pressure);
}
static function penUpCallback(x: Int, y: Int, pressure: Float): Void {
pen.sendUpEvent(0, x, y, pressure);
}
static function penMoveCallback(x: Int, y: Int, pressure: Float): Void {
pen.sendMoveEvent(0, x, y, pressure);
}
static function gamepadAxisCallback(gamepad: Int, axis: Int, value: Float): Void {
gamepads[gamepad].sendAxisEvent(axis, value);
}
static function gamepadButtonCallback(gamepad: Int, button: Int, value: Float): Void {
gamepads[gamepad].sendButtonEvent(button, value);
}
static function audioCallback(samples: Int): Void {
kha.audio2.Audio._callCallback(samples);
var buffer = @:privateAccess kha.audio2.Audio.buffer;
Krom.writeAudioBuffer(buffer.data.buffer, samples);
}
public static function init(options: SystemOptions, callback: Window->Void): Void {
Krom.init(options.title, options.width, options.height, options.framebuffer.samplesPerPixel, options.framebuffer.verticalSync,
cast options.window.mode, options.window.windowFeatures, Krom.KROM_API);
start = Krom.getTime();
haxe.Log.trace = function(v: Dynamic, ?infos: haxe.PosInfos) {
var message = haxe.Log.formatOutput(v, infos);
Krom.log(message);
};
new Window(0);
Scheduler.init();
Shaders.init();
var g4 = new kha.krom.Graphics();
framebuffer = new Framebuffer(0, null, null, g4);
framebuffer.init(new kha.graphics2.Graphics1(framebuffer), new kha.graphics4.Graphics2(framebuffer), g4);
Krom.setCallback(renderCallback);
Krom.setDropFilesCallback(dropFilesCallback);
Krom.setCutCopyPasteCallback(cutCallback, copyCallback, pasteCallback);
Krom.setApplicationStateCallback(foregroundCallback, resumeCallback, pauseCallback, backgroundCallback, shutdownCallback);
keyboard = new Keyboard();
mouse = new MouseImpl();
pen = new Pen();
gamepads = new Array<Gamepad>();
for (i in 0...maxGamepads) {
gamepads[i] = new Gamepad(i);
}
Krom.setKeyboardDownCallback(keyboardDownCallback);
Krom.setKeyboardUpCallback(keyboardUpCallback);
Krom.setKeyboardPressCallback(keyboardPressCallback);
Krom.setMouseDownCallback(mouseDownCallback);
Krom.setMouseUpCallback(mouseUpCallback);
Krom.setMouseMoveCallback(mouseMoveCallback);
Krom.setMouseWheelCallback(mouseWheelCallback);
Krom.setPenDownCallback(penDownCallback);
Krom.setPenUpCallback(penUpCallback);
Krom.setPenMoveCallback(penMoveCallback);
Krom.setGamepadAxisCallback(gamepadAxisCallback);
Krom.setGamepadButtonCallback(gamepadButtonCallback);
kha.audio2.Audio.samplesPerSecond = Krom.getSamplesPerSecond();
kha.audio1.Audio._init();
kha.audio2.Audio._init();
Krom.setAudioCallback(audioCallback);
Scheduler.start();
callback(Window.get(0));
}
public static function initEx(title: String, options: Array<WindowOptions>, windowCallback: Int->Void, callback: Void->Void): Void {}
static function translateWindowMode(value: Null<WindowMode>): Int {
if (value == null) {
return 0;
}
return switch (value) {
case Windowed: 0;
case Fullscreen: 1;
case ExclusiveFullscreen: 2;
}
}
public static function getScreenRotation(): ScreenRotation {
return ScreenRotation.RotationNone;
}
public static function getTime(): Float {
return Krom.getTime() - start;
}
public static function getVsync(): Bool {
return true;
}
public static function getRefreshRate(): Int {
return Krom.displayFrequency();
}
public static function getSystemId(): String {
return Krom.systemId();
}
public static function vibrate(ms: Int): Void {
// TODO: Implement
}
public static function getLanguage(): String {
return "en"; // TODO: Implement
}
public static function requestShutdown(): Bool {
Krom.requestShutdown();
return true;
}
public static function getMouse(num: Int): Mouse {
return mouse;
}
public static function getPen(num: Int): Pen {
return pen;
}
public static function getKeyboard(num: Int): Keyboard {
return keyboard;
}
public static function lockMouse(): Void {
if (!isMouseLocked()) {
Krom.lockMouse();
for (listener in mouseLockListeners) {
listener();
}
}
}
public static function unlockMouse(): Void {
if (isMouseLocked()) {
Krom.unlockMouse();
for (listener in mouseLockListeners) {
listener();
}
}
}
public static function canLockMouse(): Bool {
return Krom.canLockMouse();
}
public static function isMouseLocked(): Bool {
return Krom.isMouseLocked();
}
public static function notifyOfMouseLockChange(func: Void->Void, error: Void->Void): Void {
if (canLockMouse() && func != null) {
mouseLockListeners.push(func);
}
}
public static function removeFromMouseLockChange(func: Void->Void, error: Void->Void): Void {
if (canLockMouse() && func != null) {
mouseLockListeners.remove(func);
}
}
public static function hideSystemCursor(): Void {
Krom.showMouse(false);
}
public static function showSystemCursor(): Void {
Krom.showMouse(true);
}
static function unload(): Void {}
public static function canSwitchFullscreen(): Bool {
return false;
}
public static function isFullscreen(): Bool {
return false;
}
public static function requestFullscreen(): Void {}
public static function exitFullscreen(): Void {}
public static function notifyOfFullscreenChange(func: Void->Void, error: Void->Void): Void {}
public static function removeFromFullscreenChange(func: Void->Void, error: Void->Void): Void {}
public static function changeResolution(width: Int, height: Int): Void {}
public static function setKeepScreenOn(on: Bool): Void {}
public static function loadUrl(url: String): Void {}
public static function getGamepadId(index: Int): String {
return "unknown";
}
public static function getGamepadVendor(index: Int): String {
return "unknown";
}
public static function setGamepadRumble(index: Int, leftAmount: Float, rightAmount: Float): Void {}
public static function safeZone(): Float {
return 1.0;
}
public static function login(): Void {}
public static function automaticSafeZone(): Bool {
return true;
}
public static function setSafeZone(value: Float): Void {}
public static function unlockAchievement(id: Int): Void {}
public static function waitingForLogin(): Bool {
return false;
}
public static function disallowUserChange(): Void {}
public static function allowUserChange(): Void {}
}

View File

@ -1,57 +1,56 @@
package kha.audio2;
import kha.Sound;
import kha.internal.IntBox;
class Audio {
public static var disableGcInteractions = false;
static var intBox: IntBox = new IntBox(0);
static var buffer: Buffer;
public static function _init() {
var bufferSize = 1024 * 2;
buffer = new Buffer(bufferSize * 4, 2, 44100);
Audio.samplesPerSecond = 44100;
}
public static function _callCallback(samples: Int): Void {
if (buffer == null)
return;
if (audioCallback != null) {
intBox.value = samples;
audioCallback(intBox, buffer);
}
else {
for (i in 0...samples) {
buffer.data.set(buffer.writeLocation, 0);
buffer.writeLocation += 1;
if (buffer.writeLocation >= buffer.size) {
buffer.writeLocation = 0;
}
}
}
}
public static function _readSample(): Float {
if (buffer == null)
return 0;
var value = buffer.data.get(buffer.readLocation);
buffer.readLocation += 1;
if (buffer.readLocation >= buffer.size) {
buffer.readLocation = 0;
}
return value;
}
public static var samplesPerSecond: Int;
public static var audioCallback: IntBox->Buffer->Void;
public static function play(sound: Sound, loop: Bool = false): kha.audio1.AudioChannel {
return null;
}
public static function stream(sound: Sound, loop: Bool = false): kha.audio1.AudioChannel {
return null;
}
}
package kha.audio2;
import kha.Sound;
import kha.internal.IntBox;
class Audio {
public static var disableGcInteractions = false;
static var intBox: IntBox = new IntBox(0);
static var buffer: Buffer;
public static function _init() {
var bufferSize = 1024 * 2;
buffer = new Buffer(bufferSize * 4, 2, samplesPerSecond);
}
public static function _callCallback(samples: Int): Void {
if (buffer == null)
return;
if (audioCallback != null) {
intBox.value = samples;
audioCallback(intBox, buffer);
}
else {
for (i in 0...samples) {
buffer.data.set(buffer.writeLocation, 0);
buffer.writeLocation += 1;
if (buffer.writeLocation >= buffer.size) {
buffer.writeLocation = 0;
}
}
}
}
public static function _readSample(): FastFloat {
if (buffer == null)
return 0;
var value = buffer.data.get(buffer.readLocation);
++buffer.readLocation;
if (buffer.readLocation >= buffer.size) {
buffer.readLocation = 0;
}
return value;
}
public static var samplesPerSecond: Int;
public static var audioCallback: IntBox->Buffer->Void;
public static function play(sound: Sound, loop: Bool = false): kha.audio1.AudioChannel {
return null;
}
public static function stream(sound: Sound, loop: Bool = false): kha.audio1.AudioChannel {
return null;
}
}

View File

@ -59,7 +59,7 @@ class Graphics implements kha.graphics4.Graphics {
}
public function refreshRate(): Int {
return 60;
return Krom.displayFrequency();
}
public function clear(?color: Color, ?depth: Float, ?stencil: Int): Void {

View File

@ -34,22 +34,46 @@ void copySample(void *buffer) {
}
int playback_callback(snd_pcm_sframes_t nframes) {
int err = 0;
if (kinc_a2_internal_callback(&a2_buffer, nframes)) {
int ni = 0;
while (ni < nframes) {
int i = 0;
for (; ni < nframes && i < 4096 * 2; ++i, ++ni) {
copySample(&buf[i * 2]);
}
int err2;
if ((err2 = snd_pcm_writei(playback_handle, buf, i)) < 0) {
fprintf(stderr, "write failed (%s)\n", snd_strerror(err2));
}
err += err2;
}
}
return err;
int err = 0;
if (kinc_a2_internal_callback(&a2_buffer, nframes)) {
int ni = 0;
while (ni < nframes) {
int i = 0;
for (; ni < nframes && i < 4096; ++i, ++ni) {
copySample(&buf[i * 2]);
}
int err2 = snd_pcm_writei(playback_handle, buf, i);
if (err2 < 0) {
fprintf(stderr, "ALSA write failed in playback_callback: %s\n", snd_strerror(err2));
return err2;
}
if (err2 < i) {
fprintf(stderr, "ALSA short write in playback_callback: wrote %d of %d frames\n", err2, i);
}
}
err = nframes;
}
else {
// Write silence data to prevent recovery
if (nframes > 4096) {
fprintf(stderr, "Warning: ALSA requested %ld frames for silence, exceeding local buffer size %d. Clamping.\n", nframes, 4096);
nframes = 4096;
}
memset(buf, 0, nframes * 4);
int err2 = snd_pcm_writei(playback_handle, buf, nframes);
if (err2 < 0) {
fprintf(stderr, "ALSA silence write failed in playback_callback: %s\n", snd_strerror(err2));
err = err2;
} else {
if (err2 < nframes) {
fprintf(stderr, "ALSA short silence write in playback_callback: wrote %d of %d frames\n", err2, (int)nframes);
}
err = err2;
}
}
return err;
}
bool tryToRecover(snd_pcm_t *handle, int errorCode) {

View File

@ -140,4 +140,4 @@ void kinc_internal_gamepad_trigger_button(int gamepad, int button, float value)
#ifdef __cplusplus
}
#endif
#endif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 417 KiB

After

Width:  |  Height:  |  Size: 281 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 417 KiB

After

Width:  |  Height:  |  Size: 281 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 417 KiB

After

Width:  |  Height:  |  Size: 281 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 417 KiB

After

Width:  |  Height:  |  Size: 281 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 417 KiB

After

Width:  |  Height:  |  Size: 281 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 417 KiB

After

Width:  |  Height:  |  Size: 281 KiB

File diff suppressed because it is too large Load Diff

BIN
Krom/Krom Executable file → Normal file

Binary file not shown.

Binary file not shown.

BIN
Krom/Krom_opengl.exe Normal file

Binary file not shown.

View File

@ -6,22 +6,12 @@ Welcome to Leenkx!
<br>
- <a style="color:#2AE0E0;" class="text primary primary-text" href="https://leenkx.com/files/LeenkxSDK3_RC.zip">LeenkxSDKV3.6 lts</a>
<br>
- <a style="color:#2AE0E0;" class="text primary primary-text" href="https://leenkx.com/files/lx/Leenkx.js">Leenkx.js</a>
<br>
- Run your own private p2p torrent socket changing Leenkx javascript file directly in /lnxsdk/lib/leenkx_tools/lxjs/Leenkx.js or by configuring the OPTS map in the create Leenkx node.
- Run your own private p2p torrent socket changing Leenkx javascript file directly in /lnxsdk/lib/leenkx_tools/lnxjs/Leenkx.js or by configuring the OPTS map in the create Leenkx node.
<br>
- All works are open source ZLIB / MIT and any compatible licence that guarantee the softwares freedom from my additions to the previous maintainers
<br>
- LxJS Works as a standalone library
- LNXJS Works as a standalone library
<br>
- The SDK is not ready for production, use for educational purposes. Help the team by reaching out at Leenkx.com!
<br>
- This build is based on QuantumCoder's whole new core animation system packed with new features! Timmodrians Aura library is also built into this build when audio is enabled!
<br>
- The SDK is still undergoing many changes so working on large projects is not recommended.
<br>
- Special thanks to all contributors from the following projects!
<br>
* https://github.com/armory3d/armory/graphs/contributors<br>

View File

@ -310,9 +310,9 @@ class LeenkxAddonPreferences(AddonPreferences):
layout.label(text="Welcome to Leenkx!")
# Compare version Blender and Leenkx (major, minor)
if bpy.app.version[0] != 3 or bpy.app.version[1] != 6:
if bpy.app.version[:2] not in [(4, 4), (4, 2), (3, 6), (3, 3)]:
box = layout.box().column()
box.label(text="Warning: For Leenkx to work correctly, you need Blender 3.6 LTS.")
box.label(text="Warning: For Leenkx to work correctly, use a Blender LTS version")
layout.prop(self, "sdk_path")
sdk_path = get_sdk_path(context)
@ -914,7 +914,10 @@ def restart_leenkx(context):
@persistent
def on_load_post(context):
restart_leenkx(bpy.context) # context is None, use bpy.context instead
if bpy.context is not None:
restart_leenkx(bpy.context) # context is None, use bpy.context instead
else:
bpy.app.timers.register(lambda: restart_leenkx(bpy.context), first_interval=0.1)
def on_register_post():

View File

@ -475,7 +475,11 @@ fragColor.rgb = min(fragColor.rgb, 65504 * 0.5);
} else {
fragColor.rgb = mix(midLumColor, maxLumColor, luminance);
}
} else if (PPComp4.x == 9){
fragColor.rgb = tonemapAgXSimple(fragColor.rgb);
fragColor.rgb = pow(fragColor.rgb, vec3(1.0 / 2.2)); // To gamma
} else if (PPComp4.x == 10){
fragColor.rgb = tonemapAgXFull(fragColor.rgb);
} else {
fragColor.rgb = vec3(0,1,0); //ERROR
}
@ -498,6 +502,13 @@ fragColor.rgb = min(fragColor.rgb, 65504 * 0.5);
fragColor.rgb = pow(fragColor.rgb, vec3(1.0 / 2.2)); // To gamma
fragColor.rgb = clamp(fragColor.rgb, 0.0, 2.2);
#endif
#ifdef _CToneAgXSimple
fragColor.rgb = tonemapAgXSimple(fragColor.rgb);
fragColor.rgb = pow(fragColor.rgb, vec3(1.0 / 2.2)); // To gamma
#endif
#ifdef _CToneAgXFull
fragColor.rgb = tonemapAgXFull(fragColor.rgb);
#endif
#ifdef _CToneNone
fragColor.rgb = pow(fragColor.rgb, vec3(1.0 / 2.2)); // To gamma
#endif
@ -614,4 +625,37 @@ fragColor.rgb = min(fragColor.rgb, 65504 * 0.5);
#ifdef _CLUT
fragColor = LUTlookup(fragColor, lutTexture);
#endif
#ifdef _CDitheringBlueNoise
const float ditherStrength = ditherStrengthValue / 255.0;
float noise = ditherBlueNoiseStyle(gl_FragCoord.xy);
float noiseOffset = (noise - 0.5) * ditherStrength;
fragColor.rgb += noiseOffset;
#endif
#ifdef _CDitheringWhiteNoise
const float ditherStrength = ditherStrengthValue / 255.0;
float noise = ditherWhiteNoise(gl_FragCoord.xy);
float noiseOffset = (noise - 0.5) * ditherStrength;
fragColor.rgb += noiseOffset;
#endif
#ifdef _CDitheringOrderedBayer4x4
const float ditherStrength = ditherStrengthValue / 255.0;
float noise = ditherOrderedBayer4x4(ivec2(gl_FragCoord.xy));
float noiseOffset = (noise - 0.5) * ditherStrength;
fragColor.rgb += noiseOffset;
#endif
#ifdef _CDitheringOrderedBayer8x8
const float ditherStrength = ditherStrengthValue / 255.0;
float noise = ditherOrderedBayer8x8(ivec2(gl_FragCoord.xy));
float noiseOffset = (noise - 0.5) * ditherStrength;
fragColor.rgb += noiseOffset;
#endif
//fragColor.rgb = clamp(fragColor.rgb, 0.0, 1.0);
}

View File

@ -20,7 +20,7 @@ uniform sampler2D gbuffer0;
uniform sampler2D gbuffer1;
#ifdef _gbuffer2
uniform sampler2D gbuffer2;
//!uniform sampler2D gbuffer2;
#endif
#ifdef _EmissionShaded
uniform sampler2D gbufferEmission;
@ -286,7 +286,7 @@ void main() {
#ifdef _VoxelGI
vec4 indirect_diffuse = textureLod(voxels_diffuse, texCoord, 0.0);
fragColor.rgb = (indirect_diffuse.rgb * albedo + envl.rgb * (1.0 - indirect_diffuse.a)) * voxelgiDiff;
fragColor.rgb = (indirect_diffuse.rgb + envl.rgb * (1.0 - indirect_diffuse.a)) * albedo * voxelgiDiff;
if(roughness < 1.0 && occspec.y > 0.0)
fragColor.rgb += textureLod(voxels_specular, texCoord, 0.0).rgb * occspec.y * voxelgiRefl;
#endif
@ -380,7 +380,7 @@ void main() {
#endif
#ifdef _VoxelShadow
svisibility *= (1.0 - traceShadow(p, n, voxels, voxelsSDF, sunDir, clipmaps, gl_FragCoord.xy).r) * voxelgiShad;
svisibility *= (1.0 - traceShadow(p, n, voxels, voxelsSDF, sunDir, clipmaps, gl_FragCoord.xy, g2.rg).r) * voxelgiShad;
#endif
#ifdef _SSRS

View File

@ -92,7 +92,7 @@ void main() {
vec3 viewNormal = V3 * n;
vec3 viewPos = getPosView(viewRay, d, cameraProj);
vec3 reflected = reflect(viewPos, viewNormal);
vec3 reflected = reflect(normalize(viewPos), viewNormal);
hitCoord = viewPos;
#ifdef _CPostprocess

View File

@ -57,14 +57,17 @@ vec4 binarySearch(vec3 dir) {
}
vec4 rayCast(vec3 dir) {
float ddepth;
dir *= ss_refractionRayStep;
for (int i = 0; i < maxSteps; i++) {
hitCoord += dir;
ddepth = getDeltaDepth(hitCoord);
if (ddepth > 0.0) return binarySearch(dir);
}
return vec4(texCoord, 0.0, 1.0);
float ddepth;
dir *= ss_refractionRayStep;
for (int i = 0; i < maxSteps; i++) {
hitCoord += dir;
ddepth = getDeltaDepth(hitCoord);
if (ddepth > 0.0)
return binarySearch(dir);
}
// No hit — fallback to projecting the ray to UV space
vec2 fallbackUV = getProjectedCoord(hitCoord);
return vec4(fallbackUV, 0.0, 0.5); // We set .w lower to indicate fallback
}
void main() {
@ -74,7 +77,7 @@ void main() {
float ior = gr.x;
float opac = gr.y;
float d = textureLod(gbufferD, texCoord, 0.0).r * 2.0 - 1.0;
if (d == 0.0 || d == 1.0 || opac == 1.0 || ior == 1.0) {
if (d == 0.0 || opac == 1.0 || ior == 1.0) {
fragColor.rgb = textureLod(tex1, texCoord, 0.0).rgb;
return;
}
@ -86,7 +89,7 @@ void main() {
vec3 viewNormal = V3 * n;
vec3 viewPos = getPosView(viewRay, d, cameraProj);
vec3 refracted = refract(viewPos, viewNormal, 1.0 / ior);
vec3 refracted = refract(normalize(viewPos), viewNormal, 1.0 / ior);
hitCoord = viewPos;
vec3 dir = refracted * (1.0 - rand(texCoord) * ss_refractionJitter * roughness) * 2.0;

View File

@ -166,7 +166,7 @@ vec4 traceDiffuse(const vec3 origin, const vec3 normal, const sampler3D voxels,
}
vec4 traceSpecular(const vec3 origin, const vec3 normal, const sampler3D voxels, const sampler3D voxelsSDF, const vec3 viewDir, const float roughness, const float clipmaps[voxelgiClipmapCount * 10], const vec2 pixel, const vec2 velocity) {
vec3 specularDir = reflect(-viewDir, normal);
vec3 specularDir = reflect(normalize(-viewDir), normal);
vec3 P = origin + specularDir * ((BayerMatrix8[int(pixel.x + velocity.x) % 8][int(pixel.y + velocity.y) % 8] - 0.5)) * voxelgiStep;
vec4 amount = traceCone(voxels, voxelsSDF, P, normal, specularDir, 0, true, roughness, voxelgiStep, clipmaps);
@ -176,9 +176,9 @@ vec4 traceSpecular(const vec3 origin, const vec3 normal, const sampler3D voxels,
return amount * voxelgiOcc;
}
vec4 traceRefraction(const vec3 origin, const vec3 normal, sampler3D voxels, sampler3D voxelsSDF, const vec3 viewDir, const float ior, const float roughness, const float clipmaps[voxelgiClipmapCount * 10], const vec2 pixel, const vec2 velocity) {
const float transmittance = 1.0;
vec3 refractionDir = refract(-viewDir, normal, 1.0 / ior);
vec4 traceRefraction(const vec3 origin, const vec3 normal, sampler3D voxels, sampler3D voxelsSDF, const vec3 viewDir, const float ior, const float roughness, const float clipmaps[voxelgiClipmapCount * 10], const vec2 pixel, const vec2 velocity, const float opacity) {
const float transmittance = 1.0 - opacity;
vec3 refractionDir = refract(normalize(-viewDir), normal, 1.0 / ior);
vec3 P = origin + refractionDir * (BayerMatrix8[int(pixel.x + velocity.x) % 8][int(pixel.y + velocity.y) % 8] - 0.5) * voxelgiStep;
vec4 amount = transmittance * traceCone(voxels, voxelsSDF, P, normal, refractionDir, 0, true, roughness, voxelgiStep, clipmaps);
@ -328,8 +328,8 @@ float traceConeShadow(const sampler3D voxels, const sampler3D voxelsSDF, const v
}
float traceShadow(const vec3 origin, const vec3 normal, const sampler3D voxels, const sampler3D voxelsSDF, const vec3 dir, const float clipmaps[voxelgiClipmapCount * 10], const vec2 pixel) {
vec3 P = origin + dir * (BayerMatrix8[int(pixel.x) % 8][int(pixel.y) % 8] - 0.5) * voxelgiStep;
float traceShadow(const vec3 origin, const vec3 normal, const sampler3D voxels, const sampler3D voxelsSDF, const vec3 dir, const float clipmaps[voxelgiClipmapCount * 10], const vec2 pixel, const vec2 velocity) {
vec3 P = origin + dir * (BayerMatrix8[int(pixel.x + velocity.x) % 8][int(pixel.y + velocity.y) % 8] - 0.5) * voxelgiStep;
float amount = traceConeShadow(voxels, voxelsSDF, P, normal, dir, DIFFUSE_CONE_APERTURE, voxelgiStep, clipmaps);
amount = clamp(amount, 0.0, 1.0);
return amount * voxelgiOcc;

View File

@ -1,239 +1,242 @@
#ifndef _LIGHT_GLSL_
#define _LIGHT_GLSL_
#include "compiled.inc"
#include "std/brdf.glsl"
#include "std/math.glsl"
#ifdef _ShadowMap
#include "std/shadows.glsl"
#endif
#ifdef _VoxelShadow
#include "std/conetrace.glsl"
//!uniform sampler2D voxels_shadows;
#endif
#ifdef _LTC
#include "std/ltc.glsl"
#endif
#ifdef _LightIES
#include "std/ies.glsl"
#endif
#ifdef _SSRS
#include "std/ssrs.glsl"
#endif
#ifdef _Spot
#include "std/light_common.glsl"
#endif
#ifdef _ShadowMap
#ifdef _SinglePoint
#ifdef _Spot
#ifndef _LTC
uniform sampler2DShadow shadowMapSpot[1];
uniform sampler2D shadowMapSpotTransparent[1];
uniform mat4 LWVPSpot[1];
#endif
#else
uniform samplerCubeShadow shadowMapPoint[1];
uniform samplerCube shadowMapPointTransparent[1];
uniform vec2 lightProj;
#endif
#endif
#ifdef _Clusters
#ifdef _SingleAtlas
//!uniform sampler2DShadow shadowMapAtlas;
//!uniform sampler2D shadowMapAtlasTransparent;
#endif
uniform vec2 lightProj;
#ifdef _ShadowMapAtlas
#ifndef _SingleAtlas
uniform sampler2DShadow shadowMapAtlasPoint;
uniform sampler2D shadowMapAtlasPointTransparent;
#endif
#else
uniform samplerCubeShadow shadowMapPoint[4];
uniform samplerCube shadowMapPointTransparent[4];
#endif
#ifdef _Spot
#ifdef _ShadowMapAtlas
#ifndef _SingleAtlas
uniform sampler2DShadow shadowMapAtlasSpot;
uniform sampler2D shadowMapAtlasSpotTransparent;
#endif
#else
uniform sampler2DShadow shadowMapSpot[4];
uniform sampler2D shadowMapSpotTransparent[4];
#endif
uniform mat4 LWVPSpotArray[maxLightsCluster];
#endif
#endif
#endif
#ifdef _LTC
uniform vec3 lightArea0;
uniform vec3 lightArea1;
uniform vec3 lightArea2;
uniform vec3 lightArea3;
uniform sampler2D sltcMat;
uniform sampler2D sltcMag;
#ifdef _ShadowMap
#ifndef _Spot
#ifdef _SinglePoint
uniform sampler2DShadow shadowMapSpot[1];
uniform sampler2D shadowMapSpotTransparent[1];
uniform mat4 LWVPSpot[1];
#endif
#ifdef _Clusters
uniform sampler2DShadow shadowMapSpot[maxLightsCluster];
uniform sampler2D shadowMapSpotTransparent[maxLightsCluster];
uniform mat4 LWVPSpotArray[maxLightsCluster];
#endif
#endif
#endif
#endif
vec3 sampleLight(const vec3 p, const vec3 n, const vec3 v, const float dotNV, const vec3 lp, const vec3 lightCol,
const vec3 albedo, const float rough, const float spec, const vec3 f0
#ifdef _ShadowMap
, int index, float bias, bool receiveShadow, bool transparent
#endif
#ifdef _Spot
, const bool isSpot, const float spotSize, float spotBlend, vec3 spotDir, vec2 scale, vec3 right
#endif
#ifdef _VoxelShadow
, sampler3D voxels, sampler3D voxelsSDF, float clipmaps[10 * voxelgiClipmapCount]
#endif
#ifdef _MicroShadowing
, float occ
#endif
#ifdef _SSRS
, sampler2D gbufferD, mat4 invVP, vec3 eye
#endif
) {
vec3 ld = lp - p;
vec3 l = normalize(ld);
vec3 h = normalize(v + l);
float dotNH = max(0.0, dot(n, h));
float dotVH = max(0.0, dot(v, h));
float dotNL = max(0.0, dot(n, l));
#ifdef _LTC
float theta = acos(dotNV);
vec2 tuv = vec2(rough, theta / (0.5 * PI));
tuv = tuv * LUT_SCALE + LUT_BIAS;
vec4 t = textureLod(sltcMat, tuv, 0.0);
mat3 invM = mat3(
vec3(1.0, 0.0, t.y),
vec3(0.0, t.z, 0.0),
vec3(t.w, 0.0, t.x));
float ltcspec = ltcEvaluate(n, v, dotNV, p, invM, lightArea0, lightArea1, lightArea2, lightArea3);
ltcspec *= textureLod(sltcMag, tuv, 0.0).a;
float ltcdiff = ltcEvaluate(n, v, dotNV, p, mat3(1.0), lightArea0, lightArea1, lightArea2, lightArea3);
vec3 direct = albedo * ltcdiff + ltcspec * spec * 0.05;
#else
vec3 direct = lambertDiffuseBRDF(albedo, dotNL) +
specularBRDF(f0, rough, dotNL, dotNH, dotNV, dotVH) * spec;
#endif
direct *= attenuate(distance(p, lp));
direct *= lightCol;
#ifdef _MicroShadowing
direct *= clamp(dotNL + 2.0 * occ * occ - 1.0, 0.0, 1.0);
#endif
#ifdef _SSRS
direct *= traceShadowSS(l, p, gbufferD, invVP, eye);
#endif
#ifdef _VoxelShadow
direct *= (1.0 - traceShadow(p, n, voxels, voxelsSDF, l, clipmaps, gl_FragCoord.xy).r) * voxelgiShad;
#endif
#ifdef _LTC
#ifdef _ShadowMap
if (receiveShadow) {
#ifdef _SinglePoint
vec4 lPos = LWVPSpotArray[0] * vec4(p + n * bias * 10, 1.0);
direct *= shadowTest(shadowMapSpot[0], shadowMapSpotTransparent[0], lPos.xyz / lPos.w, bias, transparent);
#endif
#ifdef _Clusters
vec4 lPos = LWVPSpotArray[index] * vec4(p + n * bias * 10, 1.0);
if (index == 0) direct *= shadowTest(shadowMapSpot[0], shadowMapSpotTransparent[0], lPos.xyz / lPos.w, bias, transparent);
else if (index == 1) direct *= shadowTest(shadowMapSpot[1], shadowMapSpotTransparent[1], lPos.xyz / lPos.w, bias, transparent);
else if (index == 2) direct *= shadowTest(shadowMapSpot[2], shadowMapSpotTransparent[2], lPos.xyz / lPos.w, bias, transparent);
else if (index == 3) direct *= shadowTest(shadowMapSpot[3], shadowMapSpotTransparent[3], lPos.xyz / lPos.w, bias, transparent);
#endif
}
#endif
return direct;
#endif
#ifdef _Spot
if (isSpot) {
direct *= spotlightMask(l, spotDir, right, scale, spotSize, spotBlend);
#ifdef _ShadowMap
if (receiveShadow) {
#ifdef _SinglePoint
vec4 lPos = LWVPSpot[0] * vec4(p + n * bias * 10, 1.0);
direct *= shadowTest(shadowMapSpot[0], shadowMapSpotTransparent[0], lPos.xyz / lPos.w, bias, transparent);
#endif
#ifdef _Clusters
vec4 lPos = LWVPSpotArray[index] * vec4(p + n * bias * 10, 1.0);
#ifdef _ShadowMapAtlas
direct *= shadowTest(
#ifndef _SingleAtlas
shadowMapAtlasSpot, shadowMapAtlasSpotTransparent
#else
shadowMapAtlas, shadowMapAtlasTransparent
#endif
, lPos.xyz / lPos.w, bias, transparent
);
#else
if (index == 0) direct *= shadowTest(shadowMapSpot[0], shadowMapSpotTransparent[0], lPos.xyz / lPos.w, bias, transparent);
else if (index == 1) direct *= shadowTest(shadowMapSpot[1], shadowMapSpotTransparent[1], lPos.xyz / lPos.w, bias, transparent);
else if (index == 2) direct *= shadowTest(shadowMapSpot[2], shadowMapSpotTransparent[2], lPos.xyz / lPos.w, bias, transparent);
else if (index == 3) direct *= shadowTest(shadowMapSpot[3], shadowMapSpotTransparent[3], lPos.xyz / lPos.w, bias, transparent);
#endif
#endif
}
#endif
return direct;
}
#endif
#ifdef _LightIES
direct *= iesAttenuation(-l);
#endif
#ifdef _ShadowMap
if (receiveShadow) {
#ifdef _SinglePoint
#ifndef _Spot
direct *= PCFCube(shadowMapPoint[0], shadowMapPointTransparent[0], ld, -l, bias, lightProj, n, transparent);
#endif
#endif
#ifdef _Clusters
#ifdef _ShadowMapAtlas
direct *= PCFFakeCube(
#ifndef _SingleAtlas
shadowMapAtlasPoint, shadowMapAtlasPointTransparent
#else
shadowMapAtlas, shadowMapAtlasTransparent
#endif
, ld, -l, bias, lightProj, n, index, transparent
);
#else
if (index == 0) direct *= PCFCube(shadowMapPoint[0], shadowMapPointTransparent[0], ld, -l, bias, lightProj, n, transparent);
else if (index == 1) direct *= PCFCube(shadowMapPoint[1], shadowMapPointTransparent[1], ld, -l, bias, lightProj, n, transparent);
else if (index == 2) direct *= PCFCube(shadowMapPoint[2], shadowMapPointTransparent[2], ld, -l, bias, lightProj, n, transparent);
else if (index == 3) direct *= PCFCube(shadowMapPoint[3], shadowMapPointTransparent[3], ld, -l, bias, lightProj, n, transparent);
#endif
#endif
}
#endif
return direct;
}
#endif
#ifndef _LIGHT_GLSL_
#define _LIGHT_GLSL_
#include "compiled.inc"
#include "std/brdf.glsl"
#include "std/math.glsl"
#ifdef _ShadowMap
#include "std/shadows.glsl"
#endif
#ifdef _VoxelShadow
#include "std/conetrace.glsl"
#endif
#ifdef _gbuffer2
uniform sampler2D gbuffer2;
#endif
#ifdef _LTC
#include "std/ltc.glsl"
#endif
#ifdef _LightIES
#include "std/ies.glsl"
#endif
#ifdef _SSRS
#include "std/ssrs.glsl"
#endif
#ifdef _Spot
#include "std/light_common.glsl"
#endif
#ifdef _ShadowMap
#ifdef _SinglePoint
#ifdef _Spot
#ifndef _LTC
uniform sampler2DShadow shadowMapSpot[1];
uniform sampler2D shadowMapSpotTransparent[1];
uniform mat4 LWVPSpot[1];
#endif
#else
uniform samplerCubeShadow shadowMapPoint[1];
uniform samplerCube shadowMapPointTransparent[1];
uniform vec2 lightProj;
#endif
#endif
#ifdef _Clusters
#ifdef _SingleAtlas
//!uniform sampler2DShadow shadowMapAtlas;
//!uniform sampler2D shadowMapAtlasTransparent;
#endif
uniform vec2 lightProj;
#ifdef _ShadowMapAtlas
#ifndef _SingleAtlas
uniform sampler2DShadow shadowMapAtlasPoint;
uniform sampler2D shadowMapAtlasPointTransparent;
#endif
#else
uniform samplerCubeShadow shadowMapPoint[4];
uniform samplerCube shadowMapPointTransparent[4];
#endif
#ifdef _Spot
#ifdef _ShadowMapAtlas
#ifndef _SingleAtlas
uniform sampler2DShadow shadowMapAtlasSpot;
uniform sampler2D shadowMapAtlasSpotTransparent;
#endif
#else
uniform sampler2DShadow shadowMapSpot[4];
uniform sampler2D shadowMapSpotTransparent[4];
#endif
uniform mat4 LWVPSpotArray[maxLightsCluster];
#endif
#endif
#endif
#ifdef _LTC
uniform vec3 lightArea0;
uniform vec3 lightArea1;
uniform vec3 lightArea2;
uniform vec3 lightArea3;
uniform sampler2D sltcMat;
uniform sampler2D sltcMag;
#ifdef _ShadowMap
#ifndef _Spot
#ifdef _SinglePoint
uniform sampler2DShadow shadowMapSpot[1];
uniform sampler2D shadowMapSpotTransparent[1];
uniform mat4 LWVPSpot[1];
#endif
#ifdef _Clusters
uniform sampler2DShadow shadowMapSpot[maxLightsCluster];
uniform sampler2D shadowMapSpotTransparent[maxLightsCluster];
uniform mat4 LWVPSpotArray[maxLightsCluster];
#endif
#endif
#endif
#endif
vec3 sampleLight(const vec3 p, const vec3 n, const vec3 v, const float dotNV, const vec3 lp, const vec3 lightCol,
const vec3 albedo, const float rough, const float spec, const vec3 f0
#ifdef _ShadowMap
, int index, float bias, bool receiveShadow, bool transparent
#endif
#ifdef _Spot
, const bool isSpot, const float spotSize, float spotBlend, vec3 spotDir, vec2 scale, vec3 right
#endif
#ifdef _VoxelShadow
, sampler3D voxels, sampler3D voxelsSDF, float clipmaps[10 * voxelgiClipmapCount]
#endif
#ifdef _MicroShadowing
, float occ
#endif
#ifdef _SSRS
, sampler2D gbufferD, mat4 invVP, vec3 eye
#endif
) {
vec3 ld = lp - p;
vec3 l = normalize(ld);
vec3 h = normalize(v + l);
float dotNH = max(0.0, dot(n, h));
float dotVH = max(0.0, dot(v, h));
float dotNL = max(0.0, dot(n, l));
#ifdef _LTC
float theta = acos(dotNV);
vec2 tuv = vec2(rough, theta / (0.5 * PI));
tuv = tuv * LUT_SCALE + LUT_BIAS;
vec4 t = textureLod(sltcMat, tuv, 0.0);
mat3 invM = mat3(
vec3(1.0, 0.0, t.y),
vec3(0.0, t.z, 0.0),
vec3(t.w, 0.0, t.x));
float ltcspec = ltcEvaluate(n, v, dotNV, p, invM, lightArea0, lightArea1, lightArea2, lightArea3);
ltcspec *= textureLod(sltcMag, tuv, 0.0).a;
float ltcdiff = ltcEvaluate(n, v, dotNV, p, mat3(1.0), lightArea0, lightArea1, lightArea2, lightArea3);
vec3 direct = albedo * ltcdiff + ltcspec * spec * 0.05;
#else
vec3 direct = lambertDiffuseBRDF(albedo, dotNL) +
specularBRDF(f0, rough, dotNL, dotNH, dotNV, dotVH) * spec;
#endif
direct *= attenuate(distance(p, lp));
direct *= lightCol;
#ifdef _MicroShadowing
direct *= clamp(dotNL + 2.0 * occ * occ - 1.0, 0.0, 1.0);
#endif
#ifdef _SSRS
direct *= traceShadowSS(l, p, gbufferD, invVP, eye);
#endif
#ifdef _VoxelShadow
vec4 g2 = textureLod(gbuffer2, gl_FragCoord.xy, 0.0);
direct *= (1.0 - traceShadow(p, n, voxels, voxelsSDF, l, clipmaps, gl_FragCoord.xy, g2.rg).r) * voxelgiShad;
#endif
#ifdef _LTC
#ifdef _ShadowMap
if (receiveShadow) {
#ifdef _SinglePoint
vec4 lPos = LWVPSpotArray[0] * vec4(p + n * bias * 10, 1.0);
direct *= shadowTest(shadowMapSpot[0], shadowMapSpotTransparent[0], lPos.xyz / lPos.w, bias, transparent);
#endif
#ifdef _Clusters
vec4 lPos = LWVPSpotArray[index] * vec4(p + n * bias * 10, 1.0);
if (index == 0) direct *= shadowTest(shadowMapSpot[0], shadowMapSpotTransparent[0], lPos.xyz / lPos.w, bias, transparent);
else if (index == 1) direct *= shadowTest(shadowMapSpot[1], shadowMapSpotTransparent[1], lPos.xyz / lPos.w, bias, transparent);
else if (index == 2) direct *= shadowTest(shadowMapSpot[2], shadowMapSpotTransparent[2], lPos.xyz / lPos.w, bias, transparent);
else if (index == 3) direct *= shadowTest(shadowMapSpot[3], shadowMapSpotTransparent[3], lPos.xyz / lPos.w, bias, transparent);
#endif
}
#endif
return direct;
#endif
#ifdef _Spot
if (isSpot) {
direct *= spotlightMask(l, spotDir, right, scale, spotSize, spotBlend);
#ifdef _ShadowMap
if (receiveShadow) {
#ifdef _SinglePoint
vec4 lPos = LWVPSpot[0] * vec4(p + n * bias * 10, 1.0);
direct *= shadowTest(shadowMapSpot[0], shadowMapSpotTransparent[0], lPos.xyz / lPos.w, bias, transparent);
#endif
#ifdef _Clusters
vec4 lPos = LWVPSpotArray[index] * vec4(p + n * bias * 10, 1.0);
#ifdef _ShadowMapAtlas
direct *= shadowTest(
#ifndef _SingleAtlas
shadowMapAtlasSpot, shadowMapAtlasSpotTransparent
#else
shadowMapAtlas, shadowMapAtlasTransparent
#endif
, lPos.xyz / lPos.w, bias, transparent
);
#else
if (index == 0) direct *= shadowTest(shadowMapSpot[0], shadowMapSpotTransparent[0], lPos.xyz / lPos.w, bias, transparent);
else if (index == 1) direct *= shadowTest(shadowMapSpot[1], shadowMapSpotTransparent[1], lPos.xyz / lPos.w, bias, transparent);
else if (index == 2) direct *= shadowTest(shadowMapSpot[2], shadowMapSpotTransparent[2], lPos.xyz / lPos.w, bias, transparent);
else if (index == 3) direct *= shadowTest(shadowMapSpot[3], shadowMapSpotTransparent[3], lPos.xyz / lPos.w, bias, transparent);
#endif
#endif
}
#endif
return direct;
}
#endif
#ifdef _LightIES
direct *= iesAttenuation(-l);
#endif
#ifdef _ShadowMap
if (receiveShadow) {
#ifdef _SinglePoint
#ifndef _Spot
direct *= PCFCube(shadowMapPoint[0], shadowMapPointTransparent[0], ld, -l, bias, lightProj, n, transparent);
#endif
#endif
#ifdef _Clusters
#ifdef _ShadowMapAtlas
direct *= PCFFakeCube(
#ifndef _SingleAtlas
shadowMapAtlasPoint, shadowMapAtlasPointTransparent
#else
shadowMapAtlas, shadowMapAtlasTransparent
#endif
, ld, -l, bias, lightProj, n, index, transparent
);
#else
if (index == 0) direct *= PCFCube(shadowMapPoint[0], shadowMapPointTransparent[0], ld, -l, bias, lightProj, n, transparent);
else if (index == 1) direct *= PCFCube(shadowMapPoint[1], shadowMapPointTransparent[1], ld, -l, bias, lightProj, n, transparent);
else if (index == 2) direct *= PCFCube(shadowMapPoint[2], shadowMapPointTransparent[2], ld, -l, bias, lightProj, n, transparent);
else if (index == 3) direct *= PCFCube(shadowMapPoint[3], shadowMapPointTransparent[3], ld, -l, bias, lightProj, n, transparent);
#endif
#endif
}
#endif
return direct;
}
#endif

View File

@ -1,4 +1,3 @@
vec3 uncharted2Tonemap(const vec3 x) {
const float A = 0.15;
const float B = 0.50;
@ -36,3 +35,106 @@ vec3 acesFilm(const vec3 x) {
vec3 tonemapReinhard(const vec3 color) {
return color / (color + vec3(1.0));
}
// Blender AgX Implementation
// Troy Sobotka https://github.com/sobotka/AgX
// AGX Simple
vec3 tonemapAgXSimple(vec3 x) {
// TODO CORRECT AND OPTIMIZE
x = max(x, vec3(0.0));
float exposure = 0.6;
x *= exposure;
const vec3 AgX_A = vec3(0.92, 0.92, 0.72);
const vec3 AgX_B = vec3(0.24, 0.24, 0.36);
const vec3 AgX_C = vec3(0.92, 0.92, 0.72);
const vec3 AgX_D = vec3(0.24, 0.24, 0.36);
const vec3 AgX_E = vec3(0.08, 0.08, 0.12);
const vec3 AgX_F = vec3(0.0);
vec3 result = (x * (AgX_A * x + AgX_B)) / (x * (AgX_C * x + AgX_D) + AgX_E) + AgX_F;
float luma = dot(result, vec3(0.2126, 0.7152, 0.0722));
result = mix(vec3(luma), result, 0.6);
return clamp(result, vec3(0.0), vec3(1.0));
}
// AGX Full Contrast Approx
vec3 agxDefaultContrastApprox(vec3 x) {
vec3 x2 = x * x;
vec3 x4 = x2 * x2;
return + 15.5 * x4 * x2
- 40.14 * x4 * x
+ 31.96 * x4
- 6.868 * x2 * x
+ 0.4298 * x2
+ 0.1191 * x
- 0.00232;
}
// AGX Full Look
vec3 agxLook(vec3 x, float strength) {
const vec3 slope = vec3(1.0);
const vec3 power = vec3(1.35);
const vec3 sat = vec3(1.4);
vec3 lw = vec3(0.2126, 0.7152, 0.0722);
float luma = dot(x, lw);
return pow(x * slope, power) * sat - (pow(luma * slope, power) * (sat - 1.0));
}
// AGX Full
vec3 tonemapAgXFull(vec3 x) {
// x *= 2.0 * (1.0/0.8); // Brightness scale to match Blender's default
x = clamp(x, 0.0, 65504.0);
x = log2(x + 1.0);
x = agxDefaultContrastApprox(clamp(x * 0.5 - 10.5, -12.0, 12.0));
x = mix(x, agxLook(x, 0.5), 0.5);
x = clamp(x, 0.0, 1.0);
return pow(x, vec3(1.0/2.2));
}
// Interleaved Gradient Noise (Pseudo-random, AKA Blue Noise style)
// Based on http://momentsingraphics.de/BlueNoise.html
float ditherBlueNoiseStyle(vec2 p) {
return fract(sin(dot(p.xy, vec2(12.9898, 78.233))) * 43758.5453123);
}
// White Noise Dithering
float ditherWhiteNoise(vec2 p) {
return fract(sin(dot(p, vec2(12.9898, 4.1414))) * 43758.5453);
}
// Ordered Dithering (4x4 Bayer Matrix)
float ditherOrderedBayer4x4(ivec2 p) {
const float bayer[16] = float[16](
0.0, 8.0, 2.0, 10.0,
12.0, 4.0, 14.0, 6.0,
3.0, 11.0, 1.0, 9.0,
15.0, 7.0, 13.0, 5.0
);
int index = (p.x % 4) * 4 + (p.y % 4);
return bayer[index] / 16.0;
}
// Ordered Dithering (8x8 Bayer Matrix)
float ditherOrderedBayer8x8(ivec2 p) {
const float bayer8x8[64] = float[64](
0.0, 32.0, 8.0, 40.0, 2.0, 34.0, 10.0, 42.0,
48.0, 16.0, 56.0, 24.0, 50.0, 18.0, 58.0, 26.0,
12.0, 44.0, 4.0, 36.0, 14.0, 46.0, 6.0, 38.0,
60.0, 28.0, 52.0, 20.0, 62.0, 30.0, 54.0, 22.0,
3.0, 35.0, 11.0, 43.0, 1.0, 33.0, 9.0, 41.0,
51.0, 19.0, 59.0, 27.0, 49.0, 17.0, 57.0, 25.0,
15.0, 47.0, 7.0, 39.0, 13.0, 45.0, 5.0, 37.0,
63.0, 31.0, 55.0, 23.0, 61.0, 29.0, 53.0, 21.0
);
int index = (p.x % 8) * 8 + (p.y % 8);
return bayer8x8[index] / 64.0;
}
//vec3 applyDither(vec3 color, vec2 screenCoord) {
// float quantizationLevels = 255.0;
// float noise = randomDither(screenCoord);
// float noiseOffset = (noise - 0.5) / quantizationLevels;
// vec3 ditheredColor = color + noiseOffset;
// return clamp(ditheredColor, 0.0, 1.0);
//}

View File

@ -33,6 +33,7 @@ uniform layout(r32ui) uimage3D voxelsLight;
#ifdef _ShadowMap
uniform sampler2DShadow shadowMap;
uniform sampler2D shadowMapTransparent;
uniform sampler2DShadow shadowMapSpot;
#ifdef _ShadowMapAtlas
uniform sampler2DShadow shadowMapPoint;
@ -86,53 +87,51 @@ float lpToDepth(vec3 lp, const vec2 lightProj) {
void main() {
int res = voxelgiResolution.x;
for (int i = 0; i < 6; i++) {
ivec3 dst = ivec3(gl_GlobalInvocationID.xyz);
vec3 P = (gl_GlobalInvocationID.xyz + 0.5) / voxelgiResolution;
P = P * 2.0 - 1.0;
ivec3 dst = ivec3(gl_GlobalInvocationID.xyz);
dst.y += clipmapLevel * res;
vec3 P = (gl_GlobalInvocationID.xyz + 0.5) / voxelgiResolution;
P = P * 2.0 - 1.0;
P *= clipmaps[int(clipmapLevel * 10)];
P *= voxelgiResolution;
P += vec3(clipmaps[int(clipmapLevel * 10 + 4)], clipmaps[int(clipmapLevel * 10 + 5)], clipmaps[int(clipmapLevel * 10 + 6)]);
vec3 visibility;
vec3 lp = lightPos - P;
vec3 l;
if (lightType == 0) { l = lightDir; visibility = vec3(1.0); }
else { l = normalize(lp); visibility = vec3(attenuate(distance(P, lightPos))); }
float visibility;
vec3 lp = lightPos - P;
vec3 l;
if (lightType == 0) { l = lightDir; visibility = 1.0; }
else { l = normalize(lp); visibility = attenuate(distance(P, lightPos)); }
#ifdef _ShadowMap
if (lightShadow == 1) {
vec4 lightPosition = LVP * vec4(P, 1.0);
vec3 lPos = lightPosition.xyz / lightPosition.w;
visibility = texture(shadowMap, vec3(lPos.xy, lPos.z - shadowsBias)).rrr;
}
else if (lightShadow == 2) {
vec4 lightPosition = LVP * vec4(P, 1.0);
vec3 lPos = lightPosition.xyz / lightPosition.w;
visibility *= texture(shadowMapSpot, vec3(lPos.xy, lPos.z - shadowsBias)).r;
}
else if (lightShadow == 3) {
#ifdef _ShadowMapAtlas
int faceIndex = 0;
const int lightIndex = index * 6;
const vec2 uv = sampleCube(-l, faceIndex);
vec4 pointLightTile = pointLightDataArray[lightIndex + faceIndex]; // x: tile X offset, y: tile Y offset, z: tile size relative to atlas
vec2 uvtiled = pointLightTile.z * uv + pointLightTile.xy;
#ifdef _FlipY
uvtiled.y = 1.0 - uvtiled.y; // invert Y coordinates for direct3d coordinate system
#endif
visibility *= texture(shadowMapPoint, vec3(uvtiled, lpToDepth(lp, lightProj) - shadowsBias)).r;
#else
visibility *= texture(shadowMapPoint, vec4(-l, lpToDepth(lp, lightProj) - shadowsBias)).r;
#endif
}
#endif
if (lightShadow == 1) {
vec4 lightPosition = LVP * vec4(P, 1.0);
vec3 lPos = lightPosition.xyz / lightPosition.w;
visibility = texture(shadowMap, vec3(lPos.xy, lPos.z - shadowsBias)).r;
}
else if (lightShadow == 2) {
vec4 lightPosition = LVP * vec4(P, 1.0);
vec3 lPos = lightPosition.xyz / lightPosition.w;
visibility *= texture(shadowMapSpot, vec3(lPos.xy, lPos.z - shadowsBias)).r;
}
else if (lightShadow == 3) {
#ifdef _ShadowMapAtlas
int faceIndex = 0;
const int lightIndex = index * 6;
const vec2 uv = sampleCube(-l, faceIndex);
vec4 pointLightTile = pointLightDataArray[lightIndex + faceIndex]; // x: tile X offset, y: tile Y offset, z: tile size relative to atlas
vec2 uvtiled = pointLightTile.z * uv + pointLightTile.xy;
#ifdef _FlipY
uvtiled.y = 1.0 - uvtiled.y; // invert Y coordinates for direct3d coordinate system
#endif
visibility *= texture(shadowMapPoint, vec3(uvtiled, lpToDepth(lp, lightProj) - shadowsBias)).r;
#else
visibility *= texture(shadowMapPoint, vec4(-l, lpToDepth(lp, lightProj) - shadowsBias)).r;
#endif
}
#endif
vec3 uvw_light = (P - vec3(clipmaps[int(clipmapLevel * 10 + 4)], clipmaps[int(clipmapLevel * 10 + 5)], clipmaps[int(clipmapLevel * 10 + 6)])) / (float(clipmaps[int(clipmapLevel * 10)]) * voxelgiResolution);
uvw_light = (uvw_light * 0.5 + 0.5);
if (any(notEqual(uvw_light, clamp(uvw_light, 0.0, 1.0)))) return;
vec3 writecoords_light = floor(uvw_light * voxelgiResolution);
vec3 light = visibility * lightColor;
imageAtomicAdd(voxelsLight, dst + ivec3(0, 0, 0), uint(light.r * 255));
imageAtomicAdd(voxelsLight, dst + ivec3(0, 0, voxelgiResolution.x), uint(light.g * 255));
imageAtomicAdd(voxelsLight, dst + ivec3(0, 0, voxelgiResolution.x * 2), uint(light.b * 255));
imageAtomicMax(voxelsLight, ivec3(writecoords_light), uint(visibility * lightColor.r * 255));
imageAtomicMax(voxelsLight, ivec3(writecoords_light) + ivec3(0, 0, voxelgiResolution.x), uint(visibility * lightColor.g * 255));
imageAtomicMax(voxelsLight, ivec3(writecoords_light) + ivec3(0, 0, voxelgiResolution.x * 2), uint(visibility * lightColor.b * 255));
}
}

View File

@ -33,7 +33,7 @@ layout (local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
uniform sampler3D voxels;
uniform sampler2D gbufferD;
uniform sampler2D gbuffer0;
uniform layout(r8) image2D voxels_ao;
uniform layout(r16) image2D voxels_ao;
uniform float clipmaps[voxelgiClipmapCount * 10];
uniform mat4 InvVP;

View File

@ -33,7 +33,7 @@ layout (local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
uniform sampler3D voxels;
uniform sampler2D gbufferD;
uniform sampler2D gbuffer0;
uniform layout(rgba8) image2D voxels_diffuse;
uniform layout(rgba16) image2D voxels_diffuse;
uniform float clipmaps[voxelgiClipmapCount * 10];
uniform mat4 InvVP;
@ -46,7 +46,7 @@ void main() {
const vec2 pixel = gl_GlobalInvocationID.xy;
vec2 uv = (pixel + 0.5) / postprocess_resolution;
#ifdef _InvY
uv.y = 1.0 - uv.y
uv.y = 1.0 - uv.y;
#endif
float depth = textureLod(gbufferD, uv, 0.0).r * 2.0 - 1.0;

View File

@ -34,7 +34,7 @@ uniform sampler2D gbufferD;
uniform sampler2D gbuffer0;
uniform sampler3D voxels;
uniform sampler3D voxelsSDF;
uniform layout(rgba8) image2D voxels_specular;
uniform layout(rgba16) image2D voxels_specular;
uniform float clipmaps[voxelgiClipmapCount * 10];
uniform mat4 InvVP;
@ -48,7 +48,7 @@ void main() {
const vec2 pixel = gl_GlobalInvocationID.xy;
vec2 uv = (pixel + 0.5) / postprocess_resolution;
#ifdef _InvY
uv.y = 1.0 - uv.y
uv.y = 1.0 - uv.y;
#endif
float depth = textureLod(gbufferD, uv, 0.0).r * 2.0 - 1.0;
@ -71,7 +71,7 @@ void main() {
vec2 velocity = -textureLod(sveloc, uv, 0.0).rg;
vec3 color = traceSpecular(P, n, voxels, voxelsSDF, normalize(eye - P), g0.z, clipmaps, pixel, velocity).rgb;
vec3 color = traceSpecular(P, n, voxels, voxelsSDF, normalize(eye - P), g0.z * g0.z, clipmaps, pixel, velocity).rgb;
imageStore(voxels_specular, ivec2(pixel), vec4(color, 1.0));
}

View File

@ -23,8 +23,8 @@ THE SOFTWARE.
#include "compiled.inc"
uniform layout(r16) image3D input_sdf;
uniform layout(r16) image3D output_sdf;
uniform layout(r8) image3D input_sdf;
uniform layout(r8) image3D output_sdf;
uniform float jump_size;
uniform int clipmapLevel;

View File

@ -46,15 +46,15 @@ uniform layout(r32ui) uimage3D voxels;
uniform layout(r32ui) uimage3D voxelsLight;
uniform layout(rgba8) image3D voxelsB;
uniform layout(rgba8) image3D voxelsOut;
uniform layout(r16) image3D SDF;
uniform layout(r8) image3D SDF;
#else
#ifdef _VoxelAOvar
#ifdef _VoxelShadow
uniform layout(r16) image3D SDF;
uniform layout(r8) image3D SDF;
#endif
uniform layout(r32ui) uimage3D voxels;
uniform layout(r16) image3D voxelsB;
uniform layout(r16) image3D voxelsOut;
uniform layout(r8) image3D voxelsB;
uniform layout(r8) image3D voxelsOut;
#endif
#endif
@ -80,7 +80,6 @@ void main() {
light.r = float(imageLoad(voxelsLight, src)) / 255;
light.g = float(imageLoad(voxelsLight, src + ivec3(0, 0, voxelgiResolution.x))) / 255;
light.b = float(imageLoad(voxelsLight, src + ivec3(0, 0, voxelgiResolution.x * 2))) / 255;
light /= 3;
#endif
for (int i = 0; i < 6 + DIFFUSE_CONE_COUNT; i++)
@ -125,7 +124,7 @@ void main() {
envl.g = float(imageLoad(voxels, src + ivec3(0, 0, voxelgiResolution.x * 10))) / 255;
envl.b = float(imageLoad(voxels, src + ivec3(0, 0, voxelgiResolution.x * 11))) / 255;
envl /= 3;
envl *= 100;
//clipmap to world
vec3 wposition = (gl_GlobalInvocationID.xyz + 0.5) / voxelgiResolution.x;
@ -137,7 +136,7 @@ void main() {
radiance = basecol;
vec4 trace = traceDiffuse(wposition, wnormal, voxelsSampler, clipmaps);
vec3 indirect = trace.rgb + envl.rgb * (1.0 - trace.a);
radiance.rgb *= light + indirect;
radiance.rgb *= light / PI + indirect;
radiance.rgb += emission.rgb;
#else

View File

@ -75,16 +75,17 @@ vec4 binarySearch(vec3 dir) {
}
vec4 rayCast(vec3 dir) {
#ifdef _CPostprocess
dir *= PPComp9.x;
#else
dir *= ssrRayStep;
#endif
for (int i = 0; i < maxSteps; i++) {
hitCoord += dir;
if (getDeltaDepth(hitCoord) > 0.0) return binarySearch(dir);
}
return vec4(0.0);
float ddepth;
dir *= ss_refractionRayStep;
for (int i = 0; i < maxSteps; i++) {
hitCoord += dir;
ddepth = getDeltaDepth(hitCoord);
if (ddepth > 0.0)
return binarySearch(dir);
}
// No hit — fallback to projecting the ray to UV space
vec2 fallbackUV = getProjectedCoord(hitCoord);
return vec4(fallbackUV, 0.0, 0.5); // We set .w lower to indicate fallback
}
#endif //SSR

View File

@ -66,12 +66,32 @@ class Quat {
}
public inline function fromAxisAngle(axis: Vec4, angle: FastFloat): Quat {
var s: FastFloat = Math.sin(angle * 0.5);
x = axis.x * s;
y = axis.y * s;
z = axis.z * s;
w = Math.cos(angle * 0.5);
return normalize();
//var s: FastFloat = Math.sin(angle * 0.5);
//x = axis.x * s;
//y = axis.y * s;
//z = axis.z * s;
//w = Math.cos(angle * 0.5);
//return normalize();
// Normalize the axis vector first
var axisLen = Math.sqrt(axis.x * axis.x + axis.y * axis.y + axis.z * axis.z);
if (axisLen > 0.00001) {
var aL = 1.0 / axisLen;
var nX = axis.x * aL;
var nY = axis.y * aL;
var nZ = axis.z * aL;
var halfAngle = angle * 0.5;
var s: FastFloat = Math.sin(halfAngle);
x = nX * s;
y = nY * s;
z = nZ * s;
w = Math.cos(halfAngle);
} else {
x = 0.0;
y = 0.0;
z = 0.0;
w = 1.0;
}
return this;
}
public inline function toAxisAngle(axis: Vec4): FastFloat {
@ -379,17 +399,33 @@ class Quat {
@return This quaternion.
**/
public inline function fromEulerOrdered(e: Vec4, order: String): Quat {
var c1 = Math.cos(e.x / 2);
var c2 = Math.cos(e.y / 2);
var c3 = Math.cos(e.z / 2);
var s1 = Math.sin(e.x / 2);
var s2 = Math.sin(e.y / 2);
var s3 = Math.sin(e.z / 2);
var mappedAngles = new Vec4();
switch (order) {
case "XYZ":
mappedAngles.set(e.x, e.y, e.z);
case "XZY":
mappedAngles.set(e.x, e.z, e.y);
case "YXZ":
mappedAngles.set(e.y, e.x, e.z);
case "YZX":
mappedAngles.set(e.y, e.z, e.x);
case "ZXY":
mappedAngles.set(e.z, e.x, e.y);
case "ZYX":
mappedAngles.set(e.z, e.y, e.x);
}
var c1 = Math.cos(mappedAngles.x / 2);
var c2 = Math.cos(mappedAngles.y / 2);
var c3 = Math.cos(mappedAngles.z / 2);
var s1 = Math.sin(mappedAngles.x / 2);
var s2 = Math.sin(mappedAngles.y / 2);
var s3 = Math.sin(mappedAngles.z / 2);
var qx = new Quat(s1, 0, 0, c1);
var qy = new Quat(0, s2, 0, c2);
var qz = new Quat(0, 0, s3, c3);
// Original multiplication sequence (implements reverse of 'order')
if (order.charAt(2) == 'X')
this.setFrom(qx);
else if (order.charAt(2) == 'Y')
@ -409,6 +445,12 @@ class Quat {
else
this.mult(qz);
// TO DO quick fix somethings wrong..
this.x = -this.x;
this.y = -this.y;
this.z = -this.z;
this.w = -this.w;
return this;
}

View File

@ -411,12 +411,23 @@ class ActionSampler {
*/
public inline function setBoneAction(actionData: Array<TObj>) {
this.actionData = actionData;
this.totalFrames = actionData[0].anim.tracks[0].frames.length;
if(actionData[0].anim.root_motion_pos) this.rootMotionPos = true;
if(actionData[0].anim.root_motion_rot) this.rootMotionRot = true;
if (actionData != null && actionData.length > 0 && actionData[0] != null && actionData[0].anim != null) {
if (actionData[0].anim.tracks != null && actionData[0].anim.tracks.length > 0) {
this.totalFrames = actionData[0].anim.tracks[0].frames.length;
}
else {
this.totalFrames = 0;
}
if(actionData[0].anim.root_motion_pos) this.rootMotionPos = true;
if(actionData[0].anim.root_motion_rot) this.rootMotionRot = true;
}
else {
this.totalFrames = 0;
}
actionDataInit = true;
}
/**
* Cache raw object data for object animation.
* @param actionData Raw object data.

View File

@ -51,6 +51,7 @@ class ParticleSystem {
seed = pref.seed;
particles = [];
ready = false;
Data.getParticle(sceneName, pref.particle, function(b: ParticleData) {
data = b;
r = data.raw;
@ -70,7 +71,13 @@ class ParticleSystem {
lifetime = r.lifetime / frameRate;
animtime = (r.frame_end - r.frame_start) / frameRate;
spawnRate = ((r.frame_end - r.frame_start) / r.count) / frameRate;
for (i in 0...r.count) particles.push(new Particle(i));
for (i in 0...r.count) {
var particle = new Particle(i);
particle.sr = 1 - Math.random() * r.size_random;
particles.push(particle);
}
ready = true;
});
}
@ -108,7 +115,7 @@ class ParticleSystem {
}
// Animate
time += Time.realDelta * speed;
time += Time.delta * speed;
lap = Std.int(time / animtime);
lapTime = time - lap * animtime;
count = Std.int(lapTime / spawnRate);
@ -143,7 +150,7 @@ class ParticleSystem {
}
function setupGeomGpu(object: MeshObject, owner: MeshObject) {
var instancedData = new Float32Array(particles.length * 3);
var instancedData = new Float32Array(particles.length * 6);
var i = 0;
var normFactor = 1 / 32767; // pa.values are not normalized
@ -162,6 +169,10 @@ class ParticleSystem {
instancedData.set(i, pa.values[j * pa.size ] * normFactor * scaleFactor.x); i++;
instancedData.set(i, pa.values[j * pa.size + 1] * normFactor * scaleFactor.y); i++;
instancedData.set(i, pa.values[j * pa.size + 2] * normFactor * scaleFactor.z); i++;
instancedData.set(i, p.sr); i++;
instancedData.set(i, p.sr); i++;
instancedData.set(i, p.sr); i++;
}
case 1: // Face
@ -185,6 +196,10 @@ class ParticleSystem {
instancedData.set(i, pos.x * normFactor * scaleFactor.x); i++;
instancedData.set(i, pos.y * normFactor * scaleFactor.y); i++;
instancedData.set(i, pos.z * normFactor * scaleFactor.z); i++;
instancedData.set(i, p.sr); i++;
instancedData.set(i, p.sr); i++;
instancedData.set(i, p.sr); i++;
}
case 2: // Volume
@ -195,9 +210,13 @@ class ParticleSystem {
instancedData.set(i, (Math.random() * 2.0 - 1.0) * scaleFactorVolume.x); i++;
instancedData.set(i, (Math.random() * 2.0 - 1.0) * scaleFactorVolume.y); i++;
instancedData.set(i, (Math.random() * 2.0 - 1.0) * scaleFactorVolume.z); i++;
instancedData.set(i, p.sr); i++;
instancedData.set(i, p.sr); i++;
instancedData.set(i, p.sr); i++;
}
}
object.data.geom.setupInstanced(instancedData, 1, Usage.StaticUsage);
object.data.geom.setupInstanced(instancedData, 3, Usage.StaticUsage);
}
function fhash(n: Int): Float {
@ -236,9 +255,10 @@ class ParticleSystem {
class Particle {
public var i: Int;
public var x = 0.0;
public var y = 0.0;
public var z = 0.0;
public var px = 0.0;
public var py = 0.0;
public var pz = 0.0;
public var sr = 1.0; // Size random
public var cameraDistance: Float;
public function new(i: Int) {

View File

@ -160,6 +160,7 @@ class LnxPack {
case "anim": TAnimation;
case "tracks": TTrack;
case "morph_target": TMorphTarget;
case "vertex_groups": TVertex_groups;
case _: TSceneFormat;
}
}

View File

@ -2,9 +2,11 @@ package leenkx.logicnode;
import iron.object.Object;
#if lnx_physics
#if lnx_bullet
import leenkx.trait.physics.PhysicsConstraint;
import leenkx.trait.physics.bullet.PhysicsConstraint.ConstraintType;
#elseif lnx_oimo
// TODO
#end
class AddPhysicsConstraintNode extends LogicNode {
@ -25,7 +27,7 @@ class AddPhysicsConstraintNode extends LogicNode {
if (pivotObject == null || rb1 == null || rb2 == null) return;
#if lnx_physics
#if lnx_bullet
var disableCollisions: Bool = inputs[4].get();
var breakable: Bool = inputs[5].get();
@ -108,6 +110,8 @@ class AddPhysicsConstraintNode extends LogicNode {
}
pivotObject.addTrait(con);
}
#elseif lnx_oimo
// TODO
#end
runOutput(0);
}

View File

@ -4,7 +4,7 @@ import iron.object.Object;
#if lnx_physics
import leenkx.trait.physics.RigidBody;
import leenkx.trait.physics.bullet.RigidBody.Shape;
import leenkx.trait.physics.RigidBody.Shape;
#end

View File

@ -21,7 +21,7 @@ class ApplyForceNode extends LogicNode {
#if lnx_physics
var rb: RigidBody = object.getTrait(RigidBody);
if (rb == null) return;
!local ? rb.applyForce(force) : rb.applyForce(object.transform.worldVecToOrientation(force));
#end

View File

@ -0,0 +1,26 @@
package leenkx.logicnode;
class ArrayIndexListNode extends LogicNode {
public function new(tree: LogicTree) {
super(tree);
}
override function get(from: Int): Dynamic {
var array: Array<Dynamic> = inputs[0].get();
array = array.map(item -> Std.string(item));
var value: Dynamic = inputs[1].get();
var from: Int = 0;
var arrayList: Array<Int> = [];
var index: Int = array.indexOf(Std.string(value), from);
while(index != -1){
arrayList.push(index);
index = array.indexOf(Std.string(value), index+1);
}
return arrayList;
}
}

View File

@ -1,7 +1,7 @@
package leenkx.logicnode;
import aura.Aura;
import aura.Types;
import aura.types.HRTFData;
import aura.types.HRTF;
import aura.dsp.panner.HRTFPanner;
class AudioHRTFPannerNode extends LogicNode {

View File

@ -26,10 +26,9 @@ class GetBoneTransformNode extends LogicNode {
// Get bone in armature
var bone = anim.getBone(boneName);
//return anim.getAbsWorldMat(bone);
return anim.getAbsMat(bone).clone().multmat(object.transform.world);
//return anim.getAbsWorldMat(bone);
return anim.getAbsWorldMat(anim.skeletonMats, bone);
//return anim.getAbsMat(bone).clone().multmat(object.transform.world);
#else
return null;

View File

@ -1,7 +1,7 @@
package leenkx.logicnode;
#if lnx_physics
import leenkx.trait.physics.bullet.PhysicsWorld;
import leenkx.trait.physics.PhysicsWorld;
#end
import leenkx.trait.navigation.Navigation;
import iron.object.Object;

View File

@ -1,7 +1,7 @@
package leenkx.logicnode;
#if lnx_audio
import iron.object.SpeakerObject;
#end
class PauseSoundNode extends LogicNode {
public function new(tree: LogicTree) {
@ -9,9 +9,11 @@ class PauseSoundNode extends LogicNode {
}
override function run(from: Int) {
#if lnx_audio
var object: SpeakerObject = cast(inputs[1].get(), SpeakerObject);
if (object == null) return;
object.pause();
#end
runOutput(0);
}
}

View File

@ -1,7 +1,7 @@
package leenkx.logicnode;
#if lnx_physics
import leenkx.trait.physics.bullet.PhysicsConstraint.ConstraintAxis;
import leenkx.trait.physics.PhysicsConstraint.ConstraintAxis;
#end
class PhysicsConstraintNode extends LogicNode {

View File

@ -1,7 +1,7 @@
package leenkx.logicnode;
#if lnx_audio
import iron.object.SpeakerObject;
#end
class PlaySoundNode extends LogicNode {
public function new(tree: LogicTree) {
@ -9,9 +9,11 @@ class PlaySoundNode extends LogicNode {
}
override function run(from: Int) {
#if lnx_audio
var object: SpeakerObject = cast(inputs[1].get(), SpeakerObject);
if (object == null) return;
object.play();
#end
runOutput(0);
}
}

View File

@ -16,15 +16,16 @@ class PlaySoundRawNode extends LogicNode {
public var property5: Bool;
public var property6: String;
#if lnx_audio
var sound: kha.Sound = null;
var channel: kha.audio1.AudioChannel = null;
#end
public function new(tree: LogicTree) {
super(tree);
}
override function run(from: Int) {
#if lnx_audio
switch (from) {
case Play:
if (property6 == 'Sound' ? sound == null : true) {
@ -63,6 +64,10 @@ class PlaySoundRawNode extends LogicNode {
case UpdateVolume:
if (channel != null) channel.volume = inputs[4].get();
}
#end
#if !lnx_audio
runOutput(0);
#end
}
function onUpdate() {

View File

@ -37,6 +37,7 @@ class RotationNode extends LogicNode {
value.y = vect.y;
value.z = vect.z;
value.w = inputs[1].get();
value.normalize();
case "AxisAngle":
var vec: Vec4 = inputs[0].get();

View File

@ -0,0 +1,37 @@
package leenkx.logicnode;
import iron.object.Object;
#if lnx_skin
import iron.object.BoneAnimation;
#end
import iron.math.Mat4;
class SetBoneTransformNode extends LogicNode {
public function new(tree: LogicTree) {
super(tree);
}
override function run(from: Int) {
#if lnx_skin
var object: Object = inputs[1].get();
if (object == null) return;
var transform = inputs[3].get();
if (transform == null) return;
var boneName: String = inputs[2].get();
var anim = object.animation != null ? cast(object.animation, BoneAnimation) : null;
if (anim == null) anim = object.getBoneAnimation(object.uid);
// Get bone in armature
var bone = anim.getBone(boneName);
anim.setBoneMatFromWorldMat(anim.skeletonMats, transform, bone);
runOutput(0);
#end
}
}

View File

@ -17,7 +17,7 @@ class SetParentBoneNode extends LogicNode {
if (object == null || parent == null) return;
object.setParent(parent, false, false);
object.setParent(parent, inputs[4].get(), inputs[5].get());
var banim = object.getBoneAnimation(object.parent.uid);
banim.addBoneChild(bone, object);

View File

@ -1,7 +1,7 @@
package leenkx.logicnode;
#if lnx_audio
import iron.object.SpeakerObject;
#end
class SetSoundNode extends LogicNode {
public function new(tree: LogicTree) {
@ -9,10 +9,12 @@ class SetSoundNode extends LogicNode {
}
override function run(from: Int) {
#if lnx_audio
var object: SpeakerObject = cast(inputs[1].get(), SpeakerObject);
var sound: String = inputs[2].get();
if (object == null || sound == null) return;
object.setSound(sound);
#end
runOutput(0);
}
}

View File

@ -1,7 +1,7 @@
package leenkx.logicnode;
#if lnx_audio
import iron.object.SpeakerObject;
#end
class SetVolumeSoundNode extends LogicNode {
public function new(tree: LogicTree) {
@ -9,9 +9,11 @@ class SetVolumeSoundNode extends LogicNode {
}
override function run(from: Int) {
#if lnx_audio
var object: SpeakerObject = cast(inputs[1].get(), SpeakerObject);
if (object == null) return;
object.setVolume(inputs[2].get());
#end
runOutput(0);
}
}

View File

@ -1,7 +1,7 @@
package leenkx.logicnode;
#if lnx_audio
import iron.object.SpeakerObject;
#end
class StopSoundNode extends LogicNode {
public function new(tree: LogicTree) {
@ -9,9 +9,11 @@ class StopSoundNode extends LogicNode {
}
override function run(from: Int) {
#if lnx_audio
var object: SpeakerObject = cast(inputs[1].get(), SpeakerObject);
if (object == null) return;
object.stop();
#end
runOutput(0);
}
}

View File

@ -18,7 +18,7 @@ class TransformNode extends LogicNode {
override function get(from: Int): Dynamic {
var loc: Vec4 = inputs[0].get();
var rot: Quat = new Quat().setFrom(inputs[1].get());
rot.normalize();
//rot.normalize();
var scale: Vec4 = inputs[2].get();
if (loc == null && rot == null && scale == null) return this.value;
if (loc == null || rot == null || scale == null) return null;

View File

@ -77,6 +77,9 @@ class Inc {
#if (rp_voxels == "Voxel GI")
static var voxel_sh5:kha.compute.Shader = null;
static var voxel_ta5:kha.compute.TextureUnit;
static var voxel_te5:kha.compute.TextureUnit;
static var voxel_tf5:kha.compute.TextureUnit;
static var voxel_tg5:kha.compute.TextureUnit;
static var voxel_ca5:kha.compute.ConstantLocation;
static var voxel_cb5:kha.compute.ConstantLocation;
static var voxel_cc5:kha.compute.ConstantLocation;
@ -677,7 +680,7 @@ class Inc {
}
else {
if (t.name == "voxelsSDF" || t.name == "voxelsSDFtmp") {
t.format = "R16";
t.format = "R8";
t.width = res;
t.height = res * Main.voxelgiClipmapCount;
t.depth = res;
@ -686,7 +689,7 @@ class Inc {
#if (rp_voxels == "Voxel AO")
{
if (t.name == "voxelsOut" || t.name == "voxelsOutB") {
t.format = "R16";
t.format = "R8";
t.width = res * (6 + 16);
t.height = res * Main.voxelgiClipmapCount;
t.depth = res;
@ -892,7 +895,9 @@ class Inc {
{
voxel_sh5 = path.getComputeShader("voxel_light");
voxel_ta5 = voxel_sh5.getTextureUnit("voxelsLight");
voxel_te5 = voxel_sh5.getTextureUnit("voxels");
voxel_tf5 = voxel_sh5.getTextureUnit("voxelsSampler");
voxel_tg5 = voxel_sh5.getTextureUnit("voxelsSDFSampler");
voxel_ca5 = voxel_sh5.getConstantLocation("clipmaps");
voxel_cb5 = voxel_sh5.getConstantLocation("clipmapLevel");
@ -1288,7 +1293,9 @@ class Inc {
kha.compute.Compute.setShader(voxel_sh5);
kha.compute.Compute.setTexture(voxel_ta5, rts.get("voxelsLight").image, kha.compute.Access.Write);
kha.compute.Compute.setTexture(voxel_te5, rts.get("voxels").image, kha.compute.Access.Read);
kha.compute.Compute.setSampledTexture(voxel_tf5, rts.get("voxelsOut").image);
kha.compute.Compute.setSampledTexture(voxel_tg5, rts.get("voxelsSDF").image);
var fa:Float32Array = new Float32Array(Main.voxelgiClipmapCount * 10);
for (i in 0...Main.voxelgiClipmapCount) {
fa[i * 10] = clipmaps[i].voxelSize;

View File

@ -368,7 +368,7 @@ class RenderPathDeferred {
t.scale = Inc.getSuperSampling();
path.createRenderTarget(t);
// holds background depth
// holds background color
var t = new RenderTargetRaw();
t.name = "refr";
t.width = 0;
@ -473,6 +473,13 @@ class RenderPathDeferred {
}
#end
#if rp_ssrefr
{
path.setTarget("gbuffer_refraction");
path.clearTarget(0xffffff00);
}
#end
RenderPathCreator.setTargetMeshes();
#if rp_dynres
@ -837,7 +844,7 @@ class RenderPathDeferred {
{
path.bindTarget("voxelsOut", "voxels");
path.bindTarget("voxelsSDF", "voxelsSDF");
path.bindTarget("gbuffer2", "sveloc");
path.bindTarget("gbuffer2", "gbuffer2");
}
#end

View File

@ -522,6 +522,17 @@ class RenderPathForward {
path.setTarget("lbuffer0", ["lbuffer1", "gbuffer_refraction"]);
#if rp_shadowmap
{
#if lnx_shadowmap_atlas
Inc.bindShadowMapAtlas();
#else
Inc.bindShadowMap();
#end
}
#end
#if (rp_voxels != "Off")
path.bindTarget("voxelsOut", "voxels");
path.bindTarget("voxelsSDF", "voxelsSDF");

View File

@ -41,7 +41,11 @@ class Starter {
try {
#end
kha.System.start({title: Main.projectName, width: c.window_w, height: c.window_h, window: {mode: windowMode, windowFeatures: windowFeatures}, framebuffer: {samplesPerPixel: c.window_msaa, verticalSync: c.window_vsync}}, function(window: kha.Window) {
kha.System.start({title: Main.projectName, width: c.window_w, height: c.window_h, window: {
#if lnx_render_viewport
visible: false,
#end
mode: windowMode, windowFeatures: windowFeatures}, framebuffer: {samplesPerPixel: c.window_msaa, verticalSync: c.window_vsync}}, function(window: kha.Window) {
iron.App.init(function() {
#if lnx_loadscreen

View File

@ -10,6 +10,10 @@ class KinematicCharacterController extends iron.Trait { public function new() {
typedef KinematicCharacterController = leenkx.trait.physics.bullet.KinematicCharacterController;
#else
typedef KinematicCharacterController = leenkx.trait.physics.oimo.KinematicCharacterController;
#end
#end

View File

@ -3,17 +3,16 @@ package leenkx.trait.physics;
#if (!lnx_physics)
class PhysicsConstraint extends iron.Trait { public function new() { super(); } }
@:enum abstract ConstraintAxis(Int) from Int to Int { }
#else
#if lnx_bullet
typedef PhysicsConstraint = leenkx.trait.physics.bullet.PhysicsConstraint;
typedef ConstraintAxis = leenkx.trait.physics.bullet.PhysicsConstraint.ConstraintAxis;
#else
typedef PhysicsConstraint = leenkx.trait.physics.oimo.PhysicsConstraint;
typedef ConstraintAxis = leenkx.trait.physics.oimo.PhysicsConstraint.ConstraintAxis;
#end
#end

View File

@ -2,6 +2,7 @@ package leenkx.trait.physics;
#if (!lnx_physics)
class Hit { }
class PhysicsWorld extends iron.Trait { public function new() { super(); } }
#else
@ -9,11 +10,11 @@ class PhysicsWorld extends iron.Trait { public function new() { super(); } }
#if lnx_bullet
typedef PhysicsWorld = leenkx.trait.physics.bullet.PhysicsWorld;
typedef Hit = leenkx.trait.physics.bullet.PhysicsWorld.Hit;
#else
typedef PhysicsWorld = leenkx.trait.physics.oimo.PhysicsWorld;
typedef Hit = leenkx.trait.physics.oimo.PhysicsWorld.Hit;
#end
#end

View File

@ -3,17 +3,20 @@ package leenkx.trait.physics;
#if (!lnx_physics)
class RigidBody extends iron.Trait { public function new() { super(); } }
@:enum abstract Shape(Int) from Int to Int { }
#else
#if lnx_bullet
typedef RigidBody = leenkx.trait.physics.bullet.RigidBody;
typedef Shape = leenkx.trait.physics.bullet.RigidBody.Shape;
#else
typedef RigidBody = leenkx.trait.physics.oimo.RigidBody;
typedef Shape = leenkx.trait.physics.oimo.RigidBody.Shape;
#end
#end

View File

@ -1,5 +1,8 @@
package leenkx.trait.physics.bullet;
#if lnx_bullet
import leenkx.trait.physics.bullet.PhysicsWorld.DebugDrawMode;
import bullet.Bt.Vector3;
import kha.FastFloat;
@ -18,15 +21,21 @@ class DebugDrawHelper {
static inline var contactPointNormalColor = 0xffffffff;
static inline var contactPointDrawLifetime = true;
final rayCastColor: Vec4 = new Vec4(0.0, 1.0, 0.0);
final rayCastHitColor: Vec4 = new Vec4(1.0, 0.0, 0.0);
final rayCastHitPointColor: Vec4 = new Vec4(1.0, 1.0, 0.0);
final physicsWorld: PhysicsWorld;
final lines: Array<LineData> = [];
final texts: Array<TextData> = [];
var font: kha.Font = null;
var debugMode: PhysicsWorld.DebugDrawMode = NoDebug;
var rayCasts:Array<TRayCastData> = [];
var debugDrawMode: DebugDrawMode = NoDebug;
public function new(physicsWorld: PhysicsWorld) {
public function new(physicsWorld: PhysicsWorld, debugDrawMode: DebugDrawMode) {
this.physicsWorld = physicsWorld;
this.debugDrawMode = debugDrawMode;
#if lnx_ui
iron.data.Data.getFont(Canvas.defaultFontName, function(defaultFont: kha.Font) {
@ -35,6 +44,11 @@ class DebugDrawHelper {
#end
iron.App.notifyOnRender2D(onRender);
if (debugDrawMode & DrawRayCast != 0) {
iron.App.notifyOnUpdate(function () {
rayCasts.resize(0);
});
}
}
public function drawLine(from: bullet.Bt.Vector3, to: bullet.Bt.Vector3, color: bullet.Bt.Vector3) {
@ -49,9 +63,10 @@ class DebugDrawHelper {
final fromScreenSpace = worldToScreenFast(new Vec4(from.x(), from.y(), from.z(), 1.0));
final toScreenSpace = worldToScreenFast(new Vec4(to.x(), to.y(), to.z(), 1.0));
// For now don't draw lines if any point is outside of clip space z,
// investigate how to clamp lines to clip space borders
if (fromScreenSpace.w == 1 && toScreenSpace.w == 1) {
// If at least one point is within the Z clip space (w==1), attempt to draw.
// Note: This is not full clipping, line may still go off screen sides.
if (fromScreenSpace.w == 1 || toScreenSpace.w == 1) {
lines.push({
fromX: fromScreenSpace.x,
fromY: fromScreenSpace.y,
@ -112,6 +127,61 @@ class DebugDrawHelper {
}
}
public function rayCast(rayCastData:TRayCastData) {
rayCasts.push(rayCastData);
}
function drawRayCast(f: Vec4, t: Vec4, hit: Bool) {
final from = worldToScreenFast(f.clone());
final to = worldToScreenFast(t.clone());
var c: kha.Color;
if (from.w == 1 && to.w == 1) {
if (hit) c = kha.Color.fromFloats(rayCastHitColor.x, rayCastHitColor.y, rayCastHitColor.z);
else c = kha.Color.fromFloats(rayCastColor.x, rayCastColor.y, rayCastColor.z);
lines.push({
fromX: from.x,
fromY: from.y,
toX: to.x,
toY: to.y,
color: c
});
}
}
function drawHitPoint(hp: Vec4) {
final hitPoint = worldToScreenFast(hp.clone());
final c = kha.Color.fromFloats(rayCastHitPointColor.x, rayCastHitPointColor.y, rayCastHitPointColor.z);
if (hitPoint.w == 1) {
lines.push({
fromX: hitPoint.x - contactPointSizePx,
fromY: hitPoint.y - contactPointSizePx,
toX: hitPoint.x + contactPointSizePx,
toY: hitPoint.y + contactPointSizePx,
color: c
});
lines.push({
fromX: hitPoint.x - contactPointSizePx,
fromY: hitPoint.y + contactPointSizePx,
toX: hitPoint.x + contactPointSizePx,
toY: hitPoint.y - contactPointSizePx,
color: c
});
if (font != null) {
texts.push({
x: hitPoint.x,
y: hitPoint.y,
color: c,
text: 'RAYCAST HIT'
});
}
}
}
public function reportErrorWarning(warningString: bullet.Bt.BulletString) {
trace(warningString.toHaxeString().trim());
}
@ -135,13 +205,13 @@ class DebugDrawHelper {
});
}
public function setDebugMode(debugMode: PhysicsWorld.DebugDrawMode) {
this.debugMode = debugMode;
public function setDebugMode(debugDrawMode: DebugDrawMode) {
this.debugDrawMode = debugDrawMode;
}
public function getDebugMode(): PhysicsWorld.DebugDrawMode {
public function getDebugMode(): DebugDrawMode {
#if js
return debugMode;
return debugDrawMode;
#elseif hl
return physicsWorld.getDebugDrawMode();
#else
@ -161,6 +231,7 @@ class DebugDrawHelper {
// before some user-specific physics update, which would result in a
// one-frame drawing delay... Ideally we would ensure that debugDrawWorld()
// is called when all other (late) update callbacks are already executed...
physicsWorld.world.debugDrawWorld();
g.opacity = 1.0;
@ -180,6 +251,17 @@ class DebugDrawHelper {
}
texts.resize(0);
}
if (debugDrawMode & DrawRayCast != 0) {
for (rayCastData in rayCasts) {
if (rayCastData.hasHit) {
drawRayCast(rayCastData.from, rayCastData.hitPoint, true);
drawHitPoint(rayCastData.hitPoint);
} else {
drawRayCast(rayCastData.from, rayCastData.to, false);
}
}
}
}
/**
@ -222,3 +304,14 @@ class TextData {
public var color: kha.Color;
public var text: String;
}
@:structInit
typedef TRayCastData = {
var from: Vec4;
var to: Vec4;
var hasHit: Bool;
@:optional var hitPoint: Vec4;
@:optional var hitNormal: Vec4;
}
#end

View File

@ -85,6 +85,22 @@ class PhysicsWorld extends Trait {
public static var physTime = 0.0;
#end
public static function getSolverInfo(world:bullet.Bt.DynamicsWorld):Dynamic {
return Reflect.callMethod(world, Reflect.field(world, "getSolverInfo"), []);
}
public static function setSolverIterations(world:bullet.Bt.DynamicsWorld, iterations:Int):Void {
var solverInfo = getSolverInfo(world);
if (solverInfo != null) {
Reflect.setField(solverInfo, "m_numIterations", iterations);
} else {
trace("Warning: Could not access solver info. Solver iterations not applied.");
}
}
public function new(timeScale = 1.0, maxSteps = 10, solverIterations = 10, debugDrawMode: DebugDrawMode = NoDebug) {
super();
@ -164,7 +180,8 @@ class PhysicsWorld extends Trait {
#else
world = new bullet.Bt.DiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration);
#end
// TO DO: Set the solver iterations from Blender's rigid body world
// setSolverIterations(world, solverIterations);
setGravity(gravity);
}
@ -378,6 +395,7 @@ class PhysicsWorld extends Trait {
rayTo.setValue(to.x, to.y, to.z);
var rayCallback = new bullet.Bt.ClosestRayResultCallback(rayFrom, rayTo);
#if js
rayCallback.set_m_collisionFilterGroup(group);
rayCallback.set_m_collisionFilterMask(mask);
@ -387,6 +405,7 @@ class PhysicsWorld extends Trait {
#end
var worldDyn: bullet.Bt.DynamicsWorld = world;
var worldCol: bullet.Bt.CollisionWorld = worldDyn;
worldCol.rayTest(rayFrom, rayTo, rayCallback);
var rb: RigidBody = null;
var hitInfo: Hit = null;
@ -412,6 +431,16 @@ class PhysicsWorld extends Trait {
#end
}
if (getDebugDrawMode() & DrawRayCast != 0) {
debugDrawHelper.rayCast({
from: from,
to: to,
hasHit: rc.hasHit(),
hitPoint: hitPointWorld,
hitNormal: hitNormalWorld
});
}
#if js
bullet.Bt.Ammo.destroy(rayCallback);
#else
@ -493,7 +522,7 @@ class PhysicsWorld extends Trait {
if (debugDrawMode == NoDebug) {
return;
}
initDebugDrawing();
initDebugDrawing(debugDrawMode);
}
#if js
@ -517,8 +546,8 @@ class PhysicsWorld extends Trait {
#end
}
function initDebugDrawing() {
debugDrawHelper = new DebugDrawHelper(this);
function initDebugDrawing(debugDrawMode: DebugDrawMode) {
debugDrawHelper = new DebugDrawHelper(this, debugDrawMode);
#if js
final drawer = new bullet.Bt.DebugDrawer();
@ -644,10 +673,7 @@ enum abstract DebugDrawMode(Int) from Int to Int {
// We could use it in the future to toggle depth testing for lines, i.e. draw actual 3D lines if not set and Kha's g2 lines if set.
var FastWireframe = 1 << 13;
/**
Draw the normal vectors of the triangles of the physics collider meshes.
This only works for `Mesh` collision shapes.
**/
/** Draw the normal vectors of the triangles of the physics collider meshes. **/
// Outside of Leenkx this works for a few more collision shapes
var DrawNormals = 1 << 14;
@ -657,6 +683,8 @@ enum abstract DebugDrawMode(Int) from Int to Int {
**/
var DrawFrames = 1 << 15;
var DrawRayCast = 1 << 16;
@:op(~A) public inline function bitwiseNegate(): DebugDrawMode {
return ~this;
}

View File

@ -1,8 +1,5 @@
package zui;
// Immediate Mode UI Library
// https://github.com/leenkx3d/zui
import kha.input.Mouse;
import kha.input.Pen;
import kha.input.Surface;
@ -255,7 +252,7 @@ class Zui {
Mouse.get().notifyWindowed(ops.khaWindowId, onMouseDown, onMouseUp, onMouseMove, onMouseWheel);
if (Pen.get() != null) Pen.get().notify(onPenDown, onPenUp, onPenMove);
Keyboard.get().notify(onKeyDown, onKeyUp, onKeyPress);
#if (kha_android || kha_ios)
#if (kha_android || kha_ios || kha_html5 || kha_debug_html5)
if (Surface.get() != null) Surface.get().notify(onTouchDown, onTouchUp, onTouchMove);
#end
// Reset mouse delta on foreground
@ -268,7 +265,7 @@ class Zui {
Mouse.get().removeWindowed(ops.khaWindowId, onMouseDown, onMouseUp, onMouseMove, onMouseWheel);
if (Pen.get() != null) Pen.get().remove(onPenDown, onPenUp, onPenMove);
Keyboard.get().remove(onKeyDown, onKeyUp, onKeyPress);
#if (kha_android || kha_ios)
#if (kha_android || kha_ios || kha_html5 || kha_debug_html5)
if (Surface.get() != null) Surface.get().remove(onTouchDown, onTouchUp, onTouchMove);
#end
endInput();
@ -1760,7 +1757,7 @@ class Zui {
button == 0 ? inputStarted = true : inputStartedR = true;
button == 0 ? inputDown = true : inputDownR = true;
inputStartedTime = kha.Scheduler.time();
#if (kha_android || kha_ios)
#if (kha_android || kha_ios || kha_html5 || kha_debug_html5)
setInputPosition(x, y);
#end
inputStartedX = x;
@ -1787,7 +1784,7 @@ class Zui {
button == 0 ? inputReleased = true : inputReleasedR = true;
}
button == 0 ? inputDown = false : inputDownR = false;
#if (kha_android || kha_ios)
#if (kha_android || kha_ios || kha_html5 || kha_debug_html5)
setInputPosition(x, y);
#end
deselectText();
@ -1811,7 +1808,7 @@ class Zui {
}
public function onPenDown(x: Int, y: Int, pressure: Float) {
#if (kha_android || kha_ios)
#if (kha_android || kha_ios || kha_html5 || kha_debug_html5)
return;
#end
@ -1819,7 +1816,7 @@ class Zui {
}
public function onPenUp(x: Int, y: Int, pressure: Float) {
#if (kha_android || kha_ios)
#if (kha_android || kha_ios || kha_html5 || kha_debug_html5)
return;
#end
@ -1829,7 +1826,7 @@ class Zui {
}
public function onPenMove(x: Int, y: Int, pressure: Float) {
#if (kha_android || kha_ios)
#if (kha_android || kha_ios || kha_html5 || kha_debug_html5)
return;
#end
@ -1889,7 +1886,7 @@ class Zui {
isKeyPressed = true;
}
#if (kha_android || kha_ios)
#if (kha_android || kha_ios || kha_html5 || kha_debug_html5)
public function onTouchDown(index: Int, x: Int, y: Int) {
// Reset movement delta on touch start
if (index == 0) {

Binary file not shown.

View File

@ -324,6 +324,20 @@ class LeenkxExporter:
def export_object_transform(self, bobject: bpy.types.Object, o):
wrd = bpy.data.worlds['Lnx']
# HACK: In Blender 4.2.x, each camera must be selected to ensure its matrix is correctly assigned
if bpy.app.version >= (4, 2, 0) and bobject.type == 'CAMERA' and bobject.users_scene:
current_scene = bpy.context.window.scene
bpy.context.window.scene = bobject.users_scene[0]
bpy.context.view_layer.update()
bobject.select_set(True)
bpy.context.view_layer.update()
bobject.select_set(False)
bpy.context.window.scene = current_scene
bpy.context.view_layer.update()
# Static transform
o['transform'] = {'values': LeenkxExporter.write_matrix(bobject.matrix_local)}
@ -1001,7 +1015,8 @@ class LeenkxExporter:
action = actions.get('leenkxpose')
if action is None:
action = actions.new(name='leenkxpose')
adata.action = action
# Export actions
export_actions = [action]
# hasattr - armature modifier may reference non-parent
@ -1551,8 +1566,7 @@ class LeenkxExporter:
log.error(e.message)
else:
# Assume it was caused because of encountering n-gons
log.error(f"""object {bobject.name} contains n-gons in its mesh, so it's impossible to compute tanget space for normal mapping.
Make sure the mesh only has tris/quads.""")
log.error(f"""object {bobject.name} contains n-gons in its mesh, so it's impossible to compute tanget space for normal mapping. Make sure the mesh only has tris/quads.""")
tangdata = np.empty(num_verts * 3, dtype='<f4')
if has_col:
@ -3025,14 +3039,15 @@ Make sure the mesh only has tris/quads.""")
if rbw is not None and rbw.enabled:
out_trait['parameters'] = [str(rbw.time_scale), str(rbw.substeps_per_frame), str(rbw.solver_iterations)]
if phys_pkg == 'bullet':
debug_draw_mode = 1 if wrd.lnx_bullet_dbg_draw_wireframe else 0
debug_draw_mode |= 2 if wrd.lnx_bullet_dbg_draw_aabb else 0
debug_draw_mode |= 8 if wrd.lnx_bullet_dbg_draw_contact_points else 0
debug_draw_mode |= 2048 if wrd.lnx_bullet_dbg_draw_constraints else 0
debug_draw_mode |= 4096 if wrd.lnx_bullet_dbg_draw_constraint_limits else 0
debug_draw_mode |= 16384 if wrd.lnx_bullet_dbg_draw_normals else 0
debug_draw_mode |= 32768 if wrd.lnx_bullet_dbg_draw_axis_gizmo else 0
if phys_pkg == 'bullet' or phys_pkg == 'oimo':
debug_draw_mode = 1 if wrd.lnx_physics_dbg_draw_wireframe else 0
debug_draw_mode |= 2 if wrd.lnx_physics_dbg_draw_aabb else 0
debug_draw_mode |= 8 if wrd.lnx_physics_dbg_draw_contact_points else 0
debug_draw_mode |= 2048 if wrd.lnx_physics_dbg_draw_constraints else 0
debug_draw_mode |= 4096 if wrd.lnx_physics_dbg_draw_constraint_limits else 0
debug_draw_mode |= 16384 if wrd.lnx_physics_dbg_draw_normals else 0
debug_draw_mode |= 32768 if wrd.lnx_physics_dbg_draw_axis_gizmo else 0
debug_draw_mode |= 65536 if wrd.lnx_physics_dbg_draw_raycast else 0
out_trait['parameters'].append(str(debug_draw_mode))
self.output['traits'].append(out_trait)

View File

@ -132,6 +132,7 @@ def always() -> float:
return 0.5
def poll_threads() -> float:
"""Polls the thread callback queue and if a thread has finished, it
is joined with the main thread and the corresponding callback is
@ -141,21 +142,27 @@ def poll_threads() -> float:
thread, callback = make.thread_callback_queue.get(block=False)
except queue.Empty:
return 0.25
thread.join()
try:
callback()
except Exception as e:
# If there is an exception, we can no longer return the time to
# the next call to this polling function, so to keep it running
# we re-register it and then raise the original exception.
bpy.app.timers.unregister(poll_threads)
bpy.app.timers.register(poll_threads, first_interval=0.01, persistent=True)
raise e
# Quickly check if another thread has finished
return 0.01
if thread.is_alive():
try:
make.thread_callback_queue.put((thread, callback), block=False)
except queue.Full:
return 0.5
return 0.1
else:
try:
thread.join()
callback()
except Exception as e:
# If there is an exception, we can no longer return the time to
# the next call to this polling function, so to keep it running
# we re-register it and then raise the original exception.
try:
bpy.app.timers.unregister(poll_threads)
except ValueError:
pass
bpy.app.timers.register(poll_threads, first_interval=0.01, persistent=True)
# Quickly check if another thread has finished
return 0.01
loaded_py_libraries: dict[str, types.ModuleType] = {}

View File

@ -7,48 +7,46 @@ if lnx.is_reload(__name__):
else:
lnx.enable_reload(__name__)
lnx.keymaps = []
#lnx.keymaps = []
def register():
wm = bpy.context.window_manager
addon_keyconfig = wm.keyconfigs.addon
keyconfig = wm.keyconfigs.user
# Keyconfigs are not available in background mode. If the keyconfig
# was not found despite running _not_ in background mode, a warning
# is printed
if addon_keyconfig is None:
if keyconfig is None:
if not bpy.app.background:
log.warn("No keyconfig path found")
return
km = addon_keyconfig.keymaps.new(name='Window', space_type='EMPTY', region_type="WINDOW")
km.keymap_items.new(props_ui.LeenkxPlayButton.bl_idname, type='F5', value='PRESS')
km.keymap_items.new("tlm.build_lightmaps", type='F6', value='PRESS')
km.keymap_items.new("tlm.clean_lightmaps", type='F7', value='PRESS')
lnx.keymaps.append(km)
km = addon_keyconfig.keymaps.new(name='Node Editor', space_type='NODE_EDITOR')
# shift+G: Create a new node call group node
km.keymap_items.new('lnx.add_call_group_node', 'G', 'PRESS', shift=True)
# ctrl+G: make node group from selected
km.keymap_items.new('lnx.add_group_tree_from_selected', 'G', 'PRESS', ctrl=True)
# TAB: enter node groups depending on selection
km.keymap_items.new('lnx.edit_group_tree', 'TAB', 'PRESS')
# ctrl+TAB: exit node groups depending on selectio
km.keymap_items.new('node.tree_path_parent', 'TAB', 'PRESS', ctrl=True)
# alt+G: ungroup node tree
km.keymap_items.new('lnx.ungroup_group_tree', 'G', 'PRESS', alt=True)
lnx.keymaps.append(km)
km = keyconfig.keymaps.get('Window')
if km is None:
log.warn("Window keymaps not available")
return
lnx_start = any(kmi.idname == props_ui.LeenkxPlayButton.bl_idname for kmi in km.keymap_items)
if not lnx_start:
kmw = keyconfig.keymaps.new(name='Window', space_type='EMPTY', region_type="WINDOW")
kmw.keymap_items.new(props_ui.LeenkxPlayButton.bl_idname, type='F5', value='PRESS')
kmw.keymap_items.new('tlm.build_lightmaps', type='F6', value='PRESS')
kmw.keymap_items.new('tlm.clean_lightmaps', type='F7', value='PRESS')
kmn = keyconfig.keymaps.new(name='Node Editor', space_type='NODE_EDITOR')
kmn.keymap_items.new('lnx.add_call_group_node', 'G', 'PRESS', shift=True)
kmn.keymap_items.new('lnx.add_group_tree_from_selected', 'G', 'PRESS', ctrl=True)
kmn.keymap_items.new('lnx.edit_group_tree', 'TAB', 'PRESS')
kmn.keymap_items.new('node.tree_path_parent', 'TAB', 'PRESS', ctrl=True)
kmn.keymap_items.new('lnx.ungroup_group_tree', 'G', 'PRESS', alt=True)
def unregister():
wm = bpy.context.window_manager
for km in lnx.keymaps:
wm.keyconfigs.addon.keymaps.remove(km)
del lnx.keymaps[:]
kmw = bpy.context.window_manager.keyconfigs.user.keymaps.get('Window')
kmw.keymap_items.remove(kmw.keymap_items[props_ui.LeenkxPlayButton.bl_idname])
kmw.keymap_items.remove(kmw.keymap_items['tlm.build_lightmaps'])
kmw.keymap_items.remove(kmw.keymap_items['tlm.clean_lightmaps'])
kmn = bpy.context.window_manager.keyconfigs.user.keymaps.get('Node Editor')
kmn.keymap_items.remove(kmn.keymap_items['lnx.add_call_group_node'])
kmn.keymap_items.remove(kmn.keymap_items['lnx.add_group_tree_from_selected'])
kmn.keymap_items.remove(kmn.keymap_items['lnx.edit_group_tree'])
kmn.keymap_items.remove(kmn.keymap_items['node.tree_path_parent'])
kmn.keymap_items.remove(kmn.keymap_items['lnx.ungroup_group_tree'])

View File

@ -5,7 +5,8 @@ class TLM_Logman:
_log = []
def __init__(self):
def __init__(self, *args, **kwargs):
super(TLM_Logman, self).__init__(*args, **kwargs)
print("Logger started Init")
self.append("Logger started.")

View File

@ -1,25 +1,25 @@
from lnx.logicnode.lnx_nodes import *
class BlendActionNode(LnxLogicTreeNode):
"""Interpolates between the two given actions."""
bl_idname = 'LNBlendActionNode'
bl_label = 'Blend Action'
lnx_version = 2
def lnx_init(self, context):
self.add_input('LnxNodeSocketObject', 'Object')
self.add_input('LnxNodeSocketAnimTree', 'Action 1')
self.add_input('LnxNodeSocketAnimTree', 'Action 2')
self.add_input('ArmFactorSocket', 'Factor', default_value = 0.5)
self.add_input('LnxIntSocket', 'Bone Group', default_value = -1)
self.add_output('LnxNodeSocketAnimTree', 'Result')
def get_replacement_node(self, node_tree: bpy.types.NodeTree):
if self.lnx_version not in (0, 1):
raise LookupError()
return NodeReplacement(
'LNBlendActionNode', self.lnx_version, 'LNBlendActionNode', 2,
in_socket_mapping={}, out_socket_mapping={}
)
from lnx.logicnode.lnx_nodes import *
class BlendActionNode(LnxLogicTreeNode):
"""Interpolates between the two given actions."""
bl_idname = 'LNBlendActionNode'
bl_label = 'Blend Action'
lnx_version = 2
def lnx_init(self, context):
self.add_input('LnxNodeSocketObject', 'Object')
self.add_input('LnxNodeSocketAnimTree', 'Action 1')
self.add_input('LnxNodeSocketAnimTree', 'Action 2')
self.add_input('LnxFactorSocket', 'Factor', default_value = 0.5)
self.add_input('LnxIntSocket', 'Bone Group', default_value = -1)
self.add_output('LnxNodeSocketAnimTree', 'Result')
def get_replacement_node(self, node_tree: bpy.types.NodeTree):
if self.lnx_version not in (0, 1):
raise LookupError()
return NodeReplacement(
'LNBlendActionNode', self.lnx_version, 'LNBlendActionNode', 2,
in_socket_mapping={}, out_socket_mapping={}
)

View File

@ -90,7 +90,8 @@ class BlendSpaceNode(LnxLogicTreeNode):
draw_handler_dict = {}
modal_handler_dict = {}
def __init__(self):
def __init__(self, *args, **kwargs):
super(BlendSpaceNode, self).__init__(*args, **kwargs)
array_nodes[str(id(self))] = self
if self.advanced_draw_run:
self.add_advanced_draw()
@ -112,8 +113,8 @@ class BlendSpaceNode(LnxLogicTreeNode):
def lnx_init(self, context):
self.add_input('LnxNodeSocketObject', 'Object')
self.add_input('LnxNodeSocketArray', 'Actions')
self.add_input('ArmBlendSpaceSocket', 'Cursor X')
self.add_input('ArmBlendSpaceSocket', 'Cursor Y')
self.add_input('LnxBlendSpaceSocket', 'Cursor X')
self.add_input('LnxBlendSpaceSocket', 'Cursor Y')
self.add_output('LnxNodeSocketAnimTree', 'Out')
def add_advanced_draw(self):

View File

@ -45,7 +45,7 @@ class BoneIKNode(LnxLogicTreeNode):
self.add_input('LnxBoolSocket', 'Enable Pole')
self.add_input('LnxVectorSocket', 'Pole Position')
self.add_input('LnxFloatSocket', 'Roll Angle')
self.add_input('ArmFactorSocket', 'Influence', default_value = 1.0)
self.add_input('LnxFactorSocket', 'Influence', default_value = 1.0)
self.add_input('LnxIntSocket', 'Bone Group', default_value = 0)
self.add_output('LnxNodeSocketAnimTree', 'Result')

View File

@ -8,8 +8,8 @@ class OneShotActionMultiNode(LnxLogicTreeNode):
lnx_version = 1
min_inputs = 10
def __init__(self):
super(OneShotActionMultiNode, self).__init__()
def __init__(self, *args, **kwargs):
super(OneShotActionMultiNode, self).__init__(*args, **kwargs)
array_nodes[self.get_id_str()] = self
property0: HaxeStringProperty('property0', name = 'Action ID', default = '')

View File

@ -0,0 +1,16 @@
from lnx.logicnode.lnx_nodes import *
class SetBoneTransformNode(LnxLogicTreeNode):
"""Sets the bones transform in world space."""
bl_idname = 'LNSetBoneTransformNode'
bl_label = 'Set Bone Transform'
lnx_version = 1
lnx_section = 'armature'
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxNodeSocketObject', 'Object')
self.add_input('LnxStringSocket', 'Bone')
self.add_input('LnxDynamicSocket', 'Transform')
self.add_output('LnxNodeSocketAction', 'Out')

View File

@ -12,5 +12,7 @@ class SetParentBoneNode(LnxLogicTreeNode):
self.add_input('LnxNodeSocketObject', 'Object')
self.add_input('LnxNodeSocketObject', 'Parent')
self.add_input('LnxStringSocket', 'Bone', default_value='Bone')
self.add_input('LnxBoolSocket', 'Set Inverse')
self.add_input('LnxBoolSocket', 'Keep Transform')
self.add_output('LnxNodeSocketAction', 'Out')

View File

@ -7,8 +7,8 @@ class SwitchActionMultiNode(LnxLogicTreeNode):
lnx_version = 1
min_inputs = 8
def __init__(self):
super(SwitchActionMultiNode, self).__init__()
def __init__(self, *args, **kwargs):
super(SwitchActionMultiNode, self).__init__(*args, **kwargs)
array_nodes[self.get_id_str()] = self
def lnx_init(self, context):

View File

@ -9,7 +9,8 @@ class ArrayNode(LnxLogicVariableNodeMixin, LnxLogicTreeNode):
lnx_section = 'variable'
min_inputs = 0
def __init__(self):
def __init__(self, *args, **kwargs):
super(ArrayNode, self).__init__(*args, **kwargs)
self.register_id()
def lnx_init(self, context):

View File

@ -12,8 +12,8 @@ class ArrayAddNode(LnxLogicTreeNode):
lnx_version = 5
min_inputs = 6
def __init__(self):
super(ArrayAddNode, self).__init__()
def __init__(self, *args, **kwargs):
super(ArrayAddNode, self).__init__(*args, **kwargs)
array_nodes[self.get_id_str()] = self
def lnx_init(self, context):

View File

@ -9,8 +9,8 @@ class BooleanArrayNode(LnxLogicVariableNodeMixin, LnxLogicTreeNode):
lnx_section = 'variable'
min_inputs = 0
def __init__(self):
super(BooleanArrayNode, self).__init__()
def __init__(self, *args, **kwargs):
super(BooleanArrayNode, self).__init__(*args, **kwargs)
self.register_id()
def lnx_init(self, context):

View File

@ -9,8 +9,8 @@ class ColorArrayNode(LnxLogicVariableNodeMixin, LnxLogicTreeNode):
lnx_section = 'variable'
min_inputs = 0
def __init__(self):
super(ColorArrayNode, self).__init__()
def __init__(self, *args, **kwargs):
super(ColorArrayNode, self).__init__(*args, **kwargs)
self.register_id()
def lnx_init(self, context):

View File

@ -9,8 +9,8 @@ class FloatArrayNode(LnxLogicVariableNodeMixin, LnxLogicTreeNode):
lnx_section = 'variable'
min_inputs = 0
def __init__(self):
super(FloatArrayNode, self).__init__()
def __init__(self, *args, **kwargs):
super(FloatArrayNode, self).__init__(*args, **kwargs)
self.register_id()
def lnx_init(self, context):

View File

@ -0,0 +1,13 @@
from lnx.logicnode.lnx_nodes import *
class ArrayIndexNode(LnxLogicTreeNode):
"""Returns the array index list of the given value as an array."""
bl_idname = 'LNArrayIndexListNode'
bl_label = 'Array Index List'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketArray', 'Array')
self.add_input('LnxDynamicSocket', 'Value')
self.add_output('LnxNodeSocketArray', 'Array')

View File

@ -9,8 +9,8 @@ class IntegerArrayNode(LnxLogicVariableNodeMixin, LnxLogicTreeNode):
lnx_section = 'variable'
min_inputs = 0
def __init__(self):
super(IntegerArrayNode, self).__init__()
def __init__(self, *args, **kwargs):
super(IntegerArrayNode, self).__init__(*args, **kwargs)
self.register_id()
def lnx_init(self, context):

View File

@ -9,8 +9,8 @@ class ObjectArrayNode(LnxLogicVariableNodeMixin, LnxLogicTreeNode):
lnx_section = 'variable'
min_inputs = 0
def __init__(self):
super(ObjectArrayNode, self).__init__()
def __init__(self, *args, **kwargs):
super(ObjectArrayNode, self).__init__(*args, **kwargs)
self.register_id()
def lnx_init(self, context):

View File

@ -8,7 +8,8 @@ class ArrayRemoveValueNode(LnxLogicTreeNode):
bl_label = 'Array Remove by Value'
lnx_version = 1
# def __init__(self):
# def __init__(self, *args, **kwargs):
# super(ArrayRemoveValueNode, self).__init__(*args, **kwargs)
# array_nodes[str(id(self))] = self
def lnx_init(self, context):

View File

@ -9,8 +9,8 @@ class StringArrayNode(LnxLogicVariableNodeMixin, LnxLogicTreeNode):
lnx_section = 'variable'
min_inputs = 0
def __init__(self):
super(StringArrayNode, self).__init__()
def __init__(self, *args, **kwargs):
super(StringArrayNode, self).__init__(*args, **kwargs)
self.register_id()
def lnx_init(self, context):

View File

@ -9,8 +9,9 @@ class VectorArrayNode(LnxLogicVariableNodeMixin, LnxLogicTreeNode):
lnx_section = 'variable'
min_inputs = 0
def __init__(self):
super(VectorArrayNode, self).__init__()
def __init__(self, *args, **kwargs):
super(VectorArrayNode, self).__init__(*args, **kwargs)
self.register_id()
def lnx_init(self, context):

View File

@ -35,4 +35,4 @@ class LoadUrlNode(LnxLogicTreeNode):
if self.lnx_version not in (0, 1):
raise LookupError()
return NodeReplacement.Identity(self)
return NodeReplacement.Identity(self)

View File

@ -9,7 +9,8 @@ class AddTorrentNode(LnxLogicTreeNode):
lnx_category = 'Leenkx'
lnx_version = 1
def __init__(self):
def __init__(self, *args, **kwargs):
super(AddTorrentNode, self).__init__(*args, **kwargs)
array_nodes[str(id(self))] = self

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