Commit Graph

22 Commits

Author SHA1 Message Date
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
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
68b8f3b0a8 Skip hidden elements in PBVH iterator, raycast, and drawing. 2012-03-14 06:32:25 +00:00
c21c58f44c style cleanup, also remove unused externs. 2012-03-11 19:09:01 +00:00
89a963fb7f style cleanup: comment blocks 2012-03-09 18:28:30 +00:00
71e5edeb6a Code cleanup: use typedefs for DerivedMesh drawing callbacks.
There are still fairly bewildering set of callbacks being tossed
around, but it's at least a little less verbose now.
2012-03-07 04:41:14 +00:00
c7ffe7f621 Draw individual face's material and shading correctly in the PBVH.
Previously, the shading and material was set once per PBVHNode when
drawing. This is still the case, but PBVHNodes are now built to
contain only one material and shading mode.

This is done with an extra partitioning step; once the number of
primitives in the node falls below the PBVH leaf limit, it's
primitives are checked for matching materials. If more than one
material or shading mode is present in the node, it is split and
partitioned (partitioned by material rather than 3D location.)

Given a sufficiently 'annoying' input, like a dense mesh with
thousands of materials randomly scattered across it, this could
greatly increase PBVH build time (since nodes might end up containing
a single primitive), but in general this shouldn't come up.

In order to support materials for grids, the CCGDM is building another
grid array (of DMFaceMat structs). This could be used to replace
CCGDM.faceFlag for some small memory savings (TODO).
2012-03-06 02:40:08 +00:00
e2003f9a6c Code cleanup: remove unused drawFacesColored from DerivedMesh.
This function pointer isn't called anymore, so removing it and the
cddm/ccgdm/gpu code associated with it.
2012-03-05 21:27:28 +00:00
7cc206ddca Code Cleanup: remove non existing function declarations.
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
2012-02-29 15:00:37 +00:00
5e12c7feca Code cleanup: de-duplicate code in GPU_build_grid_buffers() with a macro. 2012-02-22 23:30:56 +00:00
fd87bf3ef6 Code cleanup: don't use GHash for GPU_build_mesh_buffers().
At the point where GPU_build_mesh_buffers is called, the
face_vert_indices map has already been built; it contains the same
data in an easier-to-access format.
2012-02-22 22:48:34 +00:00
88a2be1846 Another fix for non-VBO flat-shading in sculpt mode, this time for non-multires meshes.
As with multires, this change calculates face normals rather than
using vertex normals when the node is flat-shaded.

Flat-shading with VBO on non-multires meshes is still wrong, but
fixing that would require larger changes to our vertex buffers.
2012-02-21 04:24:30 +00:00
a6dc47b0ca Remove call to GPU_update_mesh_buffers from GPU_build_mesh_buffers.
Building the mesh buffers already gets the PBVH_UpdateDrawBuffers flag
set, so this was double-updating the vertex buffer.
2012-02-21 04:16:27 +00:00
0eb8a384c9 Remove some silly variable copies that stuck around from a previous refactor. 2012-01-02 19:01:16 +00:00
f62ad8f69b remove header text:
"The Blender Foundation also sells licenses for use in proprietary software under the Blender Licens"

also remove NaN references from files that have been added since blender went opensource.
2011-11-29 10:54:47 +00:00
a71e2c498c GPU Buffers
Small type cleanup, use `GPU_Buffers *' rather than `void *'. Should
be no functional changes.
2011-11-05 03:29:37 +00:00
4a04f72069 remove $Id: tags after discussion on the mailign list: http://markmail.org/message/fp7ozcywxum3ar7n 2011-10-23 17:52:20 +00:00
abdf420a6d == GPU Buffers ==
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
2011-07-08 19:58:02 +00:00
Nathan Letwory
8c8ae3dedf doxygen: entry for gpu, modifiers, nodes, python and render 2011-02-21 06:58:46 +00:00
7fba9eab47 added more code comments and removed some magic constants 2011-02-15 19:04:00 +00:00
cd97253502 - added GCC warning -Wstrict-prototypes
- fixed bug in paste material, exposed by stricter warnings.
- removed/renamed various shadowed vars.
- removed BGE lamp.colour, only allow lamp.color attribute.
2010-12-03 12:30:59 +00:00
f406cf4ac8 Fix a few compile warnings and rename gpu_buffers.h to GPU_buffers.h
for consistency.
2010-07-14 10:46:12 +00:00