Load
This function loads a material from a material (*.mat) file.
Syntax
- Material Load(string path, number flags=0)
Parameters
- path: the file path to load the font from.
- flags: asset load parameters.
Returns
Returns the loaded material. If the material cannot be loaded, NULL is returned.
Example
window = Window:Create()
context = Context:Create(window)
world = World:Create()
camera = Camera:Create()
directionallight = DirectionalLight:Create()
directionallight:SetRotation(45,35,0)
--Load a material
local material = Material:Load("Materials/Grass/grass01.mat")
--Create a model
local model = Model:Sphere()
model:SetMaterial(material)
model:SetPosition(0,0,3)
while true do
if window:Closed() or window:KeyHit(Key.Escape) then return false end
Time:Update()
world:Update()
world:Render()
context:Sync()
end