Age | Commit message (Collapse) | Author |
|
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
|
|
|
|
While \file doesn't need an argument, it can't have another doxy
command after it.
|
|
Move \ingroup onto same line to be more compact and
make it clear the file is in the group.
|
|
BF-admins agree to remove header information that isn't useful,
to reduce noise.
- BEGIN/END license blocks
Developers should add non license comments as separate comment blocks.
No need for separator text.
- Contributors
This is often invalid, outdated or misleading
especially when splitting files.
It's more useful to git-blame to find out who has developed the code.
See P901 for script to perform these edits.
|
|
Done using:
source/tools/utils_maintenance/c_sort_blocks.py
|
|
Comment or remove unused defines.
|
|
New code is over three times quicker than old one here (e.g. Suzanne
subdiv level 4, 250k tris, threaded part is now 1.4ms instead of 4.5ms
with OMP).
|
|
|
|
|
|
Implementation is less optimal compared to non-opensubdiv drawing but
it is now as good as we can do it without affecting on how patches are
being created by OpenSubdiv.
|
|
Use coarse coordinates to calculate AABB which gives much better approximation
of AABB than using unity AABB size.
|
|
The issue was caused by the changes from this morning.
|
|
This commit contains all the remained parts needed for initial integration of
OpenSubdiv into Blender's subdivision surface code. Includes both GPU and CPU
backends which works in the following way:
- When SubSurf modifier is the last in the modifiers stack then GPU pipeline
of OpenSubdiv is used, making viewport performance as fast as possible.
This also requires graphscard with GLSL 1.5 support. If this requirement is
not met, then no GPU pipeline is used at all.
- If SubSurf is not a last modifier or if DerivesMesh is being evaluated for
rendering then CPU limit evaluation API from OpenSubdiv is used. This only
replaces the legacy evaluation code from CCGSubSurf_legacy, but keeps CCG
structures exactly the same as they used to be for ages now.
This integration is fully covered with ifdef and not enabled by default
because there are several TODOs to be solved first:
- Face varying data interpolation is not really cleanly implemented for GPU
in OpenSubdiv 3.0. It is also not implemented for limit evaluation API.
This basically means we'll have really hard time supporting UVs.
- Limit evaluation only works with adaptivly subdivided meshes so far, which
basically means all the points of CCG are pushed to the limit. This gives
different result from old code.
- There are some serious optimizations possible on the topology refiner
creation, which would speed up initial OpenSubdiv mesh creation.
- There are some hardcoded asumptions in the GPU and DerivedMesh areas which
could be generalized.
That's something where Antony and Campbell can help, making it so the code
is structured in a way which is reusable by all planned viewport projects.
- There are also some workarounds in the dependency graph to make sure OpenGL
buffers are only freed from the main thread.
Those who'll be wanting to make experiments with this code should grab dev
branch (NOT master) from
https://github.com/Nazg-Gul/OpenSubdiv/tree/dev
There are some patches applied in there which we're working on on getting
into upstream.
|
|
Allocating the iterator from a BLI_memarena wasn't threadsafe.
Change the API to use stack memory for iterators.
Thanks to @mont29 for finding exact cause of the bug.
|
|
|
|
|
|
Subsurf on wire edges gave smooth results even if set to simple
subdiv. Added a field to the CCG meshIFC to flag simple subdivision,
then when syncing vertices simply skip moving vertices if in
simple-subdiv mode.
This change affects two places, the level-1 build in sync and the
subdivision up to other levels.
Fixes bug [#32268] Simple Subsurf Modifier gives unexpected results on
edges without faces
projects.blender.org/tracker/index.php?func=detail&aid=32268&group_id=9&atid=498
|
|
* Add new CCG function ccgSubSurf_setAllocMask(). Similar to to
ccgSubSurf_setCalcVertexNormals(), it sets whether the CCG elements
have a mask layer and what that layer's offset is. Unlike normals
however, it doesn't change any behavior during CCG calculation; it's
there only to give CCGKey information on the mask.
* Add a new flag to _getSubSurf(), CCG_ALLOC_MASK. If set, space for
an extra layer is allocated, but the number of CCG layers is not set
to include it. This is done because GridPaintMasks are absolute,
rather than being relative to the subdivided output (as MDisp
displacements are), so we skip subdividing paint masks here.
* Add a new flag to subsurf_make_derived_from_derived(),
SUBSURF_ALLOC_PAINT_MASK. This controls whether CCG_ALLOC_MASK is
set for _getSubSurf(). Related, masks are never loaded in during
ss_sync_from_derivedmesh(). After subdivision is finished, if the
alloc mask flag is set, the number of CCG layers is increase to 4
with ccgSubSurf_setNumLayers().
* Add a new flag to multires_make_from_derived(),
MULTIRES_ALLOC_PAINT_MASK. Not all multires functions need paint
mask data (e.g. multiresModifier_base_apply.) This flag is always
set in MOD_multires.c so that subdividing a mesh with a mask updates
properly even when not in sculpt mode.
* Update multiresModifier_disp_run() to apply, calculate, and add mask
elements. It's almost the same as the existing operations with xyz
coordinates, but treats masks as absolute rather than displacements
relative to subdivided values.
* Update multires_customdata_delete to free CD_GRID_PAINT_MASK in
addition to CD_MDISPS.
* Update multires_del_higher() to call the new function
multires_grid_paint_mask_downsample(), which allocates a
lower-resolution paint mask grid and copies values over from the
high-resolution grid.
|
|
The layout of vert data in CCGSubSurf is almost the same; previously
it was three floats (for xyz coordinate) optionally followed by three
floats for the normal. The only change is that the first three floats
can now be any number of floats.
* _getSubSurf takes a numLayers parameter to set the number of layers,
stored in CCGMeshIFC.numLayers.
* All calls to _getSubSurf currently have numLayers set to 3, except
for UV subsurf, where it is reduced to 2 (with a corresponding
change when reading the results out to use float (*)[2] rather than
float (*)[3].)
* The various VertData* macros in CCGSubSurf.c are now functions that
take a CCGSubSurf pointer, which provides access to CCGMeshIFC,
which has numLayers.
* Add ccgSubSurf_setNumLayers() to the API. Only changes the number of
layers that get subdivided, doesn't change the amount of memory
allocated. So if space for N layers is allocated, it's safe to set
the number of layers to less than N, but not more.
* The rest of the changes are just adding the 'ss' parameter.
|
|
Remove 'CCGSubSurf *ss' parameter from ccgSubSurf_getFaceFaceHandle,
ccgSubSurf_getFaceVert, and ccgSubSurf_getFaceEdge.
|
|
added some missing functions too - which are not used yep but should be there for api completeness.
* CDDM_set_mloop
* CDDM_set_mpoly
* BLI_mempool_count
|
|
|
|
|
|
http://markmail.org/message/fp7ozcywxum3ar7n
|
|
|
|
|
|
if there are >= 1 million faces estimated in the resulting mesh.
(merge from render25 branch)
|
|
|
|
levels, copy coordinates from face grids, and stitch together face grids.
|
|
* subsurf code had a lot of unused variables, removed these where they are obviously not needed. commented if they could be useful later.
* some variables declorations hide existing variables (many of these left), but fixed some that could cause confusion.
* removed unused vars
* obscure python memory leak with colorband.
* make_sample_tables had a loop running wasnt used.
* if 0'd functions in arithb.c that are not used yet.
* made many functions static
|
|
This fixes most of the UV distortion issues with subsurf. Near seams
however there might still be some distortion, but this should at least
not be worse than before. Subsurf UV is enabled by default on new meshes,
and can be enabled in the modifier panel for existing ones.
Before and after:
http://users.pandora.be/blendix/notsmooth.png
http://users.pandora.be/blendix/smooth.png
|
|
- added user settable defaultEdgeData (for auto edge creation
in CCGSubSurf)
- bug fix, possible crash on meshes with loose edges but
in mface not in medge
- missed file in last commit, for proper updating in image
window
|
|
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
|
|
- removed DerivedMesh.drawLooseEdges and replaced with much more
general drawEdgesFlag function that draws based edge flags.
- switch DerivedMesh.drawFacesTex to give user control over which
faces are drawn
- added object_uvs_changed and object_tface_flags_changed functions
to do object recalc flag flush/redraw queueing and added calls
in appropriate places
- added various edge flags to mark TFace information. This is used
by the drawEdgesFlag routine and was the best way I could come
up with to deal with drawing TFace information from modifier stack.
Unfortunate side effects are (1) uses a lot of MEdge flags (although
not needed in file so thats fine) and (2) requires recalculation
of modifier stack on UV selection changes. #2 is disappointing
but I could not find a better solution.
- update UV mesh shadow drawing to use modifier result. At the moment
just uses the final result but probably should be integrated with
the editmode cage option.
- convert draw_tfaces3D to use drawEdgesFlag routine which cleaned
up the code quite a bit.
- convert draw_tface_mesh to draw using result of modifier stack.
Same comment about which result actually gets draw in FACESELECT
mode as for UV editor shadow drawing applies.
There is a still a bug in that selection is using the wrong
mesh to draw.
|
|
- added ModifierTypeInfo.freeData function
- added modifier_{new,free] utility function
- added ccgSubSurf_getUseAgeCounts to query info
- removed subsurf modifier faking (ME_SUBSURF flag is no
longer valid). subsurf modifier gets converted on file load
although there is obscure linked mesh situation where this
can go wrong, will fix shortly. this also means that some
places in the code that test/copy subsurf settings are broken
for the time being.
- shuffled modifier calculation to be simpler. note that
all modifiers are currently disabled in editmode (including
subsurf). don't worry, will return shortly.
- bug fix, build modifier didn't randomize meshes with only verts
- cleaned up subsurf_ccg and adapted for future editmode modifier
work
- added editmesh.derived{Cage,Final}, not used yet
- added SubsurfModifierData.{mCache,emCache}, will be used to cache
subsurf instead of caching in derivedmesh itself
- removed old subsurf buttons
- added do_modifiers_buttons to handle modifier events
- removed count_object counting of modifier (subsurfed) objects...
this would be nice to add back at some point but requires care.
probably requires rewrite of counting system.
New feature: Incremental Subsurf in Object Mode
The previous release introduce incremental subsurf calculation during
editmode but it was not turned on during object mode. In general it
does not make sense to have it always enabled during object mode because
it requires caching a fair amount of information about the mesh which
is a waste of memory unless the mesh is often recalculated.
However, for mesh's that have subsurfed armatures for example, or that
have other modifiers so that the mesh is essentially changing on every
frame, it makes a lot of sense to keep the subsurf'd object around and
that is what the new incremental subsurf modifier toggle is for. The
intent is that the user will enable this option for (a) a mesh that is
currently under active editing or (b) a mesh that is heavily updated
in the scene, such as a character.
I will try to write more about this feature for release, because it
has advantages and disadvantages that are not immediately obvious (the
first user reaction will be to turn it on for ever object, which is
probably not correct).
|
|
didn't really add value. hardcoded to use float[3] now.
|
|
using regular ccgsubsurf but with crease set to full.
|
|
is fast, but can be rather tedious to work with...)
- vertex normals for smooth faces draw correctly now... this code also
switched to drawing with GL_QUAD_STRIP which can be quite a bit faster
(depends how fast graphics card calcs lighting, I get 50% faster here)
|
|
subsurf (always on)
- bug fix, creasing wasn't evaluated properly after incremental change
|
|
happy about coercing (xxx**) to (void**) (sadly enough)
|
|
I would like to have proper creasing (following what appears to be
the informal standard in the subdivision surface literature) but
I do not know when I will get to this or how complicated it will
be. With this patch CCGSubSurfs should now have the same capabilities
as regular subsurfs (barring possible bugs) and so replacing the
old implementation is a reasonable possibility.
|
|
only in one C file and not worth dropping in extern but presumably
will be synced with public CCGSubSurf release I hope to be making
soon.
- Currently the implementation must be enabled by defining
USE_CCGSUBSURFLIB somewhere with your build system. The code should
be considered highly experimental.
|