Add

This function adds the contents of one surface to another. This can be used to collapse multiple surfaces into one.

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)

--Create model
local box = Model:Box()
box:SetColor(0.0,1.0,0.0)
local surface1 = box:GetSurface(0)

--Create a second model
model = Model:Cylinder()
model:SetColor(0.0,0.0,1.0)
local surface2 = model:GetSurface(0)

--Add the first surface to the second one
local mat = Mat4()
mat.t.x = 1.5 -- Offset the matrix position by 1.5 on the x axis
surface1:Add(surface2,mat)
model:UpdateAABB(Entity.LocalAABB+Entity.GlobalAABB)

--Release the first model
box:Release()

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

model:Turn(0,Time:GetSpeed(),0)

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

end