-
-
Notifications
You must be signed in to change notification settings - Fork 29
Adding lights
Romain Milbert edited this page Feb 22, 2020
·
11 revisions
RaZ supports for now two types of lights:
- A PointLight is a light source defined by its position (imagine a light bulb, for example).
- A DirectionalLight is a light source defined by its direction, illuminating your scene the same way wherever your light is.
// White point light, floating above the ground
Raz::LightPtr pointLight = Raz::PointLight::create(Raz::Vec3f(0.f, 1.f, 0.f), // Position
10.f, // Energy
Raz::Vec3f(1.f, 1.f, 1.f)); // Color (R/G/B)
// Cyan directional light, pointing to the bottom left
// Since a directional light illuminates only the objects it's pointing to, its position doesn't matter much
Raz::LightPtr directionalLight = Raz::DirectionalLight::create(Raz::Vec3f(-1.f, -1.f, 0.f), // Direction
10.f, // Energy
Raz::Vec3f(0.f, 1.f, 1.f), // Color (R/G/B)
Raz::Vec3f(0.f, 0.f, 0.f)); // Position
You can then add these lights to your scene; default shaders allow up to ten lights.
- Home
- How to build RaZ
- Getting started
- General usage knowledge
- Some examples...
- Playground
- Tutorials
- File formats
- Modules
- Debug