Lagrange
lagrange::ui Namespace Reference

Lagrange UI Viewer and mini 3D engine. More...

Classes

class  AABB
 
struct  AcceleratedPicking
 
struct  AttributeRender
 
struct  Bounds
 Extent in 3D defined by Axis Aligned Bounding Box. More...
 
class  Camera
 Camera class. More...
 
struct  CameraChangedEvent
 Triggered when Camera component has changed in the default systems. More...
 
struct  CameraController
 
struct  CameraFocusAndFit
 
struct  CameraTurntable
 
class  Color
 
struct  ColormapShaderMode
 
struct  ComponentPanel
 
struct  DefaultLayers
 
struct  DefaultPanels
 
struct  DefaultShaderAtrribNames
 
struct  DefaultShaderIndicesNames
 
struct  DefaultShaders
 
struct  DefaultSystems
 IDs of default systems, in order of execution See Systems class for manipulation of systems execution. More...
 
struct  DefaultTools
 
struct  DehoveredEvent
 Triggered when Hovered component is removed from an entity. More...
 
struct  DeselectedEvent
 Triggered when Selected component is removed from an entity. More...
 
struct  Dockspace
 
struct  ElementEdge
 
struct  ElementFace
 
struct  ElementObject
 
struct  ElementVertex
 
struct  EventEmitter
 
class  FileDialogPath
 RAII Wrapper for fs::path obtained from a file dialog. More...
 
struct  FileFilter
 File filter option. More...
 
struct  FocusedViewportPanel
 
class  FrameBuffer
 
class  Frustum
 Frustum defined using 6 planes. More...
 
struct  GizmoContext
 Gizmo system state (context variable) More...
 
struct  GizmoObjectTransform
 GizmoObjectTransform component is attached to every entity being transformed by the gizmo system. More...
 
struct  GLMesh
 
struct  GlobalTime
 
struct  GLQuery
 
struct  GLRenderQueueItem
 
struct  GLScope
 
struct  GLState
 
struct  GPUBuffer
 
struct  Hovered
 
struct  HoveredEvent
 Triggered when Hovered component is added to an entity. More...
 
struct  HoveredTemp
 
struct  IBL
 
struct  IBLChangedEvent
 Triggered when IBL has changed. More...
 
struct  ImmediateEntities
 
struct  InputState
 
class  Keybinds
 Stores keybinds for actions. More...
 
struct  LastTool
 
struct  Layer
 
struct  LightComponent
 Light component By default, light points in the +Z direction, unless transformed. More...
 
struct  LightComponentChangedEvent
 Triggered when Light component has changed. More...
 
class  LogData
 
struct  LoggerContextData
 
struct  LoggerPanel
 
struct  MainMenuHeight
 
class  Material
 
struct  MeshData
 
struct  MeshDataDirty
 
struct  MeshElementIDMaterial
 
struct  MeshGeometry
 
struct  MeshRender
 
struct  MeshRenderChangedEvent
 Triggered when MeshRender component has changed. More...
 
struct  MeshSelectionRender
 Singleton component storing materials and temporary entities for selected mesh element visualization. More...
 
struct  Name
 
struct  ObjectIDViewport
 
class  PaginatedMatrixWidget
 
struct  PayloadComponent
 Payload for sending components through UI. More...
 
struct  PayloadEntity
 Payload for sending entities through UI. More...
 
struct  PBRMaterial
 
struct  PostProcessQuadVertexData
 
struct  RasterizerOptions
 Rasterization pipeline option names. More...
 
struct  RayFacetHit
 
struct  RenderContext
 
struct  RotateToolTag
 
struct  ScaleToolTag
 
struct  ScenePanel
 
struct  Selected
 
struct  SelectedEvent
 Triggered when Selected component is added to an entity. More...
 
struct  SelectionContext
 Global component with information about current viewport selection. More...
 
struct  SelectionViewport
 
struct  SelectToolTag
 
class  Shader
 
struct  ShaderBoolProperty
 
struct  ShaderColorProperty
 
struct  ShaderDefinition
 
class  ShaderException
 
struct  ShaderFloatProperty
 
struct  ShaderIntProperty
 
struct  ShaderLoader
 
struct  ShaderProperty
 
struct  ShaderTextureProperty
 
struct  ShaderTextureValue
 
struct  ShaderValue
 
struct  ShaderVectorProperty
 
struct  ShadowMap
 
struct  ShadowMapFBO
 
struct  ShadowmappingViewport
 
struct  SkyboxCubeVertexData
 
struct  SubSelection
 
class  Systems
 Container for Systems. More...
 
struct  TemporaryLigthVisualization
 
class  Texture
 
struct  ToolbarPanel
 
class  Tools
 
struct  Transform
 Affine transformation. More...
 
struct  TransformChangedEvent
 Triggered when Transform component has changed Only monitors global transform (not local) Note: this check is only performed when at least one listener is registered. More...
 
struct  TranslateToolTag
 
struct  TreeNode
 
struct  type_traits
 
struct  type_traits< double >
 
struct  type_traits< float >
 
struct  type_traits< int16_t >
 
struct  type_traits< int32_t >
 
struct  type_traits< int8_t >
 
struct  type_traits< uint16_t >
 
struct  type_traits< uint32_t >
 
struct  type_traits< uint8_t >
 
struct  UIPanel
 
class  UIWidget
 
struct  VAO
 
struct  VertexBuffer
 
struct  VertexData
 
class  Viewer
 Viewer use systems() to add functions that should be called every frame use registry() or util functions to read and manipulate application's state. More...
 
struct  ViewportComponent
 
struct  ViewportPanel
 
struct  WindowCloseEvent
 
struct  WindowDropEvent
 
struct  WindowResizeEvent
 
struct  WindowSize
 

Typedefs

using LayerIndex = std::uint8_t
 
using Registry = entt::registry
 
using Entity = entt::entity
 
using System = std::function< void(Registry &registry)>
 
using StringID = entt::id_type
 
using ShaderDefines = std::vector< std::pair< std::string, std::string > >
 
using ShaderCache = entt::resource_cache< Shader, ShaderLoader >
 
using ShaderResource = entt::resource< Shader >
 
using RegisteredShaders = std::unordered_map< entt::id_type, ShaderDefinition >
 
using RowMajorMatrixXf = Eigen::Matrix< float, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor >
 
using RowMajorMatrixXi = Eigen::Matrix< int, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor >
 
using Scheme = std::unordered_map< std::string, std::pair< ImGuiKey, std::vector< ImGuiKey > > >
 
using GLRenderQueue = std::vector< GLRenderQueueItem >
 
using LayerNames = std::array< std::string, get_max_layers()>
 

Enumerations

enum class  Glyph {
  Surface , Line , Wire , Arrow ,
  Point
}
 
enum class  DefaultCameraScheme { DIMENSION , MAYA , BLENDER , SUBSTANCE }
 Default camera scheme based on other software To create your own,. More...
 
enum class  IndexingMode {
  VERTEX , EDGE , FACE , CORNER ,
  INDEXED
}
 
enum class  PrimitiveType { POINTS , LINES , TRIANGLES }
 
enum class  SelectionBehavior { SET , ADD , ERASE }
 
enum class  GizmoMode {
  SELECT , TRANSLATE , ROTATE , SCALE ,
  count
}
 
enum  FrustumPlanes : unsigned int {
  FRUSTUM_NEAR = 0 , FRUSTUM_FAR , FRUSTUM_LEFT , FRUSTUM_RIGHT ,
  FRUSTUM_TOP , FRUSTUM_BOTTOM
}
 
enum  FrustumVertices : unsigned int {
  FRUSTUM_NEAR_LEFT_BOTTOM = 0 , FRUSTUM_FAR_LEFT_BOTTOM , FRUSTUM_NEAR_RIGHT_BOTTOM , FRUSTUM_FAR_RIGHT_BOTTOM ,
  FRUSTUM_NEAR_LEFT_TOP , FRUSTUM_FAR_LEFT_TOP , FRUSTUM_NEAR_RIGHT_TOP , FRUSTUM_FAR_RIGHT_TOP
}
 
enum  ShaderInterface { SHADER_INTERFACE_NONE = 0 , SHADER_INTERFACE_UNIFORM = 1 , SHADER_INTERFACE_ATTRIB = 2 }
 
enum class  FileSave { ConfirmOverwrite , SilentOverwrite }
 Controls the behavior of the file save dialog. More...
 
enum class  FolderOpen { LastOpened , ForcePath }
 Controls the behavior of the folder open dialog. More...
 

Functions

std::string get_name (const Registry &r, Entity e)
 
bool set_name (Registry &r, Entity e, const std::string &name)
 
const GlobalTimeget_time (const Registry &r)
 
constexpr size_t get_max_layers ()
 
RenderContextget_render_context (Registry &r)
 
ViewportComponentget_render_context_viewport (Registry &r)
 
Cameraget_viewport_camera (Registry &r, ViewportComponent &viewport)
 
const Cameraget_viewport_camera (const Registry &r, const ViewportComponent &viewport)
 
Cameraget_viewport_camera (Registry &r, Entity e)
 
const Cameraget_viewport_camera (const Registry &r, Entity e)
 
void register_default_component_widgets ()
 
LA_UI_API void set_material (Registry &r, Entity meshrender_entity, std::shared_ptr< Material > mat)
 
LA_UI_API Entity show_mesh (Registry &r, const Entity &mesh_entity, StringID shader=DefaultShaders::PBR, const ShaderDefines &shader_defines={})
 
LA_UI_API Entity show_submesh (Registry &r, const Entity &mesh_entity, std::shared_ptr< Material > material, entt::id_type submesh_id)
 
LA_UI_API Entity show_mesh (Registry &r, Entity mesh_entity, Entity scene_node_entity, StringID shader=DefaultShaders::PBR, const ShaderDefines &shader_defines={})
 
LA_UI_API Entity show_mesh (Registry &r, Entity mesh_entity, Entity scene_node_entity, std::shared_ptr< Material > material)
 
LA_UI_API Entity show_vertex_attribute (Registry &r, const Entity &mesh_entity, const std::string &attribute, Glyph glyph)
 
LA_UI_API Entity show_facet_attribute (Registry &r, const Entity &mesh_entity, const std::string &attribute, Glyph glyph)
 
LA_UI_API Entity show_edge_attribute (Registry &r, const Entity &mesh_entity, const std::string &attribute, Glyph glyph)
 
LA_UI_API Entity show_corner_attribute (Registry &r, const Entity &mesh_entity, const std::string &attribute, Glyph glyph)
 
LA_UI_API Entity show_indexed_attribute (Registry &r, const Entity &mesh_entity, const std::string &attribute, Glyph glyph)
 
LA_UI_API void set_colormap (Registry &r, Entity meshrender_entity, std::shared_ptr< Texture > texture)
 
LA_UI_API void set_colormap_range (Registry &r, Entity meshrender_entity, const Eigen::Vector4f &range_min, const Eigen::Vector4f &range_max)
 
LA_UI_API void set_colormap_range (Registry &r, Entity meshrender_entity, const std::pair< Eigen::VectorXf, Eigen::VectorXf > &range)
 
LA_UI_API std::shared_ptr< Materialget_material (Registry &r, Entity meshrender_entity)
 
Transformget_transform (Registry &r, Entity e)
 
template<typename Derived >
Eigen::Affine3f & set_transform (Registry &r, Entity e, const Derived &local_transform)
 
template<typename Derived >
Eigen::Affine3f & apply_transform (Registry &r, Entity e, const Derived &local_transform)
 
template<typename MeshType >
Entity add_mesh (Registry &r, std::shared_ptr< MeshType > mesh, const std::string &name="Unnamed mesh", StringID shader=DefaultShaders::PBR)
 
template<typename MeshType >
Entity add_mesh (Registry &r, std::unique_ptr< MeshType > mesh, const std::string &name="Unnamed mesh", StringID shader=DefaultShaders::PBR)
 
template<typename MeshType >
Entity load_mesh (Registry &r, const lagrange::fs::path &path_to_obj, bool load_materials=true, const std::string &name="Unnamed mesh", StringID shader=DefaultShaders::PBR)
 
LA_UI_API void set_mesh_vertices_dirty (Registry &r, Entity mesh_entity)
 
LA_UI_API void set_mesh_normals_dirty (Registry &r, Entity mesh_entity)
 
LA_UI_API void set_mesh_dirty (Registry &r, Entity mesh_entity)
 
LA_UI_API void set_show_attribute_dirty (Registry &r, Entity scene_entity)
 
LA_UI_API void set_mesh_attribute_dirty (Registry &r, Entity mesh_entity, IndexingMode mode, const std::string &name)
 
LA_UI_API Entity get_meshdata_entity (Registry &r, Entity scene_entity)
 
LA_UI_API MeshDataget_meshdata (Registry &r, Entity scene_or_mesh_entity)
 
std::shared_ptr< Material > LA_UI_API create_material (Registry &r, entt::id_type shader_id, const ShaderDefines &shader_defines={})
 
LA_UI_API Entity add_camera (Registry &r, const Camera &camera=Camera::default_camera(1, 1))
 
LA_UI_API void clear_scene (Registry &r)
 
LA_UI_API std::optional< std::pair< Entity, RayFacetHit > > intersect_ray (Registry &r, const Eigen::Vector3f &origin, const Eigen::Vector3f &dir, ui::Entity root=ui::NullEntity, Layer visible_layers=Layer(true), Layer hidden_layers=Layer(false))
 Intersect ray with meshes in root's hierarchy Returns a pair of intersected entity and the corresponding hit If root == ui::NullEntity, entire scene is traversed.
 
LA_UI_API IBL generate_default_ibl (size_t resolution=256)
 Creates pre-packaged IBL. More...
 
LA_UI_API void set_camera_scheme (Keybinds &keybinds, DefaultCameraScheme camera_scheme)
 Set camera control scheme from DefaultCameraScheme. More...
 
LA_UI_API bool has_camera_scheme (const Keybinds &keybinds, DefaultCameraScheme camera_scheme)
 Do the keybinds have one of the default camera schemes?
 
LA_UI_API Keybinds initialize_default_keybinds ()
 Initializes all default keybinds.
 
LA_UI_API DefaultPanels add_default_panels (Registry &registry)
 
LA_UI_API void reset_layout (Registry &registry)
 
LA_UI_API void register_default_shaders (Registry &r)
 
LA_UI_API void register_default_tools (Tools &tools)
 
LA_UI_API void select (Registry &r, const std::function< void(Registry &)> &selection_system)
 
StringID string_id (const std::string &str)
 
StringID string_id (const char *str)
 
template<typename T >
void component_clone (Registry *w, Entity src, Entity dst)
 
template<typename T >
void component_move (Registry *w, Entity src, Entity dst)
 
template<typename T >
void component_add_default (Registry *w, Entity dst)
 
template<typename Component >
void register_component (const std::string &display_name=entt::type_id< Component >().name().data())
 
template<typename Component , auto Func>
void register_component_widget ()
 
template<typename Component >
void register_component_widget (const std::function< void(Registry *, Entity)> &fn)
 
void show_widget (Registry &w, Entity e, const entt::meta_type &meta_type)
 
template<typename Resolvable >
void show_widget (Registry &r, Entity e, const Resolvable &resolvable)
 
LA_UI_API bool button_unstyled (const char *label)
 
LA_UI_API bool button_toolbar (bool selected, const std::string &label, const std::string &tooltip="", const std::string &keybind_id="", const Keybinds *keybinds=nullptr, bool enabled=true)
 
LA_UI_API bool button_icon (bool selected, const std::string &label, const std::string &tooltip="", const std::string &keybind_id="", const Keybinds *keybinds=nullptr, bool enabled=true, ImVec2 size=ImVec2(0, 0))
 
LA_UI_API Entity add_component_panel (Registry &r, const std::string &name="Components")
 
LA_UI_API Entity add_keybinds_panel (Registry &r, const std::string &name="Keybinds")
 
LA_UI_API Entity add_logger_panel (Registry &r, const std::string &name="Logger")
 
LA_UI_API std::shared_ptr< spdlog::sinks::sink > get_logger_sink (Registry &r)
 
LA_UI_API Entity add_renderer_panel (Registry &r, const std::string &name="Renderer")
 
LA_UI_API Entity add_scene_panel (Registry &r, const std::string &name="Scene")
 
LA_UI_API Entity add_toolbar_panel (Registry &r, const std::string &name="Toolbar")
 
LA_UI_API Entity add_viewport_panel (Registry &r, const std::string &name, Entity viewport)
 
LA_UI_API void camera_controller_system (Registry &registry)
 Adjust camera based on CameraController.
 
LA_UI_API void camera_turntable_system (Registry &registry)
 Rotates Camera based on CameraTurntable component.
 
LA_UI_API void camera_focusfit_system (Registry &registry)
 Zooms Camera based on CameraZoomToFit component.
 
LA_UI_API void render_background (Registry &registry)
 
LA_UI_API void setup_vertex_data (Registry &registry)
 
LA_UI_API void render_geometry (Registry &registry)
 
LA_UI_API void render_post_process (Registry &registry)
 
LA_UI_API void render_shadowmaps (Registry &registry)
 
LA_UI_API void render_viewport (Registry &registry, Entity e)
 Render viewport Renders all geometry visible in this viewport into the viewport's framebuffer.
 
LA_UI_API void render_viewports (Registry &registry)
 Render all enabled viewports. More...
 
LA_UI_API void update_accelerated_picking (Registry &r)
 
LA_UI_API bool gizmo_system_is_using ()
 
LA_UI_API bool gizmo_system_is_over ()
 
LA_UI_API void gizmo_system_set_draw_list ()
 
LA_UI_API void gizmo_system (Registry &registry, const Camera &camera, const Eigen::Vector2f &canvas_pos, GizmoMode mode=GizmoMode::SELECT)
 
LA_UI_API void update_lights_system (Registry &registry)
 
LA_UI_API void update_mesh_bounds_system (Registry &ctx)
 
LA_UI_API void update_mesh_buffers_system (Registry &ctx)
 
LA_UI_API void update_mesh_elements_hovered (Registry &r)
 
LA_UI_API void update_mesh_hovered (Registry &ctx)
 Sets <Hovered> component if the mesh is hovered a ViewportPanel. More...
 
LA_UI_API void update_scene_bounds_system (Registry &ctx)
 Sets context <AABB> variable.
 
LA_UI_API void update_transform_hierarchy (Registry &registry)
 
LA_UI_API entt::id_type register_shader_as (Registry &r, entt::id_type id, const ShaderDefinition &def)
 
LA_UI_API entt::id_type register_shader (Registry &r, const ShaderDefinition &def)
 
LA_UI_API entt::id_type register_shader (Registry &r, const std::string &path, const std::string &display_name)
 
LA_UI_API entt::id_type register_shader_variant (Registry &r, entt::id_type id, const ShaderDefines &shader_defines)
 
LA_UI_API ShaderResource get_shader (Registry &r, entt::id_type id)
 
LA_UI_API RegisteredShaders & get_registered_shaders (Registry &r)
 
LA_UI_API ShaderCache & get_shader_cache (Registry &r)
 
LA_UI_API bool add_file_to_shader_virtual_fs (const std::string &virtual_path, const std::string &contents, bool overwrite=false)
 Creates a file using virtual_path with contents in the shader virtual file system. More...
 
template<typename T >
entt::id_type register_tool_type (const std::string &display_name, const std::string &icon, const std::string &keybind)
 
LA_UI_API AABB get_bounding_box (const Registry &registry, Entity e)
 Returns Axis Aligned Bounding Box of the entity in world space If entity does not have bounds, returns an empty AABB.
 
LA_UI_API AABB get_bounding_box_local (const Registry &registry, Entity e)
 Returns Axis Aligned Bounding Box of the entity in model space If entity does not have bounds, returns an empty AABB.
 
LA_UI_API AABB get_selection_bounding_box (const Registry &registry)
 Returns Axis Aligned Bounding Box of all entities with <Selected> component If there's no selection returns an empty AABB.
 
LA_UI_API float get_nearest_bounds_distance (const Registry &registry, const Eigen::Vector3f &from, const Layer &visible, const Layer &hidden)
 Returns the least distance between from and any point within any bounding box. More...
 
LA_UI_API float get_furthest_bounds_distance (const Registry &registry, const Eigen::Vector3f &from, const Layer &visible, const Layer &hidden)
 Returns the greatest distance between from and any point within any bounding box. More...
 
LA_UI_API AABB get_scene_bounding_box (const Registry &registry)
 Returns the bounding box of everything (must be set as context variable after update_scene_bounds)
 
LA_UI_API const Boundsget_scene_bounds (const Registry &registry)
 Returns the bounds of everything (must be set as context variable after update_scene_bounds)
 
LA_UI_API Boundsget_scene_bounds (Registry &registry)
 
LA_UI_API Color colormap_viridis (float t)
 
LA_UI_API Color colormap_magma (float t)
 
LA_UI_API Color colormap_plasma (float t)
 
LA_UI_API Color colormap_inferno (float t)
 
LA_UI_API Color colormap_turbo (float t)
 
LA_UI_API Color colormap_coolwarm (float t)
 
LA_UI_API std::shared_ptr< Texturegenerate_colormap (const std::function< Color(float)> &generator, int resolution=256)
 
EventEmitterget_event_emitter (Registry &r)
 
template<typename Event >
void on (Registry &r, std::function< void(Event &)> listener)
 Register a listener for Event. More...
 
template<typename Event , typename... Args>
void publish (Registry &r, Args &&... args)
 Trigger an event of type Event. More...
 
template<typename Event >
void forward_entity_event (Registry &r, Entity e)
 Utility function for forwarding events that contain only an entity identifier.
 
template<typename Component , typename ConstructEvent , typename DestroyEvent >
void toggle_component_event (Registry &r)
 Enable/Disable on_construct and on_destroy events depending on whether ConstructEvent and DestroyEvent have any listeners.
 
LA_UI_API FileDialogPath open_file (const std::string &title, const fs::path &default_path=".", const std::vector< FileFilter > &filters={{"All Files", "*"}})
 Opens a native file dialog to open a single file. More...
 
LA_UI_API std::vector< FileDialogPathopen_files (const std::string &title, const fs::path &default_path=".", const std::vector< FileFilter > &filters={{"All Files", "*"}})
 Opens a native file dialog to open multiple files. More...
 
LA_UI_API FileDialogPath save_file (const std::string &title, const fs::path &default_path=".", const std::vector< FileFilter > &filters={{"All Files", "*"}}, FileSave overwrite_behavior=FileSave::ConfirmOverwrite)
 Opens a native file dialog to save a file. More...
 
LA_UI_API FileDialogPath open_folder (const std::string &title, const fs::path &default_path=".", FolderOpen open_behavior=FolderOpen::LastOpened)
 Opens a native file dialog to select a folder. More...
 
LA_UI_API IBL generate_ibl (const fs::path &path, size_t resolution=1024)
 Utility functions for Image Based Lights (IBLs) More...
 
LA_UI_API IBL generate_ibl (const std::shared_ptr< Texture > &background_texture, size_t resolution=1024)
 Generates Image Based Light from given rectangular texture. More...
 
LA_UI_API Entity get_ibl_entity (const Registry &registry)
 Returns first <IBL> entity found in registry. More...
 
LA_UI_API const IBLget_ibl (const Registry &registry)
 Returns pointer to the first IBL found in the registry. More...
 
LA_UI_API IBLget_ibl (Registry &registry)
 
LA_UI_API Entity add_ibl (Registry &registry, IBL ibl)
 Adds IBL to the scene.
 
LA_UI_API void clear_ibl (Registry &registry)
 Removes all ibls.
 
LA_UI_API bool save_ibl (const IBL &ibl, const fs::path &folder)
 Saves IBL as individual .png files in given folder. More...
 
LA_UI_API void render_points (Registry &r, const std::vector< Eigen::Vector3f > &points)
 
LA_UI_API void render_point (Registry &r, const Eigen::Vector3f &point)
 
LA_UI_API void render_lines (Registry &r, const std::vector< Eigen::Vector3f > &lines)
 
LA_UI_API void upload_immediate_system (Registry &r)
 
LA_UI_API InputStateget_input (Registry &r)
 
LA_UI_API const InputStateget_input (const Registry &r)
 
LA_UI_API Keybindsget_keybinds (Registry &r)
 
LA_UI_API const Keybindsget_keybinds (const Registry &r)
 
LA_UI_API InputState::Mouseget_mouse (Registry &r)
 
LA_UI_API const InputState::Mouseget_mouse (const Registry &r)
 
LA_UI_API std::shared_ptr< Textureload_texture (const fs::path &path, const Texture::Params &params=Texture::Params())
 
LA_UI_API std::shared_ptr< Materialconvert_material (Registry &r, const fs::path &base_dir, const tinyobj::material_t &tinymat)
 Convertrs tinyobj's material_t to UI's Material. More...
 
template<typename MeshType >
Entity load_obj (Registry &r, const fs::path &path, const io::MeshLoaderParams &params=io::MeshLoaderParams())
 Loads obj as a single mesh. More...
 
template<typename MeshType >
std::pair< Entity, std::vector< std::shared_ptr< Material > > > load_obj_with_materials (Registry &r, const fs::path &path, const io::MeshLoaderParams &params=io::MeshLoaderParams())
 Loads obj as a single mesh and materials. More...
 
LA_UI_API void add_to_layer (Registry &registry, Entity e, LayerIndex index)
 
LA_UI_API void remove_from_layer (Registry &registry, Entity e, LayerIndex index)
 
LA_UI_API bool is_in_layer (Registry &registry, Entity e, LayerIndex index)
 
LA_UI_API bool is_in_any_layers (Registry &registry, Entity e, Layer layers_bitset)
 
LA_UI_API bool is_visible_in (const Registry &registry, Entity e, const Layer &visible_layers, const Layer &hidden_layers)
 
LA_UI_API LayerIndex get_next_available_layer_index (Registry &r)
 
LA_UI_API LayerIndex register_layer_name (Registry &registry, const std::string &name, LayerIndex index)
 
LA_UI_API LayerIndex register_layer_name (Registry &registry, const std::string &name)
 
LA_UI_API const std::string & get_layer_name (Registry &registry, LayerIndex index)
 
LA_UI_API void register_default_layer_names (Registry &registry)
 
Eigen::Vector3f get_canonical_light_direction ()
 
LA_UI_API Entity add_point_light (Registry &r, Eigen::Vector3f intensity=Eigen::Vector3f::Ones(), Eigen::Vector3f position=Eigen::Vector3f::Zero())
 
LA_UI_API Entity add_directional_light (Registry &r, Eigen::Vector3f intensity=Eigen::Vector3f::Ones(), Eigen::Vector3f direction=-Eigen::Vector3f::UnitY())
 
LA_UI_API Entity add_spot_light (Registry &r, Eigen::Vector3f intensity=Eigen::Vector3f::Ones(), Eigen::Vector3f position=Eigen::Vector3f::Ones(), Eigen::Vector3f direction=-Eigen::Vector3f::Ones(), float cone_angle=pi()/4.0f)
 
LA_UI_API std::pair< Eigen::Vector3f, Eigen::Vector3f > get_light_position_and_direction (const Registry &r, Entity e)
 
LA_UI_API void clear_lights (Registry &r)
 
template<typename... Args>
void log_once (ui::Registry &r, spdlog::level::level_enum level, const std::string_view &fmt, Args &&... args)
 Log message once per registry lifetime.
 
template<typename... Args>
void log_trace_once (ui::Registry &r, const std::string_view &fmt, Args &&... args)
 
template<typename... Args>
void log_debug_once (ui::Registry &r, const std::string_view &fmt, Args &&... args)
 
template<typename... Args>
void log_info_once (ui::Registry &r, const std::string_view &fmt, Args &&... args)
 
template<typename... Args>
void log_warn_once (ui::Registry &r, const std::string_view &fmt, Args &&... args)
 
template<typename... Args>
void log_error_once (ui::Registry &r, const std::string_view &fmt, Args &&... args)
 
template<typename... Args>
void log_critical_once (ui::Registry &r, const std::string_view &fmt, Args &&... args)
 
LA_UI_API Eigen::Matrix4f normal_matrix (const Eigen::Affine3f &transform)
 Returns 4x4 transformation matrix that can be used for normals Performs transpose inverse.
 
LA_UI_API Eigen::Projective3f perspective (float fovy, float aspect, float zNear, float zFar)
 Constructs perspective projection matrix. More...
 
LA_UI_API Eigen::Projective3f ortho (float left, float right, float bottom, float top, float zNear, float zFar)
 Constructs orthograpic projection matrix. More...
 
LA_UI_API Eigen::Matrix4f look_at (const Eigen::Vector3f &eye, const Eigen::Vector3f &center, const Eigen::Vector3f &up)
 Constructs "look at" view matrix,. More...
 
LA_UI_API Eigen::Vector3f unproject_point (const Eigen::Vector3f &v, const Eigen::Matrix4f &view, const Eigen::Matrix4f &perspective, const Eigen::Vector4f &viewport)
 Unprojects screen point (with x,y in screen coordinates and z in NDC) back to 3D world. More...
 
LA_UI_API float pi ()
 
LA_UI_API float two_pi ()
 2 * pi
 
LA_UI_API Eigen::Vector3f vector_projection (const Eigen::Vector3f &vector, const Eigen::Vector3f &onto)
 Projects vector onto 'onto' vector.
 
LA_UI_API float vector_angle (const Eigen::Vector3f &a, const Eigen::Vector3f &b)
 Returns angle in radians between a and b.
 
template<typename MeshType >
Entity register_mesh (Registry &r, std::shared_ptr< MeshType > mesh)
 
template<typename MeshType >
Entity register_mesh (Registry &r, std::unique_ptr< MeshType > mesh)
 
template<typename V , typename F >
lagrange::Mesh< V, F > & cast_mesh (MeshData &mesh_data)
 
template<typename MeshType >
MeshTypeget_mesh (Registry &r, Entity e)
 
LA_UI_API MeshDataget_mesh_data (Registry &r, Entity e)
 
LA_UI_API const MeshDataget_mesh_data (const Registry &r, Entity e)
 
LA_UI_API bool has_mesh_component (const Registry &r, Entity e)
 
LA_UI_API size_t get_num_vertices (const MeshData &d)
 
LA_UI_API size_t get_num_facets (const MeshData &d)
 
LA_UI_API size_t get_num_edges (const MeshData &d)
 
LA_UI_API RowMajorMatrixXf get_mesh_vertices (const MeshData &d)
 
LA_UI_API RowMajorMatrixXi get_mesh_facets (const MeshData &d)
 
LA_UI_API RowMajorMatrixXf get_mesh_vertex_attribute (const MeshData &d, const std::string &name)
 
LA_UI_API RowMajorMatrixXf get_mesh_corner_attribute (const MeshData &d, const std::string &name)
 
LA_UI_API RowMajorMatrixXf get_mesh_facet_attribute (const MeshData &d, const std::string &name)
 
LA_UI_API RowMajorMatrixXf get_mesh_edge_attribute (const MeshData &d, const std::string &name)
 
LA_UI_API RowMajorMatrixXf get_mesh_attribute (const MeshData &d, IndexingMode mode, const std::string &name)
 
std::pair< Eigen::VectorXf, Eigen::VectorXf > LA_UI_API get_mesh_attribute_range (const MeshData &d, IndexingMode mode, const std::string &name)
 
LA_UI_API AABB get_mesh_bounds (const MeshData &d)
 
LA_UI_API void ensure_uv (MeshData &d)
 
LA_UI_API void ensure_normal (MeshData &d)
 
LA_UI_API void ensure_tangent_bitangent (MeshData &d)
 
LA_UI_API void ensure_is_selected_attribute (MeshData &d)
 
LA_UI_API void map_indexed_attribute_to_corner_attribute (MeshData &d, const std::string &name)
 
LA_UI_API void map_corner_attribute_to_vertex_attribute (MeshData &d, const std::string &name)
 
LA_UI_API void upload_mesh_vertices (const MeshData &d, GPUBuffer &gpu)
 
LA_UI_API void upload_mesh_triangles (const MeshData &d, GPUBuffer &gpu)
 
LA_UI_API void upload_mesh_vertex_attribute (const MeshData &d, const RowMajorMatrixXf &data, GPUBuffer &gpu)
 
LA_UI_API void upload_mesh_corner_attribute (const MeshData &d, const RowMajorMatrixXf &data, GPUBuffer &gpu)
 
LA_UI_API void upload_mesh_facet_attribute (const MeshData &d, const RowMajorMatrixXf &data, GPUBuffer &gpu)
 
LA_UI_API void upload_mesh_edge_attribute (const MeshData &d, const RowMajorMatrixXf &data, GPUBuffer &gpu)
 
LA_UI_API std::unordered_map< entt::id_type, std::shared_ptr< GPUBuffer > > upload_submesh_indices (const MeshData &d, const std::string &facet_attrib_name)
 
LA_UI_API bool has_mesh_vertex_attribute (const MeshData &d, const std::string &name)
 
LA_UI_API bool has_mesh_corner_attribute (const MeshData &d, const std::string &name)
 
LA_UI_API bool has_mesh_facet_attribute (const MeshData &d, const std::string &name)
 
LA_UI_API bool has_mesh_edge_attribute (const MeshData &d, const std::string &name)
 
LA_UI_API bool has_mesh_indexed_attribute (const MeshData &d, const std::string &name)
 
LA_UI_API std::optional< RayFacetHitintersect_ray (const MeshData &d, const Eigen::Vector3f &origin, const Eigen::Vector3f &dir)
 Intersect ray with MeshData.
 
LA_UI_API bool select_facets_in_frustum (MeshData &d, SelectionBehavior sel_behavior, const Frustum &frustum)
 
LA_UI_API void select_vertices_in_frustum (MeshData &d, SelectionBehavior sel_behavior, const Frustum &frustum)
 
LA_UI_API void select_edges_in_frustum (MeshData &d, SelectionBehavior sel_behavior, const Frustum &frustum)
 
LA_UI_API void propagate_corner_selection (MeshData &d, const std::string &attrib_name)
 
LA_UI_API void propagate_vertex_selection (MeshData &d, const std::string &attrib_name)
 
LA_UI_API void propagate_facet_selection (MeshData &d, const std::string &attrib_name)
 
LA_UI_API void combine_vertex_and_corner_selection (MeshData &d, const std::string &attrib_name)
 
LA_UI_API void select_facets_by_color (MeshData &d, const std::string &attrib_name, SelectionBehavior sel_behavior, const unsigned char *color_bytes, size_t colors_byte_size)
 
LA_UI_API void select_edges_by_color (MeshData &d, const std::string &attrib_name, SelectionBehavior sel_behavior, const unsigned char *color_bytes, size_t colors_byte_size)
 
LA_UI_API void select_vertices_by_color (MeshData &d, const std::string &attrib_name, SelectionBehavior sel_behavior, const unsigned char *color_bytes, size_t colors_byte_size)
 
LA_UI_API void select_facets (MeshData &d, SelectionBehavior sel_behavior, const std::vector< int > &facet_indices)
 
LA_UI_API void filter_closest_vertex (MeshData &d, const std::string &attrib_name, SelectionBehavior sel_behavior, const Camera &camera, const Eigen::Vector2i &viewport_pos)
 
template<typename V , typename F >
lagrange::Mesh< V, F > & cast_mesh (const Registry &r, Entity e)
 
Entity get_mesh_entity (Registry &r, Entity e)
 
template<typename MeshType >
void register_mesh_type (const std::string &display_name=entt::type_id< MeshType >().name().data())
 
LA_UI_API std::optional< RayFacetHitintersect_ray (Registry &r, Entity e, const Eigen::Vector3f &origin, const Eigen::Vector3f &dir)
 Mesh triangle X ray intersection Uses an accelerated data structure if enabled for entity e (use enable_accelerated_picking)
 
LA_UI_API bool select_visible_elements (Registry &r, StringID element_type, SelectionBehavior sel_behavior, Entity selected_entity, Entity active_viewport, Frustum local_frustum)
 Selects visible mesh elements (sets is_selected attribute) More...
 
LA_UI_API bool select_elements_in_frustum (Registry &r, StringID element_type, SelectionBehavior sel_behavior, Entity selected_entity, Frustum local_frustum)
 Selects mesh elements intersecting a frustum (sets is_selected attribute) More...
 
LA_UI_API void clear_element_selection_render (Registry &r, bool exclude_selected)
 
LA_UI_API MeshSelectionRenderensure_selection_render (Registry &r, Entity e)
 
LA_UI_API void update_selection_render (Registry &r, MeshSelectionRender &sel_render, const Entity &selected_mesh_entity, const StringID &current_element_type)
 Update materials and visibility of different mesh elements.
 
LA_UI_API void mark_selection_dirty (Registry &r, MeshSelectionRender &sel_render)
 
LA_UI_API bool enable_accelerated_picking (Registry &r, Entity e)
 Computes acceleration structure (igl::AABB) for faster ray-triangle intersection Entity can be entity with MeshGeometry or MeshData Returns false if entity does not have a mesh.
 
LA_UI_API bool has_accelerated_picking (Registry &r, Entity e)
 
LA_UI_API int color_to_id (unsigned char r, unsigned char g, unsigned char b)
 Translates shader output color to numerial ID.
 
LA_UI_API bool is_id_background (int id)
 Is numerical ID from shader a background?
 
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.
 
LA_UI_API ViewportComponentsetup_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 override_shader.
 
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.
 
LA_UI_API void set_render_transforms (GLScope &scope, Shader &shader, const Camera &camera, const Transform *transform=nullptr)
 
LA_UI_API void render_vertex_data (const VertexData &vd, GLenum primitive, GLsizei per_element_size)
 
LA_UI_API GLenum get_gl_primitive (const PrimitiveType &p)
 
LA_UI_API GLsizei get_gl_primitive_size (const PrimitiveType &p)
 
LA_UI_API GLsizei get_gl_primitive_size (GLenum primitive_enum)
 
LA_UI_API std::shared_ptr< VertexDatagenerate_cube_vertex_data (bool edges=false)
 
LA_UI_API std::shared_ptr< VertexDatagenerate_quad_vertex_data ()
 
LA_UI_API GLMesh generate_quad_mesh_gpu ()
 
LA_UI_API void update_vao (VertexData &vertex_data)
 
LA_UI_API entt::resource< Shaderget_or_load_shader (ShaderCache &cache, const std::string &generic_path, bool virtual_fs=false)
 
template<typename BufferComponent >
bool set_mesh_geometry_layout (const Registry &registry, const Entity mesh_geometry_entity, const int &location, VertexData &vertex_data)
 
LA_UI_API int get_gl_attribute_dimension (GLenum attrib_type)
 
LA_UI_API void update_vertex_data (const GLMesh &glmesh, const Shader &shader, VertexData &glvd, IndexingMode indexing, entt::id_type submesh_index)
 Assigns buffers from GLMesh to GLVertexData to Shader specified locations. More...
 
LA_UI_API bool deselect_all (Registry &registry)
 
LA_UI_API bool dehover_all (Registry &registry)
 
bool is_selected (const Registry &registry, Entity e)
 
bool is_hovered (const Registry &registry, Entity e)
 
decltype(auto) selected_view (Registry &registry)
 
decltype(auto) hovered_view (Registry &registry)
 
LA_UI_API bool is_child_selected (const Registry &registry, Entity e, bool recursive=true)
 
LA_UI_API bool is_child_hovered (const Registry &registry, Entity e, bool recursive=true)
 
LA_UI_API std::vector< Entity > collect_selected (const Registry &registry)
 
LA_UI_API std::vector< Entity > collect_hovered (const Registry &registry)
 
LA_UI_API bool set_selected (Registry &registry, Entity e, SelectionBehavior behavior=SelectionBehavior::SET)
 
LA_UI_API bool set_hovered (Registry &registry, Entity e, SelectionBehavior behavior=SelectionBehavior::SET)
 
LA_UI_API bool select (Registry &registry, Entity e)
 
LA_UI_API bool deselect (Registry &registry, Entity e)
 
LA_UI_API bool hover (Registry &registry, Entity e)
 
LA_UI_API bool dehover (Registry &registry, Entity e)
 
LA_UI_API SelectionContextget_selection_context (Registry &r)
 
LA_UI_API const SelectionContextget_selection_context (const Registry &r)
 
LA_UI_API SelectionBehavior selection_behavior (const Keybinds &keybinds)
 
LA_UI_API bool are_selection_keys_down (const Keybinds &keybinds)
 
LA_UI_API bool are_selection_keys_pressed (const Keybinds &keybinds)
 
LA_UI_API bool are_selection_keys_released (const Keybinds &keybinds)
 
LA_UI_API SelectionBehavior selection_behavior (const Registry &r)
 
LA_UI_API bool are_selection_keys_down (const Registry &r)
 
LA_UI_API bool are_selection_keys_pressed (const Registry &r)
 
LA_UI_API bool are_selection_keys_released (const Registry &r)
 
LA_UI_API Toolsget_tools (ui::Registry &r)
 
LA_UI_API const Toolsget_tools (const ui::Registry &r)
 
template<typename T >
bool is_element_type (entt::id_type elem_type)
 
LA_UI_API Toolsinitialize_tools (ui::Registry &r)
 Initialize Tools context variable.
 
LA_UI_API void run_current_tool (ui::Registry &r)
 Run currently selected tool.
 
LA_UI_API void update_previous_tool (ui::Registry &r)
 Update previously used tool - must be called for is_tool_(de)activate to work.
 
LA_UI_API bool is_tool_activated (const ui::Registry &r, entt::id_type tool_type)
 Was tool type activated this frame.
 
LA_UI_API bool is_tool_activated (const ui::Registry &r, entt::id_type tool_type, entt::id_type element_type)
 Was tool type and element type activated this frame.
 
LA_UI_API bool is_tool_deactivated (const ui::Registry &r, entt::id_type tool_type)
 Was tool type deactivated this frame.
 
LA_UI_API bool is_tool_deactivated (const ui::Registry &r, entt::id_type tool_type, entt::id_type element_type)
 Was tool type and element type deactivated this frame.
 
template<typename ToolTag >
bool is_tool_active (const ui::Registry &r)
 
template<typename ToolTag , typename ElementTag >
bool is_tool_active (const ui::Registry &r)
 
template<typename ToolTag >
bool is_tool_activated (const ui::Registry &r)
 
template<typename ToolTag , typename ElementTag >
bool is_tool_activated (const ui::Registry &r)
 
template<typename ToolTag >
bool is_tool_deactivated (const ui::Registry &r)
 
template<typename ToolTag , typename ElementTag >
bool is_tool_deactivated (const ui::Registry &r)
 
LA_UI_API Entity create_scene_node (Registry &r, const std::string &name="Unnamed Scene Node Entity", Entity parent=NullEntity)
 
LA_UI_API void remove (Registry &r, Entity e, bool recursive=false)
 Removes entity. More...
 
LA_UI_API void set_parent (Registry &registry, Entity child, Entity new_parent)
 Sets new_parent as as child's new parent. More...
 
LA_UI_API Entity get_parent (const Registry &registry, Entity e)
 Returns parent of e. More...
 
LA_UI_API std::vector< Entity > get_children (const Registry &registry, Entity e)
 Returns all children of e. More...
 
LA_UI_API bool is_orphan (const Registry &registry, Entity child)
 Returns true if child has no parents (is at top-level in the hierarachy) More...
 
LA_UI_API void orphan (Registry &registry, Entity child)
 Reparents child to be top-level (i.e., to have to parents). More...
 
LA_UI_API void foreach_child (const Registry &registry, const Entity parent, const std::function< void(Entity)> &fn)
 Calls fn(Entity) on each direct child of parent entity. More...
 
LA_UI_API void foreach_child_recursive (const Registry &registry, const Entity parent, const std::function< void(Entity)> &fn)
 Calls fn(Entity) on each child of parent entity recursively. More...
 
LA_UI_API void iterate_inorder (Registry &registry, const std::function< bool(Entity)> &on_enter, const std::function< void(Entity, bool)> &on_exit)
 Alternative to foreach_child_recursive.
 
LA_UI_API Entity group (Registry &registry, const std::vector< Entity > &entities, const std::string &name="NewGroup")
 
LA_UI_API Entity group_under (Registry &registry, const std::vector< Entity > &entities, Entity parent)
 
LA_UI_API Entity ungroup (Registry &registry, Entity parent, bool remove_parent=false)
 Returns new parent.
 
LA_UI_API void orphan_without_subtree (Registry &registry, Entity e)
 Removes the node from tree and puts it as top-level node.
 
LA_UI_API bool begin_panel (UIPanel &panel)
 
LA_UI_API void end_panel (UIPanel &panel)
 
LA_UI_API Entity add_panel (Registry &r, const std::string &title, const std::function< void(void)> &body_fn)
 Adds window that executed given imgui_code. More...
 
LA_UI_API Entity add_panel (Registry &r, const std::string &title, const std::function< void(Registry &, Entity)> &body_fn, const std::function< void(Registry &, Entity)> &before_fn=nullptr, const std::function< void(Registry &, Entity)> &after_fn=nullptr, const std::function< void(Registry &, Entity)> &menubar_fn=nullptr)
 
LA_UI_API void toggle_panel (Registry &r, Entity e)
 
LA_UI_API const WindowSizeget_window_size (const Registry &r)
 Returns global window size. More...
 
LA_UI_API MainMenuHeight get_menu_height (const Registry &r)
 
LA_UI_API void hide_tab_bar (Registry &r, Entity uipanel_entity)
 
LA_UI_API Entity add_viewport (Registry &registry, Entity camera_entity, bool srgb=false)
 Creates an offscreen viewport with given camera. Create ViewportPanel to show it on screen.
 
LA_UI_API void instance_camera_to_viewports (Registry &registry, Entity source_viewport)
 
LA_UI_API void copy_camera_to_viewports (Registry &registry, Entity source_viewport)
 
LA_UI_API ViewportPanelget_focused_viewport_panel (Registry &registry)
 Focused Viewport UI Panel Returns nullptr if there is no focused viewport.
 
LA_UI_API Entity get_focused_viewport_entity (Registry &registry)
 Focused Viewport (entity) Returns NullEntity if there is no focused viewport.
 
LA_UI_API ViewportComponentget_focused_viewport (Registry &registry)
 Focused Viewport (component reference) Returns nullptr if there is no focused viewport.
 
LA_UI_API Entity get_focused_camera_entity (Registry &registry)
 Returns NullEntity if there is no focused viewport.
 
LA_UI_API Cameraget_focused_camera (Registry &registry)
 Returns nullptr if there is no focused viewport.
 
LA_UI_API Cameraget_camera (Registry &registry, Entity e)
 
LA_UI_API Entity get_hovered_viewport_panel_entity (Registry &registry)
 Returns NullEntity if there is no hovered viewport.
 
LA_UI_API Entity get_hovered_viewport_entity (Registry &registry)
 Returns NullEntity if there is no hovered viewport.
 
LA_UI_API bool camera_focus_and_fit (Registry &registry, Entity camera, bool focus=true, bool fit=true, float duration_seconds=1.0f, const std::function< bool(Registry &r, Entity e)> &filter=nullptr)
 Adjusts camera to fit the scene bounding box over the next several frames. More...
 
LA_UI_API void camera_focus_and_fit (Registry &registry)
 Adjusts focused camera to fit the scene bounding box over the next several frames.
 
LA_UI_API Entity get_selection_viewport_entity (const Registry &registry)
 
LA_UI_API Entity get_objectid_viewport_entity (const Registry &registry)
 
LA_UI_API void add_selection_outline_post_process (Registry &registry, Entity viewport_entity, const Color &selection_color)
 
PrimitiveType get_raster_primitive (Glyph g)
 
Entity show_attribute_surface (Registry &registry, const Entity &mesh_entity, IndexingMode attribute_type, const std::string source_attribute, PrimitiveType raster_primitive, StringID shader_id=DefaultShaders::SurfaceVertexAttribute)
 
void transform_tool_impl (Registry &registry, GizmoMode mode)
 
void select_object (Registry &r)
 
void select_element (Registry &)
 
void draw_logger_panel (Registry &r, Entity entity)
 
std::shared_ptr< Textureget_brdflut (Registry &r)
 
void activate_shader (Registry &r, Shader &shader, RenderContext &rctx)
 
void meshrender_to_render_queue (Registry &r)
 
void sort_gl_render_queue (Registry &r)
 
void render_gl_render_queue (Registry &r)
 
void update_shadowmap_texture_cube (ShadowMap &shadowmap)
 
void update_shadowmap_texture_2D (ShadowMap &shadowmap)
 
void adjust_camera (Registry &registry, ViewportComponent &viewport, Camera &cam)
 
ui::Entity add_light_visualization_mesh (Registry &r, ui::Entity light_e)
 
Entity ensure_single_selection (Registry &r)
 
void update_mesh_hovered_GL (Registry &r, const SelectionContext &sel_ctx)
 
void update_transform_recursive (Registry &registry, Entity e, const Eigen::Affine3f &parent_global_transform, bool check_change=false)
 
template<typename VA , typename VB >
bool test_axis (const VA &va, const VB &vb, const Eigen::Vector3f &n)
 
bool checkGLError (const char *label)
 
bool is_whitespace_only (const std::string &s)
 
std::unordered_map< GLenum, std::string > preprocessShaderCode (std::string code, const ShaderDefines &defines)
 
std::string annotate_lines (const std::string &str)
 
entt::id_type hash_shader_definition (const ShaderDefinition &def)
 
float sRGB_to_linear (float v)
 
Eigen::Vector3f sRGB_to_linear (const Eigen::Vector3f &c)
 
float linear_to_sRGB (float v)
 
Eigen::Vector3f linear_to_sRGB (const Eigen::Vector3f &c)
 
GLenum get_type_from_internal_format (GLenum internal_format)
 
Color colormap_lookup (const int palette[], const size_t N, float t)
 
Color colormap_lookup (const float palette[][3], const size_t N, float t)
 
ImmediateEntitiesget_immediate_entities (Registry &r)
 
lagrange::fs::path resolve_texture_path (const lagrange::fs::path &parent_path, const char *tex_path)
 
std::shared_ptr< Texturediscover_texture (const fs::path &base_dir, const std::string &name, const std::string &suffix, const Texture::Params &param=Texture::Params())
 
float eval_minor (const Eigen::Matrix4f &m, int r0, int r1, int r2, int c0, int c1, int c2)
 
void initialize_selection_materials (Registry &r, MeshSelectionRender &sr)
 
template<typename Component >
bool deselect_all_impl (Registry &r)
 
template<typename Component >
bool set_selection_component_impl (Registry &r, Entity e, SelectionBehavior behavior)
 
Entity get_last_child (const Registry &registry, const TreeNode &parent_tree)
 
void iterate_inorder_recursive (Registry &registry, Entity e, const std::function< bool(Entity)> &on_enter, const std::function< void(Entity, bool)> &on_exit)
 
void remove_from_tree (Registry &registry, Entity e)
 
std::string ensure_unique_uiwindow_title (const Registry &r, const std::string &in_title)
 
void camera_zoom_to_fit (Registry &, Entity, float, const std::function< bool(Registry &r, Entity e)> &)
 
void camera_focus_on (Registry &registry, Entity camera, float duration_seconds, const std::function< bool(Registry &r, Entity e)> &filter)
 

Variables

constexpr entt::null_t NullEntity {}
 

Detailed Description

Lagrange UI Viewer and mini 3D engine.

Enumeration Type Documentation

◆ DefaultCameraScheme

enum class DefaultCameraScheme
strong

Default camera scheme based on other software To create your own,.

See also
set_camera_scheme for which actions are available

◆ FileSave

enum class FileSave
strong

Controls the behavior of the file save dialog.

Enumerator
ConfirmOverwrite 

Open a confirmation dialog before overwriting a file.

SilentOverwrite 

Force silently overwriting the file.

◆ FolderOpen

enum class FolderOpen
strong

Controls the behavior of the folder open dialog.

Enumerator
LastOpened 

On Windows, use the last opened folder as the initial path.

ForcePath 

Force folder dialog window to use the provided initial path.

Function Documentation

◆ generate_default_ibl()

IBL generate_default_ibl ( size_t  resolution = 256)

Creates pre-packaged IBL.

Source:

https://www.deviantart.com/zbyg/art/HDRi-Pack-1-97402522

CC 3.0 License 

◆ set_camera_scheme()

void set_camera_scheme ( Keybinds keybinds,
DefaultCameraScheme  camera_scheme 
)

Set camera control scheme from DefaultCameraScheme.

Binds following actions: camera.select, camera.rotate, camera.pan, camera.dolly, camera.center_on_cursor, camera.center_on_selection

In case of MAYA and SUBSTANCE, they remap viewport.selection.select.erase to LEFT MOUSE + LEFT CTRL + LEFT ALT

◆ render_viewports()

void render_viewports ( Registry &  registry)

Render all enabled viewports.

Parameters
registry

◆ update_mesh_hovered()

void update_mesh_hovered ( Registry &  ctx)

Sets <Hovered> component if the mesh is hovered a ViewportPanel.

Updates <Hovered> component based on current selection context.

See SelectionContext and default_tools for details

◆ add_file_to_shader_virtual_fs()

bool add_file_to_shader_virtual_fs ( const std::string &  virtual_path,
const std::string &  contents,
bool  overwrite = false 
)

Creates a file using virtual_path with contents in the shader virtual file system.

This file will be visible to the ShaderLoader, to be directly loaded as a shader or to be included in another shader via #include "virtual/fs/path/.." Returns true if written successfully. Returns false if 1. No virtual fs is used (DEFAULT_SHADERS_USE_REAL_PATH is defined), 2. File already exists and overwrite==false

◆ get_nearest_bounds_distance()

float get_nearest_bounds_distance ( const Registry &  registry,
const Eigen::Vector3f &  from,
const Layer visible,
const Layer hidden 
)

Returns the least distance between from and any point within any bounding box.

Returns 0 if from lies within a bounding box. Returns -1 if no bounds exist.

◆ get_furthest_bounds_distance()

float get_furthest_bounds_distance ( const Registry &  registry,
const Eigen::Vector3f &  from,
const Layer visible,
const Layer hidden 
)

Returns the greatest distance between from and any point within any bounding box.

Returns -1 if no bounds exist.

◆ get_scene_bounds()

Bounds & get_scene_bounds ( Registry &  registry)

◆ on()

void on ( Registry &  r,
std::function< void(Event &)>  listener 
)

Register a listener for Event.

Template Parameters
Event
Parameters
rRegistry instance
listenerfunction taking reference to Event as parameter
Returns
Connection instance, can be used to disconnect listener later

◆ publish()

void publish ( Registry &  r,
Args &&...  args 
)

Trigger an event of type Event.

Template Parameters
Event
Parameters
rRegistry instance
...argsArguments to construct Event

◆ open_file()

FileDialogPath open_file ( const std::string &  title,
const fs::path &  default_path = ".",
const std::vector< FileFilter > &  filters = {{"All Files", "*"}} 
)

Opens a native file dialog to open a single file.

Parameters
[in]titleDialog title.
[in]default_pathOptional default path.
[in]filtersOptional list of filters.
Returns
Selected file path.

◆ open_files()

std::vector< FileDialogPath > open_files ( const std::string &  title,
const fs::path &  default_path = ".",
const std::vector< FileFilter > &  filters = {{"All Files", "*"}} 
)

Opens a native file dialog to open multiple files.

Parameters
[in]titleDialog title.
[in]default_pathOptional default path.
[in]filtersOptional list of filters.
Returns
Selected file path.

◆ save_file()

FileDialogPath save_file ( const std::string &  title,
const fs::path &  default_path = ".",
const std::vector< FileFilter > &  filters = {{"All Files", "*"}},
FileSave  overwrite_behavior = FileSave::ConfirmOverwrite 
)

Opens a native file dialog to save a file.

Parameters
[in]titleDialog title.
[in]default_pathOptional default path.
[in]filtersOptional list of filters.
[in]overwrite_behaviorOverwrite behavior.
Returns
Selected file path.

◆ open_folder()

FileDialogPath open_folder ( const std::string &  title,
const fs::path &  default_path = ".",
FolderOpen  open_behavior = FolderOpen::LastOpened 
)

Opens a native file dialog to select a folder.

Parameters
[in]titleDialog title.
[in]default_pathOptional default path.
[in]open_behaviorDefault path behavior (e.g. use last opened folder by default, or use the provided path).
Returns
Selected folder path.

◆ generate_ibl() [1/2]

IBL generate_ibl ( const fs::path &  path,
size_t  resolution = 1024 
)

Utility functions for Image Based Lights (IBLs)

Generates Image Based Light from image file or .ibl file given by path. Throws std::runtime_error on failure.

Parameters
path
resolution
Returns
IBL

◆ generate_ibl() [2/2]

IBL generate_ibl ( const std::shared_ptr< Texture > &  background_texture,
size_t  resolution = 1024 
)

Generates Image Based Light from given rectangular texture.

Throws std::runtime_error on failure.

Parameters
path
resolution
Returns
IBL

◆ get_ibl_entity()

Entity get_ibl_entity ( const Registry &  registry)

Returns first <IBL> entity found in registry.

If there are none, returns invalid Entity

Parameters
registry
Returns
Entity

◆ get_ibl() [1/2]

const IBL * get_ibl ( const Registry &  registry)

Returns pointer to the first IBL found in the registry.

Nullptr if there is none

Parameters
registry
Returns
IBL pointer

◆ get_ibl() [2/2]

IBL * get_ibl ( Registry &  registry)

◆ save_ibl()

bool save_ibl ( const IBL ibl,
const fs::path &  folder 
)

Saves IBL as individual .png files in given folder.

Generated files: background_rect.png, background_{00-05}.png, diffuse_{00-05}.png, specular_{00-05}_mip_{00-miplevels}.png Cube maps follow GL_TEXTURE_CUBE_MAP_POSITIVE_X + i pattern.

◆ convert_material()

std::shared_ptr< lagrange::ui::Material > convert_material ( Registry &  r,
const fs::path &  base_dir,
const tinyobj::material_t &  tinymat 
)

Convertrs tinyobj's material_t to UI's Material.

Parameters
base_dir
tinymat
Returns

◆ load_obj()

Entity load_obj ( Registry &  r,
const fs::path &  path,
const io::MeshLoaderParams &  params = io::MeshLoaderParams() 
)

Loads obj as a single mesh.

Creates entity with MeshData component. Use show_mesh to add it to scene

◆ load_obj_with_materials()

std::pair< Entity, std::vector< std::shared_ptr< Material > > > load_obj_with_materials ( Registry &  r,
const fs::path &  path,
const io::MeshLoaderParams &  params = io::MeshLoaderParams() 
)

Loads obj as a single mesh and materials.

Creates entity with MeshData component. Use show_mesh to add it to scene Returns entity and array of material pointers

◆ perspective()

Eigen::Projective3f perspective ( float  fovy,
float  aspect,
float  zNear,
float  zFar 
)

Constructs perspective projection matrix.

Parameters
[in]fov_yvertical field of vision in RADIANS
[in]aspectaspect ratio
[in]zNearnear plane
[in]zFarfar plane
Returns
Eigen::Projective3f perspective projection matrix

◆ ortho()

Eigen::Projective3f ortho ( float  left,
float  right,
float  bottom,
float  top,
float  zNear,
float  zFar 
)

Constructs orthograpic projection matrix.

Parameters
[in]leftleft coordinate
[in]rightright coordinate
[in]bottombottom coordinate
[in]toptop coordinate
[in]zNearnear plane
[in]zFarfar plane
Returns
Eigen::Projective3f orthographic projection matrix

◆ look_at()

Eigen::Matrix4f look_at ( const Eigen::Vector3f &  eye,
const Eigen::Vector3f &  center,
const Eigen::Vector3f &  up 
)

Constructs "look at" view matrix,.

Parameters
[in]eyecamera position
[in]centerpoint to look at
[in]upup direction
Returns
Eigen::Matrix4f view matrix

◆ unproject_point()

Eigen::Vector3f unproject_point ( const Eigen::Vector3f &  v,
const Eigen::Matrix4f &  view,
const Eigen::Matrix4f &  perspective,
const Eigen::Vector4f &  viewport 
)

Unprojects screen point (with x,y in screen coordinates and z in NDC) back to 3D world.

Parameters
[in]vscreen point with NDC z coordinate
[in]viewview matrix
[in]perspectiveperspective matrix
[in]viewportviewport coordinates (x0,y0,x1,y1), x0,y0 being lower left
Returns
Eigen::Vector3f unprojected 3D point in world space

◆ select_visible_elements()

bool select_visible_elements ( Registry &  r,
StringID  element_type,
SelectionBehavior  sel_behavior,
Entity  selected_entity,
Entity  active_viewport,
Frustum  local_frustum 
)

Selects visible mesh elements (sets is_selected attribute)

Parameters
rRegistry
element_typetype of element (ElementFace, ElementEdge, ElementVertex)
sel_behaviorSelectionBehavior (SET/ADD/ERASE)
selected_entityEntity with MeshGeometry component
active_viewportViewport to use for resolution and layer visibility
local_frustumFrustum in mesh's local coordinate frame
Returns
always true

◆ select_elements_in_frustum()

bool select_elements_in_frustum ( Registry &  r,
StringID  element_type,
SelectionBehavior  sel_behavior,
Entity  selected_entity,
Frustum  local_frustum 
)

Selects mesh elements intersecting a frustum (sets is_selected attribute)

Parameters
r
element_typetype of element (ElementFace, ElementEdge, ElementVertex)
sel_behaviorSelectionBehavior (SET/ADD/ERASE)
selected_entityEntity with MeshGeometry component
local_frustumFrustum in mesh's local coordinate frame
Returns
always true

◆ update_vertex_data()

void update_vertex_data ( const GLMesh glmesh,
const Shader shader,
VertexData glvd,
IndexingMode  indexing,
entt::id_type  submesh_index 
)

Assigns buffers from GLMesh to GLVertexData to Shader specified locations.

Parameters
glmeshcollection of gpu buffers
shader
glvd
indexing

◆ remove()

void remove ( Registry &  r,
Entity  e,
bool  recursive = false 
)

Removes entity.

Parameters
r
e
recursiveremoves all children recursively

◆ set_parent()

void set_parent ( Registry &  registry,
Entity  child,
Entity  new_parent 
)

Sets new_parent as as child's new parent.

Both must have <Tree> component.

Parameters
registry
Entitychild
Entitynew_parent

◆ get_parent()

Entity get_parent ( const Registry &  registry,
Entity  e 
)

Returns parent of e.

Must have <Tree> component. Returns NullEntity if e is top-level.

Parameters
registry
e
Returns

◆ get_children()

std::vector< Entity > get_children ( const Registry &  registry,
Entity  e 
)

Returns all children of e.

Must have <Tree> component. Note: causes dynamic allocation. Use lagrange::ui::foreach_child to iterate children efficiently.

Parameters
registry
e
Returns
std::vector<Entity>

◆ is_orphan()

bool is_orphan ( const Registry &  registry,
Entity  child 
)

Returns true if child has no parents (is at top-level in the hierarachy)

Parameters
registry
child

◆ orphan()

void orphan ( Registry &  registry,
Entity  child 
)

Reparents child to be top-level (i.e., to have to parents).

Parameters
registry
child

◆ foreach_child()

void foreach_child ( const Registry &  registry,
const Entity  parent,
const std::function< void(Entity)> &  fn 
)

Calls fn(Entity) on each direct child of parent entity.

Parameters
registry
parentparent entity with Tree component
fnfunction to call, takes Entity parameter

◆ foreach_child_recursive()

void foreach_child_recursive ( const Registry &  registry,
const Entity  parent,
const std::function< void(Entity)> &  fn 
)

Calls fn(Entity) on each child of parent entity recursively.

Parameters
registry
parentparent entity with Tree component
fnfunction to call, takes Entity parameter

◆ add_panel()

Entity add_panel ( Registry &  r,
const std::string &  title,
const std::function< void(void)> &  body_fn 
)

Adds window that executed given imgui_code.

Imgui begin/end is called for you, do not call it inside the imgui_code.

Parameters
registry
title
imgui_code
Returns
window entity

◆ get_window_size()

const WindowSize & get_window_size ( const Registry &  r)

Returns global window size.

Parameters
registry
Returns

◆ camera_focus_and_fit()

bool camera_focus_and_fit ( Registry &  registry,
Entity  camera,
bool  focus = true,
bool  fit = true,
float  duration_seconds = 1.0f,
const std::function< bool(Registry &r, Entity e)> &  filter = nullptr 
)

Adjusts camera to fit the scene bounding box over the next several frames.

If filter is specified, it will focus only on entities passing the filter test.

Parameters
registry
cameraentity with a Camera component
focusadjusts "lookat" position of the camera
fitadjusts "zoom" or "fov" of the camera to fit the bounding box
duration_secondsduration in seconds
filterReturns false if camera is not a valid entity