Cumulia Illustrator Rendering Engine v2.1.0
A Rendering engine for industrial CAD/CAE model and optimized for greatest performance
 
Loading...
Searching...
No Matches
locatorpass.h
1//##################################################################################################
2//
3// Copyright (c) 2024 Beijing Qiongqi Tech Co.,Ltd. All rights reserved.
4
5// This source code is confidential and proprietary to Beijing Qiongqi Tech Co.,Ltd(The Holder).
6// Any unauthorized use, copying, modification, or distribution of the code is strictly prohibited.
7// Any user shall obtain authorizaition from the Holder before modifying the source code. And the user shall not
8// sublicense, sell, distribute, or transfer the source code, whether in original or modified form, to any third party
9// without the prior written consent of the Holder.
10
11// This copyright notice and permission grant shall be included in all copies or substantial portions of the source code.
12
13// Author Cumulia Illustrator
14// Date 2025-08-05
15// Version V2.1.0
16//##################################################################################################
17
18#pragma once
19
20#include "locator.h"
21#include "handler.h"
22
23#include <cilcore.h>
24
25#include <memory>
26#include <tuple>
27
28namespace cil
29{
31 class LocatorPass : public Pass
32 {
33 public:
34 LocatorPass(const std::shared_ptr<Background>& background, const std::shared_ptr<Camera>& camera);
35 virtual ~LocatorPass();
36
38 void add(const std::shared_ptr<AbstractLocator>& locator) const;
40 void remove(const std::shared_ptr<AbstractLocator>& locator) const;
41 void clear() const;
47 bool update(const Ray& r);
49 bool end(const Ray& r);
50
51 void bind(const std::string& name, std::function<void()> callback);
52 void unbind(const std::string& name);
53 void send(const std::string& name);
54
55 std::shared_ptr<Locator> activeLocator() const;
56 void setHandlerNormal(const Color3f& color);
58 void setHandlerHilited(const Color3f& color);
60 void setLocatorOutline(const Color3f& color);
62 void setLocatorOutface(const Color3f& color);
64
65 private:
66 Ray findRay(const Ray& r, const Matrix4f& m);
67 std::tuple<std::shared_ptr<Locator>, std::shared_ptr<Handler>> hit(const Ray& r);
68 bool hilite(const Ray& r);
69 void updateHandlerColor();
70
71 private:
72 float m_devicePixelRatio;
73 Locator::Modifier m_modifier;
74 std::shared_ptr<Locator> m_actived;
75 std::shared_ptr<Handler> m_hilited;
76 Matrix4f m_initial;
77 std::function<void()> m_onHilited;
78 std::function<void()> m_onBegun;
79 std::function<void()> m_onUpdated;
80 std::function<void()> m_onEnded;
81 };
82
83 std::shared_ptr<LocatorPass> _locatorPass(const std::shared_ptr<Background>& background, const std::shared_ptr<Camera>& camera);
84}
The Color3f class inherits from Color3, specilizing the template parameters to float for element type...
Definition color.h:105
The LocatorPass class inheriting from EventWatcher class and Pass class, representing a rendering pas...
Definition locatorpass.h:32
void remove(const std::shared_ptr< AbstractLocator > &locator) const
Removes a locator from this rendering pass.
LocatorPass(const std::shared_ptr< Background > &background, const std::shared_ptr< Camera > &camera)
Color3f locatorOutface() const
void add(const std::shared_ptr< AbstractLocator > &locator) const
Adds a locator to this rendering pass.
std::shared_ptr< Locator > activeLocator() const
void setLocatorOutline(const Color3f &color)
void bind(const std::string &name, std::function< void()> callback)
void setLocatorOutface(const Color3f &color)
void unbind(const std::string &name)
void setHandlerHilited(const Color3f &color)
void clear() const
Color3f handlerHilited() const
Color3f handlerNormal() const
void send(const std::string &name)
bool begin(const Ray &r, Locator::Modifier modifier=Locator::Modifier::None)
Initiates the update process if there exists highlighted handler in this locator pass.
virtual ~LocatorPass()
bool end(const Ray &r)
Ends the update process.
void setHandlerNormal(const Color3f &color)
Color3f locatorOutline() const
bool update(const Ray &r)
Synchronizes the locator pass's active locator and highlighted handler with the cursor position.
Modifier
The Modifier enumeration defines various modifier keys for handling different keyboard events.
Definition locator.h:37
The Matrix4f class is 4 X 4 matrix.
Definition matrix.h:226
The Pass class represents a rendering pass within a graphics pipeline.
Definition pass.h:32
CameraPtr camera
This member holds a shared pointer to a Camera object which the current pass uses for rendering.
Definition pass.h:37
BackgroundPtr background
This member holds a shared pointer to a Background object which defines the scene background.
Definition pass.h:36
std::string name
This memeber stores the name of the pass.
Definition pass.h:34
The Ray class inherits from the Tuple class, specilizing the templated parameter to float for element...
Definition ray.h:31
Definition decal.h:23
std::shared_ptr< LocatorPass > _locatorPass(const std::shared_ptr< Background > &background, const std::shared_ptr< Camera > &camera)