Cumulia Illustrator Rendering Engine v1.0.0
A Rendering engine for industrial CAD/CAE model and optimized for greatest performance
 
Loading...
Searching...
No Matches
viewcube.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#include <cilselector.h>
22
23namespace cil
24{
25 class Block
26 {
27 public:
30 };
31
32 /*enum class ViewCubeType
33 {
34 None,
35 Full,
36 Mini,
37 Corner
38 };*/
39
40 class ViewCube : public Pass
41 {
42 public:
43 ViewCube(const std::shared_ptr<Renderer>& renderer, const std::shared_ptr<Image2D>& image,
44 const std::shared_ptr<Vector2i>& coordinate, const std::shared_ptr<Vector2i>& backgroundSize, const std::shared_ptr<Vector2i>& windowSize);
45 virtual ~ViewCube();
46
47 int hilited() const;
49 std::shared_ptr<Matrix4f> align(const std::shared_ptr<Camera>& camera, const std::shared_ptr<BoundingBox>& boundingBox);
50 int hit(int x, int y);
51 void sync(const std::shared_ptr<Camera>& camera);
52 // setLocation
53 // updatelocation
54
55 private:
56 std::shared_ptr<Node> buildCube();
57 std::shared_ptr<Node> buildEdge();
58 std::shared_ptr<Node> buildAxis();
59 std::shared_ptr<Node> buildHilite();
60 std::shared_ptr<Primitive> buildFace(const Vector3f& p0, const Vector3f& p1, const Vector3f& p2, const Vector3f& p3, const std::string& text, float texCoordOffset);
61 std::shared_ptr<Material> buildFaceMaterial();
62
63 protected:
64 std::shared_ptr<Node> m_hilite;
65 std::shared_ptr<std::vector<std::shared_ptr<Block>>> m_blocks;
68 std::shared_ptr<Geometry> m_blockCube;
69 std::shared_ptr<Material> m_faceMaterial;
70 std::shared_ptr<FaceSelector<Block>> m_selector;
71 std::shared_ptr<Image2D> m_image;
72
73 };
74
75 class FullViewCube : public ViewCube
76 {
77 public:
78 FullViewCube(const std::shared_ptr<Renderer>& renderer, const std::shared_ptr<Image2D>& image,
79 const std::shared_ptr<Vector2i>& coordinate, const std::shared_ptr<Vector2i>& backgroundSize, const std::shared_ptr<Vector2i>& windowSize);
80 virtual ~FullViewCube();
81
82 private:
83 void initialize();
84 };
85
86 class MiniViewCube : public ViewCube
87 {
88 public:
89 MiniViewCube(const std::shared_ptr<Renderer>& renderer, const std::shared_ptr<Image2D>& image,
90 const std::shared_ptr<Vector2i>& coordinate, const std::shared_ptr<Vector2i>& backgroundSize, const std::shared_ptr<Vector2i>& windowSize);
91 virtual ~MiniViewCube();
92
93 private:
94 void initialize();
95 };
96
97 class CornerViewCube : public ViewCube
98 {
99 public:
100 CornerViewCube(const std::shared_ptr<Renderer>& renderer, const std::shared_ptr<Image2D>& image,
101 const std::shared_ptr<Vector2i>& coordinate, const std::shared_ptr<Vector2i>& backgroundSize, const std::shared_ptr<Vector2i>& windowSize);
103
104 private:
105 void initialize();
106 };
107
108 std::shared_ptr<FullViewCube> _fullViewCube(const std::shared_ptr<Renderer>& renderer, const std::shared_ptr<Image2D>& image,
109 const std::shared_ptr<Vector2i>& coordinate, const std::shared_ptr<Vector2i>& backgroundSize, const std::shared_ptr<Vector2i>& windowSize);
110
111 std::shared_ptr<MiniViewCube> _miniViewCube(const std::shared_ptr<Renderer>& renderer, const std::shared_ptr<Image2D>& image,
112 const std::shared_ptr<Vector2i>& coordinate, const std::shared_ptr<Vector2i>& backgroundSize, const std::shared_ptr<Vector2i>& windowSize);
113
114 std::shared_ptr<CornerViewCube> _cornerViewCube(const std::shared_ptr<Renderer>& renderer, const std::shared_ptr<Image2D>& image,
115 const std::shared_ptr<Vector2i>& coordinate, const std::shared_ptr<Vector2i>& backgroundSize, const std::shared_ptr<Vector2i>& windowSize);
116}
Vector3f dir
Definition viewcube.h:29
Box3f box
Definition viewcube.h:28
The Box3f class inherits from Box3, specilizing the template parameters to float for element type and...
Definition box.h:214
Definition viewcube.h:98
virtual ~CornerViewCube()
CornerViewCube(const std::shared_ptr< Renderer > &renderer, const std::shared_ptr< Image2D > &image, const std::shared_ptr< Vector2i > &coordinate, const std::shared_ptr< Vector2i > &backgroundSize, const std::shared_ptr< Vector2i > &windowSize)
Definition viewcube.h:76
virtual ~FullViewCube()
FullViewCube(const std::shared_ptr< Renderer > &renderer, const std::shared_ptr< Image2D > &image, const std::shared_ptr< Vector2i > &coordinate, const std::shared_ptr< Vector2i > &backgroundSize, const std::shared_ptr< Vector2i > &windowSize)
Definition viewcube.h:87
virtual ~MiniViewCube()
MiniViewCube(const std::shared_ptr< Renderer > &renderer, const std::shared_ptr< Image2D > &image, const std::shared_ptr< Vector2i > &coordinate, const std::shared_ptr< Vector2i > &backgroundSize, const std::shared_ptr< Vector2i > &windowSize)
The Pass class represents a rendering pass within a graphics pipeline.
Definition pass.h:34
std::shared_ptr< Camera > camera
This member holds a shared pointer to a Camera object which the current pass uses for rendering.
Definition pass.h:39
The class Vector3f inherits from the templated class of Vector3, and the template parameters are spec...
Definition vector.h:322
Definition viewcube.h:41
std::shared_ptr< Geometry > m_blockCube
Definition viewcube.h:68
std::shared_ptr< Matrix4f > align(const std::shared_ptr< Camera > &camera, const std::shared_ptr< BoundingBox > &boundingBox)
void setHilited(int hilited)
std::shared_ptr< Node > m_hilite
Definition viewcube.h:64
void sync(const std::shared_ptr< Camera > &camera)
int m_hilited
Definition viewcube.h:66
ViewCube(const std::shared_ptr< Renderer > &renderer, const std::shared_ptr< Image2D > &image, const std::shared_ptr< Vector2i > &coordinate, const std::shared_ptr< Vector2i > &backgroundSize, const std::shared_ptr< Vector2i > &windowSize)
int hit(int x, int y)
std::shared_ptr< FaceSelector< Block > > m_selector
Definition viewcube.h:70
int hilited() const
std::shared_ptr< Image2D > m_image
Definition viewcube.h:71
virtual ~ViewCube()
int m_unhilited
Definition viewcube.h:67
std::shared_ptr< std::vector< std::shared_ptr< Block > > > m_blocks
Definition viewcube.h:65
std::shared_ptr< Material > m_faceMaterial
Definition viewcube.h:69
Definition decal.h:23
std::shared_ptr< CornerViewCube > _cornerViewCube(const std::shared_ptr< Renderer > &renderer, const std::shared_ptr< Image2D > &image, const std::shared_ptr< Vector2i > &coordinate, const std::shared_ptr< Vector2i > &backgroundSize, const std::shared_ptr< Vector2i > &windowSize)
std::shared_ptr< MiniViewCube > _miniViewCube(const std::shared_ptr< Renderer > &renderer, const std::shared_ptr< Image2D > &image, const std::shared_ptr< Vector2i > &coordinate, const std::shared_ptr< Vector2i > &backgroundSize, const std::shared_ptr< Vector2i > &windowSize)
std::shared_ptr< FullViewCube > _fullViewCube(const std::shared_ptr< Renderer > &renderer, const std::shared_ptr< Image2D > &image, const std::shared_ptr< Vector2i > &coordinate, const std::shared_ptr< Vector2i > &backgroundSize, const std::shared_ptr< Vector2i > &windowSize)