2022-02-11 13:53:21 +01:00
|
|
|
/* SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
* Copyright 2011-2022 Blender Foundation */
|
2011-04-27 11:58:34 +00:00
|
|
|
|
|
|
|
|
#ifndef __SUBD_SPLIT_H__
|
|
|
|
|
#define __SUBD_SPLIT_H__
|
|
|
|
|
|
|
|
|
|
/* DiagSplit: Parallel, Crack-free, Adaptive Tessellation for Micropolygon Rendering
|
2012-03-20 22:56:26 +00:00
|
|
|
* Splits up patches and determines edge tessellation factors for dicing. Patch
|
2011-04-27 11:58:34 +00:00
|
|
|
* evaluation at arbitrary points is required for this to work. See the paper
|
|
|
|
|
* for more details. */
|
|
|
|
|
|
2021-10-24 14:19:19 +02:00
|
|
|
#include "subd/dice.h"
|
|
|
|
|
#include "subd/subpatch.h"
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2021-10-24 14:19:19 +02:00
|
|
|
#include "util/deque.h"
|
|
|
|
|
#include "util/types.h"
|
|
|
|
|
#include "util/vector.h"
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2019-08-14 01:53:09 -04:00
|
|
|
#include <deque>
|
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
CCL_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
|
|
class Mesh;
|
|
|
|
|
class Patch;
|
|
|
|
|
|
|
|
|
|
class DiagSplit {
|
2013-11-28 00:13:32 +01:00
|
|
|
SubdParams params;
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2019-08-14 01:53:09 -04:00
|
|
|
vector<Subpatch> subpatches;
|
2021-02-05 16:23:34 +11:00
|
|
|
/* `deque` is used so that element pointers remain valid when size is changed. */
|
2019-08-14 01:53:09 -04:00
|
|
|
deque<Edge> edges;
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2016-04-11 22:49:09 +02:00
|
|
|
float3 to_world(Patch *patch, float2 uv);
|
2019-08-30 10:52:39 +10:00
|
|
|
int T(Patch *patch, float2 Pstart, float2 Pend, bool recursive_resolve = false);
|
2019-08-14 01:53:09 -04:00
|
|
|
|
|
|
|
|
void limit_edge_factor(int &T, Patch *patch, float2 Pstart, float2 Pend);
|
|
|
|
|
void resolve_edge_factors(Subpatch &sub);
|
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
void partition_edge(
|
|
|
|
|
Patch *patch, float2 *P, int *t0, int *t1, float2 Pstart, float2 Pend, int t);
|
|
|
|
|
|
2019-08-14 01:53:09 -04:00
|
|
|
void split(Subpatch &sub, int depth = 0);
|
|
|
|
|
|
|
|
|
|
int num_alloced_verts = 0;
|
|
|
|
|
int alloc_verts(int n); /* Returns start index of new verts. */
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
Edge *alloc_edge();
|
|
|
|
|
|
|
|
|
|
explicit DiagSplit(const SubdParams ¶ms);
|
|
|
|
|
|
|
|
|
|
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);
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2019-08-14 01:53:09 -04:00
|
|
|
void post_split();
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
CCL_NAMESPACE_END
|
|
|
|
|
|
|
|
|
|
#endif /* __SUBD_SPLIT_H__ */
|