SetAmbientLight

This function sets a world's ambient light level. This is the minimum light level a surface will be rendered with when no other lights are present.

Syntax

Parameters

Example

#include "Leadwerks.h"

using namespace Leadwerks;

Model* model = NULL;
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();
camera->Turn(35,0,0);
camera->Move(0,0,-3);

//Create a directional light with an orange tint
Light* light = DirectionalLight::Create();
light->SetRotation(35,45,0);
light->SetColor(1.5,1.3,0.6);

//Set the ambient light level to dark blue
world->SetAmbientLight(0.08,0.08,0.18);

//Create a model
model = Model::Box();

while (true)
{
if (window->Closed() || window->KeyDown(Key::Escape)) return false;

model->Turn(0,Leadwerks::Time::GetSpeed(),0);

Leadwerks::Time::Update();
world->Update();
world->Render();
context->Sync(false);

}
return 0;
}