Commit Graph

66 Commits

Author SHA1 Message Date
Sergey Sharybin
98197343e8 OpenSubdiv: Cleanup, use C++ range based loop
Avoid indirection via define.
2020-05-27 12:07:16 +02:00
Sergey Sharybin
be03a756e5 OpenSubdiv: Cleanup, move utility function to base type conversion 2020-05-27 12:07:16 +02:00
Sergey Sharybin
0ff665e4ce OpenSubdiv: Refactor, move type conversion to base fodler 2020-05-27 12:07:16 +02:00
Sergey Sharybin
4886a704b3 OpenSubdiv: Refactor, move evaluator to own folder 2020-05-27 12:07:16 +02:00
Sergey Sharybin
6fc9d106ad OpenSubdiv: Completely disable topology verification
Previously it was enabled for debug builds, now it is to be enabled
explicitly.

The reason for this is to reduce overhead when debugging other areas
which might involve subdivision surface. When conversion is to be
debugged set this manually in the code.
2020-05-27 12:07:16 +02:00
Sergey Sharybin
0d089ce881 OpenSubdiv: Refactor, move edge map to base folder 2020-05-27 12:07:16 +02:00
Sergey Sharybin
4ab36c4393 OpenSubdiv: Refactor creation of topology refiner
Consolidate it inside of the topology refiner implementation class,
which would allow to store extra data acquired during construction
of the OpenSubdiv's object.
2020-05-27 12:07:15 +02:00
Sergey Sharybin
57aae2a355 OpenSubdiv: Refactor, use C++ allocation for internal classes
Only use OBJECT_GUARDED_{NEW. DELETE} for structures which are part of
public C-API (and hence can not have new/delete operators overloaded).

Could try being brave and override new/delete from under C++ ifdef.
2020-05-27 12:07:15 +02:00
Sergey Sharybin
c81a5f58f8 OpenSubdiv: Refactor, move topology refiner factory to topology folder 2020-05-27 12:07:15 +02:00
Sergey Sharybin
67fe31d751 OpenSubdiv: Refactor, move topology refiner to own folder
In the future factory will also be moved there.
2020-05-27 12:07:15 +02:00
Sergey Sharybin
7c0bea0d65 OpenSubdiv: Refactor, move device specific code to own files
Also, move all device files to own folder.

Makes it so checks for device availability are done in a localized
place.
2020-05-27 12:07:15 +02:00
Sergey Sharybin
31fc01eecb OIpenSubdiv: Cleanup, move to a better sounding namespace
The code is not only part of C-API, but also implements Blender-specific
glue level implementation.
2020-05-18 17:25:07 +02:00
Sergey Sharybin
2ad5131f77 OpenSubdiv: Cleanyp, remove old GPU code
All parts of drawing (shaders, GL mesh descriptor, material partitioner
and so on) needs to be redone for the draw manager and new OpenSubdiv
library.

Removing untested code which is doomed to be replaced to make localized
refactoring easier.
2020-05-18 17:06:48 +02:00
Sergey Sharybin
22f68f85a4 OpenSubdiv: Cleanup, remove unused topology orientation code
The code was trying to make winding consistent and manifold, same as
OpenSubdiv expects it to.

Unfortunately, the code was having some issues in corner cases so the
winding wasn't really correct.
Fortunately, the latter (compared to when this code was originally
written) supports orientation on OpenSubdiv side.

Removing code which is currently unused in Blender and which had
known issues. Is simple enough to bring the code from Git history
if the functionality is needed in the future.
2020-05-18 17:06:48 +02:00
Sergey Sharybin
9aeb475e99 Subdiv: Fix wrong non-manifold subdivision in certain cases
Was happening when only partial subset of callbacks was specified.

The reason was that there was a callback to specify edges sharpness
but no callback to specify vertex sharpness, so the special case for
non-manifold edges was not run.

Fixes T75697: Multires in simple mode doesn't work correct on a plane
2020-04-22 14:26:12 +02:00
Dalai Felinto
2d1cce8331 Cleanup: make format after SortedIncludes change 2020-03-19 09:33:58 +01:00
Sergey Sharybin
8622372256 OpenSubdiv: Make non-full geometry less strict for sharpness
Allow to mark individual vertices as infinitely sharp even if there is
no full topology and no access to edges: infinite sharp vertices do not
need connectivity information.
2020-03-13 14:07:44 +01:00
Sergey Sharybin
bcac081ad5 OpenSubdiv: Allow less topology callbacks assigned
Useful for cases when topology does not need to have any
crease or UV layers. Now instead of assigning callbacks
which returns zero data is possible to simply assign the
callback itself to NULL.
2020-02-28 14:30:49 +01:00
Sergey Sharybin
9f48a04799 Fix T63766: Multiresolution behavior when using crease edge
Switch to Gregory basis patches which are tangent continuous across their
boundaries.

Originally we've used BSpline basis patches to be more compatible with the
old subdivision code, but a lot of things changed anyway.
2019-12-05 16:38:26 +01:00
Sergey Sharybin
f305972377 OpenSubdiv: Initial implementation of batched evaluation
The idea is to give multiple coordinates to evaluator and evaluate them
all at once, avoiding any possible overhead.
2019-10-30 15:15:56 +01:00
Sergey Sharybin
05ee67a7c8 OpenSubdiv: Make internal evaluator aware of batched evaluation
Allows to pass multiple patch coordinates for evaluation.
2019-10-30 15:15:55 +01:00
Sergey Sharybin
ca3a96c243 OpenSubdiv: Use more generic access to patch coordinates
Saves another unnecessary temporary data copy during evaluation.
2019-10-30 15:15:55 +01:00
Sergey Sharybin
d3c87876c9 OpenSubdiv: Cleanup, remove old compatibility code
Consider that all builders have face-varying evaluation now.
2019-10-30 15:15:55 +01:00
Sergey Sharybin
5843827fb9 OpenSubdiv: Cleanup, remove unused class 2019-10-30 15:15:55 +01:00
Sergey Sharybin
4227a35b32 OpenSubdiv: Avoid unnecessary memory copies
Make evaluator itself to write directly to the output buffer.

Brings unmeasurable speedup and makes it possible to simplify
some buffer class logic.
2019-10-30 15:15:55 +01:00
Sergey Sharybin
31873218b2 OpenSubdiv: Use smaller buffer sizes and strides
We currently don't support interleaved varying data, so can make
some buffer smaller.
2019-10-30 15:15:55 +01:00
Sergey Sharybin
b4fb3db559 OpenSubdiv: Cleanup, remove unused PatchBuffer class 2019-10-30 15:15:55 +01:00
Sergey Sharybin
8e470033ab OpenSubdiv: Cleanup, remove unused evaluator member 2019-10-30 15:15:55 +01:00
Sergey Sharybin
7dda8f7faf OpenSubdiv: Cleanup, remove unused static methods 2019-10-30 15:15:55 +01:00
Sergey Sharybin
0cc45eaac4 OpenSubdiv: Add accessor to vertex edges via refiner C-API 2019-10-03 12:36:01 +02:00
Campbell Barton
fb9024bded Fix error in opensubdiv topology refiner face matching check 2019-10-03 07:32:28 +10:00
ae6300a8b7 Fix T66022: crash adding subdivision surface modifier to some meshes
This reverts commit 7c9f64d00835:
"Fix T63766: Multiresolution behavior when using crease edge"
2019-06-23 00:03:36 +02:00
Sergey Sharybin
7c9f64d008 Fix T63766: Multiresolution behavior when using crease edge
Switch to Gregory basis patches which are tangent continuous across their
boundaries.

Originally we've used BSpline basis patches to be more compatible with the
old subdivision code, but a lot of things changed anyway.
2019-06-21 15:37:46 +02:00
Campbell Barton
a1ef2e4b16 Cleanup: comment, RNA spelling 2019-06-17 12:52:20 +10:00
Campbell Barton
4439e5d0ba Cleanup: add trailing commas to avoid right shift 2019-04-18 17:19:44 +02:00
Campbell Barton
e12c08e8d1 ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.

For details on usage and instructions for migrating branches
without conflicts, see:

https://wiki.blender.org/wiki/Tools/ClangFormat
2019-04-17 06:21:24 +02:00
Sergey Sharybin
9d1cab2eba Fix T63030: Edge crease is not applied for boundary edges
Caused by missing vertex sharpness comparison in the topology
comparator.
2019-03-28 11:49:08 +01:00
Campbell Barton
6cbb4c576a Cleanup: manually remove header text not handled by automation 2019-02-02 01:49:31 +11:00
Sergey Sharybin
baa5fe1bfc Cleanup: Spelling in comment 2019-01-23 10:27:55 +01:00
Sergey Sharybin
a8902ab49a Fix T58640: Round corner in edge crease of subdivided surfaces
Fix T60502: Creasing behavior on 2.8 seams wrong

Was a mistake in a boundary vertices sharpness calculation.
2019-01-22 15:35:30 +01:00
Sergey Sharybin
0ec77aaea5 Cleanup: space after template bracket 2019-01-22 13:51:21 +01:00
Sergey Sharybin
6ae72d2d41 OpenSubdiv: Remove topology orientation code
It is no longer used and has some issues in corner cases
which are not handled in a way which OpenSubdiv expects.
2019-01-16 11:00:43 +01:00
Sergey Sharybin
4fe6a2d950 OpenSubdiv: Implement UV topology comparison 2019-01-16 11:00:43 +01:00
Sergey Sharybin
e064777cac OpenSubdiv: Correct topology cpmparator
This fixes following errors:

- The code didn't work correctly for edges reconstructed by
  the OpenSubdiv's topology refiner (due to indexing
  difference).

- Sharpness of non-manifold and boundary edges was not
  working correctly.
2019-01-16 11:00:42 +01:00
Sergey Sharybin
5a794c9685 OpenSubdiv: Use own utility header
Replaces direct access to std.
2019-01-16 11:00:42 +01:00
Sergey Sharybin
f36f60543f OpenSubdiv: Cleanup, indentation 2019-01-16 11:00:42 +01:00
Sergey Sharybin
f19b3f9b77 OpenSundiv: Simplify tweaking of shared stencil/patch settings 2019-01-07 10:33:40 +01:00
Sergey Sharybin
a2a8e71210 OpenSubdiv: API, expose vertex boundary interpolation option
Only affects internal API, bout could be exposed as an option for
the compatibility reasons with other software.

Is a part of some ongoing development of multires, but might or
might not be used.
2018-10-31 17:47:40 +01:00
Sergey Sharybin
de811518c0 OpenSubdiv: Cleanup, the TODO was actually solved 2018-09-26 11:52:06 +02:00
Sergey Sharybin
3a15834d63 OpenSubdiv: Cleanup 2018-09-26 10:21:34 +02:00