require("Scripts/constants/keycodes")
-- Register abstract path
RegisterAbstractPath("")
-- Set graphics mode
if Graphics(1680, 1050, 32) == 0 then
Notify("Failed to set graphics mode.", 1)
return
end
world = CreateWorld()
if world == nil then
Notify("Failed to initialize engine.", 1)
return
end
gbuffer = CreateBuffer(GraphicsWidth(), GraphicsHeight(), 1+2+4+8)
camera = CreateCamera()
camera:SetPosition(Vec3(0, 0, -2))
light = CreateSpotLight(10)
light:SetRotation(Vec3(45, 55, 0))
light:SetPosition(Vec3(5, 5, -5))
material = LoadMaterial("abstract::cobblestones.mat")
mesh = CreateCube()
mesh:Paint(material)
ground = CreateCube()
ground:SetScale(Vec3(10.0, 1.0, 10.))
ground:SetPosition(Vec3(0.0, -2.0, 0.0))
ground:Paint(material)
light = CreateDirectionalLight()
light:SetRotation(Vec3(45, 45, 45))
while AppTerminate() == 0 do
if KeyHit(KEY_ESCAPE) == 1 then break end
mesh:Turn(Vec3(AppSpeed() * 0.5, AppSpeed() * 0.5, AppSpeed() * 0.5))
UpdateAppTime()
world:Update(AppSpeed())
SetBuffer(gbuffer)
world:Render()
SetBuffer(BackBuffer())
world:RenderLights(gbuffer)
DrawText(UPS(), 0, 0)
Flip(0)
end