mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add scale to vca
This commit is contained in:
parent
4370eedc0a
commit
bbdf31fc19
2 changed files with 19 additions and 9 deletions
|
|
@ -3,6 +3,7 @@ local internals = __vc_internals
|
|||
local this = {
|
||||
CH_TRANSLATE = 1,
|
||||
CH_ROTATE = 2,
|
||||
CH_SCALE = 3,
|
||||
|
||||
INT_CONST = 1,
|
||||
INT_LINEAR = 2,
|
||||
|
|
@ -13,8 +14,6 @@ local this = {
|
|||
|
||||
local INT_CONST = this.INT_CONST
|
||||
local INT_BEZIER = this.INT_BEZIER
|
||||
local CH_TRANSLATE = this.CH_TRANSLATE
|
||||
local CH_ROTATE = this.CH_ROTATE
|
||||
|
||||
local function bezier(a, b, c, d, u)
|
||||
local s = 1 - u
|
||||
|
|
@ -119,6 +118,7 @@ local function codegen_track(raw_track, lines, memoised, keysets)
|
|||
local code = ""
|
||||
local translation = {false, false, false}
|
||||
local rotation = {false, false, false}
|
||||
local scale = {false, false, false}
|
||||
for i, line in ipairs(lines) do
|
||||
if line.expression then
|
||||
code = code .. "\n local l" .. i .. " = (" ..
|
||||
|
|
@ -130,10 +130,12 @@ local function codegen_track(raw_track, lines, memoised, keysets)
|
|||
i, i, raw_track.fps, line.interp)
|
||||
end
|
||||
|
||||
if line.channel == CH_TRANSLATE then
|
||||
if line.channel == this.CH_TRANSLATE then
|
||||
translation[line.axis] = i
|
||||
elseif line.channel == CH_ROTATE then
|
||||
elseif line.channel == this.CH_ROTATE then
|
||||
rotation[line.axis] = i
|
||||
elseif line.channel == this.CH_SCALE then
|
||||
scale[line.axis] = i
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -153,6 +155,13 @@ local function codegen_track(raw_track, lines, memoised, keysets)
|
|||
end
|
||||
end
|
||||
|
||||
if scale[1] or scale[2] or scale[3] then
|
||||
code = code .. "\n mat4.scale(dst, {" ..
|
||||
(scale[1] and ("l" .. scale[1]) or '1').. ", " ..
|
||||
(scale[2] and ("l" .. scale[2]) or '1').. ", " ..
|
||||
(scale[3] and ("l" .. scale[3]) or '1').. "}, dst)"
|
||||
end
|
||||
|
||||
return code
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@ local INT_BEZIER = animation.INT_BEZIER
|
|||
|
||||
local action_to_channel = {
|
||||
move = animation.CH_TRANSLATE,
|
||||
rotate = animation.CH_ROTATE
|
||||
rotate = animation.CH_ROTATE,
|
||||
scale = animation.CH_SCALE,
|
||||
}
|
||||
|
||||
local curve_to_interp = {
|
||||
|
|
@ -60,12 +61,11 @@ local function parse_track(root)
|
|||
goto continue
|
||||
end
|
||||
|
||||
local bone = node.bone
|
||||
|
||||
local lineset = linesets[bone]
|
||||
local target_name = node.bone or ""
|
||||
local lineset = linesets[target_name]
|
||||
if not lineset then
|
||||
lineset = {lines = {}}
|
||||
linesets[bone] = lineset
|
||||
linesets[target_name] = lineset
|
||||
end
|
||||
|
||||
local line = {
|
||||
|
|
@ -83,6 +83,7 @@ local function parse_track(root)
|
|||
table.insert(lineset.lines, line)
|
||||
::continue::
|
||||
end
|
||||
debug.print(raw_track)
|
||||
return raw_track
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue