diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..55f5840 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,11 @@ + +## Contributor License Agreement + +By contributing your code to HARFANG you grant the [HARFANG3D organization](https://www.harfang3d.com/en_US/legal) a non-exclusive, irrevocable, worldwide, royalty-free, sublicenseable, transferable license under all of Your relevant intellectual property rights (including copyright, patent, and any other rights), to use, copy, prepare derivative works of, distribute and publicly perform and display the Contributions on any licensing terms, including without limitation: +(a) open source licenses like the MIT license; and (b) binary, proprietary, or commercial licenses. Except for the licenses granted herein, You reserve all right, title, and interest in and to the Contribution. + +You confirm that you are able to grant us these rights. You represent that You are legally entitled to grant the above license. If Your employer has rights to intellectual property that You create, You represent that You have received permission to make the Contributions on behalf of that employer, or that Your employer has waived such rights for the Contributions. + +You represent that the Contributions are Your original works of authorship, and to Your knowledge, no other person claims, or has the right to claim, any right in any invention or patent related to the Contributions. You also represent that You are not legally obligated, whether by entering into an agreement or otherwise, in any way that conflicts with the terms of this license. + +The [HARFANG3D organization](https://www.harfang3d.com/en_US/legal) acknowledges that, except as explicitly described in this Agreement, any Contribution which you provide is on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. \ No newline at end of file diff --git a/harfang/engine/audio.cpp b/harfang/engine/audio.cpp index a755887..3e8508b 100644 --- a/harfang/engine/audio.cpp +++ b/harfang/engine/audio.cpp @@ -10,9 +10,12 @@ #include "engine/ogg_audio_stream.h" #include "engine/wav_audio_stream.h" -#ifndef EMSCRIPTEN #include -#include +#if !defined(__EMSCRIPTEN__) + #include +#else + #include +#endif #include @@ -625,4 +628,3 @@ void StopAllSources() { } } // namespace hg -#endif \ No newline at end of file diff --git a/harfang/platform/posix/thread.cpp b/harfang/platform/posix/thread.cpp index 9dc82ef..527651f 100644 --- a/harfang/platform/posix/thread.cpp +++ b/harfang/platform/posix/thread.cpp @@ -12,6 +12,9 @@ void set_thread_name(const std::string &name) {} std::string get_thread_name(std::thread::id id) { return "Unsupported"; } bool set_thread_priority(std::thread::native_handle_type handle, unsigned int priority) { +#if defined(__EMSCRIPTEN__) + return true; +#else if (!handle) return false; @@ -20,6 +23,7 @@ bool set_thread_priority(std::thread::native_handle_type handle, unsigned int pr param.sched_priority = priority; return pthread_setschedparam(handle, SCHED_OTHER, ¶m) == 0; +#endif } bool set_thread_affinity(std::thread::native_handle_type handle, unsigned int mask) { return false; } diff --git a/harfang/platform/sdl/platform_sdl.cpp b/harfang/platform/sdl/platform_sdl.cpp index b43fca3..15e2f72 100644 --- a/harfang/platform/sdl/platform_sdl.cpp +++ b/harfang/platform/sdl/platform_sdl.cpp @@ -1,5 +1,5 @@ // HARFANG(R) Copyright (C) 2019 Emmanuel Julien, Movida Production. Released under GPL/LGPL/Commercial Licence, see licence.txt for details. - +#include "../platform.h" #include "foundation/assert.h" #include "foundation/format.h" #include "foundation/log.h" @@ -13,19 +13,31 @@ bool InitPlatform() { return true; } +enum class Action : int { + FileOpen = 0, + FileSave, + SelectFolder, + Count +}; + std::string GetPlatformLocale() { - return "fr"; + return "C"; } +#pragma message "SDL2 dialogs not implemented for WASM" + bool OpenFolderDialog(const std::string &title, std::string &OUTPUT, const std::string &initial_dir) { + puts(__FILE__ ":OpenFolderDialog"); return false; } -bool OpenFileDialog(const std::string &title, const std::string &filter, std::string &OUTPUT, const std::string &initial_dir) { +bool OpenFileDialog(const std::string &title, const std::vector &filters, std::string &output, const std::string &initial_dir) { + puts(__FILE__ ":OpenFileDialog"); return false; } -bool SaveFileDialog(const std::string &title, const std::string &filter, std::string &OUTPUT, const std::string &initial_dir) { +bool SaveFileDialog(const std::string &title, const std::vector &filters, std::string &output, const std::string &initial_dir) { + puts(__FILE__ ":SaveFileDialog"); return false; } diff --git a/harfang/platform/sdl/window_system.cpp b/harfang/platform/sdl/window_system.cpp index 3304c96..c233c1b 100644 --- a/harfang/platform/sdl/window_system.cpp +++ b/harfang/platform/sdl/window_system.cpp @@ -100,11 +100,17 @@ Window *NewWindowFrom(void *handle) { } // TODO Create a new fullscreen window on a specified monitor. -Window *NewFullscreenWindow(const Monitor *monitor, int mode_index, MonitorRotation rotation) { return NewWindow(512, 512, 32, WV_Windowed); } +Window *NewFullscreenWindow(const Monitor *monitor, int mode_index, MonitorRotation rotation) { + return NewWindow(512, 512, 32, WV_Windowed); +} +Window * NewFullscreenWindow(const char *title, const Monitor *monitor, int mode_index, MonitorRotation rotation) { + return NewWindow(512, 512, 32, WV_Windowed); +} + void *GetDisplay() { return nullptr; } -static const char *canvas_name = "canvas"; +static const char *canvas_name = "#canvas"; void *GetWindowHandle(const Window *w) { return (void *)canvas_name; // return reinterpret_cast(w->w); @@ -161,7 +167,7 @@ bool SetWindowTitle(Window *w, const std::string &title) { return true; } bool WindowHasFocus(const Window *w) { return true; } -bool SetWindowPos(const Window *w, const hg::iVec2 &v) { +bool SetWindowPos(Window *w, const hg::iVec2 &v) { SDL_SetWindowPosition(w->w, v.x, v.y); UpdateWindow(w); // process messages on the spot return true; @@ -176,7 +182,13 @@ hg::iVec2 GetWindowPos(const Window *w) { return pos; } +hg::Vec2 GetWindowContentScale(const Window *window) { + puts(__FILE__ "GetWindowContentScale"); + return { 1, 1 }; +} + void ShowCursor() { SDL_ShowCursor(SDL_ENABLE); } void HideCursor() { SDL_ShowCursor(SDL_DISABLE); } +void WindowSystemShutdown() { } } // namespace hg diff --git a/readme.md b/readme.md index 4cfa3f4..77f48e1 100644 --- a/readme.md +++ b/readme.md @@ -19,6 +19,7 @@ HARFANG®3D is an all-in-one 3D visualization library usable in C++, Python, Lua 4. [Using the C++ SDK](#section_4) 5. [Version](#section_5) 6. [License](#section_6) +7. [Contributing](#section_7) # About @@ -240,6 +241,20 @@ Given a version number MAJOR.MINOR.PATCH, increment the: Harfang is licensed under the GPLv3, LGPLv3 and a commercial license:
https://www.harfang3d.com/license + +# Contributing +## Contributor License Agreement + +By contributing your code to HARFANG you grant the [HARFANG3D organization](https://www.harfang3d.com/en_US/legal) a non-exclusive, irrevocable, worldwide, royalty-free, sublicenseable, transferable license under all of Your relevant intellectual property rights (including copyright, patent, and any other rights), to use, copy, prepare derivative works of, distribute and publicly perform and display the Contributions on any licensing terms, including without limitation: +(a) open source licenses like the MIT license; and (b) binary, proprietary, or commercial licenses. Except for the licenses granted herein, You reserve all right, title, and interest in and to the Contribution. + +You confirm that you are able to grant us these rights. You represent that You are legally entitled to grant the above license. If Your employer has rights to intellectual property that You create, You represent that You have received permission to make the Contributions on behalf of that employer, or that Your employer has waived such rights for the Contributions. + +You represent that the Contributions are Your original works of authorship, and to Your knowledge, no other person claims, or has the right to claim, any right in any invention or patent related to the Contributions. You also represent that You are not legally obligated, whether by entering into an agreement or otherwise, in any way that conflicts with the terms of this license. + +The [HARFANG3D organization](https://www.harfang3d.com/en_US/legal) acknowledges that, except as explicitly described in this Agreement, any Contribution which you provide is on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. + + # More screenshots... ![alt text](https://raw.githubusercontent.com/harfang3d/image-storage/main/portfolio/3.1.1/sun_temple_aaa.png)