Age | Commit message (Collapse) | Author |
|
This patch attempts to clean up and document the GPU buffers
code. There are a few bug fixes as well.
Patch reviewed here: http://codereview.appspot.com/4631052/
Summary:
* Bugfix: make GPU_buffer_copy_normal convert from shorts to floats
correctly, also fixed the use of cached face normal CustomData.
* Bugfix: changed the `mat_nr' field of GPUBufferMaterial from char to
short.
* Changed color buffer setup to not alloc a temporary copy of color
data, just passes the MCol data in directly.
* Changed the GPU buffer pool code to make clearer what operates
specifically on the global pool.
* Lots of refactoring for GPU_drawobject_new; should operate mostly
the same (except got rid of one unecessary allocation), just split
into more functions and without macros now.
* Converted some #defines into enumerations.
* Made some stuff private, pulled out of header file.
* Deleted unused function GPU_buffer_pool_free_unused().
* Removed GPU_interleaved_setup and related #defines. (I think this
was used for editmode VBOs, but those were disabled.)
* Added lots of comments.
* Added a few comments in the code signed `--nicholas' to note places
where I am unsure about design or usage, would be good to address
these better.
* Code formatting changed to be more consistent with the rest of
Blender.
* Renamed some fields and variables to be more consistent with
Blender's naming conventions.
* Renamed some fields and variables to use more descriptive names,
e.g. renamed `redir' to `mat_orig_to_new'.
* Removed print outs with DEBUG_VBO -- don't feel too strongly about
this one, just not used elsewhere in Blender, could be easily added
back if others disagree though.
* Moved the PBVH drawing code down to the bottom of the file, before
was sitting in the middle of the other VBO code
|
|
- Constructive modifiers are enabled by default in sculpt mode.
- There's option to disable all constructive modifiers in the "Options"
panel of toolbox in sculpt mode,
- Use one column in options panel to make strings easier to read
- No modifiers would still be applied on multires
|
|
|
|
(VBO's)
|
|
|
|
- made EXPANDED_AGRP take bAnimContext as an argument.
- remove unneeded NULL check drawFacesColored functions.
- comment some vars which are set but not used.
|
|
======================
All this work with sculpting on armatured/deformed mesh allowed to
implement sculpting on non-locked keys very easy -- just use the same
approach of propagating offsets from deformed PBVH to "sculpting layer".
- If key is locked, then old logic would be used.
- If there's multires modifier enabled, sculpting would happen on multires.
|
|
- use BLI math funcs for normal float/short conversion.
- correct some un-intentional float/double promotions.
|
|
into account that some tools use normals for things other than display. Now
we properly initialize vertex normals at flat faces too.
Also fixed a normal refresh issue, and deduplicated CDDM/mesh normal
calculation code.
|
|
weighted normals as the render engine, and the render engine will copy
normals from the mesh rather than always recalculating them.
Subsurf/multires still use regular vertex normals, but they are expected
to be sufficiently high resolution to not need this.
This means that normal maps displayed in the viewport actually match the
render engine exactly and don't have artifacts due to this discrepancy.
It of course also avoids unexpected surprises where your render normals
look different than your viewport normals.
Subversion bumped to 4 for version patch to recalculate normals.
Patch by Morten Mikkelsen, with some small changes.
|
|
|
|
the two files mikktspace.h and mikktspace.c. These are standalone files
which can be redistributed into any other application and regenerate the
same tangent spaces. The implementation is independent of the ordering
of faces and the vertex ordering of faces.
|
|
python functions.
- use NULL rather then 0 where possible (makes code & function calls more readable IMHO).
- set static variables and functions (exposed some unused vars/funcs).
- use func(void) rather then func() for definitions.
|
|
used to be used for halo's
|
|
Used a crazyspace approach (like in edit mode), but only modifiers with
deformMatricies are allowed atm (currently shapekeys and armature modifiers only).
All the rest modifiers had an warning message that they aren't applied because
of sculpt mode. Deformation of multires is also unsupported.
With all this restictions users will always see the actual "layer" (or maybe
mesh state would be more correct word) they are sculpting on.
Internal changes:
- All modifiers could have deformMatricies callback (the same as deformMatriciesEM but
for non-edit mode usage)
- Added function to build crazyspace for sculpting (sculpt_get_deform_matrices), but it
could be generalized for usage in other painting modes (particle edit mode, i.e)
Todo:
- Implement crazyspace correction to support all kinds of deformation modifiers
- Maybe deformation of multires isn't so difficult?
- And maybe we could avoid extra bad-level-stub for ED_sculpt_modifiers_changed
without code duplicating?
|
|
|
|
also removed unused vars.
can_pbvh_draw() had a NULL check which is never needed (callers check for this), a NULL ob would have crashed the function anyway.
|
|
- move GS() define into DNA_ID.h
- add BLI_utildefines as an automatic include with makesrna generated files.
|
|
MAKE_ID, FILE_MAXDIR, moved the generic defines to BLI_utildefines.h.
no functional changes.
|
|
Use object's displists for storing deformed tesselated curve. Was unable to
totally get rid of curve's displist because of how texture space is calculating.
|
|
VBO enabled, GLSL shading and bevel modifier leads to crash when entering edit mode
Bevel modifier doe not support remapping still, so added check about original index
in cdDM_drawFacesTex_common. Now it works like VBO-less drawing for that special case.
|
|
|
|
Root cause is that some drawing modes don't work with PBVH
drawing. Worked around by adding a call to update mesh normals from
the PBVH so that sculpted changes appear correctly in those
"unsupported" modes. (They'll still draw much more slowly than solid,
but should at least appear correct now.)
|
|
- VBO UV Edge display wasn't allocating a large enough array for drawing.
- VBO UV Edge drawing was using an edge flag with faces.
- notifier for modifiers updating the UV window.
|
|
Solidify modifier wasn't assigning origindex values.
- BLI_math.h array functions: range_vni(), mul_vn_fl(), mul_vn_vn_fl(), add_vn_vn(), fill_vni().
- define 'AT' as __FILE__ ":" STRINGIFY(__LINE__), useful for quick debug prints.
|
|
- removed deprecated bitmap arg from IMB_allocImBuf (plugins will need updating).
- mostly tagged UNUSED() since some of these functions look like they may need to have the arguments used later.
|
|
This is a more general problem that drawing functions would skip faces when the original index could not be found, screw result for example wasnt visible in editmode too.
Fixed by adding a material set argument to DerivedMesh->drawMappedFaces(), this was already being done in some of the other drawing functions.
|
|
drawing the triangle arrays were only broken up by hidden faces, but switches in material were ignored.
now check for materual context changes.
|
|
|
|
|
|
|
|
for consistency.
|
|
* Problem was calling setDrawOptions even if there was no original face index to use
|
|
|
|
the Basis
PBVH used the same verts array as mesh data and shape key/reference key coords
were applying on the mesh data, so on some refreshing undeformed mesh was
displayed.
Added utility functions to get vert coords from key block, apply new vert coords
on keyblock and function to apply coords on bpvh, so now pbvh uses it's ovn
vertex array and no changes are making to the mesh data.
Additional change:
Store key block name in SculptUndoNode, so now shape wouldn't be copied to
wrong keyblock on undo
|
|
modifiers (VBOs)
Was actually a couple bugs:
* VBO bug was that hidden faces weren't being skipped correctly. Fixed that and rewrote this bit of VBO drawing code more clearly (less duplication, less unecessary state, and comments even)
* Second bug was that CCGDerivedMesh wasn't outputing ORIGINDEX data for faces. (it's not doing it for edges or verts either, but I don't know that we need it to.) At any rate, we do need this data for faces so that additional DerivedMeshes on top of subsurf know what faces in the editmesh are hidden.
|
|
* Problem was that the sculpt PBVH was only used for redrawing if the derived mesh's vertices were equal the base mesh's vertices, which isn't the case when sculpting on shape keys.
|
|
Fixes various crashes and redraw problems, most noticeable new feature
is that you can now sculpt on a multires mesh with deforming modifiers
preceding it.
I've left out support for sculpting on multires with enabled modifiers
following it, in this case only the base mesh can be sculpted now. The
code changes needed to do this are just too ugly in my opinion, would
need a more torough redesign which I don't think we should try now. In
my opinion this is also not really an important case, since it's going
to be incredibly slow anyway to run a modifier on a high res mesh while
sculpting.
So, to summarize current state:
* Fastest sculpting: base mesh with no modifiers or multires with only
modifiers preceding it.
* Slower sculpting: base mesh with modifiers, depends on the speed of
the modifiers.
* Not supported: multires mesh with modifiers following it.
|
|
|
|
|
|
* #20833: layer brush doesn't work with multires.
* #20946: sculpt mode partially removes parts of the mesh in the viewport.
* #20420: grab brush stops after moving some distance.
* #20906: sculpt grab tool moves in wrong direction.
* #21132 and #21272: undo on object with subdivision surface modifier crashes.
* #21115: subsurf + multires + sculpting + undo causes crash.
* #20683: sculpt + multires apply + undo crash.
* #19094: wrong outline in solid mode.
|
|
|
|
|
|
disabled for realtime displaying but enabled for rendering.
- Calculate tex space for curves before modifiers applying.
|
|
Used approach with creating DerivedMesh for curves whet they've got such modifiers.
Available modifiers are: array, edge split, mirror, solidify, subsurf.
|
|
Thank you, Andre Tibben, for the fix.
|
|
|
|
|
|
|
|
VBO draw cod was assuming a buffer was allocated for drawing.
|