Commit Graph

682 Commits

Author SHA1 Message Date
Campbell Barton
da1da3053d Cleanup: add trailing commas
Improve clang-format output.
2019-01-31 08:30:45 +11:00
Clément Foucault
d88492d4ad Object Mode: Fix reading past buffer end when drawing camera 2019-01-29 15:05:51 +01:00
Campbell Barton
851d58b34f DRW: support clipping for all lamp types 2019-01-29 20:27:28 +11:00
Campbell Barton
68cab3aff6 Cleanup: replace attrib w/ attr
Also rename GPUVertexAttribs to GPUVertAttrLayers,
avoids confusion with GPUVertAttr which isn't closely related.
2019-01-29 08:32:25 +11:00
Campbell Barton
9bc43223c1 DRW: support clipping for object & lamp centers 2019-01-29 00:27:43 +11:00
Campbell Barton
1e4aab36c2 Cleanup: remove redundant BKE/BLI/BIF headers 2019-01-26 21:20:25 +11:00
Campbell Barton
19b5f5493c Cleanup: draw manager headers 2019-01-26 20:08:52 +11:00
Campbell Barton
b8467273b8 Cleanup: redundant defines
Comment or remove unused defines.
2019-01-26 19:15:30 +11:00
Campbell Barton
77b66a9666 DRW: support clipping for empty object 2019-01-26 15:49:14 +11:00
Campbell Barton
e72fa714a8 Cleanup: remove duplicated shaders that only added clipping checks
Originally I wanted to avoid adding draw manager specific ifdef's all
over generic shaders however this isn't needed in so many places.

Also there are shaders that are only used by the draw manager so
duplicating them only to have the original unused doesn't make sense.
2019-01-25 08:01:07 +11:00
Campbell Barton
6d8394d38b DRW: support clipping for camera objects 2019-01-25 07:13:02 +11:00
Campbell Barton
a4fe338dd8 Cleanup: add missing braces to draw manager 2019-01-25 07:12:13 +11:00
mano-wii
95db2e8749 Fix GPU linking Error.
"The geometry shader uses varying _I;gl_PerVertex;gl_ClipDistance, but previous shader does not write to it."
2019-01-24 12:42:20 -02:00
Campbell Barton
aa1b77dccb DRW: support clipping for object outlines 2019-01-24 18:28:21 +11:00
Brecht Van Lommel
cd8a342d7c Cleanup: fix compiler warnings. 2019-01-24 07:41:36 +01:00
Campbell Barton
11428e0b7f DRW: use clipping for depth buffer
Object selection now supports clipping.
2019-01-24 17:12:06 +11:00
Campbell Barton
04d18b117c DRW: API for own versions of builtin GPU shaders
DRW_shader_get_builtin_shader can replace GPU_shader_get_builtin_shader
when we need to support clipping.

Use this for loose point & wire drawing in object mode,
clips edges in lattice edit mode.
2019-01-24 16:14:00 +11:00
Campbell Barton
ddc278da24 Cleanup: comments above struct members, shader group assignments
Avoid using pointer to pointer when building shader groups.
2019-01-23 23:59:40 +11:00
Campbell Barton
14d947dcad DRW: generalize selecting between regular/clipped shaders
Each engine was doing this on its own.
Move to DRWContextState, use an enum.
2019-01-23 13:34:55 +11:00
Campbell Barton
c403508e41 DRW: changes to object mode engine needed to support clipping
Split out shader struct, no function changes.
2019-01-23 12:37:12 +11:00
Campbell Barton
dc3b5024be Cleanup: add BEGIN/END to GPL headers 2019-01-23 11:32:43 +11:00
Campbell Barton
585e4848e1 3D View: Support vert & weight paint mask clipping 2019-01-22 22:22:20 +11:00
Campbell Barton
0bbca0e221 3D View: Support edit-mesh clipping (only verts)
We'll need to replace built-in shaders to add support for clipping.
2019-01-22 17:23:24 +11:00
Campbell Barton
7f40d553f9 Cleanp: use single global for draw manager
Add 'G_draw' for all draw manager globals,
avoids adding extern to each file.

Connection between `ts` and `globals_ubo` wasn't obvious,
now called `G_draw.block` & `G_draw.block_ubo`.
2019-01-22 12:09:27 +11:00
Campbell Barton
46d56872d0 Fix error in last commit 2019-01-22 11:24:59 +11:00
Campbell Barton
14adca06e4 Cleanup: use DRW_shader_create_from_arrays
Avoids messy conditional defines and inline lib allocation.
2019-01-22 11:09:17 +11:00
Campbell Barton
8beab3e339 Cleanup: remove redundant '_sh' suffix, add '_shgrp' 2019-01-22 08:31:07 +11:00
Campbell Barton
3d9bee2db1 Cleanup: rename shader containers
These only contain shaders, so name Shaders instead of ShaderData.
2019-01-22 08:26:43 +11:00
Campbell Barton
9bc47ed0f6 Fix clipping shaders with some AMD/Intel drivers
Caused:
    error: unsized array index must be constant

Use hard coded number of clipping planes, copying the 4th to 5 & 6
when only 4 are used.
2019-01-21 23:55:53 +11:00
Campbell Barton
78d2abd9c1 DRW: Support wire overlay clipping 2019-01-21 19:08:42 +11:00
Campbell Barton
7bc9a563e6 Correct freeing builtin shader from recent commit 2019-01-21 19:07:57 +11:00
Campbell Barton
a06b2b25ad DRW: pass clipping to geom shader via 'gl_in'
Removes need to pass the worldspace location.
2019-01-21 17:50:31 +11:00
Campbell Barton
1ab071bd5c Cleanup: remove '_sh' suffix
Shaders are now stored in their own struct, no need for special names.

Also free as an array.
2019-01-21 17:03:52 +11:00
Campbell Barton
07673a3460 DRW: Support edit-mesh clipping 2019-01-21 16:15:30 +11:00
Campbell Barton
dbe960fdee Cleanup: replace 'ct' w/ 'len' 2019-01-21 11:22:27 +11:00
Clément Foucault
b5bc2158a0 View 3D Grid: Improve precision and reduce code complexity
Instead of doing manual ray-plane intersection we use normalized positions
of the grid mesh and apply scaling after interpolation so that we keep
good precision even at really far distances.

Precision is now two order of magnitude better and does not produce the
same kind of artifact at lower clip start values.

This commit also cleanup the implementation.

Fixes T58918 Grid not appearing correctly at low clip start in 2.8
2019-01-18 16:30:05 +01:00
Campbell Barton
2d98dce7ee Cleanup: rename BASE_FROMDUPLI -> BASE_FROM_DUPLI
Matches `BASE_FROM_SET`.
2019-01-15 23:30:31 +11:00
Clément Foucault
209afa28c6 Object Mode: Outlines: Add support for thicker outline
Base outline is 2px wide (because of how we detect them).
And since inflating this outline will only produce outlines that are 2*x
thick we map the UI scalling and the outline width setting to the closest
match.

Do note that thicker outlines have a performance cost since they need more
texture fetches and passes.

This fixes T60252 3D View Outline Width not working
2019-01-14 18:33:07 +01:00
Campbell Barton
f91b21f85b Cleanup: move comments above definitions
For clang-format not to wrap definitions.
2019-01-14 16:30:43 +11:00
Dalai Felinto
ce3475f747 Viewport: Stereoscopy drawing is back
The viewport stereoscopy support helpers are finally ported to 2.80.

We now can scale the camera and the "stereo cameras" will scale
in the viewport as well (unlike 2.7x).

At the moment I disabled the drawing of the camera frame when
stereo is selected and you are looking through the camera.

It is to be fixed later, but for now it draws the border wrong.
In 2.79 this was not a problem because the camera frame was drawn
afterwards as a hack.

Viewport > Stereoscopy:
* Cameras
* Convergence plane
* Convergence plane alpha
* Stereoscopy volume
* Stereoscopy volume alpha
2019-01-11 21:51:15 -02:00
Dalai Felinto
9f6e09bd8c Drawing API: shgroup_instance and shgroup_instance_alpha clarification
shgroup_instance_alpha was getting a color[4] but would only use the
alpha defined upon creation of the shading group.

This was very limiting since it wouldn't allow for different instances
to have different alpha values.

Patch made with Clément Foucault (he made the code of it, while I fixed
all the parts of the code that were relying on shgroup_instance_alpha.
2019-01-11 21:51:15 -02:00
Clément Foucault
b98e6743dc Texture Paint: Add filtering option for texture paint overlay
The overlay should now use the texture interpolation setting in material
mode.

In image mode, there is now a new button to let the user choose the texture
filter. The option is located in the Texture Slots popover and only shows
in Image mode.
2019-01-11 16:00:23 +01:00
Clément Foucault
bda2cd8ba5 DRW: Fix texture paint crashing if object has no material slot 2019-01-11 16:00:23 +01:00
Campbell Barton
9327013796 3D View: use faded wire for set-scene objects
Matches 2.7x behavior.
2019-01-11 15:02:52 +11:00
Campbell Barton
ee6e02ccf3 3D View: use dupli wire color for shaded wire drawing
Was only working for loose wire.
2019-01-11 15:02:21 +11:00
Campbell Barton
0f99845d2f 3D View: use faded color for dupli instance outlines
Similar to 2.7x, so instanced geometry can be differentiated.
2019-01-10 18:29:13 +11:00
Campbell Barton
5ce6b344d5 3D View: use faded color for dupli instance wire & points
Similar to 2.7x, so instanced geometry can be differentiated.
2019-01-10 18:28:53 +11:00
Campbell Barton
4069b10be8 Fix swapped active/selected lattice vertex color 2019-01-09 13:09:03 +11:00
Philipp Oeser
a0d456daf8 Vertex Paint: support vertex masking
Working in 2.7x, was just disabled in 2.8x.

Fixes T60256
2019-01-08 15:18:28 +11:00
Campbell Barton
670b2944f4 Cleanup: indentation (right shift) 2019-01-04 19:08:09 +11:00