Update

This function updates a surface after it has been modified. This will update the binormals and tangents, update the AABB, and create a new shape for picking.

Syntax

Parameters

Example

--Create a window
window = Window:Create()
context = Context:Create(window)
world = World:Create()
local camera = Camera:Create()
camera:SetRotation(35,0,0)
camera:Move(0,0,-3)
local light = DirectionalLight:Create()
light:SetRotation(35,35,0)

local model = Model:Create()
model:SetColor(1.0,0.0,1.0)

local surface = model:AddSurface()
surface:AddVertex(-0.5,-0.5,0, 0,0,-1)
surface:AddVertex(0.5,-0.5,0, 0,0,-1)
surface:AddVertex(0.5,0.5,0, 0,0,-1)
surface:AddVertex(-0.5,0.5,0, 0,0,-1)
surface:AddTriangle(2,1,0)
surface:AddTriangle(0,3,2)
surface:Update()
model:UpdateAABB(Entity.LocalAABB)
model:UpdateAABB(Entity.GlobalAABB)

while true do
if window:Closed() or window:KeyHit(Key.Escape) then return false end

Time:Update()
world:Update()
world:Render()
context:Sync()

end