Load
This function loads a model from a Leadwerks model (*.mdl) file.
Syntax
- Model Load(string path,number flags=0)
Parameters
- path: the file path to load the model from.
- flags: asset load parameters.
Returns
Returns the loaded model. If the model could not be loaded, NULL is returned.
Example
--Create a window
window = Window:Create()
context = Context:Create(window)
world = World:Create()
camera = Camera:Create()
camera:SetRotation(0,180,0)
camera:Move(0,1,-2)
local light = DirectionalLight:Create()
light:SetRotation(35,35,0)
local model = Model:Load("Models/Grass/grass01.mdl")
local surface = model:GetSurface(0)
for v=0,surface:CountVertices()-1 do
surface:SetVertexColor(v,2,0.5,2,1)
end
while true do
if window:Closed() or window:KeyHit(Key.Escape) then return false end
Time:Update()
world:Update()
world:Render()
context:Sync()
end