Load

This function loads a material from a material (*.mat) file.

Syntax

Parameters

Returns

Returns the loaded material. If the material cannot be loaded, NULL is returned.

Example

#include "Leadwerks.h"

using namespace Leadwerks;

int main(int argc, const char *argv[])
{
Leadwerks::Window* window = Leadwerks::Window::Create();
Context* context = Context::Create(window);
World* world = World::Create();
Camera* camera = Camera::Create();
Light* light = DirectionalLight::Create();
light->SetRotation(45, 35, 0);

//Create a material
Material* material = Material::Load("Materials/Grass/grass01.mat");

//Create a model
Model* model = Model::Sphere();
model-> SetMaterial(material);
model-> SetPosition(0, 0, 3);

while (true)
{
if (window->Closed() || window->KeyDown(Key::Escape)) return false;
Leadwerks::Time::Update();
world -> Update();
world -> Render();
context->Sync();
}
return 0;
}