lots of changes

This commit is contained in:
2025-07-01 20:38:31 +02:00
parent c3475ec41d
commit 41eecfa2c2
29 changed files with 35194 additions and 33659 deletions
+3 -3
View File
@@ -1,3 +1,3 @@
[submodule "vcpkg"] [submodule "vcpkg"]
path = vcpkg path = vcpkg
url = https://github.com/Microsoft/vcpkg.git url = https://github.com/Microsoft/vcpkg.git
+48 -48
View File
@@ -1,48 +1,48 @@
cmake_minimum_required(VERSION 3.7...3.23) cmake_minimum_required(VERSION 3.7...3.23)
if(${CMAKE_VERSION} VERSION_LESS 3.12) if(${CMAKE_VERSION} VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}) cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
endif() endif()
set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD 23)
set(VCPKG_INSTALL_OPTIONS "--allow-unsupported") set(VCPKG_INSTALL_OPTIONS "--allow-unsupported")
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake) set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake)
project(MeshShadingDemo) project(MeshShadingDemo)
set(CMAKE_DEBUG_POSTFIX "") set(CMAKE_DEBUG_POSTFIX "")
set(CMAKE_BINARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/bin) set(CMAKE_BINARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_SOURCE_DIR}/bin) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_SOURCE_DIR}/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_SOURCE_DIR}/bin) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_SOURCE_DIR}/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_CURRENT_SOURCE_DIR}/bin) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_CURRENT_SOURCE_DIR}/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_CURRENT_SOURCE_DIR}/bin) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_CURRENT_SOURCE_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_SOURCE_DIR}/bin) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_SOURCE_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_SOURCE_DIR}/bin) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_SOURCE_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_CURRENT_SOURCE_DIR}/bin) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_CURRENT_SOURCE_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_CURRENT_SOURCE_DIR}/bin) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_CURRENT_SOURCE_DIR}/bin)
find_package(Seele REQUIRED) find_package(Seele REQUIRED)
find_package(Vulkan REQUIRED) find_package(Vulkan REQUIRED)
find_package(assimp CONFIG REQUIRED) find_package(assimp CONFIG REQUIRED)
find_package(Stb REQUIRED) find_package(Stb REQUIRED)
find_package(EnTT CONFIG REQUIRED) find_package(EnTT CONFIG REQUIRED)
find_package(FreeType CONFIG REQUIRED) find_package(FreeType CONFIG REQUIRED)
find_package(harfbuzz CONFIG REQUIRED) find_package(harfbuzz CONFIG REQUIRED)
find_package(glfw3 CONFIG REQUIRED) find_package(glfw3 CONFIG REQUIRED)
find_package(glm CONFIG REQUIRED) find_package(glm CONFIG REQUIRED)
find_package(Ktx CONFIG REQUIRED) find_package(Ktx CONFIG REQUIRED)
find_package(nlohmann_json CONFIG REQUIRED) find_package(nlohmann_json CONFIG REQUIRED)
find_package(fmt CONFIG REQUIRED) find_package(fmt CONFIG REQUIRED)
find_package(lunasvg CONFIG REQUIRED) find_package(lunasvg CONFIG REQUIRED)
find_package(metis CONFIG REQUIRED) find_package(metis CONFIG REQUIRED)
find_package(meshoptimizer CONFIG REQUIRED) find_package(meshoptimizer CONFIG REQUIRED)
find_package(VulkanMemoryAllocator CONFIG REQUIRED) find_package(VulkanMemoryAllocator CONFIG REQUIRED)
add_library(MeshShadingDemo SHARED "") add_library(MeshShadingDemo SHARED "")
target_link_libraries(MeshShadingDemo PUBLIC Seele::Engine) target_link_libraries(MeshShadingDemo PUBLIC Seele::Engine)
target_include_directories(MeshShadingDemo PRIVATE src/) target_include_directories(MeshShadingDemo PRIVATE src/)
target_compile_definitions(MeshShadingDemo PRIVATE BUILD_DLL) target_compile_definitions(MeshShadingDemo PRIVATE BUILD_DLL)
add_subdirectory(src/) add_subdirectory(src/)
+41 -41
View File
@@ -1,42 +1,42 @@
Vec3(8.07149, 2.89742, 72.6628) Vec3(8.07149, 2.89742, 72.6628)
Quat(0.0111646, -0.00056989, 0.998637, -0.0509748) Quat(0.0111646, -0.00056989, 0.998637, -0.0509748)
Vec3(6.56899, 3.75079, 50.512) Vec3(6.56899, 3.75079, 50.512)
Quat(0.000180251, -9.01277e-07, 0.999987, -0.00500006) Quat(0.000180251, -9.01277e-07, 0.999987, -0.00500006)
Vec3(5.36649, 3.97833, 33.2987) Vec3(5.36649, 3.97833, 33.2987)
Quat(-0.064764, -0.0011011, 0.997756, 0.0169635) Quat(-0.064764, -0.0011011, 0.997756, 0.0169635)
Vec3(9.95685, 3.66233, 1.15688) Vec3(9.95685, 3.66233, 1.15688)
Quat(-0.243346, 0.000973386, 0.969931, -0.00387974) Quat(-0.243346, 0.000973386, 0.969931, -0.00387974)
Vec3(19.6487, 3.52539, -13.0847) Vec3(19.6487, 3.52539, -13.0847)
Quat(-0.353027, -0.00176514, 0.9356, 0.004678) Quat(-0.353027, -0.00176514, 0.9356, 0.004678)
Vec3(26.875, 3.30828, -19.2694) Vec3(26.875, 3.30828, -19.2694)
Quat(0.758938, -0.0334149, -0.649676, 0.0286042) Quat(0.758938, -0.0334149, -0.649676, 0.0286042)
Vec3(34.4412, 3.13038, -11.9002) Vec3(34.4412, 3.13038, -11.9002)
Quat(0.767398, 0.0061393, -0.641121, -0.00512907) Quat(0.767398, 0.0061393, -0.641121, -0.00512907)
Vec3(41.6074, 3.17334, -7.07916) Vec3(41.6074, 3.17334, -7.07916)
Quat(-0.552013, -0.00552028, 0.833776, 0.00833798) Quat(-0.552013, -0.00552028, 0.833776, 0.00833798)
Vec3(52.3544, 3.22211, -6.32834) Vec3(52.3544, 3.22211, -6.32834)
Quat(-0.333292, 0.00299973, 0.942781, -0.00848532) Quat(-0.333292, 0.00299973, 0.942781, -0.00848532)
Vec3(59.6433, 2.86301, -16.1626) Vec3(59.6433, 2.86301, -16.1626)
Quat(0.43648, -0.0200923, 0.898538, -0.0413619) Quat(0.43648, -0.0200923, 0.898538, -0.0413619)
Vec3(57.3598, 2.50521, -19.7923) Vec3(57.3598, 2.50521, -19.7923)
Quat(0.814371, -0.0579177, 0.575992, -0.0409643) Quat(0.814371, -0.0579177, 0.575992, -0.0409643)
Vec3(52.312, 1.85907, -11.5477) Vec3(52.312, 1.85907, -11.5477)
Quat(0.758282, -0.0227553, 0.651236, -0.019543) Quat(0.758282, -0.0227553, 0.651236, -0.019543)
Vec3(44.4041, 3.09733, -7.70407) Vec3(44.4041, 3.09733, -7.70407)
Quat(0.58282, -0.00291417, 0.812586, -0.00406303) Quat(0.58282, -0.00291417, 0.812586, -0.00406303)
Vec3(31.0161, 3.27204, -16.1626) Vec3(31.0161, 3.27204, -16.1626)
Quat(0.437852, 0.00218926, 0.899033, 0.00449516) Quat(0.437852, 0.00218926, 0.899033, 0.00449516)
Vec3(23.3012, 3.2754, -23.0331) Vec3(23.3012, 3.2754, -23.0331)
Quat(0.388697, -0.000777387, 0.921364, -0.00184271) Quat(0.388697, -0.000777387, 0.921364, -0.00184271)
Vec3(11.1551, 3.20805, -35.1741) Vec3(11.1551, 3.20805, -35.1741)
Quat(0.24373, -0.00170616, 0.969818, -0.00678891) Quat(0.24373, -0.00170616, 0.969818, -0.00678891)
Vec3(3.502, 2.87556, -43.9499) Vec3(3.502, 2.87556, -43.9499)
Quat(-0.213132, 0.00191825, 0.976982, -0.00879313) Quat(-0.213132, 0.00191825, 0.976982, -0.00879313)
Vec3(10.4903, 3.0962, -52.2983) Vec3(10.4903, 3.0962, -52.2983)
Quat(-0.272279, -0.00381216, 0.962116, 0.0134705) Quat(-0.272279, -0.00381216, 0.962116, 0.0134705)
Vec3(16.7925, 2.39479, -62.9087) Vec3(16.7925, 2.39479, -62.9087)
Quat(-0.287239, 0.0282399, 0.952849, -0.0936794) Quat(-0.287239, 0.0282399, 0.952849, -0.0936794)
Vec3(23.1887, 1.41071, -88.6824) Vec3(23.1887, 1.41071, -88.6824)
Quat(0.78488, 0.0566091, -0.615457, -0.0443896) Quat(0.78488, 0.0566091, -0.615457, -0.0443896)
Vec3(24.5556, 1.41071, -95.5271) Vec3(24.5556, 1.41071, -95.5271)
Quat(0.764375, 0.026764, -0.643821, -0.0225429) Quat(0.764375, 0.026764, -0.643821, -0.0225429)
+48 -48
View File
@@ -1,49 +1,49 @@
{ {
"buildType": { "buildType": {
"default": "debug", "default": "debug",
"description": "Configuration Type", "description": "Configuration Type",
"choices": { "choices": {
"debug": { "debug": {
"short": "Debug", "short": "Debug",
"long": "Enable debugging and validation", "long": "Enable debugging and validation",
"settings": { "settings": {
"CMAKE_BUILD_TYPE": "Debug" "CMAKE_BUILD_TYPE": "Debug"
} }
}, },
"release": { "release": {
"short": "Release", "short": "Release",
"long": "Optimize binary for speed", "long": "Optimize binary for speed",
"settings": { "settings": {
"CMAKE_BUILD_TYPE": "Release" "CMAKE_BUILD_TYPE": "Release"
} }
}, },
"relwithdebinfo": { "relwithdebinfo": {
"short": "RelWithDebInfo", "short": "RelWithDebInfo",
"long": "Release with debug symbols", "long": "Release with debug symbols",
"settings": { "settings": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo" "CMAKE_BUILD_TYPE": "RelWithDebInfo"
} }
} }
} }
}, },
"architecture": { "architecture": {
"default": "x64", "default": "x64",
"description": "Platform Architecture", "description": "Platform Architecture",
"choices": { "choices": {
"x64": { "x64": {
"short": "x64", "short": "x64",
"long": "amd64 platform", "long": "amd64 platform",
"settings": { "settings": {
"CMAKE_PLATFORM": "x64" "CMAKE_PLATFORM": "x64"
} }
}, },
"arm64": { "arm64": {
"short": "arm64", "short": "arm64",
"long": "arm64 platform", "long": "arm64 platform",
"settings": { "settings": {
"CMAKE_PLATFORM": "arm64" "CMAKE_PLATFORM": "arm64"
} }
} }
} }
} }
} }
+2 -2
View File
@@ -1,3 +1,3 @@
newmtl brick newmtl brick
map_Kd brick.jpg map_Kd brick.jpg
map_Ns brick_normal.jpg map_Ns brick_normal.jpg
+353 -353
View File
@@ -1,354 +1,354 @@
Sponza 2022 Scene created by Frank Meinl. Sponza 2022 Scene created by Frank Meinl.
Additional credit for reference photos Additional credit for reference photos
Katica Putica Katica Putica
Princino.photo Princino.photo
Dubrovnik, Croatia Dubrovnik, Croatia
www.princinophoto.com www.princinophoto.com
For personal use and educational use. Limited commercial use for marketing and print in educational, science papers, etc. For personal use and educational use. Limited commercial use for marketing and print in educational, science papers, etc.
Feel free to provide feedback and report any issues to [sponza _dot_ feedback AT intel _dot_ com]. Feel free to provide feedback and report any issues to [sponza _dot_ feedback AT intel _dot_ com].
Please note that if these scenes are used in a publication, please include a citation using the following BibTeX template: Please note that if these scenes are used in a publication, please include a citation using the following BibTeX template:
@misc{sponza22, @misc{sponza22,
Author = {Frank Meinl and Katica Putica and Cristiano Siqueira and Timothy Heath and Justin Prazen and Sebastian Herholz and Bruce Cherniak and Anton Kaplanyan}, Author = {Frank Meinl and Katica Putica and Cristiano Siqueira and Timothy Heath and Justin Prazen and Sebastian Herholz and Bruce Cherniak and Anton Kaplanyan},
Year = {2022}, Year = {2022},
Note = {https://www.intel.com/content/www/us/en/developer/topic-technology/graphics-processing-research/samples.html}, Note = {https://www.intel.com/content/www/us/en/developer/topic-technology/graphics-processing-research/samples.html},
Title = {Intel Sample Library} Title = {Intel Sample Library}
} }
Thanks to the Sponza and Addon Package Crew: Thanks to the Sponza and Addon Package Crew:
Frank Meinl Frank Meinl
Katica Putica Katica Putica
Cristiano Siqueira Cristiano Siqueira
Timothy Heath Timothy Heath
Justin Prazen Justin Prazen
Sebastian Herholz Sebastian Herholz
Bruce Cherniak Bruce Cherniak
======================================================================= =======================================================================
Creative Commons Attribution 4.0 International Public License Creative Commons Attribution 4.0 International Public License
By exercising the Licensed Rights (defined below), You accept and agree By exercising the Licensed Rights (defined below), You accept and agree
to be bound by the terms and conditions of this Creative Commons to be bound by the terms and conditions of this Creative Commons
Attribution 4.0 International Public License ("Public License"). To the Attribution 4.0 International Public License ("Public License"). To the
extent this Public License may be interpreted as a contract, You are extent this Public License may be interpreted as a contract, You are
granted the Licensed Rights in consideration of Your acceptance of granted the Licensed Rights in consideration of Your acceptance of
these terms and conditions, and the Licensor grants You such rights in these terms and conditions, and the Licensor grants You such rights in
consideration of benefits the Licensor receives from making the consideration of benefits the Licensor receives from making the
Licensed Material available under these terms and conditions. Licensed Material available under these terms and conditions.
Section 1 -- Definitions. Section 1 -- Definitions.
a. Adapted Material means material subject to Copyright and Similar a. Adapted Material means material subject to Copyright and Similar
Rights that is derived from or based upon the Licensed Material Rights that is derived from or based upon the Licensed Material
and in which the Licensed Material is translated, altered, and in which the Licensed Material is translated, altered,
arranged, transformed, or otherwise modified in a manner requiring arranged, transformed, or otherwise modified in a manner requiring
permission under the Copyright and Similar Rights held by the permission under the Copyright and Similar Rights held by the
Licensor. For purposes of this Public License, where the Licensed Licensor. For purposes of this Public License, where the Licensed
Material is a musical work, performance, or sound recording, Material is a musical work, performance, or sound recording,
Adapted Material is always produced where the Licensed Material is Adapted Material is always produced where the Licensed Material is
synched in timed relation with a moving image. synched in timed relation with a moving image.
b. Adapter's License means the license You apply to Your Copyright b. Adapter's License means the license You apply to Your Copyright
and Similar Rights in Your contributions to Adapted Material in and Similar Rights in Your contributions to Adapted Material in
accordance with the terms and conditions of this Public License. accordance with the terms and conditions of this Public License.
c. Copyright and Similar Rights means copyright and/or similar rights c. Copyright and Similar Rights means copyright and/or similar rights
closely related to copyright including, without limitation, closely related to copyright including, without limitation,
performance, broadcast, sound recording, and Sui Generis Database performance, broadcast, sound recording, and Sui Generis Database
Rights, without regard to how the rights are labeled or Rights, without regard to how the rights are labeled or
categorized. For purposes of this Public License, the rights categorized. For purposes of this Public License, the rights
specified in Section 2(b)(1)-(2) are not Copyright and Similar specified in Section 2(b)(1)-(2) are not Copyright and Similar
Rights. Rights.
d. Effective Technological Measures means those measures that, in the d. Effective Technological Measures means those measures that, in the
absence of proper authority, may not be circumvented under laws absence of proper authority, may not be circumvented under laws
fulfilling obligations under Article 11 of the WIPO Copyright fulfilling obligations under Article 11 of the WIPO Copyright
Treaty adopted on December 20, 1996, and/or similar international Treaty adopted on December 20, 1996, and/or similar international
agreements. agreements.
e. Exceptions and Limitations means fair use, fair dealing, and/or e. Exceptions and Limitations means fair use, fair dealing, and/or
any other exception or limitation to Copyright and Similar Rights any other exception or limitation to Copyright and Similar Rights
that applies to Your use of the Licensed Material. that applies to Your use of the Licensed Material.
f. Licensed Material means the artistic or literary work, database, f. Licensed Material means the artistic or literary work, database,
or other material to which the Licensor applied this Public or other material to which the Licensor applied this Public
License. License.
g. Licensed Rights means the rights granted to You subject to the g. Licensed Rights means the rights granted to You subject to the
terms and conditions of this Public License, which are limited to terms and conditions of this Public License, which are limited to
all Copyright and Similar Rights that apply to Your use of the all Copyright and Similar Rights that apply to Your use of the
Licensed Material and that the Licensor has authority to license. Licensed Material and that the Licensor has authority to license.
h. Licensor means the individual(s) or entity(ies) granting rights h. Licensor means the individual(s) or entity(ies) granting rights
under this Public License. under this Public License.
i. Share means to provide material to the public by any means or i. Share means to provide material to the public by any means or
process that requires permission under the Licensed Rights, such process that requires permission under the Licensed Rights, such
as reproduction, public display, public performance, distribution, as reproduction, public display, public performance, distribution,
dissemination, communication, or importation, and to make material dissemination, communication, or importation, and to make material
available to the public including in ways that members of the available to the public including in ways that members of the
public may access the material from a place and at a time public may access the material from a place and at a time
individually chosen by them. individually chosen by them.
j. Sui Generis Database Rights means rights other than copyright j. Sui Generis Database Rights means rights other than copyright
resulting from Directive 96/9/EC of the European Parliament and of resulting from Directive 96/9/EC of the European Parliament and of
the Council of 11 March 1996 on the legal protection of databases, the Council of 11 March 1996 on the legal protection of databases,
as amended and/or succeeded, as well as other essentially as amended and/or succeeded, as well as other essentially
equivalent rights anywhere in the world. equivalent rights anywhere in the world.
k. You means the individual or entity exercising the Licensed Rights k. You means the individual or entity exercising the Licensed Rights
under this Public License. Your has a corresponding meaning. under this Public License. Your has a corresponding meaning.
Section 2 -- Scope. Section 2 -- Scope.
a. License grant. a. License grant.
1. Subject to the terms and conditions of this Public License, 1. Subject to the terms and conditions of this Public License,
the Licensor hereby grants You a worldwide, royalty-free, the Licensor hereby grants You a worldwide, royalty-free,
non-sublicensable, non-exclusive, irrevocable license to non-sublicensable, non-exclusive, irrevocable license to
exercise the Licensed Rights in the Licensed Material to: exercise the Licensed Rights in the Licensed Material to:
a. reproduce and Share the Licensed Material, in whole or a. reproduce and Share the Licensed Material, in whole or
in part; and in part; and
b. produce, reproduce, and Share Adapted Material. b. produce, reproduce, and Share Adapted Material.
2. Exceptions and Limitations. For the avoidance of doubt, where 2. Exceptions and Limitations. For the avoidance of doubt, where
Exceptions and Limitations apply to Your use, this Public Exceptions and Limitations apply to Your use, this Public
License does not apply, and You do not need to comply with License does not apply, and You do not need to comply with
its terms and conditions. its terms and conditions.
3. Term. The term of this Public License is specified in Section 3. Term. The term of this Public License is specified in Section
6(a). 6(a).
4. Media and formats; technical modifications allowed. The 4. Media and formats; technical modifications allowed. The
Licensor authorizes You to exercise the Licensed Rights in Licensor authorizes You to exercise the Licensed Rights in
all media and formats whether now known or hereafter created, all media and formats whether now known or hereafter created,
and to make technical modifications necessary to do so. The and to make technical modifications necessary to do so. The
Licensor waives and/or agrees not to assert any right or Licensor waives and/or agrees not to assert any right or
authority to forbid You from making technical modifications authority to forbid You from making technical modifications
necessary to exercise the Licensed Rights, including necessary to exercise the Licensed Rights, including
technical modifications necessary to circumvent Effective technical modifications necessary to circumvent Effective
Technological Measures. For purposes of this Public License, Technological Measures. For purposes of this Public License,
simply making modifications authorized by this Section 2(a) simply making modifications authorized by this Section 2(a)
(4) never produces Adapted Material. (4) never produces Adapted Material.
5. Downstream recipients. 5. Downstream recipients.
a. Offer from the Licensor -- Licensed Material. Every a. Offer from the Licensor -- Licensed Material. Every
recipient of the Licensed Material automatically recipient of the Licensed Material automatically
receives an offer from the Licensor to exercise the receives an offer from the Licensor to exercise the
Licensed Rights under the terms and conditions of this Licensed Rights under the terms and conditions of this
Public License. Public License.
b. No downstream restrictions. You may not offer or impose b. No downstream restrictions. You may not offer or impose
any additional or different terms or conditions on, or any additional or different terms or conditions on, or
apply any Effective Technological Measures to, the apply any Effective Technological Measures to, the
Licensed Material if doing so restricts exercise of the Licensed Material if doing so restricts exercise of the
Licensed Rights by any recipient of the Licensed Licensed Rights by any recipient of the Licensed
Material. Material.
6. No endorsement. Nothing in this Public License constitutes or 6. No endorsement. Nothing in this Public License constitutes or
may be construed as permission to assert or imply that You may be construed as permission to assert or imply that You
are, or that Your use of the Licensed Material is, connected are, or that Your use of the Licensed Material is, connected
with, or sponsored, endorsed, or granted official status by, with, or sponsored, endorsed, or granted official status by,
the Licensor or others designated to receive attribution as the Licensor or others designated to receive attribution as
provided in Section 3(a)(1)(A)(i). provided in Section 3(a)(1)(A)(i).
b. Other rights. b. Other rights.
1. Moral rights, such as the right of integrity, are not 1. Moral rights, such as the right of integrity, are not
licensed under this Public License, nor are publicity, licensed under this Public License, nor are publicity,
privacy, and/or other similar personality rights; however, to privacy, and/or other similar personality rights; however, to
the extent possible, the Licensor waives and/or agrees not to the extent possible, the Licensor waives and/or agrees not to
assert any such rights held by the Licensor to the limited assert any such rights held by the Licensor to the limited
extent necessary to allow You to exercise the Licensed extent necessary to allow You to exercise the Licensed
Rights, but not otherwise. Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this 2. Patent and trademark rights are not licensed under this
Public License. Public License.
3. To the extent possible, the Licensor waives any right to 3. To the extent possible, the Licensor waives any right to
collect royalties from You for the exercise of the Licensed collect royalties from You for the exercise of the Licensed
Rights, whether directly or through a collecting society Rights, whether directly or through a collecting society
under any voluntary or waivable statutory or compulsory under any voluntary or waivable statutory or compulsory
licensing scheme. In all other cases the Licensor expressly licensing scheme. In all other cases the Licensor expressly
reserves any right to collect such royalties. reserves any right to collect such royalties.
Section 3 -- License Conditions. Section 3 -- License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the Your exercise of the Licensed Rights is expressly made subject to the
following conditions. following conditions.
a. Attribution. a. Attribution.
1. If You Share the Licensed Material (including in modified 1. If You Share the Licensed Material (including in modified
form), You must: form), You must:
a. retain the following if it is supplied by the Licensor a. retain the following if it is supplied by the Licensor
with the Licensed Material: with the Licensed Material:
i. identification of the creator(s) of the Licensed i. identification of the creator(s) of the Licensed
Material and any others designated to receive Material and any others designated to receive
attribution, in any reasonable manner requested by attribution, in any reasonable manner requested by
the Licensor (including by pseudonym if the Licensor (including by pseudonym if
designated); designated);
ii. a copyright notice; ii. a copyright notice;
iii. a notice that refers to this Public License; iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of iv. a notice that refers to the disclaimer of
warranties; warranties;
v. a URI or hyperlink to the Licensed Material to the v. a URI or hyperlink to the Licensed Material to the
extent reasonably practicable; extent reasonably practicable;
b. indicate if You modified the Licensed Material and b. indicate if You modified the Licensed Material and
retain an indication of any previous modifications; and retain an indication of any previous modifications; and
c. indicate the Licensed Material is licensed under this c. indicate the Licensed Material is licensed under this
Public License, and include the text of, or the URI or Public License, and include the text of, or the URI or
hyperlink to, this Public License. hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any 2. You may satisfy the conditions in Section 3(a)(1) in any
reasonable manner based on the medium, means, and context in reasonable manner based on the medium, means, and context in
which You Share the Licensed Material. For example, it may be which You Share the Licensed Material. For example, it may be
reasonable to satisfy the conditions by providing a URI or reasonable to satisfy the conditions by providing a URI or
hyperlink to a resource that includes the required hyperlink to a resource that includes the required
information. information.
3. If requested by the Licensor, You must remove any of the 3. If requested by the Licensor, You must remove any of the
information required by Section 3(a)(1)(A) to the extent information required by Section 3(a)(1)(A) to the extent
reasonably practicable. reasonably practicable.
4. If You Share Adapted Material You produce, the Adapter's 4. If You Share Adapted Material You produce, the Adapter's
License You apply must not prevent recipients of the Adapted License You apply must not prevent recipients of the Adapted
Material from complying with this Public License. Material from complying with this Public License.
Section 4 -- Sui Generis Database Rights. Section 4 -- Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that Where the Licensed Rights include Sui Generis Database Rights that
apply to Your use of the Licensed Material: apply to Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right a. for the avoidance of doubt, Section 2(a)(1) grants You the right
to extract, reuse, reproduce, and Share all or a substantial to extract, reuse, reproduce, and Share all or a substantial
portion of the contents of the database; portion of the contents of the database;
b. if You include all or a substantial portion of the database b. if You include all or a substantial portion of the database
contents in a database in which You have Sui Generis Database contents in a database in which You have Sui Generis Database
Rights, then the database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database
Rights (but not its individual contents) is Adapted Material; and Rights (but not its individual contents) is Adapted Material; and
c. You must comply with the conditions in Section 3(a) if You Share c. You must comply with the conditions in Section 3(a) if You Share
all or a substantial portion of the contents of the database. all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not For the avoidance of doubt, this Section 4 supplements and does not
replace Your obligations under this Public License where the Licensed replace Your obligations under this Public License where the Licensed
Rights include other Copyright and Similar Rights. Rights include other Copyright and Similar Rights.
Section 5 -- Disclaimer of Warranties and Limitation of Liability. Section 5 -- Disclaimer of Warranties and Limitation of Liability.
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
c. The disclaimer of warranties and limitation of liability provided c. The disclaimer of warranties and limitation of liability provided
above shall be interpreted in a manner that, to the extent above shall be interpreted in a manner that, to the extent
possible, most closely approximates an absolute disclaimer and possible, most closely approximates an absolute disclaimer and
waiver of all liability. waiver of all liability.
Section 6 -- Term and Termination. Section 6 -- Term and Termination.
a. This Public License applies for the term of the Copyright and a. This Public License applies for the term of the Copyright and
Similar Rights licensed here. However, if You fail to comply with Similar Rights licensed here. However, if You fail to comply with
this Public License, then Your rights under this Public License this Public License, then Your rights under this Public License
terminate automatically. terminate automatically.
b. Where Your right to use the Licensed Material has terminated under b. Where Your right to use the Licensed Material has terminated under
Section 6(a), it reinstates: Section 6(a), it reinstates:
1. automatically as of the date the violation is cured, provided 1. automatically as of the date the violation is cured, provided
it is cured within 30 days of Your discovery of the it is cured within 30 days of Your discovery of the
violation; or violation; or
2. upon express reinstatement by the Licensor. 2. upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any For the avoidance of doubt, this Section 6(b) does not affect any
right the Licensor may have to seek remedies for Your violations right the Licensor may have to seek remedies for Your violations
of this Public License. of this Public License.
c. For the avoidance of doubt, the Licensor may also offer the c. For the avoidance of doubt, the Licensor may also offer the
Licensed Material under separate terms or conditions or stop Licensed Material under separate terms or conditions or stop
distributing the Licensed Material at any time; however, doing so distributing the Licensed Material at any time; however, doing so
will not terminate this Public License. will not terminate this Public License.
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
License. License.
Section 7 -- Other Terms and Conditions. Section 7 -- Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different a. The Licensor shall not be bound by any additional or different
terms or conditions communicated by You unless expressly agreed. terms or conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the b. Any arrangements, understandings, or agreements regarding the
Licensed Material not stated herein are separate from and Licensed Material not stated herein are separate from and
independent of the terms and conditions of this Public License. independent of the terms and conditions of this Public License.
Section 8 -- Interpretation. Section 8 -- Interpretation.
a. For the avoidance of doubt, this Public License does not, and a. For the avoidance of doubt, this Public License does not, and
shall not be interpreted to, reduce, limit, restrict, or impose shall not be interpreted to, reduce, limit, restrict, or impose
conditions on any use of the Licensed Material that could lawfully conditions on any use of the Licensed Material that could lawfully
be made without permission under this Public License. be made without permission under this Public License.
b. To the extent possible, if any provision of this Public License is b. To the extent possible, if any provision of this Public License is
deemed unenforceable, it shall be automatically reformed to the deemed unenforceable, it shall be automatically reformed to the
minimum extent necessary to make it enforceable. If the provision minimum extent necessary to make it enforceable. If the provision
cannot be reformed, it shall be severed from this Public License cannot be reformed, it shall be severed from this Public License
without affecting the enforceability of the remaining terms and without affecting the enforceability of the remaining terms and
conditions. conditions.
c. No term or condition of this Public License will be waived and no c. No term or condition of this Public License will be waived and no
failure to comply consented to unless expressly agreed to by the failure to comply consented to unless expressly agreed to by the
Licensor. Licensor.
d. Nothing in this Public License constitutes or may be interpreted d. Nothing in this Public License constitutes or may be interpreted
as a limitation upon, or waiver of, any privileges and immunities as a limitation upon, or waiver of, any privileges and immunities
that apply to the Licensor or You, including from the legal that apply to the Licensor or You, including from the legal
processes of any jurisdiction or authority. processes of any jurisdiction or authority.
======================================================================= =======================================================================
File diff suppressed because it is too large Load Diff
+19 -19
View File
@@ -1,20 +1,20 @@
mtllib brick mtllib brick
usemtl brick usemtl brick
v -1 -1 0 v -1 -1 0
v 1 -1 0 v 1 -1 0
v -1 1 0 v -1 1 0
v 1 1 0 v 1 1 0
vt 0 1 vt 0 1
vt 1 1 vt 1 1
vt 1 0 vt 1 0
vt 0 0 vt 0 0
vn 0 0 1 vn 0 0 1
vn 0 0 1 vn 0 0 1
vn 0 0 1 vn 0 0 1
vn 0 0 1 vn 0 0 1
f 1/1/1 2/2/2 3/3/3 f 1/1/1 2/2/2 3/3/3
f 3/3/3 2/2/2 1/1/1 f 3/3/3 2/2/2 1/1/1
Binary file not shown.
File diff suppressed because it is too large Load Diff
+124 -124
View File
@@ -1,125 +1,125 @@
#crappy sky/atmosphere/etc format 1.0 #crappy sky/atmosphere/etc format 1.0
# #
#number of entries #number of entries
5 5
# #
# *** normal unfancy mode *** # *** normal unfancy mode ***
# #
#name #name
normal normal
#light:ambient #light:ambient
0.2 0.2 0.2 0.2 0.2 0.2
#light:diffuse #light:diffuse
0.8 0.8 0.8 0.8 0.8 0.8
#light:specular #light:specular
0.5 0.5 0.5 0.5 0.5 0.5
#light:position #light:position
0 0 1 0 0 1
#fog:enabled (0 or 1 or -1 or whatever) #fog:enabled (0 or 1 or -1 or whatever)
0 0
#fog:color #fog:color
0 0 0 0 0 0
#fog:density #fog:density
0 0
#fog:start #fog:start
0 0
#fog:end #fog:end
0 0
#skyboxname #skyboxname
$DISABLED$ $DISABLED$
# #
# *** sunset 1 *** # *** sunset 1 ***
# #
sunset1 sunset1
#light:ambient #light:ambient
0.1064453125 0.1123046875 0.1337890625 0.1064453125 0.1123046875 0.1337890625
#light:diffuse #light:diffuse
0.9921 0.9058 0.5450 0.9921 0.9058 0.5450
#light:specular #light:specular
0 0 0 0 0 0
#light:position #light:position
5 -5 0.6186 5 -5 0.6186
#fog:enabled (0 or 1 or -1 or whatever) #fog:enabled (0 or 1 or -1 or whatever)
1 1
#fog:color #fog:color
0.427 0.423 0.478 0.427 0.423 0.478
#fog:density #fog:density
0.65 0.65
#fog:start #fog:start
1 1
#fog:end #fog:end
2.5 2.5
#skyboxname #skyboxname
skyboxsun5deg\skyrender skyboxsun5deg\skyrender
# #
# *** sunset 2 *** # *** sunset 2 ***
# #
sunset2 sunset2
#light:ambient #light:ambient
0.271484375 0.337890625 0.390625 0.271484375 0.337890625 0.390625
#light:diffuse #light:diffuse
1 1 0.654901 1 1 0.654901
#light:specular #light:specular
0 0 0 0 0 0
#light:position #light:position
5 -5 0.6186 5 -5 0.6186
#fog:enabled (0 or 1 or -1 or whatever) #fog:enabled (0 or 1 or -1 or whatever)
1 1
#fog:color #fog:color
0.368 0.368 0.431 0.368 0.368 0.431
#fog:density #fog:density
0.65 0.65
#fog:start #fog:start
1 1
#fog:end #fog:end
2.5 2.5
#skyboxname #skyboxname
skyboxsun5deg2\skyrender skyboxsun5deg2\skyrender
# #
# *** sun normal test *** # *** sun normal test ***
# #
sunnormal sunnormal
#light:ambient #light:ambient
0.2109375 0.236328125 0.29296875 0.2109375 0.236328125 0.29296875
#light:diffuse #light:diffuse
1 0.98823 0.9058 1 0.98823 0.9058
#light:specular #light:specular
0 0 0 0 0 0
#light:position #light:position
5 -5 2.66 5 -5 2.66
#fog:enabled (0 or 1 or -1 or whatever) #fog:enabled (0 or 1 or -1 or whatever)
1 1
#fog:color #fog:color
0.8431 0.79607 0.69019 0.8431 0.79607 0.69019
#fog:density #fog:density
0.65 0.65
#fog:start #fog:start
1 1
#fog:end #fog:end
2.5 2.5
#skyboxname #skyboxname
skyboxsun25degtest\skyrender skyboxsun25degtest\skyrender
# #
# *** rainy day test *** # *** rainy day test ***
# #
rainyday rainyday
#light:ambient #light:ambient
0.25 0.25 0.25 0.25 0.25 0.25
#light:diffuse #light:diffuse
0.9882 0.9764705 0.8980 0.9882 0.9764705 0.8980
#light:specular #light:specular
0 0 0 0 0 0
#light:position #light:position
5 -5 5 5 -5 5
#fog:enabled (0 or 1 or -1 or whatever) #fog:enabled (0 or 1 or -1 or whatever)
1 1
#fog:color #fog:color
0.56862 0.54901 0.50588 0.56862 0.54901 0.50588
#fog:density #fog:density
2.95 2.95
#fog:start #fog:start
.5 .5
#fog:end #fog:end
2.5 2.5
#skyboxname #skyboxname
skyboxsun45deg\skyrender skyboxsun45deg\skyrender
+6 -6
View File
@@ -1,7 +1,7 @@
target_sources(MeshShadingDemo target_sources(MeshShadingDemo
PUBLIC PUBLIC
FlyCam.h FlyCam.h
FlyCam.cpp FlyCam.cpp
PathFollowCam.h PathFollowCam.h
PathFollowCam.cpp PathFollowCam.cpp
) )
+20 -20
View File
@@ -1,21 +1,21 @@
#include "FlyCam.h" #include "FlyCam.h"
FlyCam::FlyCam(PScene scene) FlyCam::FlyCam(PScene scene)
: Actor(scene) : Actor(scene)
{ {
attachComponent<Component::Camera>(); attachComponent<Component::Camera>();
attachComponent<Component::KeyboardInput>(); attachComponent<Component::KeyboardInput>();
} }
FlyCam::~FlyCam() FlyCam::~FlyCam()
{} {}
Component::Camera& FlyCam::getCamera() Component::Camera& FlyCam::getCamera()
{ {
return accessComponent<Component::Camera>(); return accessComponent<Component::Camera>();
} }
Component::KeyboardInput& FlyCam::getKeyboardInput() Component::KeyboardInput& FlyCam::getKeyboardInput()
{ {
return accessComponent<Component::KeyboardInput>(); return accessComponent<Component::KeyboardInput>();
} }
+16 -16
View File
@@ -1,17 +1,17 @@
#pragma once #pragma once
#include "Define.h" #include "Define.h"
#include <MinimalEngine.h> #include <MinimalEngine.h>
#include <Actor/Actor.h> #include <Actor/Actor.h>
#include <Component/KeyboardInput.h> #include <Component/KeyboardInput.h>
#include <Component/Camera.h> #include <Component/Camera.h>
class FlyCam : public Actor class FlyCam : public Actor
{ {
public: public:
FlyCam(PScene scene); FlyCam(PScene scene);
virtual ~FlyCam(); virtual ~FlyCam();
Component::KeyboardInput& getKeyboardInput(); Component::KeyboardInput& getKeyboardInput();
Component::Camera& getCamera(); Component::Camera& getCamera();
private: private:
}; };
DEFINE_REF(FlyCam) DEFINE_REF(FlyCam)
+22 -22
View File
@@ -1,22 +1,22 @@
#include "PathFollowCam.h" #include "PathFollowCam.h"
PathFollowCam::PathFollowCam(PScene scene) PathFollowCam::PathFollowCam(PScene scene)
: Actor(scene) : Actor(scene)
{ {
attachComponent<Component::Camera>(); attachComponent<Component::Camera>();
attachComponent<PathFollow>(); attachComponent<PathFollow>();
} }
PathFollowCam::~PathFollowCam() PathFollowCam::~PathFollowCam()
{} {}
PathFollow& PathFollowCam::getPathFollow() PathFollow& PathFollowCam::getPathFollow()
{ {
return accessComponent<PathFollow>(); return accessComponent<PathFollow>();
} }
Component::Camera& PathFollowCam::getCamera() Component::Camera& PathFollowCam::getCamera()
{ {
return accessComponent<Component::Camera>(); return accessComponent<Component::Camera>();
} }
+16 -16
View File
@@ -1,17 +1,17 @@
#pragma once #pragma once
#include "Define.h" #include "Define.h"
#include <MinimalEngine.h> #include <MinimalEngine.h>
#include <Actor/Actor.h> #include <Actor/Actor.h>
#include <Component/PathFollow.h> #include <Component/PathFollow.h>
#include <Component/Camera.h> #include <Component/Camera.h>
class PathFollowCam : public Actor class PathFollowCam : public Actor
{ {
public: public:
PathFollowCam(PScene scene); PathFollowCam(PScene scene);
virtual ~PathFollowCam(); virtual ~PathFollowCam();
PathFollow& getPathFollow(); PathFollow& getPathFollow();
Component::Camera& getCamera(); Component::Camera& getCamera();
private: private:
}; };
DEFINE_REF(PathFollowCam) DEFINE_REF(PathFollowCam)
+9 -9
View File
@@ -1,9 +1,9 @@
target_sources(MeshShadingDemo target_sources(MeshShadingDemo
PUBLIC PUBLIC
Define.h Define.h
MeshShadingDemoGame.h MeshShadingDemoGame.h
MeshShadingDemoGame.cpp) MeshShadingDemoGame.cpp)
add_subdirectory(Actor/) add_subdirectory(Actor/)
add_subdirectory(Component/) add_subdirectory(Component/)
add_subdirectory(System/) add_subdirectory(System/)
+3 -3
View File
@@ -1,4 +1,4 @@
target_sources(MeshShadingDemo target_sources(MeshShadingDemo
PRIVATE PRIVATE
Path.h Path.h
PathFollow.h) PathFollow.h)
+187 -187
View File
@@ -1,188 +1,188 @@
#pragma once #pragma once
#include <Define.h> #include <Define.h>
#include <MinimalEngine.h> #include <MinimalEngine.h>
#include <Containers/Array.h> #include <Containers/Array.h>
#include <Math/Vector.h> #include <Math/Vector.h>
#include <Graphics/DebugVertex.h> #include <Graphics/DebugVertex.h>
struct Path struct Path
{ {
static constexpr float ARC_LENGTH_TABLE_DISTANCE = 0.05f; static constexpr float ARC_LENGTH_TABLE_DISTANCE = 0.05f;
static constexpr float LAST_POS_EPSILON = 0.015f; static constexpr float LAST_POS_EPSILON = 0.015f;
Path(Array<Vector> points) Path(Array<Vector> points)
: points(std::move(points)) : points(std::move(points))
{ {
createDebugVertices(); createDebugVertices();
updateArcLengthTable(); updateArcLengthTable();
} }
// How sharply the curve bends at the interpolated points, between 0 and 1. // How sharply the curve bends at the interpolated points, between 0 and 1.
float tension = 0.5f; float tension = 0.5f;
// The points of the Catmull-Rom curve // The points of the Catmull-Rom curve
Array<Vector> points = Array<Vector>(); Array<Vector> points = Array<Vector>();
// Offset How many points should be skipped when checking arc length table to find distance (optimization) // Offset How many points should be skipped when checking arc length table to find distance (optimization)
int pointOffset = 0; int pointOffset = 0;
// Whether to start from the first point once the last point has been reached. // Whether to start from the first point once the last point has been reached.
bool looping = false; bool looping = false;
// Arc Length table, stores for each arc (between two consecutive points) // Arc Length table, stores for each arc (between two consecutive points)
// a list of chord length distances. The chord length entries are stored with a distance // a list of chord length distances. The chord length entries are stored with a distance
// of ARC_LENGTH_TABLE_DISTANCE and contain the arc length approximated by cummulative chord lengths. // of ARC_LENGTH_TABLE_DISTANCE and contain the arc length approximated by cummulative chord lengths.
// E.g. if ARC_LENGTH_TABLE_DISTANCE = 0.2f, then the first entry in the first vector is // E.g. if ARC_LENGTH_TABLE_DISTANCE = 0.2f, then the first entry in the first vector is
// the chord length (=direct distance) between t=0 and t=0.2, // the chord length (=direct distance) between t=0 and t=0.2,
// the second one the distance between t=0 and t=0.4, and so on // the second one the distance between t=0 and t=0.4, and so on
Array<Array<float>> arcLengthTable = Array<Array<float>>(); Array<Array<float>> arcLengthTable = Array<Array<float>>();
bool showSplineCurve = false; bool showSplineCurve = false;
bool showControlPoints = false; bool showControlPoints = false;
bool showArcLengthTableSamplePoints = false; bool showArcLengthTableSamplePoints = false;
int debugSplineCurveVerticesCount = 0; int debugSplineCurveVerticesCount = 0;
int debugArcLengthTableSampleVerticesCount = 0; int debugArcLengthTableSampleVerticesCount = 0;
private: private:
Array<DebugVertex> verticesSplineCurve; Array<DebugVertex> verticesSplineCurve;
Array<DebugVertex> verticesArcLengthTableSample; Array<DebugVertex> verticesArcLengthTableSample;
public: public:
// Needs to be called the first time. // Needs to be called the first time.
// Creates vertices used for rendering the debug lines and control points // Creates vertices used for rendering the debug lines and control points
void createDebugVertices() void createDebugVertices()
{ {
updateDebugControlPoints(); updateDebugControlPoints();
updateDebugSplineCurveVertices(Array<Vector>()); updateDebugSplineCurveVertices(Array<Vector>());
updateDebugArcLengthTableSample(Array<Vector>()); updateDebugArcLengthTableSample(Array<Vector>());
} }
void updateDebugControlPoints() void updateDebugControlPoints()
{ {
Array<DebugVertex> verticesControlPoints = Array<DebugVertex>(); Array<DebugVertex> verticesControlPoints = Array<DebugVertex>();
for (uint32_t i = 0; i < points.size(); i++) for (uint32_t i = 0; i < points.size(); i++)
{ {
DebugVertex v = DebugVertex{ DebugVertex v = DebugVertex{
.position = points[i], .position = points[i],
.color = Vector(1, 0, 0), .color = Vector(1, 0, 0),
}; };
verticesControlPoints.add(v); verticesControlPoints.add(v);
} }
} }
void updateDebugSplineCurveVertices(const Array<Vector>& newSplineCurvePoints) void updateDebugSplineCurveVertices(const Array<Vector>& newSplineCurvePoints)
{ {
for (uint32_t i = 1; i < newSplineCurvePoints.size(); i++) // First one can be skipped, as it's always the last one from previous call for (uint32_t i = 1; i < newSplineCurvePoints.size(); i++) // First one can be skipped, as it's always the last one from previous call
{ {
DebugVertex v = DebugVertex{ DebugVertex v = DebugVertex{
.position = newSplineCurvePoints[i], .position = newSplineCurvePoints[i],
.color = Vector(0, 0, 1), .color = Vector(0, 0, 1),
}; };
verticesSplineCurve.add(v); verticesSplineCurve.add(v);
} }
debugSplineCurveVerticesCount = verticesSplineCurve.size(); debugSplineCurveVerticesCount = verticesSplineCurve.size();
} }
void updateDebugArcLengthTableSample(const Array<Vector>& newArcLengthTablePositions) void updateDebugArcLengthTableSample(const Array<Vector>& newArcLengthTablePositions)
{ {
for (uint32_t i = 1; i < newArcLengthTablePositions.size(); i++) // First one can be skipped, as it's always the last one from previous call for (uint32_t i = 1; i < newArcLengthTablePositions.size(); i++) // First one can be skipped, as it's always the last one from previous call
{ {
DebugVertex v = DebugVertex{ DebugVertex v = DebugVertex{
.position = newArcLengthTablePositions[i], .position = newArcLengthTablePositions[i],
.color = Vector(0, 1, 0), .color = Vector(0, 1, 0),
}; };
verticesArcLengthTableSample.add(v); verticesArcLengthTableSample.add(v);
} }
debugArcLengthTableSampleVerticesCount = verticesArcLengthTableSample.size(); debugArcLengthTableSampleVerticesCount = verticesArcLengthTableSample.size();
} }
void updateArcLengthTable() void updateArcLengthTable()
{ {
assert(points.size() > 3); assert(points.size() > 3);
Array<Vector> debugPoints = Array<Vector>(); //only used for debug visualization Array<Vector> debugPoints = Array<Vector>(); //only used for debug visualization
// don't recalculate existing entries // don't recalculate existing entries
int startIndex = arcLengthTable.size(); int startIndex = arcLengthTable.size();
float previousDistance = 0.0f; float previousDistance = 0.0f;
if (arcLengthTable.size() > 0) if (arcLengthTable.size() > 0)
{ {
Array<float> pChoordLength = arcLengthTable[arcLengthTable.size() - 1]; Array<float> pChoordLength = arcLengthTable[arcLengthTable.size() - 1];
previousDistance = pChoordLength[pChoordLength.size() - 1]; previousDistance = pChoordLength[pChoordLength.size() - 1];
} }
int stepsPerP = 1.0f / Path::ARC_LENGTH_TABLE_DISTANCE; int stepsPerP = 1.0f / Path::ARC_LENGTH_TABLE_DISTANCE;
// If path is looping, we need to check all points // If path is looping, we need to check all points
int p0IndexBorder = looping ? points.size() : points.size() - 3; int p0IndexBorder = looping ? points.size() : points.size() - 3;
// First distance is p1 to p2 (since p0 is skipped), but we check loop by p0 // First distance is p1 to p2 (since p0 is skipped), but we check loop by p0
for (int p0Index = startIndex; p0Index < p0IndexBorder; p0Index++) for (int p0Index = startIndex; p0Index < p0IndexBorder; p0Index++)
{ {
Array<float> choordLengths = Array<float>(); Array<float> choordLengths = Array<float>();
Vector pA = catmullrom(0, Vector pA = catmullrom(0,
points[(p0Index) % points.size()], points[(p0Index) % points.size()],
points[(p0Index + 1) % points.size()], points[(p0Index + 1) % points.size()],
points[(p0Index + 2) % points.size()], points[(p0Index + 2) % points.size()],
points[(p0Index + 3) % points.size()], points[(p0Index + 3) % points.size()],
tension); tension);
debugPoints.add(pA); debugPoints.add(pA);
// First distance is always same as last distance from previous step/point // First distance is always same as last distance from previous step/point
choordLengths.add(previousDistance); choordLengths.add(previousDistance);
for (int step = 1; step < (stepsPerP + 1); step++) for (int step = 1; step < (stepsPerP + 1); step++)
{ {
Vector pB = catmullrom(step * Path::ARC_LENGTH_TABLE_DISTANCE, Vector pB = catmullrom(step * Path::ARC_LENGTH_TABLE_DISTANCE,
points[(p0Index) % points.size()], points[(p0Index) % points.size()],
points[(p0Index + 1) % points.size()], points[(p0Index + 1) % points.size()],
points[(p0Index + 2) % points.size()], points[(p0Index + 2) % points.size()],
points[(p0Index + 3) % points.size()], points[(p0Index + 3) % points.size()],
tension); tension);
debugPoints.add(pB); debugPoints.add(pB);
previousDistance += glm::distance(pA, pB); previousDistance += glm::distance(pA, pB);
choordLengths.add(previousDistance); choordLengths.add(previousDistance);
pA = pB; pA = pB;
} }
Array<float>& arr = arcLengthTable.add(); Array<float>& arr = arcLengthTable.add();
arr = std::move(choordLengths); arr = std::move(choordLengths);
} }
updateDebugArcLengthTableSample(debugPoints); updateDebugArcLengthTableSample(debugPoints);
updateDebugSplineCurveVertices(debugPoints); updateDebugSplineCurveVertices(debugPoints);
} }
void appendPoints(const Array<Vector>& toBeAppendedPoints, Vector pointPositionOffset) void appendPoints(const Array<Vector>& toBeAppendedPoints, Vector pointPositionOffset)
{ {
size_t originalSize = points.size(); size_t originalSize = points.size();
points.resize(originalSize + toBeAppendedPoints.size()); points.resize(originalSize + toBeAppendedPoints.size());
for (size_t i = 0; i < toBeAppendedPoints.size(); i++) for (size_t i = 0; i < toBeAppendedPoints.size(); i++)
{ {
points[originalSize + i] = toBeAppendedPoints[i] + pointPositionOffset; points[originalSize + i] = toBeAppendedPoints[i] + pointPositionOffset;
} }
updateDebugControlPoints(); updateDebugControlPoints();
} }
float getPathLength() const float getPathLength() const
{ {
if (arcLengthTable.size() == 0 || arcLengthTable.back().size() == 0) if (arcLengthTable.size() == 0 || arcLengthTable.back().size() == 0)
return 0.f; return 0.f;
return arcLengthTable.back().back(); return arcLengthTable.back().back();
} }
// Returns float P(t) between p1 and p2 // Returns float P(t) between p1 and p2
static float catmullrom(float t, float p0, float p1, float p2, float p3, float tension) static float catmullrom(float t, float p0, float p1, float p2, float p3, float tension)
{ {
// TODO: The tension variable doesn't fully influence this function. // TODO: The tension variable doesn't fully influence this function.
// If it's something else than 0.5, This would need to be rewritten, as the matrix would be a bit different then // If it's something else than 0.5, This would need to be rewritten, as the matrix would be a bit different then
return tension * ( return tension * (
(2 * p1) + (2 * p1) +
(-p0 + p2) * t + (-p0 + p2) * t +
(2 * p0 - 5 * p1 + 4 * p2 - p3) * t * t + (2 * p0 - 5 * p1 + 4 * p2 - p3) * t * t +
(-p0 + 3 * p1 - 3 * p2 + p3) * t * t * t (-p0 + 3 * p1 - 3 * p2 + p3) * t * t * t
); );
} }
// Returns point P(t) between p1 and p2 // Returns point P(t) between p1 and p2
static Vector catmullrom(float t, Vector p0, Vector p1, Vector p2, Vector p3, float tension) static Vector catmullrom(float t, Vector p0, Vector p1, Vector p2, Vector p3, float tension)
{ {
return Vector( return Vector(
catmullrom(t, p0.x, p1.x, p2.x, p3.x, tension), catmullrom(t, p0.x, p1.x, p2.x, p3.x, tension),
catmullrom(t, p0.y, p1.y, p2.y, p3.y, tension), catmullrom(t, p0.y, p1.y, p2.y, p3.y, tension),
catmullrom(t, p0.z, p1.z, p2.z, p3.z, tension) catmullrom(t, p0.z, p1.z, p2.z, p3.z, tension)
); );
} }
}; };
+26 -26
View File
@@ -1,27 +1,27 @@
#pragma once #pragma once
#include "Define.h" #include "Define.h"
#include <Math/Vector.h> #include <Math/Vector.h>
#include <Actor/Actor.h> #include <Actor/Actor.h>
struct PathFollow struct PathFollow
{ {
enum class SpeedControl { enum class SpeedControl {
Linear, Linear,
EaseInEaseOut EaseInEaseOut
}; };
PEntity path; PEntity path;
// How many seconds since start of path, used to calculate new position in path // How many seconds since start of path, used to calculate new position in path
float time = 0.0f; float time = 0.0f;
// How much distance per passed second will be traversed along the path // How much distance per passed second will be traversed along the path
float traversalSpeed = 1.0f; float traversalSpeed = 1.0f;
// The desired speed control function (choose Linear to simply use the traversal speed) // The desired speed control function (choose Linear to simply use the traversal speed)
SpeedControl speedControl = SpeedControl::Linear; SpeedControl speedControl = SpeedControl::Linear;
// Distance travelled through the path // Distance travelled through the path
float distance = 0.0f; float distance = 0.0f;
// The entity's Transform will always get this offset applied // The entity's Transform will always get this offset applied
Vector pathOffset = Seele::Vector(0); Vector pathOffset = Seele::Vector(0);
Vector lastPos = Vector(0); Vector lastPos = Vector(0);
}; };
+13 -13
View File
@@ -1,14 +1,14 @@
#pragma once #pragma once
#include <MinimalEngine.h> #include <MinimalEngine.h>
using namespace Seele; using namespace Seele;
#ifdef WIN32 #ifdef WIN32
#ifdef BUILD_DLL #ifdef BUILD_DLL
#define MESHSHADINGDEMO_API __declspec(dllexport) #define MESHSHADINGDEMO_API __declspec(dllexport)
#else #else
#define MESHSHADINGDEMO_API __declspec(dllimport) #define MESHSHADINGDEMO_API __declspec(dllimport)
#endif #endif
#else #else
#define MESHSHADINGDEMO_API #define MESHSHADINGDEMO_API
#endif #endif
+217 -217
View File
@@ -1,218 +1,218 @@
#include "MeshShadingDemoGame.h" #include "MeshShadingDemoGame.h"
#include "Actor/FlyCam.h" #include "Actor/FlyCam.h"
#include "Asset/AssetRegistry.h" #include "Asset/AssetRegistry.h"
#include "Component/Transform.h" #include "Component/Transform.h"
#include "Component/TerrainTile.h" #include "Component/TerrainTile.h"
#include "System/FlyCamSystem.h" #include "System/FlyCamSystem.h"
#include "Component/Path.h" #include "Component/Path.h"
#include "Component/WaterTile.h" #include "Component/WaterTile.h"
#include "System/SplineCamSystem.h" #include "System/SplineCamSystem.h"
#include "Graphics/StaticMeshVertexData.h" #include "Graphics/StaticMeshVertexData.h"
MeshShadingDemoGame::MeshShadingDemoGame() MeshShadingDemoGame::MeshShadingDemoGame()
{ {
} }
MeshShadingDemoGame::~MeshShadingDemoGame() MeshShadingDemoGame::~MeshShadingDemoGame()
{ {
} }
void MeshShadingDemoGame::setupScene(PScene scene, PSystemGraph graph) void MeshShadingDemoGame::setupScene(PScene scene, PSystemGraph graph)
{ {
flyCam = new FlyCam(scene); flyCam = new FlyCam(scene);
flyCam->attachComponent<Component::PointLight>(Vector(1, 1, 1), 1.0f, 2.0f); flyCam->attachComponent<Component::PointLight>(Vector(1, 1, 1), 1.0f, 2.0f);
flyCam->getCamera().mainCamera = true; flyCam->getCamera().mainCamera = true;
followCam = new PathFollowCam(scene); followCam = new PathFollowCam(scene);
//followCam->getCamera().mainCamera = true; //followCam->getCamera().mainCamera = true;
/* { /* {
Array<Vector> lightPoints = { Array<Vector> lightPoints = {
Vector(13.542, 3.12369, -12.3293), Vector(13.542, 3.12369, -12.3293),
Vector(20.6668, 3.04548, -20.9486), Vector(20.6668, 3.04548, -20.9486),
Vector(11.5522, 3.09676, -45.9563), Vector(11.5522, 3.09676, -45.9563),
Vector(10.392, 3.0536, -63.238), Vector(10.392, 3.0536, -63.238),
Vector(14.8289, 3.01454, -72.0112), Vector(14.8289, 3.01454, -72.0112),
Vector(16.9386, 3.06158, -80.7447), Vector(16.9386, 3.06158, -80.7447),
Vector(17.6772, 3.05903, -89.3406), Vector(17.6772, 3.05903, -89.3406),
Vector(17.4801, 3.03598, -97.9897), Vector(17.4801, 3.03598, -97.9897),
Vector(17.1882, 3.04928, -106.596), Vector(17.1882, 3.04928, -106.596),
Vector(16.8547, 3.05735, -116.065), Vector(16.8547, 3.05735, -116.065),
Vector(16.6074, 3.05262, -123.884), Vector(16.6074, 3.05262, -123.884),
Vector(16.331, 3.03858, -132.499), Vector(16.331, 3.03858, -132.499),
Vector(16.0015, 3.07391, -141.126), Vector(16.0015, 3.07391, -141.126),
Vector(26.1148, 3.05149, -141.591), Vector(26.1148, 3.05149, -141.591),
Vector(26.4517, 3.06293, -132.945), Vector(26.4517, 3.06293, -132.945),
Vector(26.7491, 3.06205, -124.321), Vector(26.7491, 3.06205, -124.321),
Vector(27.0371, 3.11222, -115.731), Vector(27.0371, 3.11222, -115.731),
Vector(28.7401, 3.063, -98.5291), Vector(28.7401, 3.063, -98.5291),
Vector(29.0123, 3.09289, -89.8635), Vector(29.0123, 3.09289, -89.8635),
Vector(28.5112, 3.07688, -81.2221), Vector(28.5112, 3.07688, -81.2221),
Vector(26.8285, 3.12346, -72.5381), Vector(26.8285, 3.12346, -72.5381),
Vector(23.7577, 3.07845, -63.8065), Vector(23.7577, 3.07845, -63.8065),
Vector(18.4836, 3.07243, -54.9846), Vector(18.4836, 3.07243, -54.9846),
Vector(11.5667, 3.0757, -46.1511), Vector(11.5667, 3.0757, -46.1511),
Vector(44.4868, 3.169, -11.858), Vector(44.4868, 3.169, -11.858),
Vector(50.5335, 3.15588, -21.1511), Vector(50.5335, 3.15588, -21.1511),
Vector(54.2709, 3.18958, -30.2516), Vector(54.2709, 3.18958, -30.2516),
Vector(55.6934, 3.22225, -39.0652), Vector(55.6934, 3.22225, -39.0652),
Vector(55.8267, 3.16783, -47.748), Vector(55.8267, 3.16783, -47.748),
Vector(55.0125, 3.20429, -56.3455), Vector(55.0125, 3.20429, -56.3455),
Vector(54.0781, 3.20927, -64.9114), Vector(54.0781, 3.20927, -64.9114),
Vector(53.1076, 3.17979, -74.2689), Vector(53.1076, 3.17979, -74.2689),
Vector(52.2437, 3.21515, -82.0613), Vector(52.2437, 3.21515, -82.0613),
Vector(51.3169, 3.19196, -90.6292), Vector(51.3169, 3.19196, -90.6292),
Vector(50.3008, 3.20521, -99.2916), Vector(50.3008, 3.20521, -99.2916),
Vector(60.4217, 3.17473, -100.424), Vector(60.4217, 3.17473, -100.424),
Vector(61.3612, 3.21026, -91.855), Vector(61.3612, 3.21026, -91.855),
Vector(62.2923, 3.1473, -83.2846), Vector(62.2923, 3.1473, -83.2846),
Vector(63.2343, 3.18438, -74.7077), Vector(63.2343, 3.18438, -74.7077),
Vector(66.1857, 3.23896, -57.6697), Vector(66.1857, 3.23896, -57.6697),
Vector(67.1304, 3.19608, -49.0803), Vector(67.1304, 3.19608, -49.0803),
Vector(67.2474, 3.17215, -40.4073), Vector(67.2474, 3.17215, -40.4073),
Vector(66.2297, 3.20527, -31.6281), Vector(66.2297, 3.20527, -31.6281),
Vector(63.8036, 3.21531, -22.7063), Vector(63.8036, 3.21531, -22.7063),
Vector(59.241, 3.19388, -13.5084), Vector(59.241, 3.19388, -13.5084),
Vector(53.0474, 3.21296, -4.20644), Vector(53.0474, 3.21296, -4.20644),
Vector(4.588, 3.085, 4.934), Vector(4.588, 3.085, 4.934),
Vector(7.953, 3.121, -3.686), Vector(7.953, 3.121, -3.686),
Vector(13.556, 3.187, -20.951), Vector(13.556, 3.187, -20.951),
Vector(28.248, 3.119, -12.431), Vector(28.248, 3.119, -12.431),
Vector(21.286, 3.132, -3.812), Vector(21.286, 3.132, -3.812),
Vector(16.584, 3.1152, 4.822), Vector(16.584, 3.1152, 4.822),
Vector(14.232, 3.151, 13.474), Vector(14.232, 3.151, 13.474),
Vector(13.178, 3.144, 22.079), Vector(13.178, 3.144, 22.079),
Vector(13.074, 3.176, 30.716), Vector(13.074, 3.176, 30.716),
Vector(13.053, 3.136, 39.339), Vector(13.053, 3.136, 39.339),
Vector(13.062, 3.163, 48.746), Vector(13.062, 3.163, 48.746),
Vector(13.067, 3.097, 56.555), Vector(13.067, 3.097, 56.555),
Vector(13.051, 3.109, 65.204), Vector(13.051, 3.109, 65.204),
Vector(13.073, 3.107, 73.822), Vector(13.073, 3.107, 73.822),
Vector(2.997, 3.1082, 73.903), Vector(2.997, 3.1082, 73.903),
Vector(2.951, 3.127, 65.324), Vector(2.951, 3.127, 65.324),
Vector(2.939, 3.117, 56.713), Vector(2.939, 3.117, 56.713),
Vector(2.939, 3.100, 48.078), Vector(2.939, 3.100, 48.078),
Vector(1.819, 3.048, 30.881), Vector(1.819, 3.048, 30.881),
Vector(1.812, 3.076, 22.211), Vector(1.812, 3.076, 22.211),
Vector(2.647, 3.154, 13.573), Vector(2.647, 3.154, 13.573),
}; };
Path p = Path({ Path p = Path({
Vector(-16.9676, 5.7499, -77.5539), Vector(-16.9676, 5.7499, -77.5539),
Vector(-3.95049, 3.51678, -60.7428), Vector(-3.95049, 3.51678, -60.7428),
Vector(0.954792, 3.47537, -55.1175), Vector(0.954792, 3.47537, -55.1175),
Vector(16.9581, 3.26171, -34.3647), Vector(16.9581, 3.26171, -34.3647),
Vector(25.8841, 3.0817, -24.1843), Vector(25.8841, 3.0817, -24.1843),
Vector(42.8916, 2.71463, -7.55981), Vector(42.8916, 2.71463, -7.55981),
Vector(58.1216, 2.88532, -15.9938), Vector(58.1216, 2.88532, -15.9938),
Vector(67.3108, 3.40471, -48.757), Vector(67.3108, 3.40471, -48.757),
Vector(73.9232, 3.10779, -144.263), Vector(73.9232, 3.10779, -144.263),
Vector(81.7667, 3.32603, -172.821), Vector(81.7667, 3.32603, -172.821),
}); });
for (auto p : lightPoints) for (auto p : lightPoints)
{ {
lights.add(new PointLightActor(scene, p, Vector(251 / 255.f, 207 / 255.f, 107 / 255.f), 2)); lights.add(new PointLightActor(scene, p, Vector(251 / 255.f, 207 / 255.f, 107 / 255.f), 2));
} }
path = new Entity(scene); path = new Entity(scene);
path->attachComponent<Path>(p); path->attachComponent<Path>(p);
chapel = new StaticMeshActor(scene, AssetRegistry::findMesh("Whitechapel", "Whitechapel")); chapel = new StaticMeshActor(scene, AssetRegistry::findMesh("Whitechapel", "Whitechapel"));
followCam->getPathFollow().path = path; followCam->getPathFollow().path = path;
}*/ }*/
/* /*
{ {
Path p = Path({ Path p = Path({
Vector(-28.8013, 9.58383, -84.0442), Vector(-28.8013, 9.58383, -84.0442),
Vector(-27.5597, 9.09855, -57.1531), Vector(-27.5597, 9.09855, -57.1531),
Vector(-27.2196, 8.99756, -14.1793), Vector(-27.2196, 8.99756, -14.1793),
Vector(-27.5354, 8.11755, 26.1741), Vector(-27.5354, 8.11755, 26.1741),
Vector(-28.6125, 7.32383, 67.1864), Vector(-28.6125, 7.32383, 67.1864),
Vector(-5.20891, 7.62963, 87.9103), Vector(-5.20891, 7.62963, 87.9103),
Vector(18.1879, 8.19607, 113.661), Vector(18.1879, 8.19607, 113.661),
Vector(18.8014, 5.01105, 149.623), Vector(18.8014, 5.01105, 149.623),
Vector(18.6341, 4.84045, 183.52), Vector(18.6341, 4.84045, 183.52),
Vector(21.6458, 4.17056, 190.23), Vector(21.6458, 4.17056, 190.23),
}); });
path = new Entity(scene); path = new Entity(scene);
path->attachComponent<Path>(p); path->attachComponent<Path>(p);
for (uint32 y = 0; y < 2; y++) for (uint32 y = 0; y < 2; y++)
{ {
for (uint32 x = 0; x < 2; x++) for (uint32 x = 0; x < 2; x++)
{ {
suburbs.add(new StaticMeshActor(scene, AssetRegistry::findMesh("suburbs", "city-suburbs"))); suburbs.add(new StaticMeshActor(scene, AssetRegistry::findMesh("suburbs", "city-suburbs")));
suburbs.back()->getTransform().setPosition(Vector(x * 143, 0, y * 193)); suburbs.back()->getTransform().setPosition(Vector(x * 143, 0, y * 193));
} }
} }
followCam->getPathFollow().path = path; followCam->getPathFollow().path = path;
}*/ }*/
{ {
Path p = Path({ Path p = Path({
Vector(33.3414, 36.8653, 28.819), Vector(33.3414, 36.8653, 28.819),
Vector(69.6004, 42.7509, 109.65), Vector(69.6004, 42.7509, 109.65),
Vector(82.0893, 43.8156, 127.942), Vector(82.0893, 43.8156, 127.942),
Vector(106.724, 42.0612, 154.561), Vector(106.724, 42.0612, 154.561),
Vector(168.118, 39.9358, 220.453), Vector(168.118, 39.9358, 220.453),
Vector(219.94, 42.453, 273.038), Vector(219.94, 42.453, 273.038),
Vector(244.23, 44.1136, 289.115), Vector(244.23, 44.1136, 289.115),
Vector(253.318, 44.4212, 303.567), Vector(253.318, 44.4212, 303.567),
Vector(256.505, 44.6277, 324.343), Vector(256.505, 44.6277, 324.343),
Vector(282.637, 45.0222, 371.102), Vector(282.637, 45.0222, 371.102),
Vector(299.247, 45.3911, 375.493), Vector(299.247, 45.3911, 375.493),
Vector(393.234, 37.4515, 364.943), Vector(393.234, 37.4515, 364.943),
}); });
//path = new Entity(scene); //path = new Entity(scene);
//path->attachComponent<Path>(p); //path->attachComponent<Path>(p);
//followCam->getPathFollow().path = path; //followCam->getPathFollow().path = path;
//minecraft = new StaticMeshActor(scene, AssetRegistry::findMesh("minecraft", "minecraft-medieval-city")); //minecraft = new StaticMeshActor(scene, AssetRegistry::findMesh("minecraft", "minecraft-medieval-city"));
//minecraft->getTransform().setScale(Vector(0.01, 0.01, 0.01)); //minecraft->getTransform().setScale(Vector(0.01, 0.01, 0.01));
} }
{ {
Path p = Path({ Path p = Path({
Vector(89.3805, 153.648, 270.467), Vector(89.3805, 153.648, 270.467),
Vector(131.966, 119.247, 116.347), Vector(131.966, 119.247, 116.347),
Vector(72.9846, 95.5085, 18.481), Vector(72.9846, 95.5085, 18.481),
Vector(23.1404, 96.2972, 31.0632), Vector(23.1404, 96.2972, 31.0632),
Vector(-12.3954, 100.118, -10.2085), Vector(-12.3954, 100.118, -10.2085),
Vector(-11.1341, 104.619, -79.1077), Vector(-11.1341, 104.619, -79.1077),
Vector(-7.61656, 112.695, -102.459), Vector(-7.61656, 112.695, -102.459),
}); });
//path = new Entity(scene); //path = new Entity(scene);
//path->attachComponent<Path>(p); //path->attachComponent<Path>(p);
//followCam->getPathFollow().path = path; //followCam->getPathFollow().path = path;
//volvo = new StaticMeshActor(scene, AssetRegistry::findMesh("Volvo", "Volvo")); //volvo = new StaticMeshActor(scene, AssetRegistry::findMesh("Volvo", "Volvo"));
} }
test = new StaticMeshActor(scene, AssetRegistry::findMesh("rttest", "rttest")); test = new StaticMeshActor(scene, AssetRegistry::findMesh("rttest", "rttest"));
//test->getTransform().setScale(Vector(0.01, 0.01, 0.01)); //test->getTransform().setScale(Vector(0.01, 0.01, 0.01));
/*for (int32 y = -40; y < 40; ++y) /*for (int32 y = -40; y < 40; ++y)
{ {
for (int32 x = -40; x < 40; ++x) for (int32 x = -40; x < 40; ++x)
{ {
scene->attachComponent<Component::WaterTile>(scene->createEntity(), Component::WaterTile{ scene->attachComponent<Component::WaterTile>(scene->createEntity(), Component::WaterTile{
.location = IVector2(x, y), .location = IVector2(x, y),
.height = 0, .height = 0,
}); });
} }
}*/ }*/
center = new PointLightActor(scene, Vector(0, 0, 0), 10, Vector(1, 1, 1), 10); center = new PointLightActor(scene, Vector(0, 0, 0), 10, Vector(1, 1, 1), 10);
xAxis = new PointLightActor(scene, Vector(10, 0, 0), 10, Vector(1, 0, 0), 10); xAxis = new PointLightActor(scene, Vector(10, 0, 0), 10, Vector(1, 0, 0), 10);
yAxis = new PointLightActor(scene, Vector(0, 10, 0), 10, Vector(0, 1, 0), 10); yAxis = new PointLightActor(scene, Vector(0, 10, 0), 10, Vector(0, 1, 0), 10);
zAxis = new PointLightActor(scene, Vector(0, 0, 10), 10, Vector(0, 0, 1), 10); zAxis = new PointLightActor(scene, Vector(0, 0, 10), 10, Vector(0, 0, 1), 10);
light = new DirectionalLightActor(scene, Vector(1, 1, 1), 1, Vector(0.4, -0.4, 0)); light = new DirectionalLightActor(scene, Vector(1, 1, 1), 1, Vector(0.4, -0.4, 0));
graph->addSystem(new FlyCamSystem(scene)); graph->addSystem(new FlyCamSystem(scene));
graph->addSystem(new SplineCamSystem(scene)); graph->addSystem(new SplineCamSystem(scene));
} }
Game* createInstance() Game* createInstance()
{ {
return new MeshShadingDemoGame(); return new MeshShadingDemoGame();
} }
void destroyInstance(Game* game) void destroyInstance(Game* game)
{ {
delete game; delete game;
} }
+33 -33
View File
@@ -1,34 +1,34 @@
#pragma once #pragma once
#include "Actor/FlyCam.h" #include "Actor/FlyCam.h"
#include "Actor/PathFollowCam.h" #include "Actor/PathFollowCam.h"
#include "Define.h" #include "Define.h"
#include <Actor/StaticMeshActor.h> #include <Actor/StaticMeshActor.h>
#include <Actor/DirectionalLightActor.h> #include <Actor/DirectionalLightActor.h>
#include <Actor/PointLightActor.h> #include <Actor/PointLightActor.h>
#include <Game.h> #include <Game.h>
class MESHSHADINGDEMO_API MeshShadingDemoGame : public Game { class MESHSHADINGDEMO_API MeshShadingDemoGame : public Game {
public: public:
MeshShadingDemoGame(); MeshShadingDemoGame();
virtual ~MeshShadingDemoGame(); virtual ~MeshShadingDemoGame();
virtual void setupScene(PScene scene, PSystemGraph graph) override; virtual void setupScene(PScene scene, PSystemGraph graph) override;
private: private:
Array<OPointLightActor> lights; Array<OPointLightActor> lights;
OStaticMeshActor chapel; OStaticMeshActor chapel;
OStaticMeshActor test; OStaticMeshActor test;
OStaticMeshActor minecraft; OStaticMeshActor minecraft;
OStaticMeshActor volvo; OStaticMeshActor volvo;
Array<OStaticMeshActor> suburbs; Array<OStaticMeshActor> suburbs;
OEntity path; OEntity path;
OFlyCam flyCam; OFlyCam flyCam;
OPathFollowCam followCam; OPathFollowCam followCam;
ODirectionalLightActor light; ODirectionalLightActor light;
OPointLightActor center; OPointLightActor center;
OPointLightActor xAxis; OPointLightActor xAxis;
OPointLightActor yAxis; OPointLightActor yAxis;
OPointLightActor zAxis; OPointLightActor zAxis;
}; };
extern "C" MESHSHADINGDEMO_API Game* createInstance(); extern "C" MESHSHADINGDEMO_API Game* createInstance();
extern "C" MESHSHADINGDEMO_API void destroyInstance(Game* game); extern "C" MESHSHADINGDEMO_API void destroyInstance(Game* game);
+5 -5
View File
@@ -1,6 +1,6 @@
target_sources(MeshShadingDemo target_sources(MeshShadingDemo
PUBLIC PUBLIC
FlyCamSystem.h FlyCamSystem.h
FlyCamSystem.cpp FlyCamSystem.cpp
SplineCamSystem.h SplineCamSystem.h
SplineCamSystem.cpp) SplineCamSystem.cpp)
+53 -53
View File
@@ -1,54 +1,54 @@
#include "FlyCamSystem.h" #include "FlyCamSystem.h"
FlyCamSystem::FlyCamSystem(PScene scene) FlyCamSystem::FlyCamSystem(PScene scene)
: System::ComponentSystem<Component::KeyboardInput, Component::Camera, Component::Transform, Component::PointLight>(scene) {} : System::ComponentSystem<Component::KeyboardInput, Component::Camera, Component::Transform, Component::PointLight>(scene) {}
FlyCamSystem::~FlyCamSystem() {} FlyCamSystem::~FlyCamSystem() {}
void FlyCamSystem::update(Component::KeyboardInput& input, Component::Camera& camera, Component::Transform& transform, Component::PointLight& light) { void FlyCamSystem::update(Component::KeyboardInput& input, Component::Camera& camera, Component::Transform& transform, Component::PointLight& light) {
float cameraMove = static_cast<float>(deltaTime) * 4; float cameraMove = static_cast<float>(deltaTime) * 4;
if(input.keys[KeyCode::KEY_LEFT_SHIFT]) if(input.keys[KeyCode::KEY_LEFT_SHIFT])
{ {
cameraMove *= 10; cameraMove *= 10;
} }
Vector forward = transform.getForward(); Vector forward = transform.getForward();
Vector side = transform.getRight(); Vector side = transform.getRight();
Vector moveVector = Vector(); Vector moveVector = Vector();
if (input.keys[KeyCode::KEY_J]) if (input.keys[KeyCode::KEY_J])
{ {
std::cout << transform.getPosition() << std::endl; std::cout << transform.getPosition() << std::endl;
} }
if(input.keys[KeyCode::KEY_W]) if(input.keys[KeyCode::KEY_W])
{ {
moveVector += forward * cameraMove; moveVector += forward * cameraMove;
} }
if(input.keys[KeyCode::KEY_S]) if(input.keys[KeyCode::KEY_S])
{ {
moveVector += forward * -cameraMove; moveVector += forward * -cameraMove;
} }
if(input.keys[KeyCode::KEY_A]) if(input.keys[KeyCode::KEY_A])
{ {
moveVector += side * -cameraMove; moveVector += side * -cameraMove;
} }
if(input.keys[KeyCode::KEY_D]) if(input.keys[KeyCode::KEY_D])
{ {
moveVector += side * cameraMove; moveVector += side * cameraMove;
} }
if(input.keys[KeyCode::KEY_E]) if(input.keys[KeyCode::KEY_E])
{ {
moveVector += Vector(0, cameraMove, 0); moveVector += Vector(0, cameraMove, 0);
} }
if(input.keys[KeyCode::KEY_Q]) if(input.keys[KeyCode::KEY_Q])
{ {
moveVector += Vector(0, -cameraMove, 0); moveVector += Vector(0, -cameraMove, 0);
} }
transform.translate(moveVector); transform.translate(moveVector);
if(input.mouse2) if(input.mouse2)
{ {
transform.setRotation(glm::rotate(transform.getRotation(), input.deltaX / 500, Vector(0, 1, 0))); transform.setRotation(glm::rotate(transform.getRotation(), input.deltaX / 500, Vector(0, 1, 0)));
transform.setRotation(glm::rotate(transform.getRotation(), input.deltaY / 500, transform.getRight())); transform.setRotation(glm::rotate(transform.getRotation(), input.deltaY / 500, transform.getRight()));
} }
light.attenuation += input.scrollY * 0.1; light.attenuation += input.scrollY * 0.1;
} }
+22 -22
View File
@@ -1,23 +1,23 @@
#pragma once #pragma once
#include "Define.h" #include "Define.h"
#include <MinimalEngine.h> #include <MinimalEngine.h>
#include <Scene/Scene.h> #include <Scene/Scene.h>
#include <System/ComponentSystem.h> #include <System/ComponentSystem.h>
#include <Component/Camera.h> #include <Component/Camera.h>
#include <Component/KeyboardInput.h> #include <Component/KeyboardInput.h>
class FlyCamSystem : public System::ComponentSystem< class FlyCamSystem : public System::ComponentSystem<
Component::KeyboardInput, Component::KeyboardInput,
Component::Camera, Component::Camera,
Component::Transform, Component::Transform,
Component::PointLight> Component::PointLight>
{ {
public: public:
FlyCamSystem(PScene scene); FlyCamSystem(PScene scene);
virtual ~FlyCamSystem(); virtual ~FlyCamSystem();
virtual void update(Seele::Component::KeyboardInput& input, Seele::Component::Camera& camera, Seele::Component::Transform& transform, Seele::Component::PointLight& pointLight) override; virtual void update(Seele::Component::KeyboardInput& input, Seele::Component::Camera& camera, Seele::Component::Transform& transform, Seele::Component::PointLight& pointLight) override;
private: private:
float lastMouseX; float lastMouseX;
float lastMouseY; float lastMouseY;
}; };
DEFINE_REF(FlyCamSystem) DEFINE_REF(FlyCamSystem)
+141 -141
View File
@@ -1,141 +1,141 @@
#include "SplineCamSystem.h" #include "SplineCamSystem.h"
SplineCamSystem::SplineCamSystem(PScene scene) SplineCamSystem::SplineCamSystem(PScene scene)
: System::ComponentSystem<Component::Camera, Component::Transform, PathFollow>(scene) : System::ComponentSystem<Component::Camera, Component::Transform, PathFollow>(scene)
{} {}
SplineCamSystem::~SplineCamSystem() SplineCamSystem::~SplineCamSystem()
{} {}
void SplineCamSystem::update(Component::Camera& cam, Component::Transform& transform, PathFollow& follow) void SplineCamSystem::update(Component::Camera& cam, Component::Transform& transform, PathFollow& follow)
{ {
if (follow.path == nullptr) if (follow.path == nullptr)
return; return;
Path& path = follow.path->accessComponent<Path>(); Path& path = follow.path->accessComponent<Path>();
//for (size_t i = 0; i < path.points.size() - 1; ++i) //for (size_t i = 0; i < path.points.size() - 1; ++i)
//{ //{
// addDebugVertex(DebugVertex{ // addDebugVertex(DebugVertex{
// .position = path.points[i], // .position = path.points[i],
// .color = Vector(0, 1, 0) // .color = Vector(0, 1, 0)
// }); // });
// addDebugVertex(DebugVertex{ // addDebugVertex(DebugVertex{
// .position = path.points[i + 1], // .position = path.points[i + 1],
// .color = Vector(0, 1, 0) // .color = Vector(0, 1, 0)
// }); // });
//} //}
updateFollowDistance(follow, path.getPathLength()); updateFollowDistance(follow, path.getPathLength());
std::tuple<int, float> pt = findP0AndTForDistance(path, follow.distance); std::tuple<int, float> pt = findP0AndTForDistance(path, follow.distance);
auto [p0Index, t] = pt; auto [p0Index, t] = pt;
if (p0Index < 0 || (path.points.size() <= p0Index + 3 && !path.looping)) if (p0Index < 0 || (path.points.size() <= p0Index + 3 && !path.looping))
// Not enough points to interpolate... // Not enough points to interpolate...
return; return;
Vector p0 = path.points[p0Index]; Vector p0 = path.points[p0Index];
Vector p1 = path.points[(p0Index + 1) % path.points.size()]; Vector p1 = path.points[(p0Index + 1) % path.points.size()];
Vector p2 = path.points[(p0Index + 2) % path.points.size()]; Vector p2 = path.points[(p0Index + 2) % path.points.size()];
Vector p3 = path.points[(p0Index + 3) % path.points.size()]; Vector p3 = path.points[(p0Index + 3) % path.points.size()];
Vector oldPos = transform.getPosition() - follow.pathOffset; Vector oldPos = transform.getPosition() - follow.pathOffset;
Vector newPos = path.catmullrom(t, p0, p1, p2, p3, path.tension); Vector newPos = path.catmullrom(t, p0, p1, p2, p3, path.tension);
transform.setPosition(newPos + follow.pathOffset); transform.setPosition(newPos + follow.pathOffset);
if ((oldPos - follow.lastPos).length() > Path::LAST_POS_EPSILON) if ((oldPos - follow.lastPos).length() > Path::LAST_POS_EPSILON)
{ {
follow.lastPos = oldPos; follow.lastPos = oldPos;
} }
Vector tangentVector = glm::normalize(follow.lastPos - newPos); Vector tangentVector = glm::normalize(follow.lastPos - newPos);
Quaternion newRot = glm::quatLookAt(tangentVector, Vector(0.0f, 1.0f, 0.0f)); Quaternion newRot = glm::quatLookAt(tangentVector, Vector(0.0f, 1.0f, 0.0f));
transform.setRotation(newRot); transform.setRotation(newRot);
} }
std::tuple<int, float> SplineCamSystem::findP0AndTForDistance(const Path& path, float distance) std::tuple<int, float> SplineCamSystem::findP0AndTForDistance(const Path& path, float distance)
{ {
if (path.arcLengthTable.size() == 0) if (path.arcLengthTable.size() == 0)
return std::tuple<int, float>(-1, 0.0f); return std::tuple<int, float>(-1, 0.0f);
int p0 = -1; int p0 = -1;
float t = 0.0f; float t = 0.0f;
int pIndexToCheck = 1;//path.pointOffset + 1; int pIndexToCheck = 1;//path.pointOffset + 1;
//if (path.looping) //if (path.looping)
//{ //{
// // If looping, subtract loop distance until we are in the final "lap" // // If looping, subtract loop distance until we are in the final "lap"
// float lapDistance = path.arcLengthTable[path.arcLengthTable.size() - 1][path.arcLengthTable[path.arcLengthTable.size() - 1].size() - 1]; // float lapDistance = path.arcLengthTable[path.arcLengthTable.size() - 1][path.arcLengthTable[path.arcLengthTable.size() - 1].size() - 1];
// while (distance >= lapDistance) // while (distance >= lapDistance)
// { // {
// distance -= lapDistance; // distance -= lapDistance;
// } // }
// //
// // If we are in a new loop, the path.pointOffset might not be valid anymore // // If we are in a new loop, the path.pointOffset might not be valid anymore
// if (path.arcLengthTable[path.pointOffset][0] > distance) // if (path.arcLengthTable[path.pointOffset][0] > distance)
// { // {
// pIndexToCheck = 1; // pIndexToCheck = 1;
// } // }
//} //}
float lapDistance = path.arcLengthTable[path.arcLengthTable.size() - 1][path.arcLengthTable[path.arcLengthTable.size() - 1].size() - 1]; float lapDistance = path.arcLengthTable[path.arcLengthTable.size() - 1][path.arcLengthTable[path.arcLengthTable.size() - 1].size() - 1];
if (distance >= lapDistance) if (distance >= lapDistance)
{ {
getGlobals().running = false; getGlobals().running = false;
} }
while (pIndexToCheck < path.arcLengthTable.size() while (pIndexToCheck < path.arcLengthTable.size()
&& path.arcLengthTable[pIndexToCheck][0] < distance) && path.arcLengthTable[pIndexToCheck][0] < distance)
{ {
pIndexToCheck++; pIndexToCheck++;
} }
p0 = pIndexToCheck - 1; p0 = pIndexToCheck - 1;
int arcTableIndex = 1; int arcTableIndex = 1;
float additionalT = 0.0f; float additionalT = 0.0f;
// TODO this could be improved e.g. by using binary search // TODO this could be improved e.g. by using binary search
while (arcTableIndex < path.arcLengthTable[p0].size() while (arcTableIndex < path.arcLengthTable[p0].size()
&& path.arcLengthTable[p0][arcTableIndex] < distance) && path.arcLengthTable[p0][arcTableIndex] < distance)
{ {
arcTableIndex++; arcTableIndex++;
} }
arcTableIndex--; arcTableIndex--;
// Interpolate between arc length table entries to find additionalT // Interpolate between arc length table entries to find additionalT
if (arcTableIndex + 1 < path.arcLengthTable[p0].size()) if (arcTableIndex + 1 < path.arcLengthTable[p0].size())
{ {
float distanceA = path.arcLengthTable[p0][arcTableIndex]; float distanceA = path.arcLengthTable[p0][arcTableIndex];
float distanceB = path.arcLengthTable[p0][arcTableIndex + 1]; float distanceB = path.arcLengthTable[p0][arcTableIndex + 1];
float abDistance = distanceB - distanceA; float abDistance = distanceB - distanceA;
float requiredDistanceAfterA = distance - distanceA; float requiredDistanceAfterA = distance - distanceA;
additionalT = Path::ARC_LENGTH_TABLE_DISTANCE * (requiredDistanceAfterA / abDistance); additionalT = Path::ARC_LENGTH_TABLE_DISTANCE * (requiredDistanceAfterA / abDistance);
} }
t = (arcTableIndex * Path::ARC_LENGTH_TABLE_DISTANCE) + additionalT; t = (arcTableIndex * Path::ARC_LENGTH_TABLE_DISTANCE) + additionalT;
assert(p0 < path.points.size()); assert(p0 < path.points.size());
assert(t >= 0.0f && t <= 1.0f); assert(t >= 0.0f && t <= 1.0f);
return std::tuple<int, float>(p0, t); return std::tuple<int, float>(p0, t);
} }
void SplineCamSystem::updateFollowDistance(PathFollow& follow, float pathLength) void SplineCamSystem::updateFollowDistance(PathFollow& follow, float pathLength)
{ {
follow.time = follow.time + deltaTime; follow.time = follow.time + deltaTime;
switch (follow.speedControl) switch (follow.speedControl)
{ {
case PathFollow::SpeedControl::Linear: case PathFollow::SpeedControl::Linear:
// We increase distance instead of setting it based on overall time, because Linear SpeedControl allows for traversalSpeed change // We increase distance instead of setting it based on overall time, because Linear SpeedControl allows for traversalSpeed change
follow.distance += (deltaTime * follow.traversalSpeed); follow.distance += (deltaTime * follow.traversalSpeed);
break; break;
case PathFollow::SpeedControl::EaseInEaseOut: case PathFollow::SpeedControl::EaseInEaseOut:
{ {
float timeNeededForPath = pathLength / follow.traversalSpeed; float timeNeededForPath = pathLength / follow.traversalSpeed;
float t = follow.time / timeNeededForPath; float t = follow.time / timeNeededForPath;
int laps = (int)t; int laps = (int)t;
t = t - laps; t = t - laps;
float s = (glm::sin(t * glm::pi<float>() - glm::pi<float>() / 2.f) + 1) / 2.f; float s = (glm::sin(t * glm::pi<float>() - glm::pi<float>() / 2.f) + 1) / 2.f;
follow.distance = ((laps + s) * pathLength); follow.distance = ((laps + s) * pathLength);
break; break;
} }
default: default:
assert(false && "Unknown SpeedControl"); assert(false && "Unknown SpeedControl");
} }
} }
+22 -22
View File
@@ -1,23 +1,23 @@
#pragma once #pragma once
#include "Define.h" #include "Define.h"
#include <MinimalEngine.h> #include <MinimalEngine.h>
#include <Scene/Scene.h> #include <Scene/Scene.h>
#include <System/ComponentSystem.h> #include <System/ComponentSystem.h>
#include <Component/Camera.h> #include <Component/Camera.h>
#include <Component/Path.h> #include <Component/Path.h>
#include <Component/PathFollow.h> #include <Component/PathFollow.h>
class SplineCamSystem : public System::ComponentSystem< class SplineCamSystem : public System::ComponentSystem<
Component::Camera, Component::Camera,
Component::Transform, Component::Transform,
PathFollow> PathFollow>
{ {
public: public:
SplineCamSystem(PScene scene); SplineCamSystem(PScene scene);
virtual ~SplineCamSystem(); virtual ~SplineCamSystem();
virtual void update(Component::Camera& camera, Component::Transform& transform, PathFollow& follow); virtual void update(Component::Camera& camera, Component::Transform& transform, PathFollow& follow);
private: private:
std::tuple<int, float> findP0AndTForDistance(const Path& path, float distance); std::tuple<int, float> findP0AndTForDistance(const Path& path, float distance);
void updateFollowDistance(PathFollow& follow, float pathLength); void updateFollowDistance(PathFollow& follow, float pathLength);
}; };
DEFINE_REF(SplineCamSystem) DEFINE_REF(SplineCamSystem)
+20 -20
View File
@@ -1,21 +1,21 @@
{ {
"dependencies": [ "dependencies": [
"assimp", "assimp",
"entt", "entt",
"stb", "stb",
"entt", "entt",
"freetype", "freetype",
"glfw3", "glfw3",
"glm", "glm",
"ktx", "ktx",
"nlohmann-json", "nlohmann-json",
"fmt", "fmt",
"gtest", "gtest",
"vulkan-memory-allocator", "vulkan-memory-allocator",
"lunasvg", "lunasvg",
"harfbuzz", "harfbuzz",
"shader-slang", "shader-slang",
"metis", "metis",
"meshoptimizer" "meshoptimizer"
] ]
} }