Cumulia Illustrator Rendering Engine v1.0.0
A Rendering engine for industrial CAD/CAE model and optimized for greatest performance
 
Loading...
Searching...
No Matches
decal.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 2024-05-01
15// Version V1.0.0
16//##################################################################################################
17
18#pragma once
19
20#include <cilcore.h>
21
22namespace cil
23{
24 class Decal : public Node
25 {
26 friend class Decals;
27
28 private:
29 std::shared_ptr<Vector2i> size;
30 std::shared_ptr<Vector2i> offset;
31 std::shared_ptr<Vector3f> position;
32 };
33
34 class Decals : public Node
35 {
36 public:
37 enum class Anchor
38 {
39 TopLeft,
40 Top,
42 Left,
43 Center,
44 Right,
46 Bottom,
48 };
49
50 private:
51 std::shared_ptr<Material> m_opaqueImageMaterial;
52 std::shared_ptr<Material> m_transparentImageMaterial;
53 std::shared_ptr<Material> m_opaqueTextMaterial;
54 std::shared_ptr<Material> m_transparentTextMaterial;
55 std::shared_ptr<Material> m_opaqueBackgroundMaterial;
56 std::shared_ptr<Material> m_transparentBackgroundMaterial;
57 std::shared_ptr<Geometry> m_geometry;
58 std::shared_ptr<Geometry> m_backgroundGeometry;
59 std::shared_ptr<Sampler> m_sampler;
60
61 public:
62 Decals(const int fontSize, const std::shared_ptr<Color3f>& fontColor, const std::string& fontFile);
63 virtual ~Decals();
64
65 void set(const int fontSize, const std::shared_ptr<Color3f>& fontColor, const std::string& fontFile);
66 std::shared_ptr<Decal> add(const std::shared_ptr<Image2D>& image, const std::shared_ptr<Vector3f>& position,
67 Decals::Anchor anchor = Decals::Anchor::BottomLeft, const std::shared_ptr<Vector2i>& offset = _ivec2(0, 0));
68 std::shared_ptr<Decal> add(const std::string& text, const std::shared_ptr<Vector3f>& position,
69 const std::shared_ptr<Color3f>& backgroundColor = nullptr, const std::shared_ptr<Color3f>& borderColor = nullptr,
70 int padding = 6, Decals::Anchor anchor = Decals::Anchor::BottomLeft, const std::shared_ptr<Vector2i>& offset = _ivec2(0, 0));
71 std::shared_ptr<Decal> add(const std::wstring& text, const std::shared_ptr<Vector3f>& position,
72 const std::shared_ptr<Color3f>& backgroundColor = nullptr, const std::shared_ptr<Color3f>& borderColor = nullptr,
73 int padding = 6, Decals::Anchor anchor = Decals::Anchor::BottomLeft, const std::shared_ptr<Vector2i>& offset = _ivec2(0, 0));
74 void remove(const std::shared_ptr<Decal>& decal);
75 void removeAll();
76 std::shared_ptr<Decal> hit(int x, int y, const std::shared_ptr<Background>& background, const std::shared_ptr<Camera>& camera, float devicePixelRatio);
77 };
78
79 std::shared_ptr<Decals> _decals(const int fontSize, const std::shared_ptr<Color3f>& fontColor, const std::string& fontFile);
80}
Definition decal.h:25
Definition decal.h:35
std::shared_ptr< Decal > hit(int x, int y, const std::shared_ptr< Background > &background, const std::shared_ptr< Camera > &camera, float devicePixelRatio)
Decals(const int fontSize, const std::shared_ptr< Color3f > &fontColor, const std::string &fontFile)
void set(const int fontSize, const std::shared_ptr< Color3f > &fontColor, const std::string &fontFile)
Anchor
Definition decal.h:38
virtual ~Decals()
std::shared_ptr< Decal > add(const std::shared_ptr< Image2D > &image, const std::shared_ptr< Vector3f > &position, Decals::Anchor anchor=Decals::Anchor::BottomLeft, const std::shared_ptr< Vector2i > &offset=_ivec2(0, 0))
std::shared_ptr< Decal > add(const std::wstring &text, const std::shared_ptr< Vector3f > &position, const std::shared_ptr< Color3f > &backgroundColor=nullptr, const std::shared_ptr< Color3f > &borderColor=nullptr, int padding=6, Decals::Anchor anchor=Decals::Anchor::BottomLeft, const std::shared_ptr< Vector2i > &offset=_ivec2(0, 0))
void remove(const std::shared_ptr< Decal > &decal)
void removeAll()
std::shared_ptr< Decal > add(const std::string &text, const std::shared_ptr< Vector3f > &position, const std::shared_ptr< Color3f > &backgroundColor=nullptr, const std::shared_ptr< Color3f > &borderColor=nullptr, int padding=6, Decals::Anchor anchor=Decals::Anchor::BottomLeft, const std::shared_ptr< Vector2i > &offset=_ivec2(0, 0))
The Node class represents a node in a scene graph. A scene graph is a hierarchicaldata stucture used ...
Definition node.h:35
Definition decal.h:23
std::shared_ptr< Vector2i > _ivec2()
std::shared_ptr< Decals > _decals(const int fontSize, const std::shared_ptr< Color3f > &fontColor, const std::string &fontFile)