Blender V4.3
FEdgeXDetector.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
12#include <vector>
13
14#include "../geometry/Geom.h"
15
19
22
23#ifdef WITH_CXX_GUARDEDALLOC
24# include "MEM_guardedalloc.h"
25#endif
26
27namespace Freestyle {
28
29using namespace Geometry;
30
33 public:
35 {
36 _pProgressBar = nullptr;
37 _pRenderMonitor = nullptr;
39#if 0
40 _bbox_diagonal = 1.0;
41#endif
42 _meanEdgeSize = 0;
46 _sphereRadius = 1.0;
48 _faceSmoothness = false;
49 _changes = false;
51 _creaseAngle = 0.7; // angle of 134.43 degrees
52 }
53
54 virtual ~FEdgeXDetector() {}
55
57 virtual void processShapes(WingedEdge &);
58
59 // GENERAL STUFF
60 virtual void preProcessShape(WXShape *iWShape);
61 virtual void preProcessFace(WXFace *iFace);
62 virtual void computeCurvatures(WXVertex *iVertex);
63
64 // SILHOUETTE
65 virtual void processSilhouetteShape(WXShape *iWShape);
66 virtual void ProcessSilhouetteFace(WXFace *iFace);
67 virtual void ProcessSilhouetteEdge(WXEdge *iEdge);
68
69 // CREASE
70 virtual void processCreaseShape(WXShape *iWShape);
71 virtual void ProcessCreaseEdge(WXEdge *iEdge);
72
79 // XXX angle should be in radian...
80 inline void setCreaseAngle(float angle)
81 {
82 if (angle < 0.0) {
83 angle = 0.0;
84 }
85 else if (angle > 180.0) {
86 angle = 180.0;
87 }
88 angle = cos(M_PI * (180.0 - angle) / 180.0);
89 if (angle != _creaseAngle) {
91 _changes = true;
92 }
93 }
94
95 // BORDER
96 virtual void processBorderShape(WXShape *iWShape);
97 virtual void ProcessBorderEdge(WXEdge *iEdge);
98
99 // RIDGES AND VALLEYS
100 virtual void processRidgesAndValleysShape(WXShape *iWShape);
101 virtual void ProcessRidgeFace(WXFace *iFace);
102
103 // SUGGESTIVE CONTOURS
104 virtual void processSuggestiveContourShape(WXShape *iWShape);
105 virtual void ProcessSuggestiveContourFace(WXFace *iFace);
106 virtual void postProcessSuggestiveContourShape(WXShape *iShape);
107 virtual void postProcessSuggestiveContourFace(WXFace *iFace);
113 {
114 if (dkr != _kr_derivative_epsilon) {
116 _changes = true;
117 }
118 }
119
120 // MATERIAL BOUNDARY
121 virtual void processMaterialBoundaryShape(WXShape *iWShape);
122 virtual void ProcessMaterialBoundaryEdge(WXEdge *iEdge);
123
124 // EDGE MARKS
125 virtual void processEdgeMarksShape(WXShape *iShape);
126 virtual void ProcessEdgeMarks(WXEdge *iEdge);
127
128 // EVERYBODY
129 virtual void buildSmoothEdges(WXShape *iShape);
130
132 inline void setViewpoint(const Vec3f &ivp)
133 {
134 _Viewpoint = ivp;
135 }
136
138 {
140 }
141
143 {
145 }
146
147 inline void enableSuggestiveContours(bool b)
148 {
150 }
151
152 inline void enableMaterialBoundaries(bool b)
153 {
155 }
156
157 inline void enableFaceSmoothness(bool b)
158 {
159 if (b != _faceSmoothness) {
161 _changes = true;
162 }
163 }
164
165 inline void enableFaceMarks(bool b)
166 {
167 if (b != _faceMarks) {
168 _faceMarks = b;
169 _changes = true;
170 }
171 }
172
177 inline void setSphereRadius(float r)
178 {
179 if (r != _sphereRadius) {
180 _sphereRadius = r;
181 _changes = true;
182 }
183 }
184
185 inline void setProgressBar(ProgressBar *iProgressBar)
186 {
187 _pProgressBar = iProgressBar;
188 }
189
190 inline void setRenderMonitor(RenderMonitor *iRenderMonitor)
191 {
192 _pRenderMonitor = iRenderMonitor;
193 }
194
195 protected:
197#if 0
198 real _bbox_diagonal; // diagonal of the current processed shape bbox
199#endif
200 // oldtmp values
211
217 float _sphereRadius; // expressed as a ratio of the mean edge size
218 float _creaseAngle; // [-1, 1] compared with the inner product of face normals
220
222
225
226#ifdef WITH_CXX_GUARDEDALLOC
227 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:FEdgeXDetector")
228#endif
229};
230
231} /* namespace Freestyle */
#define M_PI
unsigned int uint
GTS - Library for the manipulation of triangulated surfaces.
Configuration definitions.
Vectors and Matrices (useful type definitions)
static double angle(const Eigen::Vector3d &v1, const Eigen::Vector3d &v2)
Definition IK_Math.h:125
Read Guarded memory(de)allocation.
Class to encapsulate a progress bar.
Classes defining the basic "Iterator" design pattern.
Classes to define an Extended Winged Edge data structure.
virtual void processRidgesAndValleysShape(WXShape *iWShape)
virtual void ProcessBorderEdge(WXEdge *iEdge)
void enableMaterialBoundaries(bool b)
virtual void processShapes(WingedEdge &)
virtual void ProcessMaterialBoundaryEdge(WXEdge *iEdge)
virtual void processEdgeMarksShape(WXShape *iShape)
virtual void processCreaseShape(WXShape *iWShape)
virtual void ProcessEdgeMarks(WXEdge *iEdge)
void enableSuggestiveContours(bool b)
virtual void ProcessRidgeFace(WXFace *iFace)
virtual void processMaterialBoundaryShape(WXShape *iWShape)
void setSuggestiveContourKrDerivativeEpsilon(float dkr)
virtual void preProcessFace(WXFace *iFace)
void setCreaseAngle(float angle)
virtual void ProcessSilhouetteFace(WXFace *iFace)
void setProgressBar(ProgressBar *iProgressBar)
virtual void buildSmoothEdges(WXShape *iShape)
virtual void preProcessShape(WXShape *iWShape)
RenderMonitor * _pRenderMonitor
virtual void computeCurvatures(WXVertex *iVertex)
void enableOrthographicProjection(bool b)
void setViewpoint(const Vec3f &ivp)
virtual void processSuggestiveContourShape(WXShape *iWShape)
virtual void processSilhouetteShape(WXShape *iWShape)
virtual void ProcessSilhouetteEdge(WXEdge *iEdge)
void setRenderMonitor(RenderMonitor *iRenderMonitor)
virtual void postProcessSuggestiveContourShape(WXShape *iShape)
virtual void ProcessCreaseEdge(WXEdge *iEdge)
void enableRidgesAndValleysFlag(bool b)
virtual void ProcessSuggestiveContourFace(WXFace *iFace)
virtual void postProcessSuggestiveContourFace(WXFace *iFace)
virtual void processBorderShape(WXShape *iWShape)
local_group_size(16, 16) .push_constant(Type b
ccl_device_inline float3 cos(float3 v)
inherits from class Rep
Definition AppCanvas.cpp:20
double real
Definition Precision.h:14