Skip to content

Commit

Permalink
Added: Check of the modified normal exists
Browse files Browse the repository at this point in the history
Added: Description for super-elevation
  • Loading branch information
dvdvideo1234 committed Nov 15, 2024
1 parent 0b25f2e commit 6c24515
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lua/autorun/trackassembly_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -566,8 +566,9 @@ if(CLIENT) then
function(nLen) local oPly, sLog = netReadEntity(), "*CREATE_CURVE_NODE"
local vNode, vNorm, vBase = netReadVector(), netReadNormal(), netReadVector()
local vOrgw, aAngw, bRayw = netReadVector(), netReadAngle() , netReadBool()
local iNorm, tC = netReadUInt(16), asmlib.GetCacheCurve(oPly) -- Read the curve
if(iNorm > 0 and tC.Size and tC.Size >= 2) then tC.Norm[iNorm]:Set(netReadNormal()) end
local iD, tC = netReadUInt(16), asmlib.GetCacheCurve(oPly) -- Read the curve
if(iD > 0 and tC.Norm[iD] and tC.Size and tC.Size => 2) then
tC.Norm[iD]:Set(netReadNormal()) end -- Update the previews curve normal
tableInsert(tC.Node, vNode); tableInsert(tC.Norm, vNorm)
tableInsert(tC.Base, vBase); tableInsert(tC.Rays, {vOrgw, aAngw, bRayw})
tC.Size = (tC.Size + 1) -- Register the index after writing the data for drawing
Expand Down
7 changes: 7 additions & 0 deletions lua/weapons/gmod_tool/stools/trackassembly.lua
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,13 @@ function TOOL:GetCurveTransform(stTrace, bPnt)
return tData
end

--[[
* Used to apply super-elevation on the previous node
* according to the location of the next node placed
* Must be run BEFORE inserting the new node placed
* tC > Curve data stricture with the normal modified
* tData > Reference to the node being inserted
]]
function TOOL:ApplySuperElevation(tC, tData)
if(not tData) then -- The node being managed
asmlib.LogInstance("Data missing", gtLogs); return 0 end
Expand Down

0 comments on commit 6c24515

Please sign in to comment.