This function sets the material sort mode. Most materials with a blend mode other than Blend::Solid should use sorting to draw surfaces back to front.
window = Window:Create()
context = Context:Create(window)
world = World:Create()
camera = Camera:Create()
directionallight = DirectionalLight:Create()
directionallight:SetRotation(45,35,0)
--Create a material
local material = Material:Create()
material:SetColor(1,1,1,.5)
material:SetBlendMode(Blend.Alpha)
material:SetSortMode(true)
local model = nil
model = Model:Box()
model:SetMaterial(material)
model:SetPosition(1.5,0,3)
model = Model:Box()
model:SetMaterial(material)
model:SetPosition(1.5,0,5)
model = Model:Box()
model:SetMaterial(material)
model:SetPosition(1.5,0,7)
while true do
if window:Closed() or window:KeyHit(Key.Escape) then return false end
Time:Update()
world:Update()
world:Render()
context:Sync()
return true
end