Lua
C++
Edit

LoadMaterial

This function loads a material from a file or open stream.

Syntax

Parameter Description
path path or URL to the file to be loaded
stream an open file stream to load the asset from
flags LoadFlags parameter to use

Remarks

Any of the values below may be combined in the flags parameter:

Example

--Get the primary display
local displays = GetDisplays()

--Create a window
local window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[1], WINDOW_TITLEBAR)

--Create a rendering framebuffer
local framebuffer = CreateFramebuffer(window);

--Create a world
local world = CreateWorld()
world:SetAmbientLight(1)

--Create a camera
local camera = CreateCamera(world)
camera:Move(0,0,-1)

--Display material
local model = CreateBox(world)

--Load material
local mtl = LoadMaterial("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/brickwall01.mtl")
if mtl ~= nil then model:SetMaterial(mtl) end

--Main loop
while window:Closed() == false do
    world:Update()
    world:Render(framebuffer)
end
Copyright © 2024 Ultra Software.
All rights reserved.