1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-07 03:12:36 +01:00

Merge pull request #533 from christoph-heiss/fix-cutscenes-macos

Fix cutscene only showing a grey screen on macOS.
This commit is contained in:
Jannik Vogel 2018-06-26 22:09:59 +02:00 committed by GitHub
commit 2b59f8b210
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 45 additions and 35 deletions

View File

@ -67,10 +67,14 @@ else()
endif() endif()
if(FILESYSTEM_LIBRARY STREQUAL "CXX17") if(FILESYSTEM_LIBRARY STREQUAL "CXX17")
set(CMAKE_CXX_STANDARD 17)
target_compile_definitions(rw_interface INTERFACE "RW_FS_LIBRARY=0") target_compile_definitions(rw_interface INTERFACE "RW_FS_LIBRARY=0")
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_link_libraries(rw_interface INTERFACE "stdc++fs")
endif()
elseif(FILESYSTEM_LIBRARY STREQUAL "CXXTS") elseif(FILESYSTEM_LIBRARY STREQUAL "CXXTS")
target_compile_definitions(rw_interface INTERFACE "RW_FS_LIBRARY=1") target_compile_definitions(rw_interface INTERFACE "RW_FS_LIBRARY=1")
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_link_libraries(rw_interface INTERFACE "stdc++fs") target_link_libraries(rw_interface INTERFACE "stdc++fs")
endif() endif()
elseif(FILESYSTEM_LIBRARY STREQUAL "BOOST") elseif(FILESYSTEM_LIBRARY STREQUAL "BOOST")

View File

@ -21,14 +21,16 @@ void LoaderCutsceneDAT::load(CutsceneTracks &tracks, const FileHandle& file) {
ss.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); ss.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
for (int i = 0; i < numZooms; ++i) { for (int i = 0; i < numZooms; ++i) {
float t = 0.f; std::string st, sz;
float z = 0.f; std::getline(ss, st, ',');
ss >> t; std::getline(ss, sz, ',');
ss.ignore(2, ',');
ss >> z; float t = std::stof(st);
ss.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
tracks.zoom[t] = z; tracks.zoom[t] = std::stof(sz);
tracks.duration = std::max(t, tracks.duration); tracks.duration = std::max(t, tracks.duration);
ss.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
} }
ss.ignore(std::numeric_limits<std::streamsize>::max(), ';'); ss.ignore(std::numeric_limits<std::streamsize>::max(), ';');
@ -38,14 +40,16 @@ void LoaderCutsceneDAT::load(CutsceneTracks &tracks, const FileHandle& file) {
ss.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); ss.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
for (int i = 0; i < numRotations; ++i) { for (int i = 0; i < numRotations; ++i) {
float t = 0.f; std::string st, sr;
float r = 0.f; std::getline(ss, st, ',');
ss >> t; std::getline(ss, sr, ',');
ss.ignore(2, ',');
ss >> r; float t = std::stof(st);
ss.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
tracks.rotation[t] = r; tracks.rotation[t] = std::stof(sr);
tracks.duration = std::max(t, tracks.duration); tracks.duration = std::max(t, tracks.duration);
ss.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
} }
ss.ignore(std::numeric_limits<std::streamsize>::max(), ';'); ss.ignore(std::numeric_limits<std::streamsize>::max(), ';');
@ -55,18 +59,19 @@ void LoaderCutsceneDAT::load(CutsceneTracks &tracks, const FileHandle& file) {
ss.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); ss.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
for (int i = 0; i < numPositions; ++i) { for (int i = 0; i < numPositions; ++i) {
float t = 0.f; std::string st, sx, sy, sz;
glm::vec3 p; std::getline(ss, st, ',');
ss >> t; std::getline(ss, sx, ',');
ss.ignore(2, ','); std::getline(ss, sy, ',');
ss >> p.x; std::getline(ss, sz, ',');
ss.ignore(1, ',');
ss >> p.y; float t = std::stof(st);
ss.ignore(1, ','); glm::vec3 p{std::stof(sx), std::stof(sy), std::stof(sz)};
ss >> p.z;
ss.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
tracks.position[t] = p; tracks.position[t] = p;
tracks.duration = std::max(t, tracks.duration); tracks.duration = std::max(t, tracks.duration);
ss.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
} }
ss.ignore(std::numeric_limits<std::streamsize>::max(), ';'); ss.ignore(std::numeric_limits<std::streamsize>::max(), ';');
@ -76,18 +81,19 @@ void LoaderCutsceneDAT::load(CutsceneTracks &tracks, const FileHandle& file) {
ss.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); ss.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
for (int i = 0; i < numTargets; ++i) { for (int i = 0; i < numTargets; ++i) {
float t = 0.f; std::string st, sx, sy, sz;
glm::vec3 p; std::getline(ss, st, ',');
ss >> t; std::getline(ss, sx, ',');
ss.ignore(2, ','); std::getline(ss, sy, ',');
ss >> p.x; std::getline(ss, sz, ',');
ss.ignore(1, ',');
ss >> p.y; float t = std::stof(st);
ss.ignore(1, ','); glm::vec3 p{std::stof(sx), std::stof(sy), std::stof(sz)};
ss >> p.z;
ss.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
tracks.target[t] = p; tracks.target[t] = p;
tracks.duration = std::max(t, tracks.duration); tracks.duration = std::max(t, tracks.duration);
ss.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
} }
RW_CHECK(ss.eof() || ss.good(), "Loading CutsceneDAT file failed"); RW_CHECK(ss.eof() || ss.good(), "Loading CutsceneDAT file failed");