Remove assets from repository and download them using xmake
This commit is contained in:
parent
03e2801dbe
commit
5507b98f2f
|
|
@ -7,6 +7,13 @@ Makefile
|
|||
vs*/*
|
||||
vsxmake*/*
|
||||
|
||||
# Ignore assets (except shaders)
|
||||
assets/*
|
||||
!assets/examples_version.txt
|
||||
!assets/readme.md
|
||||
!assets/tests_version.txt
|
||||
!assets/shaders
|
||||
|
||||
# Coverage
|
||||
coverage.out
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
1
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
# Assets
|
||||
|
||||
Assets for examples and unit tests are not part of the repository. When building using xmake, you will be asked if you want to download/update them if required.
|
||||
|
||||
You can also download them manually at :
|
||||
- https://nazara.digitalpulse.software/assets_examples.zip
|
||||
- https://nazara.digitalpulse.software/assets_tests.zip
|
||||
|
|
@ -0,0 +1 @@
|
|||
1
|
||||
|
|
@ -1 +0,0 @@
|
|||
6993cbcca9ac596667135cb0f30bea4841178d3b
|
||||
|
|
@ -1 +0,0 @@
|
|||
94b2c47c9143adbac0fb7e81df5cc87f969f7150
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
The_Brabanconne.ogg
|
||||
|
||||
https://en.wikipedia.org/wiki/File:The_Brabanconne.ogg
|
||||
|
||||
Original file:
|
||||
The_Brabanconne.ogg (Ogg Vorbis sound file, length 1 min 3 s, 378 kbps)
|
||||
|
||||
Summary:
|
||||
|
||||
Description: The Belgian national anthem (instrumental version) performed by the United States Navy Band. Direct link is at http://www.navyband.navy.mil/anthems/ANTHEMS/Belgium.mp3.
|
||||
Date: 19 October 2004
|
||||
Source: http://www.navyband.navy.mil/anthems/national_anthems.htm
|
||||
Author: United States Navy Band (rendition), uploaded to Wikimedia by Keith Lehwald
|
||||
|
||||
Licencing:
|
||||
|
||||
This file is a work of a sailor or employee of the U.S. Navy, taken or made as part of that person's official duties. As a work of the U.S. federal government, the image is in the public domain.
|
||||
This file has been identified as being free of known restrictions under copyright law, including all related and neighboring rights.
|
||||
|
||||
-------------------------------------------------------------------------------------------------
|
||||
|
||||
Cat.flac:
|
||||
|
||||
http://www.freesound.org/people/EARR/sounds/148013/
|
||||
|
||||
Original file:
|
||||
148013__earr__angry-cat.flac (Flac sound file, length 8 s, 96000 Hz, 24 bit depth)
|
||||
|
||||
Author:
|
||||
|
||||
EARR
|
||||
|
||||
Description:
|
||||
|
||||
Slightly angry cat. She is a beautiful Siamese cat called Agostina. She is angry for the recording because i pressed his tail.
|
||||
|
||||
Information about the recording and equipment:
|
||||
|
||||
-Location: Living room.
|
||||
-Type of acoustic environment: Small, diffuse, moderately reflective.
|
||||
-Distance from sound source to microphones: Approx a few centimeters.
|
||||
-Miking technique: Jecklin disk.
|
||||
|
||||
-Microphones: 2 Brüel & Kjaer type 4190 capsules with type 2669L head amplifier.
|
||||
-Microphone preamps: Modified Brüel & Kjaer type 5935L.
|
||||
-ADC: Echo Audiofire 4. (line inputs 3 & 4).
|
||||
-Recorder: Echo Audiofire 4 and Dell D630C running Samplitude 10.
|
||||
|
||||
Eq: Compensation only for the response of the microphones (In this case for flat response at 60º. See Brüel & Kjaer type 4190 datasheet).
|
||||
No reverb, no compression, no fx.
|
||||
|
||||
Licencing:
|
||||
|
||||
Creative commons
|
||||
|
|
@ -1 +0,0 @@
|
|||
Test
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
#############################
|
||||
MD5 sample mesh and animation
|
||||
#############################
|
||||
|
||||
INFORMATION & USAGE
|
||||
===================
|
||||
File includes *.blend source files and TGA format textures for MD5 animated mesh testing.
|
||||
For extensive information and usage instructions visit http://www.katsbits.com/smforum/index.php?topic=178.0
|
||||
|
||||
- bob_lamp_update.blend contain mesh and armature as would be prior to preparation for export.
|
||||
- bob_lamp_update_export contains triangulated mesh ready for export.
|
||||
|
||||
NOTES
|
||||
=====
|
||||
Included files are for use in **Blender 2.69** or above; opening files in older versions may result in errors dues to internal differences between Blender versions.
|
||||
Files and media are provided "as is" without any warranties of functionality.
|
||||
|
||||
COPYRIGHT & DISTRIBUTION
|
||||
========================
|
||||
Copyright © 2014 KatsBits. All Rights Reserved.
|
||||
For more information visit http://www.katsbits.com/ or email info@katsbits.com
|
||||
|
||||
For NON-COMMERCIAL USE ONLY. This file and/or its contents and/or associated materials may not be reproduced, duplicated, distributed or otherwise 'monetised' without prior consent.
|
||||
Contact info@katsbits.com or visit http://copyright.katsbits.com/ for further details regarding this material and/or distribution/copyright.
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
skybox.png
|
||||
|
||||
https://commons.wikimedia.org/wiki/File:Skybox_example.png
|
||||
|
||||
Original file:
|
||||
Skybox example.ogg (Ogg Vorbis sound file, length 1 min 3 s, 378 kbps)
|
||||
|
||||
Summary:
|
||||
|
||||
Description: English: An example of a skybox and how the faces can be aligned
|
||||
Date: 8 June 2011
|
||||
Source: Own work
|
||||
Author: Creator:Arieee
|
||||
|
||||
Description: The Belgian national anthem (instrumental version) performed by the United States Navy Band. Direct link is at http://www.navyband.navy.mil/anthems/ANTHEMS/Belgium.mp3.
|
||||
Date: 19 October 2004
|
||||
Source: http://www.navyband.navy.mil/anthems/national_anthems.htm
|
||||
Author: United States Navy Band (rendition), uploaded to Wikimedia by Keith Lehwald
|
||||
|
||||
Licencing:
|
||||
|
||||
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.
|
||||
|
||||
You are free:
|
||||
|
||||
to share – to copy, distribute and transmit the work
|
||||
to remix – to adapt the work
|
||||
|
||||
Under the following conditions:
|
||||
|
||||
attribution – You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work).
|
||||
share alike – If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.
|
||||
|
||||
-------------------------------------------------------------------------------------------------
|
||||
|
||||
Bob lamp
|
||||
|
||||
http://www.katsbits.com/download/models/md5-example.php
|
||||
|
||||
Original file:
|
||||
bob_lamp_update.zip (Animated MD5 sample file)
|
||||
|
||||
Summary:
|
||||
|
||||
Description: Updated version of "Bob", a low-poly character mesh for general export and testing of MD5 mesh and animation - "*.md5mesh" and "*.md5anim". File and it's contents should be opened in Blender 2.69 or above to avoid compatibility issues with older versions of Blender and/or resulting MD5 exports (md5mesh & md5anim).
|
||||
|
||||
File includes two versions of the source file, one 'working' - mesh is intact with surfaces in 'quad' form; and one 'prepped' (exported) - mesh has been tessilated (triangulated) for export.
|
||||
Date: Januari 2014
|
||||
Source: http://www.katsbits.com/download/models/md5-example.php
|
||||
Author: KatsBits
|
||||
|
||||
Licencing:
|
||||
|
||||
Please, refer to "Bob lamp/Readme.txt" file.
|
||||
|
||||
-------------------------------------------------------------------------------------------------
|
||||
|
||||
Standford dragon
|
||||
|
||||
http://graphics.stanford.edu/data/3Dscanrep/
|
||||
|
||||
Original file:
|
||||
dragon_recon.tar.gz (PLY files)
|
||||
|
||||
Summary:
|
||||
|
||||
Dragon
|
||||
Source: Stanford University Computer Graphics Laboratory
|
||||
Scanner: Cyberware 3030 MS + spacetime analysis
|
||||
Number of scans: ~70
|
||||
Total size of scans: 2,748,318 points (about 5,500,000 triangles)
|
||||
Reconstruction: vrip (conservatively decimated)
|
||||
Size of reconstruction: 566,098 vertices, 1,132,830 triangles
|
||||
Comments: contains numerous small holes
|
||||
Date: 1996
|
||||
Source: http://graphics.stanford.edu/data/3Dscanrep/
|
||||
Author: Stanford University Computer Graphics Laboratory
|
||||
|
||||
Licencing:
|
||||
|
||||
Please be sure to acknowledge the source of the data and models you take from this repository. In each of the listings below, we have cited the source of the range data and reconstructed models. You are welcome to use the data and models for research purposes. You are also welcome to mirror or redistribute them for free. Finally, you may publish images made using these models, or the images on this web site, in a scholarly article or book - as long as credit is given to the Stanford Computer Graphics Laboratory. However, such models or images are not to be used for commercial purposes, nor should they appear in a product for sale (with the exception of scholarly journals or books), without our permission.
|
||||
Please, refer to "dragon_recon/README" file.
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
Surface Reconstructions
|
||||
|
||||
Stanford Range Repository
|
||||
Computer Graphics Laboratory
|
||||
Stanford University
|
||||
|
||||
August 4, 1996
|
||||
|
||||
|
||||
These files are the result of reconstructing a set of range images
|
||||
using the "vrip" program. The first file is the high resolution
|
||||
result, while the "_res*" files are decimated versions. Note that
|
||||
these decimations were performed using a crude algorithm that does not
|
||||
necessarily preserve mesh topology. While they are not beautiful,
|
||||
they are suitable for interactive rendering.
|
||||
|
||||
Note that this model is a decimated version of the original which was
|
||||
constructed at the voxel resolution of 0.35 mm. The original model
|
||||
has no holes in it, however, the decimated model has some holes that
|
||||
we detected with software, but not by inspection. Apparently, the
|
||||
decimation software introduced these holes.
|
||||
|
||||
For more information, consult the web pages of the Stanford Graphics
|
||||
Laboratory:
|
||||
|
||||
http://www-graphics.stanford.edu
|
||||
|
||||
|
|
@ -1 +0,0 @@
|
|||
http://thefree3dmodels.com/stuff/aircraft/spaceship/15-1-0-1415
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.4 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.4 KiB |
|
|
@ -1 +0,0 @@
|
|||
https://file-examples.com/index.php/sample-audio-files/sample-mp3-download/
|
||||
|
|
@ -65,9 +65,13 @@ struct SpotLight
|
|||
|
||||
int main()
|
||||
{
|
||||
std::filesystem::path resourceDir = "resources";
|
||||
if (!std::filesystem::is_directory(resourceDir) && std::filesystem::is_directory(".." / resourceDir))
|
||||
resourceDir = ".." / resourceDir;
|
||||
std::filesystem::path resourceDir = "assets/examples";
|
||||
if (!std::filesystem::is_directory(resourceDir) && std::filesystem::is_directory("../.." / resourceDir))
|
||||
resourceDir = "../.." / resourceDir;
|
||||
|
||||
std::filesystem::path shaderDir = "assets/shaders";
|
||||
if (!std::filesystem::is_directory(shaderDir) && std::filesystem::is_directory("../.." / shaderDir))
|
||||
shaderDir = "../.." / shaderDir;
|
||||
|
||||
Nz::Renderer::Config rendererConfig;
|
||||
std::cout << "Run using Vulkan? (y/n)" << std::endl;
|
||||
|
|
@ -154,7 +158,7 @@ int main()
|
|||
skyboxPipelineInfo.faceCulling = true;
|
||||
skyboxPipelineInfo.cullingSide = Nz::FaceSide::Front;
|
||||
skyboxPipelineInfo.pipelineLayout = skyboxPipelineLayout;
|
||||
skyboxPipelineInfo.shaderModules.push_back(device->InstantiateShaderModule(nzsl::ShaderStageType::Fragment | nzsl::ShaderStageType::Vertex, Nz::ShaderLanguage::NazaraShader, resourceDir / "skybox.nzsl", states));
|
||||
skyboxPipelineInfo.shaderModules.push_back(device->InstantiateShaderModule(nzsl::ShaderStageType::Fragment | nzsl::ShaderStageType::Vertex, Nz::ShaderLanguage::NazaraShader, shaderDir / "skybox.nzsl", states));
|
||||
skyboxPipelineInfo.vertexBuffers.push_back({
|
||||
0,
|
||||
meshPrimitiveParams.vertexDeclaration
|
||||
|
|
@ -187,8 +191,8 @@ int main()
|
|||
|
||||
auto customSettings = Nz::BasicMaterial::GetSettings()->GetBuilderData();
|
||||
customSettings.shaders.clear();
|
||||
customSettings.shaders.emplace_back(std::make_shared<Nz::UberShader>(nzsl::ShaderStageType::Fragment, nzsl::ParseFromFile(resourceDir / "deferred_frag.nzsl")));
|
||||
customSettings.shaders.emplace_back(std::make_shared<Nz::UberShader>(nzsl::ShaderStageType::Vertex, nzsl::ParseFromFile(resourceDir / "deferred_vert.nzsl")));
|
||||
customSettings.shaders.emplace_back(std::make_shared<Nz::UberShader>(nzsl::ShaderStageType::Fragment, nzsl::ParseFromFile(shaderDir / "deferred_frag.nzsl")));
|
||||
customSettings.shaders.emplace_back(std::make_shared<Nz::UberShader>(nzsl::ShaderStageType::Vertex, nzsl::ParseFromFile(shaderDir / "deferred_vert.nzsl")));
|
||||
|
||||
auto customMatSettings = std::make_shared<Nz::MaterialSettings>(std::move(customSettings));
|
||||
|
||||
|
|
@ -385,7 +389,7 @@ int main()
|
|||
fullscreenVertexDeclaration
|
||||
});
|
||||
|
||||
fullscreenPipelineInfoViewer.shaderModules.push_back(device->InstantiateShaderModule(nzsl::ShaderStageType::Fragment | nzsl::ShaderStageType::Vertex, Nz::ShaderLanguage::NazaraShader, resourceDir / "bloom_bright.nzsl", states));
|
||||
fullscreenPipelineInfoViewer.shaderModules.push_back(device->InstantiateShaderModule(nzsl::ShaderStageType::Fragment | nzsl::ShaderStageType::Vertex, Nz::ShaderLanguage::NazaraShader, shaderDir / "bloom_bright.nzsl", states));
|
||||
|
||||
std::shared_ptr<Nz::ShaderBinding> bloomBrightShaderBinding;
|
||||
|
||||
|
|
@ -409,7 +413,7 @@ int main()
|
|||
std::size_t gaussianBlurDataSize = gaussianBlurDataOffsets.AddField(nzsl::StructFieldType::Float1);
|
||||
|
||||
gaussianBlurPipelineInfo.shaderModules.clear();
|
||||
gaussianBlurPipelineInfo.shaderModules.push_back(device->InstantiateShaderModule(nzsl::ShaderStageType::Fragment | nzsl::ShaderStageType::Vertex, Nz::ShaderLanguage::NazaraShader, resourceDir / "gaussian_blur.nzsl", states));
|
||||
gaussianBlurPipelineInfo.shaderModules.push_back(device->InstantiateShaderModule(nzsl::ShaderStageType::Fragment | nzsl::ShaderStageType::Vertex, Nz::ShaderLanguage::NazaraShader, shaderDir / "gaussian_blur.nzsl", states));
|
||||
|
||||
std::shared_ptr<Nz::RenderPipeline> gaussianBlurPipeline = device->InstantiateRenderPipeline(gaussianBlurPipelineInfo);
|
||||
std::vector<std::shared_ptr<Nz::ShaderBinding>> gaussianBlurShaderBinding(BloomSubdivisionCount * 2);
|
||||
|
|
@ -439,7 +443,7 @@ int main()
|
|||
std::shared_ptr<Nz::ShaderBinding> toneMappingShaderBinding;
|
||||
|
||||
fullscreenPipelineInfoViewer.shaderModules.clear();
|
||||
fullscreenPipelineInfoViewer.shaderModules.push_back(device->InstantiateShaderModule(nzsl::ShaderStageType::Fragment | nzsl::ShaderStageType::Vertex, Nz::ShaderLanguage::NazaraShader, resourceDir / "tone_mapping.nzsl", states));
|
||||
fullscreenPipelineInfoViewer.shaderModules.push_back(device->InstantiateShaderModule(nzsl::ShaderStageType::Fragment | nzsl::ShaderStageType::Vertex, Nz::ShaderLanguage::NazaraShader, shaderDir / "tone_mapping.nzsl", states));
|
||||
|
||||
std::shared_ptr<Nz::RenderPipeline> toneMappingPipeline = device->InstantiateRenderPipeline(fullscreenPipelineInfoViewer);
|
||||
|
||||
|
|
@ -478,7 +482,7 @@ int main()
|
|||
fullscreenVertexDeclaration
|
||||
});
|
||||
|
||||
bloomBlendPipelineInfo.shaderModules.push_back(device->InstantiateShaderModule(nzsl::ShaderStageType::Fragment | nzsl::ShaderStageType::Vertex, Nz::ShaderLanguage::NazaraShader, resourceDir / "bloom_final.nzsl", states));
|
||||
bloomBlendPipelineInfo.shaderModules.push_back(device->InstantiateShaderModule(nzsl::ShaderStageType::Fragment | nzsl::ShaderStageType::Vertex, Nz::ShaderLanguage::NazaraShader, shaderDir / "bloom_final.nzsl", states));
|
||||
|
||||
std::shared_ptr<Nz::RenderPipeline> bloomBlendPipeline = device->InstantiateRenderPipeline(bloomBlendPipelineInfo);
|
||||
|
||||
|
|
@ -502,7 +506,7 @@ int main()
|
|||
fullscreenVertexDeclaration
|
||||
});
|
||||
|
||||
fullscreenPipelineInfo.shaderModules.push_back(device->InstantiateShaderModule(nzsl::ShaderStageType::Fragment | nzsl::ShaderStageType::Vertex, Nz::ShaderLanguage::NazaraShader, resourceDir / "gamma.nzsl", states));
|
||||
fullscreenPipelineInfo.shaderModules.push_back(device->InstantiateShaderModule(nzsl::ShaderStageType::Fragment | nzsl::ShaderStageType::Vertex, Nz::ShaderLanguage::NazaraShader, shaderDir / "gamma.nzsl", states));
|
||||
|
||||
// God rays
|
||||
|
||||
|
|
@ -536,7 +540,7 @@ int main()
|
|||
fullscreenVertexDeclaration
|
||||
});
|
||||
|
||||
godraysPipelineInfo.shaderModules.push_back(device->InstantiateShaderModule(nzsl::ShaderStageType::Fragment | nzsl::ShaderStageType::Vertex, Nz::ShaderLanguage::NazaraShader, resourceDir / "god_rays.nzsl", states));
|
||||
godraysPipelineInfo.shaderModules.push_back(device->InstantiateShaderModule(nzsl::ShaderStageType::Fragment | nzsl::ShaderStageType::Vertex, Nz::ShaderLanguage::NazaraShader, shaderDir / "god_rays.nzsl", states));
|
||||
|
||||
std::shared_ptr<Nz::RenderPipeline> godraysPipeline = device->InstantiateRenderPipeline(godraysPipelineInfo);
|
||||
|
||||
|
|
@ -591,7 +595,7 @@ int main()
|
|||
lightingPipelineInfo.stencilBack.depthFail = Nz::StencilOperation::Zero;
|
||||
lightingPipelineInfo.stencilBack.pass = Nz::StencilOperation::Zero;
|
||||
|
||||
lightingPipelineInfo.shaderModules.push_back(device->InstantiateShaderModule(nzsl::ShaderStageType::Fragment | nzsl::ShaderStageType::Vertex, Nz::ShaderLanguage::NazaraShader, resourceDir / "lighting.nzsl", states));
|
||||
lightingPipelineInfo.shaderModules.push_back(device->InstantiateShaderModule(nzsl::ShaderStageType::Fragment | nzsl::ShaderStageType::Vertex, Nz::ShaderLanguage::NazaraShader, shaderDir / "lighting.nzsl", states));
|
||||
|
||||
std::shared_ptr<Nz::RenderPipeline> lightingPipeline = device->InstantiateRenderPipeline(lightingPipelineInfo);
|
||||
|
||||
|
|
@ -613,7 +617,7 @@ int main()
|
|||
stencilPipelineInfo.stencilBack.compare = Nz::RendererComparison::Always;
|
||||
stencilPipelineInfo.stencilBack.depthFail = Nz::StencilOperation::Invert;
|
||||
|
||||
stencilPipelineInfo.shaderModules.push_back(device->InstantiateShaderModule(nzsl::ShaderStageType::Vertex, Nz::ShaderLanguage::NazaraShader, resourceDir / "lighting.nzsl", states));
|
||||
stencilPipelineInfo.shaderModules.push_back(device->InstantiateShaderModule(nzsl::ShaderStageType::Vertex, Nz::ShaderLanguage::NazaraShader, shaderDir / "lighting.nzsl", states));
|
||||
|
||||
std::shared_ptr<Nz::RenderPipeline> stencilPipeline = device->InstantiateRenderPipeline(stencilPipelineInfo);
|
||||
|
||||
|
|
|
|||
|
|
@ -20,14 +20,14 @@
|
|||
|
||||
int main()
|
||||
{
|
||||
std::filesystem::path resourceDir = "resources";
|
||||
if (!std::filesystem::is_directory(resourceDir) && std::filesystem::is_directory(".." / resourceDir))
|
||||
resourceDir = ".." / resourceDir;
|
||||
std::filesystem::path resourceDir = "assets/examples";
|
||||
if (!std::filesystem::is_directory(resourceDir) && std::filesystem::is_directory("../.." / resourceDir))
|
||||
resourceDir = "../.." / resourceDir;
|
||||
|
||||
Nz::Modules<Nz::Audio> audio;
|
||||
|
||||
Nz::Sound sound;
|
||||
if (!sound.LoadFromFile(resourceDir / "siren.wav"))
|
||||
if (!sound.LoadFromFile(resourceDir / "Audio/siren.wav"))
|
||||
{
|
||||
std::cout << "Failed to load sound" << std::endl;
|
||||
std::getchar();
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@
|
|||
|
||||
int main()
|
||||
{
|
||||
std::filesystem::path resourceDir = "resources";
|
||||
if (!std::filesystem::is_directory(resourceDir) && std::filesystem::is_directory(".." / resourceDir))
|
||||
resourceDir = ".." / resourceDir;
|
||||
std::filesystem::path resourceDir = "assets/examples";
|
||||
if (!std::filesystem::is_directory(resourceDir) && std::filesystem::is_directory("../.." / resourceDir))
|
||||
resourceDir = "../.." / resourceDir;
|
||||
|
||||
Nz::Renderer::Config rendererConfig;
|
||||
std::cout << "Run using Vulkan? (y/n)" << std::endl;
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@ NAZARA_REQUEST_DEDICATED_GPU()
|
|||
|
||||
int main()
|
||||
{
|
||||
std::filesystem::path resourceDir = "resources";
|
||||
if (!std::filesystem::is_directory(resourceDir) && std::filesystem::is_directory(".." / resourceDir))
|
||||
resourceDir = ".." / resourceDir;
|
||||
std::filesystem::path resourceDir = "assets/examples";
|
||||
if (!std::filesystem::is_directory(resourceDir) && std::filesystem::is_directory("../.." / resourceDir))
|
||||
resourceDir = "../.." / resourceDir;
|
||||
|
||||
Nz::Renderer::Config rendererConfig;
|
||||
std::cout << "Run using Vulkan? (y/n)" << std::endl;
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ NAZARA_REQUEST_DEDICATED_GPU()
|
|||
|
||||
int main()
|
||||
{
|
||||
std::filesystem::path resourceDir = "resources";
|
||||
if (!std::filesystem::is_directory(resourceDir) && std::filesystem::is_directory(".." / resourceDir))
|
||||
resourceDir = ".." / resourceDir;
|
||||
std::filesystem::path resourceDir = "assets/examples";
|
||||
if (!std::filesystem::is_directory(resourceDir) && std::filesystem::is_directory("../.." / resourceDir))
|
||||
resourceDir = "../.." / resourceDir;
|
||||
|
||||
Nz::Renderer::Config rendererConfig;
|
||||
std::cout << "Run using Vulkan? (y/n)" << std::endl;
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@
|
|||
|
||||
int main()
|
||||
{
|
||||
std::filesystem::path resourceDir = "resources";
|
||||
if (!std::filesystem::is_directory(resourceDir) && std::filesystem::is_directory(".." / resourceDir))
|
||||
resourceDir = ".." / resourceDir;
|
||||
std::filesystem::path resourceDir = "assets/examples";
|
||||
if (!std::filesystem::is_directory(resourceDir) && std::filesystem::is_directory("../.." / resourceDir))
|
||||
resourceDir = "../.." / resourceDir;
|
||||
|
||||
Nz::Modules<Nz::Audio> audio;
|
||||
|
||||
|
|
@ -24,7 +24,7 @@ int main()
|
|||
streamParams.forceMono = false;
|
||||
|
||||
Nz::Music music;
|
||||
if (!music.OpenFromFile(resourceDir / "file_example_MP3_700KB.mp3", streamParams))
|
||||
if (!music.OpenFromFile(resourceDir / "Audio/file_example_MP3_700KB.mp3", streamParams))
|
||||
{
|
||||
std::cout << "Failed to load sound" << std::endl;
|
||||
std::getchar();
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@ NAZARA_REQUEST_DEDICATED_GPU()
|
|||
|
||||
int main()
|
||||
{
|
||||
std::filesystem::path resourceDir = "resources";
|
||||
if (!std::filesystem::is_directory(resourceDir) && std::filesystem::is_directory(".." / resourceDir))
|
||||
resourceDir = ".." / resourceDir;
|
||||
std::filesystem::path resourceDir = "assets/examples";
|
||||
if (!std::filesystem::is_directory(resourceDir) && std::filesystem::is_directory("../.." / resourceDir))
|
||||
resourceDir = "../.." / resourceDir;
|
||||
|
||||
Nz::Renderer::Config rendererConfig;
|
||||
std::cout << "Run using Vulkan? (y/n)" << std::endl;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
std::filesystem::path GetResourceDir();
|
||||
std::filesystem::path GetAssetDir();
|
||||
|
||||
SCENARIO("Music", "[AUDIO][MUSIC]")
|
||||
{
|
||||
|
|
@ -14,7 +14,7 @@ SCENARIO("Music", "[AUDIO][MUSIC]")
|
|||
|
||||
WHEN("We load our music")
|
||||
{
|
||||
REQUIRE(music.OpenFromFile(GetResourceDir() / "Engine/Audio/The_Brabanconne.ogg"));
|
||||
REQUIRE(music.OpenFromFile(GetAssetDir() / "Audio/The_Brabanconne.ogg"));
|
||||
|
||||
THEN("We can ask the informations of the file")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include <Nazara/Audio/SoundBuffer.hpp>
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
std::filesystem::path GetResourceDir();
|
||||
std::filesystem::path GetAssetDir();
|
||||
|
||||
SCENARIO("SoundBuffer", "[AUDIO][SOUNDBUFFER]")
|
||||
{
|
||||
|
|
@ -9,7 +9,7 @@ SCENARIO("SoundBuffer", "[AUDIO][SOUNDBUFFER]")
|
|||
{
|
||||
WHEN("We load a .flac file")
|
||||
{
|
||||
std::shared_ptr<Nz::SoundBuffer> soundBuffer = Nz::SoundBuffer::LoadFromFile(GetResourceDir() / "Engine/Audio/Cat.flac");
|
||||
std::shared_ptr<Nz::SoundBuffer> soundBuffer = Nz::SoundBuffer::LoadFromFile(GetAssetDir() / "Audio/Cat.flac");
|
||||
REQUIRE(soundBuffer);
|
||||
|
||||
THEN("We can ask the informations of the file")
|
||||
|
|
@ -22,7 +22,7 @@ SCENARIO("SoundBuffer", "[AUDIO][SOUNDBUFFER]")
|
|||
|
||||
WHEN("We load a .mp3 file")
|
||||
{
|
||||
std::shared_ptr<Nz::SoundBuffer> soundBuffer = Nz::SoundBuffer::LoadFromFile(GetResourceDir() / "file_example_MP3_700KB.mp3");
|
||||
std::shared_ptr<Nz::SoundBuffer> soundBuffer = Nz::SoundBuffer::LoadFromFile(GetAssetDir() / "Audio/file_example_MP3_700KB.mp3");
|
||||
REQUIRE(soundBuffer);
|
||||
|
||||
THEN("We can ask the informations of the file")
|
||||
|
|
@ -35,7 +35,7 @@ SCENARIO("SoundBuffer", "[AUDIO][SOUNDBUFFER]")
|
|||
|
||||
WHEN("We load a .ogg file")
|
||||
{
|
||||
std::shared_ptr<Nz::SoundBuffer> soundBuffer = Nz::SoundBuffer::LoadFromFile(GetResourceDir() / "Engine/Audio/The_Brabanconne.ogg");
|
||||
std::shared_ptr<Nz::SoundBuffer> soundBuffer = Nz::SoundBuffer::LoadFromFile(GetAssetDir() / "Audio/The_Brabanconne.ogg");
|
||||
REQUIRE(soundBuffer);
|
||||
|
||||
THEN("We can ask the informations of the file")
|
||||
|
|
@ -48,14 +48,14 @@ SCENARIO("SoundBuffer", "[AUDIO][SOUNDBUFFER]")
|
|||
|
||||
WHEN("We load a .wav file")
|
||||
{
|
||||
std::shared_ptr<Nz::SoundBuffer> soundBuffer = Nz::SoundBuffer::LoadFromFile(GetResourceDir() / "explosion.wav");
|
||||
std::shared_ptr<Nz::SoundBuffer> soundBuffer = Nz::SoundBuffer::LoadFromFile(GetAssetDir() / "Audio/explosion1.wav");
|
||||
REQUIRE(soundBuffer);
|
||||
|
||||
THEN("We can ask the informations of the file")
|
||||
{
|
||||
CHECK(soundBuffer->GetDuration() == 2064);
|
||||
CHECK(soundBuffer->GetFormat() == Nz::AudioFormat::I16_Stereo);
|
||||
CHECK(soundBuffer->GetSampleRate() == 48000);
|
||||
CHECK(soundBuffer->GetDuration() == 2490);
|
||||
CHECK(soundBuffer->GetFormat() == Nz::AudioFormat::I16_Mono);
|
||||
CHECK(soundBuffer->GetSampleRate() == 44100);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include <Nazara/Audio/Sound.hpp>
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
std::filesystem::path GetResourceDir();
|
||||
std::filesystem::path GetAssetDir();
|
||||
|
||||
SCENARIO("SoundEmitter", "[AUDIO][SOUNDEMITTER]")
|
||||
{
|
||||
|
|
@ -11,7 +11,7 @@ SCENARIO("SoundEmitter", "[AUDIO][SOUNDEMITTER]")
|
|||
|
||||
WHEN("We load our sound")
|
||||
{
|
||||
REQUIRE(sound.LoadFromFile(GetResourceDir() / "Engine/Audio/Cat.flac"));
|
||||
REQUIRE(sound.LoadFromFile(GetAssetDir() / "Audio/Cat.flac"));
|
||||
|
||||
THEN("We can ask information about position and velocity")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include <Nazara/Audio/SoundStream.hpp>
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
std::filesystem::path GetResourceDir();
|
||||
std::filesystem::path GetAssetDir();
|
||||
|
||||
SCENARIO("SoundStream", "[AUDIO][SoundStream]")
|
||||
{
|
||||
|
|
@ -9,7 +9,7 @@ SCENARIO("SoundStream", "[AUDIO][SoundStream]")
|
|||
{
|
||||
WHEN("We load a .flac file")
|
||||
{
|
||||
std::shared_ptr<Nz::SoundStream> soundStream = Nz::SoundStream::OpenFromFile(GetResourceDir() / "Engine/Audio/Cat.flac");
|
||||
std::shared_ptr<Nz::SoundStream> soundStream = Nz::SoundStream::OpenFromFile(GetAssetDir() / "Audio/Cat.flac");
|
||||
REQUIRE(soundStream);
|
||||
|
||||
THEN("We can ask the informations of the file")
|
||||
|
|
@ -22,7 +22,7 @@ SCENARIO("SoundStream", "[AUDIO][SoundStream]")
|
|||
|
||||
WHEN("We load a .mp3 file")
|
||||
{
|
||||
std::shared_ptr<Nz::SoundStream> soundStream = Nz::SoundStream::OpenFromFile(GetResourceDir() / "file_example_MP3_700KB.mp3");
|
||||
std::shared_ptr<Nz::SoundStream> soundStream = Nz::SoundStream::OpenFromFile(GetAssetDir() / "Audio/file_example_MP3_700KB.mp3");
|
||||
REQUIRE(soundStream);
|
||||
|
||||
THEN("We can ask the informations of the file")
|
||||
|
|
@ -35,7 +35,7 @@ SCENARIO("SoundStream", "[AUDIO][SoundStream]")
|
|||
|
||||
WHEN("We load a .ogg file")
|
||||
{
|
||||
std::shared_ptr<Nz::SoundStream> soundStream = Nz::SoundStream::OpenFromFile(GetResourceDir() / "Engine/Audio/The_Brabanconne.ogg");
|
||||
std::shared_ptr<Nz::SoundStream> soundStream = Nz::SoundStream::OpenFromFile(GetAssetDir() / "Audio/The_Brabanconne.ogg");
|
||||
REQUIRE(soundStream);
|
||||
|
||||
THEN("We can ask the informations of the file")
|
||||
|
|
@ -48,14 +48,14 @@ SCENARIO("SoundStream", "[AUDIO][SoundStream]")
|
|||
|
||||
WHEN("We load a .wav file")
|
||||
{
|
||||
std::shared_ptr<Nz::SoundStream> soundStream = Nz::SoundStream::OpenFromFile(GetResourceDir() / "explosion.wav");
|
||||
std::shared_ptr<Nz::SoundStream> soundStream = Nz::SoundStream::OpenFromFile(GetAssetDir() / "Audio/explosion1.wav");
|
||||
REQUIRE(soundStream);
|
||||
|
||||
THEN("We can ask the informations of the file")
|
||||
{
|
||||
CHECK(soundStream->GetDuration() == 2064);
|
||||
CHECK(soundStream->GetFormat() == Nz::AudioFormat::I16_Stereo);
|
||||
CHECK(soundStream->GetSampleRate() == 48000);
|
||||
CHECK(soundStream->GetDuration() == 2490);
|
||||
CHECK(soundStream->GetFormat() == Nz::AudioFormat::I16_Mono);
|
||||
CHECK(soundStream->GetSampleRate() == 44100);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
std::filesystem::path GetResourceDir();
|
||||
std::filesystem::path GetAssetDir();
|
||||
|
||||
SCENARIO("Sound", "[AUDIO][SOUND]")
|
||||
{
|
||||
|
|
@ -14,7 +14,7 @@ SCENARIO("Sound", "[AUDIO][SOUND]")
|
|||
|
||||
WHEN("We load our sound")
|
||||
{
|
||||
REQUIRE(sound.LoadFromFile(GetResourceDir() / "Engine/Audio/Cat.flac"));
|
||||
REQUIRE(sound.LoadFromFile(GetAssetDir() / "Audio/Cat.flac"));
|
||||
|
||||
THEN("We can ask the informations of the file")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@
|
|||
#include <filesystem>
|
||||
#include <variant>
|
||||
|
||||
std::filesystem::path GetResourceDir();
|
||||
std::filesystem::path GetAssetDir();
|
||||
|
||||
TEST_CASE("ComputeHash", "[CORE][ALGORITHM]")
|
||||
{
|
||||
std::filesystem::path testFilePath = GetResourceDir() / "Logo.png";
|
||||
std::filesystem::path testFilePath = GetAssetDir() / "Logo.png";
|
||||
|
||||
struct Test
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include <Nazara/Core/File.hpp>
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
std::filesystem::path GetResourceDir();
|
||||
std::filesystem::path GetAssetDir();
|
||||
|
||||
SCENARIO("File", "[CORE][FILE]")
|
||||
{
|
||||
|
|
@ -65,9 +65,9 @@ SCENARIO("File", "[CORE][FILE]")
|
|||
|
||||
GIVEN("The test file")
|
||||
{
|
||||
REQUIRE(std::filesystem::exists(GetResourceDir() / "Engine/Core/FileTest.txt"));
|
||||
REQUIRE(std::filesystem::exists(GetAssetDir() / "Core/FileTest.txt"));
|
||||
|
||||
Nz::File fileTest(GetResourceDir() / "Engine/Core/FileTest.txt", Nz::OpenMode::ReadOnly | Nz::OpenMode::Text);
|
||||
Nz::File fileTest(GetAssetDir() / "Core/FileTest.txt", Nz::OpenMode::ReadOnly | Nz::OpenMode::Text);
|
||||
|
||||
WHEN("We read the first line of the file")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#include <catch2/catch.hpp>
|
||||
#include <random>
|
||||
|
||||
std::filesystem::path GetResourceDir();
|
||||
std::filesystem::path GetAssetDir();
|
||||
|
||||
TEST_CASE("VirtualDirectory", "[Core][VirtualDirectory]")
|
||||
{
|
||||
|
|
@ -187,7 +187,7 @@ TEST_CASE("VirtualDirectory", "[Core][VirtualDirectory]")
|
|||
|
||||
SECTION("Accessing filesystem using a VirtualDirectory")
|
||||
{
|
||||
std::shared_ptr<Nz::VirtualDirectory> resourceDir = std::make_shared<Nz::VirtualDirectory>(GetResourceDir());
|
||||
std::shared_ptr<Nz::VirtualDirectory> resourceDir = std::make_shared<Nz::VirtualDirectory>(GetAssetDir());
|
||||
|
||||
WHEN("Iterating, it's not empty")
|
||||
{
|
||||
|
|
@ -242,18 +242,18 @@ TEST_CASE("VirtualDirectory", "[Core][VirtualDirectory]")
|
|||
{
|
||||
CHECK(CheckFileHash(resourceDir, "Logo.png", "5C4B9387327C039A6CE9ED51983D6C2ADA9F9DD01D024C2D5D588237ADFC7423"));
|
||||
CHECK(CheckFileHash(resourceDir, "./Logo.png", "5C4B9387327C039A6CE9ED51983D6C2ADA9F9DD01D024C2D5D588237ADFC7423"));
|
||||
CHECK(CheckFileHash(resourceDir, "Engine/Audio/The_Brabanconne.ogg", "E07706E0BEEC7770CDE36008826743AF9EEE5C80CA0BD83C37771CBC8B52E738"));
|
||||
CHECK(CheckFileHash(resourceDir, "Engine/Audio/./The_Brabanconne.ogg", "E07706E0BEEC7770CDE36008826743AF9EEE5C80CA0BD83C37771CBC8B52E738"));
|
||||
CHECK(CheckFileHash(resourceDir, "Audio/The_Brabanconne.ogg", "E07706E0BEEC7770CDE36008826743AF9EEE5C80CA0BD83C37771CBC8B52E738"));
|
||||
CHECK(CheckFileHash(resourceDir, "Audio/./The_Brabanconne.ogg", "E07706E0BEEC7770CDE36008826743AF9EEE5C80CA0BD83C37771CBC8B52E738"));
|
||||
CHECK_FALSE(CheckFileHash(resourceDir, "The_Brabanconne.ogg", "E07706E0BEEC7770CDE36008826743AF9EEE5C80CA0BD83C37771CBC8B52E738"));
|
||||
CHECK_FALSE(CheckFileHash(resourceDir, "Engine/The_Brabanconne.ogg", "E07706E0BEEC7770CDE36008826743AF9EEE5C80CA0BD83C37771CBC8B52E738"));
|
||||
CHECK_FALSE(CheckFileHash(resourceDir, "Engine/Audio/../The_Brabanconne.ogg", "E07706E0BEEC7770CDE36008826743AF9EEE5C80CA0BD83C37771CBC8B52E738"));
|
||||
CHECK_FALSE(CheckFileHash(resourceDir, "The_Brabanconne.ogg", "E07706E0BEEC7770CDE36008826743AF9EEE5C80CA0BD83C37771CBC8B52E738"));
|
||||
CHECK_FALSE(CheckFileHash(resourceDir, "Audio/../The_Brabanconne.ogg", "E07706E0BEEC7770CDE36008826743AF9EEE5C80CA0BD83C37771CBC8B52E738"));
|
||||
|
||||
// We can't escape the virtual directory
|
||||
CHECK(CheckFileHash(resourceDir, "../Logo.png", "5C4B9387327C039A6CE9ED51983D6C2ADA9F9DD01D024C2D5D588237ADFC7423"));
|
||||
CHECK(CheckFileHash(resourceDir, "../../Logo.png", "5C4B9387327C039A6CE9ED51983D6C2ADA9F9DD01D024C2D5D588237ADFC7423"));
|
||||
CHECK(CheckFileHash(resourceDir, "Engine/../Engine/Audio/The_Brabanconne.ogg", "E07706E0BEEC7770CDE36008826743AF9EEE5C80CA0BD83C37771CBC8B52E738"));
|
||||
CHECK(CheckFileHash(resourceDir, "../Engine/./Audio/The_Brabanconne.ogg", "E07706E0BEEC7770CDE36008826743AF9EEE5C80CA0BD83C37771CBC8B52E738"));
|
||||
CHECK_FALSE(CheckFileHash(resourceDir, "../Engine/Engine/Audio/The_Brabanconne.ogg", "E07706E0BEEC7770CDE36008826743AF9EEE5C80CA0BD83C37771CBC8B52E738"));
|
||||
CHECK(CheckFileHash(resourceDir, "../../Audio/The_Brabanconne.ogg", "E07706E0BEEC7770CDE36008826743AF9EEE5C80CA0BD83C37771CBC8B52E738"));
|
||||
CHECK(CheckFileHash(resourceDir, ".././Audio/The_Brabanconne.ogg", "E07706E0BEEC7770CDE36008826743AF9EEE5C80CA0BD83C37771CBC8B52E738"));
|
||||
CHECK_FALSE(CheckFileHash(resourceDir, "../Tests/Audio/The_Brabanconne.ogg", "E07706E0BEEC7770CDE36008826743AF9EEE5C80CA0BD83C37771CBC8B52E738"));
|
||||
|
||||
auto CheckOurselves = [&](const auto& entry)
|
||||
{
|
||||
|
|
@ -266,37 +266,38 @@ TEST_CASE("VirtualDirectory", "[Core][VirtualDirectory]")
|
|||
CHECK(resourceDir->GetEntry("../..", CheckOurselves));
|
||||
CHECK(resourceDir->GetEntry("./..", CheckOurselves));
|
||||
CHECK(resourceDir->GetEntry("./..", CheckOurselves));
|
||||
CHECK(resourceDir->GetEntry("Engine/../..", CheckOurselves));
|
||||
CHECK(resourceDir->GetEntry("Engine/../Engine/Audio/../../..", CheckOurselves));
|
||||
CHECK(resourceDir->GetEntry("Audio/../..", CheckOurselves));
|
||||
CHECK(resourceDir->GetEntry("Core/../Audio/../../..", CheckOurselves));
|
||||
}
|
||||
AND_THEN("Overriding the physical file with another one")
|
||||
{
|
||||
resourceDir->StoreFile("Logo.png", GetResourceDir() / "ambience.ogg");
|
||||
CHECK(CheckFileHash(resourceDir, "ambience.ogg", "49C486F44E43F023D54C9F375D902C21375DDB2748D3FA1863C9581D30E17F94"));
|
||||
resourceDir->StoreFile("Logo.png", GetAssetDir() / "Audio/ambience.ogg");
|
||||
|
||||
CHECK(CheckFileHash(resourceDir, "Audio/ambience.ogg", "49C486F44E43F023D54C9F375D902C21375DDB2748D3FA1863C9581D30E17F94"));
|
||||
CHECK(CheckFileHash(resourceDir, "Logo.png", "49C486F44E43F023D54C9F375D902C21375DDB2748D3FA1863C9581D30E17F94"));
|
||||
CHECK(CheckFileContentHash(resourceDir, "ambience.ogg", "49C486F44E43F023D54C9F375D902C21375DDB2748D3FA1863C9581D30E17F94"));
|
||||
CHECK(CheckFileContentHash(resourceDir, "Audio/ambience.ogg", "49C486F44E43F023D54C9F375D902C21375DDB2748D3FA1863C9581D30E17F94"));
|
||||
CHECK(CheckFileContentHash(resourceDir, "Logo.png", "49C486F44E43F023D54C9F375D902C21375DDB2748D3FA1863C9581D30E17F94"));
|
||||
}
|
||||
|
||||
WHEN("Testing uproot escape")
|
||||
{
|
||||
std::shared_ptr<Nz::VirtualDirectory> engineDir = std::make_shared<Nz::VirtualDirectory>(GetResourceDir() / "Engine");
|
||||
std::shared_ptr<Nz::VirtualDirectory> engineDir = std::make_shared<Nz::VirtualDirectory>(GetAssetDir() / "Audio");
|
||||
|
||||
CHECK_FALSE(engineDir->IsUprootAllowed());
|
||||
|
||||
// We can't escape the virtual directory
|
||||
CHECK_FALSE(engineDir->Exists("../Logo.png"));
|
||||
CHECK_FALSE(engineDir->Exists("../../Logo.png"));
|
||||
CHECK_FALSE(engineDir->Exists("../Engine/Audio/Audio/The_Brabanconne.ogg"));
|
||||
CHECK(CheckFileHash(engineDir, "Audio/../../Audio/The_Brabanconne.ogg", "E07706E0BEEC7770CDE36008826743AF9EEE5C80CA0BD83C37771CBC8B52E738"));
|
||||
CHECK(CheckFileHash(engineDir, "../Audio/./The_Brabanconne.ogg", "E07706E0BEEC7770CDE36008826743AF9EEE5C80CA0BD83C37771CBC8B52E738"));
|
||||
CHECK_FALSE(engineDir->Exists("../Tests/Audio/Audio/The_Brabanconne.ogg"));
|
||||
CHECK(CheckFileHash(engineDir, "../../The_Brabanconne.ogg", "E07706E0BEEC7770CDE36008826743AF9EEE5C80CA0BD83C37771CBC8B52E738"));
|
||||
CHECK(CheckFileHash(engineDir, ".././The_Brabanconne.ogg", "E07706E0BEEC7770CDE36008826743AF9EEE5C80CA0BD83C37771CBC8B52E738"));
|
||||
|
||||
engineDir->AllowUproot(true);
|
||||
CHECK(engineDir->IsUprootAllowed());
|
||||
|
||||
// Now we're able to access the resource folder beneath
|
||||
// Now we're able to access the asset folder beneath
|
||||
CHECK(CheckFileHash(engineDir, "../Logo.png", "5C4B9387327C039A6CE9ED51983D6C2ADA9F9DD01D024C2D5D588237ADFC7423"));
|
||||
CHECK(CheckFileHash(engineDir, "../Engine/Audio/The_Brabanconne.ogg", "E07706E0BEEC7770CDE36008826743AF9EEE5C80CA0BD83C37771CBC8B52E738"));
|
||||
CHECK(CheckFileHash(engineDir, "../Audio/The_Brabanconne.ogg", "E07706E0BEEC7770CDE36008826743AF9EEE5C80CA0BD83C37771CBC8B52E738"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include <array>
|
||||
#include <filesystem>
|
||||
|
||||
std::filesystem::path GetResourceDir();
|
||||
std::filesystem::path GetAssetDir();
|
||||
|
||||
SCENARIO("Fonts", "[Utility][Font]")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include <catch2/catch.hpp>
|
||||
#include <filesystem>
|
||||
|
||||
std::filesystem::path GetResourceDir();
|
||||
std::filesystem::path GetAssetDir();
|
||||
|
||||
SCENARIO("Images", "[Utility][Image]")
|
||||
{
|
||||
|
|
@ -10,7 +10,7 @@ SCENARIO("Images", "[Utility][Image]")
|
|||
{
|
||||
GIVEN("Logo.png")
|
||||
{
|
||||
std::shared_ptr<Nz::Image> logo = Nz::Image::LoadFromFile(GetResourceDir() / "Logo.png");
|
||||
std::shared_ptr<Nz::Image> logo = Nz::Image::LoadFromFile(GetAssetDir() / "Logo.png");
|
||||
REQUIRE(logo);
|
||||
|
||||
CHECK(logo->GetWidth() == 765);
|
||||
|
|
@ -26,7 +26,7 @@ SCENARIO("Images", "[Utility][Image]")
|
|||
{
|
||||
GIVEN("stars-background.jpg")
|
||||
{
|
||||
std::shared_ptr<Nz::Image> background = Nz::Image::LoadFromFile(GetResourceDir() / "stars-background.jpg");
|
||||
std::shared_ptr<Nz::Image> background = Nz::Image::LoadFromFile(GetAssetDir() / "Utility/stars-background.jpg");
|
||||
REQUIRE(background);
|
||||
|
||||
CHECK(background->GetWidth() == 1920);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#include <catch2/catch.hpp>
|
||||
#include <filesystem>
|
||||
|
||||
std::filesystem::path GetResourceDir();
|
||||
std::filesystem::path GetAssetDir();
|
||||
|
||||
void CompareFrames(const Nz::ImageStream& gif, std::vector<Nz::UInt8>& frameData, const Nz::Image& referenceImage)
|
||||
{
|
||||
|
|
@ -26,7 +26,7 @@ SCENARIO("Streamed images", "[Utility][ImageStream]")
|
|||
Nz::UInt64 time;
|
||||
};
|
||||
|
||||
std::filesystem::path resourcePath = GetResourceDir();
|
||||
std::filesystem::path resourcePath = GetAssetDir();
|
||||
|
||||
WHEN("Loading GIF files")
|
||||
{
|
||||
|
|
@ -34,28 +34,28 @@ SCENARIO("Streamed images", "[Utility][ImageStream]")
|
|||
{
|
||||
std::array expectedFrames = {
|
||||
ExpectedFrame{
|
||||
Nz::Image::LoadFromFile(resourcePath / "Tests/GIF/canvas_bgnd/0.png"),
|
||||
Nz::Image::LoadFromFile(resourcePath / "Utility/GIF/canvas_bgnd/0.png"),
|
||||
0
|
||||
},
|
||||
ExpectedFrame{
|
||||
Nz::Image::LoadFromFile(resourcePath / "Tests/GIF/canvas_bgnd/1.png"),
|
||||
Nz::Image::LoadFromFile(resourcePath / "Utility/GIF/canvas_bgnd/1.png"),
|
||||
1000
|
||||
},
|
||||
ExpectedFrame{
|
||||
Nz::Image::LoadFromFile(resourcePath / "Tests/GIF/canvas_bgnd/2.png"),
|
||||
Nz::Image::LoadFromFile(resourcePath / "Utility/GIF/canvas_bgnd/2.png"),
|
||||
2000
|
||||
},
|
||||
ExpectedFrame{
|
||||
Nz::Image::LoadFromFile(resourcePath / "Tests/GIF/canvas_bgnd/3.png"),
|
||||
Nz::Image::LoadFromFile(resourcePath / "Utility/GIF/canvas_bgnd/3.png"),
|
||||
3000
|
||||
},
|
||||
ExpectedFrame{
|
||||
Nz::Image::LoadFromFile(resourcePath / "Tests/GIF/canvas_bgnd/4.png"),
|
||||
Nz::Image::LoadFromFile(resourcePath / "Utility/GIF/canvas_bgnd/4.png"),
|
||||
4000
|
||||
}
|
||||
};
|
||||
|
||||
std::shared_ptr<Nz::ImageStream> gif = Nz::ImageStream::OpenFromFile(resourcePath / "Tests/GIF/canvas_bgnd.gif");
|
||||
std::shared_ptr<Nz::ImageStream> gif = Nz::ImageStream::OpenFromFile(resourcePath / "Utility/GIF/canvas_bgnd.gif");
|
||||
REQUIRE(gif);
|
||||
|
||||
Nz::Vector2ui size = gif->GetSize();
|
||||
|
|
@ -100,28 +100,28 @@ SCENARIO("Streamed images", "[Utility][ImageStream]")
|
|||
{
|
||||
std::array expectedFrames = {
|
||||
ExpectedFrame{
|
||||
Nz::Image::LoadFromFile(resourcePath / "Tests/GIF/canvas_prev/0.png"),
|
||||
Nz::Image::LoadFromFile(resourcePath / "Utility/GIF/canvas_prev/0.png"),
|
||||
0
|
||||
},
|
||||
ExpectedFrame{
|
||||
Nz::Image::LoadFromFile(resourcePath / "Tests/GIF/canvas_prev/1.png"),
|
||||
Nz::Image::LoadFromFile(resourcePath / "Utility/GIF/canvas_prev/1.png"),
|
||||
100
|
||||
},
|
||||
ExpectedFrame{
|
||||
Nz::Image::LoadFromFile(resourcePath / "Tests/GIF/canvas_prev/2.png"),
|
||||
Nz::Image::LoadFromFile(resourcePath / "Utility/GIF/canvas_prev/2.png"),
|
||||
1100
|
||||
},
|
||||
ExpectedFrame{
|
||||
Nz::Image::LoadFromFile(resourcePath / "Tests/GIF/canvas_prev/3.png"),
|
||||
Nz::Image::LoadFromFile(resourcePath / "Utility/GIF/canvas_prev/3.png"),
|
||||
2100
|
||||
},
|
||||
ExpectedFrame{
|
||||
Nz::Image::LoadFromFile(resourcePath / "Tests/GIF/canvas_prev/4.png"),
|
||||
Nz::Image::LoadFromFile(resourcePath / "Utility/GIF/canvas_prev/4.png"),
|
||||
3100
|
||||
}
|
||||
};
|
||||
|
||||
std::shared_ptr<Nz::ImageStream> gif = Nz::ImageStream::OpenFromFile(resourcePath / "Tests/GIF/canvas_prev.gif");
|
||||
std::shared_ptr<Nz::ImageStream> gif = Nz::ImageStream::OpenFromFile(resourcePath / "Utility/GIF/canvas_prev.gif");
|
||||
REQUIRE(gif);
|
||||
|
||||
Nz::Vector2ui size = gif->GetSize();
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include <catch2/catch.hpp>
|
||||
#include <filesystem>
|
||||
|
||||
std::filesystem::path GetResourceDir();
|
||||
std::filesystem::path GetAssetDir();
|
||||
|
||||
SCENARIO("Meshes", "[Utility][Mesh]")
|
||||
{
|
||||
|
|
@ -10,7 +10,7 @@ SCENARIO("Meshes", "[Utility][Mesh]")
|
|||
{
|
||||
GIVEN("Spaceship/spaceship.obj")
|
||||
{
|
||||
std::shared_ptr<Nz::Mesh> spaceship = Nz::Mesh::LoadFromFile(GetResourceDir() / "Spaceship/spaceship.obj");
|
||||
std::shared_ptr<Nz::Mesh> spaceship = Nz::Mesh::LoadFromFile(GetAssetDir() / "Utility/Spaceship/spaceship.obj");
|
||||
REQUIRE(spaceship);
|
||||
|
||||
CHECK(!spaceship->IsAnimable());
|
||||
|
|
@ -22,7 +22,7 @@ SCENARIO("Meshes", "[Utility][Mesh]")
|
|||
|
||||
GIVEN("SpaceStation/space_station.obj")
|
||||
{
|
||||
std::shared_ptr<Nz::Mesh> spacestation = Nz::Mesh::LoadFromFile(GetResourceDir() / "SpaceStation/space_station.obj");
|
||||
std::shared_ptr<Nz::Mesh> spacestation = Nz::Mesh::LoadFromFile(GetAssetDir() / "Utility/SpaceStation/space_station.obj");
|
||||
REQUIRE(spacestation);
|
||||
|
||||
CHECK(!spacestation->IsAnimable());
|
||||
|
|
@ -37,7 +37,7 @@ SCENARIO("Meshes", "[Utility][Mesh]")
|
|||
{
|
||||
GIVEN("drfreak.md2")
|
||||
{
|
||||
std::shared_ptr<Nz::Mesh> drfreak = Nz::Mesh::LoadFromFile(GetResourceDir() / "drfreak.md2");
|
||||
std::shared_ptr<Nz::Mesh> drfreak = Nz::Mesh::LoadFromFile(GetAssetDir() / "Utility/drfreak/drfreak.md2");
|
||||
CHECK(drfreak);
|
||||
|
||||
CHECK(!drfreak->IsAnimable()); //< non-skeletal animations are not supported
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
#include <filesystem>
|
||||
|
||||
std::filesystem::path GetResourceDir()
|
||||
std::filesystem::path GetAssetDir()
|
||||
{
|
||||
static std::filesystem::path resourceDir = []
|
||||
{
|
||||
std::filesystem::path dir = "resources";
|
||||
if (!std::filesystem::is_directory(dir) && std::filesystem::is_directory(".." / dir))
|
||||
return ".." / dir;
|
||||
else
|
||||
return dir;
|
||||
std::filesystem::path dir = "assets";
|
||||
if (!std::filesystem::is_directory(dir) && std::filesystem::is_directory("../.." / dir))
|
||||
dir = "../.." / dir;
|
||||
|
||||
return dir / "tests";
|
||||
}();
|
||||
|
||||
return resourceDir;
|
||||
}
|
||||
|
|
|
|||
17
xmake.lua
17
xmake.lua
|
|
@ -154,7 +154,12 @@ end
|
|||
|
||||
add_rules("mode.asan", "mode.coverage", "mode.debug", "mode.releasedbg")
|
||||
add_rules("plugin.vsxmake.autoupdate")
|
||||
add_rules("build_rendererplugins")
|
||||
add_rules("build.rendererplugins")
|
||||
add_rules("download.assets.examples")
|
||||
|
||||
if has_config("tests") then
|
||||
add_rules("download.assets.tests")
|
||||
end
|
||||
|
||||
set_allowedplats("windows", "mingw", "linux", "macosx")
|
||||
set_allowedarchs("windows|x64", "mingw|x86_64", "linux|x86_64", "macosx|x86_64")
|
||||
|
|
@ -162,7 +167,7 @@ set_allowedmodes("debug", "releasedbg", "asan", "coverage")
|
|||
set_defaultmode("debug")
|
||||
|
||||
if is_mode("debug") then
|
||||
add_rules("debug_suffix")
|
||||
add_rules("debug.suffix")
|
||||
elseif is_mode("asan") then
|
||||
set_optimize("none") -- by default xmake will optimize asan builds
|
||||
elseif is_mode("coverage") then
|
||||
|
|
@ -258,11 +263,11 @@ for name, module in pairs(modules) do
|
|||
local embedResourceRule = false
|
||||
for _, filepath in pairs(os.files("src/Nazara/" .. name .. "/Resources/**|**.h|**.nzsl|**.nzslb")) do
|
||||
if not embedResourceRule then
|
||||
add_rules("embed_resources")
|
||||
add_rules("embed.resources")
|
||||
embedResourceRule = true
|
||||
end
|
||||
|
||||
add_files(filepath, {rule = "embed_resources"})
|
||||
add_files(filepath, {rule = "embed.resources"})
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -270,11 +275,11 @@ for name, module in pairs(modules) do
|
|||
local compileShaderRule = false
|
||||
for _, filepath in pairs(os.files("src/Nazara/" .. name .. "/Resources/**.nzsl")) do
|
||||
if not compileShaderRule then
|
||||
add_rules("compile_shaders")
|
||||
add_rules("nzsl.compile.shaders")
|
||||
compileShaderRule = true
|
||||
end
|
||||
|
||||
add_files(filepath, {rule = "compile_shaders"})
|
||||
add_files(filepath, {rule = "nzsl.compile.shaders"})
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
-- Compile shaders to includables headers
|
||||
rule("compile_shaders")
|
||||
rule("nzsl.compile.shaders")
|
||||
on_load(function (target)
|
||||
target:add("packages", "nzsl")
|
||||
end)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
-- Adds -d as a debug suffix
|
||||
rule("debug_suffix")
|
||||
rule("debug.suffix")
|
||||
on_load(function (target)
|
||||
if target:kind() ~= "binary" then
|
||||
target:set("basename", target:basename() .. "-d")
|
||||
target:set("suffixname", "-d")
|
||||
end
|
||||
end)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
local baseDownloadURL = "https://nazara.digitalpulse.software"
|
||||
|
||||
local function downloadAssetsRule(name)
|
||||
rule("download.assets." .. name)
|
||||
set_kind("project")
|
||||
before_build(function (opt)
|
||||
import("net.http")
|
||||
import("utils.archive")
|
||||
|
||||
local referenceVersion = io.readfile("assets/" .. name .. "_version.txt")
|
||||
local currentVersion = os.exists("assets/" .. name .. "/version.txt") and io.readfile("assets/" .. name .. "/version.txt")
|
||||
if referenceVersion == currentVersion then
|
||||
utils.vprintf(name .. " assets are up-to-date, ignoring\n")
|
||||
return
|
||||
end
|
||||
|
||||
local text = {}
|
||||
table.insert(text, currentVersion and "update " or "download ")
|
||||
table.insert(text, name)
|
||||
table.insert(text, " assets?")
|
||||
if currentVersion then
|
||||
table.insert(text, " current version is " .. currentVersion .. " and remote version is " .. referenceVersion)
|
||||
end
|
||||
table.insert(text, "\nthis is required to run them")
|
||||
|
||||
local confirm = utils.confirm({description = table.concat(text), default = true})
|
||||
if not confirm then
|
||||
utils.vprintf("aborting " .. name .. " assets downloading\n")
|
||||
return
|
||||
end
|
||||
|
||||
os.rm("assets/" .. name)
|
||||
http.download(baseDownloadURL .. "/assets_" .. name .. ".zip", "assets_" .. name .. ".zip")
|
||||
archive.extract("assets_" .. name .. ".zip", "assets")
|
||||
os.rm("assets_" .. name .. ".zip")
|
||||
|
||||
print(name .. " assets downloaded!")
|
||||
end)
|
||||
end
|
||||
|
||||
downloadAssetsRule("examples")
|
||||
downloadAssetsRule("tests")
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
-- Turns resources into includables headers
|
||||
rule("embed_resources")
|
||||
rule("embed.resources")
|
||||
before_build(function (target, opt)
|
||||
import("core.base.option")
|
||||
if xmake.version():ge("2.5.9") then
|
||||
|
|
@ -42,7 +42,7 @@ rule("embed_resources")
|
|||
end
|
||||
|
||||
for _, sourcebatch in pairs(target:sourcebatches()) do
|
||||
if sourcebatch.rulename == "embed_resources" then
|
||||
if sourcebatch.rulename == "embed.resources" then
|
||||
for _, sourcefile in ipairs(sourcebatch.sourcefiles) do
|
||||
local targetpath = sourcefile .. ".h"
|
||||
if option.get("rebuild") or os.mtime(sourcefile) >= os.mtime(targetpath) then
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
local modules = NazaraModules
|
||||
|
||||
-- Builds renderer plugins if linked to NazaraRenderer
|
||||
rule("build_rendererplugins")
|
||||
rule("build.rendererplugins")
|
||||
on_load(function (target)
|
||||
local deps = table.wrap(target:get("deps"))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue