Skip to content

Commit

Permalink
Merge pull request #119 from Silverlan/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Silverlan authored Oct 11, 2024
2 parents 3ea0fb5 + 2d32f9d commit 28a530f
Show file tree
Hide file tree
Showing 32 changed files with 213 additions and 54 deletions.
9 changes: 9 additions & 0 deletions assets/lua/autorun/client/c_lightmapping.lua
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,13 @@ console.register_command("debug_lightmaps", function(pl, ...)
debug.open_lightmap_atlas_view(ent, function(windowHandle, contents, controls)
dirAtlasWindow = windowHandle
end)

local _, cDataCache = ents.citerator(ents.COMPONENT_LIGHT_MAP_DATA_CACHE)()

print("Lightmap material name: " .. c:GetLightmapMaterialName())
local lightmapDataCache = "NULL"
if cDataCache ~= nil then
lightmapDataCache = cDataCache:GetLightMapDataCachePath()
end
print("Lightmap data cache: " .. lightmapDataCache)
end)
8 changes: 4 additions & 4 deletions build_scripts/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@
if platform == "linux":
curDir = os.getcwd()
os.chdir(deps_dir)
clang19_root = os.getcwd() +"/LLVM-19.1.0-Linux-X64"
clang19_root = os.getcwd() +"/LLVM-19.1.1-Linux-X64"
if not Path(clang19_root).is_dir():
print_msg("Downloading clang-19...")
http_extract("https://github.com/llvm/llvm-project/releases/download/llvmorg-19.1.0/LLVM-19.1.0-Linux-X64.tar.xz",format="tar.xz")
http_extract("https://github.com/llvm/llvm-project/releases/download/llvmorg-19.1.1/LLVM-19.1.1-Linux-X64.tar.xz",format="tar.xz")
c_compiler = clang19_root +"/bin/clang"
cxx_compiler = clang19_root +"/bin/clang++"
print_msg("Setting c_compiler override to '" +c_compiler +"'")
Expand Down Expand Up @@ -851,7 +851,7 @@ def execbuildscript(filepath):
)
add_pragma_module(
name="pr_dmx",
commitSha="e2b0eff826eda999056f182fc15cfb16cbfbe913",
commitSha="eb6b4c8e0cd45dc27cc7ed46ff50eb5a9cae1fba",
repositoryUrl="https://github.com/Silverlan/pr_dmx.git"
)
if with_all_pfm_modules:
Expand Down Expand Up @@ -1129,7 +1129,7 @@ def download_addon(name,addonName,url,commitId=None):
curDir = os.getcwd()
if not skip_repository_updates:
if with_pfm:
download_addon("PFM","filmmaker","https://github.com/Silverlan/pfm.git","b4ed38338fd3478f50361bdeed6f433924e932e3")
download_addon("PFM","filmmaker","https://github.com/Silverlan/pfm.git","46ef461311983bb6878169ffa8262b21747b6a02")
download_addon("model editor","tool_model_editor","https://github.com/Silverlan/pragma_model_editor.git","4c185ce7533fba1294e7282ae88168e7842e1a2b")

if with_vr:
Expand Down
8 changes: 4 additions & 4 deletions build_scripts/scripts/external_libs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

external_libs_dir = curDir +"/external_libs"
os.chdir(external_libs_dir)
get_submodule("alsoundsystem","https://github.com/Silverlan/alsoundsystem.git","7daad8c34ab5000fc92b6f326b08fdc81b984cfe")
get_submodule("alsoundsystem","https://github.com/Silverlan/alsoundsystem.git","cf9d6139d3a6812333cc991cceff204a9927d6d1")
get_submodule("datasystem","https://github.com/Silverlan/datasystem.git","7642296ea0f8316957e1123034e87034294f8b46")
get_submodule("iglfw","https://github.com/Silverlan/iglfw.git","0a32680dcf085f4541252110229439125e35c3c6")
get_submodule("luasystem","https://github.com/Silverlan/luasystem.git","b36cfa22c79906270dec09a0d882e92c07a12104")
Expand All @@ -18,13 +18,13 @@
get_submodule("panima","https://github.com/Silverlan/panima.git","08492a7bd8b214ff8472ae3288a32020aff1f60e")
get_submodule("prosper","https://github.com/Silverlan/prosper.git","8e3cf2412f90842f1ab5b10427526d21ab97eba9")
get_submodule("sharedutils","https://github.com/Silverlan/sharedutils.git","cbfdabddc7bacbcb1c00bfaccda5c7b10a8fc912")
get_submodule("util_bsp","https://github.com/Silverlan/util_bsp.git","7c49f7b9a59b1e9776a355881aeecede8a8f9be3")
get_submodule("util_bsp","https://github.com/Silverlan/util_bsp.git","26ca23e32ebedf1797985567455d125f2e94e2df")
get_submodule("util_formatted_text","https://github.com/Silverlan/util_formatted_text.git","c473a2bdc1ad84ef52d391226d6983ef3076958e")
get_submodule("util_image","https://github.com/Silverlan/util_image.git","bc1af9d7a0e4e4e51550a4730d65e072ae97d592")
get_submodule("util_pad","https://github.com/Silverlan/util_pad.git","49d78bd7725cc320fae67c6eff5c25524d1363c0")
get_submodule("util_pragma_doc","https://github.com/Silverlan/util_pragma_doc.git","88e85503b120f820143f6f4566e194b539297ffa")
get_submodule("util_smdmodel","https://github.com/Silverlan/util_smdmodel.git","10fb2d10eb62188c8b9639a62da646152277a748")
get_submodule("util_sound","https://github.com/Silverlan/util_sound.git","dcc284ca1affd33c9964ff1646e7aa7cf902eb96")
get_submodule("util_sound","https://github.com/Silverlan/util_sound.git","729915ed7eaa7c9669a57c4e0d3dc4bf02a62cea")
get_submodule("util_source2","https://github.com/Silverlan/util_source2.git","2d45b2c76921475b61647ea63aeb180b37a17d44")
get_submodule("util_source_script","https://github.com/Silverlan/util_source_script.git","eb71bb79736ccc693832c98d69069f3ffbbcb897")
get_submodule("util_timeline_scene","https://github.com/Silverlan/util_timeline_scene.git","8cac3eae6f4bc892e2ea229a97261385651a90f6")
Expand All @@ -33,7 +33,7 @@
get_submodule("util_vmf","https://github.com/Silverlan/util_vmf.git","3080ba05280ae5b0a76ef283870864c16d1c7826")
get_submodule("util_zip","https://github.com/Silverlan/util_zip.git","d9bf05a5cbf71bf53f9fbea82c7352f870989ed1")
get_submodule("vfilesystem","https://github.com/Silverlan/vfilesystem.git","25c839e313b1bb1c2b4dee56c4a0298c53f546b4")
get_submodule("wgui","https://github.com/Silverlan/wgui.git","28f5feb6f72f472f77d15dc75f26e5c6672ca0ba")
get_submodule("wgui","https://github.com/Silverlan/wgui.git","66d3758336d6e58046813a30298a6a3d9af74318")
get_submodule("util_unicode","https://github.com/Silverlan/util_unicode.git","5a0ac6c02f199e42d7d38d99231503cf42e26f8a")
get_submodule("cppbezierfit","https://github.com/Silverlan/cppbezierfit.git","eb08f35ad74c1124f3cd4ef3a8958cded6a04b0e")

Expand Down
1 change: 1 addition & 0 deletions core/client/include/pragma/console/c_cvar_global.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ REGISTER_CONCOMMAND_CL(debug_particle_alpha_mode, Console::commands::debug_parti
Blend factor options: zero, one, src_color, one_minus_src_color, dst_color, one_minus_dst_color, src_alpha, one_minus_src_alpha, dst_alpha, one_minus_dst_alpha, constant_color, \
one_minus_constant_color, constant_alpha, one_minus_constant_alpha, src_alpha_saturate, src1_color, one_minus_src1_color, src1_alpha, one_minus_src1_alpha\n\
Operation options: add, subtract, reverse_subtract, min, max");
REGISTER_CONCOMMAND_CL(debug_print_shader_material_data, Console::commands::debug_print_shader_material_data, ConVarFlags::None, "Prints the shader material data for the specified material.");

#ifdef _DEBUG
REGISTER_CONCOMMAND_CL(cl_dump_sounds, CMD_cl_dump_sounds, ConVarFlags::None, "Prints information about all active sounds to the console.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ namespace Console {

DLLCLIENT void debug_texture_mipmaps(NetworkState *state, pragma::BasePlayerComponent *pl, std::vector<std::string> &argv);
DLLCLIENT void debug_pbr_ibl(NetworkState *state, pragma::BasePlayerComponent *pl, std::vector<std::string> &argv);
DLLCLIENT void debug_print_shader_material_data(NetworkState *state, pragma::BasePlayerComponent *pl, std::vector<std::string> &argv);
DLLCLIENT void debug_font(NetworkState *state, pragma::BasePlayerComponent *pl, std::vector<std::string> &argv);
DLLCLIENT void debug_hitboxes(NetworkState *state, pragma::BasePlayerComponent *pl, std::vector<std::string> &argv);
DLLCLIENT void debug_water(NetworkState *state, pragma::BasePlayerComponent *pl, std::vector<std::string> &argv);
Expand Down
3 changes: 0 additions & 3 deletions core/client/include/pragma/entities/c_world.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@

#pragma warning(push)
#pragma warning(disable : 4251)
namespace bsp {
class File;
};
namespace prosper {
class Buffer;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "pragma/clientdefinitions.h"
#include <pragma/entities/components/base_entity_component.hpp>

namespace bsp {
namespace source_engine::bsp {
class File;
};
namespace pragma {
Expand All @@ -21,7 +21,7 @@ namespace pragma {
virtual void Initialize() override;
virtual void InitializeLuaObject(lua_State *l) override;
protected:
void InitializeBSPTree(bsp::File &bsp);
void InitializeBSPTree(source_engine::bsp::File &bsp);
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
#include "pragma/rendering/raytracing/cycles.hpp"
#include <pragma/entities/components/base_entity_component.hpp>

namespace bsp {
class File;
};
namespace prosper {
class IDynamicResizableBuffer;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ namespace pragma::rendering::shader_material {

struct ShaderMaterialData {
ShaderMaterialData(const ShaderMaterial &shaderMaterial) : m_shaderMaterial {shaderMaterial} {}
void DebugPrint();
void PopulateFromMaterial(const CMaterial &mat);
MaterialFlags GetFlags() const;
void SetFlags(MaterialFlags flags);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ namespace pragma {

void SetShaderMaterialName(const std::optional<std::string> &shaderMaterial);
const std::optional<std::string> &GetShaderMaterialName() const;
const rendering::shader_material::ShaderMaterial *GetShaderMaterial() const { return m_shaderMaterial.get(); }

virtual GameShaderSpecializationConstantFlag GetBaseSpecializationFlags() const;
virtual void RecordBindScene(rendering::ShaderProcessor &shaderProcessor, const pragma::CSceneComponent &scene, const pragma::CRasterizationRendererComponent &renderer, prosper::IDescriptorSet &dsScene, prosper::IDescriptorSet &dsRenderer, prosper::IDescriptorSet &dsRenderSettings,
Expand Down
4 changes: 2 additions & 2 deletions core/client/src/audio/c_sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
#include <alsound_buffer.hpp>
#include <pragma/game/game_resources.hpp>
#include <pragma/audio/sound_util.hpp>
#include <util_sound.hpp>
#include <sharedutils/util_file.h>
#include <steam_audio/alsound_steam_audio.hpp>
#include <pragma/entities/components/base_transform_component.hpp>
#include <pragma/logging.hpp>
#include <sharedutils/util_markup_file.hpp>

import se_script;
import pragma.audio.util;

extern DLLCLIENT CEngine *c_engine;
extern DLLCLIENT ClientState *client;
Expand Down Expand Up @@ -140,7 +140,7 @@ bool ClientState::PrecacheSound(std::string snd, std::pair<al::ISoundBuffer *, a
}

auto duration = 0.f;
if(util::sound::get_duration(path, duration) == false || duration == 0.f) {
if(pragma::audio::util::get_duration(path, duration) == false || duration == 0.f) {
spdlog::warn("Unable to precache sound '{}': Invalid format!", snd);
return false;
}
Expand Down
7 changes: 7 additions & 0 deletions core/client/src/c_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
#include "pragma/c_engine.h"
#include <pragma/console/convars.h>
#include "pragma/input/input_binding_layer.hpp"

namespace pragma::string {
class Utf8String;
class Utf8StringView;
class Utf8StringArg;
};

#include "pragma/localization.h"
#include <fsys/filesystem.h>
#include "pragma/input/inputhelper.h"
Expand Down
5 changes: 5 additions & 0 deletions core/client/src/c_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
* Copyright (c) 2021 Silverlan
*/

namespace pragma::string {
class Utf8String;
class Utf8StringView;
class Utf8StringArg;
};
#include "stdafx_cengine.h"
#include "pragma/c_engine.h"
#include <wgui/wgui.h>
Expand Down
7 changes: 7 additions & 0 deletions core/client/src/c_engine_cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
*/

#include "stdafx_cengine.h"

namespace pragma::string {
class Utf8String;
class Utf8StringView;
class Utf8StringArg;
};

#include "pragma/c_engine.h"
#include "pragma/audio/c_audio.hpp"
#include "pragma/rendering/render_processor.hpp"
Expand Down
7 changes: 7 additions & 0 deletions core/client/src/c_vr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
*/

#include "stdafx_client.h"

namespace pragma::string {
class Utf8String;
class Utf8StringView;
class Utf8StringArg;
};

#include "pragma/clientstate/clientstate.h"
#include "pragma/c_engine.h"
#include "pragma/gui/wimessagebox.h"
Expand Down
19 changes: 10 additions & 9 deletions core/client/src/entities/c_world.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include "pragma/rendering/world_environment.hpp"
#include "pragma/rendering/render_processor.hpp"
#include "pragma/lua/c_lentity_handles.hpp"
#include <util_bsp.hpp>
#include <buffers/prosper_buffer.hpp>
#include <prosper_util.hpp>
#include <pragma/entities/entity_iterator.hpp>
Expand All @@ -34,6 +33,8 @@
#include <pragma/lua/converters/game_type_converters_t.hpp>
#include <cmaterial.h>

import source_engine.bsp;

using namespace pragma;

extern DLLCLIENT CEngine *c_engine;
Expand Down Expand Up @@ -72,9 +73,9 @@ void CWorldComponent::Initialize()
if(pRenderComponent.valid())
pRenderComponent->SetLocalRenderBounds(min, max);
});
BindEvent(CModelComponent::EVENT_ON_RENDER_MESHES_UPDATED, [this](std::reference_wrapper<pragma::ComponentEvent> evData) -> util::EventReply {
BindEvent(CModelComponent::EVENT_ON_RENDER_MESHES_UPDATED, [this](std::reference_wrapper<pragma::ComponentEvent> evData) -> ::util::EventReply {
BuildOfflineRenderQueues(true);
return util::EventReply::Handled;
return ::util::EventReply::Handled;
});
#if 0
BindEventUnhandled(CColorComponent::EVENT_ON_COLOR_CHANGED, [this](std::reference_wrapper<pragma::ComponentEvent> evData) {
Expand Down Expand Up @@ -107,13 +108,13 @@ void CWorldComponent::ReloadCHCController()
m_chcController = std::make_shared<CHC>(*cam);
m_chcController->Reset(m_meshTree);*/ // prosper TODO
}
void CWorldComponent::SetBSPTree(const std::shared_ptr<util::BSPTree> &bspTree, const std::vector<std::vector<RenderMeshIndex>> &meshesPerCluster)
void CWorldComponent::SetBSPTree(const std::shared_ptr<::util::BSPTree> &bspTree, const std::vector<std::vector<RenderMeshIndex>> &meshesPerCluster)
{
m_bspTree = bspTree;
m_meshesPerCluster = meshesPerCluster;
BuildOfflineRenderQueues(false);
}
const std::shared_ptr<util::BSPTree> &CWorldComponent::GetBSPTree() const { return m_bspTree; }
const std::shared_ptr<::util::BSPTree> &CWorldComponent::GetBSPTree() const { return m_bspTree; }
void CWorldComponent::ReloadMeshCache()
{
m_meshTree = nullptr;
Expand Down Expand Up @@ -159,7 +160,7 @@ void CWorldComponent::OnEntityComponentAdded(BaseEntityComponent &component)
std::shared_ptr<OcclusionOctree<std::shared_ptr<ModelMesh>>> CWorldComponent::GetMeshTree() const { return m_meshTree; };
std::shared_ptr<CHC> CWorldComponent::GetCHCController() const { return m_chcController; }

const pragma::rendering::RenderQueue *CWorldComponent::GetClusterRenderQueue(util::BSPTree::ClusterIndex clusterIndex, bool translucent) const
const pragma::rendering::RenderQueue *CWorldComponent::GetClusterRenderQueue(::util::BSPTree::ClusterIndex clusterIndex, bool translucent) const
{
auto &queue = translucent ? m_clusterRenderTranslucentQueues : m_clusterRenderQueues;
return (clusterIndex < queue.size()) ? queue.at(clusterIndex).get() : nullptr;
Expand Down Expand Up @@ -228,7 +229,7 @@ void CWorldComponent::BuildOfflineRenderQueues(bool rebuild)
auto &meshesPerClusters = m_meshesPerCluster;
if(meshesPerClusters.empty()) {
meshesPerClusters.resize(numClusters);
auto fAddClusterMesh = [&meshesPerClusters](util::BSPTree::ClusterIndex clusterIndex, RenderMeshIndex meshIdx) {
auto fAddClusterMesh = [&meshesPerClusters](::util::BSPTree::ClusterIndex clusterIndex, RenderMeshIndex meshIdx) {
auto &clusterMeshes = meshesPerClusters.at(clusterIndex);
if(clusterMeshes.size() == clusterMeshes.capacity())
clusterMeshes.reserve(clusterMeshes.size() * 1.1 + 100);
Expand All @@ -247,10 +248,10 @@ void CWorldComponent::BuildOfflineRenderQueues(bool rebuild)
Vector3 min, max;
mesh->GetBounds(min, max);
auto leafNodes = m_bspTree->FindLeafNodesInAabb(min, max);
std::unordered_set<util::BSPTree::ClusterIndex> clusters;
std::unordered_set<::util::BSPTree::ClusterIndex> clusters;
for(auto *node : leafNodes) {
auto meshClusterIdx = node->cluster;
if(meshClusterIdx == std::numeric_limits<util::BSPTree::ClusterIndex>::max())
if(meshClusterIdx == std::numeric_limits<::util::BSPTree::ClusterIndex>::max())
continue;
for(auto clusterIdx = decltype(numClusters) {0u}; clusterIdx < numClusters; ++clusterIdx) {
if(m_bspTree->IsClusterVisible(clusterIdx, meshClusterIdx) == false)
Expand Down
2 changes: 1 addition & 1 deletion core/client/src/entities/components/c_bsp_component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ using namespace pragma;

void CBSPComponent::InitializeLuaObject(lua_State *l) { return BaseEntityComponent::InitializeLuaObject<std::remove_reference_t<decltype(*this)>>(l); }
void CBSPComponent::Initialize() { BaseEntityComponent::Initialize(); }
void CBSPComponent::InitializeBSPTree(bsp::File &bsp)
void CBSPComponent::InitializeBSPTree(source_engine::bsp::File &bsp)
{
// TODO
//auto bspTree = BSPTree::Create(bsp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@
#include "pragma/entities/components/c_light_map_component.hpp"
#include <pragma/entities/entity_component_system_t.hpp>
#include <pragma/game/game_resources.hpp>
#include <util_bsp.hpp>
#include <util_image_buffer.hpp>
#include <buffers/prosper_buffer.hpp>
#include <prosper_command_buffer.hpp>
#include <prosper_util.hpp>
#include <image/prosper_texture.hpp>
#include <pragma/lua/converters/game_type_converters_t.hpp>

import source_engine.bsp;

extern DLLCLIENT CGame *c_game;
extern DLLCLIENT ClientState *client;
extern DLLCLIENT CEngine *c_engine;
Expand Down Expand Up @@ -75,7 +76,7 @@ void CLightMapComponent::ConvertLightmapToBSPLuxelData() const
// imgBuf->Clear(Color::Red);

auto mapPath = "maps/" + c_game->GetMapName() + ".bsp";
auto *convertLightmapDataToBspLuxelData = reinterpret_cast<bool (*)(NetworkState &, const std::string &, const uimg::ImageBuffer &, uint32_t, uint32_t, std::string &)>(util::impl::get_module_func(client, "convert_lightmap_data_to_bsp_luxel_data"));
auto *convertLightmapDataToBspLuxelData = reinterpret_cast<bool (*)(NetworkState &, const std::string &, const uimg::ImageBuffer &, uint32_t, uint32_t, std::string &)>(::util::impl::get_module_func(client, "convert_lightmap_data_to_bsp_luxel_data"));
if(convertLightmapDataToBspLuxelData == nullptr)
return;
std::string errMsg;
Expand Down
Loading

0 comments on commit 28a530f

Please sign in to comment.