Lagrange
objectid_viewport.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
17
18namespace lagrange {
19namespace ui {
20
21struct ViewportComponent;
22struct SelectionContext;
23
25LA_UI_API int color_to_id(unsigned char r, unsigned char g, unsigned char b);
26
28LA_UI_API bool is_id_background(int id);
29
31LA_UI_API const std::vector<unsigned char>&
32read_pixels(Registry& r, ViewportComponent& v, int x, int y, int w, int h);
33
34
36LA_UI_API ViewportComponent& setup_offscreen_viewport(
37 Registry& r,
38 Entity ofscreen_viewport_entity,
39 Entity active_viewport_entity,
40 StringID override_shader);
41
43LA_UI_API std::tuple<int, int, int, int>
44setup_scissor(Registry& r, ViewportComponent& offscreen_viewport, const SelectionContext& sel_ctx);
45
46
47} // namespace ui
48} // namespace lagrange
Lagrange UI Viewer and mini 3D engine.
Definition: AcceleratedPicking.h:22
LA_UI_API std::tuple< int, int, int, int > setup_scissor(Registry &r, ViewportComponent &offscreen_viewport, const SelectionContext &sel_ctx)
Sets rasterizer scissor based on SelectionContext.
Definition: objectid_viewport.cpp:87
LA_UI_API bool is_id_background(int id)
Is numerical ID from shader a background?
Definition: objectid_viewport.cpp:38
LA_UI_API const std::vector< unsigned char > & read_pixels(Registry &r, ViewportComponent &v, int x, int y, int w, int h)
Read pixels of viewport in rectangle at x,y of size w,h.
Definition: objectid_viewport.cpp:43
LA_UI_API ViewportComponent & setup_offscreen_viewport(Registry &r, Entity ofscreen_viewport_entity, Entity active_viewport_entity, StringID override_shader)
Copies properties of active viewport to offscreen viewport, sets up a material override using overrid...
Definition: objectid_viewport.cpp:62
LA_UI_API int color_to_id(unsigned char r, unsigned char g, unsigned char b)
Translates shader output color to numerial ID.
Definition: objectid_viewport.cpp:32
Main namespace for Lagrange.
Definition: AABBIGL.h:30