Lagrange
lights.h
1/*
2 * Copyright 2021 Adobe. All rights reserved.
3 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License. You may obtain a copy
5 * of the License at http://www.apache.org/licenses/LICENSE-2.0
6 *
7 * Unless required by applicable law or agreed to in writing, software distributed under
8 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9 * OF ANY KIND, either express or implied. See the License for the specific language
10 * governing permissions and limitations under the License.
11 */
12#pragma once
13
14#include <lagrange/ui/api.h>
15#include <lagrange/ui/Entity.h>
16#include <lagrange/ui/components/Light.h>
17#include <lagrange/ui/types/Color.h>
18
19
20namespace lagrange {
21namespace ui {
22
23inline Eigen::Vector3f get_canonical_light_direction()
24{
25 return Eigen::Vector3f(0, 0, 1);
26}
27
28
29LA_UI_API Entity add_point_light(
30 Registry& r,
31 Eigen::Vector3f intensity = Eigen::Vector3f::Ones(),
32 Eigen::Vector3f position = Eigen::Vector3f::Zero());
33
34LA_UI_API Entity add_directional_light(
35 Registry& r,
36 Eigen::Vector3f intensity = Eigen::Vector3f::Ones(),
37 Eigen::Vector3f direction = -Eigen::Vector3f::UnitY());
38
39LA_UI_API Entity add_spot_light(
40 Registry& r,
41 Eigen::Vector3f intensity = Eigen::Vector3f::Ones(),
42 Eigen::Vector3f position = Eigen::Vector3f::Ones(),
43 Eigen::Vector3f direction = -Eigen::Vector3f::Ones(),
44 float cone_angle = pi() / 4.0f);
45
46
47LA_UI_API std::pair<Eigen::Vector3f, Eigen::Vector3f> get_light_position_and_direction(
48 const Registry& r,
49 Entity e);
50
51
52LA_UI_API void clear_lights(Registry& r);
53
54} // namespace ui
55} // namespace lagrange
Lagrange UI Viewer and mini 3D engine.
Definition: AcceleratedPicking.h:22
Main namespace for Lagrange.
Definition: AABBIGL.h:30