Commit Graph

189 Commits

Author SHA1 Message Date
7ca74fc1c0 Code cleanup: use 'const' for arrays (blenloader, gpu, imbuf, makesdna, modifiers, nodes) 2014-04-27 00:25:16 +10:00
a15b3c4d11 Code cleanup: use bool 2014-04-11 11:33:29 +10:00
9de24c82ba View3D: disable LOD when game engine is disabled or ifdef'd 2014-04-09 11:52:34 +10:00
cced07661a Matcaps.
Instead of setting color every time, just set it on material enable.
Handles all cases of surfaces. Thanks to Campbell for pointing out!
2014-04-08 01:25:49 +03:00
03bd418d16 Fix T39517,
Issue here is that "show diffuse" option does not respect its intended
purpose which is to be used only for masking.

There are a couple of caveats here:

Dyntopo and multires -always- have mask data enabled, and thus as soon
as one goes to dyntopo mode or adds a multires modifier he would get the
default grey color instead.

Matcaps would break when nodes asked for a diffuse material color (this
was broken before too). Solved by adding global material state for when
matcaps are enabled. Also matcaps don't always played well with VBOs
off.

Added a few more missing updates for mask operators to notify
show_diffuse property as changed. This was also needed on rebuilding
dyntopo pbvh.

Also make zero mask color duller again after artist feedback.
2014-04-03 00:39:42 +03:00
617557b08e Code cleanup: remove TRUE/FALSE & WITH_BOOL_COMPAT define 2014-04-01 15:22:28 +11:00
88f1c283a7 Tweak to T38766 fix: cycles now support setting viewport alpha for a material. 2014-02-24 19:53:14 +01:00
7ef1ed15f1 Fix T38766: blender material transparency setting not taken into account for viewport. 2014-02-24 15:44:22 +01:00
a3f4736a4d Fix T38766: cycles viewport incorrectly taking blender internal alpha into account. 2014-02-24 15:35:26 +01:00
d900f5be55 Code cleanup: use bools where possible 2014-02-03 19:35:44 +11:00
c02c2dfdd9 BGE Bitmap Text: add in check if the character is outside the range 2014-01-23 13:37:09 +11:00
2f46ed5564 Fix T38325: Game Engine Bitmap fonts failed for characters >128 2014-01-23 13:29:49 +11:00
621bf47e91 Docs: doxygen file descriptions for BLF, GPU and WM 2014-01-19 23:15:25 +11:00
c48c62a831 Code Cleanup: replace checks for ima->source with BKE_image_is_animated 2014-01-14 04:59:58 +11:00
aad731d51c Code cleanup: remove BKE_object_where_is_calc_simul function.
It doesn't make any sense anymore with the current depsgraph and probably was
not useful for a long time, just a leftover from the pre 2.04 game engine.
2014-01-09 00:17:18 +01:00
0dabf824fb Fix T38045: Clone stamp crashes
Issue seems to be caused by thread-unsafe IMB_freeImBuf.
Now use generic BKE_image_release_ibuf to de-reference
image buffer which was acquired from image datablock.
2014-01-03 23:00:53 +06:00
e9e08a1d12 Game Engine: Level of detail support and tools
Levels of detail can be added and modified in the object panel. The object
panel also contains new tools for generating levels of detail, setting up
levels of detail based on object names (useful for importing), and
clearing an object's level of detail settings. This is meant as a game
engine feature, though the level of details settings can be previewed in
the viewport.

Reviewed By: moguri, nexyon, brecht

Differential Revision: http://developer.blender.org/D109
2013-12-17 17:03:27 -08:00
ce893552c3 Image cache rewrite to using generic movie cache
Summary:
Behaves very much the same as cache for Movie Clip datablock:

- Image now have `MovieCache *cache` field which replaced
  legacy `ListBase ibufs`.

  This allows image datablock to easily keep of image
  buffers which are owned by itself. This field isn't
  saved to the file and getting restored on undo steps.

  However, cache limit is global for movies, sequences
  and image datablocks now. So overall cached image buffers
  size will not go above cache limit size in user
  preferences.

- Image buffers which are marked as BITMAPDIRTY will never
  be freed from the cache.

- Added utility function to iterate over image buffers
  saved in movie cache.

- Movie cache cleanup check callback now have ImBuf argument
  which can be used in a condition of cleanup.

- Added some utility functions which replaces legacy ibufs
  iterations with image cache iteration which happens from
  inside a lock.

- Fixed `image_mem_size()` which was only counting one of
  the buffers if both float and byte buffer present.

Additional notes:

- `BKE_image_get_first_ibuf()` is rather stupid, but direct
  access to ibufs->first was also the same stupid idea.

  Would consider avoid this function is another project.

- There are some places which doesn't look threadsafe, but
  they already were not so much threadsafe anyway before.

  So think not a big deal with solving this later.

Finally solves infinite memory usage by image sequences! :)

Reviewers: brecht, campbellbarton

Reviewed By: brecht

CC: sebastian_k

Differential Revision: http://developer.blender.org/D95
2013-12-13 16:30:00 +06:00
46eef60d93 Cleanup: Internal degrees removal.
This patch changes most of the reamining degrees usage in internal code into radians.
I let a few which I know off asside, for reasons explained below - and I'm not sure to have found out all of them.

WARNING: this introduces forward incompatibility, which means files saved from this version won't open 100% correctly
         in previous versions (a few angle properties would use radians values as degrees...).

Details:
- Data:
-- Lamp.spotsize: Game engine exposed this setting in degrees, to not break the API here I kept it as such
                  (using getter/setter functions), still using radians internally.
-- Mesh.smoothresh: Didn't touch to this one, as we will hopefully replace it completely by loop normals currently in dev.

- Modifiers:
-- EdgeSplitModifierData.split_angle, BevelModifierData.bevel_angle: Done.

- Postprocessing:
-- WipeVars.angle (sequencer's effect), NodeBokehImage.angle, NodeBoxMask.rotation, NodeEllipseMask.rotation: Done.

- BGE:
-- bConstraintActuator: Orientation type done (the minloc[0] & maxloc[0] cases). Did not touch to 'limit location' type,
                        it can also limit rotation, but it exposes through RNA the same limit_min/limit_max, which hence
                        can be either distance or angle values, depending on the mode. Will leave this to BGE team.
-- bSoundActuator.cone_outer_angle_3d, bSoundActuator.cone_inner_angle_3d: Done (note I kept degrees in BGE itself,
                                                                           as it seems this is the expected value here...).
-- bRadarSensor.angle: Done.

Reviewers: brecht, campbellbarton, sergey, gaiaclary, dfelinto, moguri, jbakker, lukastoenne, howardt

Reviewed By: brecht, campbellbarton, sergey, gaiaclary, moguri, jbakker, lukastoenne, howardt
Thanks to all!

Differential Revision: http://developer.blender.org/D59
2013-12-03 20:35:45 +01:00
fd7bffa3c5 replace calls to BLI_linklist_append with BLI_linklist_prepend where order us unimportant, since append steps over the whole list each time. 2013-08-16 13:06:40 +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
b3ceab896a add some missing members to opengl debug print, also use a macro to avoid passing each arg twice. 2013-06-30 23:50:17 +00:00
c9add22b5e opengl debug info, make GPU_state_print() only show values in arrays that are set. (was print 32 values every time) 2013-06-30 23:30:21 +00:00
8245bdca2b quiet double promotion warning and some style cleanup 2013-06-25 20:52:33 +00:00
bd59bae651 Fix #34909 Texture paint mode does not correctly update when using
textures larger than 2048x2048.

Check if texture is over user preference or GPU limit in texture paint
mode and if it is, scale the partial redraw rectangle before uploading
to GPU. This should be faster than rescaling the whole texture.
2013-06-25 13:27:43 +00:00
4a34d86f32 Fix #35848: render crash in background mode due to missing G.main. 2013-06-23 13:58:59 +00:00
ee8d353fdd Fix #35768: crash in with "free image textures" option and 3D viewport with textured
draw mode open. OpenGL texture free needs to happen in the main thread, but it was
freeing a copy of the image datablock. I can't understand how this code ever worked,
probably it never did.
2013-06-15 14:01:16 +00:00
cda5770160 code cleanup: also fix crash in GPU_state_print(). and confine to debug mode builds. 2013-06-13 11:59:28 +00:00
d2b14ed4f0 BGE: Adding mipmapping control to bge.render via bge.render.setMipmapping() and bge.render.getMipmapping(). 2013-04-14 00:40:24 +00:00
d0beabb642 Add function to query maximum texture size. Also, make texture upload
functions aware of this limit.
2013-04-12 17:56:07 +00:00
36094af7a3 Fix #34908: compressed DDS files did not display properly when their mipmap levels
did not go down to 1x1 image size, need to set GL_TEXTURE_MAX_LEVEL then.
2013-04-08 15:39:38 +00:00
966e86cd2d Fix for [#34754] "Revision 55527 provokes glitchy GLSL shadow map rendering" reported by Alain Ducharme. Per material uniforms and per object uniforms are now better separated. 2013-04-04 03:55:43 +00:00
e8d532f1dd style cleanup 2013-03-31 03:28:46 +00:00
8655be437d code cleanup: use bool where values are true/false, for view3d and related functions. 2013-03-20 23:14:18 +00:00
01e9dae3dc code cleanup 2013-03-18 18:25:05 +00:00
bcec00dddc Fix #34649: texture size limit user preference not working. 2013-03-15 16:16:11 +00:00
c36f20a7d2 style cleanup 2013-03-08 04:00:06 +00:00
525da1f872 Fix wrong alpha channel for OpenGL render results with transparent textures or
materials, the typical glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); blend
function does not give correct destination alpha.
2013-02-18 17:39:44 +00:00
5a0e2b58c8 Activate partial redraw of non-power of two textures. This looks like
it's working as expected out of the box. I hope nothing breaks.
2013-01-27 20:26:18 +00:00
c411cde415 header cleanup, include BLI before BKE, also use bool for ntreeShaderExecTree 2013-01-24 21:57:13 +00:00
e11d22a6b7 Matcap support in 3D Viewport.
Full log is here:
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability#Matcap_in_3D_viewport

Implementation notes:

- Matcaps are an extension of Solid draw mode, and don't show in other drawmodes.
  (It's mostly intended to aid modeling/sculpt)

- By design, Matcaps are a UI feature, and only stored locally for the UI itself, and
  won't affect rendering or materials.

- Currently a set of 16 (GPL licensed) Matcaps have been compiled into Blender. 
  It doesn't take memory or cpu time, until you use it.

- Brush Icons and Matcaps use same code now, and only get generated/allocated on
  actually using it (instead of on startup).

- The current set might get new or different images still, based on user feedback.

- Matcap images are 512x512 pixels, so each image takes 1 Mb memory. Unused matcaps get 
  freed immediately. The Matcap icon previews (128x128 pixels) stay in memory.

- Loading own matcap image files will be added later. That needs design and code work 
  to get it stable and memory-friendly.

- The GLSL code uses the ID PreviewImage for matcaps. I tested it using the existing
  Material previews, which has its limits... especially for textured previews the
  normal-mapped matcap won't look good.
2013-01-22 11:18:41 +00:00
08cea96ab0 Alpha premul pipeline cleanup
This assumptions are now made:
- Internally float buffers are always linear alpha-premul colors
- Readers should worry about delivering float buffers with that
  assumptions.
- There's an input image setting to say whether it's stored with
  straight/premul alpha on the disk.
- Byte buffers are now assumed have straight alpha, readers should
  deliver straight alpha.

Some implementation details:

- Removed scene's color unpremultiply setting, which was very
  much confusing and was wrong for default settings.
  Now all renderers assumes to deliver premultiplied alpha.

- IMB_buffer_byte_from_float will now linearize alpha when
  converting from buffer.

- Sequencer's effects were changed to assume bytes have got
  straight alpha. Most of effects will work with bytes still,
  however for glow it was more tricky to avoid data loss, so
  there's a commented out glow implementation which converts
  byte buffer to floats first, operates on floats and returns
  bytes back. It's slower and not sure if it should actually
  be used -- who're using glow on alpha anyway?

- Sequencer modifiers should also be working nice with straight
  bytes now.

- GLSL preview will predivide float textures to make nice shading,
  shading with byte textures worked nice (GLSL was assuming straight
  alpha).

- Blender Internal will set alpha=1 to the whole sky. The same
  happens in Cycles and there's no way to avoid this -- sky is
  neither straight nor premul and doesn't fit color pipeline well.

- Straight alpha mode for render result was also eliminated.

- Conversion to correct alpha need to be done before linearizing
  float buffer.

- TIFF will now load and save files with proper alpha mode setting
  in file meta data header.

- Remove Use Alpha from texture mapping and replaced with image
  datablock setting.

  Behaves much more predictable and clear from code point of view
  and solves possible regressions when non-premultiplied images were
  used as textures with ignoring alpha channel.
2012-12-31 13:52:13 +00:00
857df8065f style cleanup 2012-12-28 14:19:05 +00:00
b2c66e268f replace MIN/MAX 3,4 with inline functions 2012-12-21 05:07:26 +00:00
b13f4e6999 DDS compressed textures now make use of the anisotropic filtering setting. 2012-12-21 02:49:15 +00:00
e7485d46cd Fix #33630: DDS compressed textures were not actually using mipmaps for minification. 2012-12-20 15:49:59 +00:00
468a6aba62 Attempted fix #33546: GPU mipmap generation is not working on some ATI cards,
causing textures to be missing in textured draw mode. There is apparently a bug
in the ATI drivers, committed a workaround for that now.

http://www.opengl.org/wiki/Common_Mistakes#Automatic_mipmap_generation
2012-12-15 17:15:42 +00:00
7c699a217a define the size of matrix args for both rows/cols. 2012-12-11 14:29:01 +00:00
5bb576e8e4 Fix #33417: add back GPU Mipmap Generation option, apparently with this disabled
it takes up less memory on some cards, still unclear why.
2012-12-05 11:46:13 +00:00
6b03e9bc47 Fix #33376: non-square DDS textures were mapped wrong in the viewport / game engine. 2012-12-02 08:25:53 +00:00