Skip to content

Commit

Permalink
Merge pull request #585 from dgud/dgud/fix-otp27
Browse files Browse the repository at this point in the history
Fix otp27 compilation
  • Loading branch information
dgud authored Sep 27, 2024
2 parents ea6e3a1 + bf4d0c8 commit 265681a
Show file tree
Hide file tree
Showing 56 changed files with 291 additions and 287 deletions.
35 changes: 20 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ jobs:
runs-on: ubuntu-latest
steps:
# Fetch the commits and hopefully get nice version via git describe
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-depth: 1

- uses: erlef/setup-beam@v1
with:
otp-version: '26.0'
rebar3-version: '3.20'
otp-version: '27.1'
rebar3-version: '3.24'

- name: Install OpenCL deps
run: sudo apt-get update && sudo apt-get install -y ocl-icd-opencl-dev
Expand All @@ -34,11 +34,11 @@ jobs:
- name: Build installer
run: make unix

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: wings_ubuntu
path: |
wings-*.bzip2.run
compression-level: 0
path: wings-*.bzip2.run

build-windows:
defaults:
Expand All @@ -48,21 +48,26 @@ jobs:
runs-on: windows-2022

steps:
- uses: Vampire/setup-wsl@v2
- uses: Vampire/setup-wsl@v3
with:
distribution: Ubuntu-22.04

- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-depth: 1

- name: Install winget
uses: Cyberboss/install-winget@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Download win32 Erlang
shell: cmd
run: |
choco install -y --version "26.0.0" erlang
winget install --id=Erlang.ErlangOTP -v "27.0" -e --accept-source-agreements
## NSIS is already pre-installed
## choco install --verbose -y nsis
## winget install --verbose -y nsis

- name: Prepare WSL for compilation
run: |
Expand Down Expand Up @@ -107,11 +112,11 @@ jobs:
export WINGS_VCREDIST_IGNORE_VSN=1
make win32
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: wings_win32_x64_installer
path: |
wings-*.exe
compression-level: 0
path: wings-*.exe



2 changes: 1 addition & 1 deletion e3d/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ TARGET_FILES= $(MODULES:%=$(EBIN)/%.beam)
# ----------------------------------------------------
# FLAGS
# ----------------------------------------------------
ERL_COMPILE_FLAGS += +nowarn_match_float_zero -Werror $(TYPE_FLAGS)
ERL_COMPILE_FLAGS += -Werror $(TYPE_FLAGS)

# ----------------------------------------------------
# Targets
Expand Down
13 changes: 6 additions & 7 deletions e3d/e3d__tri_quad.erl
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ polygon_plane(Vs, Vcoords) ->
Vtab = list_to_tuple(Vcoords),
Ps = [element(V+1, Vtab) || V <- Vs],
case e3d_vec:normal(Ps) of
{0.0,0.0,0.0} -> {0.0,0.0,1.0};
{+0.0,+0.0,+0.0} -> {0.0,0.0,1.0};
N -> N
end
end.
Expand Down Expand Up @@ -817,16 +817,15 @@ segsintersect(IA, IB, IC, ID, Vtab) ->
andalso TI > 0.0 andalso TI < 1.0);
true ->
%% parallel or overlapping
case {dot2(U, U),dot2(V, V)} of
{0.0,_} -> false;
{_,0.0} -> false;
{_,_} ->
case abs(dot2(U, U)) < ?EPSILON orelse abs(dot2(V, V)) < ?EPSILON of
true -> false;
false ->
%% At this point, we know that none of the
%% segments are points.
Z = sub2(B, C),
{Wx,Wy}=W, {Zx,Zy}=Z,
{T0,T1} = case Vx of
0.0 -> {Wy/Vy, Zy/Vy};
{T0,T1} = case abs(Vx) < ?EPSILON of
true -> {Wy/Vy, Zy/Vy};
_ -> {Wx/Vx, Zx/Vx}
end,
(0.0 < T0)
Expand Down
8 changes: 4 additions & 4 deletions e3d/e3d_bvh.erl
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ bary_centric(Ax,Ay,Bx,By,Cx,Cy, BFCull) ->
false;
true ->
case U+V+W of
0.0 -> false;
Det when abs(Det) < ?EPSILON -> false;
Det -> {U,V,W,Det}
end
end.
Expand Down Expand Up @@ -521,13 +521,13 @@ tri_intvals(V0, V1, V2, Index, D0, D1, D2, _DOD1, DOD2)
%% here we know that d0d1<=0.0
isect2(V1,V0,V2,Index,D1,D0,D2);
tri_intvals(V0, V1, V2, Index, D0, D1, D2, _DOD1, _DOD2)
when (D1*D2>0.0) orelse D0 =/= 0.0 ->
when (D1*D2>0.0) orelse abs(D0) > ?EPSILON ->
isect2(V0,V1,V2,Index,D0,D1,D2);
tri_intvals(V0, V1, V2, Index, D0, D1, D2, _DOD1, _DOD2)
when D1 =/= 0.0 ->
when abs(D1) > ?EPSILON ->
isect2(V1,V0,V2,Index,D1,D0,D2);
tri_intvals(V0, V1, V2, Index, D0, D1, D2, _DOD1, _DOD2)
when D2 =/= 0.0 ->
when abs(D2) > ?EPSILON ->
isect2(V2,V0,V1,Index,D2,D0,D1);
tri_intvals(_V1, _V2, _V3, _Index, _D0, _D1, _D2, DOD1, DOD2) ->
%% triangles are coplanar
Expand Down
64 changes: 32 additions & 32 deletions e3d/e3d_mat.erl
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ identity() ->
-spec is_identity(matrix()) -> boolean().

is_identity(identity) -> true;
is_identity({1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0}) -> true;
is_identity({1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,
0.0,0.0,0.0,1.0}) -> true;
is_identity({1.0,+0.0,+0.0,+0.0,1.0,+0.0,+0.0,+0.0,1.0,+0.0,+0.0,+0.0}) -> true;
is_identity({1.0,+0.0,+0.0,+0.0,1.0,+0.0,+0.0,+0.0,1.0,+0.0,+0.0,+0.0,
+0.0,+0.0,+0.0,1.0}) -> true;
is_identity({_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_}) -> false;
is_identity({_,_,_,_,_,_,_,_,_,_,_,_}) -> false.

Expand All @@ -77,10 +77,10 @@ compress(Mat)
-spec expand(matrix()) -> matrix().

expand(identity) ->
{1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0};
{1.0,+0.0,+0.0,+0.0,+0.0,1.0,+0.0,+0.0,+0.0,+0.0,1.0,+0.0,+0.0,+0.0,+0.0,1.0};
expand({_A,_B,_C,_,_D,_E,_F,_,_G,_H,_I,_,_Tx,_Ty,_Tz,_}=Mat) -> Mat;
expand({A,B,C,D,E,F,G,H,I,Tx,Ty,Tz}) ->
{A,B,C,0.0,D,E,F,0.0,G,H,I,0.0,Tx,Ty,Tz,1.0}.
{A,B,C,+0.0,D,E,F,+0.0,G,H,I,+0.0,Tx,Ty,Tz,1.0}.

-spec translate(e3d_vector()) -> compact_matrix().

Expand All @@ -89,7 +89,7 @@ translate({X,Y,Z}) -> translate(X, Y, Z).
-spec translate(X::float(), Y::float(), Z::float()) -> compact_matrix().

translate(Tx, Ty, Tz) ->
Zero = 0.0,
Zero = +0.0,
One = 1.0,
{One,Zero,Zero,
Zero,One,Zero,
Expand All @@ -102,7 +102,7 @@ scale({X,Y,Z}) -> scale(X, Y, Z);
scale(Sc) when is_float(Sc) -> scale(Sc, Sc, Sc).

scale(Sx, Sy, Sz) ->
Zero = 0.0,
Zero = +0.0,
{Sx,Zero,Zero,
Zero,Sy,Zero,
Zero,Zero,Sz,
Expand Down Expand Up @@ -133,7 +133,7 @@ rotate(A0, {X,Y,Z}) when is_float(X), is_float(Y), is_float(Z) ->
{U1+S*(1.0-U1), U4+NegS*U4+C4, U7+NegS*U7+C7,
U2+NegS*U2+C2, U5+S*(1.0-U5), U8+NegS*U8+C8,
U3+NegS*U3+C3, U6+NegS*U6+C6, U9+S*(1.0-U9),
0.0,0.0,0.0}.
+0.0,+0.0,+0.0}.

%% rotate_from_euler_rad is a shortcut for
%% Rad2deg = 180/math:pi(),
Expand All @@ -152,7 +152,7 @@ rotate_from_euler_rad(Rx,Ry,Rz) ->
Cy = math:cos(Ry), Sy = math:sin(Ry),
Cx = math:cos(Rx), Sx = math:sin(Rx),
Sxsy=Sx*Sy, Cxsy=Cx*Sy,
TZ = 0.0,
TZ = +0.0,
{Cy*Cz, Cy*Sz, -Sy,
Sxsy*Cz-Cx*Sz, Sxsy*Sz+Cx*Cz, Sx*Cy,
Cxsy*Cz+Sx*Sz, Cxsy*Sz-Sx*Cz, Cx*Cy,
Expand All @@ -177,7 +177,7 @@ project_to_plane(Vec) ->
{Ux*Ux+Vx*Vx,Uy*Ux+Vy*Vx,Uz*Ux+Vz*Vx,
Ux*Uy+Vx*Vy,Uy*Uy+Vy*Vy,Uz*Uy+Vz*Vy,
Ux*Uz+Vx*Vz,Uy*Uz+Vy*Vz,Uz*Uz+Vz*Vz,
0.0,0.0,0.0}
+0.0,+0.0,+0.0}
end.

-spec rotate_to_z(Vector::e3d_vector()) -> compact_matrix().
Expand All @@ -186,17 +186,17 @@ rotate_to_z(Vec) ->
{Vx,Vy,Vz} = V =
case e3d_vec:norm(Vec) of
{Wx,Wy,Wz}=W when abs(Wx) =< abs(Wy), abs(Wx) < abs(Wz) ->
e3d_vec:norm(0.0, Wz, -Wy);
e3d_vec:norm(+0.0, Wz, -Wy);
{Wx,Wy,Wz}=W when abs(Wy) < abs(Wz) ->
e3d_vec:norm(Wz, 0.0, -Wx);
e3d_vec:norm(Wz, +0.0, -Wx);
{Wx,Wy,Wz}=W ->
e3d_vec:norm(Wy, -Wx, 0.0)
e3d_vec:norm(Wy, -Wx, +0.0)
end,
{Ux,Uy,Uz} = e3d_vec:cross(V, W),
{Ux,Vx,Wx,
Uy,Vy,Wy,
Uz,Vz,Wz,
0.0,0.0,0.0}.
+0.0,+0.0,+0.0}.

-spec rotate_s_to_t(S::e3d_vector(), T::e3d_vector()) -> compact_matrix().

Expand All @@ -214,7 +214,7 @@ rotate_s_to_t(S, T) ->
-spec transpose(matrix()) -> matrix().

transpose(identity=I) -> I;
transpose({M1,M2,M3,M4,M5,M6,M7,M8,M9,0.0=Z,0.0,0.0}) ->
transpose({M1,M2,M3,M4,M5,M6,M7,M8,M9,+0.0=Z,+0.0,+0.0}) ->
{M1,M4,M7,
M2,M5,M8,
M3,M6,M9,
Expand Down Expand Up @@ -267,7 +267,7 @@ add(M1,M2) when tuple_size(M1) =:= 12; tuple_size(M2) =:= 12 ->
mul(M, identity) -> M;
mul(identity, M) when not is_number(M) -> M;
mul(identity,M2) -> mul(expand(identity), M2);
mul({1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,B_tx,B_ty,B_tz},
mul({1.0,+0.0,+0.0,+0.0,1.0,+0.0,+0.0,+0.0,1.0,B_tx,B_ty,B_tz},
{A_a,A_b,A_c,A_d,A_e,A_f,A_g,A_h,A_i,A_tx,A_ty,A_tz})
when is_float(A_tx), is_float(A_ty), is_float(A_tz),
is_float(B_tx), is_float(B_ty), is_float(B_tz) ->
Expand Down Expand Up @@ -371,7 +371,7 @@ mul_point({A,B,C,D,E,F,G,H,I,Tx,Ty,Tz}, {X,Y,Z})
share(X*A + Y*D + Z*G + Tx,
X*B + Y*E + Z*H + Ty,
X*C + Y*F + Z*I + Tz);
mul_point({A,B,C,0.0,D,E,F,0.0,G,H,I,0.0,Tx,Ty,Tz,1.0}, {X,Y,Z})
mul_point({A,B,C,+0.0,D,E,F,+0.0,G,H,I,+0.0,Tx,Ty,Tz,1.0}, {X,Y,Z})
when is_float(A), is_float(B), is_float(C), is_float(D), is_float(E),
is_float(F), is_float(G), is_float(H), is_float(I),
is_float(Tx), is_float(Ty), is_float(Tz), is_float(X), is_float(Y), is_float(Z) ->
Expand Down Expand Up @@ -495,7 +495,7 @@ print(Mat) when tuple_size(Mat) =:= 12;
print_1(Mat).

print_1({A,B,C,D,E,F,G,H,I,Tx,Ty,Tz}) ->
print_1({A,B,C,0.0,D,E,F,0.0,G,H,I,0.0,Tx,Ty,Tz,1.0});
print_1({A,B,C,+0.0,D,E,F,+0.0,G,H,I,+0.0,Tx,Ty,Tz,1.0});
print_1(_Mat = {A,B,C,D,E,F,G,H,I,J,K,L,TX,TY,TZ,W}) ->
io:format(" ~10.3g ~10.3g ~10.3g ~10.3g~n ~10.3g ~10.3g ~10.3g ~10.3g~n"
" ~10.3g ~10.3g ~10.3g ~10.3g~n ~10.3g ~10.3g ~10.3g ~10.3g~n~n",
Expand Down Expand Up @@ -557,7 +557,7 @@ almost_parallel(S, T) ->
{1.0+ael(C, 1, 1),ael(C, 2, 1),ael(C, 3, 1),
ael(C, 1, 2),1.0+ael(C, 2, 2),ael(C, 3, 2),
ael(C, 1, 3),ael(C, 2, 3),1.0+ael(C, 3, 3),
0.0,0.0,0.0}.
+0.0,+0.0,+0.0}.

ael({C1,C2,C3,U,V}, I, J) ->
-C1 * element(I, U) * element(J, U) -
Expand All @@ -571,13 +571,13 @@ closest_axis({X0,Y0,Z0}) ->
if
X < Y ->
if
X < Z -> {1.0,0.0,0.0};
true -> {0.0,0.0,1.0}
X < Z -> {1.0,+0.0,+0.0};
true -> {+0.0,+0.0,1.0}
end;
true ->
if
Y < Z -> {0.0,1.0,0.0};
true -> {0.0,0.0,1.0}
Y < Z -> {+0.0,1.0,+0.0};
true -> {+0.0,+0.0,1.0}
end
end.

Expand All @@ -591,7 +591,7 @@ rotate_s_to_t_1({Vx,Vy,Vz}, E) when is_float(Vx), is_float(Vy), is_float(Vz) ->
{E+HVx*Vx,HVxy+Vz,HVxz-Vy,
HVxy-Vz,E+H*Vy*Vy,HVyz+Vx,
HVxz+Vy,HVyz-Vx,E+HVz*Vz,
0.0,0.0,0.0}.
+0.0,+0.0,+0.0}.

eig_triDiag3({A0,B0,C0,_,D0,E0,_,_,F0})
when is_float(A0), is_float(B0), is_float(C0),
Expand All @@ -606,15 +606,15 @@ eig_triDiag3({A0,B0,C0,_,D0,E0,_,_,F0})
Di2 = F0-C*Q,
Su0 = Ell,
Su1 = E0-B*Q,
Mat = {1.0, 0.0, 0.0,
0.0, B, C,
0.0, C, -B},
{Mat,{Di0,Di1,Di2},{Su0,Su1,0.0}};
Mat = {1.0, +0.0, +0.0,
+0.0, B, C,
+0.0, C, -B},
{Mat,{Di0,Di1,Di2},{Su0,Su1,+0.0}};
true ->
Mat = {1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0},
{Mat,{Di0,D0,F0},{B0,E0,0.0}}
Mat = {1.0, +0.0, +0.0,
+0.0, 1.0, +0.0,
+0.0, +0.0, 1.0},
{Mat,{Di0,D0,F0},{B0,E0,+0.0}}
end.

eps(E) ->
Expand Down
2 changes: 1 addition & 1 deletion e3d/e3d_q.erl
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ rotate_s_to_t(V1={X,Y,Z},V2)
when is_float(X), is_float(Y), is_float(Z) ->
Bisector = e3d_vec:norm(e3d_vec:add(V1,V2)),
CosHalfAngle = e3d_vec:dot(V1,Bisector),
if CosHalfAngle =/= 0.0 ->
if abs(CosHalfAngle) > ?EPSILON ->
{e3d_vec:cross(V1,Bisector), CosHalfAngle};
abs(X) >= abs(Y) ->
%% V1.x or V1.z is the largest magnitude component
Expand Down
2 changes: 1 addition & 1 deletion e3d/e3d_vec.erl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ zero() ->

-spec is_zero(vector()) -> boolean().

is_zero({0.0,0.0,0.0}) -> true;
is_zero({+0.0,+0.0,+0.0}) -> true;
is_zero(_) -> false.

-spec add(vector(), vector()) -> vector().
Expand Down
2 changes: 1 addition & 1 deletion plugins_src/autouv/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ TARGET_FILES= $(MODULES:%=$(EBIN)/%.beam)
# ----------------------------------------------------
# FLAGS
# ----------------------------------------------------
ERL_COMPILE_FLAGS += +nowarn_match_float_zero -Werror -pa $(WINGS_INTL) -I $(WINGS_TOP) $(TYPE_FLAGS) +debug_info
ERL_COMPILE_FLAGS += -Werror -pa $(WINGS_INTL) -I $(WINGS_TOP) $(TYPE_FLAGS) +debug_info

# ----------------------------------------------------
# Targets
Expand Down
Loading

0 comments on commit 265681a

Please sign in to comment.