Commit Graph

2761 Commits

Author SHA1 Message Date
d97feb22f6 Entirely removed native presets.
The native presets did not build anymore due to refactorings, cause other build issues on Windows (e.g. require linking to psapi.lib) and would need a complete makeover anyway.
2022-09-18 13:32:58 +02:00
98b10f5ec6 Fixed a crash when all presets in the playlist have a rating of 0.
In this case, the weighted random chooser would divide by zero, which will cause a crash. In the case this happens, we'll simply use a uniform random distribution as all ratings are equally zero.
2022-09-18 13:32:33 +02:00
5a165f5de8 Parser: use size_t variable where possible
This fixes some -Wsign-compare warnings.
2022-09-16 10:51:00 +02:00
4d2345cd13 MilkdropWaveform: use size_t for loop counter
This fixes a Wsign-compare warning.
2022-09-16 10:51:00 +02:00
db1b02e718 MilkdropWaveform: remove unused private variable 2022-09-16 10:51:00 +02:00
2805459021 MenuText: use correct forward declaration
The external gltext.h is C, thus forward declare GLTtext as a struct
instead of a class.

In file included from /projectm/src/libprojectM/Renderer/MenuText.cpp:7:
/projectm/src/libprojectM/Renderer/../gltext.h:108:9: warning: struct 'GLTtext' was previously declared as a class; this is valid, but may result in linker errors under the Microsoft C++ ABI [-Wmismatched-tags]
typedef struct GLTtext GLTtext;
        ^
/projectm/src/libprojectM/Renderer/MenuText.h:9:7: note: previous use is here
class GLTtext;
      ^

In file included from /projectm/src/libprojectM/Renderer/MenuText.cpp:7:
/projectm/src/libprojectM/Renderer/../gltext.h:211:1: warning: 'GLTtext' defined as a struct here but previously declared as a class; this is valid, but may result in linker errors under the Microsoft C++ ABI [-Wmismatched-tags]
struct GLTtext {
^
/projectm/src/libprojectM/Renderer/MenuText.h:9:1: note: did you mean struct here?
class GLTtext;
^~~~~
struct
2022-09-16 10:51:00 +02:00
4805790900 Shape: add missing override 2022-09-16 10:51:00 +02:00
9c8e412cdb Replace broken WIN32 checks with _WIN32
CMake defines WIN32 by default on Windows, but we shouldn't rely on it.
_WIN32 is defined by all compilers targeting Windows.

Also cleaned up some header includes.
2022-09-16 10:47:56 +02:00
4cf04e6f66 Remove unused WIN32 ifdefs 2022-09-16 10:47:56 +02:00
2e9d0aaafe Expr.cpp: use _MSC_VER instead of WIN32
CMake defines WIN32 by default on Windows, but we shouldn't rely on it,
as it is also defined when using MinGW. Since the comments suggest MSVC-
specific code, scope to MSVC only.
2022-09-16 10:47:56 +02:00
6edb9d01dd Avoid relying on max() from windows.h
Unfortunately, windows.h breaks the standard library because it
defines max() as a macro by default.

To fix this, add NOMINMAX (and WIN32_LEAN_AND_MEAN for good measure) to
the compile options. Ideally, this would be set on a per-target basis,
but with so many OBJECT targets, that is really tedious. Luckily,
add_compile_definitions() is scoped to the current directory and sub-
directories only.
2022-09-16 10:47:56 +02:00
91a0b0be23 CMake: disable --no-undefined on Windows
link.exe emits warning LNK4044 about an unrecognized option '/-no-undefined'.

c.f. https://github.com/mesonbuild/meson/pull/4230
2022-09-16 10:47:56 +02:00
1813613e8b CMake: use target_compile_definitions instead of target_compile_options
It captures the intent better.
2022-09-16 10:47:56 +02:00
9e5f86b75f features.cmake: enable exceptions and RTTI on MSVC
On MSVC, this warning is emitted when including <vector>, among others:

  warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc

clang-cl won't even build without /EHsc and fails on the first try-statement.

Since projectM uses the C++ standard library and because it uses exceptions
itself, enable the flag.

Also, since projectM uses dynamic_cast, enable RTTI.

While both /EHsc and /GR are added by CMake by default, user-provided
CMAKE_CXX_FLAGS will override the CMake default. So instead of relying on
the CMake default, enable them explicitly.
2022-09-16 10:47:56 +02:00
f40fd3f467 features.cmake: avoid duplicate header check 2022-09-16 10:47:56 +02:00
37f2cb2b00 Renderer: Fix build with GCC 12
In file included from /projectm/src/libprojectM/Renderer/Renderer.cpp:1:
/projectm/src/libprojectM/Renderer/Renderer.hpp:191:10: error: ‘unique_ptr’ in namespace ‘std’ does not name a template type
  191 |     std::unique_ptr<TextureManager> m_textureManager;
      |          ^~~~~~~~~~
2022-09-15 17:03:48 +02:00
e4701793ee CMake: set ENABLE_SHARED_LINKING to ON when ENABLE_SHARED_LIB is enabled
This fixes the following CMake error when configuring with just
-DENABLE_STATIC_LIB=OFF:

CMake Error at src/libprojectM/CMakeLists.txt:130 (add_library):
  add_library cannot create ALIAS target "projectM::libprojectM" because
  target "projectM_static" does not already exist.

In this case, static linking is disabled, thus the "projectM_static"
CMake target doesn't exist. Previously, ENABLE_SHARED_LINKING was always
false, and because of that, "projectM::libprojectM" was added as as an
alias to "projectM_static", which didn't exist.

Now, ENABLE_SHARED_LINKING is set to true only when ENABLE_SHARED_LIB is
enabled, otherwise it will be false.
2022-09-15 17:02:05 +02:00
371365a03f ProjectM.cpp: Unname unused parameters
Amends the previous commit.

In order to avoid unused parameter warnings when building the library
itself, also unname these parameters here.

The names of these parameters are still named in ProjectM.hpp, so they
serve as documentation. In ProjectM.cpp, they are mere stubs.

As a drive-by, removed some unneeded newlines.
2022-09-15 16:57:40 +02:00
c547489feb ProjectM.{hpp,cpp}: Move event function stubs
This will avoid -Wunused-parameter warnings in client applications.
2022-09-15 16:57:40 +02:00
972b911e75 BeatDetect/Render: Fix -Wshadow warnings
Rename the variables to avoid shadowing local variables and class
members.

Also changed some spaces to tabs for local consistency.
2022-09-15 16:57:40 +02:00
0d047407dc ProjectM.hpp: Use #pragma warning on MSVC only
Fixes multiple "warning: unknown pragma ignored [-Wunknown-pragmas]"
diagnostics on GCC/Clang when used with MinGW, both when building the
library aswell as in client applications.
2022-09-15 16:57:40 +02:00
02c6e2df68 Fixed CMake compiler/linker flag detection on Windows.
Replacing the / with _ in the variable name, as CMake doesn't support this character in variable names.
2022-09-15 16:22:05 +02:00
0d2355ca8f Fix macOS compilation due to unsupported query param.
Querying will certainly fail, but the value is then guaranteed to be unchanged. We'll be using GL_BGRA in this case, which works perfectly fine.
2022-09-09 00:59:25 +02:00
c1a0317367 Fixed a crash when calling ReadConfig() early. 2022-09-09 00:59:25 +02:00
e35ef8b83a Got the texture format wrong on a previous commit. Fixed to use the proper format.
Also query the optimal internal format on desktop GL implementations and use a sensible default for GLES as it doesn't support the query target.
2022-09-09 00:59:25 +02:00
1a1eb871d8 Fix CMake's find_package(libprojectM) with Emscripten and GLES builds 2022-09-09 00:57:03 +02:00
5ff183834e Don't copy texture search paths in Renderer/TextureManager
Instead, store a reference to the original vector which is managed by the ProjectM class. This will allow manipulation of the paths after library init.
2022-09-09 00:45:59 +02:00
4edfd687f5 Copy texturePath to settings member in ReadSettings()
Why isn't this done via a simple assignment?
2022-09-09 00:45:59 +02:00
d655ae411c Don't crash if dir list is empty on UNIX systems, avoid string copying on Windows. 2022-09-09 00:45:59 +02:00
60dd295ee6 Expose texture path in the public API, removed unused font settings. 2022-09-09 00:45:58 +02:00
66380727b2 Create texture search path list in ProjectM class, pass it to TextureManager. 2022-09-09 00:45:58 +02:00
788a5ecaac Class Renderer: Store TextureManager instance as unique_ptr for easier memory management 2022-09-09 00:45:58 +02:00
6906d4ed60 Class Renderer: Renamed members, removed more unused ones. 2022-09-09 00:45:58 +02:00
33523ffe63 Class Renderer: Made internally used member private, removed a few unused members. 2022-09-09 00:45:58 +02:00
0e026ac7af Cleaned up TextureManager header, renamed members and fixed search path list usage. 2022-09-09 00:45:57 +02:00
3dab0dafc8 Quick fix: Cut off any text after end of shader's main() function
In a shader, the main function must be the last one declared. Everything following it isn't used and the HLSL compiler seems to simply ignore it. Some preset authors put credits after the closing bracket without //, which fails shader compilation in projectM. We'll now just cut off any text following the last closing bracket. One example preset is "martin - city lights.milk".
2022-07-25 12:05:46 +02:00
595a9a6cbf Disable line smoothing which is not supported in GLES, use different GL constants for other calls.
Using "GL_CLAMP_TO_EDGE" could in theory make textured shaped look weird, but the image should ideally be filling the shape completely, so users will in practice never see the actual texture border.
2022-07-11 14:26:57 +02:00
a6293f63c8 Fix function name casing causing an error with threads disabled. 2022-07-11 14:26:57 +02:00
edf06e9940 Disable OpenMP & multi threading on emscripten.
Doesn't give any real speed improvements either due to WebAssembly limitations, so we just drop it for now.
2022-07-11 14:26:57 +02:00
460a2dcd84 suggested change for float cast 2022-06-27 19:09:34 +02:00
e73917d32a did not mean to change float cast style 2022-06-27 19:09:34 +02:00
4ef7f44b8d projectm_pcm_add_float_1ch_data to projectm_pcm_add_float 2022-06-27 19:09:34 +02:00
73042a9fca Removed a filename that was added automatically to the wrong target by the IDE.
Had no build implications as it's an interface target.
2022-06-24 15:29:48 +02:00
4ad0242c60 Only search for system GLM library if user requests it.
Preferably (and by default) use the internal copy. There's rarely a need to use it from a system location, as it's just a header-only lib.
2022-06-09 10:49:14 +02:00
9298ae396c Remove unused RenderItem* files 2022-06-09 10:48:57 +02:00
39ceea422b Fix playlist loading check. 2022-06-06 18:50:50 +02:00
65a2496bfa Removed parameters from ProjectM initializer functions and set aspect correction earlier.
All parameters were just values from the internal settings struct, which is readily available - no need to pass them on the stack.
2022-06-06 18:50:50 +02:00
b28d3762ab Simplified ProjectM::RenderFrameOnlyPass2 2022-06-06 18:50:50 +02:00
828a0eb04a Moved comments for ProjectM::RenderFrameOnlyPass1 to header. 2022-06-06 18:50:50 +02:00
3dbf4ecb4b Instantiate PipelineContext directly.
The class has no real dependencies and sind we no longer need to hide internal dependencies we can just use it directly.
2022-06-06 18:50:50 +02:00