Blender
V5.3
intern
cycles
subd
subd/split.h
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
2
*
3
* SPDX-License-Identifier: Apache-2.0 */
4
5
#pragma once
6
7
/* DiagSplit: Parallel, Crack-free, Adaptive Tessellation for Micro-polygon Rendering
8
* Splits up patches and determines edge tessellation factors for dicing. Patch
9
* evaluation at arbitrary points is required for this to work. See the paper
10
* for more details. */
11
12
#include "
scene/mesh.h
"
13
14
#include "
subd/dice.h
"
15
#include "
subd/subpatch.h
"
16
17
#include "
util/set.h
"
18
#include "
util/types.h
"
19
#include "
util/vector.h
"
20
21
CCL_NAMESPACE_BEGIN
22
23
class
Mesh
;
24
class
Patch
;
25
class
SubdAttributeInterpolation
;
26
27
class
DiagSplit
{
28
private
:
29
SubdParams
params;
30
vector<SubPatch>
subpatches;
31
vector<bool>
owned_verts;
32
unordered_set<SubEdge, SubEdge::Hash, SubEdge::Equal> edges;
33
int
num_verts = 0;
34
int
num_triangles = 0;
35
36
/* Allocate vertices, edges and subpatches. */
37
int
alloc_verts(
const
int
num);
38
SubEdge
*alloc_edge(
const
int
v0,
const
int
v1,
const
int
depth,
bool
&was_missing);
39
void
alloc_edge(
SubPatch::Edge
*sub_edge,
40
const
int
v0,
41
const
int
v1,
42
const
int
depth,
43
const
bool
want_to_own_edge,
44
const
bool
want_to_own_vertex);
45
void
alloc_subpatch(
SubPatch
&&sub);
46
47
/* Compute edge factors. */
48
float3
to_world(
const
Patch
*patch,
const
float2
uv);
49
std::pair<int, float> T(
const
Patch
*patch,
50
const
float2
uv_start,
51
const
float2
uv_end,
52
const
int
depth,
53
const
bool
recursive_resolve =
false
);
54
int
limit_edge_factor(
const
Patch
*patch,
55
const
float2
uv_start,
56
const
float2
uv_end,
57
const
int
T);
58
void
assign_edge_factor(
SubEdge
*edge,
59
const
Patch
*patch,
60
const
float2
uv_start,
61
const
float2
uv_end,
62
const
bool
recursive_resolve =
false
);
63
void
resolve_edge_factors(
const
SubPatch
&sub);
64
65
/* Split edge, subpatch, quad and n-gon. */
66
float2
split_edge(
const
Patch
*patch,
67
SubPatch::Edge
*subedge,
68
SubPatch::Edge
*subedge_a,
69
SubPatch::Edge
*subedge_b,
70
float2
uv_start,
71
float2
uv_end);
72
void
split_quad(
SubPatch
&&sub);
73
void
split_triangle(
SubPatch
&&sub);
74
void
split_quad_into_triangles(
SubPatch
&&sub);
75
void
split_quad(
const
Mesh::SubdFace
&face,
const
int
face_index,
const
Patch
*patch);
76
void
split_ngon(
const
Mesh::SubdFace
&face,
77
const
int
face_index,
78
const
Patch
*patches,
79
const
size_t
patches_byte_stride);
80
81
public
:
82
explicit
DiagSplit
(
const
SubdParams
¶ms);
83
84
void
split_patches
(
const
Patch
*patches,
const
size_t
patches_byte_stride);
85
86
size_t
get_num_subpatches
()
const
87
{
88
return
subpatches.size();
89
}
90
91
const
SubPatch
&
get_subpatch
(
const
size_t
i)
const
92
{
93
return
subpatches[i];
94
}
95
96
int
get_num_verts
()
const
97
{
98
return
num_verts;
99
}
100
101
int
get_num_triangles
()
const
102
{
103
return
num_triangles;
104
}
105
};
106
107
CCL_NAMESPACE_END
DiagSplit::DiagSplit
DiagSplit(const SubdParams ¶ms)
Definition
subd/split.cpp:22
DiagSplit::get_num_triangles
int get_num_triangles() const
Definition
subd/split.h:101
DiagSplit::get_num_verts
int get_num_verts() const
Definition
subd/split.h:96
DiagSplit::get_subpatch
const SubPatch & get_subpatch(const size_t i) const
Definition
subd/split.h:91
DiagSplit::get_num_subpatches
size_t get_num_subpatches() const
Definition
subd/split.h:86
DiagSplit::split_patches
void split_patches(const Patch *patches, const size_t patches_byte_stride)
Definition
subd/split.cpp:756
Mesh
Definition
scene/mesh.h:39
Patch
Definition
patch.h:12
SubPatch
Definition
subpatch.h:91
SubdAttributeInterpolation
Definition
interpolation.h:28
vector
Definition
cycles/util/vector.h:20
vector.h
CCL_NAMESPACE_END
#define CCL_NAMESPACE_END
Definition
device/cuda/compat.h:10
dice.h
CCL_NAMESPACE_BEGIN
Definition
python.cpp:41
mesh.h
set.h
Mesh::SubdFace
Definition
scene/mesh.h:79
SubEdge
Definition
subpatch.h:22
SubPatch::Edge
Definition
subpatch.h:106
SubdParams
Definition
dice.h:25
float2
Definition
types_float2.h:13
float3
Definition
sky_math.h:135
subpatch.h
types.h
Generated on
for Blender by
doxygen
1.18.0