Skip to content

Commit

Permalink
Merge pull request #122 from Silverlan/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Silverlan authored Oct 18, 2024
2 parents c910c06 + 5f6d1e6 commit 1c3c21d
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 13 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/check-linux-build-gcc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Check Linux Build (GCC)
on:
push:
branches-ignore:
- main

concurrency:
group: check-build-lin-${{ github.ref }}-gcc
cancel-in-progress: true

env:
# See https://github.com/git-lfs/git-lfs/issues/5749
GIT_CLONE_PROTECTION_ACTIVE: 'false'

jobs:
build:
name: Build - ${{ matrix.config.os }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- os: ubuntu-24.04
name: "Ubuntu 24.04"
steps:
- name: Setup Pragma
uses: Silverlan/pragma/github_actions/setup@main
with:
branch: ${{ github.ref_name }}
clone_url: "https://github.com/${{ github.repository }}.git"

- name: Install gcc-14
shell: bash
id: install-gcc
run: |
sudo apt-get install gcc-14
sudo apt-get install g++-14
- name: Build Pragma
uses: ./pragma/github_actions/build
id: build-pragma
with:
build-args: '--with-pfm --with-all-pfm-modules --with-vr --with-networking --with-lua-debugger=0 --with-swiftshader --c-compiler="gcc-14" --cxx-compiler="g++-14"'

- name: Upload Debug Artifacts
if: ${{ !cancelled() }}
uses: ./pragma/github_actions/upload_debug_artifacts
with:
build-dir: '${{ steps.build-pragma.outputs.build-dir }}'
deps-dir: '${{ steps.build-pragma.outputs.deps-dir }}'
install-dir: '${{ steps.build-pragma.outputs.install-dir }}'

- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: pragma-lin64
path: ${{ steps.build-pragma.outputs.install-dir }}
retention-days: 1
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
},
{
$string name "normal_map"
},
{
$string name "matcap_map"
$string default "white"
}
]
}
13 changes: 13 additions & 0 deletions assets/addons/toon_shader/shaders/programs/scene/toon.frag
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,15 @@ void calc_toon_blinn_phong_lighting(ShadingInfo shadingInfo, SpecularInfo specIn
calc_toon_blinn_phong_lighting(shadingInfo, specInfo, light, lightInfo, shadowFactor, rimInfo, lightColor, specularColor, rimColor, lightIndex, enableShadows);
}

vec2 calc_matcap_uv(vec3 surfaceNormal, vec3 viewDirection)
{
vec3 crossSpace = cross(normalize(viewDirection), surfaceNormal);
vec2 matSpace = vec2(crossSpace.y * 1.0, crossSpace.x);
matSpace *= vec2(-0.5, -0.5);
matSpace += vec2(0.5, 0.5);
return matSpace;
}

void main()
{
SpecularInfo specInfo;
Expand Down Expand Up @@ -244,6 +253,10 @@ void main()
else if(TOON_DEBUG_MODE == TOON_DEBUG_MODE_RIM)
color = vec4(totalRimColor, 1);

vec2 uvMatcap = calc_matcap_uv(shadingInfo.surfaceNormal, shadingInfo.viewDirection);
vec4 matcapColor = fetch_matcap_map(uvMatcap);
color.rgb = color.rgb * matcapColor.rgb;

fs_color = color;
extract_bright_color(color);
}
16 changes: 15 additions & 1 deletion assets/lua/util/util_asset_import.lua
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ local function import_assets(handler, settings)
local clearFiles = settings.clearFiles

local files = handler:GetFileList()
for i, f in ipairs(files) do
files[i] = util.Path.CreateFilePath(f):GetString()
end

local function installFiles(dropPath, installPath)
local numInstalled = 0
Expand Down Expand Up @@ -363,6 +366,10 @@ local function import_assets(handler, settings)
end
end
elseif assetType == IMPORT_ASSET_TYPE_IMPORT then
-- Reset file list. If there are model import assets, they may require some of the assets (e.g. textures) that we have
-- already copied.
files = handler:GetFileList()

local extractMap = {}
local filePaths = {}
for i, f in ipairs(files) do
Expand All @@ -383,6 +390,7 @@ local function import_assets(handler, settings)
-- to "addons/imported/", so Pragma can locate them.
for rootPath, _ in pairs(extractMap) do
for i, path in ipairs(filePaths) do
path = path:Copy()
if path:MakeRelative(rootPath) then
local outPath = "addons/imported/models/" .. basePath .. path:GetString()
file.create_path(file.get_file_path(outPath))
Expand Down Expand Up @@ -543,7 +551,12 @@ function util.import_assets(files, settings)
end
local ext = file.get_file_extension(filePath)
if ext ~= nil and zipExts[ext] == true then
local f = game.open_dropped_file(file.get_file_name(filePath), true)
local f
if settings.dropped then
f = game.open_dropped_file(filePath, true)
else
f = file.open(filePath, bit.bor(file.OPEN_MODE_READ, file.OPEN_MODE_BINARY))
end
if f == nil then
settings.logger("Unable to open zip-archive '" .. filePath .. "': File not found!", log.SEVERITY_ERROR)
else
Expand All @@ -560,6 +573,7 @@ function util.import_assets(files, settings)
zipFile = nil
import_assets(handler, settings)
end
f:Close()
end
else
table.insert(nonZipFiles, f)
Expand Down
18 changes: 10 additions & 8 deletions build_scripts/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

# See https://stackoverflow.com/a/43357954/1879228 for boolean args
if platform == "linux":
parser.add_argument('--c-compiler', help='The C-compiler to use.', default='clang-18')
parser.add_argument('--cxx-compiler', help='The C++-compiler to use.', default='clang++-18')
parser.add_argument('--c-compiler', help='The C-compiler to use.', default='clang-19')
parser.add_argument('--cxx-compiler', help='The C++-compiler to use.', default='clang++-19')
defaultGenerator = "Ninja Multi-Config"
else:
defaultGenerator = "Visual Studio 17 2022"
Expand Down Expand Up @@ -184,15 +184,17 @@
########## clang-19 ##########
# Due to a compiler bug with C++20 Modules in clang, we have to use clang-19 for now,
# which is not available in package managers yet.
if platform == "linux":
if platform == "linux" and (c_compiler == "clang-19" or c_compiler == "clang++-19"):
curDir = os.getcwd()
os.chdir(deps_dir)
clang19_root = os.getcwd() +"/LLVM-19.1.1-Linux-X64"
clang19_root = os.getcwd() +"/LLVM-19.1.2-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.1/LLVM-19.1.1-Linux-X64.tar.xz",format="tar.xz")
c_compiler = clang19_root +"/bin/clang"
cxx_compiler = clang19_root +"/bin/clang++"
http_extract("https://github.com/llvm/llvm-project/releases/download/llvmorg-19.1.2/LLVM-19.1.2-Linux-X64.tar.xz",format="tar.xz")
if c_compiler == "clang-19":
c_compiler = clang19_root +"/bin/clang"
if c_compiler == "clang++-19":
cxx_compiler = clang19_root +"/bin/clang++"
print_msg("Setting c_compiler override to '" +c_compiler +"'")
print_msg("Setting cxx_compiler override to '" +cxx_compiler +"'")
os.chdir(curDir)
Expand Down Expand Up @@ -862,7 +864,7 @@ def execbuildscript(filepath):
)
add_pragma_module(
name="pr_unirender",
commitSha="dacb41c60f751482bc0943a07d86a979216c6266",
commitSha="1389fda9dad4ec8b1937cb57b426f7d7b0053203",
repositoryUrl="https://github.com/Silverlan/pr_cycles.git"
)
add_pragma_module(
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 @@ -10,14 +10,14 @@
os.chdir(external_libs_dir)
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("iglfw","https://github.com/Silverlan/iglfw.git","1449acb5399cd1d288a973396e2bab3a443d199d")
get_submodule("luasystem","https://github.com/Silverlan/luasystem.git","b36cfa22c79906270dec09a0d882e92c07a12104")
get_submodule("materialsystem","https://github.com/Silverlan/materialsystem.git","fc162908056a67e8a3ae9508a0eb1cbdd7cf6447")
get_submodule("mathutil","https://github.com/Silverlan/mathutil.git","90a6cbb229cf3b2e7af1eb9bc58b3ff22db5a611")
get_submodule("networkmanager","https://github.com/Silverlan/networkmanager.git","981bc5809c1a768267ddace778205e1be0262730")
get_submodule("panima","https://github.com/Silverlan/panima.git","c133a82e4acabfe88c3ae45c482bd743229e6f18")
get_submodule("panima","https://github.com/Silverlan/panima.git","06916dd30cde319f31b1eee25cfed7dea8f14630")
get_submodule("prosper","https://github.com/Silverlan/prosper.git","ce6533ccbd9dd0f276c01e747fc7ae089fb10b6f")
get_submodule("sharedutils","https://github.com/Silverlan/sharedutils.git","feceb9a138150177c2d9fd8e29411fcba8399b8e")
get_submodule("sharedutils","https://github.com/Silverlan/sharedutils.git","be3c166b28d9a2cd9cb6efa875419ce89c74d4ee")
get_submodule("util_bsp","https://github.com/Silverlan/util_bsp.git","2d912cceaaa59199a86431aa9d194e922b2ebea4")
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")
Expand All @@ -32,7 +32,7 @@
get_submodule("util_versioned_archive","https://github.com/Silverlan/util_versioned_archive.git","e8db74a6ad9ed44d7e8a4492eb8fe44eae3452f6")
get_submodule("util_vmf","https://github.com/Silverlan/util_vmf.git","4e477b1425e1a7b9898975effaf527f661e792da")
get_submodule("util_zip","https://github.com/Silverlan/util_zip.git","d9bf05a5cbf71bf53f9fbea82c7352f870989ed1")
get_submodule("vfilesystem","https://github.com/Silverlan/vfilesystem.git","25c839e313b1bb1c2b4dee56c4a0298c53f546b4")
get_submodule("vfilesystem","https://github.com/Silverlan/vfilesystem.git","db7aff45411c03fffb8d925f4f491f407af5f07a")
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","4d4c89e25835b4c9be0d9aa53f273fec47f4d621")
Expand Down

0 comments on commit 1c3c21d

Please sign in to comment.