mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-07 03:12:36 +01:00
commit
aeece2683e
@ -2,6 +2,7 @@ add_library(rw_interface INTERFACE)
|
|||||||
add_library(openrw::interface ALIAS rw_interface)
|
add_library(openrw::interface ALIAS rw_interface)
|
||||||
|
|
||||||
# target_compile_features(rw_interface INTERFACE cxx_std_14) is not supported by CMake 3.2
|
# target_compile_features(rw_interface INTERFACE cxx_std_14) is not supported by CMake 3.2
|
||||||
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
set(CMAKE_CXX_STANDARD 14)
|
set(CMAKE_CXX_STANDARD 14)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
@ -38,14 +39,25 @@ if(MINGW)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
# Required minimum version of Windows = Vista
|
||||||
|
set(RW_NTDDI_VISTA 0x06000000)
|
||||||
|
set(RW_WINVER 0x0600)
|
||||||
|
target_compile_definitions(rw_interface
|
||||||
|
INTERFACE
|
||||||
|
"NTDDI_VERSION=${RW_NTDDI_VISTA}"
|
||||||
|
"WINVER=${RW_WINVER}"
|
||||||
|
"_WIN32_WINNT=${RW_WINVER}"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
target_compile_definitions(rw_interface
|
target_compile_definitions(rw_interface
|
||||||
INTERFACE
|
INTERFACE
|
||||||
"$<$<CONFIG:Debug>:RW_DEBUG=1>"
|
"$<$<CONFIG:Debug>:RW_DEBUG>"
|
||||||
"GLM_FORCE_RADIANS"
|
"GLM_FORCE_RADIANS"
|
||||||
"GLM_ENABLE_EXPERIMENTAL"
|
"GLM_ENABLE_EXPERIMENTAL"
|
||||||
"RW_VERBOSE_DEBUG_MESSAGES=$<BOOL:${RW_VERBOSE_DEBUG_MESSAGES}>"
|
"$<$<BOOL:${RW_VERBOSE_DEBUG_MESSAGES}>:RW_VERBOSE_DEBUG_MESSAGES>"
|
||||||
"RENDER_PROFILER=0"
|
"$<$<BOOL:${ENABLE_PROFILING}>:RW_PROFILER>"
|
||||||
"RW_PROFILER=$<BOOL:${ENABLE_PROFILING}>"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
|
@ -57,7 +57,7 @@ FileContentsInfo FileIndex::openFileRaw(const std::string &filePath) const {
|
|||||||
throw std::runtime_error("Unable to open file: " + filePath);
|
throw std::runtime_error("Unable to open file: " + filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if RW_DEBUG
|
#ifdef RW_DEBUG
|
||||||
if (indexData->type != IndexedDataType::FILE) {
|
if (indexData->type != IndexedDataType::FILE) {
|
||||||
RW_MESSAGE("Reading raw data from archive \"" << filePath << "\"");
|
RW_MESSAGE("Reading raw data from archive \"" << filePath << "\"");
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
#if RW_DEBUG
|
#ifdef RW_DEBUG
|
||||||
std::function<void()> _rw_abort_cb[2] = {nullptr, nullptr};
|
std::function<void()> _rw_abort_cb[2] = {nullptr, nullptr};
|
||||||
|
|
||||||
#if defined(RW_WINDOWS)
|
#if defined(RW_WINDOWS)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef _LIBRW_DEBUG_HPP_
|
#ifndef _LIBRW_DEBUG_HPP_
|
||||||
#define _LIBRW_DEBUG_HPP_
|
#define _LIBRW_DEBUG_HPP_
|
||||||
|
|
||||||
#if RW_DEBUG
|
#ifdef RW_DEBUG
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ void WinBreak();
|
|||||||
#define _RW_FAILED_CHECK_ACTION()
|
#define _RW_FAILED_CHECK_ACTION()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if RW_DEBUG && RW_VERBOSE_DEBUG_MESSAGES
|
#if defined(RW_DEBUG) && defined(RW_VERBOSE_DEBUG_MESSAGES)
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#define RW_MESSAGE(msg) \
|
#define RW_MESSAGE(msg) \
|
||||||
std::cout << __FILE__ << ":" << __LINE__ << ": " << msg << std::endl
|
std::cout << __FILE__ << ":" << __LINE__ << ": " << msg << std::endl
|
||||||
|
@ -72,7 +72,7 @@ bool SoundManager::initializeOpenAL() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool SoundManager::initializeAVCodec() {
|
bool SoundManager::initializeAVCodec() {
|
||||||
#if RW_DEBUG && RW_VERBOSE_DEBUG_MESSAGES
|
#if defined(RW_DEBUG) && defined(RW_VERBOSE_DEBUG_MESSAGES)
|
||||||
av_log_set_level(AV_LOG_WARNING);
|
av_log_set_level(AV_LOG_WARNING);
|
||||||
#else
|
#else
|
||||||
av_log_set_level(AV_LOG_ERROR);
|
av_log_set_level(AV_LOG_ERROR);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef _RWENGINE_PROFILER_HPP_
|
#ifndef _RWENGINE_PROFILER_HPP_
|
||||||
#define _RWENGINE_PROFILER_HPP_
|
#define _RWENGINE_PROFILER_HPP_
|
||||||
|
|
||||||
#if RW_PROFILER
|
#ifdef RW_PROFILER
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <stack>
|
#include <stack>
|
||||||
|
@ -604,7 +604,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
|
|||||||
READ_VALUE(ped.modelName)
|
READ_VALUE(ped.modelName)
|
||||||
READ_VALUE(ped.align)
|
READ_VALUE(ped.align)
|
||||||
|
|
||||||
#if RW_DEBUG
|
#ifdef RW_DEBUG
|
||||||
std::cout << "Player Health: " << ped.info.health << " ("
|
std::cout << "Player Health: " << ped.info.health << " ("
|
||||||
<< ped.info.armour << ")" << std::endl;
|
<< ped.info.armour << ")" << std::endl;
|
||||||
std::cout << "Player model: " << ped.modelName << std::endl;
|
std::cout << "Player model: " << ped.modelName << std::endl;
|
||||||
@ -639,7 +639,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
|
|||||||
READ_VALUE(garages[i]);
|
READ_VALUE(garages[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if RW_DEBUG
|
#ifdef RW_DEBUG
|
||||||
std::cout << "Garages: " << garageData.garageCount << std::endl;
|
std::cout << "Garages: " << garageData.garageCount << std::endl;
|
||||||
std::cout << "Bombs Free: " << garageData.freeBombs << std::endl;
|
std::cout << "Bombs Free: " << garageData.freeBombs << std::endl;
|
||||||
std::cout << "Sprays Free: " << garageData.freeResprays << std::endl;
|
std::cout << "Sprays Free: " << garageData.freeResprays << std::endl;
|
||||||
@ -674,7 +674,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
|
|||||||
READ_VALUE(veh.modelId)
|
READ_VALUE(veh.modelId)
|
||||||
READ_VALUE(veh.unknown2)
|
READ_VALUE(veh.unknown2)
|
||||||
READ_VALUE(veh.state)
|
READ_VALUE(veh.state)
|
||||||
#if RW_DEBUG
|
#ifdef RW_DEBUG
|
||||||
std::cout << " v " << veh.modelId << " " << veh.state.position.x << " "
|
std::cout << " v " << veh.modelId << " " << veh.state.position.x << " "
|
||||||
<< veh.state.position.y << " " << veh.state.position.z
|
<< veh.state.position.y << " " << veh.state.position.z
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
@ -687,7 +687,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
|
|||||||
READ_VALUE(veh.modelId)
|
READ_VALUE(veh.modelId)
|
||||||
READ_VALUE(veh.unknown2)
|
READ_VALUE(veh.unknown2)
|
||||||
READ_VALUE(veh.state)
|
READ_VALUE(veh.state)
|
||||||
#if RW_DEBUG
|
#ifdef RW_DEBUG
|
||||||
std::cout << " b " << veh.modelId << " " << veh.state.position.x << " "
|
std::cout << " b " << veh.modelId << " " << veh.state.position.x << " "
|
||||||
<< veh.state.position.y << " " << veh.state.position.z
|
<< veh.state.position.y << " " << veh.state.position.z
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
@ -736,7 +736,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
|
|||||||
inst->setRotation(glm::normalize(static_cast<glm::quat>(m)));
|
inst->setRotation(glm::normalize(static_cast<glm::quat>(m)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if RW_DEBUG
|
#ifdef RW_DEBUG
|
||||||
std::cout << "Objects " << objectCount << std::endl;
|
std::cout << "Objects " << objectCount << std::endl;
|
||||||
for (size_t o = 0; o < objectCount; ++o) {
|
for (size_t o = 0; o < objectCount; ++o) {
|
||||||
auto& obj = objects[o];
|
auto& obj = objects[o];
|
||||||
@ -786,7 +786,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
|
|||||||
READ_VALUE(crane)
|
READ_VALUE(crane)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if RW_DEBUG
|
#ifdef RW_DEBUG
|
||||||
std::cout << "Cranes: " << craneData.numCranes << std::endl;
|
std::cout << "Cranes: " << craneData.numCranes << std::endl;
|
||||||
for (size_t c = 0; c < craneData.numCranes; ++c) {
|
for (size_t c = 0; c < craneData.numCranes; ++c) {
|
||||||
Block6Crane& crane = craneData.cranes[c];
|
Block6Crane& crane = craneData.cranes[c];
|
||||||
@ -806,7 +806,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
|
|||||||
Block7Data pickupData;
|
Block7Data pickupData;
|
||||||
READ_VALUE(pickupData);
|
READ_VALUE(pickupData);
|
||||||
|
|
||||||
#if RW_DEBUG
|
#ifdef RW_DEBUG
|
||||||
for (const auto &pickup : pickupData.pickups) {
|
for (const auto &pickup : pickupData.pickups) {
|
||||||
if (pickup.type == 0) continue;
|
if (pickup.type == 0) continue;
|
||||||
std::cout << " " << uint16_t(pickup.type) << " " << pickup.position.x << " "
|
std::cout << " " << uint16_t(pickup.type) << " " << pickup.position.x << " "
|
||||||
@ -827,7 +827,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
|
|||||||
READ_VALUE(payphone)
|
READ_VALUE(payphone)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if RW_DEBUG
|
#ifdef RW_DEBUG
|
||||||
std::cout << "Payphones: " << payphoneData.numPayphones << std::endl;
|
std::cout << "Payphones: " << payphoneData.numPayphones << std::endl;
|
||||||
for (const auto& payphone : payphones) {
|
for (const auto& payphone : payphones) {
|
||||||
std::cout << " " << uint16_t(payphone.state) << " " << payphone.position.x
|
std::cout << " " << uint16_t(payphone.state) << " " << payphone.position.x
|
||||||
@ -847,7 +847,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
|
|||||||
Block9Data restartData;
|
Block9Data restartData;
|
||||||
READ_VALUE(restartData);
|
READ_VALUE(restartData);
|
||||||
|
|
||||||
#if RW_DEBUG
|
#ifdef RW_DEBUG
|
||||||
std::cout << "Hospitals: " << restartData.numHospitals
|
std::cout << "Hospitals: " << restartData.numHospitals
|
||||||
<< " police: " << restartData.numPolice << std::endl;
|
<< " police: " << restartData.numPolice << std::endl;
|
||||||
for (int s = 0; s < restartData.numHospitals; ++s) {
|
for (int s = 0; s < restartData.numHospitals; ++s) {
|
||||||
@ -873,7 +873,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
|
|||||||
Block10Data radarData;
|
Block10Data radarData;
|
||||||
READ_VALUE(radarData);
|
READ_VALUE(radarData);
|
||||||
|
|
||||||
#if RW_DEBUG
|
#ifdef RW_DEBUG
|
||||||
for (const auto &blip : radarData.blips) {
|
for (const auto &blip : radarData.blips) {
|
||||||
if (blip.type == 0) continue;
|
if (blip.type == 0) continue;
|
||||||
std::cout << " " << blip.position.x << " " << blip.position.y << " "
|
std::cout << " " << blip.position.x << " " << blip.position.y << " "
|
||||||
@ -934,7 +934,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
|
|||||||
READ_VALUE(zoneData.numMapZones);
|
READ_VALUE(zoneData.numMapZones);
|
||||||
READ_VALUE(zoneData.numAudioZones);
|
READ_VALUE(zoneData.numAudioZones);
|
||||||
|
|
||||||
#if RW_DEBUG
|
#ifdef RW_DEBUG
|
||||||
std::cout << "zones: " << zoneData.numNavZones << " "
|
std::cout << "zones: " << zoneData.numNavZones << " "
|
||||||
<< zoneData.numZoneInfos << " " << zoneData.numMapZones << " "
|
<< zoneData.numZoneInfos << " " << zoneData.numMapZones << " "
|
||||||
<< zoneData.numAudioZones << std::endl;
|
<< zoneData.numAudioZones << std::endl;
|
||||||
@ -1004,7 +1004,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
|
|||||||
Block12Data gangData;
|
Block12Data gangData;
|
||||||
READ_VALUE(gangData);
|
READ_VALUE(gangData);
|
||||||
|
|
||||||
#if RW_DEBUG
|
#ifdef RW_DEBUG
|
||||||
for (const auto &gang : gangData.gangs) {
|
for (const auto &gang : gangData.gangs) {
|
||||||
std::cout << " " << gang.carModelId << " " << gang.weaponPrimary << " "
|
std::cout << " " << gang.carModelId << " " << gang.weaponPrimary << " "
|
||||||
<< gang.weaponSecondary << std::endl;
|
<< gang.weaponSecondary << std::endl;
|
||||||
@ -1028,7 +1028,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
|
|||||||
READ_VALUE(carGenerators[g])
|
READ_VALUE(carGenerators[g])
|
||||||
}
|
}
|
||||||
|
|
||||||
#if RW_DEBUG
|
#ifdef RW_DEBUG
|
||||||
std::cout << "Car generators: " << carGeneratorData.generatorCount
|
std::cout << "Car generators: " << carGeneratorData.generatorCount
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
for (size_t g = 0; g < carGeneratorData.generatorCount; ++g) {
|
for (size_t g = 0; g < carGeneratorData.generatorCount; ++g) {
|
||||||
@ -1051,7 +1051,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
|
|||||||
READ_VALUE(particles[p])
|
READ_VALUE(particles[p])
|
||||||
}
|
}
|
||||||
|
|
||||||
#if RW_DEBUG
|
#ifdef RW_DEBUG
|
||||||
std::cout << "particles: " << particleCount << std::endl;
|
std::cout << "particles: " << particleCount << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1071,7 +1071,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
|
|||||||
READ_VALUE(audioObjects[a])
|
READ_VALUE(audioObjects[a])
|
||||||
}
|
}
|
||||||
|
|
||||||
#if RW_DEBUG
|
#ifdef RW_DEBUG
|
||||||
std::cout << "Audio Objects: " << audioCount << std::endl;
|
std::cout << "Audio Objects: " << audioCount << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1094,7 +1094,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
|
|||||||
READ_VALUE(state.playerInfo.singlePayerHealthcare)
|
READ_VALUE(state.playerInfo.singlePayerHealthcare)
|
||||||
READ_VALUE(state.playerInfo.unknown5)
|
READ_VALUE(state.playerInfo.unknown5)
|
||||||
|
|
||||||
#if RW_DEBUG
|
#ifdef RW_DEBUG
|
||||||
std::cout << "Player money: " << state.playerInfo.money << " ("
|
std::cout << "Player money: " << state.playerInfo.money << " ("
|
||||||
<< state.playerInfo.displayedMoney << ")" << std::endl;
|
<< state.playerInfo.displayedMoney << ")" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
@ -1157,7 +1157,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
|
|||||||
READ_VALUE(state.gameStats.peopleKilledSinceLastBustedOrWasted);
|
READ_VALUE(state.gameStats.peopleKilledSinceLastBustedOrWasted);
|
||||||
READ_VALUE(state.gameStats.lastMissionGXT);
|
READ_VALUE(state.gameStats.lastMissionGXT);
|
||||||
|
|
||||||
#if RW_DEBUG
|
#ifdef RW_DEBUG
|
||||||
std::cout << "Player kills: " << state.gameStats.playerKills << std::endl;
|
std::cout << "Player kills: " << state.gameStats.playerKills << std::endl;
|
||||||
std::cout << "longest flight " << state.gameStats.longestDodoFlight
|
std::cout << "longest flight " << state.gameStats.longestDodoFlight
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
@ -1172,7 +1172,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
|
|||||||
Block18Data streamingData;
|
Block18Data streamingData;
|
||||||
READ_VALUE(streamingData);
|
READ_VALUE(streamingData);
|
||||||
|
|
||||||
#if RW_DEBUG && 0 // No idea what the data in the section means yet
|
#if defined(RW_DEBUG) && 0 // No idea what the data in the section means yet
|
||||||
static const size_t streamSize = sqrt(200 * 8);
|
static const size_t streamSize = sqrt(200 * 8);
|
||||||
for (int x = 0; x < streamSize; ++x) {
|
for (int x = 0; x < streamSize; ++x) {
|
||||||
for (int y = 0; y < streamSize; ++y) {
|
for (int y = 0; y < streamSize; ++y) {
|
||||||
@ -1198,7 +1198,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
|
|||||||
Block19Data pedTypeData;
|
Block19Data pedTypeData;
|
||||||
READ_VALUE(pedTypeData);
|
READ_VALUE(pedTypeData);
|
||||||
|
|
||||||
#if RW_DEBUG
|
#ifdef RW_DEBUG
|
||||||
for (const auto &type : pedTypeData.types) {
|
for (const auto &type : pedTypeData.types) {
|
||||||
printf("%08x: %f %f %f %f %f threat %08x avoid %08x\n", type.bitstring_,
|
printf("%08x: %f %f %f %f %f threat %08x avoid %08x\n", type.bitstring_,
|
||||||
static_cast<double>(type.unknown2),
|
static_cast<double>(type.unknown2),
|
||||||
|
@ -128,7 +128,7 @@ void OpenGLRenderer::useDrawBuffer(DrawBuffer* dbuff) {
|
|||||||
glBindVertexArray(dbuff->getVAOName());
|
glBindVertexArray(dbuff->getVAOName());
|
||||||
currentDbuff = dbuff;
|
currentDbuff = dbuff;
|
||||||
bufferCounter++;
|
bufferCounter++;
|
||||||
#if RW_PROFILER
|
#ifdef RW_PROFILER
|
||||||
if (currentDebugDepth > 0) {
|
if (currentDebugDepth > 0) {
|
||||||
profileInfo[currentDebugDepth - 1].buffers++;
|
profileInfo[currentDebugDepth - 1].buffers++;
|
||||||
}
|
}
|
||||||
@ -145,7 +145,7 @@ void OpenGLRenderer::useTexture(GLuint unit, GLuint tex) {
|
|||||||
glBindTexture(GL_TEXTURE_2D, tex);
|
glBindTexture(GL_TEXTURE_2D, tex);
|
||||||
currentTextures[unit] = tex;
|
currentTextures[unit] = tex;
|
||||||
textureCounter++;
|
textureCounter++;
|
||||||
#if RW_PROFILER
|
#ifdef RW_PROFILER
|
||||||
if (currentDebugDepth > 0) {
|
if (currentDebugDepth > 0) {
|
||||||
profileInfo[currentDebugDepth - 1].textures++;
|
profileInfo[currentDebugDepth - 1].textures++;
|
||||||
}
|
}
|
||||||
@ -291,7 +291,7 @@ void OpenGLRenderer::setDrawState(const glm::mat4& model, DrawBuffer* draw,
|
|||||||
uploadUBO(UBOObject, objectData);
|
uploadUBO(UBOObject, objectData);
|
||||||
|
|
||||||
drawCounter++;
|
drawCounter++;
|
||||||
#if RW_PROFILER
|
#ifdef RW_PROFILER
|
||||||
if (currentDebugDepth > 0) {
|
if (currentDebugDepth > 0) {
|
||||||
profileInfo[currentDebugDepth - 1].draws++;
|
profileInfo[currentDebugDepth - 1].draws++;
|
||||||
profileInfo[currentDebugDepth - 1].primitives += p.count;
|
profileInfo[currentDebugDepth - 1].primitives += p.count;
|
||||||
@ -421,7 +421,7 @@ void OpenGLRenderer::uploadUBOEntry(Buffer &buffer, const void *data, size_t siz
|
|||||||
}
|
}
|
||||||
|
|
||||||
void OpenGLRenderer::pushDebugGroup(const std::string& title) {
|
void OpenGLRenderer::pushDebugGroup(const std::string& title) {
|
||||||
#if RW_PROFILER
|
#ifdef RW_PROFILER
|
||||||
if (ogl_ext_KHR_debug) {
|
if (ogl_ext_KHR_debug) {
|
||||||
glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, -1, title.c_str());
|
glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, -1, title.c_str());
|
||||||
ProfileInfo& prof = profileInfo[currentDebugDepth];
|
ProfileInfo& prof = profileInfo[currentDebugDepth];
|
||||||
@ -440,7 +440,7 @@ void OpenGLRenderer::pushDebugGroup(const std::string& title) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const Renderer::ProfileInfo& OpenGLRenderer::popDebugGroup() {
|
const Renderer::ProfileInfo& OpenGLRenderer::popDebugGroup() {
|
||||||
#if RW_PROFILER
|
#ifdef RW_PROFILER
|
||||||
if (ogl_ext_KHR_debug) {
|
if (ogl_ext_KHR_debug) {
|
||||||
glPopDebugGroup();
|
glPopDebugGroup();
|
||||||
currentDebugDepth--;
|
currentDebugDepth--;
|
||||||
|
@ -403,7 +403,7 @@ private:
|
|||||||
template <class T>
|
template <class T>
|
||||||
void uploadUBO(Buffer& buffer, const T& data) {
|
void uploadUBO(Buffer& buffer, const T& data) {
|
||||||
uploadUBOEntry(buffer, &data, sizeof(T));
|
uploadUBOEntry(buffer, &data, sizeof(T));
|
||||||
#if RW_PROFILER
|
#ifdef RW_PROFILER
|
||||||
if (currentDebugDepth > 0) {
|
if (currentDebugDepth > 0) {
|
||||||
profileInfo[currentDebugDepth - 1].uploads++;
|
profileInfo[currentDebugDepth - 1].uploads++;
|
||||||
}
|
}
|
||||||
|
@ -148,10 +148,6 @@ TextRenderer::TextRenderer(GameRenderer* renderer) : renderer(renderer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TextRenderer::setFontTexture(font_t font, const std::string& textureName) {
|
void TextRenderer::setFontTexture(font_t font, const std::string& textureName) {
|
||||||
if (font >= FONTS_COUNT) {
|
|
||||||
RW_ERROR("Illegal font: " << font);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
auto ftexture = renderer->getData()->findSlotTexture("fonts", textureName);
|
auto ftexture = renderer->getData()->findSlotTexture("fonts", textureName);
|
||||||
const glm::u32vec2 textureSize = ftexture->getSize();
|
const glm::u32vec2 textureSize = ftexture->getSize();
|
||||||
glm::u8vec2 glyphOffset{textureSize.x / 16, textureSize.x / 16};
|
glm::u8vec2 glyphOffset{textureSize.x / 16, textureSize.x / 16};
|
||||||
@ -169,6 +165,8 @@ void TextRenderer::setFontTexture(font_t font, const std::string& textureName) {
|
|||||||
case FONT_ARIAL:
|
case FONT_ARIAL:
|
||||||
glyphWidths = &fontWidthsArial;
|
glyphWidths = &fontWidthsArial;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
throw std::runtime_error("Illegal font");
|
||||||
}
|
}
|
||||||
std::uint8_t monoWidth = 0;
|
std::uint8_t monoWidth = 0;
|
||||||
if (font == FONT_PAGER) {
|
if (font == FONT_PAGER) {
|
||||||
|
@ -849,7 +849,7 @@ void RWGame::renderDebugObjects(float time, ViewCamera& camera) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RWGame::renderProfile() {
|
void RWGame::renderProfile() {
|
||||||
#if RW_PROFILER
|
#ifdef RW_PROFILER
|
||||||
auto& frame = perf::Profiler::get().getFrame();
|
auto& frame = perf::Profiler::get().getFrame();
|
||||||
constexpr float upperlimit = 30000.f;
|
constexpr float upperlimit = 30000.f;
|
||||||
constexpr float lineHeight = 15.f;
|
constexpr float lineHeight = 15.f;
|
||||||
|
Loading…
Reference in New Issue
Block a user