GetLightQuality

This function sets the world's light quality setting. This will effect the softness of shadow edges, and will also affect how far in the distance directional light shadows are visible.

Syntax

Returns

This function returns an integer indicating the light quality:
0: Low
1: Medium
2: High
The engine normally defaults to medium quality, but will use low quality if Intel graphics are detected.

Example

#include "Leadwerks.h"

using namespace Leadwerks;

SpotLight* light = 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();
window = Window::Create();
context = Context::Create(window);
world = World::Create();
camera = Camera::Create();
camera->SetRotation(35, 0, 0);
camera->Move(0, 0, -8);

//Create a model
Model* model = Model::Box();
model->SetColor(0.0, 1.0, 0.0);
model->SetScale(10, 1, 10);

light = SpotLight::Create();
light->SetPosition(0, 3, 0);
light->Turn(90, 0, 0);
light->SetConeAngles(10, 7.5);

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

float delta = (window->KeyDown(Key::Up) - window->KeyDown(Key::Down)) * Leadwerks::Time::GetSpeed() * 0.1;
Vec2 angles = light->GetConeAngles();
angles.x += delta;
angles.x = Math::Clamp(angles.x, 1, 45);
angles.y = angles.x * 0.75;
light->SetConeAngles(angles.x, angles.y);

Leadwerks::Time::Update();
world->Update();
world->Render();

context->SetBlendMode(Blend::Alpha);
context->DrawText("Cone angles: " + angles.ToString(), 2, 2);
context->DrawText("Light quality: " + world->GetLightQuality(), 2, 20);

context->Sync();

}
return 0;
}