Create

This function creates and returns a new model.

Syntax

Parameters

Returns

Returns a new model.

Example

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

local model = NULL

model = Model:Box()
model:SetColor(1.0,0.0,0.0)
model:SetPosition(-4,0,0)

model = Model:Cylinder()
model:SetColor(0.0,1.0,0.0)
model:SetPosition(-2,0,0)

model = Model:Cone()
model:SetColor(0.0,0.0,1.0)
model:SetPosition(0,0,0)

model = Model:Sphere()
model:SetColor(0.0,1.0,1.0)
model:SetPosition(2,0,0)

model = Model:Create()
model:SetColor(1.0,0.0,1.0)
model:SetPosition(4,0,0)

local surface = tolua.cast(model:AddSurface(),"Surface")
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:UpdateAABB()
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