Skip to content

Instantly share code, notes, and snippets.

@lpberg
Created March 1, 2013 20:38
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lpberg/5067603 to your computer and use it in GitHub Desktop.
Save lpberg/5067603 to your computer and use it in GitHub Desktop.
local getRoomToWorld = function()
return RelativeTo.World:getInverseMatrix()
end
--- This is a HIDEOUS HACK @todo
local matrixMult = function(a, b)
local val = osg.Matrixd(a)
val:preMult(b)
return val
end
local transformMatrixRoomToWorld = function(m)
return matrixMult(getRoomToWorld(), m)
end
local transformPointRoomToWorld = function(v)
return getRoomToWorld():preMult(v)
end
local transformDirectionRoomToWorld = function(v)
return getRoomToWorld():preMult(osg.Vec4d(v,0))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment