Commit Graph

3528 Commits

Author SHA1 Message Date
Campbell Barton
0024768f88 Cleanup: style/spelling 2016-03-14 13:21:13 +11:00
Campbell Barton
da9f0a507c Minor improvement to last commit
Sign is known in this case, no need  to check for either direction.
2016-03-12 01:12:51 +11:00
Campbell Barton
8accc19d5d Math Lib: less complex convex quad check 2016-03-11 23:41:50 +11:00
Campbell Barton
5704ba7f9b Cleanup: style, spelling 2016-03-09 19:34:26 +11:00
Campbell Barton
4e500101a7 Cleanup: quiet -Wcomma, cast to void where needed 2016-03-05 09:16:12 +11:00
Sergey Sharybin
ba7eb0c7b9 Add utility macro to work with thread local storage 2016-03-03 16:02:31 +05:00
Campbell Barton
0658659f74 GHash: BLI_ghash_ensure_p_ex now takes a pointer-to-key arg
This is an alternative to passing a copy callback which is some times inconvenient.
Instead the caller can write to the key - needed when the key is duplicated memory.

Allows for minor optimization in ghash/gset use.

Also add BLI_gset_ensure_p_ex
2016-03-02 11:18:56 +11:00
Bastien Montagne
fe9b21a44a Add GHash/GSet pop() feature.
Behavior is similar to python's set.pop(), it removes and returns a 'random' entry from the hash.

Notes:
* Popping will return items in same order as ghash/gset iterators (i.e. increasing
  order in internal buckets-based storage), unless ghash/gset is modified in between.
* We are keeping a track of the latest bucket we popped out (through a 'state' parameter),
  this allows for similar performances to iterators when iteratively popping a whole hash
  (without it, we are roughly O(n!), with it we are roughly O(n)...).

Reviewers: campbellbarton

Differential Revision: https://developer.blender.org/D1808
2016-02-20 15:28:25 +01:00
Campbell Barton
578f98d7ad Fix T47452: Translate-node seams w/ subpixel offset 2016-02-18 02:16:49 +11:00
Campbell Barton
12b996e61b BLI_bitmap: add flip macro 2016-02-13 18:59:56 +11:00
Germano Cavalcante
4b42a49086 Fix error in bvhtree_walk_dfs_recursive 2016-02-13 01:53:44 +11:00
Germano Cavalcante
5b2d0b0fb4 BLI_kdopbvh: test root node before traversing 2016-02-11 18:23:58 +11:00
Germano Cavalcante
86725667d4 Cleanup: naming for NearestRayToAABB_Precalc 2016-02-11 18:21:10 +11:00
Campbell Barton
0ba649549c Cleanup: remove unused radius argument 2016-02-11 05:47:05 +11:00
Campbell Barton
fce0e31bcf Docs: use doxygen sections 2016-02-11 05:39:39 +11:00
Campbell Barton
e7374d0227 Docs: minor comment edits to smallhash 2016-02-10 23:28:16 +11:00
Sergey Sharybin
88d5d99130 Tweaks to the comments of smallhash
Collaboration between russki guy working from Netherlands and
ausie bloke working from Australia (not Austria).
2016-02-10 10:52:24 +01:00
Campbell Barton
2cbf32e0fb Cleanup: double promotion
Also remove null checks from args with non-null attribute.
2016-02-10 15:27:28 +11:00
Germano Cavalcante
9961d47a4f Add BLI_bvhtree_walk_dfs utility function
This generic function allows callers to walk the tree using callbacks to define behavior.
2016-02-09 22:47:14 +11:00
Campbell Barton
caa16c1443 BLI_kdopbvh: expose bvhtree_kdop_axes array
So future callbacks can make use of the axis index.
2016-02-09 22:47:14 +11:00
Campbell Barton
ea3900c58f Docs: correct description 2016-02-09 16:30:13 +11:00
Campbell Barton
2a65acc952 Cleanup: parenthesize macros 2016-02-03 21:17:07 +11:00
Campbell Barton
622019a085 Fix BLI_rename returned success w/ missing source path 2016-02-03 15:57:24 +11:00
Campbell Barton
0e4e1993e6 Cleanup: correct qsort comments
Also add link to original source & parenthesize min macro.
2016-01-30 13:27:48 +11:00
Campbell Barton
05dbc470ad Cleanup: warnings & style 2016-01-28 17:23:12 +11:00
Bastien Montagne
e5e7507d31 PIL_time_utiledefines: add TIMEIT_AVERAGED variants to block timing macros.
This variant behave exactly as TIMEIT_START etc., but it also sums up all times in
a static var and prints out average execution time - very useful when dealing
with small/quick pieces of code that get executed often, to get some meaningful results.
2016-01-27 12:26:00 +01:00
Campbell Barton
b336124a13 Correct commented printfs 2016-01-26 09:08:40 +11:00
Campbell Barton
3c72e302e1 Correct own error in recent BVH nearest ray 2016-01-26 07:40:21 +11:00
Sergey Sharybin
e3e23f7746 ImBuf: Make luminance calculation inlined
Title actually tells it all, it is rather simple function which totally makes
sense to be inlined.

This gives up to 5% of speedup when updating scopes for a large image.

Reviewers: campbellbarton

Differential Revision: https://developer.blender.org/D1310
2016-01-25 14:13:52 +01:00
Germano Cavalcante
33a7c7408d BLI_kdopbvh: Add BLI_bvhtree_find_nearest_to_ray
Support for casting a ray through all nodes to find the closest
(not the first hit as with ray casting).
2016-01-25 19:01:53 +11:00
Germano Cavalcante
bfabb9d3c5 Math Lib: Add dist_squared_ray_to_aabb_v3 utility 2016-01-25 19:01:42 +11:00
Campbell Barton
90293a8da3 Math Lib: optimize segment-plane clipping
Calculate the clipped min/max factor along the segment,
only applying to the coordinates at the end (will give better precision too).

Also make split input/output args.
2016-01-23 13:48:31 +11:00
Campbell Barton
aa69fb64ac Cleanup: line length, indentation 2016-01-21 09:42:17 +11:00
Campbell Barton
18ffeb689d error in last commit 2016-01-20 17:09:18 +11:00
Campbell Barton
e25b113694 Cleanup: naming convention
Follow isect_ray_tri_watertight_v3 naming.
2016-01-20 17:03:10 +11:00
Campbell Barton
5128637d48 BLI_array_utils: add binary and/or functions 2016-01-19 08:23:05 +11:00
Campbell Barton
3d4b8922fc Ignore const qualifier when comparing types 2016-01-19 07:51:03 +11:00
Campbell Barton
d5ddc52ae1 Cleanup: style 2016-01-19 04:54:39 +11:00
Bastien Montagne
8acf14c55c Cleanup: BLI_task foreach looper API doc. 2016-01-16 16:06:27 +01:00
Bastien Montagne
31d907fa0a Cleanup: BLI_task - API changes.
Based on usages so far:
- Split callback worker func in two, 'basic' and 'extended' versions. The former goes back
  to the simplest verion, while the later keeps the 'userdata_chunk', and gets the thread_id too.
- Add use_threading to simple BLI_task_parallel_range(), turns out we need this pretty much systematically,
  and allows to get rid of most usages of BLI_task_parallel_range_ex().
- Now BLI_task_parallel_range() expects 'basic' version of callback, while BLI_task_parallel_range_ex()
  expectes 'extended' version of the callback.

All in all, this should make common usage of BLI_task_parallel_range simpler (less verbose), and add
access to advanced callback to thread id, which is mandatory in some (future) cases.
2016-01-16 15:59:37 +01:00
Campbell Barton
31375a1b21 Cleanup: stdbool no longer optional, remove checks 2016-01-16 15:38:57 +11:00
Campbell Barton
a14c67b0ad Polyfill2d: improve sweep clipping logic
Now only reverse the fill direction when reaching a non-concave corner.
Gives ~4x speedup here in tests with complex ngon.
2016-01-13 14:49:00 +11:00
Bastien Montagne
c6c223ade6 Fix T47164: [Scene.raycast] - True result when it should be False.
We cannot use FLT_MAX as initi distance for raycast...

Renamed TRANSFORM_DIST_MAX_RAY to BVH_RAYCAST_DIST_MAX, moved it into BLI_kdopbvh,
and use in RNA raycast callbacks (and all other places using that API).
2016-01-12 10:09:00 +01:00
Kévin Dietrich
14de8361f9 Smoke (fire): Move spectrum code from C++ (intern/) to C code (BLI)
This change is for a few reasons:
- it works with color, and (therefore) will need to be color managed, at
some point. This will be much easier to do if the code is closer to the
actual color management code (in Blender's core, so to speak).
- it has nothing to do with the actual fire simulation, as it is just
used to create a lookup table
- it can be reused for other purposes (i.e. in Blender internal
renderer, if people are interrested in a blackbody node à la Cycles)
- cleanup: some functions (`contrain_rgb`, `xyz_to_rgb`) already exist
in BLI

Reviewers: brecht

Reviewed By: brecht

Subscribers: brecht

Differential Revision: https://developer.blender.org/D1719
2016-01-09 04:48:31 +01:00
Campbell Barton
e830334357 Math Lib: use x-span for fill_poly_v2i_n callback
Instead of running the callback per-pixel,
pass the x-span to the callback.
2016-01-08 23:35:34 +11:00
Bastien Montagne
82d88e42a5 BLI_task threaded looper: do not assert when start == stop.
This can happen quite often in forloops, and would be annoying to have to check for this
in caller code! So now, just return without doing anything in this case.
2016-01-04 19:17:09 +01:00
Bastien Montagne
aad24468e2 Fix T47038: Particles in Particle Edit Mode get added in completely wrong location.
It also fixes another issue (crash) related to symmetric editing.

Quite involved, we (try to!) fix complete broken logic of parts of particle code, which would use poly index
as tessface one (or vice-versa). Issue most probably goes back to BMesh integration time...

This patch mostly fixes particle editing mode:
  - Adding/removing particles when using generative modifiers (like subsurf) should now work.
  - Adding/removing particles with a non-tessellated mesh (i.e. one having ngons) should also mostly work.
  - X-axis-mirror-editing particles over ngons does not really work, not sure why currently.
  - All this in both 'modes' (with or without using modifier stack for particles).

Tech side:
  - Store a deformed-only DM in particle modifier data.
  - Rename existing DM to make it clear it's a final one.
  - Use deformed-only DM's tessface2poly mapping to 'solve' poly/tessface mismatches.
  - Make (part of) mirror-editing code able to use a DM instead of raw mesh, so that we can mirror based on final DM
    when editing particles using modifier stack (mandatory, since there is no way currently to find orig tessface
    from an final DM tessface index).

Note that this patch is not really nice and clean (current particles are beyond hope on this side anyway),
it's more like some urgency bandage. Whole crap needs complete rewrite anyway,
BMesh's polygons make it really hard to work with current system (and looptri would not help much here).

Also, did not test everything possibly affected by those changes, so it needs some users' testing & validation too.

Reviewers: psy-fi

Subscribers: dfelinto, eyecandy

Maniphest Tasks: T47038

Differential Revision: https://developer.blender.org/D1685
2016-01-04 12:19:45 +01:00
Sergey Sharybin
5d99cde822 Remove SCons building system
While SCons building system was serving us really good for ages it's no longer
having much attention by the developers and started to become quite a difficult
task to maintain.

What's even worse -- there started to be quite serious divergence between SCons
and CMake which was only accumulating over the releases now. The fact that none
of the active developers are really using SCons and that our main studio is also
using CMake spotting bugs in the SCons builds became quite a difficult task and
we aren't always spotting them in time.

Meanwhile CMake became really mature building system which is available on every
platform we support and arguably it's also easier and more robust to use.

This commit includes:

- Removal of actual SCons building system
- Removal of SCons git submodule
- Removal of documentation which is stored in the sources and covers SCons
- Tweaks to the buildbot master to stop using SCons submodule
  (this change requires deploying to the server)
- Tweaks to the install dependencies script to skip installing or mentioning
  SCons building system
- Tweaks to various helper scripts to avoid mention of SCons folders/files
  as well

Reviewers: mont29, dingto, dfelinto, lukastoenne, lukasstockner97, brecht, Severin, merwin, aligorith, psy-fi, campbellbarton, juicyfruit

Reviewed By: campbellbarton, juicyfruit

Differential Revision: https://developer.blender.org/D1680
2016-01-04 14:20:48 +05:00
Campbell Barton
7a702ba1d5 Cleanup: warning 2015-12-31 18:15:45 +11:00
Bastien Montagne
6472810c96 Grr, forgot those ones in previous commit...
Never believe QTCreator when it comes to finding all usages of a func, kids... grep ftw!
2015-12-30 21:05:57 +01:00