Commit Graph

138 Commits

Author SHA1 Message Date
bbce51d116 replace hashes with sets where possible. 2013-08-25 20:03:45 +00:00
f3ceee51fa fix for GPU_update_bmesh_buffers not setting bmesh vertex index values as dirty (could cause errors later). 2013-08-24 11:46:08 +00:00
b9ae749480 Make GPU buffers allocation/freeing safe for threading
Code in GPU_buffers_free was already trying to be safe
for threading, by skipping OGL calls there, but in fact
it was still buggy.

Namely, freeing was doing buffers shift in a cycle, and
if two threads will call this function shifting will go
crazy.

Now made it so GPU_buffers_alloc and GPU_buffers_free
are using mutex lock, so they're completely safe for
threading. Same goes to gpu_buffer_setup function.

It required minor functions reshuffle, so there're no
locks happening from locked thread, but it's all very
straightforward change

--
svn merge -r58276:58277 ^/branches/soc-2013-depsgraph_mt
2013-08-19 10:06:05 +00:00
3fbd8abcfd OpenGL VBO's: free VBO pool before redraw, otherwise this just holds onto memory
after objects are deleted until another big object is added. There's no good reason
to do this, or to think that our pool is somehow much faster than using the OpenGL
API to allocate and free buffers.
2013-08-09 19:55:43 +00:00
04ea8c0ee8 remove the pointer from BLI_bitmap's typedef,
hides that an arg passed is really an array which may be modified by other functions.
2013-07-22 23:20:48 +00:00
a6b505ef0b style cleanup 2013-06-06 06:02:46 +00:00
f18fad668f Fix textured draw mode + dyntopo crash fix to cover more cases. 2013-06-05 15:54:41 +00:00
aa96f0290a Obsessive Null Checking Compulsion case:
Textured draw mode + DynTopo crashed after recent specularity tweak.
2013-06-05 09:10:56 +00:00
4a7f37f6ed Fix #35602: VBO + dynamic topology sculpt did not show specularity. 2013-06-04 17:10:57 +00:00
0408684763 avoid per-vertex mask layer lookups for dyntopo. 2013-05-02 06:09:05 +00:00
89bda7899d style cleanup & some spelling 2013-02-03 10:28:28 +00:00
9a50f45469 Skip hidden faces in PBVH BMesh ray intersection test
Moved the GPU function gpu_bmesh_face_visible() to BKE_paint and
inverted the test to match equivalent tests for other mesh types:
paint_is_bmesh_face_hidden().

Changed BKE_pbvh_bmesh_node_save_orig() to not save hidden faces into
the triangle array.

Modified the non-use-original branch of pbvh_bmesh_node_raycast() to
skip hidden faces.

Fixes bug #33914:
projects.blender.org/tracker/index.php?func=detail&aid=33914&group_id=9&atid=498
2013-01-19 16:10:21 +00:00
5ddc7d64a8 optimize bmesh operations that use triangle BMFace's (dyn-topo and mesh conversion). 2013-01-16 21:09:54 +00:00
d342e3ef0f Use GPU_Buffers to draw wireframe when in dynamic-topology sculpt mode
This adds an override to the CDDM edge drawing function that switches
to GPU_Buffers drawing for PBVHes of type PBVH_BMESH.

Within the GPU_Buffers code, glPolygonMode() is used to draw lines
instead of faces.
2012-12-30 18:30:13 +00:00
d383c32413 Add GPU_buffers support for drawing dynamic topology nodes
The GPU interface for PBVH drawing gets a new pair of build/update
buffers functions for drawing BMFaces and BMVerts.

TODO: the diffuse color is hardcoded to 0.8 gray rather than using
material color.

TODO: only VBO drawing is implemented, no immediate mode.
2012-12-30 18:24:54 +00:00
9046c292f8 fix [#33598] Regression in 2.65 while opening a 2.64 file
VBO's were using a material limit half the size of the rest of blender.
2012-12-18 11:17:20 +00:00
9b948717b0 code cleanup: float <> double conversion. 2012-11-03 18:23:30 +00:00
25591e958d style cleanup: tabs & whitespace 2012-11-03 15:35:03 +00:00
b4e484e211 Fix for own r51737.
Refactoring of draw code showed another problem: The MCol we want to draw may change without dm rebuild (e.g. when enabling solid textured option)! Also, choosing which MCol layer to use in GPU code is stupid, different draw modes use different layers/order of precedence!

Solved this by adding a new colType parameter to GPU_color_setup, and removing any 'color choosing' code from gpu_buffers.c.
2012-10-30 11:00:06 +00:00
f139377a1a Complete fix for [#33002] Wrong vertex color.
Appart from the color glitch, there was several problems with vpaint:
* "fast_update" mode was never on, because of wrong testing code;
* drawing refresh during stroke in "fast_update" (i.e. no dm rebuild) mode was broken in VBO mode, because updated (tess data) mcol wasn't moved to colors GPUBuffer.

Solved the later point by adding a new DM_DIRTY_MCOL_UPDATE_DRAW flag to DerivedMesh dirty var, which is set each time vpaint stroke directly update me->mcol, and forces GPU_color_setup() to refresh the gpu's colors buffer.

Also got rid of the uggly GPU_color3_upload(), which basically did the same thing, but with an additional intermediate buffer !
2012-10-29 16:26:18 +00:00
2b9e70c81e Fix #32943: sculpt mode draw crash with VBO and flat shaded, hidden faces. 2012-10-23 11:07:05 +00:00
6e62491c5a Fix #32522: Object's diffuse color not showing in Sculpt Mode
Added option to display object's diffuse color multiplied by sculpting
mask. This option could be found in Options panel of toolshelf when in
sculpting mode.

Thanks to Nicholas and Brecht for reviewing the patch!
2012-10-22 17:33:53 +00:00
3a52a876b6 Fix for drawing meshes with VBOs disabled in sculpt mode
* This is another fix for r51118. Was drawing flat-shaded GPU buffers
  with VBOs even when VBOs were disabled in the preferences.
2012-10-20 00:45:44 +00:00
5ad61e9642 Fix for VBO drawing in multires sculpting
Was a mistake in a code cleanup commit, r51118.

Fixes bug [#32919] Sculting performance regression in svn_51118
projects.blender.org/tracker/?func=detail&aid=32919&group_id=9&atid=498
2012-10-19 02:38:50 +00:00
0c0fa7dde6 Improve flat-shaded VBO drawing for sculpt meshes
Separate vertex copies are now made for flat-shading, such that the
normal is correctly flat-shaded. The element index buffer is not
created in this case.
2012-10-06 16:52:52 +00:00
1df170bb96 Code cleanups for PBVH GPU buffers
* De-duplicate GPU code to check if VBO should be used.

* Add a flag to indicate if the buffer should be drawn smooth or not,
  rather than checking each time the node is drawn.
2012-10-06 16:42:11 +00:00
323ad98496 Fix: gpu_colors_enable could cause 3d display corruption because it always enables glColorMaterial. Make sure to call gpu_colors_disable even if we don't have a mask layer, to match gpu_colors_enable above 2012-10-01 07:53:54 +00:00
df298490b8 mask data is no longer automatically added when sculpting (except when there is a multi-res modifier). 2012-10-01 05:19:57 +00:00
168ffbfb67 Revert changes made to support diffuse color when sculpting
This changes are not stable enough and trying fix it could backfire in some
other regressions which isn't wanted so much close to the release.

This means objects will have gray color as diffuse which becomes darker in
masked areas for 2.64.

Proper fix is aimed for 2.65.

This commit reverts 50827 and 50898.
2012-09-30 15:04:46 +00:00
b2167e771a Fix #32663: Sculpt masks are too dark
Scaled mask multiplier to 0.25..1.0 instead of 0.0..1.0.
2012-09-26 07:55:52 +00:00
2637efa2a3 Fix #32522: Object's diffuse color not showing in Sculpt Mode
It was missing since sculpting mask implementation.

Now object's color would be multiplied by sculpt mask value.

For VBOs it's done by storing final color in VertexBufferFormat and
mimic behavior of setMaterial callback for getting current diffuse
color.

For non-VBOs diffuse color is getting from current OpenGL context.
2012-09-23 14:16:52 +00:00
32cf7fcdb1 code cleanup: spelling 2012-07-16 23:23:33 +00:00
0adf252c9b Fix #31593: Every time I switch between edit and object mode, it crashes
Crash was caused by incorrect restoring OpenGL context due to some
weird bit operations used to indicate whether stuff like color arrays
is initialized resulting in some unpredictable results on different
platforms and drivers.
2012-06-05 08:41:53 +00:00
032d83ecc4 style cleanup: defines with braces 2012-05-27 20:13:59 +00:00
dab1d8e487 style cleanup 2012-05-22 22:03:41 +00:00
931146731d Fix memory leak when deleting all vertices from mesh with certain modifiers (bevel and array among them) and VBO are enabled. 2012-05-22 17:33:58 +00:00
9dd981a440 style cleanup: block comments 2012-05-16 23:37:23 +00:00
ce17c35240 style cleanup: mainly sculpt/whitespace 2012-05-11 08:05:47 +00:00
d35d0e38ce Add mask-drawing support to GPU_Buffers.
This is the last commit of the sculpt masking merge. Documentation:
http://wiki.blender.org/index.php/User:Nicholasbishop/PaintMasks

Thanks to Brecht for reviewing!

* For VBO, add color to the VertexBufferFormat structure as three
  unsigned bytes. Since mask elements are scalar the three color
  components are identical to eachother, but the fixed-function OpenGL
  pipeline requires colors to be either three or four components.

* For the same reason, multires VBO drawing now copies into the
  VertexBufferFormat format as well.

* Regression: material colors will not show up correctly now, masks
  colors are overriding. Not sure how to fix this nicely (would be
  much easier to fix if drawing with vertex shaders.)

* Also, masks will only draw PBVH drawing, so only 'solid' drawing
  will work correctly with masks.
2012-05-10 20:36:34 +00:00
3ee0305ebb Use VertexBufferFormat for multires VBO. 2012-05-10 20:36:24 +00:00
f751d0f6ae Replace hardcoded DMGridData structure with CCGElem/CCGKey.
* Changes to DerivedMesh interface: DMGridData has been removed,
  getGridData() now returns an array of CCGElem pointers. Also added
  getGridKey() to initialize a CCGKey (implemented only by
  CCGDerivedMesh.)

* PBVH: added BLI_pbvh_get_grid_key().

* A lot of code is affected, but mainly is just replacing
  DMGridData.co, DMGridData.no, and sizeof(DMGridData) with the
  CCG_*_elem functions, removing the reliance on grid elements of
  exactly six floats.
2012-05-10 20:33:09 +00:00
d20c129a9c style cleanup: whitespace/operators 2012-05-09 09:24:15 +00:00
e701f9b670 style cleanup: whitespace / commas 2012-04-29 15:47:02 +00:00
b340f930ec style cleanup: changes to brace placement / newlines - for/while/if/switch 2012-04-28 06:31:57 +00:00
5c89138684 style cleanup: comments 2012-04-22 11:54:53 +00:00
3c1b5b5632 stule cleanup: edits for files which were recently cleaned up. 2012-04-02 22:26:00 +00:00
0740e9e464 fix [#30643] Crasher on entering edit mode with VBOs enabled 2012-03-30 06:11:59 +00:00
81d8f17843 style cleanup: pep8, indentation 2012-03-24 07:36:32 +00:00
ab4a2aaf4a style cleanup: follow style guide for formatting of if/for/while loops, and else if's 2012-03-24 06:38:07 +00:00
9751653410 Renaming CD_WEIGHT_MCOL/MLOOPCOL and their masks from WEIGHT to PREVIEW, as this layer is now also used for various preview tasks in Object mode.
“Cleanup” commit, no functional changes.
2012-03-22 08:41:50 +00:00