Import the RangeTree library into intern

RangeTree is a simple C++ tree set for storing non-overlapping scalar
ranges. Original source from:
https://github.com/nicholasbishop/RangeTree

Also update the build systems to include RangeTree.
Add BM_edge_calc_squared_length() query function

Same as BM_edge_calc_length(), but avoids square root for cases where
only comparison is needed.
Add function to find closest point in triangle to another point

New function is closest_to_tri_v3() in BLI_math_geom.
Disable fall through to global undo from paint/sculpt undo

Undoing/redoing in sculpt and other paint modes should only use the
mode-specific undo, not global undo. It is now consistent with edit
mode and avoids tricky interaction between the two systems.
Add BMLog for efficiently storing changes to vertices and faces

The BMLog is an interface for storing undo/redo steps as a BMesh is
modified. It only stores changes to the BMesh, not full copies.

Currently it supports the following types of changes:
- Adding and removing vertices
- Adding and removing faces
- Moving vertices
- Setting vertex paint-mask values
- Setting vertex hflags
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.
Code cleanup: move PBVH/PBVHNode structs into new header file
Move layer displacements from SculptUndoNode to PBVHNode

* This doesn't make much difference for regular mesh/multires
  sculpting, but for dynamic topology sculpting the undo stack isn't
  split up by PBVH nodes, so it's more convenient to store the layer
  data in PBVH nodes.

* Note that the life cycle of the layer displacement data is
  unchanged -- it's only valid during a stroke with the layer brush,
  gets free'd when the undo step ends.
Add DNA/RNA/BKE/UI infrastructure for dynamic-topology sculpt mode

* Add a detail_size field to the Sculpt struct, two new sculpt flags,
  and a Mesh flag for dynamic-topology mode; that's it for file-level
  changes needed by dynamic-topology

* Add RNA for the new DNA field and flags

* In Py UI, add new topology section to sculpt Options panel with
  controls for dynamic topology

* Adds a new icon for dynamic-topology created by Julio Iglesias
Add BLI_buffer, an alternative to BLI_array

BLI_buffer is a dynamic homogeneous array similar to BLI_array, but it
allocates a structure that can be passed around making it possible to
resize the array outside the function it was declared in.
Add dynamic topology support to the PBVH

* Add BLI_pbvh_build_bmesh(), similar to the other PBVH builders but
  specialized for BMesh. Whereas the PBVH leaf nodes for mesh and
  grids only store a start-index and count into the primitive indices
  array, the BMesh version uses GHashes to store the full set of faces
  and vertices in leaf nodes

* Add new PBVH node functions for BMesh-specific operations

* Update PBVH iterator to handle BMesh

* Make some of the pbvh.c functions non-static so they can be used by
  the new pbvh_bmesh code
Add dynamic topology support to sculpt mode

Description TODO
Modify info stats for dynamic-topology sculpt mode

Format is like this: "Verts:8 | Tris:12 | Cube"
Update DerivedMesh for dynamic-topology sculpting

* Build bmesh PBVH in CDDM when dyntopo is enabled

* Disable all modifiers when dyntopo is enabled
Hiding support for dynamic topology
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.
Add simplify brush for sculpt mode
WIP: symmetrize integration
Add unit tests

* Covers the BMesh convex hull operator and BMLog.
Add sculpt documentation