Commit Graph

2612 Commits

Author SHA1 Message Date
Campbell Barton
da8619fe23 Math Lib: add iroundf function for: (int)floorf(a + 0.5f) 2014-01-15 13:40:40 +11:00
Antony Riakiotakis
53f93ef66d Fix build issues with mingw's 2014-01-15 00:33:55 +02:00
gaiaclary
875ddfcee0 Added missing include 2014-01-14 22:54:18 +01:00
Campbell Barton
a9f761708c Fix for icon generation with MSVC
Big thanks to Gaia for getting this working!
2014-01-15 08:40:56 +11:00
Sergey Sharybin
43c2b36431 Correction to assert in previous commit 2014-01-14 23:51:26 +06:00
Sergey Sharybin
e7d18eb7bd Add check for KD tree size to BLI_kdtree_insert()
Makes sure we're not trying to insert more nodes than we've
been expecting to.
2014-01-14 17:16:06 +06:00
Campbell Barton
aa986c3f3d Correct bad mistake in own recent to commit to angle calculation 2014-01-14 13:47:24 +11:00
Campbell Barton
8cb9b42c9c Math Lib: minor optimization for angle functions 2014-01-14 09:48:59 +11:00
Campbell Barton
61ff3dfdda Code Cleanup: spelling 2014-01-13 15:31:57 +11:00
Antony Riakiotakis
717bf85545 Fix some harmless warnings that mostly appeared on MinGW64 2014-01-13 04:28:51 +02:00
Campbell Barton
62aa004c25 Style Cleanup: whitespace 2014-01-12 22:05:24 +11:00
Campbell Barton
b243b4fe40 Fix for inorrect use of BLI_utf8_invalid_strip, add assert to prevent it happening again. 2014-01-08 14:46:06 +11:00
Campbell Barton
fee66f7bc8 Code cleanup: defines for statfs were getting out of hand for BSD's.
add __DragonFly__ and internal defines to avoid copy-pasting checks.

also remove __CYGWIN32__ check, since cygwin is no longer supported.
2014-01-07 13:39:00 +11:00
Campbell Barton
99d050f88b Text3d: selection in editmode now follows rotated text along path 2014-01-05 22:20:33 +11:00
Antony Riakiotakis
1f2aec71b4 Fix for previous commit...sorry! 2014-01-04 13:47:40 +02:00
Antony Riakiotakis
baa1ae0749 Fix MinGW32 compilation 2014-01-04 13:39:10 +02:00
Campbell Barton
fd6ef46d6d KDTree: ensure balance runs before usage (in debug mode) 2014-01-04 10:44:02 +11:00
Campbell Barton
a288644b1e Code Cleanup: WIN32 defines, check for _MSC_VER instead of !FREE_WINDOWS 2014-01-03 20:46:12 +11:00
Martijn Berger
46a3752a1f Fix :I broke the build for MSVC 2008 this fixes it 2014-01-02 23:32:44 +01:00
Martijn Berger
1c8a12ee61 Fix T37987: MSVC 2013 has C99 headers and warns for out define hypot _hypot for good reason it seems 2014-01-02 22:19:10 +01:00
Sergey Sharybin
df5631216a Fix T37980: Multiple font objects sharing an external font gives problems
Solved by adding RW lock to BKE_vfont_to_curve.

So now all the threads are allowed to read chars from ghash,
but they'll be locked as soon as one thread would need to load
more chars from font to the ghash.
2013-12-29 16:44:07 +06:00
Campbell Barton
d0ec1b1caa Fix for 3d text ctrl+arrow keys failing for multi-byte characters. 2013-12-29 16:54:43 +11:00
Campbell Barton
07851dd8df Math Lib: replace point in polygon function with one thats ~23x faster.
rather then using angle summing, use line intersection checks.
2013-12-29 14:50:15 +11:00
Campbell Barton
eb4090dadf Fix missing check if isect_plane_plane_v3 fails to find an intersection. 2013-12-29 12:51:27 +11:00
Campbell Barton
2654b28f04 Text3d: avoid calculating the font boundbox scale for every character 2013-12-28 19:45:54 +11:00
Campbell Barton
1a91b8bd5d Fix for 3d fonts loading the character of the string terminator.
also remove redundant call to wcslen and ensure FT_Init_FreeType runs
once the font loads.
2013-12-28 19:06:45 +11:00
Campbell Barton
961d0409c8 3D Text: use ghash for character lookups 2013-12-28 17:40:13 +11:00
Campbell Barton
6f5ced4a30 Math Lib: add dist_squared_to_line_v2, avoids sqrt in scanfill and 3d-text 2013-12-28 17:23:59 +11:00
Campbell Barton
bc1eb0bf0a Simplify isect_point_poly_v2 functions using angle_signed_v2v2 2013-12-26 20:07:44 +11:00
Campbell Barton
db8293d456 Polyfill: minor changes to which fix rare errors with float precision 2013-12-26 12:21:40 +11:00
Campbell Barton
af32c1c77b Fix T37946: Error filling ngons 2013-12-26 12:06:52 +11:00
Campbell Barton
7f4533fa49 String API: BLI_ascii_strtolower/upper now check NULL terminator
This wasn't needed before now, but since recent change to bUnit_ReplaceString,
it uses in a context where NULL terminator is expected - best add.
(spotted by Sergey)
2013-12-25 01:20:46 +11:00
Campbell Barton
c1c26c36f6 Style Cleanup: remove preprocessor indentation (updated wiki style guide too) 2013-12-22 14:12:19 +11:00
Campbell Barton
737e51cb21 Mempool/Memarena: hint for unlikely conditions 2013-12-10 21:28:52 +11:00
Campbell Barton
c005fb407b Util-defines: avoid multiple calculation/access for MIN/MAX macros 2013-12-08 17:29:22 +11:00
Campbell Barton
8a9a060b67 Math lib: optimize hsv/rgb conversion 2013-12-08 17:20:53 +11:00
Campbell Barton
f64b3732be Util Macros: reduce multiple access & conversion for CLAMP/CLAMPIS/ABS 2013-12-07 14:29:27 +11:00
Campbell Barton
69065b5b2c Compiler warnings: quiet warnings for gcc4.7x
patch from Sergey
2013-12-07 13:21:59 +11:00
Campbell Barton
72d950ba49 Rectangle API: add single axis intersection check 2013-12-06 18:48:55 +11:00
Antony Riakiotakis
4b9fb83e67 Appease grumpy ole gcc 4.7 of MinGW64 (possibly gcc 4.6 of MinGW32 too?)
that cannot convert float to char without false warnings that are turned
into errors with strict flags. I expect that any real conversion
warnings can be caught on linux.
2013-12-05 23:32:59 +02:00
Campbell Barton
07ceb99213 Code Cleanup: use strict flags for math lib, add inline declarations 2013-12-06 03:57:17 +11:00
Campbell Barton
8003f0606d Compiler warnings: quiet float/double conversion warning 2013-12-05 10:34:30 +11:00
Lukas Tönne
67134a7bf6 Fix for EWA (elliptical weighted average) sampling in the compositor.
EWA sampling is designed for downsampling images, i.e. scaling down the size of
input image pixels, which happens regularly in compositing. While the standard
sampling methods (linear, cubic) work reasonably well for linear
transformations, they don't yield good results in non-linear cases like
perspective projection or arbitrary displacement. EWA sampling is comparable to
mipmapping, but avoids problems with discontinuities.

To work correctly the EWA algorithm needs partial derivatives of the mapping
functions which convert output pixel coordinates back into the input image
space (2x2 Jacobian matrix). With these derivatives the EWA algorithm
projects ellipses into the input space and accumulates colors over their
area. This calculation was not done correctly in the compositor, only the
derivatives du/dx and dv/dy were calculation, basically this means it only
worked for non-rotated input images.

The patch introduces full derivative calculations du/dx, du/dy, dv/dx, dv/dy for
the 3 nodes which use EWA sampling currently: PlaneTrackWarp, MapUV and
Displace. In addition the calculation of ellipsis area and axis-aligned
bounding boxes has been fixed.

For the MapUV and Displace nodes the derivatives have to be estimated by
evaluating the UV/displacement inputs with 1-pixel offsets, which can still have
problems on discontinuities and sub-pixel variations. These potential problems
can only be alleviated by more radical design changes in the compositor
functions, which are out of scope for now. Basically the values passed to the
UV/Displacement inputs would need to be associated with their 1st order
derivatives, which requires a general approach to derivatives in all nodes.
2013-12-04 16:05:56 +01:00
Lukas Tönne
45fc80153a Fix for interpolation errors on lower-left borders in compositor image
inputs.

http://wiki.blender.org/uploads/4/4c/Compo_image_interpolation_borders.png

Problem is that all image buffer reader nodes (RenderLayer, Image,
MovieClip) were clipping pixel coordinates to 0..N range (N being width
or height respectively). Bilinear interpolation works ok then on the
upper-right borders (x, N) and (N, y), since the last (N-1) pixel fades
out to N (background). But the lower-left (x, 0) and (0, y) borders are
not correctly interpolated because the nodes cut off the negative pixels
before the interpolation function can calculate their value.

To fix this, the interpolation functions are now entirely responsible
for handling "out of range" cases, i.e. setting (0,0,0,0) results for
invalid pixels, while also handling interpolation for borders.
Callers should not do pixel range checks themselves, which also makes
the code simpler. Should not have any real performance penalty,
the interpolation functions do this check anyway, so is probably even
slightly faster.
2013-12-04 12:09:13 +01:00
Campbell Barton
a9b97dcf22 User interface: internal change, collect panels to draw before drawing.
avoids calling poll twice, in some cases
2013-12-04 11:57:19 +11:00
Campbell Barton
f3d13bec6d Code Cleanup: correct fabsf/fabs/abs use 2013-12-04 09:24:38 +11:00
Campbell Barton
f64ae4cbe5 MemArena: use size_t instead of int for alloc args and internal storage.
also add BLI_memarena_calloc to be used when calloc isnt enabled for the arena.
2013-12-02 17:51:27 +11:00
Campbell Barton
4436620150 Polyfill: fast-path for convex ngons (and mostly convex ngons).
avoid intersection checks where there are no concave coords.
2013-12-02 15:56:14 +11:00
Campbell Barton
b9445106b2 Geometry API: polyfill2d, ear clipping polygon filling functions.
Simple/predictable polygon filling functions (no hole support)
originally from libgdx which have some advantages over scanfill.

- always creates the same number of triangles (never any missing faces).
- gives same results for any affine transformation.
- doesn't give so many skinny faces by default.

made some changes for Blender.
- remove last ears first (less to memmove)
- step over the ears while clipping to avoid some verts becoming fans to most of the other.
2013-11-30 22:00:01 +11:00
Campbell Barton
5910531318 Math Library: add functions cross_poly_v2, cross_tri_v2
also added utility macro for removing elements in the middle of an array
2013-11-30 15:57:16 +11:00