Blender V4.3
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#ifndef __SUBD_SPLIT_H__
6#define __SUBD_SPLIT_H__
7
8/* DiagSplit: Parallel, Crack-free, Adaptive Tessellation for Micro-polygon Rendering
9 * Splits up patches and determines edge tessellation factors for dicing. Patch
10 * evaluation at arbitrary points is required for this to work. See the paper
11 * for more details. */
12
13#include "subd/dice.h"
14#include "subd/subpatch.h"
15
16#include "util/deque.h"
17#include "util/types.h"
18#include "util/vector.h"
19
20#include <deque>
21
23
24class Mesh;
25class Patch;
26
27class DiagSplit {
28 SubdParams params;
29
30 vector<Subpatch> subpatches;
31 /* `deque` is used so that element pointers remain valid when size is changed. */
32 deque<Edge> edges;
33
34 float3 to_world(Patch *patch, float2 uv);
35 int T(Patch *patch, float2 Pstart, float2 Pend, bool recursive_resolve = false);
36
37 void limit_edge_factor(int &T, Patch *patch, float2 Pstart, float2 Pend);
38 void resolve_edge_factors(Subpatch &sub);
39
40 void partition_edge(
41 Patch *patch, float2 *P, int *t0, int *t1, float2 Pstart, float2 Pend, int t);
42
43 void split(Subpatch &sub, int depth = 0);
44
45 int num_alloced_verts = 0;
46 int alloc_verts(int n); /* Returns start index of new verts. */
47
48 public:
50
51 explicit DiagSplit(const SubdParams &params);
52
53 void split_patches(Patch *patches, size_t patches_byte_stride);
54
55 void split_quad(const Mesh::SubdFace &face, Patch *patch);
56 void split_ngon(const Mesh::SubdFace &face, Patch *patches, size_t patches_byte_stride);
57
58 void post_split();
59};
60
62
63#endif /* __SUBD_SPLIT_H__ */
void post_split()
void split_patches(Patch *patches, size_t patches_byte_stride)
void split_quad(const Mesh::SubdFace &face, Patch *patch)
void split_ngon(const Mesh::SubdFace &face, Patch *patches, size_t patches_byte_stride)
DiagSplit(const SubdParams &params)
Edge * alloc_edge()
#define CCL_NAMESPACE_END
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
#define T