Compare commits

...

970 Commits

Author SHA1 Message Date
Julian Eisel
8927bc5dff Swap order of selectability/visibility toggles
Just to be consistent with outliner.
2017-02-09 14:34:08 +01:00
Julian Eisel
39739c1c5f Add columns for visibility and selectability toggles
Good example of where the table API is useful: Adding new columns is a
small change.
2017-02-09 14:28:55 +01:00
Julian Eisel
7821985196 Use entire width of collections editor for table 2017-02-09 14:01:51 +01:00
Julian Eisel
86c70c5d6d Use table background drawing for collections editor 2017-02-09 13:58:17 +01:00
Julian Eisel
fea46f6ad6 Merge branch 'uiTable' into temp-layers-ui-table 2017-02-09 13:52:03 +01:00
Julian Eisel
ac5cbf8c0e Fix mistakes with background drawing 2017-02-09 13:51:39 +01:00
Julian Eisel
c4a6f70783 Draw collection names using layout/button engine
Instead of drawing it directly via BLF call.
2017-02-09 05:22:40 +01:00
Julian Eisel
c38aee2b46 Merge branch 'uiTable' into temp-layers-ui-table 2017-02-09 05:09:56 +01:00
Julian Eisel
d1fb6819d5 Create and pass a uiLayout to cells
Played with a more complex and more efficient version, but that made
things pretty complicated. Now this is a simple, but less optimized, solution.
2017-02-09 05:09:10 +01:00
Julian Eisel
5caeb054ee Support drawing some background color alternating per row 2017-02-09 02:56:27 +01:00
Julian Eisel
2f43ab5935 Draw tables row by row, not column by column 2017-02-08 00:04:09 +01:00
Julian Eisel
4e3cfaeb16 Unit tests for uiTable API (and fix bugs found using it :) 2017-02-07 00:45:33 +01:00
Julian Eisel
185f588e1c Initial commit to use uiTable API for collections editor
Does nothing but drawing a single column for collection name, but it
shows that the API works ;)
2017-02-05 18:22:47 +01:00
Julian Eisel
7dfd122dc9 Merge branch 'uiTable' into temp-layers-ui-table 2017-02-05 17:47:56 +01:00
Julian Eisel
1807c09986 Cleanup: Add assert, remove unused variable 2017-02-05 17:25:12 +01:00
Julian Eisel
1a7eeb4fef Initial implementation of a uiTable API
This adds an initial (and already working), generic API for defining, handling and drawing of table UIs.

It supports two types of tables:
* Vertical flow: Rows are all in a vertical stack.
* Horizontal flow: Rows are stacked vertically, until some threshold height is reached. The table is then split into another vertical stack that is drawn next to the former one. Such drawing could be used for the file browser in non-thumbnail mode.

A table is built out of - guess what - rows and columns. The API allows defining new collumns (identified by an id-name) and inserting new rows at any point. When drawing, we draw a cell for each column/row combination, using a custom cell-drawing callback.
The uiTable API will probably get some support for drawing buttons (uiBut) into custom layouts (uiLayout).

The API is written with big data sets in mind. In future we may get a spreadsheet view where data like all vertices of a mesh is displayed. That would result in thousands of rows, the uiTable API should be ready for this.
2017-02-05 16:43:56 +01:00
Dalai Felinto
0412b0d296 Merge remote-tracking branch 'origin/clay-engine' into render-layers 2017-02-03 18:18:58 +01:00
71c8db2a0c Build Clay engine by default 2017-02-03 17:51:04 +01:00
Dalai Felinto
1e69c9e1c8 Another fixup for rB6cdb3845 (Added collection props getter/setter)
Values were getting clamped
2017-02-03 17:39:54 +01:00
Dalai Felinto
16385ae285 Merge remote-tracking branch 'origin/clay-engine' into render-layers 2017-02-03 17:22:51 +01:00
Dalai Felinto
2b04710d61 UI: use the "USE" flag for collection settings
Note, this should be a proper uiTemplate, but a pure python approach seems to work fine for now
2017-02-03 16:16:39 +01:00
Dalai Felinto
35fb0e341b RNA: macros to wrap collection settings use 2017-02-03 16:16:39 +01:00
Dalai Felinto
83fea5307b layer: getter/setter for USE flag 2017-02-03 16:16:39 +01:00
Dalai Felinto
6644ff25f2 Update collection engine setings when updating collection values 2017-02-03 16:16:39 +01:00
Dalai Felinto
7f2da487a6 Placeholder for depsgraph evaluation of collection engine settings 2017-02-03 16:16:39 +01:00
41ba828131 Fix bplayer (c) 2017-02-03 15:18:32 +01:00
Dalai Felinto
79924fce49 RNA: use new getter/setter functions for LayerEngineSettings 2017-02-03 15:06:11 +01:00
Dalai Felinto
865a0de03d Fixup for rB6cdb3845 (Added collection props getter/setter) 2017-02-03 15:05:11 +01:00
4a84884e99 Fix warnings 2017-02-03 14:52:33 +01:00
7203aa24f9 New CMake flag for Clay Engine 2017-02-03 14:38:11 +01:00
9fb97e3f85 Fix hang infinite loop 2017-02-03 14:37:50 +01:00
0ee52a5741 Get rid of runtime data struct. 2017-02-03 13:33:59 +01:00
6cdb3845a3 Added collection settings getter/setter 2017-02-03 13:33:59 +01:00
8a22429db2 Change settings order 2017-02-03 13:33:59 +01:00
Dalai Felinto
eaf9748f23 Fix new objects are invisible 2017-02-03 12:46:47 +01:00
Dalai Felinto
a8ce1c98fe Set COLLECTION_PROP_USE when setting a layer_engine_settings property
We still need depsgraph to evaluate those changes
2017-02-03 12:23:01 +01:00
Dalai Felinto
5a9cd6a14d Util function to create CollectionEngineSettings
This may be run by Depsgraph, as well as internal layercollection create routines
2017-02-03 12:23:01 +01:00
Dalai Felinto
fa2bf9381b Util function to free CollectionEngineSettings
This may be run by Depsgraph, as well as internal layercollection free routines
2017-02-03 12:23:01 +01:00
Dalai Felinto
e1b13c0fa7 Fix storage of CollectionSettings in DNA_object_types.h 2017-02-03 12:23:01 +01:00
Dalai Felinto
85f7ad95ed Remove unused enum values (COLLECTION_PROP_TYPE_POINTER/BOOL) 2017-02-03 12:23:01 +01:00
Dalai Felinto
bd0367d1e6 Fix return in BKE_scene_layer_find_from_collection 2017-02-03 10:51:13 +01:00
0e3ba7cf41 More lamp work 2017-02-02 22:19:23 +01:00
e148661d8d Use vec2 for screen space stuff 2017-02-02 21:44:14 +01:00
6f1bdaab9d Lamp sunrays and shadow circles 2017-02-02 21:39:58 +01:00
Dalai Felinto
fbb9bffe1b Bring back the select button for the UI 2017-02-02 18:06:27 +01:00
8641fa1397 Fix unfreed memory 2017-02-02 17:15:26 +01:00
b12d2fb922 Fix warnings 2017-02-02 17:03:21 +01:00
e572cf1239 Fix depth not cleared 2017-02-02 16:54:34 +01:00
f695c9861f Bypass wires. 2017-02-02 16:54:15 +01:00
c1057ac196 Fix ogl warnings. 2017-02-02 16:28:16 +01:00
b1add8e5bd Fix assert 2017-02-02 16:23:21 +01:00
92a2b444b0 Added Lamp screen space visual 2017-02-02 14:17:29 +01:00
0ccfa297f9 Start of Lamp drawing 2017-02-02 11:58:24 +01:00
6144721778 Groundline/GroundPoint shader for lights 2017-02-02 11:58:24 +01:00
Dalai Felinto
003c64757d Clay Engine per-collection settings
Note: this is still not used by rendering
2017-02-02 11:26:36 +01:00
Dalai Felinto
0b834c4fd9 Introduce Per-Collection Render settings
Pending:

* UI template for those settings (showing USE)
* Depsgraph evaluation of them (to flush into objects)
* RNA to see if a settings is being used
2017-02-02 11:26:36 +01:00
0651227c4a Fixing Memory Leak 2017-02-01 14:32:48 +01:00
160c643131 Implemented All Empties type drawing 2017-02-01 13:58:49 +01:00
Dalai Felinto
a19607ca56 Silence more warnings
This should silence the current warnings, and gives us real warnings if
the bContext data is tampered with.
2017-02-01 11:59:59 +01:00
Dalai Felinto
0526088819 Silence warning
There is still a warning because of `DST.context = C;` which discards
'const' qualifier. I find this a legit problem, I suspect we are not
suppose to store bContext at all.
2017-02-01 11:47:03 +01:00
85194046e6 Giving Overlay Edges a try 2017-02-01 00:28:16 +01:00
242715b843 Code cleanup 2017-01-31 17:27:19 +01:00
81db4d2b43 Added wire outlines 2017-01-31 17:27:05 +01:00
641828bf85 Code Cleanup 2017-01-31 16:15:06 +01:00
Dalai Felinto
f6b66e76e1 Use new temporary depsgraph
The idea is to use only Object, never Base
2017-01-31 15:21:40 +01:00
Dalai Felinto
dd4c638c0d Remove unused function (silence warning) 2017-01-31 15:20:40 +01:00
Dalai Felinto
71d7c57997 Merge branch 'render-layers' into clay-engine 2017-01-31 15:06:51 +01:00
Dalai Felinto
835f9742e6 Depsgraph hack: DEG_OBJECT_ITER and base_flag
This is a temporary iterator that flushes the base flag to the object
2017-01-31 15:06:34 +01:00
481785f153 Merge branch 'render-layers' of git.blender.org:blender into clay-engine 2017-01-31 14:03:00 +01:00
581b0c9a4f More Object mode work. 2017-01-31 14:01:23 +01:00
Dalai Felinto
a6191d0e27 UI: temporary panels for layer/collections 2017-01-31 13:06:26 +01:00
Dalai Felinto
6064ffdc83 bpy.ops.collections.* accessible outside collection editor 2017-01-31 13:05:26 +01:00
Dalai Felinto
c955b77f7d bpy.ops.collections.select()
When we introduce overrides we will extend it to have override_index,
and if it is -1, only set the collection
2017-01-31 13:05:23 +01:00
Dalai Felinto
a0e4ae5d37 bpy.ops.collections.collection_new() 2017-01-31 13:05:19 +01:00
Dalai Felinto
7f498b4bde Remove old layers bitflag from viewport 3d header template 2017-01-31 11:46:02 +01:00
Dalai Felinto
fb5682412d Let scene_collection and layer_collection to have the same fallback 2017-01-31 11:45:09 +01:00
c4c3951c4f Initial implementation of instancing 2017-01-31 11:44:40 +01:00
75d6a30cc2 Show Render Layer panel to clay engine. 2017-01-31 11:44:40 +01:00
Dalai Felinto
64b07e866a Add icon to collection panel 2017-01-31 10:52:09 +01:00
Dalai Felinto
52e1728a12 Fix logic for bpy.context.scene_collection 2017-01-31 10:46:06 +01:00
Dalai Felinto
910f16576d Unittest: refresh blender between tests 2017-01-31 10:14:46 +01:00
Dalai Felinto
5fa0315a75 Mesh batch caches should not be stored in file 2017-01-30 18:31:29 +01:00
Dalai Felinto
a35a66f702 Properties Editor: Collection context 2017-01-30 18:24:33 +01:00
Dalai Felinto
f35d38e5a7 Collections Editor: populate header with operators 2017-01-30 18:23:51 +01:00
Dalai Felinto
45b9dee8bd SceneCollection.objects.active_index (for user interface) 2017-01-30 18:23:05 +01:00
Dalai Felinto
8605eb9c97 Collection related operators barebones
Those are the operators for the collections editor, and the collection property panel
2017-01-30 18:21:36 +01:00
Dalai Felinto
1bfc6e79ee RNA: collection override 2017-01-30 18:21:34 +01:00
Dalai Felinto
f51c34185e bpy.context.layer_collection 2017-01-30 18:21:07 +01:00
f2e217938e Fixed unfreed memory 2017-01-30 15:35:12 +01:00
106f415ddd Fix crash on read file 2017-01-30 15:17:03 +01:00
b86e5a9fbf Fixed Pointer problem. Now materials are working. 2017-01-30 15:09:35 +01:00
12bac207c7 Added scene.active_engine_settings 2017-01-30 14:41:58 +01:00
Dalai Felinto
3da834e83c Collection Editor based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following
changes:

* Renamed references of layer manager to collections manager
* I didn't include the editors/space_collections/ draw and util files.

I still need to bring the drawing code here, so we see something.
2017-01-30 14:20:31 +01:00
Dalai Felinto
dce8ef49ff Layers: allow anonymous collection, and set active collection when linking it 2017-01-30 14:15:07 +01:00
08675b94ef Fixed Engine name length 2017-01-30 13:03:30 +01:00
ba4a30c71b Fix read/writefile.c 2017-01-30 12:19:51 +01:00
e15c16f11c Changes to DNA/RNA. Follow same layout as sensors. 2017-01-30 02:24:18 +01:00
744f26b612 Change in DNA/RNA. Still missing freeing and read/write. 2017-01-29 00:55:46 +01:00
5bf60530e5 Added switch to test viewport cache 2017-01-27 17:17:01 +01:00
Dalai Felinto
86887fe1c5 Temporarily prevent crash on edit mode 2017-01-27 15:20:19 +01:00
Dalai Felinto
29669db7d7 Merge remote-tracking branch 'origin/render-layers' into clay-engine 2017-01-27 12:46:39 +01:00
efa401b086 Introduce Dynamic Batches + Relationship lines + Clear some matrix warnings 2017-01-27 11:18:16 +01:00
4c416aea3b Merge branch 'render-layers' of git.blender.org:blender into clay-engine
# Conflicts:
#	source/blender/makesdna/DNA_scene_types.h
2017-01-26 19:49:09 +01:00
Dalai Felinto
c1742b88a4 Merge remote-tracking branch 'origin/blender2.8' into render-layers
Note:

renamed blo_do_versions_after_linking_280 to do_versions_after_linking_280 to following the pattern of do_versions_after_linking_270
2017-01-26 19:17:22 +01:00
Dalai Felinto
8d04f49d0e Mesh batch caches update from depsgraph
We no longer need to rely on Derived mesh flag since the mesh is
properly flushed from the depsgraph
2017-01-26 19:14:39 +01:00
Dalai Felinto
9b7b9d6ae9 Depsgraph: mesh cache depends needs updates when geometry changes (patch by Sergey Sharybin) 2017-01-26 19:06:17 +01:00
Dalai Felinto
8f673cb40c Fix blenderplayer build 2017-01-26 19:01:49 +01:00
Dalai Felinto
4c43dddeb7 Use the ultimate depsgraph callback function
Note: when in edit mode this depsgraph update is not being called. We are using DerivedMesh in those cases, so it is fine. I would like to investigate this though
2017-01-26 18:56:52 +01:00
fcd5880d12 Fix include compilation error on MSVC 2015. 2017-01-26 18:51:22 +01:00
92e5dfbeed Fix compilation error on windows 2017-01-26 18:33:24 +01:00
Dalai Felinto
40aa8a1c79 Fixup for selected_objects context
This was making crash happen for any operation :/ shame on me
2017-01-26 18:27:30 +01:00
Dalai Felinto
51f77a10eb Fixup in doversioning 2017-01-26 18:25:08 +01:00
9023abbf27 Depsgraph: Add placeholder function to handle objects update
This way @dfelinto can do some special trickery in there.
2017-01-26 17:24:57 +01:00
5ef2f21963 Merge branch 'master' into blender2.8 2017-01-26 17:23:33 +01:00
67bef6bcf6 Depsgraph: Fix typo in assert 2017-01-26 17:22:54 +01:00
d812e0cb64 Blender 2.8: Apparently auto-merge worked incorrect in the merge commit 2017-01-26 17:04:25 +01:00
9e48cafd6d Merge branch 'master' into blender2.8 2017-01-26 17:02:28 +01:00
fd69ba2255 Depsgraph: Link from material to object shading
This is a ground work for the upcoming changes in Blender 2.8 branch
where we need to do special actions to reconstruct shaders when
material changes.
2017-01-26 17:01:37 +01:00
c441eb27ea Depsgraph: Add relation from node tree to material it's coming from 2017-01-26 16:49:24 +01:00
331f721725 Depsgraph: Remove owner argument from relations builder as well
The idea was to link something to a parent, but the point is:
we must not pass owner deep and then have any parent-type-related
logic implemented in the "children".
2017-01-26 16:36:37 +01:00
f14e1da5aa Fix (unreported) crash when file browser attempts to show preview of some defective font
Confirmed with the Wine's bundled fonts.
2017-01-27 00:36:24 +09:00
3c3c52a74b Depsgraph: Remove owner node argument which was simply passed around 2017-01-26 16:29:09 +01:00
00c3c6824d Integrated MBC functions. Added Object centers and empties. 2017-01-26 15:56:40 +01:00
ac58a7fa19 Compositor: Make HSV node inputs a real sockets
This is much more flexible solution which will allow doing some
more procedural features.

Reviewers: brecht, dfelinto, mont29

Reviewed By: mont29

Subscribers: Severin

Differential Revision: https://developer.blender.org/D2403
2017-01-26 15:20:13 +01:00
Dalai Felinto
18cf3e1a38 Fix unfreed memory after cleaning render layers
The freestyle data was never freed when removing a renderlayer.

```
blender -b --factory-startup --debug-memory --python-expr "import bpy;bpy.ops.scene.render_layer_add();bpy.context.scene.render.layers.active_index=0;bpy.ops.scene.render_layer_remove()"
```
2017-01-26 11:58:51 +01:00
Dalai Felinto
290e080db4 Fix T50530: Crash on Info Editor "console"
Introduced on rB2de882e8 - the original size of the array was neglected
2017-01-26 09:41:40 +01:00
01527197aa Alembic: fix compile error on Linux. 2017-01-26 06:18:07 +01:00
b91edd61d0 Fix T50287: Blender crashes when open a blend that contains an alembic
file.

Missed in rB62a2ed97b.
2017-01-26 06:16:33 +01:00
Dalai Felinto
e346927111 Remove unused panels (layer_passes and layer_options) 2017-01-25 18:02:58 +01:00
Dalai Felinto
dd61b7d346 Add scene active layer 2017-01-25 18:02:09 +01:00
64f5afdb89 [Cycles/MSVC/Testing] Fix broken test code.
Currently the tests don't run on windows for the following reasons

1) render_graph_finalize has an linking issue due missing a bunch of libraries (not sure why this is not an issue for linux)
2) This one is more interesting, in test/python/cmakelists.txt ${TEST_BLENDER_EXE_BARE} and ${TEST_BLENDER_EXE} are flat out wrong, but for some reason this doesn't matter for most tests, cause ctest will actually go out and look for the executable and fix the path for you *BUT* only for the command, if you use them in any of the parameters it'll happily pass on the wrong path.
3) on linux you can just run a .py file, windows is not as awesome and needs to be told to run it with pyton.
4) had to use the NAME/COMMAND long form of add_test otherwise $<TARGET_FILE:blender> doesn't get expanded, why? beats me.
5) missing idiff.exe for msvc2015/x64 in the libs folder.

This patch addresses 1-4 , but given I have no working Linux build environment, I'm unsure if it'll break anything there

5 has been fixed in rBL61751

Reviewers: juicyfruit, brecht, sergey

Reviewed By: sergey

Subscribers: Blendify

Tags: #cycles, #automated_testing

Differential Revision: https://developer.blender.org/D2367
2017-01-25 09:37:19 -07:00
Dalai Felinto
99e8618202 Remove scene layer and collection from context 2017-01-25 17:01:39 +01:00
Dalai Felinto
e5482f986c Fix T50115: stereoscopic video file memory leak 2017-01-25 15:16:36 +01:00
ced20b74e5 Fix T50032: Wrong render result when same image is used with and without alpha 2017-01-25 14:02:59 +01:00
e29a6f739d Fix T50512: Linked Backround scene with animation not updating with new depsgraph
Was missing relations for the set scenes.

Perhaps not ideal solution, but should be good enough for now.
2017-01-25 12:30:29 +01:00
72ff78a951 Merge branch 'render-layers' of git.blender.org:blender into clay-engine
# Conflicts:
#	source/blender/editors/space_view3d/drawobject.c
2017-01-25 12:28:52 +01:00
e4de6e87e1 Depsgraph: Do ID tag outside of build_scene
Otherwise it was possible to get ID tags cleared in the middle
of DEG construction when there are set scenes used.
2017-01-25 12:28:27 +01:00
95e9790704 Fix compile error 2017-01-25 12:21:43 +01:00
8ea09252c8 Fix T50517: Rendering expecting time is negative 2017-01-25 11:18:12 +01:00
Dalai Felinto
212e5d60d3 Merge remote-tracking branch 'origin/blender2.8' into render-layers 2017-01-25 10:17:38 +01:00
Dalai Felinto
99cfad6a01 Convert MBC_ API to Mesh (instead of derived mesh) and move it to mesh_render
This includes a few fixes in the MBC_ api.

The idea here is for this to be the only interface the render engines
will deal with for the meshes.

If we need to expose special options for sculpting engine we refactor
this accordingly. But for now we are shaping this in a per-case base.

Note:
* We still need to hook up to the depsgraph to force clear/update of
batch_cache when mesh changes

(I'm waiting for Sergey Sharybin's depsgraph update for this though)

* Also ideally we could/should use BMesh directly instead of
DerivedMesh, but this will do for now.

Note 2:
In the end I renamed the `BKE_mesh_render` functions to `static
mesh_render`. We can re-expose them as BKE_* later once we need it.

Reviewers: merwin

Subscribers: fclem

Differential Revision: https://developer.blender.org/D2476
2017-01-25 10:01:48 +01:00
4cbfaa6f3f Revert "UI: Add missing menu item"
This reverts commit 1ad842d432.
2017-01-25 01:33:10 -05:00
1ad842d432 UI: Add missing menu item 2017-01-25 01:00:28 -05:00
a7d5cabd4e Fix T49405: Crash when baking with adaptive subdivision
Blenders baking system currently doesn't support the topology used by
adaptive subdivision and primitive ids will be wrong or out of range
leading to crashes. Updating the baking system to support other
topologies would be a bit involved, so for now we simply disable
subdivision while baking to avoid crashes.
2017-01-25 00:40:45 -05:00
57f937ad5a Remove commented code 2017-01-24 16:00:15 -05:00
Julian Eisel
8a6c689f30 Fix T50386: Crash when spawning pie menus
D2455 by @raa, thanks!
2017-01-24 21:35:38 +01:00
605695de61 Depsgraph: Fix duplicated operation node when two objects are sharing same armature 2017-01-24 17:15:39 +01:00
d84df351d0 Cycles: Don't rely on indirectly included algorithm 2017-01-24 16:39:16 +01:00
5be2a62ca3 Merge branch 'master' into blender2.8 2017-01-24 14:56:56 +01:00
b6ccba9241 Fix typo in comment 2017-01-24 14:56:35 +01:00
f286e7e017 Depsgraph: Make it more clear and explicit compile fail when required features are not found 2017-01-24 12:57:33 +01:00
769d189ff1 Depsgraph: Remove legacy code from new depsgraph
Now we have no remaining WITH_LEGACY_DEPSGRAPH in the code.
2017-01-24 12:55:37 +01:00
610af632a9 Depsgraph: Remove command line argument to use new depsgraph 2017-01-24 12:54:21 +01:00
a2d609331b Depsgraph: Remove more legacy code from viewport 2017-01-24 12:52:20 +01:00
218b06eb83 Depsgraph: Remove legacy updateDepgraph callbacks from modifiers 2017-01-24 12:49:23 +01:00
55e6d5428d Depsgraph: Remove legacy implementation of depsgraph 2017-01-24 12:47:23 +01:00
f20b8ae5aa Depsgraph: Remove legacy calls from scene update routines 2017-01-24 12:42:56 +01:00
46d6992907 Depsgraph: Remove special exception in update logging 2017-01-24 12:34:28 +01:00
9e40027110 Depsgraph: Remove special version of pose builder 2017-01-24 12:34:24 +01:00
23122ca889 Depsgraph: Remove legacy depsgraph code from viewport 2017-01-24 12:34:18 +01:00
991bda6959 Depsgraph: Remove legacy depsgraph code from transform 2017-01-24 12:34:14 +01:00
d4c5e366ea Install deps: Bump OpenSubdiv version to 3.1.1
Required to have some crash fixes.
2017-01-24 11:49:45 +01:00
520afa2962 GPencil: Fix unreported animation data missing when change palette name
When a palette was renamed, the animation data was not changed.

This fix is related to commit 196520fe7d
2017-01-24 09:15:41 +01:00
e5d8c2a67f Use new manual URL 2017-01-23 19:10:37 -05:00
d5c7d22bc2 Update script generating/uploading py API doc to new addresses (docs.blender.org). 2017-01-23 21:10:56 +01:00
c5ed943479 Clay Material work. 2017-01-23 18:36:30 +01:00
08ca32093a Merge branch 'master' into blender2.8 2017-01-23 18:11:42 +01:00
39577403d3 Fix compilation error with legacy depsgraph disabled 2017-01-23 18:08:41 +01:00
bc096e1eb8 Cycles: Split ShaderData object and shader flags
We started to run out of bits there, so now we separate flags
which came from __object_flags and which are either runtime or
coming from __shader_flags.

Rule now is: SD_OBJECT_* flags are to be tested against new
object_flags field of ShaderData, all the rest flags are to
be tested against flags field of ShaderData.

There should be no user-visible changes, and time difference
should be minimal. In fact, from tests here can only see hardly
measurable difference and sometimes the new code is somewhat
faster (all within a noise floor, so hard to tell for sure).

Reviewers: brecht, dingto, juicyfruit, lukasstockner97, maiself

Differential Revision: https://developer.blender.org/D2428
2017-01-23 12:56:55 +01:00
b9311b5e5a Cycles: Make object flag names more obvious that hey are object and not shader 2017-01-23 12:14:17 +01:00
2ae39ff6b1 Fix strict compiler warning in the gflags code 2017-01-23 11:52:41 +01:00
7b8810b01a Silence strict compiler warnings
Similar thing to other areas where we mix Blender's char with OpenGL API.
2017-01-23 11:46:02 +01:00
Dalai Felinto
673a149e87 Merge remote-tracking branch 'origin/blender2.8' into render-layers 2017-01-23 11:17:09 +01:00
77982e159c Cycles: Fix typo in the panel name
No user visible changes, it was a typo in the name of the class.

Spotted by povmaniac in IRC, thanks!
2017-01-23 10:35:15 +01:00
2268f41418 Cycles: Update current Cycles version 2017-01-23 10:25:59 +01:00
efa46d7db0 Initial support of Uniform Buffer objects 2017-01-23 09:54:54 +01:00
Julian Eisel
1814241526 Merge branch 'master' into blender2.8
Conflicts:
	source/blender/editors/space_action/action_draw.c
2017-01-22 21:16:00 +01:00
ce8889175a Fix T50491: Cycles UI breaks when pushing F8.
Cycles add-on did not actually support reloading correctly.

When you want to correctly reload sub-modules (i.e. modules of an add-on
which is a package), you need to use importlib, a mere import will do
nothing with already loaded modules (RNA classes are sort of
pre-registered when they are evaluated, through the meta-class system).
2017-01-22 12:42:14 +01:00
d2382f782e Fix T49527: Blender stalls when changing armature ghosting range with stepsize = 0
A big thanks to Steffen Mortensen (stifan) for finding the root cause of this bug!
2017-01-22 02:55:10 +13:00
82187a58f5 Fix own mistake in rB051526da6279, confusing off_t with ptrdiff_t. 2017-01-20 21:57:48 +01:00
475d536f72 Fix minor glitches in GP code.
Reported by coverity scan.
2017-01-20 18:46:06 +01:00
a97ec403c2 Fix/cleanup stupid check on array of char being non-NULL pointer...
Reported by coverity scan.
2017-01-20 18:43:42 +01:00
21e1282265 Fix float buffer of tracking image accessed outside of check that it has been correctly allocated.
Reported by coverity scan.
2017-01-20 18:41:56 +01:00
43268c1997 Cycles: Use more const qualifiers to avoid possible issues 2017-01-20 17:54:17 +01:00
a1c21e0b50 Cycles: Cleanup, split one gigantic function into two smaller ones 2017-01-20 17:52:48 +01:00
094d916c60 Fix compilation error with strict flags 2017-01-20 17:47:09 +01:00
cdaed4d360 Fix compilation error with strict flags and gcc-6 2017-01-20 17:43:13 +01:00
051526da62 Cleanup/fix some BLI_string_utf8 not using size_t/off_t as expected. 2017-01-20 16:51:05 +01:00
2666a222f6 Cleanup/fix last remnant usages of int instead of size_t for string length in BLI_string_utils. 2017-01-20 16:51:05 +01:00
404e59c842 D1873: Customize style for animation motion paths
New options to define the style of the animation paths in order to get
better visibility in complex scenes.

Now is possible define the color, thickness and several options relative
to the style of the lines used to draw motion path.
2017-01-20 16:49:14 +01:00
1ad04c7d65 Cycles: Store time in BVH nodes
This way we can stop traversing BVH node early on.

Gives about 2-2.5x times render time improvement with 3 BVH steps.
Hopefully this gives no measurable performance loss for scenes with
single BVH step.

Traversal is currently only implemented for QBVH, meaning old CPUs
and GPU do not benefit from this change.
2017-01-20 12:46:18 +01:00
c4890cd354 Cycles: Add option to split triangle motion primitives by time steps
Similar to the previous commit, the statistics goes as:

BVH Steps     Render time (sec)       Memory usage (MB)
    0                46                    260
    1                27                    373
    2                18                    598
    3                15                    826

Scene used for the tests is the agent's body from one of the barber
shop scenes (no textures or anything, just a diffuse material).

Once again this is limited to regular (non-spatial split) BVH,
Support of spatial split to this feature will come later.
2017-01-20 12:46:18 +01:00
5298853e95 Cycles: Add option to split curve motion primitives by time steps
The idea is to create several smaller BVH nodes for each of the motion
curve primitives. This acts as a forced spatial split for the single
primitive.

This gives up render time speedup of motion blurred hair in the cost
of extra memory usage. The numbers goes as:

BVH Steps     Render time (sec)       Memory usage (MB)
    0               258                    191
    1               123                    278
    2                69                    453
    3                43                    627

Scene used for the tests is the agent's hair from one of the barber
shop scenes.

Currently it's only limited to scenes without spatial split enabled,
since the spatial split builder requires some changes to work properly
with motion steps coordinates.
2017-01-20 12:46:18 +01:00
d50d370755 Cycles: Add utility function to calculate curve boundbox from given 4 keys
Also fixed some issues with motion keys calculation:

- Clamp lower and upper limits of curves so we can safely call those
  functions for the very first and very last curve segment.
- Fixed wrong indexing for the curve radius array.
- Fixed wrong motion attribute offset calculation.
2017-01-20 12:46:18 +01:00
6f900c383a Cycles: Cleanup, trailing whitespace 2017-01-20 12:46:18 +01:00
26cdc64a7f Cycles: Split motion triangle file once again, avoids annoying forward declarations 2017-01-20 12:46:17 +01:00
14d343a8f9 Cycles: Move motion triangle intersection functions to own file
Mimics how regular triangles are working and makes it more clear where
the stuff is located in the kernel.

Needed to have some forward declarations because of the current placement
of things in the kernel.
2017-01-20 12:46:17 +01:00
ebc695ef2c Cycles: Cleanup, better variable name 2017-01-20 12:46:17 +01:00
20eb1fe3c1 Cycles: Add utility function to fetch motion keys while on CPU side 2017-01-20 12:46:17 +01:00
938ec3a743 Cycles: Cleanup, comments 2017-01-20 12:46:16 +01:00
461214508c Cycles: Add utility function to fetch motion triangle when on CPU side 2017-01-20 12:46:15 +01:00
811e6c2d32 Cycles: Cleanup, delete trailing whitespace 2017-01-20 12:46:15 +01:00
254fbcdd7b Cycles: Fix compilation error on with older GCC
Hopefully it works on all platforms now.
2017-01-20 11:55:48 +01:00
ff1b850081 Fix T50460. Greying out issue with Cycles culling options. 2017-01-20 10:58:03 +01:00
05ff32bd25 Fix compile error (-Werror=float-conversion). 2017-01-20 10:50:55 +01:00
2e3fda2d95 DopeSheet: Show group colours behind keyframes too
Following @AlonDan's feature request and @hjalti's screenshot yesterday,
I've decided to implement support for this to make it easier to scan which
keyframes correspond with which set of controls, especially when faced with
a large wall of keyframes.

In retrospect, I should've done this a long time ago!
2017-01-20 18:40:26 +13:00
bbbb8405b6 Removed Batch storage
Also lots of renaming
Small visual tweaks
Material Settings Struct is now shared by Scene and material
2017-01-20 01:11:42 +01:00
831cfcfb3d API: Do not show "Created using Sphinx" in the footer
I talked to Campbell and he said there is no need for this
2017-01-19 16:16:04 -05:00
c91bdaf55b Build dir should be set after the sanity checks
Error here is that if do not have 2012 it switch to 2015 but not change the build dir
2017-01-19 16:00:52 -05:00
2a2ae9c3fa BMesh: remove BM_face_create_ngon_vcloud
Instead, add BM_verts_sort_radial_plane
and use regular creation API.
2017-01-20 06:09:37 +11:00
53e7a4a83c Correct asserts, un-hiding when selected is ok 2017-01-20 06:00:55 +11:00
Dalai Felinto
f8e4999656 I hereby declare layers syncing fully implemented! 2017-01-19 18:25:18 +01:00
Dalai Felinto
1edabaee72 curve convert and mesh separation working 2017-01-19 18:25:18 +01:00
Dalai Felinto
8a8e5055e3 Refactor mball util function, untested
I have not address MBalls directly, so there are probably other parts that are required to conform to the new code before consider than useful
2017-01-19 18:25:18 +01:00
Dalai Felinto
adcb6a1b90 Handle main object dupli functions
Missing: mesh separation, material split, mesh conversion (curve to mesh)
2017-01-19 18:25:18 +01:00
Dalai Felinto
971aa5f838 unittest: bpy.ops.object.duplicate 2017-01-19 18:25:18 +01:00
Dalai Felinto
caf59d3709 Use more of the FOREACH macros in screen_context.c 2017-01-19 17:15:19 +01:00
d6cf28c5e1 Cycles: Expose diffuse and glossy depth to Light Path node
Was a bit confusing to have transparent and translucent depth
exposed but no diffuse or glossy.

Reviewers: brecht

Subscribers: eyecandy

Differential Revision: https://developer.blender.org/D2399
2017-01-19 15:09:58 +01:00
afdd756e56 Cycles: Don't use fast math for the host code
This is important for the reliable behavior or isnan/isfinite/min/max
functions to work with nan and non-finite values. Some of the issues
with fast math are possible to work around, but didn't find a way to
have reliable min/max implementation yet.
2017-01-19 14:51:11 +01:00
78b94902f8 Cycles: Add fast-math safe isnan and isfinite
Currently unused, but might become really handy in the future.
2017-01-19 14:51:11 +01:00
6d36e033ba Cycles: Remove using namespace hell
Please NEVER EVER use such a statement, it's only causing HUGE
issues. What is even worse: it's not always possible to immediately
see that the hell is coming from such a statement.

There is still some statements in the existing code, will leave
those for a later cleanup.
2017-01-19 14:51:11 +01:00
446ed355a5 GPencil: Add option to create blank frame in active layer only
Now it is possible to select if the blank frame is created in active
layer only or in all layers.
2017-01-19 13:05:23 +01:00
666cb5ddd9 Cleanup: naming, comments assert for hide+selected 2017-01-19 22:59:41 +11:00
e2d02fee30 BMesh: improve hide-flush internal logic
- flushing hidden state ran when it didn't need to.
- flushing checks didn't early exit when first visible element found.
- low level BM_*_hide API calls like this can use skip iterators
  can loop over struct members directly.

No user-visible changes.
2017-01-19 22:50:56 +11:00
Dalai Felinto
bd14352a01 object/base iterator refactor + add FOREACH_VISIBLE_BASE 2017-01-19 12:07:12 +01:00
Dalai Felinto
32662bc95d Using static for prototypes 2017-01-19 12:06:18 +01:00
8aa8165e85 OpenGL: convert legacy calls in transform.c
Took pieces from D2316 and D2359, changed a few more things.

- use new immediate mode
- use new matrix stack
- remove state push/pop

Part of T49043 and T49450
2017-01-19 00:46:20 -05:00
b76dbf5e65 UI: Fix capitalization inconsistency 2017-01-18 19:38:55 -05:00
4a19112277 Cycles: Fix amount of rendered samples not being shown while rendering the last tile on CPU 2017-01-19 00:48:09 +01:00
1455023e64 Fix T49807: Inset faces edge rail bug 2017-01-19 10:37:04 +11:00
11187e8628 Fix face-creation with existing hidden geometry
- face-create-extend option could add hidden verts and edges into
  the selection history (invalid state).
- faces could be created that included existing hidden edges
  that remained hidden (invalid state too).
- newly created faces could copy hidden flag from surrounding faces,
  giving very confusing results (looks as if face creation failed).

Surprising nobody noticed these years old bugs!
2017-01-19 09:17:36 +11:00
fd4728c85a BMesh: Use angle_signed_on_axis_v3v3v3_v3 2017-01-19 07:59:32 +11:00
76dead8603 Basic Implementation of GTAO :
There is still artifacts to remove and optimisation to do.
2017-01-18 18:55:56 +01:00
a48d3417b5 Fix strict compiler warning message 2017-01-18 15:56:40 +01:00
b059a71655 GPencil: Avoid variable shadowing 2017-01-18 15:56:04 +01:00
Dalai Felinto
550446bade Tag areas of code that require TODO_LAYER_COPY 2017-01-18 15:41:27 +01:00
Dalai Felinto
10db593060 Merge remote-tracking branch 'origin/blender2.8' into render-layers
Manual fix: collection.c layer.c
2017-01-18 15:40:05 +01:00
6d868d9f48 Reproject Strokes - To Surface/Geometry
Experimental option for the Reproject Strokes operator to project strokes on to
geometry, instead of only doing this in a planar (i.e. parallel to viewplane) way.

The current implementation is quite rough, and may need to be improved before it
is really ready for use. Potential issues:
* Loss of precision (i.e. stairstepping artifacts) from the 3D -> 2D -> 3D conversion
  as we don't have float version of one of the projection funcs
* Jagged depth if there are gaps, since it will default back to the 3d-cursor plane
  if no geometry was found (instead of doing some fancy interpolation scheme)
* I'm not sure if it's that useful for adapting GP strokes to deforming geometry yet...
2017-01-19 03:20:44 +13:00
00edc600b0 Fix: Make it possible to erase strokes (on other layers) even if the active layer doesn't have any frames 2017-01-19 03:06:43 +13:00
7452af0f86 Fix: Avoid creating redundant frames when erasing
Now the eraser checks if there's an active frame with some strokes in it
before creating a new frame. There's no point in creating a new frame if
there are no strokes in the active frame (if one exists).

This still doesn't help much if there were strokes but they weren't touched though...
2017-01-19 03:06:43 +13:00
a93881d704 GPencil: Pressing 'B' while in 'Continuous Drawing' mode will create a blank frame
This is a hardcoded keymapping that just calls the "Add Blank Frame" operator
introduced in the previous commit.
2017-01-19 03:06:42 +13:00
259447300f GPencil: "Add Blank Frame" operator (D+B)
This operator adds a new frame with nothing in it on the current frame.
If there is already a frame there, all existing frames are shifted one frame later.

Quite often when animating, you may want a quick way to get a blank frame,
ready to start drawing something new. Or maybe you just need a quick way to
add a "placeholder" frame so that a suddenly-appearing element does not show
up before its time.
2017-01-19 03:06:41 +13:00
86b6006ef8 GPencil: Cleanup - move include line to correct scope 2017-01-18 13:00:09 +01:00
196520fe7d GPencil: Fix unreported error in animation after rename items
If the layers or the colors were renamed, the animation data was wrong
because the data path was not updated.

I also have fixed a possible stroke color name update if the name was duplicated moving
the rename function call after checking unique name.
2017-01-18 12:29:02 +01:00
d216313732 Cleanup: Strict compiler flags
Also seems the new file forced trailing whitespace, which goes against

  https://wiki.blender.org/index.php/Dev:Doc/Code_Style#Trailing_Space
2017-01-18 12:20:53 +01:00
e138cdeeb6 Transform manipulator: Allow first clicking Shift before selecting axis
Avoids possible jumps when one is trying to do some really preciese tweak.

Quite striaghtforward change for mouse input initialization: take Shift
state into account. However, this will interfere with the axis exclusion
which is currently also uses Shift (the feature to move something in a
plane which doesn't have selected axis). This is probably not so commonly
used feature (nobody in the studio even knew of it) and the only downside
now would be that such a constrainted movement will become accurate by
default. That's easy to deal from user side by just unholding Shift key.

Reviewers: brecht, mont29, Severin

Differential Revision: https://developer.blender.org/D2418
2017-01-18 12:18:54 +01:00
Dalai Felinto
03fc433e18 Fix unittest for cases where we set render_layer but not scene_collection 2017-01-18 11:59:26 +01:00
Dalai Felinto
597cafb873 Fix context operator test
We needed a fallback for the cases where the layer was specified but not a scene_collection
2017-01-18 11:56:28 +01:00
Dalai Felinto
53eabca4e8 BKE_scene_layer_has_collection
Util function to check if a SceneCollection is linked to a SceneLayer

This is needed for corner cases of bpy.context.scene_collection when the context render_layer mismatches the context scene_collection.
2017-01-18 11:48:40 +01:00
8d4b31ce03 GP Interpolation: "Remove Breakdowns" operator
To make it faster to try different interpolation curves, there's a new operator
"Remove Breakdowns" which will delete all breakdowns sandwiched by normal
keyframes (i.e. all the ones that the previous run of the Interpolation op created)
2017-01-18 19:42:00 +13:00
65ec429d11 GP Interpolate Sequence: Tool settings for controlling the shape of interpolation
This commit introduces the ability to use the Robert Penner easing equations
or a Custom Curve to control the way that the "Interpolate Sequence" operator
interpolates between keyframes. Previously, it was only possible to get linear
interpolation between the gp frames.

Workflow:
1) Place current frame between a pair of GP keyframes
2) Open the "Interpolate" panel in the Toolshelf
3) Choose the interpolation type (under "Sequence Options")
4) Adjust settings (e.g. if you're using "Custom Curve", use the curvemap widget
   to define the way that the interpolation proceeds)
5) Click "Sequence" to interpolate
6) Play back/scrub the animation to see if you've got the result you want
7) If you need to make some tweaks, undo, or delete the generated keyframes,
   then repeat the process again from step 4 until you've got the desired result.
2017-01-18 19:41:59 +13:00
224ae23443 GP Interpolate: Move settings from "gp_sculpt" to a new toolsettings struct - "gp_interpolate"
The "gp_sculpt" settings should be strictly for stroke sculpting, and not abused by
other tools. (Similarly, if other general GP tools need one-off options, those should
go into the normal toolsettings->gpencil_flag)

Furthermore, this paves the way for introducing new settings for controlling the way
that GP interpolation takes place (e.g. with easing equations, or a custom curvemap)
2017-01-18 19:41:58 +13:00
4903a83235 GP Interpolate Code Cleanup (Second Round)
* Reduce scope of variables
* Simplify a lot of the active_gpl->actframe->...->framenum stuff
* Missed some error messages
2017-01-18 19:41:58 +13:00
fd119a3723 Code Cleanup for GP Interpolation ops (first pass)
* Reshuffled some blocks of code for better ease of navigation/flow in the file
* Improved some tooltips
* Removed "Helper" tag from some functions that serve bigger roles
* Fixed some errant formatting
2017-01-18 19:41:57 +13:00
cd8cde1a6a Code Cleanup: Move GPencil Interpolation operators into their own file
The interpolation operators (and their associated code) occupied a significant
portion of gpencil_edit.c (which was getting a bit heavy). So, it's best to split
these out into a separate file to make things easier to handle, in preparation
for some further dev work.
2017-01-18 19:41:57 +13:00
3216831c76 T50457 Remove temporary solution for animation types and put in definitve position
After revert the commit rB4b99958ca12642, the line added at the end of the enum is not necessary anymore because it is replaced by the corresponding element in the list in the right position.
2017-01-17 20:01:59 +01:00
3df30c34c3 Revert "Remove particle expander"
This reverts commit 4b99958ca1.
2017-01-17 19:46:05 +01:00
Dalai Felinto
096f251122 Left-over from previous commit (remove OBJECT_OT_move_to_layer) 2017-01-17 17:58:56 +01:00
Dalai Felinto
b3ce0625c6 Remove OBJECT_OT_move_to_layer 2017-01-17 17:45:08 +01:00
Dalai Felinto
ef7dc52b53 Link objects in scene using ObjectBase 2017-01-17 17:42:32 +01:00
61b52f6d90 Fix previous commit because there are some code using this define, but really it is not used in editors. This is a temporary fix to broken editors, but this entry must be removed or moved to the right place when particles are in place again. 2017-01-17 15:53:31 +01:00
Dalai Felinto
74ba736fc4 Update selected_editable_bases to use ObjectBase 2017-01-17 15:33:46 +01:00
Dalai Felinto
78b630844b Remove base from BKE_object_groups_clear 2017-01-17 15:32:55 +01:00
Dalai Felinto
b1ff8e8703 Remove OB_FROMGROUP from base, and add util funcs to sync base/object flags
I still want to remove the syncing of base/object flags. But for now
this will at least help future refactor.
2017-01-17 14:58:41 +01:00
Dalai Felinto
216273d9e9 ObjectBase need a flag for from_dupli temp objects 2017-01-17 14:13:53 +01:00
276e36a59f Remove unused definition. This enum must be synchronized with the registration ANIM_init_channel_typeinfo_data function in anim_channels_define.c
If the list is not equal, weird things start to happend in animation editors.
2017-01-17 13:33:37 +01:00
e6bba9fa3a Edge AO improvement when geometry is over the background. 2017-01-17 12:59:39 +01:00
Dalai Felinto
fd99d52448 Fixup on versioning (re: selected objects) 2017-01-17 12:46:31 +01:00
af9f6fd57e Add 'Layer Weight' node to Blender internal node items 2017-01-17 12:02:05 +03:00
d7b2093db3 Return correct alpha for environment map in GLSL 2017-01-17 11:52:02 +03:00
43872f59b9 Merge branch 'master' into blender2.8 2017-01-16 21:03:12 +01:00
e0303d0297 Cleanup/refactor: move BKE_deform_flip_side_name & co to BLI_string_utils
Functions like that do not have anything to do in BKE really, even less
when actually more used for bones than vgroups!
2017-01-16 20:36:23 +01:00
7ce833af5b Cleanup/refactor: get rid of fixed name limit in BKE_deform_flip_side_name & co.
Those were forcing to use vgroup name define in bones area, or even
mixing with maxbonename... ugly, and totally avoidable.
2017-01-16 20:36:23 +01:00
b997988323 Cleanup/refactor: Add new BLI_string_util.
Things like `BLI_uniquename` had nothing, but really nothing to do in
BLI_path_util files!

Also, got rid of length limitation in `BLI_uniquename_cb`, we can use
alloca here to avoid overhead of malloc while keeping free size (within
reasonable limits of course).
2017-01-16 20:36:23 +01:00
3748defefe Cleanup: remove unused & unimplemented BLI_newname. 2017-01-16 20:36:22 +01:00
702bc5ba26 Fix T50393: Flip names working just on one side when both are selected.
Just store bones that could not get renamed to desired flipped name on the
first try into a temp list, and try to rename them a second time.

This is rather simple solution, will induce 'over numbering' in case you
flip a bone to another unselected bone's name (since number will be
incremented in both rename attempts), but think this is acceptable minor
glitch, for a corner case situation that does not have any good
resolution anyway.

Also, set `strip_numbers` option of `BKE_deform_flip_side_name` to
false, otherwise chains of bones with same names would get their numbers
completely messed up after name flipping.

Based on work by @dfelinto in D2456 (https://developer.blender.org/D2456), thanks.
2017-01-16 20:36:22 +01:00
92fbcbb4bf Cycles: Cleanup, spelling 2017-01-16 17:55:41 +01:00
d3e4eecaa5 Cycles: Cleanup, avoid shadowing 2017-01-16 17:54:39 +01:00
Dalai Felinto
c36cdb92d6 Update selectable_bases to use ObjectBase 2017-01-16 17:49:35 +01:00
Dalai Felinto
9ddb221aab Update visible_bases to use ObjectBase 2017-01-16 17:04:02 +01:00
Dalai Felinto
5ff3dd5d97 Fix logic for BKE_scene_layer_base_flag_recalculate 2017-01-16 16:36:53 +01:00
Dalai Felinto
d2f97224b5 Remove select by layer operator 2017-01-16 15:12:58 +01:00
Dalai Felinto
10754500b0 Add BASE_SELECTABLED flag 2017-01-16 15:12:58 +01:00
Dalai Felinto
8a3dd31658 Rename: BASE_VISIBLE > BASE_VISIBLED
BASE_VISIBLE was already defined on DNA_scene_types.h
2017-01-16 15:12:58 +01:00
Dalai Felinto
911c31c201 Remove object hide operators 2017-01-16 15:12:58 +01:00
Dalai Felinto
c21e00683c Remove outliner restrict options for objects (and groups) 2017-01-16 15:12:58 +01:00
Dalai Felinto
0ad3979a6c Implement update of selected/visible based on collection tree 2017-01-16 10:54:34 +01:00
af9e99763c OpenGL: convert anim_channel_defines.c to new imm mode
This is part of T49043

fixed up some color/rect calls

fixed up ANIM_channel_draw()

Reviewers: krash, merwin

Reviewed By: merwin

Tags: #bf_blender_2.8

Maniphest Tasks: T49043

Differential Revision: https://developer.blender.org/D2377
2017-01-16 00:18:28 -05:00
7d55761c5d OpenGL: fix immRect usage & convert more glRect calls
part of T49043
2017-01-15 23:48:46 -05:00
4e2c6ad8ee Updating outliner_draw_struct_marks to retained mode
Had to add a few utility functions to replace existing functions. Let me know if these are duplicates.

Reviewers: merwin

Reviewed By: merwin

Tags: #bf_blender_2.8

Maniphest Tasks: T49043

Differential Revision: https://developer.blender.org/D2434
2017-01-15 19:30:05 -05:00
0a446d7276 Add 3d to 2d plane mapping functions to math lib
This adds two functions to project 3d coordinates onto a 3d plane,
to get 2d coordinates, essentially eliminating the plane's normal axis
from the coordinates.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D2460
2017-01-14 00:34:51 -02:00
Dalai Felinto
c4e34a84e0 Outliner: initial work for render-layers
Remove Base references, still need to do some adjustments
2017-01-13 18:34:18 +01:00
Dalai Felinto
baad441362 FOREACH_VISIBLE_OBJECT macro
Also adding a new flag value for ObjectBase to store visibility.

I still need this to be synced, but the idea is to centralize the
logic of tree evluation, and keep the visibility cached.
2017-01-13 18:34:18 +01:00
Dalai Felinto
533965db73 Initial syncing of selection and visibility flag
When we make a collection invisible or unselectable, selected object have to be re-evaluated
Same goes for when we add a new object, its base visibility has to be
refreshed.

TODO also add a call for this when we remove a scene collection, or
unlink a scene layer.
2017-01-13 18:34:18 +01:00
33ca692256 Added object mode wires to new drawing pipeline. 2017-01-13 18:25:06 +01:00
646aa40cf7 Fix missing user when opening text from ID UI widget.
Own mistake in recent fix for Text data-block usercount (rBa9163f7d2).

Reported by @sergey over IRC, thanks.
2017-01-13 18:12:56 +01:00
e5a665fe24 Cycles: Fix wrong transparent shadows for motion blur hair
This was a missing bit from b53ce9a.
2017-01-13 16:14:57 +01:00
14f6e27f6a Cycles: Cleanup, style 2017-01-13 15:24:56 +01:00
Dalai Felinto
988024063f Use ObjectBase only to delete objects 2017-01-13 11:21:20 +01:00
807b1a262f Cycles: Simplify some code in Curve BVH reference fill
makes code slightly shorter and uses idea of const qualifiers.
2017-01-13 10:59:34 +01:00
3160472a66 Cycles: Avoid shadowing in BVH code
Run into some nasty bugs while trying various things here.

Wouldn't mind enabling -Wshadow for Cycles actually..
2017-01-13 10:53:01 +01:00
bd6bd62753 Fix small spelling error 2017-01-12 23:36:08 -05:00
d464fb0996 Dynamic Paint: recursively search for island border edges.
It is quite likely in a triangulated mesh that the actual island edge
belongs to a different triangle than the current pixel; for example
consider corners of a triangulated axis aligned rectangle face that
have the additional edge: a pixel there will have to be assigned to
one of the triangles, but one of the edges of the original rectangle
can only be accessed through the other triangle.

Thus for robust operation it is necessary to do a recursive search.
The search is limited by requiring that it only goes through edges
that bring it closer to the target point, and also by depth as a
safeguard.

Differential Revision: https://developer.blender.org/D2409
2017-01-12 21:28:15 +03:00
c937c3af46 Dynamic Paint: provide margin of error for linking neighbors across seams.
The code requires the pixel on the other side of the seam to be assigned
precisely to the expected triangle. This can cause false negatives around
vertices, where a pixel is likely to touch multiple triangles and thus
cannot be said to unambiguously belong to any one of them, so check
distance to the intended triangle and accept the result if it's close.
2017-01-12 21:28:15 +03:00
99ca90e808 Dynamic Paint: improve UV island border handling in effects.
1. Forcibly symmetrize the neighbor relations, so that if A is neighbor
   of B, B is neighbor of A. The existing code is guaranteed to violate
   this if texture resolution is different between the sides of a seam.

2. In texture mode dynamic paint adds a 1 pixel wide border around the
   islands. These pixels aren't really part of the dynamic paint domain
   and thus by design can't have symmetrical neighbor relations. This
   means they can't be treated by effects like normal pixels.
   The simplest way to handle it in a consistent way is to exclude
   them from effects, but add an additional pass that recomputes them
   as average of their non-border neighbors, located on both sides of
   the seam.
2017-01-12 21:28:14 +03:00
720e564882 Cycles: Allow up to 4 motion curve primitives per BVH node
This avoids intersection AABB of different curve primitives
which makes it less ray-to-primitive intersections.

This gives about 30% speedup of hair rendering in the barber
shop scenes here. There is still some work to be done on those
files to solve major speed issues on certain frames.
2017-01-12 18:23:23 +01:00
Dalai Felinto
07d571ea22 Remove Bases onces and for all
This officially makes the viewport not draw anything, until we get the
new ObjectBase * to use.

This is easily revertable, but for now I prefer to make sure this is not
in the way of refactoring.
2017-01-12 18:23:01 +01:00
b53ce9a1d0 Cycles: Prepare BVH traversal code to work with multiple curve primitives per node 2017-01-12 18:20:19 +01:00
Dalai Felinto
0fba4655bf Updated python files to use select_get/_set() [not addons] 2017-01-12 17:51:09 +01:00
f12f906dd9 Cycles: Correct assert() for cases when there are multiple curves per BVH node 2017-01-12 17:38:27 +01:00
76a4cf1941 Cycles: Use separate limit for motion primitives for BVH node limits
This way we can have different limits for regular and motion curves
which we'll do in one of the upcoming commits in order to gain some
percents of speedup.

The reasoning here is that motion curves are usually intersecting
lots of others bounding boxes, which makes it inefficient to have
single primitive in the leaf node.
2017-01-12 16:54:08 +01:00
0421ae056d Cycles: Change confusing logic of max leaf size check
Maximal number of elements is supposed to be inclusive. That is what
it was always meant in this file and what @brecht considered still
the case in 6974b69c61.

In fact, the commit message to that change mentions that we allowed
up to 2 curve primitives per leaf while in fact it was doing up to 1
curve primitive.

Making it real 2 primitives at a max gives about 5% slowdown for the
koro.blend scene. This is a reason why BVHParams.max_curve_leaf_size
was changed to 1 by this change.
2017-01-12 16:33:08 +01:00
d9cd9ff322 Cycles: Cleanup, space prior to semicolon
We don't have that in Blender style, no reason to violate it here.
2017-01-12 15:31:25 +01:00
985c121c0b Cycles: Cleanup, make curve functions private
Not only they don't really follow naming convention (we don't use
camel case) but also was not necessary to keep them in the global
symbol table.
2017-01-12 15:28:19 +01:00
83d18a2a91 Cycles: Make it more clear message why curve motion attribute was removed 2017-01-12 15:22:41 +01:00
53fa389802 Cycles: Use dedicated debug passes for traversed nodes and intersection tests
This way it's more clear whether some issue is caused by lots of geometry in
the node or by lots of "transparent" BVH nodes.
2017-01-12 13:44:35 +01:00
8daf02f134 Cycles: Remove more duplicated code in debug passes logic 2017-01-12 13:33:53 +01:00
789fdab825 Cycles: Fix wrong scaling of traversed instances debug pass 2017-01-12 13:32:13 +01:00
618b3480c8 Cycles: Cleanup, remove duplicated code 2017-01-12 13:31:35 +01:00
7eb4c850d3 Merge branch 'master' into blender2.8 2017-01-12 12:59:45 +01:00
d1131227c5 Cycles: Cleanup, indentation within preprocessor 2017-01-12 12:54:24 +01:00
511dbe56db Cycles: Cleanup, use switch() instead of if-else chain
About to add extra debug passes, which will be more clear to use switch().
2017-01-12 12:45:37 +01:00
e954a6b8bc Fix crash. 2017-01-12 12:29:58 +01:00
554024e08e Cycles: move hair particle settings to scene context
Since the beginning of times hair settings in cycles were global for
the whole scene but were located in the particle context. This causes
quite some trickery to get shots set up for the movies here in the
studio by forcing artists to create dummy particle system to change
settings of hair on the shot.

While ideally this settings should be properly become per-particle
system for the time being it will save sweat and blood to move the
settings to scene context.

Reviewers: brecht

Subscribers: jtheninja, eyecandy, venomgfx, Blendify

Differential Revision: https://developer.blender.org/D2287
2017-01-12 10:48:17 +01:00
67f68295be Cycles tests: Rework output messages
Made them closer to how GTest shows the output, so reading test logs
is easier now (at least feels more uniform).

Additionally now we know how much time tests are taking so can tweak
samples/resolution to reduce render time of slow tests.

It is now also possible to enable colored messages using magic
CYCLESTEST_COLOR environment variable. This makes it even easier to
visually grep failed/passed tests using `ctest -R cycles -V`.
2017-01-12 09:47:54 +01:00
65c8937f7e Add Add Modifiers tab to the NLA & VSE editors
This is a follow up to rBca935ab

Differential Revision: https://developer.blender.org/D2442
2017-01-12 01:03:23 -05:00
306711c7ab Separate SSAO code & add orthographic support 2017-01-12 01:15:16 +01:00
Julian Eisel
092cbcd1d2 Fix T50056: Dyntopo brush size shortcut broken using constant detail setting. 2017-01-11 23:16:02 +01:00
Julian Eisel
c4f60319d1 UI: Try limiting 'x' icon to search buttons
Reusing PROP_TEXTEDIT_UPDATE instead of adding a new property flag just for search strings. Currently it's only used for search strings anyway so seems fine for now.

Fixes T50336.
2017-01-11 22:15:50 +01:00
c910beaa21 Split interp_weights_face_v3 into specific functions for tris and quads
This splits `interp_weights_face_v3` into `interp_weights_tri_v3` and
`interp_weights_quad_v3`, in order to properly handle three sided polygons
without needing a useless extra index in your weight array. This also
improves clarity and consistency with other math_geom functions, thus
reducing potential future errors.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D2461
2017-01-11 17:55:13 -02:00
382ade4c29 Added saturation and value slider + fix versioning 2017-01-11 19:48:51 +01:00
0507b3e4c4 Viewport SSAO: Fix normals not normalized 2017-01-11 18:47:06 +01:00
2c3d9f2762 Merge remote-tracking branch 'origin/render-layers' into clay-engine
# Conflicts:
#	source/blender/editors/space_view3d/drawobject.c
#	source/blender/gpu/intern/gpu_viewport.c
2017-01-11 17:41:18 +01:00
ddd95b9712 Fixed versionning 2017-01-11 17:38:00 +01:00
a94b4c2ff0 Fix Crash and Unfreed Memory 2017-01-11 16:58:08 +01:00
fd7f78d89f Introduce Batch storage. 2017-01-11 16:34:02 +01:00
394fa07d41 Cycles: Fix wrong motion blur when combining deformation motion blur with autosplit
The issue was that we used to compare number of vertices for mesh after the auto
smooth was applied (at the center of the shutter time) with number of vertices
prior to the auto smooth applied. This caused false-positive consideration of a
mesh as changing topology.

Now we do autosplit as early as possible and do it from blender side, so Cycles
does not need to re-implement splitting on it's side.
2017-01-11 16:32:57 +01:00
38b0141554 Cycles: Pass explicit subdivision type to object_to_mesh
This allows us to do some extra logic checks there based on particular
subdivision type.

Additionally avoids implicit cast of enum to bool.
2017-01-11 16:23:54 +01:00
Dalai Felinto
d97c6c36b8 Fix mem freed twice 2017-01-11 16:20:10 +01:00
2b66a17e50 Copy autosmooth mesh settings BKE_mesh_new_from_object
This way render engine can first apply all modifiers on the
new mesh and then optionally perform autosmooth face splitting
on it.
2017-01-11 16:04:39 +01:00
8576efc98a RNA: Expose autosmooth face splitting
This way render engine can request mesh to be auto-split and not
worry about implementing this functionality on it's own.

Please note that this split is to be performed prior to tessellation.
2017-01-11 15:59:32 +01:00
Dalai Felinto
051f0a0b15 _free() functions should not clear the pointer itself 2017-01-11 15:54:56 +01:00
Dalai Felinto
a80d94c289 BLI_assert fix 2017-01-11 15:54:26 +01:00
7bbb2292dc Cycles: Cleanup, whitespace around operator 2017-01-11 15:16:22 +01:00
e068d09a4b Cycles: Improve logging of cases when motion blur is disabled
Next logical step is to expose this somehow to the interface.
2017-01-11 14:34:56 +01:00
Dalai Felinto
4180ca9b92 Doversion: set selected objects for "Render Layer" 2017-01-11 12:58:54 +01:00
Dalai Felinto
6d68195a9b Doversion: set active object for "Render Layer"
We don't do it for the other render layers (the ones converted from
SceneRenderLayer)
2017-01-11 12:58:25 +01:00
Dalai Felinto
345eb6f7cc RNA: object.select_get/set(action={'SELECT', 'DESELECT', 'TOGGLE'}) 2017-01-11 12:48:36 +01:00
Dalai Felinto
ec65bc6e76 Introduce ObjectBase rna wrapper for bpy.context.active_base 2017-01-11 11:45:41 +01:00
Dalai Felinto
b00cfb77cd Use active_object instead of active_base for edit mode enter
(prevent a crash after recent Base > ObjectBase commit)
2017-01-11 11:05:22 +01:00
Dalai Felinto
70ddef82b7 Merge remote-tracking branch 'origin/blender2.8' into render-layers 2017-01-11 09:47:30 +01:00
Dalai Felinto
77dcf0fbc5 Merge remote-tracking branch 'origin/master' into blender2.8 2017-01-11 09:44:25 +01:00
Dalai Felinto
80865bd583 Fix building with INPUT_NDOF after warning cleanup
Reported by Clément Foucault
2017-01-11 09:43:40 +01:00
8c3a98e583 Added Matcap HSV variation (only Hue exposed). 2017-01-11 01:49:03 +01:00
e041bf7579 Cleanup: Use more meaningful constants other than 0 2017-01-11 00:27:53 +01:00
89d99b6b77 Added matcap rotation 2017-01-10 23:52:13 +01:00
1dbaf0dbcc Add mid_v3_v3_array function and remove redundant functions
Other than implementing a `mid_v3_v3_array` function, this removes
`cent_tri_v3` and `cent_quad_v3` in favor of `mid_v3_v3v3v3` and
`mid_v3_v3v3v3v3` respectively.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D2459
2017-01-10 19:58:34 -02:00
1ceeac2cab Use overall matcap colors as AO color avoiding completelly dark areas. 2017-01-10 22:03:57 +01:00
Dalai Felinto
d89274e83a Merge remote-tracking branch 'origin/blender2.8' into render-layers 2017-01-10 18:37:06 +01:00
Dalai Felinto
9533eb4908 Fix warnings (mostly unused arguments) 2017-01-10 18:36:00 +01:00
Dalai Felinto
a771249d7d Add new objects and some Base > ObjectBase convertion
New objects are properly added to the correct collection, and are synced
into the correct collections.
2017-01-10 17:56:31 +01:00
c8162c5a2c Added SSAO to give cavity / Edge highlight effect. 2017-01-10 17:33:30 +01:00
da026249ab UI Layout: fix some cases mixing fixed and expandable sizes
When layout has only small buttons (buttons with icon and without label)
its size should be fixed. Code was modified to be able to add a new UI_ITEM_MIN
flag which indicates that the layout has only small fixed-width buttons.

Patch by @raa, with minor style edits by @mont29.

Reviewers: Severin, mont29

Reviewed By: mont29

Tags: #bf_blender, #user_interface

Differential Revision: https://developer.blender.org/D2423
2017-01-10 16:24:22 +01:00
Dalai Felinto
143c869bd0 Fix selected_objects iterator 2017-01-10 16:17:22 +01:00
Dalai Felinto
33ee18ad6f rename ob_base > base, it will simplify further refactors 2017-01-10 16:17:22 +01:00
Dalai Felinto
5ed5ed59c3 Fix T49861: Interlace stereo drawing
This does not address stapling shader in 2.8, though the solution can be
similar (own shader, not polutting interlace shader).

part of T49043

Reviewers: merwin

Differential Revision: https://developer.blender.org/D2440
2017-01-09 17:58:13 +01:00
Dalai Felinto
d16bfecde1 Removing Bases from clay.c and other fixes
Listbase was used wrongly in draw_manager, using LinkData elements now
2017-01-09 17:52:06 +01:00
Dalai Felinto
2ad2b23911 Merge remote-tracking branch 'origin/render-layers' into clay-engine 2017-01-09 16:35:25 +01:00
Dalai Felinto
052b45ac2a Fixup for iterator
(this is a placeholder anyways, what we really need is DEG_OBJECT_ITER()
2017-01-09 16:33:42 +01:00
Dalai Felinto
551852f4ca Adding FOREACH_OBJECT iterator 2017-01-09 16:17:04 +01:00
c9c0d6c24f Add properties to clay material (not exposed yet) 2017-01-09 15:06:17 +01:00
d5cf90f59f Cleanup: Strict CLang warning in Smoke module 2017-01-09 13:12:43 +01:00
bb88c7af81 Cleanup: Indentation 2017-01-09 13:11:42 +01:00
1b75cd5aa8 Cleanup: Don't use C++ comments style in C code 2017-01-09 12:35:08 +01:00
378afc9830 Fix for T50373: lattices should not be able to get subsurf modifiers
Reviewers: mont29

Reviewed By: mont29

Subscribers: sergey

Differential Revision: https://developer.blender.org/D2449
2017-01-09 12:24:34 +01:00
9c756162ae Fix T50385: Deadlock in BKE_libblock_remap_locked.
Am pretty sure node update should not touch to Main database like that,
but for now let's allow it, I guess the hack is needed for things like
Sverchok. ;)
2017-01-09 10:43:23 +01:00
e713009e9b Fix: Audio plays back incorrectly after rendering to a video file
D2365
2017-01-06 18:18:20 +01:00
Dalai Felinto
1020914980 unittest: check context overriden passed to operator 2017-01-06 18:13:32 +01:00
Dalai Felinto
9f333a0889 unittest: use proper setUpModule class method() 2017-01-06 18:01:08 +01:00
Dalai Felinto
7e57905385 unittest: use assertEqual instead of assertTrue
(thanks to Sybren Stuvel)
2017-01-06 16:37:15 +01:00
ca4618bdbf Apply changes GPU_texture change. 2017-01-06 14:39:34 +01:00
2cf79f41fe Modifications to GPU_texture:
-Remove NPOT check as it should be supported by default with OGL 3.3
-All custom texture creation follow the same path now
-Now explicit texture format is required when creating a custom texture (Non RGBA8)
-Support for arrays of textures
2017-01-06 14:38:36 +01:00
Dalai Felinto
6933bb4e9a Fixup for bpy.context.scene_collection 2017-01-06 14:31:48 +01:00
62604c5c20 Make button span the full width of the properties editor 2017-01-05 15:41:14 -05:00
Dalai Felinto
b5d41b1d71 RNA: bpy.context.scene_collection
We will need this for UI eventually, and now I need this to update the
Python add object routine.
2017-01-05 18:25:29 +01:00
Dalai Felinto
71e5e87f01 Unittest debug options, set context via override and bpy.context.scene_collection
For some reason ID is not being passed when we get SceneCollection from
bpy.context. This test fails in that case.
2017-01-05 18:24:28 +01:00
5333b2aa00 (Clay) Free memory + lots of renaming/reorganizing
Signed-off-by: Clément Foucault <foucault.clem@gmail.com>
2017-01-05 16:13:20 +01:00
c990364559 Merge remote-tracking branch 'origin/render-layers' into clay-engine 2017-01-05 11:28:28 +01:00
624f3c254f (Clay) Added Render settings:
- Default clay settings inside Scene RNA
- Material clay settings RNA is here and will be used once we can render multiple meshes
2017-01-05 11:28:11 +01:00
b2159b94bc Remove instances of old vector icons
I checked and this makes consistent with other area of blender.
See https://developer.blender.org/rBf86eccb1ca2388ae203df2a59285a2f2fb9b6aa8#131061
2017-01-04 23:24:43 -05:00
Julian Eisel
e42e1769b3 Merge branch 'master' into blender2.8
Conflicts:
	source/blender/editors/gpencil/drawgpencil.c
2017-01-05 00:31:15 +01:00
Julian Eisel
82b9e1e312 Show 'Manipulate Center Points' in weight paint mode
If the active object is in weight paint mode, but some armatures in pose mode, 'manipulate center points' still affects the transformation. See bd2034a749.

Also removed redundant check, we basically did the same check for paint modes twice.
2017-01-05 00:14:25 +01:00
Dalai Felinto
d80372c9f4 handle objects removal only on preprocess 2017-01-04 18:34:49 +01:00
Dalai Felinto
7bd56f207d Merge remote-tracking branch 'origin/blender2.8' into render-layers 2017-01-04 18:27:14 +01:00
Dalai Felinto
ac6019e079 unittest: del via operator fixup 2017-01-04 18:26:13 +01:00
Dalai Felinto
ac80793592 Include object unlinking in library_remap preprocessing 2017-01-04 18:19:51 +01:00
Dalai Felinto
f8dd25afb8 remove objects from collections when ED_base_object_free_and_unlink 2017-01-04 18:04:32 +01:00
b86042f21a Dynamic Paint: Fix random pixel flooding by absolute brush with spread.
If a very low wetness absolute alpha brush is used with spread and
drying effects enabled, some pixels will rapidly accumulate paint.
This happens because paint drying code applies a minimal wetness
threshold that causes the paint to instantly dry out.

Specifically, every frame the brush adds paint at the specified
absolute alpha and wetness set to the minimal threshold, spread
drops it below threshold, and finally drying moves all paint to
the dry layer. This drastically accelerates the rate of flow of
paint into the affected pixels.

Fortunately, the reason paint spread actually ends up decreasing
wetness turns out to be a simple floating point precision problem,
which can be easily fixed by restructuring the affected expression.
2017-01-04 19:44:29 +03:00
a9163f7d22 Fix (IRC reported) bad handling of Text data-block user count.
Reported on IRC by dfelinto, thanks.

Root of the issue was that opening a new text file would create
datablock with one user, when Text editor is actually a 'user one' user.

This was leaving Text datablocks in inconsitent user count, and
generating asserts in BKE_library area.

Also changed a weird piece of code related to that extra user thing in
main remapping func.
2017-01-04 14:07:38 +01:00
0c4776280d More work on Clay engine:
- Calculate normals with dfdy while waiting for a proper way to draw mesh normals.
- Added initial support for 2d texture arrays.
- Better API naming.
- Generate Matcap texture arrays and draw with it.
2017-01-04 11:01:14 +01:00
351a9d084f Fix T50369: Objects can't be deleted from scene when using "link group objects to scene"
Main issue here was that in old usercount system 'user_real' did simply
not allow that kind of thing to work. With new pait of 'USER_EXTRA'
tags, it becomes possible to handle the case correctly, by merely refining
checks about indirectly use objects whene removing them from a scene.

Incidently, found another related bug, 'link group objects to scene' was not
incrementing objects' usercount - bad, very very bad!
2017-01-04 10:28:59 +01:00
Dalai Felinto
c0c48cdacc Fix T50350: Quick Explode time frame problem
The settings.frame_start rna was clamping frame start to frame end when frame start was bigger than frame end.
The fix is simply to set frame end first
2017-01-04 10:13:28 +01:00
Dalai Felinto
3bdd555159 Massive fixup on BLI_iterator and the iterators using it 2017-01-03 18:21:15 +01:00
Dalai Felinto
36c34b96b3 From review: handle post processing of objects after they are removed 2017-01-03 16:46:05 +01:00
Dalai Felinto
caed6aad4b unittest: object delete 2017-01-03 16:42:57 +01:00
3a1b1100af Revert "Remove double menu entries"
This reverts commit e2d7efc950.
2017-01-03 10:34:05 -05:00
ff0221f5d8 Fix implicit size_t to int conversion.
Seems like it was erroring on some buildbots...
2017-01-03 15:30:59 +01:00
Dalai Felinto
b89b1b58b2 From review: proper handle of library_query 2017-01-03 11:48:42 +01:00
fe0df0a972 Beginning Clay Viewport Engine :
- Added temporary draw_mesh function to render edit mesh
- DRW_draw_batch_list allows to render a list of objects with optimal state change
- All viewport rendering is done offscreen for the moment

Signed-off-by: Clément Foucault <foucault.clem@gmail.com>
2017-01-03 10:44:24 +01:00
65582e75e3 Fix: NLA "Strip Time" setting cannot be edited
This is a hacky fix for a regression introduced sometime after 2.76.
The "Strip Time" setting on NLA Strips could not be edited without the
value immediately jumping back to the current FCurve value (or 0.0 if no
keyframes existed); even enabling autokey wouldn't let you key the property.

Until we have proper overrides (that only lose their values on frame change),
it's best that this setting is editable, even if it does mean it you have to
manually change the frame to see the updated values.
2017-01-03 11:42:50 +13:00
Dalai Felinto
e758b9d869 unittest: fixup 2017-01-02 14:22:46 +01:00
Dalai Felinto
329879239e Merge remote-tracking branch 'origin/master' into blender2.8
I'm deliberately ignoring/reverting rB070f22c4 which in turns means T49861 is happening on 2.8
2017-01-02 11:47:26 +01:00
8f1f3a0d46 GPencil: Per-layer option to always show onion skinning
Sometimes it can be useful to be able to keep onion skins visible in the
OpenGL renders and/or when doing animation playback. In particular, there
are two use cases where this is quite useful:
 1) For creating a cheap motion-blur effect, especially when the before/after
    values are also animated.
 2) If you've animated a shot with onion skinning enabled, the poses may end
    up looking odd if the ghosts are not shown (as you may have been accounting
    for the ghosts when making the compositions).

This option can be found as the small "camera" toggle between the "Use Onion Skinning"
and "Use Custom Colors" options.
2017-01-02 23:32:13 +13:00
3c74071634 Fix: Passed wrong last argument to function 2017-01-02 23:32:13 +13:00
Dalai Felinto
d78f51a4c2 Merge remote-tracking branch 'origin/master' into blender2.8 2017-01-02 11:31:03 +01:00
Dalai Felinto
070f22c440 Fix T49861: Interlace stereo is broken in 2.78
This is a regression introduced in rB5bd9e832

It looks more like a hack than a proper fix, but the shader logic
changed a lot for blender2.8, so I would rather do the elegant fix
there, while leaving master working.

If we ever do a 2.78b (or 2.79) this should get in.
2017-01-02 11:30:17 +01:00
13174df534 API: Fix rst syntax 2017-01-02 00:33:15 -05:00
42e4b0955c API: Fix redirect in bgl page 2017-01-02 00:24:40 -05:00
143d9373e4 API: Update to modern sphinx syntax 2017-01-01 23:54:55 -05:00
32c65faeb9 Cleanup: redundant assignment in rect resize 2017-01-02 13:56:19 +11:00
911544c70c API: Fix double slashes in URLs 2017-01-01 19:53:16 -05:00
7924c84c44 Fix T50305: When adding new ID with same name as existing, Blender could generate invalid utf-8 ID name.
`check_for_dupid()` would roughly truncate existing name, without doing any utf-8 validation.
2017-01-01 02:27:03 +01:00
adadfaad88 Fix (unreported) fully broken 'sanitize utf-8' helper.
That code was a joke, letting some invalid utf8 bytes pass, returning
wrong offset for some invalid sequences, not to mention length and
pointer easily going out of sync, NULL final byte being 'forgotten' by
memcpy, etc. etc.

The miracle here is that we could survive using this for so long!
Probably because we do not use utf-8 sanitizing enough in Blender,
actually... :/
2017-01-01 02:15:42 +01:00
acbb84b021 Add BLI_string_utf8 specific test.
This test should ensure we correctly detect all invalid utf-8 sequences in a given string.

DISCLAIMER:
Do not run this with current code - you'll either laugh or cry, nearly *all* checks fail!

Based on utf-8 decoder stress-test (https://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt)
by Markus Kuhn <http://www.cl.cam.ac.uk/~mgk25/> - 2015-08-28 - CC BY 4.0
2016-12-31 16:10:20 +01:00
fb20cbe04c Fix missing particlemode context mode, after recent particle-removal revert.
This caused the particle mode tools panel to appear in object mode, where it
misses some contextual data and spews python exceptions.
2016-12-30 12:13:21 +01:00
f874aeef70 Merge branch 'master' into blender2.8
Please **DO NOT** add changes from master when it's totally uneeded!

Changes to BLI_ area most certainly shall *always* be done in master,
there is absolutely no point in adding more diff between the two
branches than needed, will only makes merging more cumbersome!

Conflicts:
	CMakeLists.txt
	source/blender/blenlib/intern/math_vector_inline.c
2016-12-29 20:05:22 +01:00
bf7d7bc323 Add new operator, ED_OT_undo_redo, to allow py tools to trigger that action.
Patch D2430 by @raa, thanks.
2016-12-29 12:38:20 +01:00
934b3f3682 Fix T50334: Also select indirectly imported objects when linking/appending.
Since we create a base and instantiate them, they become directly
linked, so makes sense to also select them if requested.
2016-12-29 12:17:23 +01:00
7ba2356a53 Freestyle: fix typo in console message.
Patch D2270 by Anthony Edlin (@krash), thanks.
2016-12-29 10:34:59 +01:00
6bd245bb53 Edits to user prefs NDOF UI
Small changes:

- Remove "NDOF" from each setting
- Change tooltip for deadzone
- Unrelated typo in cmake comment

Reviewers: merwin, Severin

Reviewed By: merwin, Severin

Tags: #bf_blender, #user_interface

Differential Revision: https://developer.blender.org/D2319
2016-12-29 01:09:11 -05:00
3d243eb710 Fix T49848: bevel of spiral gets bigger and bigger widths.
This is the same issue as was fixed with T39486: the adjustment pass
that tries to equalize different widths at either end of an edge
sometimes causes the widths to get bigger and bigger.
The previous fix was to let "clamp_overlap" do double duty as a way
to limit this behavior. But clearly this is undiscoverable, as the
current bug report shows.  So I put in an "auto-limiting" mode that
detects when adjustments are going crazy and then acts as if
clamp_overlap were set.
The reason we can't always act as if clamp_overlap is set is that
certain models (e.g., Bent_test in regression tests) look bad if
that is enabled.
2016-12-28 13:55:19 -05:00
6ecab6dd8e Revert particle system and point cache removal in blender2.8 branch.
This reverts commit 5aa19be912 and b4a721af69.

Due to postponement of particle system rewrite it was decided to put particle code
back into the 2.8 branch for the time being.
2016-12-28 17:30:58 +01:00
2412e67ef8 UI: Make icon-only buttons for enum items with empty label.
Patch D2420 by @raa, thanks.
2016-12-28 15:07:18 +01:00
a522469940 Various UI message and API doc tweaks and fixes.
Mostly from patch D2256 by Aaron Carlisle (@Blendify), thanks!
2016-12-28 14:37:08 +01:00
11ae06b0b7 Update manual links in 'add object' py template.
Patch D2328 by @blendify, thanks.
2016-12-28 14:25:31 +01:00
45d0231a24 Minor UI message fix.
Based on D2436 by @blendify, thanks.
2016-12-28 14:17:15 +01:00
cabd2dceca Tweak error message when external image editor launching fails.
Include idea that Blender may fail to launch it even if path is correct,
in some cases (dear Windows...).

Based on idea from @lijenstina and @blendify (D2349), thanks.
2016-12-28 14:11:47 +01:00
b1c6ddb107 Also apply similar fixes to .keyframe_delete()
- T49816
2016-12-29 01:12:25 +13:00
3cbe95f683 Fix T49816: Keyframing NLA Strip influence from Python set keyframes in the wrong place 2016-12-29 01:12:24 +13:00
c5338fd162 Fix T50184: Grease Pencil Layer synchronization between Dope Sheet and Properties panel 2016-12-29 01:12:23 +13:00
7f262acb92 Fix T49479: Freestyle inconsistent line drawing with large geometry dimension.
Ray-plane intersection routine GeomUtils::intersectRayPlane() was used with an
unnormalized direction vector as input.
2016-12-28 18:09:35 +09:00
6559ab2d51 3D View roll & orbit were scaling view-quat length
Over time roll and orbit would scale the quaternion
which is documented as unit length.

In practice any errors would be subtle,
but better normalize as other operators do.
2016-12-28 18:10:34 +11:00
d5edaac42d Comments: mul_project_m4_v3_zfac 2016-12-28 15:49:39 +11:00
d874b40a55 Fix T50240: Rendering crashes when synced to JACK Transport
Disabling synchronization while rendering.
Using G.is_rendering as suggested by bastien. ;-)
2016-12-27 20:47:01 +01:00
752a783fa4 Fix T50305: Blender truncates a long multibyte character object's name to an invalid utf-8 string.
Add logic in RNA to ensure we pass valid utf8 string to BKE ID new functions...
2016-12-27 16:39:19 +01:00
c1e3041051 Comments: hints for perspective functions
Note which GL functions these are equivalent to.
2016-12-27 15:30:11 +11:00
41ec1adb03 Correct bad cast, unused var warning 2016-12-27 15:29:55 +11:00
3a9c490531 [MSVC] Fix test for C++11 support for vc2015/2017 based on D2432 by Ulysse Martin (youle) 2016-12-24 10:37:10 -07:00
Dalai Felinto
2fa175eb8a Revert "Make sure new objects go to the correct (active) collection"
This reverts commit c51a32554e.
2016-12-23 19:25:29 +01:00
Dalai Felinto
2c55b4cbc8 Revert "Fix warning"
This reverts commit 280da49595.
2016-12-23 19:25:21 +01:00
Dalai Felinto
66bc0616fc unittest: object_add 2016-12-23 18:17:06 +01:00
Dalai Felinto
eae6e02759 unittest: active_collection_index 2016-12-23 17:42:35 +01:00
Dalai Felinto
7ba2a5feb5 bpy.context.render_layer 2016-12-23 17:04:10 +01:00
Dalai Felinto
280da49595 Fix warning 2016-12-23 15:59:33 +01:00
Dalai Felinto
ee6214dc80 Merge remote-tracking branch 'origin/blender2.8' into render-layers
Include manual changes to accomodate new do_versions_after_liblink
2016-12-23 15:56:13 +01:00
Dalai Felinto
605263177b Merge remote-tracking branch 'origin/master' into blender2.8 2016-12-23 15:36:16 +01:00
Dalai Felinto
c51a32554e Make sure new objects go to the correct (active) collection 2016-12-23 15:34:36 +01:00
b47c912f4b Fix (unreported) crash in 'Match movie length operator' in case of lost video texture file 2016-12-23 16:51:26 +03:00
d0335796a8 Readfile: Resurrect do_versions_after_liblink.
Basic idea is to store fileversion in Library datablock, and split again
Main by libraries after lib linking, do_versions_after_liblink on
those separated Mains, and merge again.

This allows to still have correct versions for each data-block in that
second do_versions step.

Note that this is not used currently in master (might be soon, though),
but is needed for 2.8 work.
2016-12-23 12:54:51 +01:00
8db2f72997 Fix (unreported) --threads option no more respected by main task scheduler.
Main scheduler would be created way before `-t` argument would be
parsed, since it was on forth pass! Moved it to first pass of argparse,
that kind of stuff should be initialized asap on startup.
2016-12-22 22:00:48 +01:00
Dalai Felinto
95e183b7f4 unittest touch ups 2016-12-22 12:14:46 +01:00
Dalai Felinto
a9cc4d0c5c render_layer.collections.link/unlink() 2016-12-22 12:14:32 +01:00
Julian Eisel
5e31e07230 Fix wrong return type in blenderplayer stubs 2016-12-22 02:35:34 +01:00
Dalai Felinto
4d998fb373 unittest: new layer, layer_collection_link/unlink 2016-12-21 19:14:44 +01:00
Dalai Felinto
5e79ebce13 Fixup for rna_SceneCollection_remove 2016-12-21 18:44:43 +01:00
Dalai Felinto
52c4adc4df Debug UI revamp 2016-12-21 18:44:42 +01:00
Dalai Felinto
c8978b160d unittest: syncing when unlinking a collection 2016-12-21 18:44:42 +01:00
Dalai Felinto
5c22ade95a Syncing: update layercollection tree when an object is unlinked
Note: filtering is not implemented/fully considered yet
2016-12-21 18:05:22 +01:00
Dalai Felinto
d550554d0c unittest: make tests more granular 2016-12-21 17:41:50 +01:00
Dalai Felinto
18ee712bf1 Layers: unittest to cover unlinking of objects 2016-12-21 17:41:50 +01:00
Dalai Felinto
a6cf5cfe9c Syncing: an object added to a scenecollection
Also changed the ObjectBase->refcount logic a bit, to simplify
further implementations of syncing.
2016-12-21 17:41:50 +01:00
Dalai Felinto
0abcddf470 Syncing: update layercollection tree when a new scenecollection is added 2016-12-21 12:27:50 +01:00
Dalai Felinto
1abef41657 Add nesting collections into unittest 2016-12-20 16:27:09 +01:00
Dalai Felinto
51984897d8 Temporary UI for layer/collections (for debug/testing) 2016-12-20 15:59:13 +01:00
Dalai Felinto
a508029fbc Make hide/hide_select icons dynamic 2016-12-20 15:37:23 +01:00
5fb85ef2c2 Fix strict compiler warning in generated C++ RNA 2016-12-20 12:29:41 +01:00
544f6113f8 OpensSubdiv: Cleanup, unused argument 2016-12-20 12:29:41 +01:00
1c34a7f4eb Libmv: Fix missing virtual destructor in frame access sub-class
This is undefined behavior in C++ and Clang was complaining a lot
about this.
2016-12-20 12:29:41 +01:00
Dalai Felinto
619cbca39f From review: "doxygen"
I do not compile doxygen (assuming it is compiled, I do not even know). But it does not hurt to add the extra * everywhere
2016-12-20 11:21:10 +01:00
4d5cd638ff String drawing function for the "simdebug" utilities.
Simple string drawing API for debug drawing, in addition to basic primitives.
2016-12-20 11:02:40 +01:00
Dalai Felinto
72bd463127 Merge remote-tracking branch 'origin/blender2.8' into render-layers 2016-12-20 10:58:10 +01:00
Dalai Felinto
42bb135480 Fresh morning fixup of iterator logics
(and fix unfreed memory)
2016-12-20 10:42:26 +01:00
76c4f0ec6c Fix parameter error (changes by Mike Erwin) 2016-12-19 22:36:56 +01:00
Dalai Felinto
9d2b6b56ac Fixup on BKE_scene_objects_Iterator_next 2016-12-19 18:13:47 +01:00
Dalai Felinto
d4cebc998b Use FOREACH_OBJECT_FLAG in more places 2016-12-19 17:57:45 +01:00
Dalai Felinto
60aa0b5b15 Reworked logic of iterators
otherwise I could not get different iterators based on a flag (SELECT), which is used everywhere in object_relations.c
The alternative would be to split every function in object_relations.c into _all, and _selected
2016-12-19 17:57:05 +01:00
bd42987399 Fix (unreported) linked datablocks going through do_versions several times.
When linking data-blocks from same library in several steps, the already
linked data-blocks of same lib would go again through versionning code...

Note: only fixed for libraries, I can't imagine how this could happen
with local data...
2016-12-19 16:31:06 +01:00
Dalai Felinto
f59b6ff410 Using an iterator to go over objects, and use this for library_query
This is not the ideal iterator (it loops over the scene collection tree 3x).
One solution (I want to discuss with Bastien Montagne @mont29) is whether to store the *parent of a SceneCollection to help with that. That would speed things up, and cost less memory.

We do not even need to store it in the file, since it can be re-generated at read time
2016-12-19 14:11:58 +01:00
e30d94bb3b Cleanup: rename paramenter to right name 2016-12-19 12:28:51 +01:00
Dalai Felinto
57a5f2ef44 Iterator util function 2016-12-19 10:49:11 +01:00
3af98b4c04 Merge branch 'master' into blender2.8
Conflicts:
	intern/cycles/blender/CMakeLists.txt
	source/blender/editors/gpencil/drawgpencil.c
	source/blender/editors/physics/physics_ops.c
2016-12-17 13:07:00 +01:00
6c3d8fbeb3 Cleanup: trackball logic
Used SQRT2 and SQRT1_2 to calculate the same value,
harmless but a little confusing, set once and check instead.
2016-12-17 19:14:02 +11:00
2e15618f49 Fix T50216: Missing checks caused data transfer segfault
Data transfer was not checking if the required geometry existed, thus
causing a segfault when it didn't. This adds the required checks, and
reports errors if geometry is missing.

This also replaces instances of the words "polygon" and "loop" in error
messages with "face" and "corner" respectively, to be consistent with
the rest of the existing UI.

Reviewed By: mont29

Differential Revision: http://developer.blender.org/D2410
2016-12-16 23:53:08 -02:00
535298eea5 Fix T50264: Stroke is not painted when append Grease Pencil block
When append a datablock the default brushes were not created and only
were created when draw new strokes. Now the default brushes are created
when draw strokes if necessary.
2016-12-16 22:56:43 +01:00
Dalai Felinto
a3fd4274cf From review: curly brackets reinforcement
(even though the other related functions are not following this rule ... How I miss a code refactor dev!)
2016-12-16 16:04:47 +01:00
Dalai Felinto
0da8957bc5 From review: move nodetree syncing of layers to util function 2016-12-16 16:03:00 +01:00
Dalai Felinto
75b7a25014 From review: do_versions_after_linking skipped on undo 2016-12-16 15:53:23 +01:00
Dalai Felinto
29961ad597 From review: blo_do_versions_280_after_linking > blo_do_versions_after_linking_280 2016-12-16 15:51:17 +01:00
Dalai Felinto
3f9432b76a From review: use typedef for callbacks 2016-12-16 15:50:08 +01:00
Dalai Felinto
59fbc6db8d Merge remote-tracking branch 'origin/blender2.8' into render-layers 2016-12-16 14:46:17 +01:00
Julian Eisel
4df75e536a Make Shift+LMB on transform manipulator configurable
It's now possible to change the shortcut that enables planar transformation with the transform manipulators (shift+LMB on axis).

This actually fixes the workaround added in rB20681f49801fd. Thing is that we needed to allow using the manipulators, even if a modifier key is held so things like snapping work right away. That's why normal LMB behavior uses KM_ANY. However, event handling would always execute the KM_ANY keymap handler because it's iterated over first. Simply solved this by registering the KM_SHIFT keymap item first, so it has priority over the KM_ANY one.
2016-12-16 02:49:53 +01:00
Julian Eisel
524ab96245 Fix drawing enum property with icon only flag
Enum properties with icon only flag should use minimum/fixed width in expanded layouts (alignment=UI_LAYOUT_ALIGN_EXPAND).

Differential Revision: https://developer.blender.org/D2415 by @raa (only made some really minor corrections)
2016-12-15 23:43:17 +01:00
e2d7efc950 Remove double menu entries
These were already present in the "Select" menu.
2016-12-15 22:12:29 +01:00
bd3de93557 Gtest: Fix/workaround MSVC complains about use of struct with alignment 2016-12-15 17:53:57 +01:00
26bb0ee464 Fix Playerstubs tm 2016-12-15 15:47:00 +01:00
12e1732f72 Layer Weight node support for Blender Internal Render 2016-12-15 15:03:28 +03:00
1bfe359802 OpenGL fixes
- mixing of old & new APIs
- vertex format mismatch
2016-12-14 02:43:26 -05:00
1e21b8dc1b OpenGL: another way to set uniform theme color 2016-12-13 16:45:59 -05:00
0fa887ae35 OpenGL: finish area action zone todo
Replace outlined circle (24 vertices) with a point sprite (1 vertex).

Replace one todo with another todo.
2016-12-13 15:43:13 -05:00
3b98b44223 small fix for previous commit 2016-12-13 15:03:58 -05:00
fe59296361 OpenGL: new immediate mode in area.c
D2361 by @punya, part of T49043
2016-12-13 14:51:39 -05:00
Dalai Felinto
c75e7516c3 Merge remote-tracking branch 'origin/blender2.8' into render-layers
plus manual rna fixup
2016-12-13 13:03:57 +01:00
9be6d5ff18 Merge branch 'master' into blender2.8
Conflicts:
	source/blender/blenkernel/intern/depsgraph.c
	source/blender/blenloader/intern/versioning_270.c
	source/blender/depsgraph/intern/builder/deg_builder_relations.cc
	source/blender/makesrna/intern/rna_main_api.c
	source/blender/makesrna/intern/rna_particle.c
2016-12-12 16:17:57 +01:00
Dalai Felinto
b7a42fe69f unittest: test cleanup 2016-12-12 13:08:58 +01:00
Dalai Felinto
3839afe03d Layers: change the API so that we can run a function on every object of the scene
use tag to make sure we call each object only once
2016-12-12 12:56:40 +01:00
Dalai Felinto
c96c3c8bbe Scene copy (full or link) working for layers
I'm using the flags in the objects instead of bases.
2016-12-12 12:12:42 +01:00
Dalai Felinto
ef6a35b0af scenelayer: unittest more granular, for debugging 2016-12-12 11:52:58 +01:00
Julian Eisel
54528079e3 Correction to previous commit
Accidentally included some changes from workspaces branch.
2016-12-08 23:27:56 +01:00
Julian Eisel
35c18e4871 Move screen drawing functions into new screen_draw.c 2016-12-08 23:17:45 +01:00
Dalai Felinto
df8d4299a2 Unittest scene copy 2016-12-07 18:19:51 +01:00
Dalai Felinto
6fdd6f7d7c Unitest: doversion, write and read test for layers 2016-12-07 15:37:19 +01:00
Dalai Felinto
dddf38dc42 Fix new scenes should have a default renderlayer 2016-12-06 19:17:12 +01:00
Dalai Felinto
3c3c818d1b Fix all unfreed memory 2016-12-06 19:13:02 +01:00
Dalai Felinto
a2e81fa2e9 Final cleanup of read/write to have things in the right order (pure cosmetic) 2016-12-06 16:37:13 +01:00
Dalai Felinto
866b3268a5 Fix write of nested LayerCollections (and DNA cleanup) 2016-12-06 16:20:36 +01:00
Dalai Felinto
97109b654e Fix stupidest mistake (objects > filter_objects) 2016-12-06 15:57:04 +01:00
Dalai Felinto
6e6750a06a Fixing writing objects 2016-12-06 14:48:49 +01:00
Dalai Felinto
8146a4498a Fix writing nested scene collections 2016-12-06 14:16:42 +01:00
Dalai Felinto
3acb83c6f4 Use pointer for master collection
This allows this pointer to be used, otherwise the pointer is not written
2016-12-05 21:52:38 +01:00
Dalai Felinto
d0ef44218e Rename: collections > scene/layer_collections 2016-12-05 20:43:02 +01:00
Dalai Felinto
4ad8789a38 Read/Write, first take 2016-12-05 20:20:17 +01:00
Dalai Felinto
1db50e9a88 Fix objects not disappearing after unlinking collection 2016-12-05 14:58:26 +01:00
47c6047873 3D cursor & mini axis for modern viewport
Shuffle existing code, hook it up to the new (& old) viewport.

Also the 3D mouse rotation guide for NEW viewport only. Minor feature not worth enabling for legacy 3D view.
2016-12-05 02:50:28 -05:00
6ab42eb0bd OpenGL: delete bl_debug_draw
Eliminating this chunk of legacy GL as part of T49043.

We can introduce some sort of "debug plate" to fill this need in the future.
2016-12-04 20:34:44 -05:00
5de33c3b64 cleanup: C99 for view3d_draw
Mostly for clarity & to declare things close to where they are used.

I'm getting ready to do substantial work in these files.
2016-12-04 20:11:12 -05:00
Dalai Felinto
87330b4729 RNA: layer.objects.selected
Instead of exposing the base I think this may be nicer for the API. We still need a way to change select for a layer though (expose the ObjectBase perhaps? :/)
2016-12-03 02:44:06 +01:00
Dalai Felinto
2b09fb3f30 layer.engine 2016-12-03 02:23:44 +01:00
Dalai Felinto
d085e62693 layer.objects.active 2016-12-03 02:23:44 +01:00
Dalai Felinto
89d20732a1 layer.active_collection
This one is straight from the "layers" branch. I nailed it quite nicely there, so it was simply a matter of bringing it over :)
2016-12-03 02:23:44 +01:00
Dalai Felinto
bc2321025b Shuffle code around to re-order functions 2016-12-03 02:23:43 +01:00
Dalai Felinto
52fdf5d06c layer.objects 2016-12-03 02:23:43 +01:00
Dalai Felinto
63780823a7 DNA documentation 2016-12-03 00:33:03 +01:00
Dalai Felinto
f304e2e273 BKE_collection_remove: (also first of five of the syncing functions) 2016-12-02 23:57:14 +01:00
Dalai Felinto
84d94fc06f RNA layer collections 2016-12-02 22:57:48 +01:00
Dalai Felinto
25f1e97408 Fixup for new layers 2016-12-02 22:16:14 +01:00
Dalai Felinto
d2b91a1c7c Rename CollectionBase > LayerCollection 2016-12-02 18:31:17 +01:00
Dalai Felinto
3c65f2f542 More RNA: objects, objects_filter (for SceneCollection), .new, remove 2016-12-02 17:50:53 +01:00
Dalai Felinto
b4799b23ec RNA (start), and some refactor (scene.main_collection)
Instead of storing a libstbase in scene, we simply store a collection, the api (RNA) is much more clear now
2016-12-02 16:29:10 +01:00
Dalai Felinto
91d7c345d4 Rename Collection > SceneCollection
We may want to re-use part of this struct (or concept) for groups and armatures. But filter is something specific to SceneCollections, so may as well keep it in a separate struct, and re-evaluate that once/if we get to it.
2016-12-02 12:43:08 +01:00
Dalai Felinto
bc66ca246c DNA fixups 2016-12-02 11:33:43 +01:00
7458a022aa OpenGL: cleanup function parameters & state
glDepthMask takes GLenum
glLineWidth & PointSize take float
glCullFace has no effect when GL_CULL_FACE disabled
2016-12-01 18:18:07 -05:00
Dalai Felinto
477fc97bd5 Renaming RenderLayer > SceneLayer
RenderLayer was the struct for RenderResult, better not to clash namespace here. For the Python API we still stick to scene.render_layers
2016-12-01 19:13:40 +01:00
Julian Eisel
52ec962516 UI: Previews for screen layouts
Basically all this does is drawing layout previews into the opened layout search menu.
https://youtu.be/RHYWtZP7pyA

The previews are drawn using offscreen rendering so they can't use multi-threading (yet!). But that shouldn't be an issue since only a handful of previews are drawn at the same time. Normally we only need to redraw the preview if a screen layout was changed. Would be nice if PreviewImage could store if it supports threaded rendering.
Previews are saved in files, might be useful if you later want to support appending layouts.
Adds a new file screen_draw.c.
2016-12-01 17:19:58 +01:00
4ff4dbc0ab Immediate mode replacement for compositor node backdrop elements.
Part of T49043.
2016-12-01 17:08:29 +01:00
ff2a74906a Merge branch 'master' into blender2.8 2016-12-01 10:29:46 +01:00
Dalai Felinto
58acb05061 Add description for the functions 2016-11-30 13:04:09 +01:00
Dalai Felinto
cb11ab9b09 More versioning, and more DNA 2016-11-30 12:39:55 +01:00
Dalai Felinto
8d55fe9899 Start of versioning and more work 2016-11-29 18:24:00 +01:00
Dalai Felinto
dc3154b29f New DNA for layers 2016-11-29 15:23:26 +01:00
Dalai Felinto
34520c0ffc Barebones for dna files 2016-11-29 15:15:51 +01:00
73c1c92c0e Fix C++11 building on MSVC 2015
Newest 2017 not yet supported because i don't know its version symbol...
2016-11-29 02:35:46 -05:00
a76f1a7449 Default to C++11 for all compilers (2.8)
This fixes multiple problems on latest Mac OS + Xcode. Hopefully does not cause any on other platforms.

The Xcode detection logic could use further cleanup. It's checking several old versions that are unsupported for Blender 2.8+ development.
2016-11-29 01:01:38 -05:00
8d4421b0fc DerivedMeshes clean up their draw-batch caches
No more "Not freed memory blocks"!

This code was almost ready 1 month ago, waiting for other pieces to fall into place.
2016-11-29 00:26:21 -05:00
9f35495a26 Gawain: batch mode uses buffer ID funcs
The _discard functions now free their resources! These were waiting on thread-safe ID management, which we now have.
2016-11-29 00:12:50 -05:00
4af42f06c3 Gawain: immediate mode uses buffer ID funcs
These functions are called very infrequently.
2016-11-29 00:08:07 -05:00
328a47fa2c Gawain: manage GL buffer IDs in a thread-safe way
Needed because deps graph can destroy objects from any thread. We ran into the same problem & solved it in GPU_buffers.

Implemented in C++11 since it provides the needed machinery. The interface is in C like the rest of Gawain.
2016-11-29 00:03:54 -05:00
e369b85e2f Replacing UI_view2d_scrollsers_draw() to immedaite mode
Part of T49043

Reviewers: krash, merwin

Reviewed By: krash, merwin

Differential Revision: https://developer.blender.org/D2364
2016-11-28 20:14:15 -05:00
c6d6f39153 Moved UI_view2_multi_grid_draw() to Gawain
Part of T49043, to replace gl immediate calls with Gawain

Reviewers: krash, merwin

Reviewed By: krash, merwin

Tags: #bf_blender_2.8

Differential Revision: https://developer.blender.org/D2363
2016-11-28 20:11:13 -05:00
Julian Eisel
2821da5b70 Enable multi-selection editing by default (Alt-key behavior)
This means editing a property will now always affect all selected objects, bones or sequencer strips. Support for this was added in rBdfbb876d4660 but you had to hold the Alt-key to use it. The old behavior of only editing the active object will not be kept like decided in the 2.8 workflow meeting (reports comming). If you only want to edit the active object, you have to deselect others.

There are still a couple of issues to be resolved (listed below), but having it enabled by default helps testing and getting used to it and should motivate us to fix them ;)
To be fixed:
* Give users hint when edits are applied to all objects/bones/strips ("Applying to x objects") - there are ideas but we need to finalize and implement them
* Make it work better in corner cases (material editing, modifier property editing, etc)

Note: Values usually override the initial value of the object/bones/strips, except of number buttons where it depends if you enter the value (absolute override) or drag the value (add value change). This behavior is consistent with multi-button editing.
2016-11-27 16:28:56 +01:00
Julian Eisel
a796a84a43 Use const for color array arguments 2016-11-22 14:51:34 +01:00
Julian Eisel
60ce602380 Fix missing conversion of uchar color to float
Decided to just pass float [4] args, so no type conversion is needed at all.
2016-11-22 14:40:57 +01:00
559bd75766 Merge branch 'master' into blender2.8
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
	source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
	source/blender/depsgraph/intern/builder/deg_builder_relations.cc
	source/blender/editors/space_view3d/drawobject.c
2016-11-19 16:28:39 +01:00
Martijn Berger
5cbc7b6ed2 bgl do not bind parts of OpenGL that are not exposed in core profiles 2016-11-19 15:07:01 +01:00
Martijn Berger
53267d2579 convert icon_draw_texture to gawain imm mode replacements 2016-11-18 16:04:25 +01:00
e0bea34c51 fix problem from D2360
I was too eager to get patch in after a last-minute change. My bad!
2016-11-18 00:40:40 -05:00
43ed3079e2 Moved UI_view2d_grid_draw() to immediate functions
Part of T49043

Reviewers: krash, merwin

Reviewed By: krash, merwin

Differential Revision: https://developer.blender.org/D2360
2016-11-17 22:49:22 -05:00
2de882e8cb OpenGL: textview port to immediate mode -> T49043
Updated the GL calls to the new immediate mode.
I left some glcolor calls which I'm not sure wether thats right?
Part of T49043

warm regards,
Sebastian Witt

Reviewers: merwin

Reviewed By: merwin

Tags: #bf_blender_2.8

Maniphest Tasks: T49043

Differential Revision: https://developer.blender.org/D2305
2016-11-17 22:05:49 -05:00
fe73b8c29c use new enum types in glutil & imm_util 2016-11-17 16:10:53 -05:00
d915e89ec8 delete deprecated fdrawXORcirc function
Only one place used it, and that place was dead code already.
2016-11-17 15:03:55 -05:00
feccadd81b mark certain glutil functions as deprecated
These will be removed before we ship 2.8
2016-11-17 14:44:15 -05:00
86f435d6c8 Gawain: small note for future Vulkan work 2016-11-16 18:25:36 -05:00
Martijn Berger
b757e8298a Convert console_draw.c to Gawain
Reviewers: merwin

Reviewed By: merwin

Tags: #bf_blender_2.8

Differential Revision: https://developer.blender.org/D2276
2016-11-16 22:56:39 +01:00
b1f700dad3 Gawain: use PRIM_ and INDEX_ enums instead of GLenum
For a few reasons:
- separate enum sets for separate concepts
- debug with symbolic names instead of 0x4e72
- prepare for a Vulkan future
2016-11-16 16:03:15 -05:00
36ac979ee0 Gawain: use COMP_ instead of GL_ internally
Because GLenum could be ANYTHING. We use our own enum type for components.
2016-11-16 15:18:06 -05:00
7aa82e7ed2 Gawain: re-enable strict error checking in release builds
Makes it easier for new volunteers to catch errors early.
2016-11-16 12:14:55 -05:00
472e2c5acf Blender 2.8: Added immVertex2s() and immAttrib2s()
Just as mentioned in title. Need new functions for calls found in `transform.c`

T49043

Reviewers: merwin

Tags: #bf_blender_2.8

Differential Revision: https://developer.blender.org/D2358
2016-11-16 11:53:41 -05:00
Dalai Felinto
2bcb1b208a Merge remote-tracking branch 'origin/master' into blender2.8 2016-11-16 17:04:21 +01:00
930f999f6e Part of T49043: Convert drawsimdebug.c to use the new Gawain API.
This conversion is pretty straightforward.

The code for debug drawing is not great, but it does the job.
Rewriting it is for another day, if it becomes more widely used.
2016-11-16 12:18:12 +01:00
15b2a64d0a Add stdlib.h include to fix missing 'abort' prototype. 2016-11-16 11:31:35 +01:00
3b06c42616 Blender2.8 convert UI_view2d_constant_grid_draw to new immediate mode
Convert UI_view2d_constant_grid_draw to new immediate mode.

Part of T49043.

Reviewers: merwin

Reviewed By: merwin

Tags: #bf_blender_2.8

Differential Revision: https://developer.blender.org/D2298
2016-11-15 18:59:24 -05:00
edddd2c6f5 Use new immediate mode for ED_region_grid_draw
Convert ED_region_grid_draw to new immediate mode.

Part of T49043

Reviewers: merwin

Reviewed By: merwin

Tags: #bf_blender_2.8

Differential Revision: https://developer.blender.org/D2289
2016-11-15 18:37:03 -05:00
2653758adc blender 2.8: OpenGL immediate mode: anim_draw
Reviewers: merwin

Reviewed By: merwin

Maniphest Tasks: T49043

Differential Revision: https://developer.blender.org/D2353
2016-11-15 12:19:47 -05:00
b78ddd43a5 start using COMP_* instead of GL_* in viewport
Gawain can accept either enum, but its own COMP_ values are recommended.
2016-11-15 11:49:00 -05:00
093b6c9e6e blender 2.8: OpenGL immediate mode: action_draw
Updated action_draw to use imm mode.

Reviewers: merwin

Subscribers: LazyDodo

Differential Revision: https://developer.blender.org/D2351
2016-11-14 23:02:57 -05:00
665aa6a2a0 blender 2.8: Opengl: UI_draw_roundbox
all is in the title too..

Reviewers: merwin

Reviewed By: merwin

Subscribers: Blendify, Severin

Tags: #bf_blender_2.8, #opengl_gfx

Maniphest Tasks: T49043

Differential Revision: https://developer.blender.org/D2337
2016-11-14 20:27:54 -05:00
8859aa3828 OpenGL: use packed normals for fancy wireframes
Consumes much less memory (1/3 for both normals = 32 bytes less per edge). Same visual result.

We can pack normals for other draw modes to get similar savings.

Part of T49165
2016-11-13 20:27:50 -06:00
ffc26fc5a8 Gawain: add support for 10_10_10 vertex format
Most useful for packed normals, which take 1/3 the space of float32 normals.

2-bit alpha|w component is ignored for now.

Batch API can use these now, will add support to immediate mode API if desired.

Enabling on Windows first. Will enable on all platforms after we switch Blender to core profile.
2016-11-13 20:18:51 -06:00
1dbe26f76c OpenGL: simplify debug, use only newer features
Drop SciTech support & workarounds for WinCE and OpenGL ES.

AMD_debug_output is still in the code but disabled. Once I verify the newer extensions are available on all the GPU + OS combos we support we can delete this disabled code.
2016-11-12 17:18:13 -06:00
eb880f280d Gawain: strict error checking in debug builds
Not release builds. Fix 66d7f01ecc to match what I meant to do.
2016-11-11 23:53:58 -06:00
8fd510f4b8 Gawain: new enum type for vertex attrib components
Motivations:
1) GLenum is too broad; tightly-defined enum just for this is safer.
2) enable a Vulkan future

New code should use these instead of GL_FLOAT etc. When all existing code has been updated to use new enum, we can drop compatibility with GLenum values.

Early work towards 10_10_10 format, more to come soon.
2016-11-11 19:39:56 -06:00
Julian Eisel
82ba89b042 Fix T49961: Blender 2.8 Crashes on saving an image
Caused by 4811b2d356 which caused the event handler hack that is used to fire up the file browser from other operators to fail. Basically the context from before the file browser is opened gets stored and used later for executing the actual file read/write operation (in this case, saving image). This context storage is cleared when exiting an editor since 4811b2d356, which is technically correct, but causes usage of NULLed context data in this case, because the file browser is exited before the file read/write operation is executed.

For now I solved this by moving the fileselect handler to list of normal handlers, instead of modal ones. 4811b2d356 only touches list of modal handlers so we avoid the crash. Ideally we'd completely refactor how the file browser opening works to get rid of these event handler hacks.

Note that I wouldn't be suprised if this causes other regressions, but I couldn't find one so worth a try.
2016-11-10 20:34:35 +01:00
Dalai Felinto
69655a1103 Merge remote-tracking branch 'origin/master' into blender2.8 2016-11-09 14:36:59 +01:00
a0ae6d7116 OpenGL: manage built-in shaders better
As our library of built-in shaders grows, it's important to create, access, and discard them efficiently.

Lookup via GPU_shader_get_builtin is now constant time instead of linear (# of built-in shaders). This is called very often with our new immediate mode.

Creation and discard are unified.

Adding a new shader requires fewer steps.

365 lines shorter  :D
2016-11-08 22:53:59 -06:00
2b726b054e blender 2.8: OpenGL immediate mode: node_draw_preview_background
all is in the title.

Reviewers: merwin

Tags: #bf_blender_2.8, #opengl_gfx

Maniphest Tasks: T49043

Differential Revision: https://developer.blender.org/D2336
2016-11-08 11:12:29 -05:00
12bce04b2f Blender 2.8: OpenGL: new immediate mode for paint_image.c
This one is for the straight line (white with width 2.0 over a black with width 4.0) drawn when you use the gradient tool.

To test: Image editor, create / open an image, choose image paint mode and on the tool shelf: choose the Fill brush and enable "Use Gradient" for it. Then click and drag on the image.

From what I checked, calls to glLineWidth are not being removed yet, so I kept them.

Reviewers: dfelinto, Severin, merwin

Reviewed By: merwin

Tags: #bf_blender_2.8, #opengl_gfx

Maniphest Tasks: T49043

Differential Revision: https://developer.blender.org/D2312
2016-11-08 11:08:16 -05:00
f90b480f95 OpenGL: wm_operators.c uses new immediate mode
D2311 by @ianwill

This is the radial control that appears when we change the size of a brush in sculpt and vertex and texture painting modes, by pressing "f".

Also includes a new built-in shader that can be useful in other places.

Part of T49043
2016-11-08 10:55:23 -05:00
4e80bd2d6d Blender 2.8: OpenGL: new immediate mode API for screendump.c
It's the screencast cursor, tested here, compared to original, seems to be working fine.

Reviewers: dfelinto, Severin, merwin

Reviewed By: merwin

Tags: #bf_blender_2.8, #opengl_gfx

Maniphest Tasks: T49043

Differential Revision: https://developer.blender.org/D2306
2016-11-08 10:10:55 -05:00
66d7f01ecc Gawain: less error checking in release builds
Gawain does very strict runtime checking to help us catch coding errors. Final release should disable most of these checks, so I'm disabling now for all non-debug builds.

When writing Blender code that uses Gawain, always make debug builds and test there! "make lite debug" is my favorite.
2016-11-08 05:28:40 +01:00
de101fe9a8 OpenGL: mesh edit mode uses edge overlays
Legacy GL uses GL_LINES, modern GL uses the good stuff.

Edit mode still has a long way to go...
2016-11-08 05:22:17 +01:00
0b83680d85 OpenGL: support for edge overlays
Has some obvious opportunities for improvement. This is my second attempt. First attempt used MLoopTri and sort of worked...
2016-11-08 05:06:09 +01:00
016aca7427 OpenGL: fade other objects during edit mode
Right now this only affects other objects in wireframe. The idea is to do something similar for other draw modes, and keep focus on the edit object.

As seen at #bcon16
2016-11-07 20:32:27 +01:00
a3277ae384 OpenGL: simple mesh edit mode for new viewport
Very very simple. Needs a lot of work to reach "legacy viewport" capabilities.
2016-11-07 20:24:03 +01:00
5abf1a4e9d OpenGL: enable fancy wireframes
Most of this was already in place, just enabling & adding comments.

One fix was needed to make batch uniforms stick between multiple draws.

Added comments to selection outline; no functional changes there.
2016-11-07 20:07:31 +01:00
1cd754ad31 OpenGL: simple batch of all mesh triangles
Can be used for drawing basic surfaces, hit testing, depth pre-pass, ...
2016-11-07 20:07:31 +01:00
c1ba58c44d Merge branch 'master' into blender2.8
Conflicts:
	intern/cycles/blender/addon/properties.py
2016-11-07 15:46:27 +01:00
93dbd81796 Gawain: manage batch API's current shader program + uniform funcs
Typical pattern:
Batch_set_program
Batch_Uniform(s)
Batch_draw
2016-11-05 21:03:26 +01:00
5b26c36008 OpenGL: edge overlay shaders
As seen at #bcon16. These were produced quickly and probably need further work.

SIMPLE variant draws triangle mesh edges. Based on this research:
http://www2.imm.dtu.dk/pubdb/views/edoc_download.php/4884/pdf/imm4884.pdf
http://developer.download.nvidia.com/SDK/10/direct3d/Source/SolidWireframe/Doc/SolidWireframe.pdf

Non-SIMPLE variant can adjust thickness per edge. This can be used to draw only some edges, or accentuate some edges. Given the right inputs this is a general n-gon perimeter shader.

Part of T49165
2016-11-05 19:26:13 +01:00
a85f68e9c7 OpenGL: further wireframe shaders
As seen at #bcon16

Geometry shader version is automatically used on modern GL runtimes. Legacy version is used on pre-3.2 systems (Mac, Mesa compat profile). They have the same inputs and visual result.

TODO: specialized versions that are less flexible -- draw ALL edges or draw JUST silhouette edges.

Part of T49165
2016-11-05 18:56:57 +01:00
Dalai Felinto
c25c3bb6cb Fix UI for smoke cache
(this was probably broken since we got rid of point cache in 2.8)
2016-11-02 11:09:27 +01:00
Dalai Felinto
a41bbd3053 Merge remote-tracking branch 'origin/master' into blender2.8 2016-11-02 10:59:52 +01:00
fb6f42dc4f OpenGL: draw NLA strip curves with new imm mode
Part of T49043.
2016-10-31 17:42:11 +01:00
1556a28108 OpenGL: draw filebrowser dropshadow with new imm mode
Part of T49043.
2016-10-28 20:46:10 +02:00
Dalai Felinto
a25d3d7de2 Viewport: Set outline color for mesh based on active/select state
(also, fix warning regarding const float being written)

You only see the color if you use the "modern" viewport option
(otherwise I believe Blender is drawing the old on top of the new outline).

That said, in the "modern" viewport we have unfreed mem. To be
investigated separately.
2016-10-26 13:57:22 +00:00
2783d5df61 OpenGL: follow up on mesh wire TODOs
- depth test on (affects scene depth for now)
- color variations
- object outline  does not need GL_BLEND with latest shader
2016-10-26 04:18:19 -04:00
a394f4e545 OpenGL: edge shader discards fragments of unused edges
Discarded edges should not update depth buffer or blend with color buffer.

Geometry shader version will make this obsolete.
2016-10-26 03:57:14 -04:00
222ba0247f fix edge shader input 2016-10-25 19:38:22 -04:00
456d145d07 OpenGL: new mesh draw routines for new viewport
Totally WIP.

Started with copies of legacy routines, modified to use the new shaders & batch cache. Not all features are implemented; this is why we keep legacy viewport around during development!
2016-10-25 19:34:17 -04:00
Dalai Felinto
821fa24876 Viewport: fix depth not being cleared in ortho mode 2016-10-25 11:18:56 +00:00
Dalai Felinto
b4f849b9c6 Merge remote-tracking branch 'origin/master' into blender2.8 2016-10-25 11:18:41 +00:00
392551bd95 OpenGL: mesh batch cache (WIP)
Gawain batches are built on demand while drawing, then kept in this per-DerivedMesh cache.

A mesh's batches try to share vertex buffers as much as possible.

Not sure if this file is the best home for this code, but functions in this file are the only users of the cache. So maybe.

Big part of T49165
2016-10-25 05:31:25 -04:00
d8d42e1702 make View3D depth debug code optional
Quick hack to optionally disable depth buffer debugging at compile time.

Will this be useful for users or just during development?
2016-10-25 04:46:07 -04:00
bc566e9393 OpenGL: 3D View background & depth buffer details
Surveying buffer usage & clears for new viewport. Not yet perfect, but closer. Committing from Mac so I can test this on Windows.

Using new matrix API (T49450) for gradient background.
2016-10-25 04:39:55 -04:00
94e14a2c43 OpenGL: new built-in shaders for mesh edges 2016-10-25 03:19:10 -04:00
c5072941c3 OpenGL: clean up glActiveTexture usage
Removed some of my earlier glActiveTexture calls. After reviewing the
code I now trust that GL_TEXTURE0 is active by default. Fewer GL calls,
same results.

Fixed some misuse of glActiveTexture & glUniformi, mostly my fault.
Caught by --debug-gpu on Windows. Don't know why this appeared to be
working previously!

Plus some easy cleanup nearby.
2016-10-25 01:02:41 -04:00
Dalai Felinto
4d11b2fb91 Viewport: original gradient background
Last but not least, fix the original 3d view background based on
@merwin's comment.
2016-10-24 19:40:37 +00:00
Dalai Felinto
1458f0136d Viewport: move the background to the "modern" viewport
This also leaves room for the gradient background Mike Erwin wants to
implement.
2016-10-24 19:05:49 +00:00
Dalai Felinto
744718f635 immediate mode: background
There is a problem here, which is that we can't use immediate mode here
until we rely on `GPU_material_bind`.

(cc: @merwin)
2016-10-24 17:26:27 +00:00
Dalai Felinto
a3b69c8131 Viewport: fix depth filled before solid plates 2016-10-24 12:58:23 +00:00
6388d0c4a0 OpenGL: triple buffer tweaks
Works great on Mac now. Will test on Windows & Linux (Mesa) tomorrow. Related to T49505

Main fix is glActiveTexture and immUniform1i.

TEXTURE_2D vs TEXTURE_RECTANGLE is now a compile-time option. Both are available starting in GL 3.1 so there's no need for a run-time check.

Removed glClears that I don't think are necessary.

Prevent TEXTURE_2D from creating extra mipmap levels. We only need level 0.

Some minor cleanup: booleans and variable declarations.
2016-10-24 05:06:45 -04:00
1abdb0c2ee OpenGL: add NormalMatrix & inverse to new API
Part of T49450
2016-10-23 23:37:53 -04:00
2cb45c9938 a place to cache draw data in DerivedMesh
DerivedMesh owns this cache and cleans up as part of DM cleanup. DM has no idea what is stored in this cache. Loose coupling FTW
2016-10-23 23:22:16 -04:00
e53ab2b9ec Gawain: fixups & progress for batch API 2016-10-23 23:16:54 -04:00
Julian Eisel
dabbe6eb22 Fix memory leak when using depth-only shader 2016-10-24 00:03:55 +02:00
Julian Eisel
46257e01a7 Fix compiling with blenderplayer (once again...) 2016-10-22 00:30:28 +02:00
Dalai Felinto
5ff586610a Viewport: use depth shader to debug the depth
At the moment this already shows that the depth is the same after the solid plates and in the very end of drawing, while they should be different. Later on we can adapt this to show different buffers we want to debug.

I am using near=0.1, far=2.0 for my tests. I decided not to make a doversion for near/far because this is for debugging only
2016-10-21 20:51:12 +00:00
Dalai Felinto
deb77c0e74 Viewport: create a shader to show depth images linearized 2016-10-21 20:51:10 +00:00
Dalai Felinto
4c3624a7a0 Viewport: add missing alpha for stereo 2016-10-21 20:51:05 +00:00
Dalai Felinto
af20ca51a1 Viewport: Bring camera, speaker, rigid body shape and bounding box 2016-10-21 20:50:36 +00:00
cdcddddd96 OpenGL: disable GL_CULL_FACE state only when needed
The active camera has a solid "up" triangle instead of the usual outline. We want to see both sides of this triangle. Disable face culling only when drawing the active camera, not for every camera.
2016-10-21 16:25:17 -04:00
Dalai Felinto
01872d7f5d Fix build for gameengine 2016-10-21 12:50:04 +00:00
Dalai Felinto
dd23e52817 Merge remote-tracking branch 'origin/master' into blender2.8
Conflicts:
	source/blender/blenloader/intern/versioning_defaults.c
2016-10-21 12:22:50 +00:00
224d70c978 OpenGL: draw lamp objects with new imm mode
Previous commit in blender2.8 branch had some... unintended
consequences. This one should be better.

Part of T49043. Also uses new matrix API (T49450)
2016-10-20 16:55:40 -04:00
4ea6917468 OpenGL: box & circle outline functions that work with 3D position (z=0)
New immediate mode API is strict about attribute formats. These new functions make existing code easier to port.

Supports T49043
2016-10-20 14:33:32 -04:00
c6abbb40ad Gawain: closer integration of immediate mode & matrix APIs
- any shader program can use matrix state (not only built-in shaders)
- you can mix matrix & begin/end calls, and the bound shader will use the latest matrix state

Part of T49450 & T49043
2016-10-20 14:29:59 -04:00
a92d20a0a4 OpenGL: dirty bit for GPU matrix API
Have matrices changed since the most recent bind?

Part of T49450
2016-10-20 14:18:34 -04:00
Dalai Felinto
225edf4e66 immediate mode: outliner background
I tried using immRecti instead, but it didn't work. The current approach
should be more efficient anyways (since GL_TRIANGLE_FAN wouldn't work
here).
2016-10-20 01:44:49 +00:00
Dalai Felinto
33d99bdfe6 immediate mode: ed_util.c
note: I switched one of the glVertex2iv into glVertex2fv to use the same attrib_id
2016-10-19 23:59:22 +00:00
9941bc3041 OpenGL: draw empties with new imm mode
Part of T49043
2016-10-19 04:01:15 -04:00
625f1a1c30 OpenGL: draw cameras using new matrix API
Also removed some extra push/pops.
Ref T49450
2016-10-18 20:57:36 -04:00
05117d71a3 OpenGL: draw cameras with new immediate mode
Mostly the same as before. Except:
- avoid drawing same lines multiple times
- helper functions take "bool filled" argument instead of GLenum
- drawcamera_volume draws its own near & far planes
2016-10-18 20:27:24 -04:00
54a0ff3ab5 Gawain: yet another way to set uniform color 2016-10-18 20:22:22 -04:00
e9268abf4a fix narrow text entry fields
widget_draw_text was calculating wrong display length when field is too narrow to show entire input string. Gawain assert caught this 11 function calls away!

Thanks to @ianwill for reporting.
2016-10-18 17:34:29 -04:00
117af2356a skip drawing of gpencil strokes with overall thickness <= zero
Fixes an assert in drawing code.

Might need further work to support variable-thickness strokes (from pressure-sensitive stylus). This all is due for geometry shader overhaul anyway.
2016-10-18 13:12:40 -04:00
46a069822a draw gpencil dots smooth
Some strokes are just single dots. Draw these smooth / antialiased.
2016-10-18 13:07:35 -04:00
827ad4125c OpenGL: new built-in shader for smooth round 3D points 2016-10-18 13:03:30 -04:00
70ff63e63f OpenGL: tweak image shaders & code that uses them
- rename image shaders to describe exactly what they do
- rename inputs to match other built-in shaders
- set & use active texture unit
- no need to enable/disable textures with GLSL
- pull vertex format setup out of loops
2016-10-18 00:08:34 -04:00
0c6939f5f5 minor cleanup & deprecation 2016-10-17 23:48:12 -04:00
8327795f8d OpenGL: draw image empties with new API
This extensive rewrite caches the image texture in VRAM. Can handle images up to OpenGL limits (8K or 16K).

Part of T49043 & T49450
2016-10-17 23:28:51 -04:00
Dalai Felinto
6a0292cc19 Fix for gpu_shader_2D_texture_2D_frag.glsl
Report and patch by Willian Padovani Germano (ianwill)
2016-10-17 19:24:08 +00:00
Julian Eisel
4811b2d356 Proper fix for crash when joining areas that doesn't break manipulators
Turns out CTX_wm_region returns mostly NULL in wm_manipulatormaps_handled_modal_update. Now propertly unsetting area/region data of handlers when deleting area/region.
2016-10-17 19:28:09 +02:00
e7fddc0772 OpenGL: disable checks for NPOT texture support
Non-power-of-two textures are always allowed. Keeping the disabled checks in the code in case we support OpenGL ES in the future. Even then it should be a compile-time check, not at run-time.
2016-10-17 02:36:51 -04:00
42677fa937 Gawain: tweak tracking of unassigned attributes (no API change)
Hoping for a small performance win.
2016-10-16 23:50:18 -04:00
ca369e6f0c OpenGL: draw object centers nicer
Shaders + new immediate mode = very nice dots.

Part of T49043
2016-10-16 18:49:48 -04:00
61ca73ea10 OpenGL: new built-in shader for smooth round 3D points w/ outline 2016-10-16 18:43:24 -04:00
36d2365ac3 OpenGL: new immUniformThemeColorShadeAlpha function
Plus some naming cleanup.

Supports T49043
2016-10-16 17:48:35 -04:00
9cdf4afb76 Gawain: new immUniform4fv function 2016-10-16 17:48:35 -04:00
f7414b7412 fix IS_VIEWPORT_LEGACY macro 2016-10-16 17:48:35 -04:00
Julian Eisel
d1a35b7a08 Fix outliner items sometimes not opening
Own mistake in 9a9a663f40. Guessed there is a case where we have to rebuild the tree but everything seemed fine... It didn't work in display modes like "Data-Blocks".
2016-10-16 22:23:50 +02:00
Julian Eisel
fa39ec9e46 More fixes for keyframe theme options
Couple of issues here:
* Missing initialization for 3D view keyframe options for "Reset to Default Theme"
* Alpha values not reset correctly on "Reset to Default Theme"
* Alpha values of timeline keyframe options not reset correctly for old files
Also corrected old version patches even though they're overridden later, to avoid more issues in case people copy this code.

Corrections to d7af7a1e04 and 8d573aa0ec
2016-10-16 20:47:44 +02:00
Julian Eisel
196654ad08 Fix crash when joining areas (caused by manipulators)
Manipulator code tried to access the removed region from handler->op_region. Use context region now.
2016-10-16 19:31:57 +02:00
Julian Eisel
69713aa2da Cleanup: Quiet warnings, use RAD2DEG macro 2016-10-16 17:28:12 +02:00
Julian Eisel
b557ceb2c1 Merge branch 'master' into blender2.8
Conflicts:
	source/blender/editors/space_outliner/outliner_draw.c
	source/blender/editors/space_outliner/outliner_edit.c
	source/blender/editors/space_outliner/outliner_intern.h
	source/blender/editors/space_outliner/outliner_select.c
2016-10-16 15:33:00 +02:00
Julian Eisel
9a9a663f40 Outliner: Rework element selection behavior
* LMB now replaces selection instead of adding to it. Shift+LMB adds to selection (or removes if already selected). This is usual selection behavior Blender.
* Outliner selection isn't completely separate from object/sequencer-strip/render-layer/... selection anymore, when selecting an outliner item we now always try to select (and activate) the object it belongs to. Previously you had to click the name or icon of an item to select the object (or whatever) and on empty space within the row to set outliner selection.
* Collapsed items may show click-able icons for their children (nothing new). Clicking on such an icon will also select the hidden item it represents now, you'll notice after opening the parent. This valid from a technical POV, I'm not sure if this is wanted from user POV though. Changing would be easy, feedback welcome!
* Code cleanup.

Part of T37430.
2016-10-16 14:29:38 +02:00
Julian Eisel
f929045c2c Outliner: Avoid rebuilding tree when mouse-hover highlight changes 2016-10-16 14:10:30 +02:00
3999910b19 OpenGL: add GLSL #version 330, drop 140 and 150
GL 3.3 is the new minimum. Compatibility profile for now, core profile eventually. During development, GL 3.0 (on Mesa) and 2.1 (on Mac) will still work.

Part of T49012
2016-10-16 03:18:17 -04:00
1deab69e0a BLF/OpenGL: more text drawing optimization
Make color values compact. Set color once per primitive. Use new immSkipAttrib to avoid useless color copies.

All of this should make text drawing less CPU hungry.
2016-10-16 02:08:16 -04:00
741965615d Gawain: new immSkipAttrib function
Now you can explicitly skip a vertex attribute -- you don't give it a value and it won't get a copy of the previous vert's value. Useful for flat interpolated per-primitive values.

This is an advanced feature. Expect garbage in the empty spaces, and copies of garbage if you rely on the attrib copy behavior after skipping.
2016-10-16 01:58:26 -04:00
a4fe823416 BLF/OpenGL: accurate vertex count for drawing
We still need to BeginAtMost instead of simple Begin, since some glyphs could be clipped & not drawn.
2016-10-15 20:04:25 -04:00
a8dc3f4596 BLF: make blurry text an optional (disabled) feature
While trying to simplify text drawing, noticed no Blender code uses the blur feature. Hopefully scripts don't use it!
2016-10-15 19:40:41 -04:00
878938f203 OpenGL: remove some unused legacy matrix calls
Part of T49450
2016-10-15 19:08:19 -04:00
3996fbc564 OpenGL: bump Windows to GL 3.3 compat profile
Part of T49012
2016-10-15 14:41:29 -04:00
cf5750a85e Gawain: improve immediate mode performance
This was already fast on Apple, but @Severin and @dfelinto noticed slowdowns in user prefs, which is text heavy.

The problem was immBeginAtMost not being smart about VBO write flushing. immBeginAtMost can use all of its allocated range or only a subrange. The previous code was forcing back-to-back draw calls and buffer writes to serialize. This commit lets OpenGL know that our VBO writes never overlap, so there's no need to wait.

Should be much faster now!
2016-10-15 14:41:29 -04:00
Julian Eisel
5e428b3b3f Fix unitialized variable use
Own mistake in ae8e845470.
Patch by @efi0ng, thanks!
2016-10-15 18:59:31 +02:00
fcff984338 Merge branch 'master' into blender2.8 2016-10-15 10:05:03 +02:00
9632ca0a13 OpenGL: draw node sockets more efficiently
1 or 2 draw calls per node instead of 1 per socket (inputs + outputs).
Rearranged draw order so we set uniforms less frequently.
Some style & dead code cleanup.

Part of T49043
2016-10-15 02:49:00 -04:00
2df27995f9 OpenGL: new built-in point shader, clean up other shader names
Smooth round point with outline (uniform color) and fill (varying color).

Updated shader naming scheme: a shader that doesn't deal with color does not have to say "no color". Vertex shaders do not have to say "uniform color" since their frag counterpart actually has the uniform. Each name should describe what that shader *does*, not what it *doesn't do*.
2016-10-15 02:30:59 -04:00
48db35468f blender 2.8: OpenGL: node_circle_draw use now immediate mode
I use your new point shader to draw the node's soket

Reviewers: Severin, merwin

Maniphest Tasks: T49043

Differential Revision: https://developer.blender.org/D2286
2016-10-15 00:14:28 -04:00
29b47924dd OpenGL: bump Linux to GL 3.3 compat profile
fall back to 3.0 if needed (during development)

Part of T49012
2016-10-14 23:42:45 -04:00
4f4c7808e4 fix pointer type warning
thanks, gcc
2016-10-14 22:40:55 -04:00
Julian Eisel
325b21c1d5 Outliner: Fix missing indentation for search-match highlight
Own mistake in ae8e845470.
2016-10-15 02:08:38 +02:00
4736f19000 BLF: early exit when drawing empty strings
Avoids all kinds of setup & preparations to draw nothing.
2016-10-14 20:00:31 -04:00
3f0c0ed87d BLF: fix crash on text input fields
Some strings have known length, others are NULL terminated (len = INT_MAX in this case).

Now font drawing knows to treat INT_MAX special.
2016-10-14 20:00:31 -04:00
Julian Eisel
9904d73d9a Outliner: Draw highlights over entire row
Previously, highlights (mouse hover, selection, search-match) didn't affect background of restriction icons, now the entire line gets highlighted.
2016-10-15 01:38:44 +02:00
Julian Eisel
ae8e845470 Outliner: Element mouse hover feedback
Some little UI polish to get familiar with outliner code (but also because it's a useful feature). Committing to blender2.8 branch but can also port to master (2.7) if wanted.

This basically causes the mouse hovered element to be highlighted. Contrast of the highlight should be fine, even with a non-default theme. Also did some minor cleanup.
2016-10-15 01:03:25 +02:00
Dalai Felinto
ee54a6f130 viewport: draw non-mesh objects for a starter
This starts to decouple non-mesh objects and the legacy draw pipeline.
It shows how we can mix e.g., Cycles and lamps and empties.
2016-10-14 19:00:59 +00:00
Dalai Felinto
608e2402ef viewport: move border drawing code to new file 2016-10-14 19:00:45 +00:00
Dalai Felinto
4a10eb38a3 immediate mode: convert render border code and move to new drawing
routine
2016-10-14 19:00:32 +00:00
Dalai Felinto
e1e97bbb98 Immediate mode: use new util functions, and border draw functions
Part of T49043

Reviewers: merwin
2016-10-14 18:58:58 +00:00
Dalai Felinto
11653f85ff Immediate mode: new util functions (imm_cpack and imm_draw_line_box) 2016-10-14 18:57:38 +00:00
34dc660a76 OpenGL: draw text with fewer draw calls
Was one draw call per glyph,  now one per line.

Still room for improvement here.
2016-10-14 14:41:36 -04:00
dd350c0b37 GPencil: Avoid assert error if the immEnd is called with only one point for lines
This function will be replace by geometry shader, but we need this fix until the shader will be ready. The problem is similar to T49614.
2016-10-14 19:24:27 +02:00
6855ba4034 Fix T49614: Grease Pencil GPF error if stroke thickness change too much between stroke points
The problem was the function tried to draw a line with one point only. This fix will be replaced by new geometry shaders, but we need while this change is not ready.
2016-10-14 18:35:01 +02:00
f23db59e48 GPencil: Display stroke filling while drawing
Before this change, the stroke was filled only after complete the stroke drawing. For artist is better to get a feedback of the area he is filling while drawing, so this commit draws the filling area while drawing.

The triangulation of the stroke is recalculated every time the function is called because using a cache is not useful because the points information is changing all the time while the stroke is being drawing.
2016-10-14 12:06:30 +02:00
Dalai Felinto
58f0af965c viewport: fix rv3d->viewport mem free issue 2016-10-14 05:17:55 +00:00
Dalai Felinto
3cecf39069 immediate mode: starting using new immUniformThemeColorBlendShade and more conversion 2016-10-13 20:08:52 +00:00
Dalai Felinto
05cf74622f more theme color functions: UI_GetThemeColorBlendShade4fv, immUniformThemeColorBlendShade 2016-10-13 20:08:51 +00:00
945f8e3f93 Gawain: vertex format now uses fixed allocations (CPU perf++)
API stays exactly the same.

Attribute names can still be of variable length, as long as the average length does not exceed AVG_VERTEX_ATTRIB_NAME_LEN. Since this includes unused attributes (length = 0) the current avg of 5 might even be too high.
2016-10-13 15:15:40 -04:00
Dalai Felinto
dfa5b32c8c Merge remote-tracking branch 'origin/master' into blender2.8 2016-10-13 16:42:54 +00:00
Dalai Felinto
ecbedce81e viewport: barebones to handle viewport compositing in gpu_viewport.c 2016-10-13 16:26:29 +00:00
14d0549295 Gawain: fix build when TRUST_NO_ONE is disabled 2016-10-13 12:24:01 -04:00
Julian Eisel
916e631fc9 Fix compiling with Blenderplayer 2016-10-13 17:17:17 +02:00
Dalai Felinto
3579350481 immediate mode: small cleanup on timeline
(no need to unbind/rebind the same program)
2016-10-13 14:18:47 +00:00
6f220c1c55 inform immediate mode when switching OpenGL context
Longstanding to-do is now to-done.

Heinous bug reported by @dfelinto pushed me to fix this.
2016-10-13 00:38:29 -04:00
71656ac222 Gawain: fix immediate mode for multiple GL contexts
New functions activate & deactivate immediate mode. Call these when switching context and the internal VAO will be handled properly. VAOs are one of the few things *not* shared between OpenGL contexts.
2016-10-13 00:38:29 -04:00
Dalai Felinto
d5b75256e0 Fix for crash on dopesheet drawing with immediate mode (rB7a552612c) 2016-10-13 04:23:58 +00:00
Dalai Felinto
c565f7b5fd viewport: bring the manipulators 2016-10-13 02:50:42 +00:00
Dalai Felinto
165bdfb672 Fix timeline break after recent immediate mode change (rBf6e7e46f) 2016-10-13 02:19:04 +00:00
Dalai Felinto
b5c539f9fa gawain: assert for immBeginAtMost(..., 0) 2016-10-13 02:16:55 +00:00
Dalai Felinto
84ed9d9829 Draw depth even when in wire mode (for OB_RENDER)
Note: this is not working at the moment, but the logic is sound.
Since we will still change the drawing code a lot I think the commit is valid.
2016-10-13 00:36:58 +00:00
Dalai Felinto
69b1b95356 immediate mode: use new ThemeColor functions 2016-10-13 00:36:56 +00:00
Dalai Felinto
e79f302f16 gawain/immediate mode: new util functions for color uniforms 2016-10-13 00:36:52 +00:00
Dalai Felinto
f6e7e46fac Immediate mode: timeline (keyframes and range)
Part of T49043
2016-10-12 22:36:54 +00:00
683656681c BLF/OpenGL: use new matrix API when drawing text
First test of matrix API. This will eventually use the 2D part of this API, but the 3D part is ready now.

Part of T49450
2016-10-11 21:21:02 -04:00
06d4aca879 OpenGL: matrix fixes & compatibility
Was multiplying matrices backward, so concatenation was broken. Fixed!

Also a way to mix legacy matrix stacks with the new library. Just during the transition! Anything within SUPPORT_LEGACY_MATRIX will go away after we switch to core profile.

Part of T49450
2016-10-11 21:16:26 -04:00
c330f37135 quiet GPU matrix debug printing
Will be needed soon but turn it off by default.
Part of T49450
2016-10-11 14:44:12 -04:00
53d82c3e8d BLF/OpenGL: draw text with new immediate mode
Part of T49043
2016-10-11 14:36:16 -04:00
2fe7e70e92 install_deps: make c++11 building mandatory on blender2.8 branch. 2016-10-11 12:19:04 +02:00
0c43567a5a Merge branch 'master' into blender2.8 2016-10-11 12:09:59 +02:00
587a16352a Gawain: add immRect utility functions (replaces legacy glRect)
Caller is responsible for setting up vertex format, binding a shader program, and setting the color *before* calling immRect.
2016-10-10 12:31:38 -04:00
6371f8ff8a Merge branch 'master' into blender2.8
Conflicts:
	source/blender/blenloader/intern/readfile.c
	source/blender/editors/space_view3d/view3d_draw.c
2016-10-10 12:41:32 +02:00
ecbad54df9 blender 2.8; OpenGL. ui_panel_category_draw_tab with immediate API
Reviewers: dfelinto, Severin, merwin

Reviewed By: merwin

Tags: #bf_blender_2.8, #opengl_gfx

Maniphest Tasks: T49043

Differential Revision: https://developer.blender.org/D2281
2016-10-10 01:41:31 -04:00
22f59b81d7 OpenGL: remove GLSL support query (it's always supported) 2016-10-10 01:13:03 -04:00
78abbdf264 remove call to GLSL support query (it's always supported)
Reworked logic in the one place that still called this. Deleted the "GLSL not supported" fallback.
2016-10-10 01:11:03 -04:00
5fc9bed8b3 BGE: remove calls to GLSL support query (it's always supported)
Reworked logic in the few places that still called this. Deleted the "GLSL not supported" fallbacks.

Also removed some nearby checks for ARB_multitexture and OpenGL 1.1. Blender 2.77 removed checks like this, but game engine still has some.
2016-10-10 01:08:49 -04:00
7a60f889d3 OpenGL: plug new matrix system into shaders (WIP)
Built-in shaders now use uniforms instead of legacy built-in matrices. So far I only hooked this up for new immediate mode.

We use the same matrix naming convention as OpenGL, but without the gl_ prefix, e.g. gl_ModelView becomes ModelView.

Right now it can skip the new matrix stack and use the legacy built-in matrices app-side. This will help us transition gradually from glMatrix functions to gpuMatrix functions.

Still some work to do in gpuBindMatrices. See TODO comments in gpu_matrix.c for specifics.
2016-10-09 23:03:35 -04:00
e636529e33 OpenGL: Draw dividers in space_file with the new immediate mode
Thanks to @merwin for the review

Part of T49043
2016-10-09 18:20:52 +02:00
99db1b8d95 fix shaders for picky GLSL compilers
@zeauro reported this issue:
texture2DRect needs the ARB_texture_rectangle extension.
But isn't that an OpenGL 2.1 feature and should be part of GLSL 1.2+?

This should fix it, and future shaders should do something similar.
2016-10-09 10:53:03 -04:00
a2471d2b37 Gawain: validate inputs to add_attrib
Should help prevent errors when building vertex formats.
2016-10-08 16:58:06 -04:00
187d8f473a OpenGL: fix smooth point fringe
Smooth edge was fading to transparent black instead of transparent color. My bad.
2016-10-08 03:34:05 -04:00
7a552612c3 OpenGL: draw f-curve points and handles with new imm mode
Got rid of GLU and some matrix manipulation. Everything is shader driven now, drawn with point sprites.

Still plenty to do in this file...

Part of T49042 and T49043
2016-10-08 03:27:02 -04:00
25e4dc45e5 OpenGL: shaders for smooth round points
Solid color with an optional outline.

size (diameter) and outlineWidth are in pixels.
2016-10-08 03:11:53 -04:00
b071ac315c Gawain: allow immBeginAtMost, immEnd with no vertices
The whole point of BeginAtMost is to avoid counting before drawing. Sometimes the uncounted count is zero, and that's ok!
2016-10-07 23:50:52 -04:00
2a76da9ec2 draw region emboss with new immediate mode
Simple convert of drawing emboss lines to new immediate mode.

Part of T49043

Reviewers: merwin

Reviewed By: merwin

Subscribers: dfelinto

Tags: #bf_blender_2.8

Differential Revision: https://developer.blender.org/D2271
2016-10-07 23:46:52 -04:00
a398cdedfa Gawain: code cleanup & inline docs
Made function categories more clear & added more notes about how to use this API.

immEndVertex is no longer part of the public API.

Minor cleanup & organizing of recent additions.
2016-10-07 18:51:42 -04:00
b613d25354 Blender 2.8: OpenGL: replace old GL with the new immediate API in UI_draw_roundbox_gl_mode
I change UI_draw_roundbox_gl_mode to use immediate API.
The rest of the change is the call to the function.
I also make some change in UI_ThemeColor4(int colorid) for eg to make convenience to use.
I would really like to know if it's the good way to do, if yes I will make all the change in the node_daw.c after, else say me what's wrong and how to deal with color else.

Reviewers: merwin, dfelinto, Severin

Reviewed By: merwin

Subscribers: fablefox, Severin

Tags: #bf_blender_2.8, #opengl_gfx

Maniphest Tasks: T49043

Differential Revision: https://developer.blender.org/D2274
2016-10-07 15:03:21 -04:00
5c23b863f8 fix grid floor drawing assert
@dfelinto reported crash when setting grid subdivisions too low.

Code was setting color twice and Gawain was catching this. Fix is to only set regular grid color when we have regular grid lines to draw.  Then emphasized grid lines are free to set their own color further down.
2016-10-07 13:00:23 -04:00
Julian Eisel
6e358a1d06 Custom Manipulators Core Backend
This commit lands the core backend of the Custom Manipulators project onto the blender2.8 branch. It is a generic backend for managinig interactive on-screen controls that can be integrated into any 2D or 3D edito. It's also already integrated into the window-manager and editor code where needed.

NOTE: The changes here should not be visible for users at all. It's really just a back-end patch. Neither does this include any RNA or Python integration.

Of course, there's still lots of work ahead for custom manipulators, but this is a big milestone. WIP code that actually uses this backend can be found in the 'custom-manipulators' branch (previously called 'wiggly-widgets').

The work here isn't completely my own, all the initial work was done by @Antony Riakiotakis (psy-fi) and - although it has changed a lot since them - it's still the same in essence. He definitely deserves a big credit! Some changes in this patch were also done by @Campbell Barton (campbellbarton). Thank you guys!

Merge accepted by @brecht and @merwin.
Patch: https://developer.blender.org/D2232
Code documentation: https://wiki.blender.org/index.php/Dev:2.8/Source/Custom_Manipulator
Main task: https://developer.blender.org/T47343
More info: https://code.blender.org/2015/09/the-custom-manipulator-project-widget-project/
2016-10-07 16:59:55 +02:00
Julian Eisel
53d1dbbe5c Merge branch 'master' into blender2.8 2016-10-07 15:14:49 +02:00
4639664b3c Merge branch 'master' into blender2.8 2016-10-07 11:50:17 +02:00
107b585a41 OpenGL/gpencil: delete unused utility functions
Part of T49043  -- done with this file!
2016-10-07 03:17:23 -04:00
9d40c3dc32 OpenGL: draw gpencil fill with new imm mode
Part of T49043
2016-10-07 03:04:34 -04:00
1865bcd3cf OpenGL: draw 2D gpencil strokes with new imm mode
Part of T49043
2016-10-07 00:56:28 -04:00
1f6d704008 OpenGL: draw 3D gpencil strokes with new imm mode
Part of T49043
2016-10-07 00:06:20 -04:00
0fbe35c674 OpenGL: fix shader input typo 2016-10-07 00:00:12 -04:00
70a16298ea gpencil: disable / remove some legacy drawing
Want to avoid updating code we no longer use anyway.

Comments for areas to investigate or deadlines for deletion.

also some minor bool cleanup

Part of T49165
2016-10-06 22:05:28 -04:00
Julian Eisel
fc77787f6f Avoid possible compatibility issues with tmp viewport flags
We can't prevent users from using this branch, so I'd say it's reasonable to be a bit careful about what we store to files. In this concrete case we were storing a bit-flag for temporary use (only during early viewport transition) in a bit-field that's saved in files. Doing so would mean we either can't reuse this bit later or we risk breaking files (admittedly, likely in a pretty minor way). Moved the bit-flag to a new bit-field which can be removed later.
2016-10-07 03:56:32 +02:00
Dalai Felinto
49beb714c5 Viewport: support for external render engines (e.g., Cycles) with depth
(it is still a rough approach, but you can already see Cycles with Floor (when using board render or full render)
2016-10-07 01:47:30 +00:00
Dalai Felinto
4539c2b173 Viewport: floor cleanup 2016-10-07 01:47:30 +00:00
Dalai Felinto
82d069c232 Viewport: draw floor routine should not use GL_ALWAYS for depth
(talked with merwin about that, and he agrees on it, we are not supposed to write to the scene depth buffer
but we should read its depth)
2016-10-07 01:47:30 +00:00
Julian Eisel
490a938c8b Move panel for new viewport up
Makes it easier to enable it and avoids jumping of the panel when activating/deactivating it (because some panels disappear then). Also changed how panel title is drawn to make it behave like other panels.
2016-10-07 03:22:48 +02:00
Julian Eisel
1997b0f03c Use theme color for clearing viewport background
We'll obviously do more fancy stuff here later, but we don't have to look at pure blackness either ;)
2016-10-07 03:11:08 +02:00
1b4b4dfd0c OpenGL/GPencil: draw stroke-in-progress with new imm mode
We should revisit this later and use geometry shader to draw one continuous tapered stroke.

Part of T49043
2016-10-06 20:51:31 -04:00
fe654a93c7 Gawain: allow strips of 1 line, fans of 1 triangle
My initial tests were stricter than necessary, and blocked some valid uses. Fixed!
2016-10-06 20:51:31 -04:00
e01b1eac84 cleanup: C99, const, blank lines 2016-10-06 20:51:30 -04:00
Julian Eisel
553b4faac8 Merge branch 'master' into blender2.8 2016-10-07 00:22:21 +02:00
ffc46668c4 OpenGL: modernize gp_draw_strokes_edit
Single draw call per stroke!

Part of T49043
2016-10-06 17:41:23 -04:00
Dalai Felinto
ea89b4a918 Viewport: bring grid over to the new viewport
We will keep the old system working as long as we can. At the moment even the visibility flags we are getting from the old system. That will continue like this until we have decided on the new UI
2016-10-06 20:35:41 +00:00
Dalai Felinto
6b88f3118f Viewport: Starting to port over the principles of the draw flux into placeholder functions
A lot of the work still have to done on space_view3d.c for initialize the data and buffers properly, but it is a start
2016-10-06 20:35:40 +00:00
198e3a35c8 OpenGL: another built-in shader for 2D points
GPU_SHADER_2D_POINT_VARYING_SIZE_VARYING_COLOR
2016-10-06 16:32:02 -04:00
86e439e311 OpenGL: convert gp_draw_stroke_point to new immediate mode
and constify some static utility functions

Note: 2D shader will ignore position's z value, but making pos a vec3 lets us unify code in this function.
2016-10-06 14:40:47 -04:00
edcce96d97 OpenGL: more built-in GPU_SHADERs for points
No new GLSL shaders were needed! Just combined existing vertex & fragment shaders in new ways.
2016-10-06 14:20:33 -04:00
360cb87007 OpenGL: modernize more volumetric gpencil drawing
Main goal is to get rid of GLU.

Part of T49042, touches on T49043 and T49450
2016-10-06 12:45:04 -04:00
e86bd78745 Gawain: more ways to set uniform color 2016-10-06 09:37:04 -04:00
1731e94d0c draw gpencil erase cursor with new imm mode
Part of T49043 and T49450.
2016-10-05 14:05:55 -04:00
e874f3cdc5 draw gpencil sculpt cursor with new imm mode
Part of T49043 and T49450.
2016-10-05 13:45:28 -04:00
c462500618 Gawain: more ways to set uniform color 2016-10-05 13:12:18 -04:00
Dalai Felinto
5e8c4ae75b Barebones for viewport code apart from 2.7x drawing code
A new option (set in the properties region) allows the user to pick the
"new viewport" for the rendering  (in the UI: Modern Viewport).

For now we have a semi-blank file (view3d_draw.c) that can starts to take
over the drawing pipeline.

I can't guarantee we will be able to keep both drawing systems working
through the entire 2.8 development, but it should do for now.

also, we can use branches for some of the viewport development, but it's
better to keep things in 2.8 whenever we can, so people can test it.
2016-10-04 22:02:05 +00:00
3a4c1db14b fix Linux build
My mistake. Breakage reported by @mont29
2016-10-04 01:31:24 -04:00
79b8242fd1 Gawain: fix bug in immUniformColor4ubv
Reported by @kgeogeo
2016-10-04 01:24:33 -04:00
Dalai Felinto
ae44e24fed Merge remote-tracking branch 'origin/master' into blender2.8 2016-10-03 20:54:22 +00:00
55aadccbde Merge branch 'master' into blender2.8 2016-10-03 20:48:00 +02:00
72473a61b0 Fix compile errors with Alembic. 2016-10-02 20:52:25 +02:00
c50ccc8476 Merge branch 'master' into blender2.8 2016-10-02 18:53:01 +02:00
ba30b852f3 OpenGL: draw volumetric gpencil with point sprites
Transition away from GLU and legacy matrix stack. Using point sprites eliminated the need for most of the matrix math!

Depends on decent support of large aliased points. NVIDIA is good at this, must test limits on AMD & Intel systems.

Still needs proper scaling based on view zoom.

Part of T49042, touches on T49043 and T49450.
2016-10-01 18:11:58 -04:00
b8e3d81f31 OpenGL: fix point sprites
Apparently GL_POINT_SPRITE is important to GL 3.2+ compatibility profile, not just to GL 2.1 as thought.

We'll remove this during the core profile transition.
2016-10-01 17:34:41 -04:00
875d63ccb5 OpenGL: one more point shader
Added a built-in shader for points that vary both size and color.
2016-10-01 17:32:29 -04:00
5753a1462f OpenGL: new built-in shaders for drawing points
Both of these draw round points with jaggy edges, but treat color & size differently.
2016-09-30 20:44:22 -04:00
d1b21d1278 OpenGL: add support for programmable point size
And enable point sprites always. Fragment shaders can use gl_PointCoord now.
2016-09-30 19:51:04 -04:00
82648a8f91 OpenGL: make platform requirements explicit
At context startup, make sure our assumptions about the OpenGL version are true. Should match since we set up the contexts... but this is what asserts are for, to check "should"s!

Part of T49012
2016-09-30 19:10:30 -04:00
Julian Eisel
42ed1f0e3c Merge branch 'master' into blender2.8
Conflicts:
	source/blender/blenloader/intern/writefile.c
2016-09-30 01:18:41 +02:00
47bba7e15f OpenGL: draw nurbs control verts with new imm mode
patch P397 by @lichtwert + minor const by @merwin

Notes from drawvertsN function:
this used to be called twice (once for selected/active, once for unselected -- guess: to avoid state switches[color]?)
this used to be called in a loop, too (subcurves), moved the loop here to avoid multiple init stuff

Part of T49043
2016-09-29 15:23:13 -04:00
Julian Eisel
35bd833e02 Cleanup: Style 2016-09-29 21:15:27 +02:00
bbf32980b0 OpenGL: draw speaker with new immediate mode
patch P388 by @lichtwerk, I tweaked a few things.

Since speaker theme color is opaque we leave blend mode alone.

Part of T49043
2016-09-29 14:47:38 -04:00
Dalai Felinto
9bac74c27b Complement fixup for 4a1feaa555 (texture shaders)
We now multiply the alpha by the image alpha (as per severin
suggestion).
That still doesn't solve the main question of user preference drawing
black.
2016-09-28 19:11:11 +00:00
Dalai Felinto
4c7ff8fb1e Fix animation transition in region overlay not working since 4a1feaa5
We still have stills with the User Preference window, though.
2016-09-28 18:48:51 +00:00
83d5a919e2 modernize basic shader a tiny bit
"varying" is redundant here, all GS inputs & outputs vary.

Any code that uses this will be GLSL 1.3 or newer.
2016-09-27 21:25:38 +02:00
0ca2118851 safety checks in GPU shader library
If shader compilation fails, or for some other reason the shader is NULL or 0, we need to know.
2016-09-27 21:25:38 +02:00
ad32b774cb fix basic shader syntax when drawing lines
Fixed on GL 3.2+, Mac still lays an egg due to the geometry shader.
2016-09-27 21:05:48 +02:00
Julian Eisel
88aa42a6f7 Fix most toolbar panels not visible
Was likely in here since initial blender2.8 branch commit (particle removal).
2016-09-27 03:38:24 +02:00
Dalai Felinto
fc485302cc immediate mode: using texture shader for stereo drawing
(for side-by-side and top-bottom stereo modes)
2016-09-26 15:38:24 +00:00
8cff9c20ff Merge branch 'master' into blender2.8
WARNING! Full build is broken, alembic has not been merged in correctly and has some references to particle stuff.
Don't have time to tackle this now (and probably would be better if someone knowing what he's doing does it anyway).

Conflicts:
	release/scripts/startup/bl_ui/properties_particle.py
	source/blender/blenkernel/intern/library_remap.c
	source/blender/blenkernel/intern/smoke.c
	source/blender/editors/physics/particle_object.c
	source/blender/editors/physics/physics_intern.h
	source/blender/editors/physics/physics_ops.c
	source/blender/editors/space_outliner/outliner_intern.h
	source/blender/editors/space_view3d/drawvolume.c
	source/blender/makesrna/intern/rna_smoke.c
2016-09-26 17:19:03 +02:00
628ef78e8a overhaul gpuMatrix API
Complete (for our needs) 2D & 3D transformation API. Should be easy to port legacy OpenGL matrix stack-based code to this. Still needs testing.

Ported ortho, frustum, lookAt functions from Viewport FX (rB194998766c65). Kept plenty of Viewport FX code from previous commit.

Stack API and 2D routines ported from Gawain. This version uses BLI_math library so everything is licensed under GPL instead of the usual MPL.

Part of T49450
2016-09-25 19:29:45 +02:00
a731c75442 port math function from Viewport FX
mul_v4_m4v3(r, M, v) means r = M * vec4(v, 1.0)
Based on rB194998766c65
2016-09-25 19:01:18 +02:00
9bea012b8c specialize mat3 multiply routines
Same as 5c6baf1ee9 but for 3x3 matrices.
2016-09-25 18:48:11 +02:00
5c6baf1ee9 specialize mat4 multiply routines
mul_m4_m4m4(R, A, B) gives us R = AB in general. Existing code assumed the worst, that A and B both alias the output R. For safety it makes internal copies of A and B before calculating & writing R.

This is the least common case. Usually all 3 matrices differ. Often we see M = AM or M = MB, but never M = MM.

With this revision mul_m4_m4m4 is called in exactly the same way but copies inputs only when needed. If you know the inputs are independent of the output use the "uniq" variant to skip the saftety checks.
2016-09-25 14:27:48 +02:00
addc666999 constify BLI_math_matrix inputs
GPU_matrix needs this very soon, and it's good practice in general.

also sprinkled in some TODOs for later
2016-09-24 16:21:38 +02:00
36bbdf142c OpenGL: fix new shader for Mac
Follow-up to rB4a1feaa5558ed60388fd3be41db74fbc54f2ab08
2016-09-23 18:16:45 +02:00
7fc2e333bb small merge fix
Follow-up to rB1dfb89d22930
2016-09-23 18:12:24 +02:00
Julian Eisel
1dfb89d229 Merge branch 'master' into blender2.8
Conflicts:
	intern/ghost/intern/GHOST_ContextCGL.mm
	intern/ghost/intern/GHOST_WindowCocoa.mm
	source/blender/makesrna/intern/rna_main.c
2016-09-23 01:40:19 +02:00
Dalai Felinto
4a1feaa555 immediate mode: Triple Buffer and two new shaders for TEXTURE_2D and TEXTURE_RECT
Use the same vertex shader for both fragment shaders
2016-09-22 13:40:33 +00:00
1d469f3780 OpenGL: remove double precision matrix functions
Proper fp64 is a GL 4.x feature. Pretending to support it in our API is just clutter.
2016-09-22 12:19:24 +02:00
0e7c3dfe75 OpenGL: matrix code from viewport-fx
Bringing over whole files from rB194998766c65
2016-09-22 12:11:40 +02:00
825150605e GPU_basic_shader uses GLSL by default
switch back to old mode at runtime:
blender --enable-legacy-basic-shader
2016-09-21 20:24:02 +02:00
9047717b3f Gawain: support triangle strips & fans in immediate mode
fixes crash in Vertex Paint (color picker)
2016-09-21 15:47:08 +02:00
0f759da370 Gawain: batch drawing works
Forgot to tell OpenGL which shader program the batch is using. Now it works!
2016-09-20 18:03:59 +02:00
Dalai Felinto
284398e517 immediate mode refactor: walk navigation cross 2016-09-20 14:50:24 +00:00
Dalai Felinto
04bc828fb6 gawain update: immAttribute for 2i 2016-09-20 14:50:20 +00:00
Dalai Felinto
6ebf5c18c3 immediate mode refactor: fly navigation square 2016-09-20 14:47:14 +00:00
d3365c5c72 OpenGL: fix GPU_SHADER_TEXT on non-Mac
Developed on Mac and committed quickly.. oops
2016-09-20 16:13:01 +02:00
Julian Eisel
42ad5952ff Quiet warning with -Wformat-signedness
Is actually a redundant cast since Blender uses -funsigned-char, however I think it's fine to be explicit about it in new code so cast is required to make compiler happy. Am not a fan of -funsigned-char anyway...
2016-09-20 14:23:15 +02:00
34bd89a9f6 OpenGL: draw_view_axis with new immediate mode
Changed drawing to use smooth lines, and to fade away when axis points toward / away from screen. (transform manipulators do this already)

Also fixed a nearby (but unrelated) missing immUnbindProgram.

Part of T49043
2016-09-17 15:52:32 +02:00
e21853abb9 OpenGL: streamline font rendering
Ignore texture matrix in the shader, stop messing with texture matrix in BLF code.

Use linear screen-space interpolation instead of perspective.

Avoid redundant call to glMatrixMode.
2016-09-17 13:54:30 +02:00
1b1275f0db add GPU_SHADER_TEXT for font rendering
With USE_GLSL enabled, GPU_basic_shader(TEXTURE|COLOR) always rendered black. New shader uses a solid color + alpha channel of texture (which in our case is a font glyph). See fragment shader for details.

I prefer this approah -- multiple shaders that each do one thing well (and are easy to read/write/understand), instead of one shader that can do many things given the right options.
2016-09-17 13:33:48 +02:00
c3034afa58 OpenGL: simplify basic_shader_bind
No need to enable/disable texturing with GLSL, just use textures in the fragment shader.
2016-09-17 13:33:48 +02:00
834cb93f40 Blender 2.8: Fix some strict aspects on Linux 2016-09-16 17:18:19 +02:00
d96b8e168f Merge branch 'master' into blender2.8 2016-09-16 17:09:28 +02:00
76c99f361f Gawain improvements
Fixed compile error in debug build (thanks mont29)

Renamed some functions for consistency.

New features:

Create a Batch with immediate mode! Just use immBeginBatch instead of immBegin. You can keep the result and draw it as many times as you like. This partially replaces the need for display lists.

Copy a VertexFormat, and create a VertexBuffer using an existing format.

Resize a VertexBuffer to a different number of vertices. (can only resize BEFORE using it to draw)
2016-09-15 21:45:10 +02:00
5eddb80513 Extend Gawain to use Blender's built-in shaders
Was already done for immediate mode, but rearranged code to make a clean separation. Cleaned up #includes for code that uses this feature.

Added same for batched rendering.
2016-09-15 18:41:28 +02:00
39f7a81176 Gawain: batch rendering API
Follow-up to rBddb1d5648dbd

API is nearly complete but untested.

1) create batch with vertex buffer & optional index buffer
2) choose shader program
3) draw!
2016-09-15 16:51:10 +02:00
0d54d32dd6 Gawain: simplify attrib binding API
This API is used internally by the immediate and batch drawing systems.
2016-09-15 12:57:07 +02:00
2fb5a959e9 Gawain: delete bind_attrib_locations
This function modifies the GL program object, which reduces our ability to share a shader among meshes with different vertex formats. Recommended approach is to use get_attrib_locations.
2016-09-15 12:24:06 +02:00
110d68ca1d Gawain: flesh out VertexBuffer
create, specify, fill with data
2016-09-14 16:29:01 +02:00
df7be04ca6 fix Mac build with Xcode 8
Small issues in GHOST
- use NSApplicationDelegate protocol for our app delegate
- make sure NSApp is initialized before using
2016-09-14 16:29:01 +02:00
54b00657ca Gawain: fix Windows compile error
MSVC was NOT happy about uint64_t, now it is.
2016-09-13 03:21:16 -04:00
1b5b899228 OpenGL: add built-in GPU_SHADER_3D_DEPTH_ONLY
We’re discussing several techniques that require a depth pre-pass.
2016-09-13 02:51:38 -04:00
ddb1d5648d Gawain: geometry batches (unfinished)
Vertex Buffer to store vertex attribute data.
Element List (AKA Index Buffer) to select which vertices to use.
Batch combines these into an object that can be built once then drawn
many times.

Porting over from the C++ version… Most of this C code is compiled but
unused. Some of it is not even compiled. Committing now in case I’m
lost at sea.
2016-09-13 02:41:43 -04:00
b6bd299359 Gawain: reorganize source code
Put Gawain source code in a subfolder to make the boundary between the
library and the rest of Blender clear.

Changed Gawain’s license from Apache to Mozilla Public License. Has
more essence of copyleft — closer to GPL but not as restrictive.

Split immediate.c into several files so parts can be reused (adding
more files soon…)
2016-09-13 02:18:33 -04:00
18d49a8283 Gawain: add immBeginAtMost
immBegin requires us to know how many vertices will be drawn. Most times this is fine, but sometimes it can be tricky. Do we make the effort to count everything in one pass, then draw it in a second?

immBeginAtMost makes this simple. Example: I'll draw at most 100 vertices. Supply only 6 verts and it draws only 6.

Any unused space is reclaimed and given to the next immBegin.
2016-09-06 16:56:08 -04:00
031c5bad87 Gawain: fix GL_POINTS in immediate mode
Was using GL_NONE to mean "no primitive" but GL_NONE and GL_POINTS are both defined as 0x0000.

Introducing PRIM_NONE = 0xF which does not clash with any primitive types.
2016-09-06 15:45:10 -04:00
3c29aad787 Merge branch 'master' into blender2.8
Conflicts:
	intern/cycles/blender/blender_particles.cpp
	source/blender/blenkernel/intern/particle.c
	source/blender/gpu/intern/gpu_shader.c
2016-09-04 16:41:06 +02:00
498583844f OpenGL: use new uniform color functions
Color picker code motivated these convenience functions. looks much better now.
2016-08-27 14:14:01 -04:00
9d3813e602 Gawain: convenience functions for uniform color
Application code can pass ubytes, Gawain converts to float vec4 expected by shader.

For now the conversion is simple linear. We can add sRGB support later if needed.
2016-08-27 14:10:37 -04:00
42bbfe7f0a OpenGL: draw grid floor & axes with new immediate mode
Significant rewrite with some improvements.

Maintain visual hierarchy of the grid:
- emphasized lines draw atop normal lines
- axes draw atop all lines (same as before)

Draw axes only once, not twice.

Return early if nothing to draw.

Single draw call for the default case (grid floor with X and Y axes).

Z axis needs a second draw call because it uses 3D coordinates.

Part of T49043
2016-08-26 01:12:44 -04:00
060bf1bd28 OpenGL: draw empties without GLU
Also reduced number of matrix ops by generating final positions directly.

Also removed a display list (deprecated in modern GL).

Tried to reuse sinval & cosval tables but those values are skewed (last value repeats first value, middle values are squished to compensate). Went with sinf & cosf instead.

Part of T49042
2016-08-25 13:45:39 -04:00
da36b447c7 OpenGL: de-GLU the transform manipulator
Part of T49042

Also reduced the number of matrix ops.

TODO: replace glBegin/glVertex with new immediate mode
2016-08-24 23:47:45 -04:00
1fc1fd8372 OpenGL: draw area resize handle with new immediate mode
The little grabby handle in the corner of an area. Now uses 1 draw call
instead of 6.

Also one version of the (+) icon to show a hidden region. Why do we
have multiple versions of this?

Fixed a harmless signed/unsigned error.

Fixed a GL state error that prematurely disabled blending.

Added imm_draw_filled_circle function, which can be used for drawing
other widgets.

Work toward T49042 and T49043
2016-08-22 23:39:42 -04:00
069569f820 Merge branch 'master' into blender2.8
In addition to pack of conflicts listed below, also had to comment out particle part of new Alembic code... :/

Conflicts:
	intern/ghost/intern/GHOST_WindowWin32.cpp
	source/blender/blenkernel/BKE_effect.h
	source/blender/blenkernel/BKE_pointcache.h
	source/blender/blenkernel/intern/cloth.c
	source/blender/blenkernel/intern/depsgraph.c
	source/blender/blenkernel/intern/dynamicpaint.c
	source/blender/blenkernel/intern/effect.c
	source/blender/blenkernel/intern/particle_system.c
	source/blender/blenkernel/intern/pointcache.c
	source/blender/blenkernel/intern/rigidbody.c
	source/blender/blenkernel/intern/smoke.c
	source/blender/blenkernel/intern/softbody.c
	source/blender/depsgraph/intern/builder/deg_builder_relations.cc
	source/blender/gpu/intern/gpu_debug.c
	source/blender/makesdna/DNA_object_types.h
	source/blender/makesrna/intern/rna_particle.c
2016-08-21 13:18:26 +02:00
be2bc7e0f6 OpenGL: draw color picker wheel with new immediate mode
Includes new imm_draw_lined_circle function that can be used for other
widgets.

Part of T49043
2016-08-20 15:40:08 -04:00
eb717ee979 Gawain: more immediate mode functions
Scanned Blender code for commonly used glVertex, glColor functions.
Implemented immVertex, immAttrib versions of these to ease transition
away from legacy OpenGL.
2016-08-20 15:09:32 -04:00
1e6b3ef1a1 cleanup: unused OpenGL utility code
Keeping unused gla2D code because it might be useful, or inspire
something useful, for Blender 2.8 development.

Also removed an old Mac driver bug workaround. Disabled this before the
2.77 release and nobody has complained.
2016-08-20 13:57:17 -04:00
7e02d335c0 OpenGL: don't poll for errors, rely on KHR_debug
Errors are caught & reported by our GL debug callback. This gives us way more useful information than sporadic calls to glGetError.

I removed almost all use of glGetError, including our own GPU_ASSERT_NO_GL_ERRORS and GPU_CHECK_ERRORS_AROUND macros.

Still used in rna_Image_gl_load because it passes unvalidated input to OpenGL functions.

Still used in gpu_state_print_fl_ex as an exception handling hack -- will rewrite this soon.

The optimism embodied by this commit will not prevent OpenGL errors. We need to analyze what would cause GL to fail at certain points and proactively intercept these failures. Or guarantee they can't happen.
2016-08-19 00:52:52 -04:00
d8f036efd6 OpenGL: draw NDOF guide with new immediate mode
This is the rotation pivot guide for 3D mouse input.

Work toward T49043
2016-08-16 21:54:50 -04:00
6b34eed217 Gawain: add v functions to immediate mode
Legacy OpenGL has a matching Vertex3fv for every Vertex3f, and so on. Add something similar to Gawain, just for a few common functions. Might add more as the need arises.
2016-08-16 21:45:17 -04:00
b92d76000d fix #includes for GPU debug
Can now build release and debug.

Close to final version in master (which took several commits).
2016-08-16 17:14:42 -04:00
b8f27b2514 OpenGL: shaders for simple 3D drawing
These are intended for very simple drawing. No lighting etc.

Shares some fragment code with the 2D shaders.

Similar to their 2D counterparts, but are not combined because of
future plans for separate 2D & 3D matrix stacks.
2016-08-16 14:58:53 -04:00
8619e09107 OpenGL: tweak legacy 2D shader
EXT_gpu_shader4 lets us say “noperspective” in GLSL #version 120 just
like in later GLSL.

Mac shader now matches modern GLSL available on other platforms.
2016-08-15 21:44:44 -04:00
23d7ae1843 OpenGL: backtrace on errors (--debug-gpu)
Backtrace so we can pinpoint where the GL error came from. Then fflush
on severe errors in case it's severe enough to crash Blender.
2016-08-15 04:00:59 -04:00
f1ad3483af get latest OpenGL version on Windows + AMD
When we ask for GL 3.2 compatibility profile:
AMD (Radeon HD 6970) gives us exactly this version
NVIDIA (Quadro K600) gives at least this version
Still need to check Intel behavior

We want *at least* the version requested, plus more recent features if
available.

Both GPUs tested & mentioned above are capable of GL 4.5. With this
commit they both give 4.5 to Blender.
2016-08-14 01:27:00 -04:00
91f04b82a5 early out for ortho grid drawing
Helps most when real-world units are used.

Previous code started at the smallest visible unit (e.g. Inches) then
followed to Feet, Yards, Chains, Furlongs, Miles. Always to the largest
unit of the set, even though most would be way off screen.

New code knows whether it skipped any grid lines for the next unit to
fill in, can stop once all lines are on screen.
2016-08-13 22:33:49 -04:00
90c4ad7387 Mac fixes for new ortho grid drawing
Previous commit works on Windows, found some issues after trying on Mac.

- benign warnings about && within ||
- replaced nearbyint() with round() to avoid floating point environment
surprises
- remquo function appears to be broken on Mac (!) results were way way
off. Replaced with simple division.
- minor tweaks to debug output
2016-08-13 22:13:24 -04:00
db5ad6a79e draw ortho grid with new immediate mode
Work toward T49043, with a side of client vertex arrays.

Not a straightforward port from glVertex to immVertex since Gawain needs
to know how many vertices we'll be drawing *before* we start drawing.

Fixed these not-so-great aspects of grid drawing:
- coarse grids would draw atop some lines from the finer grids
- visible axes would draw atop lines from coarse grid
- axes were drawn even if they weren't in view
- terrible misuse of vertex arrays
- each line issued its own draw call

New code draws each line exactly once. The entire grid is one draw call.

Bonus: I had to / got to learn how the units system works!
2016-08-13 18:14:45 -04:00
e36af2c257 Gawain: increase size of immediate mode buffer
New value of 4MB should handle our needs without taking up too many GPU
resources.

Old value of 1KB was for observing what happens when the buffer fills up
and we need to flush and start a new one.
2016-08-13 16:31:44 -04:00
dfbc51f764 cleanup: ortho grid drawing
Getting this ready for Gawain treatment.

Removed setlinestyle(0) -- solid lines are the default,  hope this isn't
really needed.

Eliminated redundant math.

Arithmetic is still double precision, passed to OpenGL as single
precision. Even though it said GL_DOUBLE before, values were converted
to GL_FLOAT internally.

Use C99-isms for declaring variables close to where they're used.

Minor whitespace tweaks.
2016-08-12 17:20:21 -04:00
4565f3d0c8 use new immediate mode for UI_draw_box_shadow
This serves as a good example of the Gawain API. (I’ve thought of a
better way to draw drop shadows, but that can wait!)

Part of T49043.

This is what I had in mind for D1753.
2016-08-11 01:06:17 -04:00
7664d947b3 Gawain: allow partial vertex specification
If you don’t specify a vertex’s color, it will use the color of the
previous vertex. Similar for all other attributes.

This matches the legacy behavior of glColor, glNormal, etc. *except* in
Gawain the first vertex of each immBegin must be fully specified. There
is no “current” color in the new system.
2016-08-11 00:11:48 -04:00
4aadf7331e Gawain: tweak immediate mode API
Should be simpler to use now.

Made vertex format structure private. New immVertexFormat() function
clears and returns the format. Devs can start with add_attrib(format...)
and not have to clear it first.

immBindProgram automatically packs the vertex format if needed.

Updated 3D cursor drawing to use new API.
2016-08-10 18:01:04 -04:00
f537d96286 Merge branch 'blender2.8' of git.blender.org:blender into blender2.8 2016-08-10 16:09:08 -04:00
adbbcefe57 Gawain: fewer glEnable/DisableVertexAttribArray calls
Track previously enabled attrib locations so we can call OpenGL only
when needed.

Same result, fewer GL calls.
2016-08-10 16:08:32 -04:00
8fd4a8ab5d Merge branch 'master' into blender2.8
Conflicts:
	source/blender/blenkernel/intern/library.c
	source/blender/blenkernel/intern/particle.c
2016-08-10 15:06:40 +02:00
e7a32365cf Gawain: map vertex format to shader inputs
glBindAttribLocation does not take effect until the program is
re-linked. In other words I was doing it wrong!

New code gets attrib locations from program, then remembers the attrib
-> location mapping for subsequent draw calls.

The program and VertexFormat are not modified (makes threading and reuse
easier).
2016-08-10 04:45:23 -04:00
5320a0ad9b Gawain: fix compiler warnings
properly typed function parameters
pointer casting & arithmetic
ptrdiff_t formatting
2016-08-10 02:38:51 -04:00
e4e1b0c7d3 OpenGL: invalidate buffers the modern way
There are older ways to give OpenGL hints about buffer invalidation, but
glInvalidateBufferData does exactly what we want. Use this function when
OpenGL 4.3 is available (Windows and proprietary Linux drivers).

Part of Gawain immediate mode.
2016-08-09 17:17:34 -04:00
f3d65ad23c OpenGL: debug context on Windows
Enable based on --debug-gpu at the command line. Linux already works
this way.
2016-08-09 03:29:49 -04:00
b7f3fb0ef9 Gawain: fix Windows build error
MSVC is more strict than  gcc or clang about pointer arithmetic. Also
fixed pointer cast warnings.
2016-08-09 02:27:54 -04:00
a77e77599d OpenGL: enhance debug output
When running blender --debug-gpu

Display which debug facilities are available. One of these, in order of preference:
- OpenGL 4.3
- KHR_debug
- ARB_debug_output
- AMD_debug_output

All messages are logged now, not just errors. Will probably turn some of these off later.

GL_DEBUG_OUTPUT_SYNCHRONOUS lets us break on errors and backtrace to the exact trouble spot.

Callers of GPU_string_marker no longer pass in a message length, just the message itself (null terminated).

Apple provides no GL debug logging features.
2016-08-09 01:29:58 -04:00
9893153799 OpenGL: fix FBO error messages
Old code had a mix of framebuffer error codes from OpenGL ES, EXT_framebuffer_object, and desktop GL. We use desktop GL (or ARB_framebuffer_object which acts just like GL 3.x) so I made it compatible with that.

Changed messages to the actual GL_FRAMEBUFFER_XXX symbols. These are less friendly and more accurate. Can easily look up what an error means, unfiltered by what a Blender dev thinks it means.

Kept ES error codes around in case we support that one day. Just flip the #if or use a compile-time option.
2016-08-08 18:02:40 -04:00
39259fc8ab draw 3D cursor with new immediate mode
Replace legacy OpenGL with Gawain. Use shaders instead of fixed
function pipeline.

This simple UI element is shown at startup so is easy to verify things
are working. It also serves as a good example for people converting
other parts of the code.

Part of T49043
2016-08-08 15:45:18 -04:00
c73e4e99a5 OpenGL: simple 2D shader with flat color
Flat color means each primitive will use color from the provoking
vertex.
2016-08-08 04:56:02 -04:00
4214b3c44a OpenGL: simplify 3D cursor drawing
Use simple alternating colored lines instead of stippled overdraw.

Reimplement circ function to not use deprecated GLU (T49042). It also
leaves matrix stack untouched.

Remove unused circf function.
2016-08-08 03:17:24 -04:00
6c65e5a00c GPU: bind builtin shader for immediate mode
immBindBuiltinProgram extends Gawain’s immBindProgram to use Blender’s
library of built-in shader programs.

It uses imm prefix instead of GPU_ so people won’t be tempted to call
GPU_unbind_program() afterward.

From my understanding, Apache code is not allowed to call GPL code, so
this function needs to be in the GPU lib.
2016-08-07 22:11:45 -04:00
8e99eec026 Gawain: immediate mode set uniforms for active program
Start simple with vec4 uniforms. Add more later.
2016-08-07 21:30:02 -04:00
11ffbfb36a Gawain: bind a shader for immediate mode
How to use:
1) set up vertex format
2) bind a shader
3) draw with immBegin … immEnd
4) unbind shader

TODO: expand this a little, so we can send uniform values to the bound
shader.
2016-08-07 01:35:42 -04:00
6fea42d677 Gawain: initialize & destroy immediate mode
TODO: make this work better with multiple OpenGL contexts
2016-08-07 01:30:45 -04:00
f27516839f fix simple 2D built-in shaders
Forgot the projection matrix.
2016-08-07 01:26:29 -04:00
0ea8430549 Gawain: legacy Mac VBO workarounds
glMapBufferRange is a wonderful function that doesn’t exist on GL < 3.0.

Use the APPLE_flush_buffer_range extension on Mac. It offers several of
glMapBufferRange’s benefits.

Use older “black arts” method to orphan VBOs when we are done with
them. In modern OpenGL this behavior is more obvious.

Add APPLE_flush_buffer_range to Mac requirements. Every GPU is
supported. T49012
2016-08-07 01:05:49 -04:00
e7f9614f07 Gawain: legacy OpenGL compatibility
Apple invented VAOs and exposes them via an extension in legacy GL.
Other platforms use at least GL 3.0 which has VAOs built in.

QUADS were removed from core profile but are useful for immediate-mode
drawing. We’ll have to implement our own QUAD drawing before switching
to core profile.
2016-08-07 01:05:49 -04:00
6b21d22c60 Gawain: fix VAO and VBO binds
Immediate mode no longer leaves its internals bound after use. Part of
transition from a simple prototype app to non-simple Blender, which has
lots of other parts using OpenGL.
2016-08-07 01:05:49 -04:00
a55c5dbcc4 Gawain: flesh out immediate mode
More ways to send values via immAttrib:
2D float vectors
3 & 4 component ubytes (for colors mostly)

New immVertex functions that act more like familiar glVertex. We’ll
find a balance between making this API convenient and keeping it small.
2f and 3f are enough for now.
2016-08-07 01:05:49 -04:00
3eae585791 Merge branch 'master' into blender2.8 2016-08-06 12:57:21 +02:00
9843921288 Merge branch 'master' into blender2.8
Conflicts:
	release/scripts/startup/bl_ui/properties_particle.py
	release/scripts/startup/bl_ui/properties_physics_cloth.py
	release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py
	release/scripts/startup/bl_ui/properties_physics_softbody.py
	source/blender/blenkernel/BKE_library.h
	source/blender/blenkernel/BKE_particle.h
	source/blender/blenkernel/intern/cloth.c
	source/blender/blenkernel/intern/library.c
	source/blender/blenkernel/intern/library_query.c
	source/blender/blenkernel/intern/particle_system.c
	source/blender/blenkernel/intern/scene.c
	source/blender/blenkernel/intern/softbody.c
	source/blender/blenloader/intern/readfile.c
	source/blender/blenloader/intern/versioning_270.c
	source/blender/editors/space_file/filesel.c
	source/blender/editors/space_outliner/outliner_intern.h
	source/blender/makesdna/DNA_ID.h
	source/blender/makesdna/DNA_object_force.h
	source/blender/makesdna/DNA_particle_types.h
	source/blender/makesrna/intern/rna_particle.c
	source/blender/makesrna/intern/rna_sculpt_paint.c
	source/blender/makesrna/intern/rna_smoke.c
	source/blender/makesrna/intern/rna_space.c
2016-08-06 12:45:03 +02:00
4571fdde0e OpenGL: transition to ARB FBOs, remove runtime checks
ARB_framebuffer_object replaces several related EXT extensions. The ARB
version pulls GL 3 FBO features into GL 2.1, useful for Mac platform.
Its functions and enums have no ARB suffix so transition to modern GL
will be seamless!

Extension is checked at startup, so is guaranteed to be true at runtime.

Part of T49012
2016-08-04 21:11:45 -04:00
58697444bb OpenGL: remove runtime check for EXT_gpu_shader4
It’s checked at startup, so is guaranteed to be true at runtime.

Part of T49012
2016-08-04 20:27:24 -04:00
32757d488f OpenGL: require EXT_gpu_shader4 & ARB_framebuffer_object on Mac
Mac’s OpenGL version is furthest away from our target of GL 3.2. This
commit brings Mac closer to other platforms, so that our shaders and
other code don’t diverge too much during development.

According to Apple’s OpenGL matrix these useful extensions are
available on all GPUs that will be able to run Blender 2.8.

Only checked in debug builds; we might need something more forceful.

Part of T49012
2016-08-04 20:25:47 -04:00
396dd82428 OpenGL: add simple shaders for 2D drawing
The first two of several new simple built-in shaders (will test these
before adding more). These are intended for the new immediate mode API,
but you can use them just like any built-in GPUShader.

Due to limitations on different platforms, shaders need to work with
GLSL versions 120, 130 and 150. Final Blender 2.8 will be pure #version
150.
2016-08-04 15:59:38 -04:00
797f1896fa OpenGL: immediate mode work-alike
Introducing an immediate mode drawing API that works with modern GL 3.2
core profile. I wrote and tested this using a core context on Mac.

This is part of the Gawain library which is Apache 2 licensed. Be very
careful not to pull other Blender code into these files.

Modifications for the Blender integration:
- prefix filenames to match rest of Blender’s GPU libs
- include GPU_glew.h instead of <OpenGL/gl3.h>
- disable thread-local vars until we figure out how best to do this
2016-08-04 15:36:20 -04:00
42d816a3d9 Blender 2.8 requires Mac OS 10.7 or later
MacOS 10.7 “Lion” was the first to implement OpenGL 3.2, which will be
required to run Blender 2.8.

Minimum OS version was unspecified before.
2016-08-04 03:13:20 -04:00
3d9cc4d3f1 support automatic GPU switching on Mac
First attempt. On my laptop (Intel + nVidia) Blender still switches to
nVidia at launch time.
2016-08-04 03:08:13 -04:00
b3cb7e2652 OpenGL: on Mac use legacy 2.1 or core 3.2
This implements Mac part of T49012.

Removed options for EGL, ES2, compatibility profile. None of these
exist on Mac platform.

Create a GL 3.2 core context when requested at build time. Old code
just pretended to support core profile.
2016-08-04 02:36:46 -04:00
0d1f0116fe OpenGL: Blender 2.8 on X11 requires GL 3.0
Implements the Linux part of T49012.

Simplify the options for context creation. No options for legacy GL or EGL or ES2. Select 3.2 CORE or COMPATIBILITY profile at build time.

If that fails, use a GL 3.0 context. This keeps Mesa supported while we work on full 3.2 core elsewhere in the code.
2016-08-03 17:58:24 -04:00
eccf5a6f81 OpenGL: Blender 2.8 on Windows requires GL 3.2
This greatly simplifies the options for context creation. No options for
legacy GL or EGL or ES2. Select CORE or COMPATIBILITY profile at build
time.

OpenGL 3.2 core profile will be our final target on all platforms. Until
all our code is ready we can use 3.2 compatibility profile or "legacy"
GL 2.1 on platforms that don't support compatibility profile.
2016-08-03 14:46:29 -04:00
251349c3c2 Merge branch 'master' into blender2.8 2016-07-28 12:00:58 +10:00
b1532493c2 Merge branch 'master' into blender2.8
Conflicts:
	source/blender/blenkernel/BKE_particle.h
	source/blender/blenkernel/intern/library.c
	source/blender/blenkernel/intern/particle.c
2016-07-25 15:07:17 +02:00
9186b9ae48 Merge branch 'master' into blender2.8 2016-07-18 19:25:44 +10:00
cfbd605567 Merge branch 'master' into blender2.8
Conflicts:
	intern/cycles/blender/addon/ui.py
	source/blender/blenkernel/BKE_particle.h
	source/blender/blenkernel/intern/dynamicpaint.c
	source/blender/blenkernel/intern/library.c
	source/blender/blenkernel/intern/object.c
	source/blender/blenkernel/intern/particle.c
	source/blender/blenkernel/intern/particle_distribute.c
	source/blender/blenkernel/intern/texture.c
	source/blender/editors/object/object_add.c
	source/blender/editors/object/object_relations.c
	source/blender/editors/physics/particle_edit.c
	source/blender/editors/physics/particle_object.c
	source/blender/editors/transform/transform_snap_object.c
2016-07-12 00:07:44 +02:00
71a57a37b2 Merge branch 'master' into blender2.8 2016-06-29 17:58:39 +02:00
f45fbf4b83 Merge branch 'master' into blender2.8 2016-06-29 17:45:16 +02:00
b90b02a480 Merge branch 'master' into blender2.8 2016-06-28 21:21:11 +10:00
5ae6a3b6b6 Merge branch 'master' into blender2.8 2016-06-28 21:10:11 +10:00
0f927d6eca Fix stupid merge error. 2016-06-27 16:07:38 +02:00
cbce7fef16 Merge branch 'master' into blender2.8
Conflicts:
	source/blender/blenkernel/intern/pointcache.c
	source/blender/makesrna/intern/rna_main_api.c
	source/blender/makesrna/intern/rna_particle.c
2016-06-27 15:59:01 +02:00
c2dc77983d Merge branch 'master' into blender2.8
No changes, just resolve conflicts.
2016-06-23 08:04:19 +10:00
3b0a5dd158 Merge branch 'master' into blender2.8 2016-06-23 07:52:58 +10:00
97ee7f8609 Merge branch 'master' into blender2.8
Conflicts:
	source/blender/blenloader/intern/readfile.c
	source/blender/editors/physics/particle_edit.c
2016-06-22 13:12:44 +02:00
48c58bd913 Merge branch 'master' into blender2.8 2016-06-21 12:14:49 +10:00
2cfff95ba3 Merge branch 'master' into blender2.8 2016-06-15 17:41:22 +10:00
eedcc4a6a0 Merge branch 'master' into blender2.8 2016-06-15 17:29:11 +10:00
5864269b2c Merge branch 'master' into blender2.8 2016-06-13 19:26:56 +10:00
46e1d85e61 Reduce conflicts be keeping same indent-level as master 2016-06-10 05:51:34 +10:00
c96d4ec644 Merge branch 'master' into blender2.8 2016-06-10 05:46:29 +10:00
a151806698 Merge branch 'master' into blender2.8 2016-06-10 05:17:33 +10:00
10d57f991b Merge branch 'master' into blender2.8 2016-06-10 05:15:06 +10:00
4b99958ca1 Remove particle expander
Having this caused buffer-overrun on startup
2016-06-07 18:27:31 +10:00
1e5735ab99 World space switch for BI nodes.
At the moment light shading in Blender is produced in viewspace. Apparently, that's why
shader nodes work with normals in camera space. But it is not convenient for artists.
The more convenient approach is implemented in Cycles where normals are represented in world space.
Blend4Web Team designed the engine keeping in mind shader parameters readability,
so normals are interpreted in world space as well. And now our users have to use some tweaks, like
empty node group with the name "Replace", which is replacing one input by another on the engine side
(replacing working configuration in Blender Viewport by the configuration that has the same behavior in the engine).

This patch adds the ability to switch to world space for normals and lamp vector in BI and Viewport.
This patch is very important to us and we crave to see this patch in Blender 2.7 because
it will significantly simplify Blend4Web material creation workflow.

{F315547}

{F315548}

Reviewers: campbellbarton, brecht

Reviewed By: brecht

Subscribers: homyachetser, Evgeny_Rodygin, AlexKowel, yurikovelenov

Differential Revision: https://developer.blender.org/D2046
2016-06-07 10:21:55 +02:00
5750549f6a Cleanup: warnings 2016-06-07 18:16:03 +10:00
ed6f86a510 Merge branch 'master' into blender2.8 2016-06-07 18:06:46 +10:00
24d29f2e50 Merge branch 'master' into blender2.8
Conflicts:
	source/blender/blenkernel/intern/particle.c
	source/blender/editors/transform/transform_snap_object.c
2016-06-07 09:59:26 +02:00
11af9e9a5b Merge branch 'master' into blender2.8
Conflicts:
	intern/cycles/blender/blender_curves.cpp
	intern/cycles/blender/blender_particles.cpp
	source/blender/depsgraph/intern/builder/deg_builder_relations.h
	source/blender/depsgraph/intern/depsgraph_build.cc
2016-06-01 14:34:11 +02:00
faec430914 Merge branch 'master' into blender2.8
Conflicts:
	intern/cycles/blender/blender_curves.cpp
	source/blender/blenkernel/intern/dynamicpaint.c
	source/blender/blenkernel/intern/particle.c
	source/blender/blenloader/intern/versioning_270.c
	source/blender/editors/physics/particle_edit.c
	source/blender/editors/transform/transform_snap_object.c
	source/blender/editors/util/undo.c
	source/blender/makesrna/intern/rna_object_force.c
2016-05-24 16:48:10 +02:00
f85745b17b Flat shading for basic shader
The purpose of the patch is to replace deprecated  glShadeModel.

To decrease glShadeModel calls I've set GL_SMOOTH by default

Reviewers: merwin, brecht

Reviewed By: brecht

Subscribers: blueprintrandom, Evgeny_Rodygin, AlexKowel, yurikovelenov

Differential Revision: https://developer.blender.org/D1958
2016-05-16 11:13:21 +03:00
b4a721af69 Merge branch 'temp_remove_pointcache' into blender2.8 2016-05-02 11:00:34 +02:00
5aa19be912 Merge branch 'temp_remove_particles' into blender2.8 2016-05-02 11:00:26 +02:00
735727e2b8 Removed DNA for point caches. 2016-04-30 14:20:13 +02:00
ac30a04b27 Removed point cache blenkernel code. 2016-04-29 15:03:58 +02:00
181d095f50 Removed PointCache RNA struct definition and uses. 2016-04-29 11:07:11 +02:00
ceb452bc9d Removed point cache operators. 2016-04-29 10:44:09 +02:00
c3863650cc Removed UI for point cache users. 2016-04-28 18:38:10 +02:00
1f723603c8 Merge branch 'master' into temp_remove_particles 2016-04-28 17:33:19 +02:00
3632c4997f Merge branch 'master' into temp_remove_particles 2016-04-20 16:25:16 +02:00
773efb506a Removed particle sync code from Cycles.
Note that this only removes the actual dependencies of Cycles on the
particle code in Blender, but not the internal "particle" definition
or the curve type handling inside Cycles. These structures may be in need
of some improvement themselves, but that is out of scope here.
2016-04-20 11:59:02 +02:00
ba279efbdb Removed the ND_PARTICLE notifier and outliner particle elements. 2016-04-16 17:27:49 +02:00
9465d3decf Removed the particle context of property buttons space. 2016-04-16 17:17:31 +02:00
ecb695ccc8 Removed tool settings for particle edit mode. 2016-04-16 14:26:09 +02:00
cd0ec340c4 Removed remaining uses of the particle edit mode flag. 2016-04-16 12:39:41 +02:00
15c8d095e5 Removed the Main.particle list, used for ParticleSettings ID blocks.
There were still some type-agnostic uses as well, owing to the generic
ListBase type.
2016-04-16 12:28:29 +02:00
7c57822afa Fixed some minor errors in game engine and player. 2016-04-16 12:11:34 +02:00
c92b6f1de6 Removed the translation context for particle settings. 2016-04-16 11:32:45 +02:00
d30b942f07 Removed the ID_PA code used for ParticleSettings. 2016-04-16 11:29:28 +02:00
df2e543d44 Removed some unused declarations for boids code. 2016-04-16 11:11:39 +02:00
fbed29a246 Merge branch 'master' into temp_remove_particles 2016-04-15 17:59:54 +02:00
987bb50a74 Removed remaining use of pointers to particle types as well as boids headers. 2016-04-13 18:10:23 +02:00
d474ed9b88 Partially revert 82ec9c87a7, to add back point cache operators.
Eventually point cache will also be replaced, but it can be kept working at first even without particles.
2016-04-13 16:58:44 +02:00
664f5b8c06 Removed particle DNA. 2016-04-13 13:41:11 +02:00
d8d49befa0 Removed particle system and particle instance modifiers. 2016-04-13 11:45:15 +02:00
d47173c8ca Removed blenkernel particle code. 2016-04-13 10:49:39 +02:00
cf6cb3dcaf Removed most particle system code from RNA. 2016-04-12 18:26:19 +02:00
bcd12bf64d Removed most partical-related code from UI scripts.
There are a lot of cases here where deciding for removal is a bit tricky.
Many features have options for "use_particles" and similar settings. Only
features which actually store a particle object reference or work on actual
particle data have been removed.
2016-04-12 16:28:00 +02:00
29a792a75b Removed all direct uses of BKE_particle.h and DNA_particle_types.h from source/blender/editors. 2016-04-12 13:04:31 +02:00
cc468c1974 Removed remnants of particle draw code. 2016-04-12 12:18:38 +02:00
82ec9c87a7 Removed particle operators API and point cache operators. 2016-04-12 11:47:08 +02:00
5a783144e2 Removed particle operators from editors/physics/. 2016-04-12 11:25:40 +02:00
697 changed files with 39809 additions and 19407 deletions

View File

@@ -242,6 +242,8 @@ endif()
option(WITH_PLAYER "Build Player" OFF)
option(WITH_OPENCOLORIO "Enable OpenColorIO color management" ${_init_OPENCOLORIO})
option(WITH_CLAY_ENGINE "Enable New Clay engine (Breaks Mac and Intel compatibility)" ON)
# Compositor
option(WITH_COMPOSITOR "Enable the tile based nodal compositor" ON)
@@ -497,11 +499,10 @@ endif()
# We default options to whatever default standard in the current compiler.
if(CMAKE_COMPILER_IS_GNUCC AND (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "6.0") AND (NOT WITH_CXX11))
set(_c11_init ON)
set(_cxx11_init ON)
else()
set(_c11_init OFF)
set(_cxx11_init OFF)
endif()
set(_cxx11_init ON)
option(WITH_C11 "Build with C11 standard enabled, for development use only!" ${_c11_init})
mark_as_advanced(WITH_C11)
@@ -867,7 +868,7 @@ endif()
# linux only, not cached
set(WITH_BINRELOC OFF)
# MAXOSX only, set to avoid uninitialized
# MACOSX only, set to avoid uninitialized
set(EXETYPE "")
# C/C++ flags
@@ -1573,7 +1574,7 @@ if(WITH_CXX11)
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
# TODO(sergey): Do we want c++11 or gnu-c++11 here?
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif(MSVC12)
elseif(MSVC)
# Nothing special is needed, C++11 features are available by default.
else()
message(FATAL_ERROR "Compiler ${CMAKE_C_COMPILER_ID} is not supported for C++11 build yet")

View File

@@ -25,7 +25,7 @@
ARGS=$( \
getopt \
-o s:i:t:h \
--long source:,install:,tmp:,info:,threads:,help,show-deps,no-sudo,no-build,no-confirm,use-cxx11,\
--long source:,install:,tmp:,info:,threads:,help,show-deps,no-sudo,no-build,no-confirm,\
with-all,with-opencollada,\
ver-ocio:,ver-oiio:,ver-llvm:,ver-osl:,ver-osd:,ver-openvdb:,\
force-all,force-python,force-numpy,force-boost,\
@@ -104,11 +104,6 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
--no-confirm
Disable any interaction with user (suitable for automated run).
--use-cxx11
Build all libraries in cpp11 'mode' (will be mandatory soon in blender2.8 branch).
NOTE: If your compiler is gcc-6.0 or above, you probably *want* to enable this option (since it's default
standard starting from this version).
--with-all
By default, a number of optional and not-so-often needed libraries are not installed.
This option will try to install them, at the cost of potential conflicts (depending on
@@ -287,7 +282,7 @@ SUDO="sudo"
NO_BUILD=false
NO_CONFIRM=false
USE_CXX11=false
USE_CXX11=true # Mandatory in blender2.8
PYTHON_VERSION="3.5.2"
PYTHON_VERSION_MIN="3.5"
@@ -344,7 +339,7 @@ OSL_FORCE_REBUILD=false
OSL_SKIP=false
# OpenSubdiv needs to be compiled for now
OSD_VERSION="3.1.0"
OSD_VERSION="3.1.1"
OSD_VERSION_MIN=$OSD_VERSION
OSD_FORCE_BUILD=false
OSD_FORCE_REBUILD=false
@@ -499,9 +494,6 @@ while true; do
--no-confirm)
NO_CONFIRM=true; shift; continue
;;
--use-cxx11)
USE_CXX11=true; shift; continue
;;
--with-all)
WITH_ALL=true; shift; continue
;;
@@ -793,7 +785,7 @@ FFMPEG_SOURCE=( "http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2" )
CXXFLAGS_BACK=$CXXFLAGS
if [ "$USE_CXX11" = true ]; then
WARNING "You are trying to use c++11, this *should* go smoothely with any very recent distribution
WARNING "C++11 is now mandatory for blender2.8, this *should* go smoothly with any very recent distribution.
However, if you are experiencing linking errors (also when building Blender itself), please try the following:
* Re-run this script with `--build-all --force-all` options.
* Ensure your gcc version is at the very least 4.8, if possible you should really rather use gcc-5.1 or above.

View File

@@ -45,7 +45,7 @@ macro(BLENDER_SRC_GTEST_EX NAME SRC EXTRA_LIBS DO_ADD_TEST)
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${TESTS_OUTPUT_DIR}"
INCLUDE_DIRECTORIES "${TEST_INC}")
if(${DO_ADD_TEST})
add_test(${NAME}_test ${TESTS_OUTPUT_DIR}/${NAME}_test)
add_test(NAME ${NAME}_test COMMAND ${TESTS_OUTPUT_DIR}/${NAME}_test WORKING_DIRECTORY $<TARGET_FILE_DIR:blender>)
endif()
endif()
endmacro()

View File

@@ -416,14 +416,7 @@ function(setup_liblinks
target_link_libraries(${target} ${OPENCOLORIO_LIBRARIES})
endif()
if(WITH_OPENSUBDIV OR WITH_CYCLES_OPENSUBDIV)
if(WIN32 AND NOT UNIX)
file_list_suffix(OPENSUBDIV_LIBRARIES_DEBUG "${OPENSUBDIV_LIBRARIES}" "_d")
target_link_libraries_debug(${target} "${OPENSUBDIV_LIBRARIES_DEBUG}")
target_link_libraries_optimized(${target} "${OPENSUBDIV_LIBRARIES}")
unset(OPENSUBDIV_LIBRARIES_DEBUG)
else()
target_link_libraries(${target} ${OPENSUBDIV_LIBRARIES})
endif()
endif()
if(WITH_OPENVDB)
target_link_libraries(${target} ${OPENVDB_LIBRARIES} ${TBB_LIBRARIES})
@@ -573,6 +566,7 @@ function(SETUP_BLENDER_SORTED_LIBS)
bf_editor_space_userpref
bf_editor_space_view3d
bf_editor_space_clip
bf_editor_space_collections
bf_editor_transform
bf_editor_util
@@ -604,6 +598,7 @@ function(SETUP_BLENDER_SORTED_LIBS)
bf_modifiers
bf_bmesh
bf_gpu
bf_draw
bf_blenloader
bf_blenkernel
bf_physics

View File

@@ -446,10 +446,14 @@ if(WITH_MOD_CLOTH_ELTOPO)
endif()
if(WITH_OPENSUBDIV OR WITH_CYCLES_OPENSUBDIV)
set(OPENSUBDIV_INCLUDE_DIR ${LIBDIR}/opensubdiv/include)
set(OPENSUBDIV_LIBPATH ${LIBDIR}/opensubdiv/lib)
set(OPENSUBDIV_LIBRARIES ${OPENSUBDIV_LIBPATH}/osdCPU.lib ${OPENSUBDIV_LIBPATH}/osdGPU.lib)
find_package(OpenSubdiv)
set(OPENSUBDIV_INCLUDE_DIR ${LIBDIR}/opensubdiv/include)
set(OPENSUBDIV_LIBPATH ${LIBDIR}/opensubdiv/lib)
set(OPENSUBDIV_LIBRARIES optimized ${OPENSUBDIV_LIBPATH}/osdCPU.lib
optimized ${OPENSUBDIV_LIBPATH}/osdGPU.lib
debug ${OPENSUBDIV_LIBPATH}/osdCPU_d.lib
debug ${OPENSUBDIV_LIBPATH}/osdGPU_d.lib
)
windows_find_package(OpenSubdiv)
endif()
if(WITH_SDL)

View File

@@ -405,7 +405,7 @@ base class --- :class:`SCA_IObject`
.. note::
This attribute is experemental and may be removed (but probably wont be).
This attribute is experimental and may be removed (but probably wont be).
.. note::
@@ -419,7 +419,7 @@ base class --- :class:`SCA_IObject`
.. note::
This attribute is experemental and may be removed (but probably wont be).
This attribute is experimental and may be removed (but probably wont be).
.. note::
@@ -453,7 +453,7 @@ base class --- :class:`SCA_IObject`
.. attribute:: childrenRecursive
all children of this object including childrens children, (read-only).
all children of this object including children's children, (read-only).
:type: :class:`CListValue` of :class:`KX_GameObject`'s
@@ -536,7 +536,7 @@ base class --- :class:`SCA_IObject`
.. method:: getAxisVect(vect)
Returns the axis vector rotates by the objects worldspace orientation.
Returns the axis vector rotates by the object's worldspace orientation.
This is the equivalent of multiplying the vector by the orientation matrix.
:arg vect: a vector to align the axis.
@@ -596,7 +596,7 @@ base class --- :class:`SCA_IObject`
Gets the game object's linear velocity.
This method returns the game object's velocity through it's centre of mass, ie no angular velocity component.
This method returns the game object's velocity through it's center of mass, ie no angular velocity component.
:arg local:
* False: you get the "global" velocity ie: relative to world orientation.
@@ -609,7 +609,7 @@ base class --- :class:`SCA_IObject`
Sets the game object's linear velocity.
This method sets game object's velocity through it's centre of mass,
This method sets game object's velocity through it's center of mass,
ie no angular velocity component.
This requires a dynamic object.
@@ -814,7 +814,7 @@ base class --- :class:`SCA_IObject`
# do something
pass
The face paremeter determines the orientation of the normal.
The face parameter determines the orientation of the normal.
* 0 => hit normal is always oriented towards the ray origin (as if you casted the ray from outside)
* 1 => hit normal is the real face normal (only for mesh object, otherwise face has no effect)
@@ -911,7 +911,7 @@ base class --- :class:`SCA_IObject`
.. note::
The gameObject argument has an advantage that it can convert from a mesh with modifiers applied (such as subsurf).
The gameObject argument has an advantage that it can convert from a mesh with modifiers applied (such as the Subdivision Surface modifier).
.. warning::
@@ -919,7 +919,7 @@ base class --- :class:`SCA_IObject`
.. warning::
If the object is a part of a combound object it will fail (parent or child)
If the object is a part of a compound object it will fail (parent or child)
.. warning::

View File

@@ -12,7 +12,7 @@ contents: dir(bgl). A simple search on the web can point to more
than enough material to teach OpenGL programming, from books to many
collections of tutorials.
Here is a comprehensive `list of books <https://www.opengl.org/documentation/books/>`__ (non free).
Here is a comprehensive `list of books <https://www.khronos.org/developers/books/>`__ (non free).
The `arcsynthesis tutorials <https://web.archive.org/web/20150225192611/http://www.arcsynthesis.org/gltut/index.html>`__
is one of the best resources to learn modern OpenGL and
`g-truc <http://www.g-truc.net/post-opengl-samples.html#menu>`__
@@ -2067,7 +2067,7 @@ offers a set of extensive examples, including advanced features.
:arg length: Returns the length of the string returned in source (excluding the null terminator).
:type source: :class:`bgl.Buffer` char.
:arg source: Specifies an array of characters that is used to return the source code string.
.. function:: glShaderSource(shader, shader_string):

View File

@@ -204,7 +204,7 @@ Lets say we want to access the texture of a brush via Python, to adjust its ``co
- Start in the default scene and enable 'Sculpt' mode from the 3D-View header.
- From the toolbar expand the **Texture** panel and add a new texture.
*Notice the texture button its self doesn't have very useful links (you can check the tool-tips).*
*Notice the texture button its self doesn't have very useful links (you can check the tooltips).*
- The contrast setting isn't exposed in the sculpt toolbar, so view the texture in the properties panel...
- In the properties button select the Texture context.

View File

@@ -19,7 +19,7 @@ This is a typical Python environment so tutorials on how to write Python scripts
will work running the scripts in Blender too.
Blender provides the :mod:`bpy` module to the Python interpreter.
This module can be imported in a script and gives access to Blender data, classes, and functions.
Scripts that deal with Blender data will need to import this module.
Scripts that deal with Blender data will need to import this module.
Here is a simple example of moving a vertex of the object named **Cube**:
@@ -80,7 +80,7 @@ To run as modules:
Add-ons
------
-------
Some of Blenders functionality is best kept optional,
alongside scripts loaded at startup we have add-ons which are kept in their own directory ``scripts/addons``,
@@ -213,7 +213,7 @@ A simple Blender/Python module can look like this:
bpy.utils.register_class(SimpleOperator)
def unregister():
bpy.utils.unregister_class(SimpleOperator)
bpy.utils.unregister_class(SimpleOperator)
if __name__ == "__main__":
register()
@@ -327,7 +327,7 @@ Say you want to store material settings for a custom engine.
.. note::
*The class must be registered before being used in a property, failing to do so will raise an error:*
``ValueError: bpy_struct "Material" registration error: my_custom_props could not register``
@@ -429,4 +429,3 @@ Calling these operators:
>>> bpy.ops.object.operator_2()
Hello World OBJECT_OT_operator_2
{'FINISHED'}

View File

@@ -1565,9 +1565,9 @@ def pyrna2sphinx(basepath):
# operators
def write_ops():
API_BASEURL = "https://developer.blender.org/diffusion/B/browse/master/release/scripts/ "
API_BASEURL_ADDON = "https://developer.blender.org/diffusion/BA/"
API_BASEURL_ADDON_CONTRIB = "https://developer.blender.org/diffusion/BAC/"
API_BASEURL = "https://developer.blender.org/diffusion/B/browse/master/release/scripts "
API_BASEURL_ADDON = "https://developer.blender.org/diffusion/BA"
API_BASEURL_ADDON_CONTRIB = "https://developer.blender.org/diffusion/BAC"
op_modules = {}
for op in ops.values():
@@ -1632,13 +1632,9 @@ def write_sphinx_conf_py(basepath):
file = open(filepath, "w", encoding="utf-8")
fw = file.write
fw("import sys, os\n")
fw("\n")
fw("extensions = ['sphinx.ext.intersphinx']\n")
fw("\n")
fw("intersphinx_mapping = {'blender_manual': ('https://www.blender.org/manual/', None)}\n")
fw("\n")
fw("import sys, os\n\n")
fw("extensions = ['sphinx.ext.intersphinx']\n\n")
fw("intersphinx_mapping = {'blender_manual': ('https://docs.blender.org/manual/en/dev/', None)}\n\n")
fw("project = 'Blender'\n")
# fw("master_doc = 'index'\n")
fw("copyright = u'Blender Foundation'\n")
@@ -1655,12 +1651,16 @@ def write_sphinx_conf_py(basepath):
# not helpful since the source is generated, adds to upload size.
fw("html_copy_source = False\n")
fw("html_show_sphinx = False\n")
fw("html_split_index = True\n")
fw("\n")
# needed for latex, pdf gen
fw("latex_elements = {\n")
fw(" 'papersize': 'a4paper',\n")
fw("}\n\n")
fw("latex_documents = [ ('contents', 'contents.tex', 'Blender Index', 'Blender Foundation', 'manual'), ]\n")
fw("latex_paper_size = 'a4paper'\n")
file.close()

View File

@@ -41,9 +41,9 @@ import tempfile
import zipfile
DEFAULT_RSYNC_SERVER = "www.blender.org"
DEFAULT_RSYNC_SERVER = "docs.blender.org"
DEFAULT_RSYNC_ROOT = "/api/"
DEFAULT_SYMLINK_ROOT = "/data/www/vhosts/www.blender.org/api"
DEFAULT_SYMLINK_ROOT = "/data/www/vhosts/docs.blender.org/api"
def argparse_create():

View File

@@ -18,6 +18,8 @@ Local modifications:
- Applied some modifications from fork https://github.com/Nazg-Gul/gflags.git
(see https://github.com/gflags/gflags/pull/129)
- Avoid attemot of acquiring mutex lock in FlagRegistry::GlobalRegistry when
- Avoid attempt of acquiring mutex lock in FlagRegistry::GlobalRegistry when
doing static flags initialization. See d81dd2d in Blender repository.
- Made `google::{anonymous}::FlagValue::ValueSize() const` inlined, so it does
not trigger strict compiler warning.

View File

@@ -218,7 +218,7 @@ class FlagValue {
bool Equal(const FlagValue& x) const;
FlagValue* New() const; // creates a new one with default value
void CopyFrom(const FlagValue& x);
int ValueSize() const;
inline int ValueSize() const;
// Calls the given validate-fn on value_buffer_, and returns
// whatever it returns. But first casts validate_fn_proto to a
@@ -443,7 +443,7 @@ void FlagValue::CopyFrom(const FlagValue& x) {
}
}
int FlagValue::ValueSize() const {
inline int FlagValue::ValueSize() const {
if (type_ > FV_MAX_INDEX) {
assert(false); // unknown type
return 0;

View File

@@ -60,6 +60,10 @@
#include <string>
#include <vector>
#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1800)
# include <type_traits>
#endif
#include "gtest/gtest-message.h"
#include "gtest/internal/gtest-string.h"
#include "gtest/internal/gtest-filepath.h"
@@ -854,6 +858,7 @@ struct AddReference<T&> { typedef T& type; }; // NOLINT
template <typename From, typename To>
class ImplicitlyConvertible {
private:
#if !((__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1800))
// We need the following helper functions only for their types.
// They have no implementations.
@@ -874,6 +879,7 @@ class ImplicitlyConvertible {
// implicitly converted to type To.
static char Helper(To);
static char (&Helper(...))[2]; // NOLINT
#endif
// We have to put the 'public' section after the 'private' section,
// or MSVC refuses to compile the code.
@@ -883,6 +889,8 @@ class ImplicitlyConvertible {
// instantiation. The simplest workaround is to use its C++0x type traits
// functions (C++Builder 2009 and above only).
static const bool value = __is_convertible(From, To);
#elif (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1800)
static const bool value = std::is_convertible<From, To>::value;
#else
// MSVC warns about implicitly converting from double to int for
// possible loss of data, so we need to temporarily disable the

View File

@@ -74,7 +74,6 @@ elseif(CMAKE_COMPILER_IS_GNUCC)
if(CXX_HAS_AVX2)
set(CYCLES_AVX2_KERNEL_FLAGS "-ffast-math -msse -msse2 -msse3 -mssse3 -msse4.1 -mavx -mavx2 -mfma -mlzcnt -mbmi -mbmi2 -mf16c -mfpmath=sse")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffast-math")
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
check_cxx_compiler_flag(-msse CXX_HAS_SSE)
check_cxx_compiler_flag(-mavx CXX_HAS_AVX)
@@ -90,7 +89,6 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if(CXX_HAS_AVX2)
set(CYCLES_AVX2_KERNEL_FLAGS "-ffast-math -msse -msse2 -msse3 -mssse3 -msse4.1 -mavx -mavx2 -mfma -mlzcnt -mbmi -mbmi2 -mf16c")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffast-math")
endif()
if(CXX_HAS_SSE)

View File

@@ -523,7 +523,7 @@ static void xml_read_mesh(const XMLReadState& state, pugi::xml_node node)
/* we don't yet support arbitrary attributes, for now add vertex
* coordinates as generated coordinates if requested */
if (mesh->need_attribute(state.scene, ATTR_STD_GENERATED)) {
if(mesh->need_attribute(state.scene, ATTR_STD_GENERATED)) {
Attribute *attr = mesh->attributes.add(ATTR_STD_GENERATED);
memcpy(attr->data_float3(), mesh->verts.data(), sizeof(float3)*mesh->verts.size());
}

View File

@@ -23,11 +23,25 @@ bl_info = {
"location": "Info header, render engine menu",
"description": "Cycles Render Engine integration",
"warning": "",
"wiki_url": "https://www.blender.org/manual/render/cycles/index.html",
"wiki_url": "https://docs.blender.org/manual/en/dev/render/cycles/",
"tracker_url": "",
"support": 'OFFICIAL',
"category": "Render"}
# Support 'reload' case.
if "bpy" in locals():
import importlib
if "engine" in locals():
importlib.reload(engine)
if "version_update" in locals():
importlib.reload(version_update)
if "ui" in locals():
importlib.reload(ui)
if "properties" in locals():
importlib.reload(properties)
if "presets" in locals():
importlib.reload(presets)
import bpy
from . import (

View File

@@ -528,6 +528,12 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
description="Use special type BVH optimized for hair (uses more ram but renders faster)",
default=True,
)
cls.debug_bvh_time_steps = IntProperty(
name="BVH Time Steps",
description="Split BVH primitives by this number of time steps to speed up render time in cost of memory",
default=0,
min=0, max=16,
)
cls.tile_order = EnumProperty(
name="Tile Order",
description="Tile order for rendering",

View File

@@ -217,7 +217,7 @@ class CyclesRender_PT_sampling(CyclesButtonsPanel, Panel):
draw_samples_info(layout, context)
class CyclesRender_PT_geometery(CyclesButtonsPanel, Panel):
class CyclesRender_PT_geometry(CyclesButtonsPanel, Panel):
bl_label = "Geometry"
bl_options = {'DEFAULT_CLOSED'}
@@ -226,6 +226,7 @@ class CyclesRender_PT_geometery(CyclesButtonsPanel, Panel):
scene = context.scene
cscene = scene.cycles
ccscene = scene.cycles_curves
if cscene.feature_set == 'EXPERIMENTAL':
split = layout.split()
@@ -252,6 +253,25 @@ class CyclesRender_PT_geometery(CyclesButtonsPanel, Panel):
row.prop(cscene, "volume_step_size")
row.prop(cscene, "volume_max_steps")
layout.prop(ccscene, "use_curves", text="Use Hair")
col = layout.column()
col.active = ccscene.use_curves
col.prop(ccscene, "primitive", text="Primitive")
col.prop(ccscene, "shape", text="Shape")
if not (ccscene.primitive in {'CURVE_SEGMENTS', 'LINE_SEGMENTS'} and ccscene.shape == 'RIBBONS'):
col.prop(ccscene, "cull_backfacing", text="Cull back-faces")
if ccscene.primitive == 'TRIANGLES' and ccscene.shape == 'THICK':
col.prop(ccscene, "resolution", text="Resolution")
elif ccscene.primitive == 'CURVE_SEGMENTS':
col.prop(ccscene, "subdivisions", text="Curve subdivisions")
row = col.row()
row.prop(ccscene, "minimum_width", text="Min Pixels")
row.prop(ccscene, "maximum_width", text="Max Ext.")
class CyclesRender_PT_light_paths(CyclesButtonsPanel, Panel):
bl_label = "Light Paths"
@@ -412,6 +432,10 @@ class CyclesRender_PT_performance(CyclesButtonsPanel, Panel):
col.prop(cscene, "debug_use_spatial_splits")
col.prop(cscene, "debug_use_hair_bvh")
row = col.row()
row.active = not cscene.debug_use_spatial_splits
row.prop(cscene, "debug_bvh_time_steps")
class CyclesRender_PT_layer_options(CyclesButtonsPanel, Panel):
bl_label = "Layer"
@@ -767,10 +791,13 @@ class CyclesObject_PT_cycles_settings(CyclesButtonsPanel, Panel):
col = layout.column()
col.label(text="Performance:")
row = col.row()
row.active = scene.render.use_simplify and cscene.use_camera_cull
row.prop(cob, "use_camera_cull")
row.active = scene.render.use_simplify and cscene.use_distance_cull
row.prop(cob, "use_distance_cull")
sub = row.row()
sub.active = scene.render.use_simplify and cscene.use_camera_cull
sub.prop(cob, "use_camera_cull")
sub = row.row()
sub.active = scene.render.use_simplify and cscene.use_distance_cull
sub.prop(cob, "use_distance_cull")
class CYCLES_OT_use_shading_nodes(Operator):
@@ -1391,43 +1418,6 @@ class CyclesParticle_PT_textures(CyclesButtonsPanel, Panel):
layout.template_ID(slot, "texture", new="texture.new")
class CyclesRender_PT_CurveRendering(CyclesButtonsPanel, Panel):
bl_label = "Cycles Hair Rendering"
bl_context = "particle"
@classmethod
def poll(cls, context):
psys = context.particle_system
return CyclesButtonsPanel.poll(context) and psys and psys.settings.type == 'HAIR'
def draw_header(self, context):
ccscene = context.scene.cycles_curves
self.layout.prop(ccscene, "use_curves", text="")
def draw(self, context):
layout = self.layout
scene = context.scene
ccscene = scene.cycles_curves
layout.active = ccscene.use_curves
layout.prop(ccscene, "primitive", text="Primitive")
layout.prop(ccscene, "shape", text="Shape")
if not (ccscene.primitive in {'CURVE_SEGMENTS', 'LINE_SEGMENTS'} and ccscene.shape == 'RIBBONS'):
layout.prop(ccscene, "cull_backfacing", text="Cull back-faces")
if ccscene.primitive == 'TRIANGLES' and ccscene.shape == 'THICK':
layout.prop(ccscene, "resolution", text="Resolution")
elif ccscene.primitive == 'CURVE_SEGMENTS':
layout.prop(ccscene, "subdivisions", text="Curve subdivisions")
row = layout.row()
row.prop(ccscene, "minimum_width", text="Min Pixels")
row.prop(ccscene, "maximum_width", text="Max Ext.")
class CyclesRender_PT_bake(CyclesButtonsPanel, Panel):
bl_label = "Bake"
bl_context = "render"
@@ -1594,6 +1584,7 @@ class CyclesScene_PT_simplify(CyclesButtonsPanel, Panel):
row.prop(rd, "simplify_subdivision", text="Viewport")
row.prop(rd, "simplify_subdivision_render", text="Render")
col = layout.column(align=True)
col.label(text="Child Particles")
row = col.row(align=True)

View File

@@ -29,24 +29,6 @@
CCL_NAMESPACE_BEGIN
/* Utilities */
/* Hair curve functions */
void curveinterp_v3_v3v3v3v3(float3 *p, float3 *v1, float3 *v2, float3 *v3, float3 *v4, const float w[4]);
void interp_weights(float t, float data[4]);
float shaperadius(float shape, float root, float tip, float time);
void InterpolateKeySegments(int seg, int segno, int key, int curve, float3 *keyloc, float *time, ParticleCurveData *CData);
bool ObtainCacheParticleUV(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, ParticleCurveData *CData, bool background, int uv_num);
bool ObtainCacheParticleVcol(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, ParticleCurveData *CData, bool background, int vcol_num);
bool ObtainCacheParticleData(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, ParticleCurveData *CData, bool background);
void ExportCurveSegments(Scene *scene, Mesh *mesh, ParticleCurveData *CData);
void ExportCurveTrianglePlanes(Mesh *mesh, ParticleCurveData *CData,
float3 RotCam, bool is_ortho);
void ExportCurveTriangleGeometry(Mesh *mesh, ParticleCurveData *CData, int resolution);
void ExportCurveTriangleUV(ParticleCurveData *CData, int vert_offset, int resol, float3 *uvdata);
void ExportCurveTriangleVcol(ParticleCurveData *CData, int vert_offset, int resol, uchar4 *cdata);
ParticleCurveData::ParticleCurveData()
{
}
@@ -55,7 +37,7 @@ ParticleCurveData::~ParticleCurveData()
{
}
void interp_weights(float t, float data[4])
static void interp_weights(float t, float data[4])
{
/* Cardinal curve interpolation */
float t2 = t * t;
@@ -68,17 +50,19 @@ void interp_weights(float t, float data[4])
data[3] = fc * t3 - fc * t2;
}
void curveinterp_v3_v3v3v3v3(float3 *p, float3 *v1, float3 *v2, float3 *v3, float3 *v4, const float w[4])
static void curveinterp_v3_v3v3v3v3(float3 *p,
float3 *v1, float3 *v2, float3 *v3, float3 *v4,
const float w[4])
{
p->x = v1->x * w[0] + v2->x * w[1] + v3->x * w[2] + v4->x * w[3];
p->y = v1->y * w[0] + v2->y * w[1] + v3->y * w[2] + v4->y * w[3];
p->z = v1->z * w[0] + v2->z * w[1] + v3->z * w[2] + v4->z * w[3];
}
float shaperadius(float shape, float root, float tip, float time)
static float shaperadius(float shape, float root, float tip, float time)
{
float radius = 1.0f - time;
if(shape != 0.0f) {
if(shape < 0.0f)
radius = powf(radius, 1.0f + shape);
@@ -90,7 +74,13 @@ float shaperadius(float shape, float root, float tip, float time)
/* curve functions */
void InterpolateKeySegments(int seg, int segno, int key, int curve, float3 *keyloc, float *time, ParticleCurveData *CData)
static void InterpolateKeySegments(int seg,
int segno,
int key,
int curve,
float3 *keyloc,
float *time,
ParticleCurveData *CData)
{
float3 ckey_loc1 = CData->curvekey_co[key];
float3 ckey_loc2 = ckey_loc1;
@@ -119,7 +109,11 @@ void InterpolateKeySegments(int seg, int segno, int key, int curve, float3 *keyl
curveinterp_v3_v3v3v3v3(keyloc, &ckey_loc1, &ckey_loc2, &ckey_loc3, &ckey_loc4, t);
}
bool ObtainCacheParticleData(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, ParticleCurveData *CData, bool background)
static bool ObtainCacheParticleData(Mesh *mesh,
BL::Mesh *b_mesh,
BL::Object *b_ob,
ParticleCurveData *CData,
bool background)
{
int curvenum = 0;
int keyno = 0;
@@ -143,7 +137,7 @@ bool ObtainCacheParticleData(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, Par
int totparts = b_psys.particles.length();
int totchild = background ? b_psys.child_particles.length() : (int)((float)b_psys.child_particles.length() * (float)b_part.draw_percentage() / 100.0f);
int totcurves = totchild;
if(b_part.child_type() == 0 || totchild == 0)
totcurves += totparts;
@@ -161,7 +155,7 @@ bool ObtainCacheParticleData(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, Par
CData->psys_shader.push_back_slow(shader);
float radius = get_float(cpsys, "radius_scale") * 0.5f;
CData->psys_rootradius.push_back_slow(radius * get_float(cpsys, "root_width"));
CData->psys_tipradius.push_back_slow(radius * get_float(cpsys, "tip_width"));
CData->psys_shape.push_back_slow(get_float(cpsys, "shape"));
@@ -181,7 +175,7 @@ bool ObtainCacheParticleData(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, Par
for(; pa_no < totparts+totchild; pa_no++) {
int keynum = 0;
CData->curve_firstkey.push_back_slow(keyno);
float curve_length = 0.0f;
float3 pcKey;
for(int step_no = 0; step_no < ren_step; step_no++) {
@@ -213,7 +207,12 @@ bool ObtainCacheParticleData(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, Par
return true;
}
bool ObtainCacheParticleUV(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, ParticleCurveData *CData, bool background, int uv_num)
static bool ObtainCacheParticleUV(Mesh *mesh,
BL::Mesh *b_mesh,
BL::Object *b_ob,
ParticleCurveData *CData,
bool background,
int uv_num)
{
if(!(mesh && b_mesh && b_ob && CData))
return false;
@@ -231,7 +230,7 @@ bool ObtainCacheParticleUV(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, Parti
int totparts = b_psys.particles.length();
int totchild = background ? b_psys.child_particles.length() : (int)((float)b_psys.child_particles.length() * (float)b_part.draw_percentage() / 100.0f);
int totcurves = totchild;
if(b_part.child_type() == 0 || totchild == 0)
totcurves += totparts;
@@ -267,7 +266,12 @@ bool ObtainCacheParticleUV(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, Parti
return true;
}
bool ObtainCacheParticleVcol(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, ParticleCurveData *CData, bool background, int vcol_num)
static bool ObtainCacheParticleVcol(Mesh *mesh,
BL::Mesh *b_mesh,
BL::Object *b_ob,
ParticleCurveData *CData,
bool background,
int vcol_num)
{
if(!(mesh && b_mesh && b_ob && CData))
return false;
@@ -285,7 +289,7 @@ bool ObtainCacheParticleVcol(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, Par
int totparts = b_psys.particles.length();
int totchild = background ? b_psys.child_particles.length() : (int)((float)b_psys.child_particles.length() * (float)b_part.draw_percentage() / 100.0f);
int totcurves = totchild;
if(b_part.child_type() == 0 || totchild == 0)
totcurves += totparts;
@@ -333,16 +337,16 @@ static void set_resolution(BL::Object *b_ob, BL::Scene *scene, bool render)
}
}
void ExportCurveTrianglePlanes(Mesh *mesh, ParticleCurveData *CData,
float3 RotCam, bool is_ortho)
static void ExportCurveTrianglePlanes(Mesh *mesh, ParticleCurveData *CData,
float3 RotCam, bool is_ortho)
{
int vertexno = mesh->verts.size();
int vertexindex = vertexno;
int numverts = 0, numtris = 0;
/* compute and reserve size of arrays */
for(int sys = 0; sys < CData->psys_firstcurve.size() ; sys++) {
for(int curve = CData->psys_firstcurve[sys]; curve < CData->psys_firstcurve[sys] + CData->psys_curvenum[sys] ; curve++) {
for(int sys = 0; sys < CData->psys_firstcurve.size(); sys++) {
for(int curve = CData->psys_firstcurve[sys]; curve < CData->psys_firstcurve[sys] + CData->psys_curvenum[sys]; curve++) {
if(CData->curve_keynum[curve] <= 1 || CData->curve_length[curve] == 0.0f)
continue;
@@ -354,8 +358,8 @@ void ExportCurveTrianglePlanes(Mesh *mesh, ParticleCurveData *CData,
mesh->reserve_mesh(mesh->verts.size() + numverts, mesh->num_triangles() + numtris);
/* actually export */
for(int sys = 0; sys < CData->psys_firstcurve.size() ; sys++) {
for(int curve = CData->psys_firstcurve[sys]; curve < CData->psys_firstcurve[sys] + CData->psys_curvenum[sys] ; curve++) {
for(int sys = 0; sys < CData->psys_firstcurve.size(); sys++) {
for(int curve = CData->psys_firstcurve[sys]; curve < CData->psys_firstcurve[sys] + CData->psys_curvenum[sys]; curve++) {
if(CData->curve_keynum[curve] <= 1 || CData->curve_length[curve] == 0.0f)
continue;
@@ -380,7 +384,7 @@ void ExportCurveTrianglePlanes(Mesh *mesh, ParticleCurveData *CData,
if(curvekey == CData->curve_firstkey[curve] + CData->curve_keynum[curve] - 1)
v1 = CData->curvekey_co[curvekey] - CData->curvekey_co[max(curvekey - 1, CData->curve_firstkey[curve])];
else
else
v1 = CData->curvekey_co[curvekey + 1] - CData->curvekey_co[curvekey - 1];
time = CData->curvekey_time[curvekey]/CData->curve_length[curve];
@@ -416,15 +420,17 @@ void ExportCurveTrianglePlanes(Mesh *mesh, ParticleCurveData *CData,
/* texture coords still needed */
}
void ExportCurveTriangleGeometry(Mesh *mesh, ParticleCurveData *CData, int resolution)
static void ExportCurveTriangleGeometry(Mesh *mesh,
ParticleCurveData *CData,
int resolution)
{
int vertexno = mesh->verts.size();
int vertexindex = vertexno;
int numverts = 0, numtris = 0;
/* compute and reserve size of arrays */
for(int sys = 0; sys < CData->psys_firstcurve.size() ; sys++) {
for(int curve = CData->psys_firstcurve[sys]; curve < CData->psys_firstcurve[sys] + CData->psys_curvenum[sys] ; curve++) {
for(int sys = 0; sys < CData->psys_firstcurve.size(); sys++) {
for(int curve = CData->psys_firstcurve[sys]; curve < CData->psys_firstcurve[sys] + CData->psys_curvenum[sys]; curve++) {
if(CData->curve_keynum[curve] <= 1 || CData->curve_length[curve] == 0.0f)
continue;
@@ -436,8 +442,8 @@ void ExportCurveTriangleGeometry(Mesh *mesh, ParticleCurveData *CData, int resol
mesh->reserve_mesh(mesh->verts.size() + numverts, mesh->num_triangles() + numtris);
/* actually export */
for(int sys = 0; sys < CData->psys_firstcurve.size() ; sys++) {
for(int curve = CData->psys_firstcurve[sys]; curve < CData->psys_firstcurve[sys] + CData->psys_curvenum[sys] ; curve++) {
for(int sys = 0; sys < CData->psys_firstcurve.size(); sys++) {
for(int curve = CData->psys_firstcurve[sys]; curve < CData->psys_firstcurve[sys] + CData->psys_curvenum[sys]; curve++) {
if(CData->curve_keynum[curve] <= 1 || CData->curve_length[curve] == 0.0f)
continue;
@@ -548,7 +554,7 @@ void ExportCurveTriangleGeometry(Mesh *mesh, ParticleCurveData *CData, int resol
/* texture coords still needed */
}
void ExportCurveSegments(Scene *scene, Mesh *mesh, ParticleCurveData *CData)
static void ExportCurveSegments(Scene *scene, Mesh *mesh, ParticleCurveData *CData)
{
int num_keys = 0;
int num_curves = 0;
@@ -557,13 +563,13 @@ void ExportCurveSegments(Scene *scene, Mesh *mesh, ParticleCurveData *CData)
return;
Attribute *attr_intercept = NULL;
if(mesh->need_attribute(scene, ATTR_STD_CURVE_INTERCEPT))
attr_intercept = mesh->curve_attributes.add(ATTR_STD_CURVE_INTERCEPT);
/* compute and reserve size of arrays */
for(int sys = 0; sys < CData->psys_firstcurve.size() ; sys++) {
for(int curve = CData->psys_firstcurve[sys]; curve < CData->psys_firstcurve[sys] + CData->psys_curvenum[sys] ; curve++) {
for(int sys = 0; sys < CData->psys_firstcurve.size(); sys++) {
for(int curve = CData->psys_firstcurve[sys]; curve < CData->psys_firstcurve[sys] + CData->psys_curvenum[sys]; curve++) {
if(CData->curve_keynum[curve] <= 1 || CData->curve_length[curve] == 0.0f)
continue;
@@ -582,8 +588,8 @@ void ExportCurveSegments(Scene *scene, Mesh *mesh, ParticleCurveData *CData)
num_curves = 0;
/* actually export */
for(int sys = 0; sys < CData->psys_firstcurve.size() ; sys++) {
for(int curve = CData->psys_firstcurve[sys]; curve < CData->psys_firstcurve[sys] + CData->psys_curvenum[sys] ; curve++) {
for(int sys = 0; sys < CData->psys_firstcurve.size(); sys++) {
for(int curve = CData->psys_firstcurve[sys]; curve < CData->psys_firstcurve[sys] + CData->psys_curvenum[sys]; curve++) {
if(CData->curve_keynum[curve] <= 1 || CData->curve_length[curve] == 0.0f)
continue;
@@ -677,8 +683,13 @@ static void ExportCurveSegmentsMotion(Mesh *mesh, ParticleCurveData *CData, int
/* in case of new attribute, we verify if there really was any motion */
if(new_attribute) {
if(i != numkeys || !have_motion) {
/* no motion, remove attributes again */
VLOG(1) << "No motion, removing attribute";
/* No motion or hair "topology" changed, remove attributes again. */
if(i != numkeys) {
VLOG(1) << "Hair topology changed, removing attribute.";
}
else {
VLOG(1) << "No motion, removing attribute.";
}
mesh->curve_attributes.remove(ATTR_STD_MOTION_VERTEX_POSITION);
}
else if(time_index > 0) {
@@ -698,7 +709,10 @@ static void ExportCurveSegmentsMotion(Mesh *mesh, ParticleCurveData *CData, int
}
}
void ExportCurveTriangleUV(ParticleCurveData *CData, int vert_offset, int resol, float3 *uvdata)
static void ExportCurveTriangleUV(ParticleCurveData *CData,
int vert_offset,
int resol,
float3 *uvdata)
{
if(uvdata == NULL)
return;
@@ -708,8 +722,8 @@ void ExportCurveTriangleUV(ParticleCurveData *CData, int vert_offset, int resol,
int vertexindex = vert_offset;
for(int sys = 0; sys < CData->psys_firstcurve.size() ; sys++) {
for(int curve = CData->psys_firstcurve[sys]; curve < CData->psys_firstcurve[sys] + CData->psys_curvenum[sys] ; curve++) {
for(int sys = 0; sys < CData->psys_firstcurve.size(); sys++) {
for(int curve = CData->psys_firstcurve[sys]; curve < CData->psys_firstcurve[sys] + CData->psys_curvenum[sys]; curve++) {
if(CData->curve_keynum[curve] <= 1 || CData->curve_length[curve] == 0.0f)
continue;
@@ -743,15 +757,18 @@ void ExportCurveTriangleUV(ParticleCurveData *CData, int vert_offset, int resol,
}
}
void ExportCurveTriangleVcol(ParticleCurveData *CData, int vert_offset, int resol, uchar4 *cdata)
static void ExportCurveTriangleVcol(ParticleCurveData *CData,
int vert_offset,
int resol,
uchar4 *cdata)
{
if(cdata == NULL)
return;
int vertexindex = vert_offset;
for(int sys = 0; sys < CData->psys_firstcurve.size() ; sys++) {
for(int curve = CData->psys_firstcurve[sys]; curve < CData->psys_firstcurve[sys] + CData->psys_curvenum[sys] ; curve++) {
for(int sys = 0; sys < CData->psys_firstcurve.size(); sys++) {
for(int curve = CData->psys_firstcurve[sys]; curve < CData->psys_firstcurve[sys] + CData->psys_curvenum[sys]; curve++) {
if(CData->curve_keynum[curve] <= 1 || CData->curve_length[curve] == 0.0f)
continue;
@@ -1044,4 +1061,3 @@ void BlenderSync::sync_curves(Mesh *mesh,
}
CCL_NAMESPACE_END

View File

@@ -597,8 +597,8 @@ static void create_mesh(Scene *scene,
Mesh *mesh,
BL::Mesh& b_mesh,
const vector<Shader*>& used_shaders,
bool subdivision=false,
bool subdivide_uvs=true)
bool subdivision = false,
bool subdivide_uvs = true)
{
/* count vertices and faces */
int numverts = b_mesh.vertices.length();
@@ -671,28 +671,10 @@ static void create_mesh(Scene *scene,
int shader = clamp(f->material_index(), 0, used_shaders.size()-1);
bool smooth = f->use_smooth() || use_loop_normals;
/* split vertices if normal is different
/* Create triangles.
*
* note all vertex attributes must have been set here so we can split
* and copy attributes in split_vertex without remapping later */
if(use_loop_normals) {
BL::Array<float, 12> loop_normals = f->split_normals();
for(int i = 0; i < n; i++) {
float3 loop_N = make_float3(loop_normals[i * 3], loop_normals[i * 3 + 1], loop_normals[i * 3 + 2]);
if(N[vi[i]] != loop_N) {
int new_vi = mesh->split_vertex(vi[i]);
/* set new normal and vertex index */
N = attr_N->data_float3();
N[new_vi] = loop_N;
vi[i] = new_vi;
}
}
}
/* create triangles */
* NOTE: Autosmooth is already taken care about.
*/
if(n == 4) {
if(is_zero(cross(mesh->verts[vi[1]] - mesh->verts[vi[0]], mesh->verts[vi[2]] - mesh->verts[vi[0]])) ||
is_zero(cross(mesh->verts[vi[2]] - mesh->verts[vi[0]], mesh->verts[vi[3]] - mesh->verts[vi[0]])))
@@ -724,24 +706,8 @@ static void create_mesh(Scene *scene,
vi.reserve(n);
for(int i = 0; i < n; i++) {
/* NOTE: Autosmooth is already taken care about. */
vi[i] = b_mesh.loops[p->loop_start() + i].vertex_index();
/* split vertices if normal is different
*
* note all vertex attributes must have been set here so we can split
* and copy attributes in split_vertex without remapping later */
if(use_loop_normals) {
float3 loop_N = get_float3(b_mesh.loops[p->loop_start() + i].normal());
if(N[vi[i]] != loop_N) {
int new_vi = mesh->split_vertex(vi[i]);
/* set new normal and vertex index */
N = attr_N->data_float3();
N[new_vi] = loop_N;
vi[i] = new_vi;
}
}
}
/* create subd faces */
@@ -961,7 +927,20 @@ Mesh *BlenderSync::sync_mesh(BL::Object& b_ob,
mesh->subdivision_type = object_subdivision_type(b_ob, preview, experimental);
BL::Mesh b_mesh = object_to_mesh(b_data, b_ob, b_scene, true, !preview, need_undeformed, mesh->subdivision_type);
/* Disable adaptive subdivision while baking as the baking system
* currently doesnt support the topology and will crash.
*/
if(scene->bake_manager->get_baking()) {
mesh->subdivision_type = Mesh::SUBDIVISION_NONE;
}
BL::Mesh b_mesh = object_to_mesh(b_data,
b_ob,
b_scene,
true,
!preview,
need_undeformed,
mesh->subdivision_type);
if(b_mesh) {
if(render_layer.use_surfaces && !hide_tris) {
@@ -1086,7 +1065,13 @@ void BlenderSync::sync_mesh_motion(BL::Object& b_ob,
if(ccl::BKE_object_is_deform_modified(b_ob, b_scene, preview)) {
/* get derived mesh */
b_mesh = object_to_mesh(b_data, b_ob, b_scene, true, !preview, false, false);
b_mesh = object_to_mesh(b_data,
b_ob,
b_scene,
true,
!preview,
false,
Mesh::SUBDIVISION_NONE);
}
if(!b_mesh) {
@@ -1157,10 +1142,12 @@ void BlenderSync::sync_mesh_motion(BL::Object& b_ob,
{
/* no motion, remove attributes again */
if(b_mesh.vertices.length() != numverts) {
VLOG(1) << "Topology differs, disabling motion blur.";
VLOG(1) << "Topology differs, disabling motion blur for object "
<< b_ob.name();
}
else {
VLOG(1) << "No actual deformation motion for object " << b_ob.name();
VLOG(1) << "No actual deformation motion for object "
<< b_ob.name();
}
mesh->attributes.remove(ATTR_STD_MOTION_VERTEX_POSITION);
if(attr_mN)

View File

@@ -43,7 +43,7 @@ BlenderObjectCulling::BlenderObjectCulling(Scene *scene, BL::Scene& b_scene)
camera_cull_margin_ = get_float(cscene, "camera_cull_margin");
distance_cull_margin_ = get_float(cscene, "distance_cull_margin");
if (distance_cull_margin_ == 0.0f) {
if(distance_cull_margin_ == 0.0f) {
use_scene_distance_cull_ = false;
}
}

View File

@@ -305,12 +305,16 @@ static PassType get_pass_type(BL::RenderPass& b_pass)
#ifdef WITH_CYCLES_DEBUG
case BL::RenderPass::type_DEBUG:
{
if(b_pass.debug_type() == BL::RenderPass::debug_type_BVH_TRAVERSAL_STEPS)
return PASS_BVH_TRAVERSAL_STEPS;
if(b_pass.debug_type() == BL::RenderPass::debug_type_BVH_TRAVERSED_INSTANCES)
return PASS_BVH_TRAVERSED_INSTANCES;
if(b_pass.debug_type() == BL::RenderPass::debug_type_RAY_BOUNCES)
return PASS_RAY_BOUNCES;
switch(b_pass.debug_type()) {
case BL::RenderPass::debug_type_BVH_TRAVERSED_NODES:
return PASS_BVH_TRAVERSED_NODES;
case BL::RenderPass::debug_type_BVH_TRAVERSED_INSTANCES:
return PASS_BVH_TRAVERSED_INSTANCES;
case BL::RenderPass::debug_type_BVH_INTERSECTIONS:
return PASS_BVH_INTERSECTIONS;
case BL::RenderPass::debug_type_RAY_BOUNCES:
return PASS_RAY_BOUNCES;
}
break;
}
#endif
@@ -580,7 +584,7 @@ static void populate_bake_data(BakeData *data, const
BL::BakePixel bp = pixel_array;
int i;
for(i=0; i < num_pixels; i++) {
for(i = 0; i < num_pixels; i++) {
if(bp.object_id() == object_id) {
data->set(i, bp.primitive_id(), bp.uv(), bp.du_dx(), bp.du_dy(), bp.dv_dx(), bp.dv_dy());
} else {

View File

@@ -640,7 +640,8 @@ static ShaderNode *add_node(Scene *scene,
image->filename.string(),
image->builtin_data,
get_image_interpolation(b_image_node),
get_image_extension(b_image_node));
get_image_extension(b_image_node),
image->use_alpha);
}
}
image->color_space = (NodeImageColorSpace)b_image_node.color_space();
@@ -686,7 +687,8 @@ static ShaderNode *add_node(Scene *scene,
env->filename.string(),
env->builtin_data,
get_image_interpolation(b_env_node),
EXTENSION_REPEAT);
EXTENSION_REPEAT,
env->use_alpha);
}
}
env->color_space = (NodeImageColorSpace)b_env_node.color_space();
@@ -823,7 +825,8 @@ static ShaderNode *add_node(Scene *scene,
point_density->filename.string(),
point_density->builtin_data,
point_density->interpolation,
EXTENSION_CLIP);
EXTENSION_CLIP,
true);
}
node = point_density;

View File

@@ -498,6 +498,7 @@ SceneParams BlenderSync::get_scene_params(BL::Scene& b_scene,
params.use_bvh_spatial_split = RNA_boolean_get(&cscene, "debug_use_spatial_splits");
params.use_bvh_unaligned_nodes = RNA_boolean_get(&cscene, "debug_use_hair_bvh");
params.num_bvh_time_steps = RNA_int_get(&cscene, "debug_bvh_time_steps");
if(background && params.shadingsystem != SHADINGSYSTEM_OSL)
params.persistent_data = r.use_persistent_data();

View File

@@ -48,12 +48,12 @@ static inline BL::Mesh object_to_mesh(BL::BlendData& data,
bool apply_modifiers,
bool render,
bool calc_undeformed,
bool subdivision)
Mesh::SubdivisionType subdivision_type)
{
bool subsurf_mod_show_render;
bool subsurf_mod_show_viewport;
if(subdivision) {
if(subdivision_type != Mesh::SUBDIVISION_NONE) {
BL::Modifier subsurf_mod = object.modifiers[object.modifiers.length()-1];
subsurf_mod_show_render = subsurf_mod.show_render();
@@ -65,7 +65,7 @@ static inline BL::Mesh object_to_mesh(BL::BlendData& data,
BL::Mesh me = data.meshes.new_from_object(scene, object, apply_modifiers, (render)? 2: 1, false, calc_undeformed);
if(subdivision) {
if(subdivision_type != Mesh::SUBDIVISION_NONE) {
BL::Modifier subsurf_mod = object.modifiers[object.modifiers.length()-1];
subsurf_mod.show_render(subsurf_mod_show_render);
@@ -74,9 +74,14 @@ static inline BL::Mesh object_to_mesh(BL::BlendData& data,
if((bool)me) {
if(me.use_auto_smooth()) {
me.calc_normals_split();
if(subdivision_type == Mesh::SUBDIVISION_CATMULL_CLARK) {
me.calc_normals_split();
}
else {
me.split_faces();
}
}
if(!subdivision) {
if(subdivision_type == Mesh::SUBDIVISION_NONE) {
me.calc_tessface(true);
}
}

View File

@@ -845,6 +845,8 @@ void QBVH::pack_aligned_inner(const BVHStackEntry& e,
bounds,
child,
e.node->m_visibility,
e.node->m_time_from,
e.node->m_time_to,
num);
}
@@ -852,12 +854,17 @@ void QBVH::pack_aligned_node(int idx,
const BoundBox *bounds,
const int *child,
const uint visibility,
const float time_from,
const float time_to,
const int num)
{
float4 data[BVH_QNODE_SIZE];
memset(data, 0, sizeof(data));
data[0].x = __uint_as_float(visibility & ~PATH_RAY_NODE_UNALIGNED);
data[0].y = time_from;
data[0].z = time_to;
for(int i = 0; i < num; i++) {
float3 bb_min = bounds[i].min;
float3 bb_max = bounds[i].max;
@@ -908,6 +915,8 @@ void QBVH::pack_unaligned_inner(const BVHStackEntry& e,
bounds,
child,
e.node->m_visibility,
e.node->m_time_from,
e.node->m_time_to,
num);
}
@@ -916,12 +925,16 @@ void QBVH::pack_unaligned_node(int idx,
const BoundBox *bounds,
const int *child,
const uint visibility,
const float time_from,
const float time_to,
const int num)
{
float4 data[BVH_UNALIGNED_QNODE_SIZE];
memset(data, 0, sizeof(data));
data[0].x = __uint_as_float(visibility | PATH_RAY_NODE_UNALIGNED);
data[0].y = time_from;
data[0].z = time_to;
for(int i = 0; i < num; i++) {
Transform space = BVHUnaligned::compute_node_transform(
@@ -1207,6 +1220,8 @@ void QBVH::refit_node(int idx, bool leaf, BoundBox& bbox, uint& visibility)
child_bbox,
&c[0],
visibility,
0.0f,
1.0f,
4);
}
else {
@@ -1214,6 +1229,8 @@ void QBVH::refit_node(int idx, bool leaf, BoundBox& bbox, uint& visibility)
child_bbox,
&c[0],
visibility,
0.0f,
1.0f,
4);
}
}

View File

@@ -175,6 +175,8 @@ protected:
const BoundBox *bounds,
const int *child,
const uint visibility,
const float time_from,
const float time_to,
const int num);
void pack_unaligned_inner(const BVHStackEntry& e,
@@ -185,6 +187,8 @@ protected:
const BoundBox *bounds,
const int *child,
const uint visibility,
const float time_from,
const float time_to,
const int num);
/* refit */

View File

@@ -26,6 +26,7 @@
#include "scene.h"
#include "curves.h"
#include "util_algorithm.h"
#include "util_debug.h"
#include "util_foreach.h"
#include "util_logging.h"
@@ -112,81 +113,237 @@ BVHBuild::~BVHBuild()
/* Adding References */
void BVHBuild::add_reference_mesh(BoundBox& root, BoundBox& center, Mesh *mesh, int i)
void BVHBuild::add_reference_triangles(BoundBox& root, BoundBox& center, Mesh *mesh, int i)
{
if(params.primitive_mask & PRIMITIVE_ALL_TRIANGLE) {
Attribute *attr_mP = NULL;
if(mesh->has_motion_blur())
attr_mP = mesh->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
size_t num_triangles = mesh->num_triangles();
for(uint j = 0; j < num_triangles; j++) {
Mesh::Triangle t = mesh->get_triangle(j);
const Attribute *attr_mP = NULL;
if(mesh->has_motion_blur()) {
attr_mP = mesh->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
}
const size_t num_triangles = mesh->num_triangles();
for(uint j = 0; j < num_triangles; j++) {
Mesh::Triangle t = mesh->get_triangle(j);
const float3 *verts = &mesh->verts[0];
if(attr_mP == NULL) {
BoundBox bounds = BoundBox::empty;
PrimitiveType type = PRIMITIVE_TRIANGLE;
t.bounds_grow(&mesh->verts[0], bounds);
/* motion triangles */
if(attr_mP) {
size_t mesh_size = mesh->verts.size();
size_t steps = mesh->motion_steps - 1;
float3 *vert_steps = attr_mP->data_float3();
for(size_t i = 0; i < steps; i++)
t.bounds_grow(vert_steps + i*mesh_size, bounds);
type = PRIMITIVE_MOTION_TRIANGLE;
}
t.bounds_grow(verts, bounds);
if(bounds.valid()) {
references.push_back(BVHReference(bounds, j, i, type));
references.push_back(BVHReference(bounds,
j,
i,
PRIMITIVE_TRIANGLE));
root.grow(bounds);
center.grow(bounds.center2());
}
}
}
if(params.primitive_mask & PRIMITIVE_ALL_CURVE) {
Attribute *curve_attr_mP = NULL;
if(mesh->has_motion_blur())
curve_attr_mP = mesh->curve_attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
size_t num_curves = mesh->num_curves();
for(uint j = 0; j < num_curves; j++) {
Mesh::Curve curve = mesh->get_curve(j);
PrimitiveType type = PRIMITIVE_CURVE;
for(int k = 0; k < curve.num_keys - 1; k++) {
BoundBox bounds = BoundBox::empty;
curve.bounds_grow(k, &mesh->curve_keys[0], &mesh->curve_radius[0], bounds);
/* motion curve */
if(curve_attr_mP) {
size_t mesh_size = mesh->curve_keys.size();
size_t steps = mesh->motion_steps - 1;
float3 *key_steps = curve_attr_mP->data_float3();
for(size_t i = 0; i < steps; i++)
curve.bounds_grow(k, key_steps + i*mesh_size, &mesh->curve_radius[0], bounds);
type = PRIMITIVE_MOTION_CURVE;
}
else if(params.num_motion_triangle_steps == 0 || params.use_spatial_split) {
/* Motion triangles, simple case: single node for the whole
* primitive. Lowest memory footprint and faster BVH build but
* least optimal ray-tracing.
*/
/* TODO(sergey): Support motion steps for spatially split BVH. */
const size_t num_verts = mesh->verts.size();
const size_t num_steps = mesh->motion_steps;
const float3 *vert_steps = attr_mP->data_float3();
BoundBox bounds = BoundBox::empty;
t.bounds_grow(verts, bounds);
for(size_t step = 0; step < num_steps - 1; step++) {
t.bounds_grow(vert_steps + step*num_verts, bounds);
}
if(bounds.valid()) {
references.push_back(
BVHReference(bounds,
j,
i,
PRIMITIVE_MOTION_TRIANGLE));
root.grow(bounds);
center.grow(bounds.center2());
}
}
else {
/* Motion triangles, trace optimized case: we split triangle
* primitives into separate nodes for each of the time steps.
* This way we minimize overlap of neighbor curve primitives.
*/
const int num_bvh_steps = params.num_motion_curve_steps * 2 + 1;
const float num_bvh_steps_inv_1 = 1.0f / (num_bvh_steps - 1);
const size_t num_verts = mesh->verts.size();
const size_t num_steps = mesh->motion_steps;
const float3 *vert_steps = attr_mP->data_float3();
/* Calculate bounding box of the previous time step.
* Will be reused later to avoid duplicated work on
* calculating BVH time step boundbox.
*/
float3 prev_verts[3];
t.motion_verts(verts,
vert_steps,
num_verts,
num_steps,
0.0f,
prev_verts);
BoundBox prev_bounds = BoundBox::empty;
prev_bounds.grow(prev_verts[0]);
prev_bounds.grow(prev_verts[1]);
prev_bounds.grow(prev_verts[2]);
/* Create all primitive time steps, */
for(int bvh_step = 1; bvh_step < num_bvh_steps; ++bvh_step) {
const float curr_time = (float)(bvh_step) * num_bvh_steps_inv_1;
float3 curr_verts[3];
t.motion_verts(verts,
vert_steps,
num_verts,
num_steps,
curr_time,
curr_verts);
BoundBox curr_bounds = BoundBox::empty;
curr_bounds.grow(curr_verts[0]);
curr_bounds.grow(curr_verts[1]);
curr_bounds.grow(curr_verts[2]);
BoundBox bounds = prev_bounds;
bounds.grow(curr_bounds);
if(bounds.valid()) {
int packed_type = PRIMITIVE_PACK_SEGMENT(type, k);
const float prev_time = (float)(bvh_step - 1) * num_bvh_steps_inv_1;
references.push_back(
BVHReference(bounds,
j,
i,
PRIMITIVE_MOTION_TRIANGLE,
prev_time,
curr_time));
root.grow(bounds);
center.grow(bounds.center2());
}
/* Current time boundbox becomes previous one for the
* next time step.
*/
prev_bounds = curr_bounds;
}
}
}
}
void BVHBuild::add_reference_curves(BoundBox& root, BoundBox& center, Mesh *mesh, int i)
{
const Attribute *curve_attr_mP = NULL;
if(mesh->has_motion_blur()) {
curve_attr_mP = mesh->curve_attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
}
const size_t num_curves = mesh->num_curves();
for(uint j = 0; j < num_curves; j++) {
const Mesh::Curve curve = mesh->get_curve(j);
const float *curve_radius = &mesh->curve_radius[0];
for(int k = 0; k < curve.num_keys - 1; k++) {
if(curve_attr_mP == NULL) {
/* Really simple logic for static hair. */
BoundBox bounds = BoundBox::empty;
curve.bounds_grow(k, &mesh->curve_keys[0], curve_radius, bounds);
if(bounds.valid()) {
int packed_type = PRIMITIVE_PACK_SEGMENT(PRIMITIVE_CURVE, k);
references.push_back(BVHReference(bounds, j, i, packed_type));
root.grow(bounds);
center.grow(bounds.center2());
}
}
else if(params.num_motion_curve_steps == 0 || params.use_spatial_split) {
/* Simple case of motion curves: single node for the while
* shutter time. Lowest memory usage but less optimal
* rendering.
*/
/* TODO(sergey): Support motion steps for spatially split BVH. */
BoundBox bounds = BoundBox::empty;
curve.bounds_grow(k, &mesh->curve_keys[0], curve_radius, bounds);
const size_t num_keys = mesh->curve_keys.size();
const size_t num_steps = mesh->motion_steps;
const float3 *key_steps = curve_attr_mP->data_float3();
for(size_t step = 0; step < num_steps - 1; step++) {
curve.bounds_grow(k,
key_steps + step*num_keys,
curve_radius,
bounds);
}
if(bounds.valid()) {
int packed_type = PRIMITIVE_PACK_SEGMENT(PRIMITIVE_MOTION_CURVE, k);
references.push_back(BVHReference(bounds,
j,
i,
packed_type));
root.grow(bounds);
center.grow(bounds.center2());
}
}
else {
/* Motion curves, trace optimized case: we split curve keys
* primitives into separate nodes for each of the time steps.
* This way we minimize overlap of neighbor curve primitives.
*/
const int num_bvh_steps = params.num_motion_curve_steps * 2 + 1;
const float num_bvh_steps_inv_1 = 1.0f / (num_bvh_steps - 1);
const size_t num_steps = mesh->motion_steps;
const float3 *curve_keys = &mesh->curve_keys[0];
const float3 *key_steps = curve_attr_mP->data_float3();
const size_t num_keys = mesh->curve_keys.size();
/* Calculate bounding box of the previous time step.
* Will be reused later to avoid duplicated work on
* calculating BVH time step boundbox.
*/
float4 prev_keys[4];
curve.cardinal_motion_keys(curve_keys,
curve_radius,
key_steps,
num_keys,
num_steps,
0.0f,
k - 1, k, k + 1, k + 2,
prev_keys);
BoundBox prev_bounds = BoundBox::empty;
curve.bounds_grow(prev_keys, prev_bounds);
/* Create all primitive time steps, */
for(int bvh_step = 1; bvh_step < num_bvh_steps; ++bvh_step) {
const float curr_time = (float)(bvh_step) * num_bvh_steps_inv_1;
float4 curr_keys[4];
curve.cardinal_motion_keys(curve_keys,
curve_radius,
key_steps,
num_keys,
num_steps,
curr_time,
k - 1, k, k + 1, k + 2,
curr_keys);
BoundBox curr_bounds = BoundBox::empty;
curve.bounds_grow(curr_keys, curr_bounds);
BoundBox bounds = prev_bounds;
bounds.grow(curr_bounds);
if(bounds.valid()) {
const float prev_time = (float)(bvh_step - 1) * num_bvh_steps_inv_1;
int packed_type = PRIMITIVE_PACK_SEGMENT(PRIMITIVE_MOTION_CURVE, k);
references.push_back(BVHReference(bounds,
j,
i,
packed_type,
prev_time,
curr_time));
root.grow(bounds);
center.grow(bounds.center2());
}
/* Current time boundbox becomes previous one for the
* next time step.
*/
prev_bounds = curr_bounds;
}
}
}
}
}
void BVHBuild::add_reference_mesh(BoundBox& root, BoundBox& center, Mesh *mesh, int i)
{
if(params.primitive_mask & PRIMITIVE_ALL_TRIANGLE) {
add_reference_triangles(root, center, mesh, i);
}
if(params.primitive_mask & PRIMITIVE_ALL_CURVE) {
add_reference_curves(root, center, mesh, i);
}
}
void BVHBuild::add_reference_object(BoundBox& root, BoundBox& center, Object *ob, int i)
{
references.push_back(BVHReference(ob->bounds, -1, i, 0));
@@ -200,7 +357,7 @@ static size_t count_curve_segments(Mesh *mesh)
for(size_t i = 0; i < num_curves; i++)
num += mesh->get_curve(i).num_keys - 1;
return num;
}
@@ -344,6 +501,7 @@ BVHNode* BVHBuild::run()
else {
/*rotate(rootnode, 4, 5);*/
rootnode->update_visibility();
rootnode->update_time();
}
if(rootnode != NULL) {
VLOG(1) << "BVH build statistics:\n"
@@ -371,7 +529,7 @@ void BVHBuild::progress_update()
{
if(time_dt() - progress_start_time < 0.25)
return;
double progress_start = (double)progress_count/(double)progress_total;
double duplicates = (double)(progress_total - progress_original_total)/(double)progress_total;
@@ -379,7 +537,7 @@ void BVHBuild::progress_update()
progress_start * 100.0, duplicates * 100.0);
progress.set_substatus(msg);
progress_start_time = time_dt();
progress_start_time = time_dt();
}
void BVHBuild::thread_build_node(InnerNode *inner,
@@ -435,6 +593,7 @@ bool BVHBuild::range_within_max_leaf_size(const BVHRange& range,
return false;
size_t num_triangles = 0;
size_t num_motion_triangles = 0;
size_t num_curves = 0;
size_t num_motion_curves = 0;
@@ -445,13 +604,16 @@ bool BVHBuild::range_within_max_leaf_size(const BVHRange& range,
num_curves++;
if(ref.prim_type() & PRIMITIVE_MOTION_CURVE)
num_motion_curves++;
else if(ref.prim_type() & PRIMITIVE_ALL_TRIANGLE)
else if(ref.prim_type() & PRIMITIVE_TRIANGLE)
num_triangles++;
else if(ref.prim_type() & PRIMITIVE_MOTION_TRIANGLE)
num_motion_triangles++;
}
return (num_triangles < params.max_triangle_leaf_size) &&
(num_curves < params.max_curve_leaf_size) &&
(num_motion_curves < params.max_curve_leaf_size);
return (num_triangles <= params.max_triangle_leaf_size) &&
(num_motion_triangles <= params.max_motion_triangle_leaf_size) &&
(num_curves <= params.max_curve_leaf_size) &&
(num_motion_curves <= params.max_motion_curve_leaf_size);
}
/* multithreaded binning builder */
@@ -689,18 +851,24 @@ BVHNode *BVHBuild::create_object_leaf_nodes(const BVHReference *ref, int start,
prim_object[start] = ref->prim_object();
uint visibility = objects[ref->prim_object()]->visibility;
return new LeafNode(ref->bounds(), visibility, start, start+1);
BVHNode *leaf_node = new LeafNode(ref->bounds(), visibility, start, start+1);
leaf_node->m_time_from = ref->time_from();
leaf_node->m_time_to = ref->time_to();
return leaf_node;
}
else {
int mid = num/2;
BVHNode *leaf0 = create_object_leaf_nodes(ref, start, mid);
BVHNode *leaf1 = create_object_leaf_nodes(ref+mid, start+mid, num-mid);
BVHNode *leaf0 = create_object_leaf_nodes(ref, start, mid);
BVHNode *leaf1 = create_object_leaf_nodes(ref+mid, start+mid, num-mid);
BoundBox bounds = BoundBox::empty;
bounds.grow(leaf0->m_bounds);
bounds.grow(leaf1->m_bounds);
return new InnerNode(bounds, leaf0, leaf1);
BVHNode *inner_node = new InnerNode(bounds, leaf0, leaf1);
inner_node->m_time_from = min(leaf0->m_time_from, leaf1->m_time_from);
inner_node->m_time_to = max(leaf0->m_time_to, leaf1->m_time_to);
return inner_node;
}
}
@@ -804,6 +972,16 @@ BVHNode* BVHBuild::create_leaf_node(const BVHRange& range,
visibility[i],
start_index,
start_index + num);
if(true) {
float time_from = 1.0f, time_to = 0.0f;
for(int j = 0; j < num; ++j) {
const BVHReference &ref = p_ref[i][j];
time_from = min(time_from, ref.time_from());
time_to = max(time_to, ref.time_to());
}
leaf_node->m_time_from = time_from;
leaf_node->m_time_to = time_to;
}
if(alignment_found) {
/* Need to recalculate leaf bounds with new alignment. */
leaf_node->m_bounds = BoundBox::empty;
@@ -918,7 +1096,7 @@ BVHNode* BVHBuild::create_leaf_node(const BVHRange& range,
BVHNode *inner = new InnerNode(inner_bounds, leaves[1], leaves[2]);
return new InnerNode(range.bounds(), leaves[0], inner);
} else {
/* Shpuld be doing more branches if more primitive types added. */
/* Should be doing more branches if more primitive types added. */
assert(num_leaves <= 5);
BoundBox inner_bounds_a = merge(leaves[0]->m_bounds, leaves[1]->m_bounds);
BoundBox inner_bounds_b = merge(leaves[2]->m_bounds, leaves[3]->m_bounds);
@@ -951,7 +1129,7 @@ void BVHBuild::rotate(BVHNode *node, int max_depth)
/* nothing to rotate if we reached a leaf node. */
if(node->is_leaf() || max_depth < 0)
return;
InnerNode *parent = (InnerNode*)node;
/* rotate all children first */

View File

@@ -63,6 +63,8 @@ protected:
friend class BVHObjectBinning;
/* Adding references. */
void add_reference_triangles(BoundBox& root, BoundBox& center, Mesh *mesh, int i);
void add_reference_curves(BoundBox& root, BoundBox& center, Mesh *mesh, int i);
void add_reference_mesh(BoundBox& root, BoundBox& center, Mesh *mesh, int i);
void add_reference_object(BoundBox& root, BoundBox& center, Object *ob, int i);
void add_references(BVHRange& root);

View File

@@ -176,6 +176,19 @@ uint BVHNode::update_visibility()
return m_visibility;
}
void BVHNode::update_time()
{
if(!is_leaf()) {
InnerNode *inner = (InnerNode*)this;
BVHNode *child0 = inner->children[0];
BVHNode *child1 = inner->children[1];
child0->update_time();
child1->update_time();
m_time_from = min(child0->m_time_from, child1->m_time_from);
m_time_to = max(child0->m_time_to, child1->m_time_to);
}
}
/* Inner Node */
void InnerNode::print(int depth) const

View File

@@ -47,7 +47,9 @@ class BVHNode
{
public:
BVHNode() : m_is_unaligned(false),
m_aligned_space(NULL)
m_aligned_space(NULL),
m_time_from(0.0f),
m_time_to(1.0f)
{
}
@@ -91,12 +93,15 @@ public:
void deleteSubtree();
uint update_visibility();
void update_time();
bool m_is_unaligned;
// TODO(sergey): Can be stored as 3x3 matrix, but better to have some
// utilities and type defines in util_transform first.
Transform *m_aligned_space;
float m_time_from, m_time_to;
};
class InnerNode : public BVHNode

View File

@@ -43,7 +43,9 @@ public:
/* number of primitives in leaf */
int min_leaf_size;
int max_triangle_leaf_size;
int max_motion_triangle_leaf_size;
int max_curve_leaf_size;
int max_motion_curve_leaf_size;
/* object or mesh level bvh */
bool top_level;
@@ -59,6 +61,17 @@ public:
*/
bool use_unaligned_nodes;
/* Split time range to this number of steps and create leaf node for each
* of this time steps.
*
* Speeds up rendering of motion curve primitives in the cost of higher
* memory usage.
*/
int num_motion_curve_steps;
/* Same as above, but for triangle primitives. */
int num_motion_triangle_steps;
/* fixed parameters */
enum {
MAX_DEPTH = 64,
@@ -80,13 +93,17 @@ public:
min_leaf_size = 1;
max_triangle_leaf_size = 8;
max_curve_leaf_size = 2;
max_motion_triangle_leaf_size = 8;
max_curve_leaf_size = 1;
max_motion_curve_leaf_size = 4;
top_level = false;
use_qbvh = false;
use_unaligned_nodes = false;
primitive_mask = PRIMITIVE_ALL;
num_motion_curve_steps = 0;
}
/* SAH costs */
@@ -113,8 +130,15 @@ class BVHReference
public:
__forceinline BVHReference() {}
__forceinline BVHReference(const BoundBox& bounds_, int prim_index_, int prim_object_, int prim_type)
: rbounds(bounds_)
__forceinline BVHReference(const BoundBox& bounds_,
int prim_index_,
int prim_object_,
int prim_type,
float time_from = 0.0f,
float time_to = 1.0f)
: rbounds(bounds_),
time_from_(time_from),
time_to_(time_to)
{
rbounds.min.w = __int_as_float(prim_index_);
rbounds.max.w = __int_as_float(prim_object_);
@@ -125,6 +149,9 @@ public:
__forceinline int prim_index() const { return __float_as_int(rbounds.min.w); }
__forceinline int prim_object() const { return __float_as_int(rbounds.max.w); }
__forceinline int prim_type() const { return type; }
__forceinline float time_from() const { return time_from_; }
__forceinline float time_to() const { return time_to_; }
BVHReference& operator=(const BVHReference &arg) {
if(&arg != this) {
@@ -133,9 +160,11 @@ public:
return *this;
}
protected:
BoundBox rbounds;
uint type;
float time_from_, time_to_;
};
/* BVH Range

View File

@@ -130,7 +130,7 @@ public:
{
if(first_error) {
fprintf(stderr, "\nRefer to the Cycles GPU rendering documentation for possible solutions:\n");
fprintf(stderr, "http://www.blender.org/manual/render/cycles/gpu_rendering.html\n\n");
fprintf(stderr, "https://docs.blender.org/manual/en/dev/render/cycles/gpu_rendering.html\n\n");
first_error = false;
}
}

View File

@@ -164,6 +164,8 @@ set(SRC_GEOM_HEADERS
geom/geom_curve.h
geom/geom_motion_curve.h
geom/geom_motion_triangle.h
geom/geom_motion_triangle_intersect.h
geom/geom_motion_triangle_shader.h
geom/geom_object.h
geom/geom_patch.h
geom/geom_primitive.h

View File

@@ -187,7 +187,7 @@ bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
/* primitive intersection */
while(prim_addr < prim_addr2) {
kernel_assert(kernel_tex_fetch(__prim_type, prim_addr) == type);
kernel_assert((kernel_tex_fetch(__prim_type, prim_addr) & PRIMITIVE_ALL) == p_type);
bool hit;
@@ -222,6 +222,7 @@ bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
#if BVH_FEATURE(BVH_HAIR)
case PRIMITIVE_CURVE:
case PRIMITIVE_MOTION_CURVE: {
const uint curve_type = kernel_tex_fetch(__prim_type, prim_addr);
if(kernel_data.curve.curveflags & CURVE_KN_INTERPOLATE) {
hit = bvh_cardinal_curve_intersect(kg,
isect_array,
@@ -231,7 +232,7 @@ bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
object,
prim_addr,
ray->time,
type,
curve_type,
NULL,
0, 0);
}
@@ -244,7 +245,7 @@ bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
object,
prim_addr,
ray->time,
type,
curve_type,
NULL,
0, 0);
}

View File

@@ -72,7 +72,7 @@ void BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
ss_isect->num_hits = 0;
const int object_flag = kernel_tex_fetch(__object_flag, subsurface_object);
if(!(object_flag & SD_TRANSFORM_APPLIED)) {
if(!(object_flag & SD_OBJECT_TRANSFORM_APPLIED)) {
#if BVH_FEATURE(BVH_MOTION)
Transform ob_itfm;
bvh_instance_motion_push(kg,

View File

@@ -213,7 +213,7 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
--stack_ptr;
}
}
BVH_DEBUG_NEXT_STEP();
BVH_DEBUG_NEXT_NODE();
}
/* if node is leaf, fetch triangle list */
@@ -235,7 +235,7 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
switch(type & PRIMITIVE_ALL) {
case PRIMITIVE_TRIANGLE: {
for(; prim_addr < prim_addr2; prim_addr++) {
BVH_DEBUG_NEXT_STEP();
BVH_DEBUG_NEXT_INTERSECTION();
kernel_assert(kernel_tex_fetch(__prim_type, prim_addr) == type);
if(triangle_intersect(kg,
&isect_precalc,
@@ -264,7 +264,7 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
#if BVH_FEATURE(BVH_MOTION)
case PRIMITIVE_MOTION_TRIANGLE: {
for(; prim_addr < prim_addr2; prim_addr++) {
BVH_DEBUG_NEXT_STEP();
BVH_DEBUG_NEXT_INTERSECTION();
kernel_assert(kernel_tex_fetch(__prim_type, prim_addr) == type);
if(motion_triangle_intersect(kg,
isect,
@@ -296,8 +296,9 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
case PRIMITIVE_CURVE:
case PRIMITIVE_MOTION_CURVE: {
for(; prim_addr < prim_addr2; prim_addr++) {
BVH_DEBUG_NEXT_STEP();
kernel_assert(kernel_tex_fetch(__prim_type, prim_addr) == type);
BVH_DEBUG_NEXT_INTERSECTION();
const uint curve_type = kernel_tex_fetch(__prim_type, prim_addr);
kernel_assert((curve_type & PRIMITIVE_ALL) == (type & PRIMITIVE_ALL));
bool hit;
if(kernel_data.curve.curveflags & CURVE_KN_INTERPOLATE) {
hit = bvh_cardinal_curve_intersect(kg,
@@ -308,7 +309,7 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
object,
prim_addr,
ray->time,
type,
curve_type,
lcg_state,
difl,
extmax);
@@ -322,7 +323,7 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
object,
prim_addr,
ray->time,
type,
curve_type,
lcg_state,
difl,
extmax);

View File

@@ -50,12 +50,17 @@ CCL_NAMESPACE_BEGIN
#ifdef __KERNEL_DEBUG__
# define BVH_DEBUG_INIT() \
do { \
isect->num_traversal_steps = 0; \
isect->num_traversed_nodes = 0; \
isect->num_traversed_instances = 0; \
isect->num_intersections = 0; \
} while(0)
# define BVH_DEBUG_NEXT_STEP() \
# define BVH_DEBUG_NEXT_NODE() \
do { \
++isect->num_traversal_steps; \
++isect->num_traversed_nodes; \
} while(0)
# define BVH_DEBUG_NEXT_INTERSECTION() \
do { \
++isect->num_intersections; \
} while(0)
# define BVH_DEBUG_NEXT_INSTANCE() \
do { \
@@ -63,7 +68,8 @@ CCL_NAMESPACE_BEGIN
} while(0)
#else /* __KERNEL_DEBUG__ */
# define BVH_DEBUG_INIT()
# define BVH_DEBUG_NEXT_STEP()
# define BVH_DEBUG_NEXT_NODE()
# define BVH_DEBUG_NEXT_INTERSECTION()
# define BVH_DEBUG_NEXT_INSTANCE()
#endif /* __KERNEL_DEBUG__ */

View File

@@ -236,9 +236,7 @@ bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
/* instance push */
object = kernel_tex_fetch(__prim_object, -prim_addr-1);
int object_flag = kernel_tex_fetch(__object_flag, object);
if(object_flag & SD_OBJECT_HAS_VOLUME) {
# if BVH_FEATURE(BVH_MOTION)
bvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, &isect->t, &ob_itfm);
# else

View File

@@ -287,7 +287,6 @@ uint BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
/* instance push */
object = kernel_tex_fetch(__prim_object, -prim_addr-1);
int object_flag = kernel_tex_fetch(__object_flag, object);
if(object_flag & SD_OBJECT_HAS_VOLUME) {
# if BVH_FEATURE(BVH_MOTION)

View File

@@ -106,14 +106,20 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
while(node_addr >= 0 && node_addr != ENTRYPOINT_SENTINEL) {
float4 inodes = kernel_tex_fetch(__bvh_nodes, node_addr+0);
if(false
#ifdef __VISIBILITY_FLAG__
if((__float_as_uint(inodes.x) & PATH_RAY_SHADOW) == 0) {
|| ((__float_as_uint(inodes.x) & PATH_RAY_SHADOW) == 0)
#endif
#if BVH_FEATURE(BVH_MOTION)
|| UNLIKELY(ray->time < inodes.y)
|| UNLIKELY(ray->time > inodes.z)
#endif
) {
/* Pop. */
node_addr = traversal_stack[stack_ptr].addr;
--stack_ptr;
continue;
}
#endif
ssef dist;
int child_mask = NODE_INTERSECT(kg,
@@ -262,7 +268,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
/* Primitive intersection. */
while(prim_addr < prim_addr2) {
kernel_assert(kernel_tex_fetch(__prim_type, prim_addr) == type);
kernel_assert((kernel_tex_fetch(__prim_type, prim_addr) & PRIMITIVE_ALL) == p_type);
bool hit;
@@ -297,6 +303,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
#if BVH_FEATURE(BVH_HAIR)
case PRIMITIVE_CURVE:
case PRIMITIVE_MOTION_CURVE: {
const uint curve_type = kernel_tex_fetch(__prim_type, prim_addr);
if(kernel_data.curve.curveflags & CURVE_KN_INTERPOLATE) {
hit = bvh_cardinal_curve_intersect(kg,
isect_array,
@@ -306,7 +313,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
object,
prim_addr,
ray->time,
type,
curve_type,
NULL,
0, 0);
}
@@ -319,7 +326,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
object,
prim_addr,
ray->time,
type,
curve_type,
NULL,
0, 0);
}

View File

@@ -61,7 +61,7 @@ ccl_device void BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
ss_isect->num_hits = 0;
const int object_flag = kernel_tex_fetch(__object_flag, subsurface_object);
if(!(object_flag & SD_TRANSFORM_APPLIED)) {
if(!(object_flag & SD_OBJECT_TRANSFORM_APPLIED)) {
#if BVH_FEATURE(BVH_MOTION)
Transform ob_itfm;
bvh_instance_motion_push(kg,

View File

@@ -117,6 +117,10 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
float4 inodes = kernel_tex_fetch(__bvh_nodes, node_addr+0);
if(UNLIKELY(node_dist > isect->t)
#if BVH_FEATURE(BVH_MOTION)
|| UNLIKELY(ray->time < inodes.y)
|| UNLIKELY(ray->time > inodes.z)
#endif
#ifdef __VISIBILITY_FLAG__
|| (__float_as_uint(inodes.x) & visibility) == 0)
#endif
@@ -131,7 +135,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
int child_mask;
ssef dist;
BVH_DEBUG_NEXT_STEP();
BVH_DEBUG_NEXT_NODE();
#if BVH_FEATURE(BVH_HAIR_MINIMUM_WIDTH)
if(difl != 0.0f) {
@@ -326,7 +330,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
switch(type & PRIMITIVE_ALL) {
case PRIMITIVE_TRIANGLE: {
for(; prim_addr < prim_addr2; prim_addr++) {
BVH_DEBUG_NEXT_STEP();
BVH_DEBUG_NEXT_INTERSECTION();
kernel_assert(kernel_tex_fetch(__prim_type, prim_addr) == type);
if(triangle_intersect(kg,
&isect_precalc,
@@ -347,7 +351,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
#if BVH_FEATURE(BVH_MOTION)
case PRIMITIVE_MOTION_TRIANGLE: {
for(; prim_addr < prim_addr2; prim_addr++) {
BVH_DEBUG_NEXT_STEP();
BVH_DEBUG_NEXT_INTERSECTION();
kernel_assert(kernel_tex_fetch(__prim_type, prim_addr) == type);
if(motion_triangle_intersect(kg,
isect,
@@ -371,8 +375,9 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
case PRIMITIVE_CURVE:
case PRIMITIVE_MOTION_CURVE: {
for(; prim_addr < prim_addr2; prim_addr++) {
BVH_DEBUG_NEXT_STEP();
kernel_assert(kernel_tex_fetch(__prim_type, prim_addr) == type);
BVH_DEBUG_NEXT_INTERSECTION();
const uint curve_type = kernel_tex_fetch(__prim_type, prim_addr);
kernel_assert((curve_type & PRIMITIVE_ALL) == (type & PRIMITIVE_ALL));
bool hit;
if(kernel_data.curve.curveflags & CURVE_KN_INTERPOLATE) {
hit = bvh_cardinal_curve_intersect(kg,
@@ -383,7 +388,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
object,
prim_addr,
ray->time,
type,
curve_type,
lcg_state,
difl,
extmax);
@@ -397,7 +402,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
object,
prim_addr,
ray->time,
type,
curve_type,
lcg_state,
difl,
extmax);

View File

@@ -293,9 +293,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
/* Instance push. */
object = kernel_tex_fetch(__prim_object, -prim_addr-1);
int object_flag = kernel_tex_fetch(__object_flag, object);
if(object_flag & SD_OBJECT_HAS_VOLUME) {
# if BVH_FEATURE(BVH_MOTION)
bvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, &isect->t, &ob_itfm);
# else

View File

@@ -344,9 +344,7 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
/* Instance push. */
object = kernel_tex_fetch(__prim_object, -prim_addr-1);
int object_flag = kernel_tex_fetch(__object_flag, object);
if(object_flag & SD_OBJECT_HAS_VOLUME) {
# if BVH_FEATURE(BVH_MOTION)
bvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, &isect_t, &ob_itfm);
# else

View File

@@ -23,6 +23,8 @@
#include "geom_subd_triangle.h"
#include "geom_triangle_intersect.h"
#include "geom_motion_triangle.h"
#include "geom_motion_triangle_intersect.h"
#include "geom_motion_triangle_shader.h"
#include "geom_motion_curve.h"
#include "geom_curve.h"
#include "geom_volume.h"

View File

@@ -911,7 +911,7 @@ ccl_device_forceinline bool bvh_curve_intersect(KernelGlobals *kg, Intersection
# undef len3_squared
# undef len3
# undef dot3
# endif
#endif
}
ccl_device_inline float3 curvetangent(float t, float3 p0, float3 p1, float3 p2, float3 p3)

View File

@@ -50,12 +50,12 @@ ccl_device_inline int find_attribute_curve_motion(KernelGlobals *kg, int object,
ccl_device_inline void motion_curve_keys_for_step(KernelGlobals *kg, int offset, int numkeys, int numsteps, int step, int k0, int k1, float4 keys[2])
{
if(step == numsteps) {
/* center step: regular vertex location */
/* center step: regular key location */
keys[0] = kernel_tex_fetch(__curve_keys, k0);
keys[1] = kernel_tex_fetch(__curve_keys, k1);
}
else {
/* center step not stored in this array */
/* center step is not stored in this array */
if(step > numsteps)
step--;
@@ -97,14 +97,14 @@ ccl_device_inline void motion_curve_keys(KernelGlobals *kg, int object, int prim
ccl_device_inline void motion_cardinal_curve_keys_for_step(KernelGlobals *kg, int offset, int numkeys, int numsteps, int step, int k0, int k1, int k2, int k3, float4 keys[4])
{
if(step == numsteps) {
/* center step: regular vertex location */
/* center step: regular key location */
keys[0] = kernel_tex_fetch(__curve_keys, k0);
keys[1] = kernel_tex_fetch(__curve_keys, k1);
keys[2] = kernel_tex_fetch(__curve_keys, k2);
keys[3] = kernel_tex_fetch(__curve_keys, k3);
}
else {
/* center step not store in this array */
/* center step is not stored in this array */
if(step > numsteps)
step--;

View File

@@ -76,7 +76,7 @@ ccl_device_inline void motion_triangle_normals_for_step(KernelGlobals *kg, uint4
normals[2] = float4_to_float3(kernel_tex_fetch(__tri_vnormal, tri_vindex.z));
}
else {
/* center step not stored in this array */
/* center step is not stored in this array */
if(step > numsteps)
step--;
@@ -117,312 +117,4 @@ ccl_device_inline void motion_triangle_vertices(KernelGlobals *kg, int object, i
verts[2] = (1.0f - t)*verts[2] + t*next_verts[2];
}
/* Refine triangle intersection to more precise hit point. For rays that travel
* far the precision is often not so good, this reintersects the primitive from
* a closer distance. */
ccl_device_inline float3 motion_triangle_refine(KernelGlobals *kg, ShaderData *sd, const Intersection *isect, const Ray *ray, float3 verts[3])
{
float3 P = ray->P;
float3 D = ray->D;
float t = isect->t;
#ifdef __INTERSECTION_REFINE__
if(isect->object != OBJECT_NONE) {
if(UNLIKELY(t == 0.0f)) {
return P;
}
# ifdef __OBJECT_MOTION__
Transform tfm = ccl_fetch(sd, ob_itfm);
# else
Transform tfm = object_fetch_transform(kg, isect->object, OBJECT_INVERSE_TRANSFORM);
# endif
P = transform_point(&tfm, P);
D = transform_direction(&tfm, D*t);
D = normalize_len(D, &t);
}
P = P + D*t;
/* compute refined intersection distance */
const float3 e1 = verts[0] - verts[2];
const float3 e2 = verts[1] - verts[2];
const float3 s1 = cross(D, e2);
const float invdivisor = 1.0f/dot(s1, e1);
const float3 d = P - verts[2];
const float3 s2 = cross(d, e1);
float rt = dot(e2, s2)*invdivisor;
/* compute refined position */
P = P + D*rt;
if(isect->object != OBJECT_NONE) {
# ifdef __OBJECT_MOTION__
Transform tfm = ccl_fetch(sd, ob_tfm);
# else
Transform tfm = object_fetch_transform(kg, isect->object, OBJECT_TRANSFORM);
# endif
P = transform_point(&tfm, P);
}
return P;
#else
return P + D*t;
#endif
}
/* Same as above, except that isect->t is assumed to be in object space for instancing */
#ifdef __SUBSURFACE__
# if defined(__KERNEL_CUDA__) && (defined(i386) || defined(_M_IX86))
ccl_device_noinline
# else
ccl_device_inline
# endif
float3 motion_triangle_refine_subsurface(KernelGlobals *kg, ShaderData *sd, const Intersection *isect, const Ray *ray, float3 verts[3])
{
float3 P = ray->P;
float3 D = ray->D;
float t = isect->t;
# ifdef __INTERSECTION_REFINE__
if(isect->object != OBJECT_NONE) {
# ifdef __OBJECT_MOTION__
Transform tfm = ccl_fetch(sd, ob_itfm);
# else
Transform tfm = object_fetch_transform(kg, isect->object, OBJECT_INVERSE_TRANSFORM);
# endif
P = transform_point(&tfm, P);
D = transform_direction(&tfm, D);
D = normalize(D);
}
P = P + D*t;
/* compute refined intersection distance */
const float3 e1 = verts[0] - verts[2];
const float3 e2 = verts[1] - verts[2];
const float3 s1 = cross(D, e2);
const float invdivisor = 1.0f/dot(s1, e1);
const float3 d = P - verts[2];
const float3 s2 = cross(d, e1);
float rt = dot(e2, s2)*invdivisor;
P = P + D*rt;
if(isect->object != OBJECT_NONE) {
# ifdef __OBJECT_MOTION__
Transform tfm = ccl_fetch(sd, ob_tfm);
# else
Transform tfm = object_fetch_transform(kg, isect->object, OBJECT_TRANSFORM);
# endif
P = transform_point(&tfm, P);
}
return P;
# else
return P + D*t;
# endif
}
#endif
/* Setup of motion triangle specific parts of ShaderData, moved into this one
* function to more easily share computation of interpolated positions and
* normals */
/* return 3 triangle vertex normals */
ccl_device_noinline void motion_triangle_shader_setup(KernelGlobals *kg, ShaderData *sd, const Intersection *isect, const Ray *ray, bool subsurface)
{
/* get shader */
ccl_fetch(sd, shader) = kernel_tex_fetch(__tri_shader, ccl_fetch(sd, prim));
/* get motion info */
int numsteps, numverts;
object_motion_info(kg, ccl_fetch(sd, object), &numsteps, &numverts, NULL);
/* figure out which steps we need to fetch and their interpolation factor */
int maxstep = numsteps*2;
int step = min((int)(ccl_fetch(sd, time)*maxstep), maxstep-1);
float t = ccl_fetch(sd, time)*maxstep - step;
/* find attribute */
AttributeElement elem;
int offset = find_attribute_motion(kg, ccl_fetch(sd, object), ATTR_STD_MOTION_VERTEX_POSITION, &elem);
kernel_assert(offset != ATTR_STD_NOT_FOUND);
/* fetch vertex coordinates */
float3 verts[3], next_verts[3];
uint4 tri_vindex = kernel_tex_fetch(__tri_vindex, ccl_fetch(sd, prim));
motion_triangle_verts_for_step(kg, tri_vindex, offset, numverts, numsteps, step, verts);
motion_triangle_verts_for_step(kg, tri_vindex, offset, numverts, numsteps, step+1, next_verts);
/* interpolate between steps */
verts[0] = (1.0f - t)*verts[0] + t*next_verts[0];
verts[1] = (1.0f - t)*verts[1] + t*next_verts[1];
verts[2] = (1.0f - t)*verts[2] + t*next_verts[2];
/* compute refined position */
#ifdef __SUBSURFACE__
if(!subsurface)
#endif
ccl_fetch(sd, P) = motion_triangle_refine(kg, sd, isect, ray, verts);
#ifdef __SUBSURFACE__
else
ccl_fetch(sd, P) = motion_triangle_refine_subsurface(kg, sd, isect, ray, verts);
#endif
/* compute face normal */
float3 Ng;
if(ccl_fetch(sd, flag) & SD_NEGATIVE_SCALE_APPLIED)
Ng = normalize(cross(verts[2] - verts[0], verts[1] - verts[0]));
else
Ng = normalize(cross(verts[1] - verts[0], verts[2] - verts[0]));
ccl_fetch(sd, Ng) = Ng;
ccl_fetch(sd, N) = Ng;
/* compute derivatives of P w.r.t. uv */
#ifdef __DPDU__
ccl_fetch(sd, dPdu) = (verts[0] - verts[2]);
ccl_fetch(sd, dPdv) = (verts[1] - verts[2]);
#endif
/* compute smooth normal */
if(ccl_fetch(sd, shader) & SHADER_SMOOTH_NORMAL) {
/* find attribute */
AttributeElement elem;
int offset = find_attribute_motion(kg, ccl_fetch(sd, object), ATTR_STD_MOTION_VERTEX_NORMAL, &elem);
kernel_assert(offset != ATTR_STD_NOT_FOUND);
/* fetch vertex coordinates */
float3 normals[3], next_normals[3];
motion_triangle_normals_for_step(kg, tri_vindex, offset, numverts, numsteps, step, normals);
motion_triangle_normals_for_step(kg, tri_vindex, offset, numverts, numsteps, step+1, next_normals);
/* interpolate between steps */
normals[0] = (1.0f - t)*normals[0] + t*next_normals[0];
normals[1] = (1.0f - t)*normals[1] + t*next_normals[1];
normals[2] = (1.0f - t)*normals[2] + t*next_normals[2];
/* interpolate between vertices */
float u = ccl_fetch(sd, u);
float v = ccl_fetch(sd, v);
float w = 1.0f - u - v;
ccl_fetch(sd, N) = (u*normals[0] + v*normals[1] + w*normals[2]);
}
}
/* Ray intersection. We simply compute the vertex positions at the given ray
* time and do a ray intersection with the resulting triangle */
ccl_device_inline bool motion_triangle_intersect(KernelGlobals *kg, Intersection *isect,
float3 P, float3 dir, float time, uint visibility, int object, int prim_addr)
{
/* primitive index for vertex location lookup */
int prim = kernel_tex_fetch(__prim_index, prim_addr);
int fobject = (object == OBJECT_NONE)? kernel_tex_fetch(__prim_object, prim_addr): object;
/* get vertex locations for intersection */
float3 verts[3];
motion_triangle_vertices(kg, fobject, prim, time, verts);
/* ray-triangle intersection, unoptimized */
float t, u, v;
if(ray_triangle_intersect_uv(P, dir, isect->t, verts[2], verts[0], verts[1], &u, &v, &t)) {
#ifdef __VISIBILITY_FLAG__
/* visibility flag test. we do it here under the assumption
* that most triangles are culled by node flags */
if(kernel_tex_fetch(__prim_visibility, prim_addr) & visibility)
#endif
{
isect->t = t;
isect->u = u;
isect->v = v;
isect->prim = prim_addr;
isect->object = object;
isect->type = PRIMITIVE_MOTION_TRIANGLE;
return true;
}
}
return false;
}
/* Special ray intersection routines for subsurface scattering. In that case we
* only want to intersect with primitives in the same object, and if case of
* multiple hits we pick a single random primitive as the intersection point. */
#ifdef __SUBSURFACE__
ccl_device_inline void motion_triangle_intersect_subsurface(
KernelGlobals *kg,
SubsurfaceIntersection *ss_isect,
float3 P,
float3 dir,
float time,
int object,
int prim_addr,
float tmax,
uint *lcg_state,
int max_hits)
{
/* primitive index for vertex location lookup */
int prim = kernel_tex_fetch(__prim_index, prim_addr);
int fobject = (object == OBJECT_NONE)? kernel_tex_fetch(__prim_object, prim_addr): object;
/* get vertex locations for intersection */
float3 verts[3];
motion_triangle_vertices(kg, fobject, prim, time, verts);
/* ray-triangle intersection, unoptimized */
float t, u, v;
if(ray_triangle_intersect_uv(P, dir, tmax, verts[2], verts[0], verts[1], &u, &v, &t)) {
for(int i = min(max_hits, ss_isect->num_hits) - 1; i >= 0; --i) {
if(ss_isect->hits[i].t == t) {
return;
}
}
ss_isect->num_hits++;
int hit;
if(ss_isect->num_hits <= max_hits) {
hit = ss_isect->num_hits - 1;
}
else {
/* reservoir sampling: if we are at the maximum number of
* hits, randomly replace element or skip it */
hit = lcg_step_uint(lcg_state) % ss_isect->num_hits;
if(hit >= max_hits)
return;
}
/* record intersection */
Intersection *isect = &ss_isect->hits[hit];
isect->t = t;
isect->u = u;
isect->v = v;
isect->prim = prim_addr;
isect->object = object;
isect->type = PRIMITIVE_MOTION_TRIANGLE;
/* Record geometric normal. */
ss_isect->Ng[hit] = normalize(cross(verts[1] - verts[0],
verts[2] - verts[0]));
}
}
#endif
CCL_NAMESPACE_END

View File

@@ -0,0 +1,280 @@
/*
* Copyright 2011-2016 Blender Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* Motion Triangle Primitive
*
* These are stored as regular triangles, plus extra positions and normals at
* times other than the frame center. Computing the triangle vertex positions
* or normals at a given ray time is a matter of interpolation of the two steps
* between which the ray time lies.
*
* The extra positions and normals are stored as ATTR_STD_MOTION_VERTEX_POSITION
* and ATTR_STD_MOTION_VERTEX_NORMAL mesh attributes.
*/
CCL_NAMESPACE_BEGIN
/* Refine triangle intersection to more precise hit point. For rays that travel
* far the precision is often not so good, this reintersects the primitive from
* a closer distance.
*/
ccl_device_inline float3 motion_triangle_refine(KernelGlobals *kg,
ShaderData *sd,
const Intersection *isect,
const Ray *ray,
float3 verts[3])
{
float3 P = ray->P;
float3 D = ray->D;
float t = isect->t;
#ifdef __INTERSECTION_REFINE__
if(isect->object != OBJECT_NONE) {
if(UNLIKELY(t == 0.0f)) {
return P;
}
# ifdef __OBJECT_MOTION__
Transform tfm = ccl_fetch(sd, ob_itfm);
# else
Transform tfm = object_fetch_transform(kg,
isect->object,
OBJECT_INVERSE_TRANSFORM);
# endif
P = transform_point(&tfm, P);
D = transform_direction(&tfm, D*t);
D = normalize_len(D, &t);
}
P = P + D*t;
/* Compute refined intersection distance. */
const float3 e1 = verts[0] - verts[2];
const float3 e2 = verts[1] - verts[2];
const float3 s1 = cross(D, e2);
const float invdivisor = 1.0f/dot(s1, e1);
const float3 d = P - verts[2];
const float3 s2 = cross(d, e1);
float rt = dot(e2, s2)*invdivisor;
/* Compute refined position. */
P = P + D*rt;
if(isect->object != OBJECT_NONE) {
# ifdef __OBJECT_MOTION__
Transform tfm = ccl_fetch(sd, ob_tfm);
# else
Transform tfm = object_fetch_transform(kg,
isect->object,
OBJECT_TRANSFORM);
# endif
P = transform_point(&tfm, P);
}
return P;
#else
return P + D*t;
#endif
}
/* Same as above, except that isect->t is assumed to be in object space
* for instancing.
*/
#ifdef __SUBSURFACE__
# if defined(__KERNEL_CUDA__) && (defined(i386) || defined(_M_IX86))
ccl_device_noinline
# else
ccl_device_inline
# endif
float3 motion_triangle_refine_subsurface(KernelGlobals *kg,
ShaderData *sd,
const Intersection *isect,
const Ray *ray,
float3 verts[3])
{
float3 P = ray->P;
float3 D = ray->D;
float t = isect->t;
# ifdef __INTERSECTION_REFINE__
if(isect->object != OBJECT_NONE) {
# ifdef __OBJECT_MOTION__
Transform tfm = ccl_fetch(sd, ob_itfm);
# else
Transform tfm = object_fetch_transform(kg,
isect->object,
OBJECT_INVERSE_TRANSFORM);
# endif
P = transform_point(&tfm, P);
D = transform_direction(&tfm, D);
D = normalize(D);
}
P = P + D*t;
/* compute refined intersection distance */
const float3 e1 = verts[0] - verts[2];
const float3 e2 = verts[1] - verts[2];
const float3 s1 = cross(D, e2);
const float invdivisor = 1.0f/dot(s1, e1);
const float3 d = P - verts[2];
const float3 s2 = cross(d, e1);
float rt = dot(e2, s2)*invdivisor;
P = P + D*rt;
if(isect->object != OBJECT_NONE) {
# ifdef __OBJECT_MOTION__
Transform tfm = ccl_fetch(sd, ob_tfm);
# else
Transform tfm = object_fetch_transform(kg,
isect->object,
OBJECT_TRANSFORM);
# endif
P = transform_point(&tfm, P);
}
return P;
# else /* __INTERSECTION_REFINE__ */
return P + D*t;
# endif /* __INTERSECTION_REFINE__ */
}
#endif /* __SUBSURFACE__ */
/* Ray intersection. We simply compute the vertex positions at the given ray
* time and do a ray intersection with the resulting triangle.
*/
ccl_device_inline bool motion_triangle_intersect(KernelGlobals *kg,
Intersection *isect,
float3 P,
float3 dir,
float time,
uint visibility,
int object,
int prim_addr)
{
/* Primitive index for vertex location lookup. */
int prim = kernel_tex_fetch(__prim_index, prim_addr);
int fobject = (object == OBJECT_NONE)
? kernel_tex_fetch(__prim_object, prim_addr)
: object;
/* Get vertex locations for intersection. */
float3 verts[3];
motion_triangle_vertices(kg, fobject, prim, time, verts);
/* Ray-triangle intersection, unoptimized. */
float t, u, v;
if(ray_triangle_intersect_uv(P,
dir,
isect->t,
verts[2], verts[0], verts[1],
&u, &v, &t))
{
#ifdef __VISIBILITY_FLAG__
/* Visibility flag test. we do it here under the assumption
* that most triangles are culled by node flags.
*/
if(kernel_tex_fetch(__prim_visibility, prim_addr) & visibility)
#endif
{
isect->t = t;
isect->u = u;
isect->v = v;
isect->prim = prim_addr;
isect->object = object;
isect->type = PRIMITIVE_MOTION_TRIANGLE;
return true;
}
}
return false;
}
/* Special ray intersection routines for subsurface scattering. In that case we
* only want to intersect with primitives in the same object, and if case of
* multiple hits we pick a single random primitive as the intersection point.
*/
#ifdef __SUBSURFACE__
ccl_device_inline void motion_triangle_intersect_subsurface(
KernelGlobals *kg,
SubsurfaceIntersection *ss_isect,
float3 P,
float3 dir,
float time,
int object,
int prim_addr,
float tmax,
uint *lcg_state,
int max_hits)
{
/* Primitive index for vertex location lookup. */
int prim = kernel_tex_fetch(__prim_index, prim_addr);
int fobject = (object == OBJECT_NONE)
? kernel_tex_fetch(__prim_object, prim_addr)
: object;
/* Get vertex locations for intersection. */
float3 verts[3];
motion_triangle_vertices(kg, fobject, prim, time, verts);
/* Ray-triangle intersection, unoptimized. */
float t, u, v;
if(ray_triangle_intersect_uv(P,
dir,
tmax,
verts[2], verts[0], verts[1],
&u, &v, &t))
{
for(int i = min(max_hits, ss_isect->num_hits) - 1; i >= 0; --i) {
if(ss_isect->hits[i].t == t) {
return;
}
}
ss_isect->num_hits++;
int hit;
if(ss_isect->num_hits <= max_hits) {
hit = ss_isect->num_hits - 1;
}
else {
/* Reservoir sampling: if we are at the maximum number of
* hits, randomly replace element or skip it.
*/
hit = lcg_step_uint(lcg_state) % ss_isect->num_hits;
if(hit >= max_hits)
return;
}
/* Record intersection. */
Intersection *isect = &ss_isect->hits[hit];
isect->t = t;
isect->u = u;
isect->v = v;
isect->prim = prim_addr;
isect->object = object;
isect->type = PRIMITIVE_MOTION_TRIANGLE;
/* Record geometric normal. */
ss_isect->Ng[hit] = normalize(cross(verts[1] - verts[0],
verts[2] - verts[0]));
}
}
#endif /* __SUBSURFACE__ */
CCL_NAMESPACE_END

View File

@@ -0,0 +1,123 @@
/*
* Copyright 2011-2016 Blender Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* Motion Triangle Primitive
*
* These are stored as regular triangles, plus extra positions and normals at
* times other than the frame center. Computing the triangle vertex positions
* or normals at a given ray time is a matter of interpolation of the two steps
* between which the ray time lies.
*
* The extra positions and normals are stored as ATTR_STD_MOTION_VERTEX_POSITION
* and ATTR_STD_MOTION_VERTEX_NORMAL mesh attributes.
*/
CCL_NAMESPACE_BEGIN
/* Setup of motion triangle specific parts of ShaderData, moved into this one
* function to more easily share computation of interpolated positions and
* normals */
/* return 3 triangle vertex normals */
ccl_device_noinline void motion_triangle_shader_setup(KernelGlobals *kg,
ShaderData *sd, const
Intersection *isect,
const Ray *ray,
bool subsurface)
{
/* Get shader. */
ccl_fetch(sd, shader) = kernel_tex_fetch(__tri_shader, ccl_fetch(sd, prim));
/* Get motion info. */
/* TODO(sergey): This logic is really similar to motion_triangle_vertices(),
* can we de-duplicate something here?
*/
int numsteps, numverts;
object_motion_info(kg, ccl_fetch(sd, object), &numsteps, &numverts, NULL);
/* Figure out which steps we need to fetch and their interpolation factor. */
int maxstep = numsteps*2;
int step = min((int)(ccl_fetch(sd, time)*maxstep), maxstep-1);
float t = ccl_fetch(sd, time)*maxstep - step;
/* Find attribute. */
AttributeElement elem;
int offset = find_attribute_motion(kg, ccl_fetch(sd, object),
ATTR_STD_MOTION_VERTEX_POSITION,
&elem);
kernel_assert(offset != ATTR_STD_NOT_FOUND);
/* Fetch vertex coordinates. */
float3 verts[3], next_verts[3];
uint4 tri_vindex = kernel_tex_fetch(__tri_vindex, ccl_fetch(sd, prim));
motion_triangle_verts_for_step(kg, tri_vindex, offset, numverts, numsteps, step, verts);
motion_triangle_verts_for_step(kg, tri_vindex, offset, numverts, numsteps, step+1, next_verts);
/* Interpolate between steps. */
verts[0] = (1.0f - t)*verts[0] + t*next_verts[0];
verts[1] = (1.0f - t)*verts[1] + t*next_verts[1];
verts[2] = (1.0f - t)*verts[2] + t*next_verts[2];
/* Compute refined position. */
#ifdef __SUBSURFACE__
if(subsurface) {
ccl_fetch(sd, P) = motion_triangle_refine_subsurface(kg,
sd,
isect,
ray,
verts);
}
else
#endif /* __SUBSURFACE__*/
{
ccl_fetch(sd, P) = motion_triangle_refine(kg, sd, isect, ray, verts);
}
/* Compute face normal. */
float3 Ng;
if(ccl_fetch(sd, object_flag) & SD_OBJECT_NEGATIVE_SCALE_APPLIED) {
Ng = normalize(cross(verts[2] - verts[0], verts[1] - verts[0]));
}
else {
Ng = normalize(cross(verts[1] - verts[0], verts[2] - verts[0]));
}
ccl_fetch(sd, Ng) = Ng;
ccl_fetch(sd, N) = Ng;
/* Compute derivatives of P w.r.t. uv. */
#ifdef __DPDU__
ccl_fetch(sd, dPdu) = (verts[0] - verts[2]);
ccl_fetch(sd, dPdv) = (verts[1] - verts[2]);
#endif
/* Compute smooth normal. */
if(ccl_fetch(sd, shader) & SHADER_SMOOTH_NORMAL) {
/* Find attribute. */
AttributeElement elem;
int offset = find_attribute_motion(kg,
ccl_fetch(sd, object),
ATTR_STD_MOTION_VERTEX_NORMAL,
&elem);
kernel_assert(offset != ATTR_STD_NOT_FOUND);
/* Fetch vertex coordinates. */
float3 normals[3], next_normals[3];
motion_triangle_normals_for_step(kg, tri_vindex, offset, numverts, numsteps, step, normals);
motion_triangle_normals_for_step(kg, tri_vindex, offset, numverts, numsteps, step+1, next_normals);
/* Interpolate between steps. */
normals[0] = (1.0f - t)*normals[0] + t*next_normals[0];
normals[1] = (1.0f - t)*normals[1] + t*next_normals[1];
normals[2] = (1.0f - t)*normals[2] + t*next_normals[2];
/* Interpolate between vertices. */
float u = ccl_fetch(sd, u);
float v = ccl_fetch(sd, v);
float w = 1.0f - u - v;
ccl_fetch(sd, N) = (u*normals[0] + v*normals[1] + w*normals[2]);
}
}
CCL_NAMESPACE_END

View File

@@ -113,7 +113,6 @@ ccl_device_inline Transform object_fetch_transform_motion(KernelGlobals *kg, int
ccl_device_inline Transform object_fetch_transform_motion_test(KernelGlobals *kg, int object, float time, Transform *itfm)
{
int object_flag = kernel_tex_fetch(__object_flag, object);
if(object_flag & SD_OBJECT_MOTION) {
/* if we do motion blur */
Transform tfm = object_fetch_transform_motion(kg, object, time);

View File

@@ -157,8 +157,9 @@ ccl_device_inline float4 primitive_motion_vector(KernelGlobals *kg, ShaderData *
if(is_curve_primitive) {
center = curve_motion_center_location(kg, sd);
if(!(ccl_fetch(sd, flag) & SD_TRANSFORM_APPLIED))
if(!(ccl_fetch(sd, object_flag) & SD_OBJECT_TRANSFORM_APPLIED)) {
object_position_transform(kg, sd, &center);
}
}
else
#endif
@@ -181,7 +182,7 @@ ccl_device_inline float4 primitive_motion_vector(KernelGlobals *kg, ShaderData *
motion_post = primitive_attribute_float3(kg, sd, desc, NULL, NULL);
#ifdef __HAIR__
if(is_curve_primitive && (ccl_fetch(sd, flag) & SD_OBJECT_HAS_VERTEX_MOTION) == 0) {
if(is_curve_primitive && (ccl_fetch(sd, object_flag) & SD_OBJECT_HAS_VERTEX_MOTION) == 0) {
object_position_transform(kg, sd, &motion_pre);
object_position_transform(kg, sd, &motion_post);
}

View File

@@ -32,10 +32,12 @@ ccl_device_inline float3 triangle_normal(KernelGlobals *kg, ShaderData *sd)
const float3 v2 = float4_to_float3(kernel_tex_fetch(__prim_tri_verts, tri_vindex.w+2));
/* return normal */
if(ccl_fetch(sd, flag) & SD_NEGATIVE_SCALE_APPLIED)
if(ccl_fetch(sd, object_flag) & SD_OBJECT_NEGATIVE_SCALE_APPLIED) {
return normalize(cross(v2 - v0, v1 - v0));
else
}
else {
return normalize(cross(v1 - v0, v2 - v0));
}
}
/* point and normal on triangle */
@@ -46,20 +48,18 @@ ccl_device_inline void triangle_point_normal(KernelGlobals *kg, int object, int
float3 v0 = float4_to_float3(kernel_tex_fetch(__prim_tri_verts, tri_vindex.w+0));
float3 v1 = float4_to_float3(kernel_tex_fetch(__prim_tri_verts, tri_vindex.w+1));
float3 v2 = float4_to_float3(kernel_tex_fetch(__prim_tri_verts, tri_vindex.w+2));
/* compute point */
float t = 1.0f - u - v;
*P = (u*v0 + v*v1 + t*v2);
/* get object flags */
int object_flag = kernel_tex_fetch(__object_flag, object);
/* compute normal */
if(object_flag & SD_NEGATIVE_SCALE_APPLIED)
if(object_flag & SD_OBJECT_NEGATIVE_SCALE_APPLIED) {
*Ng = normalize(cross(v2 - v0, v1 - v0));
else
}
else {
*Ng = normalize(cross(v1 - v0, v2 - v0));
}
/* shader`*/
*shader = kernel_tex_fetch(__tri_shader, prim);
}

View File

@@ -320,7 +320,7 @@ ccl_device void kernel_bake_evaluate(KernelGlobals *kg, ccl_global uint4 *input,
P, Ng, Ng,
shader, object, prim,
u, v, 1.0f, 0.5f,
!(kernel_tex_fetch(__object_flag, object) & SD_TRANSFORM_APPLIED),
!(kernel_tex_fetch(__object_flag, object) & SD_OBJECT_TRANSFORM_APPLIED),
LAMP_NONE);
sd.I = sd.N;

View File

@@ -18,8 +18,9 @@ CCL_NAMESPACE_BEGIN
ccl_device_inline void debug_data_init(DebugData *debug_data)
{
debug_data->num_bvh_traversal_steps = 0;
debug_data->num_bvh_traversed_nodes = 0;
debug_data->num_bvh_traversed_instances = 0;
debug_data->num_bvh_intersections = 0;
debug_data->num_ray_bounces = 0;
}
@@ -30,16 +31,21 @@ ccl_device_inline void kernel_write_debug_passes(KernelGlobals *kg,
int sample)
{
int flag = kernel_data.film.pass_flag;
if(flag & PASS_BVH_TRAVERSAL_STEPS) {
kernel_write_pass_float(buffer + kernel_data.film.pass_bvh_traversal_steps,
if(flag & PASS_BVH_TRAVERSED_NODES) {
kernel_write_pass_float(buffer + kernel_data.film.pass_bvh_traversed_nodes,
sample,
debug_data->num_bvh_traversal_steps);
debug_data->num_bvh_traversed_nodes);
}
if(flag & PASS_BVH_TRAVERSED_INSTANCES) {
kernel_write_pass_float(buffer + kernel_data.film.pass_bvh_traversed_instances,
sample,
debug_data->num_bvh_traversed_instances);
}
if(flag & PASS_BVH_INTERSECTIONS) {
kernel_write_pass_float(buffer + kernel_data.film.pass_bvh_intersections,
sample,
debug_data->num_bvh_intersections);
}
if(flag & PASS_RAY_BOUNCES) {
kernel_write_pass_float(buffer + kernel_data.film.pass_ray_bounces,
sample,

View File

@@ -767,7 +767,7 @@ ccl_device void object_transform_light_sample(KernelGlobals *kg, LightSample *ls
{
#ifdef __INSTANCING__
/* instance transform */
if(!(kernel_tex_fetch(__object_flag, object) & SD_TRANSFORM_APPLIED)) {
if(!(kernel_tex_fetch(__object_flag, object) & SD_OBJECT_TRANSFORM_APPLIED)) {
# ifdef __OBJECT_MOTION__
Transform itfm;
Transform tfm = object_fetch_transform_motion_test(kg, object, time, &itfm);

View File

@@ -452,7 +452,7 @@ bool kernel_path_subsurface_scatter(
# ifdef __VOLUME__
ss_indirect->need_update_volume_stack =
kernel_data.integrator.use_volumes &&
ccl_fetch(sd, flag) & SD_OBJECT_INTERSECTS_VOLUME;
ccl_fetch(sd, object_flag) & SD_OBJECT_INTERSECTS_VOLUME;
# endif /* __VOLUME__ */
/* compute lighting with the BSDF closure */
@@ -634,8 +634,9 @@ ccl_device_inline float4 kernel_path_integrate(KernelGlobals *kg,
#ifdef __KERNEL_DEBUG__
if(state.flag & PATH_RAY_CAMERA) {
debug_data.num_bvh_traversal_steps += isect.num_traversal_steps;
debug_data.num_bvh_traversed_nodes += isect.num_traversed_nodes;
debug_data.num_bvh_traversed_instances += isect.num_traversed_instances;
debug_data.num_bvh_intersections += isect.num_intersections;
}
debug_data.num_ray_bounces++;
#endif /* __KERNEL_DEBUG__ */
@@ -776,21 +777,25 @@ ccl_device_inline float4 kernel_path_integrate(KernelGlobals *kg,
/* holdout */
#ifdef __HOLDOUT__
if((sd.flag & (SD_HOLDOUT|SD_HOLDOUT_MASK)) && (state.flag & PATH_RAY_CAMERA)) {
if(((sd.flag & SD_HOLDOUT) ||
(sd.object_flag & SD_OBJECT_HOLDOUT_MASK)) &&
(state.flag & PATH_RAY_CAMERA))
{
if(kernel_data.background.transparent) {
float3 holdout_weight;
if(sd.flag & SD_HOLDOUT_MASK)
if(sd.object_flag & SD_OBJECT_HOLDOUT_MASK) {
holdout_weight = make_float3(1.0f, 1.0f, 1.0f);
else
}
else {
holdout_weight = shader_holdout_eval(kg, &sd);
}
/* any throughput is ok, should all be identical here */
L_transparent += average(holdout_weight*throughput);
}
if(sd.flag & SD_HOLDOUT_MASK)
if(sd.object_flag & SD_OBJECT_HOLDOUT_MASK) {
break;
}
}
#endif /* __HOLDOUT__ */

View File

@@ -167,8 +167,9 @@ ccl_device void kernel_branched_path_subsurface_scatter(KernelGlobals *kg,
true);
#ifdef __VOLUME__
Ray volume_ray = *ray;
bool need_update_volume_stack = kernel_data.integrator.use_volumes &&
ccl_fetch(sd, flag) & SD_OBJECT_INTERSECTS_VOLUME;
bool need_update_volume_stack =
kernel_data.integrator.use_volumes &&
ccl_fetch(sd, object_flag) & SD_OBJECT_INTERSECTS_VOLUME;
#endif /* __VOLUME__ */
/* compute lighting with the BSDF closure */
@@ -288,8 +289,9 @@ ccl_device float4 kernel_branched_path_integrate(KernelGlobals *kg, RNG *rng, in
#endif /* __HAIR__ */
#ifdef __KERNEL_DEBUG__
debug_data.num_bvh_traversal_steps += isect.num_traversal_steps;
debug_data.num_bvh_traversed_nodes += isect.num_traversed_nodes;
debug_data.num_bvh_traversed_instances += isect.num_traversed_instances;
debug_data.num_bvh_intersections += isect.num_intersections;
debug_data.num_ray_bounces++;
#endif /* __KERNEL_DEBUG__ */
@@ -472,21 +474,21 @@ ccl_device float4 kernel_branched_path_integrate(KernelGlobals *kg, RNG *rng, in
/* holdout */
#ifdef __HOLDOUT__
if(sd.flag & (SD_HOLDOUT|SD_HOLDOUT_MASK)) {
if((sd.flag & SD_HOLDOUT) || (sd.object_flag & SD_OBJECT_HOLDOUT_MASK)) {
if(kernel_data.background.transparent) {
float3 holdout_weight;
if(sd.flag & SD_HOLDOUT_MASK)
if(sd.object_flag & SD_OBJECT_HOLDOUT_MASK) {
holdout_weight = make_float3(1.0f, 1.0f, 1.0f);
else
}
else {
holdout_weight = shader_holdout_eval(kg, &sd);
}
/* any throughput is ok, should all be identical here */
L_transparent += average(holdout_weight*throughput);
}
if(sd.flag & SD_HOLDOUT_MASK)
if(sd.object_flag & SD_OBJECT_HOLDOUT_MASK) {
break;
}
}
#endif /* __HOLDOUT__ */

View File

@@ -38,7 +38,7 @@ CCL_NAMESPACE_BEGIN
#ifdef __OBJECT_MOTION__
ccl_device void shader_setup_object_transforms(KernelGlobals *kg, ShaderData *sd, float time)
{
if(ccl_fetch(sd, flag) & SD_OBJECT_MOTION) {
if(ccl_fetch(sd, object_flag) & SD_OBJECT_MOTION) {
ccl_fetch(sd, ob_tfm) = object_fetch_transform_motion(kg, ccl_fetch(sd, object), time);
ccl_fetch(sd, ob_itfm) = transform_quick_inverse(ccl_fetch(sd, ob_tfm));
}
@@ -59,7 +59,9 @@ ccl_device_noinline void shader_setup_from_ray(KernelGlobals *kg,
#endif
ccl_fetch(sd, type) = isect->type;
ccl_fetch(sd, flag) = kernel_tex_fetch(__object_flag, ccl_fetch(sd, object));
ccl_fetch(sd, flag) = 0;
ccl_fetch(sd, object_flag) = kernel_tex_fetch(__object_flag,
ccl_fetch(sd, object));
/* matrices and time */
#ifdef __OBJECT_MOTION__
@@ -160,10 +162,11 @@ void shader_setup_from_subsurface(
const Intersection *isect,
const Ray *ray)
{
bool backfacing = sd->flag & SD_BACKFACING;
const bool backfacing = sd->flag & SD_BACKFACING;
/* object, matrices, time, ray_length stay the same */
sd->flag = kernel_tex_fetch(__object_flag, sd->object);
sd->flag = 0;
sd->object_flag = kernel_tex_fetch(__object_flag, sd->object);
sd->prim = kernel_tex_fetch(__prim_index, isect->prim);
sd->type = isect->type;
@@ -271,8 +274,10 @@ ccl_device_inline void shader_setup_from_sample(KernelGlobals *kg,
ccl_fetch(sd, ray_length) = t;
ccl_fetch(sd, flag) = kernel_tex_fetch(__shader_flag, (ccl_fetch(sd, shader) & SHADER_MASK)*SHADER_SIZE);
ccl_fetch(sd, object_flag) = 0;
if(ccl_fetch(sd, object) != OBJECT_NONE) {
ccl_fetch(sd, flag) |= kernel_tex_fetch(__object_flag, ccl_fetch(sd, object));
ccl_fetch(sd, object_flag) |= kernel_tex_fetch(__object_flag,
ccl_fetch(sd, object));
#ifdef __OBJECT_MOTION__
shader_setup_object_transforms(kg, sd, time);
@@ -298,7 +303,7 @@ ccl_device_inline void shader_setup_from_sample(KernelGlobals *kg,
ccl_fetch(sd, N) = triangle_smooth_normal(kg, ccl_fetch(sd, prim), ccl_fetch(sd, u), ccl_fetch(sd, v));
#ifdef __INSTANCING__
if(!(ccl_fetch(sd, flag) & SD_TRANSFORM_APPLIED)) {
if(!(ccl_fetch(sd, object_flag) & SD_OBJECT_TRANSFORM_APPLIED)) {
object_normal_transform_auto(kg, sd, &ccl_fetch(sd, N));
}
#endif
@@ -309,7 +314,7 @@ ccl_device_inline void shader_setup_from_sample(KernelGlobals *kg,
triangle_dPdudv(kg, ccl_fetch(sd, prim), &ccl_fetch(sd, dPdu), &ccl_fetch(sd, dPdv));
# ifdef __INSTANCING__
if(!(ccl_fetch(sd, flag) & SD_TRANSFORM_APPLIED)) {
if(!(ccl_fetch(sd, object_flag) & SD_OBJECT_TRANSFORM_APPLIED)) {
object_dir_transform_auto(kg, sd, &ccl_fetch(sd, dPdu));
object_dir_transform_auto(kg, sd, &ccl_fetch(sd, dPdv));
}
@@ -364,7 +369,7 @@ ccl_device void shader_setup_from_displace(KernelGlobals *kg, ShaderData *sd,
P, Ng, I,
shader, object, prim,
u, v, 0.0f, 0.5f,
!(kernel_tex_fetch(__object_flag, object) & SD_TRANSFORM_APPLIED),
!(kernel_tex_fetch(__object_flag, object) & SD_OBJECT_TRANSFORM_APPLIED),
LAMP_NONE);
}
@@ -379,6 +384,7 @@ ccl_device_inline void shader_setup_from_background(KernelGlobals *kg, ShaderDat
ccl_fetch(sd, I) = -ray->D;
ccl_fetch(sd, shader) = kernel_data.background.surface_shader;
ccl_fetch(sd, flag) = kernel_tex_fetch(__shader_flag, (ccl_fetch(sd, shader) & SHADER_MASK)*SHADER_SIZE);
ccl_fetch(sd, object_flag) = 0;
#ifdef __OBJECT_MOTION__
ccl_fetch(sd, time) = ray->time;
#endif
@@ -420,6 +426,7 @@ ccl_device_inline void shader_setup_from_volume(KernelGlobals *kg, ShaderData *s
sd->I = -ray->D;
sd->shader = SHADER_NONE;
sd->flag = 0;
sd->object_flag = 0;
#ifdef __OBJECT_MOTION__
sd->time = ray->time;
#endif
@@ -1027,6 +1034,7 @@ ccl_device_inline void shader_eval_volume(KernelGlobals *kg,
sd->num_closure = 0;
sd->num_closure_extra = 0;
sd->flag = 0;
sd->object_flag = 0;
for(int i = 0; stack[i].shader != SHADER_NONE; i++) {
/* setup shaderdata from stack. it's mostly setup already in
@@ -1034,11 +1042,12 @@ ccl_device_inline void shader_eval_volume(KernelGlobals *kg,
sd->object = stack[i].object;
sd->shader = stack[i].shader;
sd->flag &= ~(SD_SHADER_FLAGS|SD_OBJECT_FLAGS);
sd->flag &= ~SD_SHADER_FLAGS;
sd->flag |= kernel_tex_fetch(__shader_flag, (sd->shader & SHADER_MASK)*SHADER_SIZE);
sd->object_flag &= ~SD_OBJECT_FLAGS;
if(sd->object != OBJECT_NONE) {
sd->flag |= kernel_tex_fetch(__object_flag, sd->object);
sd->object_flag |= kernel_tex_fetch(__object_flag, sd->object);
#ifdef __OBJECT_MOTION__
/* todo: this is inefficient for motion blur, we should be

View File

@@ -345,9 +345,10 @@ typedef enum PassType {
PASS_SUBSURFACE_COLOR = (1 << 24),
PASS_LIGHT = (1 << 25), /* no real pass, used to force use_light_pass */
#ifdef __KERNEL_DEBUG__
PASS_BVH_TRAVERSAL_STEPS = (1 << 26),
PASS_BVH_TRAVERSED_NODES = (1 << 26),
PASS_BVH_TRAVERSED_INSTANCES = (1 << 27),
PASS_RAY_BOUNCES = (1 << 28),
PASS_BVH_INTERSECTIONS = (1 << 28),
PASS_RAY_BOUNCES = (1 << 29),
#endif
} PassType;
@@ -542,8 +543,9 @@ typedef ccl_addr_space struct Intersection {
int type;
#ifdef __KERNEL_DEBUG__
int num_traversal_steps;
int num_traversed_nodes;
int num_traversed_instances;
int num_intersections;
#endif
} Intersection;
@@ -690,56 +692,108 @@ typedef enum ShaderContext {
/* Shader Data
*
* Main shader state at a point on the surface or in a volume. All coordinates
* are in world space. */
* are in world space.
*/
enum ShaderDataFlag {
/* runtime flags */
SD_BACKFACING = (1 << 0), /* backside of surface? */
SD_EMISSION = (1 << 1), /* have emissive closure? */
SD_BSDF = (1 << 2), /* have bsdf closure? */
SD_BSDF_HAS_EVAL = (1 << 3), /* have non-singular bsdf closure? */
SD_BSSRDF = (1 << 4), /* have bssrdf */
SD_HOLDOUT = (1 << 5), /* have holdout closure? */
SD_ABSORPTION = (1 << 6), /* have volume absorption closure? */
SD_SCATTER = (1 << 7), /* have volume phase closure? */
SD_AO = (1 << 8), /* have ao closure? */
SD_TRANSPARENT = (1 << 9), /* have transparent closure? */
/* Runtime flags. */
/* Set when ray hits backside of surface. */
SD_BACKFACING = (1 << 0),
/* Shader has emissive closure. */
SD_EMISSION = (1 << 1),
/* Shader has BSDF closure. */
SD_BSDF = (1 << 2),
/* Shader has non-singular BSDF closure. */
SD_BSDF_HAS_EVAL = (1 << 3),
/* Shader has BSSRDF closure. */
SD_BSSRDF = (1 << 4),
/* Shader has holdout closure. */
SD_HOLDOUT = (1 << 5),
/* Shader has volume absorption closure. */
SD_ABSORPTION = (1 << 6),
/* Shader has have volume phase (scatter) closure. */
SD_SCATTER = (1 << 7),
/* Shader has AO closure. */
SD_AO = (1 << 8),
/* Shader has transparent closure. */
SD_TRANSPARENT = (1 << 9),
/* BSDF requires LCG for evaluation. */
SD_BSDF_NEEDS_LCG = (1 << 10),
SD_CLOSURE_FLAGS = (SD_EMISSION|SD_BSDF|SD_BSDF_HAS_EVAL|SD_BSSRDF|
SD_HOLDOUT|SD_ABSORPTION|SD_SCATTER|SD_AO|
SD_CLOSURE_FLAGS = (SD_EMISSION |
SD_BSDF |
SD_BSDF_HAS_EVAL |
SD_BSSRDF |
SD_HOLDOUT |
SD_ABSORPTION |
SD_SCATTER |
SD_AO |
SD_BSDF_NEEDS_LCG),
/* shader flags */
SD_USE_MIS = (1 << 12), /* direct light sample */
SD_HAS_TRANSPARENT_SHADOW = (1 << 13), /* has transparent shadow */
SD_HAS_VOLUME = (1 << 14), /* has volume shader */
SD_HAS_ONLY_VOLUME = (1 << 15), /* has only volume shader, no surface */
SD_HETEROGENEOUS_VOLUME = (1 << 16), /* has heterogeneous volume */
SD_HAS_BSSRDF_BUMP = (1 << 17), /* bssrdf normal uses bump */
SD_VOLUME_EQUIANGULAR = (1 << 18), /* use equiangular sampling */
SD_VOLUME_MIS = (1 << 19), /* use multiple importance sampling */
SD_VOLUME_CUBIC = (1 << 20), /* use cubic interpolation for voxels */
SD_HAS_BUMP = (1 << 21), /* has data connected to the displacement input */
SD_HAS_DISPLACEMENT = (1 << 22), /* has true displacement */
SD_HAS_CONSTANT_EMISSION = (1 << 23), /* has constant emission (value stored in __shader_flag) */
/* Shader flags. */
SD_SHADER_FLAGS = (SD_USE_MIS|SD_HAS_TRANSPARENT_SHADOW|SD_HAS_VOLUME|
SD_HAS_ONLY_VOLUME|SD_HETEROGENEOUS_VOLUME|
SD_HAS_BSSRDF_BUMP|SD_VOLUME_EQUIANGULAR|SD_VOLUME_MIS|
SD_VOLUME_CUBIC|SD_HAS_BUMP|SD_HAS_DISPLACEMENT|SD_HAS_CONSTANT_EMISSION),
/* direct light sample */
SD_USE_MIS = (1 << 16),
/* Has transparent shadow. */
SD_HAS_TRANSPARENT_SHADOW = (1 << 17),
/* Has volume shader. */
SD_HAS_VOLUME = (1 << 18),
/* Has only volume shader, no surface. */
SD_HAS_ONLY_VOLUME = (1 << 19),
/* Has heterogeneous volume. */
SD_HETEROGENEOUS_VOLUME = (1 << 20),
/* BSSRDF normal uses bump. */
SD_HAS_BSSRDF_BUMP = (1 << 21),
/* Use equiangular volume sampling */
SD_VOLUME_EQUIANGULAR = (1 << 22),
/* Use multiple importance volume sampling. */
SD_VOLUME_MIS = (1 << 23),
/* Use cubic interpolation for voxels. */
SD_VOLUME_CUBIC = (1 << 24),
/* Has data connected to the displacement input. */
SD_HAS_BUMP = (1 << 25),
/* Has true displacement. */
SD_HAS_DISPLACEMENT = (1 << 26),
/* Has constant emission (value stored in __shader_flag) */
SD_HAS_CONSTANT_EMISSION = (1 << 27),
/* object flags */
SD_HOLDOUT_MASK = (1 << 24), /* holdout for camera rays */
SD_OBJECT_MOTION = (1 << 25), /* has object motion blur */
SD_TRANSFORM_APPLIED = (1 << 26), /* vertices have transform applied */
SD_NEGATIVE_SCALE_APPLIED = (1 << 27), /* vertices have negative scale applied */
SD_OBJECT_HAS_VOLUME = (1 << 28), /* object has a volume shader */
SD_OBJECT_INTERSECTS_VOLUME = (1 << 29), /* object intersects AABB of an object with volume shader */
SD_OBJECT_HAS_VERTEX_MOTION = (1 << 30), /* has position for motion vertices */
SD_SHADER_FLAGS = (SD_USE_MIS |
SD_HAS_TRANSPARENT_SHADOW |
SD_HAS_VOLUME |
SD_HAS_ONLY_VOLUME |
SD_HETEROGENEOUS_VOLUME|
SD_HAS_BSSRDF_BUMP |
SD_VOLUME_EQUIANGULAR |
SD_VOLUME_MIS |
SD_VOLUME_CUBIC |
SD_HAS_BUMP |
SD_HAS_DISPLACEMENT |
SD_HAS_CONSTANT_EMISSION)
};
SD_OBJECT_FLAGS = (SD_HOLDOUT_MASK|SD_OBJECT_MOTION|SD_TRANSFORM_APPLIED|
SD_NEGATIVE_SCALE_APPLIED|SD_OBJECT_HAS_VOLUME|
/* Object flags. */
enum ShaderDataObjectFlag {
/* Holdout for camera rays. */
SD_OBJECT_HOLDOUT_MASK = (1 << 0),
/* Has object motion blur. */
SD_OBJECT_MOTION = (1 << 1),
/* Vertices have transform applied. */
SD_OBJECT_TRANSFORM_APPLIED = (1 << 2),
/* Vertices have negative scale applied. */
SD_OBJECT_NEGATIVE_SCALE_APPLIED = (1 << 3),
/* Object has a volume shader. */
SD_OBJECT_HAS_VOLUME = (1 << 4),
/* Object intersects AABB of an object with volume shader. */
SD_OBJECT_INTERSECTS_VOLUME = (1 << 5),
/* Has position for motion vertices. */
SD_OBJECT_HAS_VERTEX_MOTION = (1 << 6),
SD_OBJECT_FLAGS = (SD_OBJECT_HOLDOUT_MASK |
SD_OBJECT_MOTION |
SD_OBJECT_TRANSFORM_APPLIED |
SD_OBJECT_NEGATIVE_SCALE_APPLIED |
SD_OBJECT_HAS_VOLUME |
SD_OBJECT_INTERSECTS_VOLUME)
};
@@ -778,6 +832,8 @@ typedef ccl_addr_space struct ShaderData {
ccl_soa_member(int, shader);
/* booleans describing shader, see ShaderDataFlag */
ccl_soa_member(int, flag);
/* booleans describing object of the shader, see ShaderDataObjectFlag */
ccl_soa_member(int, object_flag);
/* primitive id if there is one, ~0 otherwise */
ccl_soa_member(int, prim);
@@ -1040,10 +1096,10 @@ typedef struct KernelFilm {
float mist_falloff;
#ifdef __KERNEL_DEBUG__
int pass_bvh_traversal_steps;
int pass_bvh_traversed_nodes;
int pass_bvh_traversed_instances;
int pass_bvh_intersections;
int pass_ray_bounces;
int pass_pad3;
#endif
} KernelFilm;
static_assert_align(KernelFilm, 16);
@@ -1188,10 +1244,9 @@ static_assert_align(KernelData, 16);
* really important here.
*/
typedef ccl_addr_space struct DebugData {
// Total number of BVH node traversal steps and primitives intersections
// for the camera rays.
int num_bvh_traversal_steps;
int num_bvh_traversed_nodes;
int num_bvh_traversed_instances;
int num_bvh_intersections;
int num_ray_bounces;
} DebugData;
#endif

View File

@@ -102,6 +102,8 @@ ustring OSLRenderServices::u_curve_tangent_normal("geom:curve_tangent_normal");
#endif
ustring OSLRenderServices::u_path_ray_length("path:ray_length");
ustring OSLRenderServices::u_path_ray_depth("path:ray_depth");
ustring OSLRenderServices::u_path_diffuse_depth("path:diffuse_depth");
ustring OSLRenderServices::u_path_glossy_depth("path:glossy_depth");
ustring OSLRenderServices::u_path_transparent_depth("path:transparent_depth");
ustring OSLRenderServices::u_path_transmission_depth("path:transmission_depth");
ustring OSLRenderServices::u_trace("trace");
@@ -710,7 +712,7 @@ bool OSLRenderServices::get_object_standard_attribute(KernelGlobals *kg, ShaderD
else
motion_triangle_vertices(kg, sd->object, sd->prim, sd->time, P);
if(!(sd->flag & SD_TRANSFORM_APPLIED)) {
if(!(sd->object_flag & SD_OBJECT_TRANSFORM_APPLIED)) {
object_position_transform(kg, sd, &P[0]);
object_position_transform(kg, sd, &P[1]);
object_position_transform(kg, sd, &P[2]);
@@ -759,6 +761,24 @@ bool OSLRenderServices::get_background_attribute(KernelGlobals *kg, ShaderData *
int f = state->bounce;
return set_attribute_int(f, type, derivatives, val);
}
else if(name == u_path_diffuse_depth) {
/* Diffuse Ray Depth */
PathState *state = sd->osl_path_state;
int f = state->diffuse_bounce;
return set_attribute_int(f, type, derivatives, val);
}
else if(name == u_path_glossy_depth) {
/* Glossy Ray Depth */
PathState *state = sd->osl_path_state;
int f = state->glossy_bounce;
return set_attribute_int(f, type, derivatives, val);
}
else if(name == u_path_transmission_depth) {
/* Transmission Ray Depth */
PathState *state = sd->osl_path_state;
int f = state->transmission_bounce;
return set_attribute_int(f, type, derivatives, val);
}
else if(name == u_path_transparent_depth) {
/* Transparent Ray Depth */
PathState *state = sd->osl_path_state;

View File

@@ -165,6 +165,8 @@ public:
static ustring u_curve_tangent_normal;
static ustring u_path_ray_length;
static ustring u_path_ray_depth;
static ustring u_path_diffuse_depth;
static ustring u_path_glossy_depth;
static ustring u_path_transparent_depth;
static ustring u_path_transmission_depth;
static ustring u_trace;

View File

@@ -27,6 +27,8 @@ shader node_light_path(
output float IsVolumeScatterRay = 0.0,
output float RayLength = 0.0,
output float RayDepth = 0.0,
output float DiffuseDepth = 0.0,
output float GlossyDepth = 0.0,
output float TransparentDepth = 0.0,
output float TransmissionDepth = 0.0)
{
@@ -45,6 +47,14 @@ shader node_light_path(
getattribute("path:ray_depth", ray_depth);
RayDepth = (float)ray_depth;
int diffuse_depth;
getattribute("path:diffuse_depth", diffuse_depth);
DiffuseDepth = (float)diffuse_depth;
int glossy_depth;
getattribute("path:glossy_depth", glossy_depth);
GlossyDepth = (float)glossy_depth;
int transparent_depth;
getattribute("path:transparent_depth", transparent_depth);
TransparentDepth = (float)transparent_depth;

View File

@@ -137,22 +137,22 @@ ccl_device void kernel_holdout_emission_blurring_pathtermination_ao(
/* holdout */
#ifdef __HOLDOUT__
if((ccl_fetch(sd, flag) & (SD_HOLDOUT|SD_HOLDOUT_MASK)) &&
if(((ccl_fetch(sd, flag) & SD_HOLDOUT) ||
(ccl_fetch(sd, object_flag) & SD_OBJECT_HOLDOUT_MASK)) &&
(state->flag & PATH_RAY_CAMERA))
{
if(kernel_data.background.transparent) {
float3 holdout_weight;
if(ccl_fetch(sd, flag) & SD_HOLDOUT_MASK)
if(ccl_fetch(sd, object_flag) & SD_OBJECT_HOLDOUT_MASK) {
holdout_weight = make_float3(1.0f, 1.0f, 1.0f);
else
}
else {
holdout_weight = shader_holdout_eval(kg, sd);
}
/* any throughput is ok, should all be identical here */
L_transparent_coop[ray_index] += average(holdout_weight*throughput);
}
if(ccl_fetch(sd, flag) & SD_HOLDOUT_MASK) {
if(ccl_fetch(sd, object_flag) & SD_OBJECT_HOLDOUT_MASK) {
ASSIGN_RAY_STATE(ray_state, ray_index, RAY_UPDATE_BUFFER);
*enqueue_flag = 1;
}

View File

@@ -116,8 +116,9 @@ ccl_device void kernel_scene_intersect(
#ifdef __KERNEL_DEBUG__
if(state.flag & PATH_RAY_CAMERA) {
debug_data->num_bvh_traversal_steps += isect->num_traversal_steps;
debug_data->num_bvh_traversed_nodes += isect->num_traversed_nodes;
debug_data->num_bvh_traversed_instances += isect->num_traversed_instances;
debug_data->num_bvh_intersections += isect->num_intersections;
}
debug_data->num_ray_bounces++;
#endif

View File

@@ -34,6 +34,8 @@ ccl_device void svm_node_light_path(ShaderData *sd, ccl_addr_space PathState *st
case NODE_LP_backfacing: info = (ccl_fetch(sd, flag) & SD_BACKFACING)? 1.0f: 0.0f; break;
case NODE_LP_ray_length: info = ccl_fetch(sd, ray_length); break;
case NODE_LP_ray_depth: info = (float)state->bounce; break;
case NODE_LP_ray_diffuse: info = (float)state->diffuse_bounce; break;
case NODE_LP_ray_glossy: info = (float)state->glossy_bounce; break;
case NODE_LP_ray_transparent: info = (float)state->transparent_bounce; break;
case NODE_LP_ray_transmission: info = (float)state->transmission_bounce; break;
}

View File

@@ -188,6 +188,8 @@ typedef enum NodeLightPath {
NODE_LP_backfacing,
NODE_LP_ray_length,
NODE_LP_ray_depth,
NODE_LP_ray_diffuse,
NODE_LP_ray_glossy,
NODE_LP_ray_transparent,
NODE_LP_ray_transmission,
} NodeLightPath;

View File

@@ -57,7 +57,7 @@ ccl_device_inline float wireframe(KernelGlobals *kg,
else
motion_triangle_vertices(kg, ccl_fetch(sd, object), ccl_fetch(sd, prim), ccl_fetch(sd, time), Co);
if(!(ccl_fetch(sd, flag) & SD_TRANSFORM_APPLIED)) {
if(!(ccl_fetch(sd, object_flag) & SD_OBJECT_TRANSFORM_APPLIED)) {
object_position_transform(kg, sd, &Co[0]);
object_position_transform(kg, sd, &Co[1]);
object_position_transform(kg, sd, &Co[2]);

View File

@@ -185,13 +185,11 @@ bool RenderBuffers::get_pass_rect(PassType type, float exposure, int sample, int
}
}
#ifdef WITH_CYCLES_DEBUG
else if(type == PASS_BVH_TRAVERSAL_STEPS) {
for(int i = 0; i < size; i++, in += pass_stride, pixels++) {
float f = *in;
pixels[0] = f*scale;
}
}
else if(type == PASS_RAY_BOUNCES) {
else if(type == PASS_BVH_TRAVERSED_NODES ||
type == PASS_BVH_TRAVERSED_INSTANCES ||
type == PASS_BVH_INTERSECTIONS ||
type == PASS_RAY_BOUNCES)
{
for(int i = 0; i < size; i++, in += pass_stride, pixels++) {
float f = *in;
pixels[0] = f*scale;

View File

@@ -154,14 +154,9 @@ void Pass::add(PassType type, array<Pass>& passes)
pass.components = 0;
break;
#ifdef WITH_CYCLES_DEBUG
case PASS_BVH_TRAVERSAL_STEPS:
pass.components = 1;
pass.exposure = false;
break;
case PASS_BVH_TRAVERSED_NODES:
case PASS_BVH_TRAVERSED_INSTANCES:
pass.components = 1;
pass.exposure = false;
break;
case PASS_BVH_INTERSECTIONS:
case PASS_RAY_BOUNCES:
pass.components = 1;
pass.exposure = false;
@@ -421,12 +416,15 @@ void Film::device_update(Device *device, DeviceScene *dscene, Scene *scene)
break;
#ifdef WITH_CYCLES_DEBUG
case PASS_BVH_TRAVERSAL_STEPS:
kfilm->pass_bvh_traversal_steps = kfilm->pass_stride;
case PASS_BVH_TRAVERSED_NODES:
kfilm->pass_bvh_traversed_nodes = kfilm->pass_stride;
break;
case PASS_BVH_TRAVERSED_INSTANCES:
kfilm->pass_bvh_traversed_instances = kfilm->pass_stride;
break;
case PASS_BVH_INTERSECTIONS:
kfilm->pass_bvh_intersections = kfilm->pass_stride;
break;
case PASS_RAY_BOUNCES:
kfilm->pass_ray_bounces = kfilm->pass_stride;
break;

View File

@@ -258,12 +258,14 @@ static bool image_equals(ImageManager::Image *image,
const string& filename,
void *builtin_data,
InterpolationType interpolation,
ExtensionType extension)
ExtensionType extension,
bool use_alpha)
{
return image->filename == filename &&
image->builtin_data == builtin_data &&
image->interpolation == interpolation &&
image->extension == extension;
image->extension == extension &&
image->use_alpha == use_alpha;
}
int ImageManager::add_image(const string& filename,
@@ -305,7 +307,8 @@ int ImageManager::add_image(const string& filename,
filename,
builtin_data,
interpolation,
extension))
extension,
use_alpha))
{
if(img->frame != frame) {
img->frame = frame;
@@ -377,7 +380,8 @@ void ImageManager::remove_image(int flat_slot)
void ImageManager::remove_image(const string& filename,
void *builtin_data,
InterpolationType interpolation,
ExtensionType extension)
ExtensionType extension,
bool use_alpha)
{
size_t slot;
@@ -387,7 +391,8 @@ void ImageManager::remove_image(const string& filename,
filename,
builtin_data,
interpolation,
extension))
extension,
use_alpha))
{
remove_image(type_index_to_flattened_slot(slot, (ImageDataType)type));
return;
@@ -403,7 +408,8 @@ void ImageManager::remove_image(const string& filename,
void ImageManager::tag_reload_image(const string& filename,
void *builtin_data,
InterpolationType interpolation,
ExtensionType extension)
ExtensionType extension,
bool use_alpha)
{
for(size_t type = 0; type < IMAGE_DATA_NUM_TYPES; type++) {
for(size_t slot = 0; slot < images[type].size(); slot++) {
@@ -411,7 +417,8 @@ void ImageManager::tag_reload_image(const string& filename,
filename,
builtin_data,
interpolation,
extension))
extension,
use_alpha))
{
images[type][slot]->need_load = true;
break;

View File

@@ -61,11 +61,13 @@ public:
void remove_image(const string& filename,
void *builtin_data,
InterpolationType interpolation,
ExtensionType extension);
ExtensionType extension,
bool use_alpha);
void tag_reload_image(const string& filename,
void *builtin_data,
InterpolationType interpolation,
ExtensionType extension);
ExtensionType extension,
bool use_alpha);
ImageDataType get_image_metadata(const string& filename, void *builtin_data, bool& is_linear);
void device_update(Device *device,

View File

@@ -49,6 +49,64 @@ void Mesh::Triangle::bounds_grow(const float3 *verts, BoundBox& bounds) const
bounds.grow(verts[v[2]]);
}
void Mesh::Triangle::motion_verts(const float3 *verts,
const float3 *vert_steps,
size_t num_verts,
size_t num_steps,
float time,
float3 r_verts[3]) const
{
/* Figure out which steps we need to fetch and their interpolation factor. */
const size_t max_step = num_steps - 1;
const size_t step = min((int)(time * max_step), max_step - 1);
const float t = time*max_step - step;
/* Fetch vertex coordinates. */
float3 curr_verts[3];
float3 next_verts[3];
verts_for_step(verts,
vert_steps,
num_verts,
num_steps,
step,
curr_verts);
verts_for_step(verts,
vert_steps,
num_verts,
num_steps,
step + 1,
next_verts);
/* Interpolate between steps. */
r_verts[0] = (1.0f - t)*curr_verts[0] + t*next_verts[0];
r_verts[1] = (1.0f - t)*curr_verts[1] + t*next_verts[1];
r_verts[2] = (1.0f - t)*curr_verts[2] + t*next_verts[2];
}
void Mesh::Triangle::verts_for_step(const float3 *verts,
const float3 *vert_steps,
size_t num_verts,
size_t num_steps,
size_t step,
float3 r_verts[3]) const
{
const size_t center_step = ((num_steps - 1) / 2);
if(step == center_step) {
/* Center step: regular vertex location. */
r_verts[0] = verts[v[0]];
r_verts[1] = verts[v[1]];
r_verts[2] = verts[v[2]];
}
else {
/* Center step not stored in the attribute array array. */
if(step > center_step) {
step--;
}
size_t offset = step * num_verts;
r_verts[0] = vert_steps[offset + v[0]];
r_verts[1] = vert_steps[offset + v[1]];
r_verts[2] = vert_steps[offset + v[2]];
}
}
/* Curve */
void Mesh::Curve::bounds_grow(const int k, const float3 *curve_keys, const float *curve_radius, BoundBox& bounds) const
@@ -104,6 +162,205 @@ void Mesh::Curve::bounds_grow(const int k,
bounds.grow(upper, mr);
}
void Mesh::Curve::bounds_grow(float4 keys[4], BoundBox& bounds) const
{
float3 P[4] = {
float4_to_float3(keys[0]),
float4_to_float3(keys[1]),
float4_to_float3(keys[2]),
float4_to_float3(keys[3]),
};
float3 lower;
float3 upper;
curvebounds(&lower.x, &upper.x, P, 0);
curvebounds(&lower.y, &upper.y, P, 1);
curvebounds(&lower.z, &upper.z, P, 2);
float mr = max(keys[1].w, keys[2].w);
bounds.grow(lower, mr);
bounds.grow(upper, mr);
}
void Mesh::Curve::motion_keys(const float3 *curve_keys,
const float *curve_radius,
const float3 *key_steps,
size_t num_curve_keys,
size_t num_steps,
float time,
size_t k0, size_t k1,
float4 r_keys[2]) const
{
/* Figure out which steps we need to fetch and their interpolation factor. */
const size_t max_step = num_steps - 1;
const size_t step = min((int)(time * max_step), max_step - 1);
const float t = time*max_step - step;
/* Fetch vertex coordinates. */
float4 curr_keys[2];
float4 next_keys[2];
keys_for_step(curve_keys,
curve_radius,
key_steps,
num_curve_keys,
num_steps,
step,
k0, k1,
curr_keys);
keys_for_step(curve_keys,
curve_radius,
key_steps,
num_curve_keys,
num_steps,
step + 1,
k0, k1,
next_keys);
/* Interpolate between steps. */
r_keys[0] = (1.0f - t)*curr_keys[0] + t*next_keys[0];
r_keys[1] = (1.0f - t)*curr_keys[1] + t*next_keys[1];
}
void Mesh::Curve::cardinal_motion_keys(const float3 *curve_keys,
const float *curve_radius,
const float3 *key_steps,
size_t num_curve_keys,
size_t num_steps,
float time,
size_t k0, size_t k1,
size_t k2, size_t k3,
float4 r_keys[4]) const
{
/* Figure out which steps we need to fetch and their interpolation factor. */
const size_t max_step = num_steps - 1;
const size_t step = min((int)(time * max_step), max_step - 1);
const float t = time*max_step - step;
/* Fetch vertex coordinates. */
float4 curr_keys[4];
float4 next_keys[4];
cardinal_keys_for_step(curve_keys,
curve_radius,
key_steps,
num_curve_keys,
num_steps,
step,
k0, k1, k2, k3,
curr_keys);
cardinal_keys_for_step(curve_keys,
curve_radius,
key_steps,
num_curve_keys,
num_steps,
step + 1,
k0, k1, k2, k3,
next_keys);
/* Interpolate between steps. */
r_keys[0] = (1.0f - t)*curr_keys[0] + t*next_keys[0];
r_keys[1] = (1.0f - t)*curr_keys[1] + t*next_keys[1];
r_keys[2] = (1.0f - t)*curr_keys[2] + t*next_keys[2];
r_keys[3] = (1.0f - t)*curr_keys[3] + t*next_keys[3];
}
void Mesh::Curve::keys_for_step(const float3 *curve_keys,
const float *curve_radius,
const float3 *key_steps,
size_t num_curve_keys,
size_t num_steps,
size_t step,
size_t k0, size_t k1,
float4 r_keys[2]) const
{
k0 = max(k0, 0);
k1 = min(k1, num_keys - 1);
const size_t center_step = ((num_steps - 1) / 2);
if(step == center_step) {
/* Center step: regular key location. */
/* TODO(sergey): Consider adding make_float4(float3, float)
* function.
*/
r_keys[0] = make_float4(curve_keys[first_key + k0].x,
curve_keys[first_key + k0].y,
curve_keys[first_key + k0].z,
curve_radius[first_key + k0]);
r_keys[1] = make_float4(curve_keys[first_key + k1].x,
curve_keys[first_key + k1].y,
curve_keys[first_key + k1].z,
curve_radius[first_key + k1]);
}
else {
/* Center step is not stored in this array. */
if(step > center_step) {
step--;
}
const size_t offset = first_key + step * num_curve_keys;
r_keys[0] = make_float4(key_steps[offset + k0].x,
key_steps[offset + k0].y,
key_steps[offset + k0].z,
curve_radius[first_key + k0]);
r_keys[1] = make_float4(key_steps[offset + k1].x,
key_steps[offset + k1].y,
key_steps[offset + k1].z,
curve_radius[first_key + k1]);
}
}
void Mesh::Curve::cardinal_keys_for_step(const float3 *curve_keys,
const float *curve_radius,
const float3 *key_steps,
size_t num_curve_keys,
size_t num_steps,
size_t step,
size_t k0, size_t k1,
size_t k2, size_t k3,
float4 r_keys[4]) const
{
k0 = max(k0, 0);
k3 = min(k3, num_keys - 1);
const size_t center_step = ((num_steps - 1) / 2);
if(step == center_step) {
/* Center step: regular key location. */
r_keys[0] = make_float4(curve_keys[first_key + k0].x,
curve_keys[first_key + k0].y,
curve_keys[first_key + k0].z,
curve_radius[first_key + k0]);
r_keys[1] = make_float4(curve_keys[first_key + k1].x,
curve_keys[first_key + k1].y,
curve_keys[first_key + k1].z,
curve_radius[first_key + k1]);
r_keys[2] = make_float4(curve_keys[first_key + k2].x,
curve_keys[first_key + k2].y,
curve_keys[first_key + k2].z,
curve_radius[first_key + k2]);
r_keys[3] = make_float4(curve_keys[first_key + k3].x,
curve_keys[first_key + k3].y,
curve_keys[first_key + k3].z,
curve_radius[first_key + k3]);
}
else {
/* Center step is not stored in this array. */
if(step > center_step) {
step--;
}
const size_t offset = first_key + step * num_curve_keys;
r_keys[0] = make_float4(key_steps[offset + k0].x,
key_steps[offset + k0].y,
key_steps[offset + k0].z,
curve_radius[first_key + k0]);
r_keys[1] = make_float4(key_steps[offset + k1].x,
key_steps[offset + k1].y,
key_steps[offset + k1].z,
curve_radius[first_key + k1]);
r_keys[2] = make_float4(key_steps[offset + k2].x,
key_steps[offset + k2].y,
key_steps[offset + k2].z,
curve_radius[first_key + k2]);
r_keys[3] = make_float4(key_steps[offset + k3].x,
key_steps[offset + k3].y,
key_steps[offset + k3].z,
curve_radius[first_key + k3]);
}
}
/* SubdFace */
float3 Mesh::SubdFace::normal(const Mesh *mesh) const
@@ -394,7 +651,7 @@ void Mesh::compute_bounds()
if(use_motion_blur && attr) {
size_t steps_size = verts.size() * (motion_steps - 1);
float3 *vert_steps = attr->data_float3();
for(size_t i = 0; i < steps_size; i++)
bnds.grow(vert_steps[i]);
}
@@ -403,7 +660,7 @@ void Mesh::compute_bounds()
if(use_motion_blur && curve_attr) {
size_t steps_size = curve_keys.size() * (motion_steps - 1);
float3 *key_steps = curve_attr->data_float3();
for(size_t i = 0; i < steps_size; i++)
bnds.grow(key_steps[i]);
}
@@ -417,11 +674,11 @@ void Mesh::compute_bounds()
for(size_t i = 0; i < curve_keys_size; i++)
bnds.grow_safe(curve_keys[i], curve_radius[i]);
if(use_motion_blur && attr) {
size_t steps_size = verts.size() * (motion_steps - 1);
float3 *vert_steps = attr->data_float3();
for(size_t i = 0; i < steps_size; i++)
bnds.grow_safe(vert_steps[i]);
}
@@ -429,7 +686,7 @@ void Mesh::compute_bounds()
if(use_motion_blur && curve_attr) {
size_t steps_size = curve_keys.size() * (motion_steps - 1);
float3 *key_steps = curve_attr->data_float3();
for(size_t i = 0; i < steps_size; i++)
bnds.grow_safe(key_steps[i]);
}
@@ -464,7 +721,7 @@ void Mesh::add_face_normals()
/* don't compute if already there */
if(attributes.find(ATTR_STD_FACE_NORMAL))
return;
/* get attributes */
Attribute *attr_fN = attributes.add(ATTR_STD_FACE_NORMAL);
float3 *fN = attr_fN->data_float3();
@@ -796,6 +1053,8 @@ void Mesh::compute_bvh(DeviceScene *dscene,
bparams.use_qbvh = params->use_qbvh;
bparams.use_unaligned_nodes = dscene->data.bvh.have_curves &&
params->use_bvh_unaligned_nodes;
bparams.num_motion_triangle_steps = params->num_bvh_time_steps;
bparams.num_motion_curve_steps = params->num_bvh_time_steps;
delete bvh;
bvh = BVH::create(bparams, objects);
@@ -1002,7 +1261,7 @@ void MeshManager::update_svm_attributes(Device *device, DeviceScene *dscene, Sce
if(attr_map_stride == 0)
return;
/* create attribute map */
uint4 *attr_map = dscene->attributes_map.resize(attr_map_stride*scene->objects.size());
memset(attr_map, 0, dscene->attributes_map.size()*sizeof(uint));
@@ -1564,6 +1823,8 @@ void MeshManager::device_update_bvh(Device *device, DeviceScene *dscene, Scene *
bparams.use_spatial_split = scene->params.use_bvh_spatial_split;
bparams.use_unaligned_nodes = dscene->data.bvh.have_curves &&
scene->params.use_bvh_unaligned_nodes;
bparams.num_motion_triangle_steps = scene->params.num_bvh_time_steps;
bparams.num_motion_curve_steps = scene->params.num_bvh_time_steps;
delete bvh;
bvh = BVH::create(bparams, scene->objects);
@@ -1946,14 +2207,14 @@ bool Mesh::need_attribute(Scene *scene, AttributeStandard std)
{
if(std == ATTR_STD_NONE)
return false;
if(scene->need_global_attribute(std))
return true;
foreach(Shader *shader, used_shaders)
if(shader->attributes.find(std))
return true;
return false;
}
@@ -1965,9 +2226,8 @@ bool Mesh::need_attribute(Scene * /*scene*/, ustring name)
foreach(Shader *shader, used_shaders)
if(shader->attributes.find(name))
return true;
return false;
}
CCL_NAMESPACE_END

View File

@@ -31,6 +31,7 @@
CCL_NAMESPACE_BEGIN
class Attribute;
class BVH;
class Device;
class DeviceScene;
@@ -54,11 +55,27 @@ public:
int v[3];
void bounds_grow(const float3 *verts, BoundBox& bounds) const;
void motion_verts(const float3 *verts,
const float3 *vert_steps,
size_t num_verts,
size_t num_steps,
float time,
float3 r_verts[3]) const;
void verts_for_step(const float3 *verts,
const float3 *vert_steps,
size_t num_verts,
size_t num_steps,
size_t step,
float3 r_verts[3]) const;
};
Triangle get_triangle(size_t i) const
{
Triangle tri = {{triangles[i*3 + 0], triangles[i*3 + 1], triangles[i*3 + 2]}};
Triangle tri = {{triangles[i*3 + 0],
triangles[i*3 + 1],
triangles[i*3 + 2]}};
return tri;
}
@@ -78,11 +95,48 @@ public:
const float3 *curve_keys,
const float *curve_radius,
BoundBox& bounds) const;
void bounds_grow(float4 keys[4], BoundBox& bounds) const;
void bounds_grow(const int k,
const float3 *curve_keys,
const float *curve_radius,
const Transform& aligned_space,
BoundBox& bounds) const;
void motion_keys(const float3 *curve_keys,
const float *curve_radius,
const float3 *key_steps,
size_t num_curve_keys,
size_t num_steps,
float time,
size_t k0, size_t k1,
float4 r_keys[2]) const;
void cardinal_motion_keys(const float3 *curve_keys,
const float *curve_radius,
const float3 *key_steps,
size_t num_curve_keys,
size_t num_steps,
float time,
size_t k0, size_t k1,
size_t k2, size_t k3,
float4 r_keys[4]) const;
void keys_for_step(const float3 *curve_keys,
const float *curve_radius,
const float3 *key_steps,
size_t num_curve_keys,
size_t num_steps,
size_t step,
size_t k0, size_t k1,
float4 r_keys[2]) const;
void cardinal_keys_for_step(const float3 *curve_keys,
const float *curve_radius,
const float3 *key_steps,
size_t num_curve_keys,
size_t num_steps,
size_t step,
size_t k0, size_t k1,
size_t k2, size_t k3,
float4 r_keys[4]) const;
};
Curve get_curve(size_t i) const

View File

@@ -92,7 +92,7 @@ namespace Far {
if(vert_edges.size() == 2) {
float sharpness = refiner.getLevel(0).getEdgeSharpness(vert_edges[0]);
sharpness = min(sharpness, refiner.getLevel(0).getEdgeSharpness(vert_edges[1]));
sharpness = ccl::min(sharpness, refiner.getLevel(0).getEdgeSharpness(vert_edges[1]));
setBaseVertexSharpness(refiner, i, sharpness);
}

View File

@@ -263,7 +263,8 @@ ImageTextureNode::~ImageTextureNode()
image_manager->remove_image(filename.string(),
builtin_data,
interpolation,
extension);
extension,
use_alpha);
}
}
@@ -462,7 +463,8 @@ EnvironmentTextureNode::~EnvironmentTextureNode()
image_manager->remove_image(filename.string(),
builtin_data,
interpolation,
EXTENSION_REPEAT);
EXTENSION_REPEAT,
use_alpha);
}
}
@@ -1381,7 +1383,8 @@ PointDensityTextureNode::~PointDensityTextureNode()
image_manager->remove_image(filename.string(),
builtin_data,
interpolation,
EXTENSION_CLIP);
EXTENSION_CLIP,
true);
}
}
@@ -3027,6 +3030,8 @@ NODE_DEFINE(LightPathNode)
SOCKET_OUT_FLOAT(is_volume_scatter_ray, "Is Volume Scatter Ray");
SOCKET_OUT_FLOAT(ray_length, "Ray Length");
SOCKET_OUT_FLOAT(ray_depth, "Ray Depth");
SOCKET_OUT_FLOAT(diffuse_depth, "Diffuse Depth");
SOCKET_OUT_FLOAT(glossy_depth, "Glossy Depth");
SOCKET_OUT_FLOAT(transparent_depth, "Transparent Depth");
SOCKET_OUT_FLOAT(transmission_depth, "Transmission Depth");
@@ -3093,6 +3098,16 @@ void LightPathNode::compile(SVMCompiler& compiler)
compiler.add_node(NODE_LIGHT_PATH, NODE_LP_ray_depth, compiler.stack_assign(out));
}
out = output("Diffuse Depth");
if(!out->links.empty()) {
compiler.add_node(NODE_LIGHT_PATH, NODE_LP_ray_diffuse, compiler.stack_assign(out));
}
out = output("Glossy Depth");
if(!out->links.empty()) {
compiler.add_node(NODE_LIGHT_PATH, NODE_LP_ray_glossy, compiler.stack_assign(out));
}
out = output("Transparent Depth");
if(!out->links.empty()) {
compiler.add_node(NODE_LIGHT_PATH, NODE_LP_ray_transparent, compiler.stack_assign(out));

View File

@@ -166,7 +166,7 @@ void Object::apply_transform(bool apply_to_motion)
float3 c0 = transform_get_column(&tfm, 0);
float3 c1 = transform_get_column(&tfm, 1);
float3 c2 = transform_get_column(&tfm, 2);
float scalar = pow(fabsf(dot(cross(c0, c1), c2)), 1.0f/3.0f);
float scalar = powf(fabsf(dot(cross(c0, c1), c2)), 1.0f/3.0f);
/* apply transform to curve keys */
for(size_t i = 0; i < mesh->curve_keys.size(); i++) {
@@ -410,7 +410,7 @@ void ObjectManager::device_update_object_transform(UpdateObejctTransformState *s
/* Object flag. */
if(ob->use_holdout) {
flag |= SD_HOLDOUT_MASK;
flag |= SD_OBJECT_HOLDOUT_MASK;
}
state->object_flag[object_index] = flag;
@@ -716,9 +716,9 @@ void ObjectManager::apply_static_transforms(DeviceScene *dscene, Scene *scene, u
if(progress.get_cancel()) return;
}
object_flag[i] |= SD_TRANSFORM_APPLIED;
object_flag[i] |= SD_OBJECT_TRANSFORM_APPLIED;
if(object->mesh->transform_negative_scaled)
object_flag[i] |= SD_NEGATIVE_SCALE_APPLIED;
object_flag[i] |= SD_OBJECT_NEGATIVE_SCALE_APPLIED;
}
else
have_instancing = true;

View File

@@ -143,6 +143,7 @@ public:
} bvh_type;
bool use_bvh_spatial_split;
bool use_bvh_unaligned_nodes;
int num_bvh_time_steps;
bool use_qbvh;
bool persistent_data;
int texture_limit;
@@ -153,6 +154,7 @@ public:
bvh_type = BVH_DYNAMIC;
use_bvh_spatial_split = false;
use_bvh_unaligned_nodes = true;
num_bvh_time_steps = 0;
use_qbvh = false;
persistent_data = false;
texture_limit = 0;
@@ -163,6 +165,7 @@ public:
&& bvh_type == params.bvh_type
&& use_bvh_spatial_split == params.use_bvh_spatial_split
&& use_bvh_unaligned_nodes == params.use_bvh_unaligned_nodes
&& num_bvh_time_steps == params.num_bvh_time_steps
&& use_qbvh == params.use_qbvh
&& persistent_data == params.persistent_data
&& texture_limit == params.texture_limit); }

View File

@@ -458,6 +458,8 @@ void Session::release_tile(RenderTile& rtile)
{
thread_scoped_lock tile_lock(tile_mutex);
progress.add_finished_tile();
if(write_render_tile_cb) {
if(params.progressive_refine == false) {
/* todo: optimize this by making it thread safe and removing lock */
@@ -834,11 +836,11 @@ void Session::update_status_time(bool show_pause, bool show_done)
substatus = string_printf("Path Tracing Tile %d/%d", tile, num_tiles);
if(device->show_samples() || (is_cpu && is_last_tile))
{
if(device->show_samples() || (is_cpu && is_last_tile)) {
/* Some devices automatically support showing the sample number:
* - CUDADevice
* - OpenCLDevice when using the megakernel (the split kernel renders multiple samples at the same time, so the current sample isn't really defined)
* - OpenCLDevice when using the megakernel (the split kernel renders multiple
* samples at the same time, so the current sample isn't really defined)
* - CPUDevice when using one thread
* For these devices, the current sample is always shown.
*

View File

@@ -157,7 +157,7 @@ void TileManager::set_samples(int num_samples_)
divider >>= 1;
}
state.total_pixel_samples = pixel_samples + get_num_effective_samples() * params.width*params.height;
state.total_pixel_samples = pixel_samples + (uint64_t)get_num_effective_samples() * params.width*params.height;
}
}

View File

@@ -54,12 +54,23 @@ if(WITH_CYCLES_OPENSUBDIV)
endif()
list(APPEND ALL_CYCLES_LIBRARIES
${BOOST_LIBRARIES}
${PNG_LIBRARIES}
${JPEG_LIBRARIES}
${ZLIB_LIBRARIES}
${TIFF_LIBRARY}
${OPENIMAGEIO_LIBRARIES}
${OPENEXR_LIBRARIES}
)
include_directories(${INC})
link_directories(${BOOST_LIBPATH})
link_directories(${OPENIMAGEIO_LIBPATH})
link_directories(${OPENIMAGEIO_LIBPATH}
${BOOST_LIBPATH}
${PNG_LIBPATH}
${JPEG_LIBPATH}
${ZLIB_LIBPATH}
${TIFF_LIBPATH}
${OPENEXR_LIBPATH})
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}")

View File

@@ -25,8 +25,6 @@
#include "util_transform.h"
#include "util_types.h"
using namespace std;
CCL_NAMESPACE_BEGIN
/* 3D BoundBox */

View File

@@ -22,6 +22,11 @@
* Basic math functions on scalar and vector types. This header is used by
* both the kernel code when compiled as C++, and other C++ non-kernel code. */
#ifndef __KERNEL_GPU__
# include <cmath>
#endif
#ifndef __KERNEL_OPENCL__
#include <float.h>
@@ -97,6 +102,9 @@ ccl_device_inline float fminf(float a, float b)
#ifndef __KERNEL_GPU__
using std::isfinite;
using std::isnan;
ccl_device_inline int abs(int x)
{
return (x > 0)? x: -x;
@@ -1233,6 +1241,20 @@ ccl_device_inline float __uint_as_float(uint i)
return u.f;
}
/* Versions of functions which are safe for fast math. */
ccl_device_inline bool isnan_safe(float f)
{
unsigned int x = __float_as_uint(f);
return (x << 1) > 0xff000000u;
}
ccl_device_inline bool isfinite_safe(float f)
{
/* By IEEE 754 rule, 2*Inf equals Inf */
unsigned int x = __float_as_uint(f);
return (f == f) && (x == 0 || (f != 2.0f*f));
}
/* Interpolation */
template<class A, class B> A lerp(const A& a, const A& b, const B& t)

View File

@@ -21,9 +21,9 @@
CCL_NAMESPACE_BEGIN
#define CYCLES_VERSION_MAJOR 1
#define CYCLES_VERSION_MINOR 7
#define CYCLES_VERSION_PATCH 0
#define CYCLES_VERSION_MAJOR 1
#define CYCLES_VERSION_MINOR 8
#define CYCLES_VERSION_PATCH 1
#define CYCLES_MAKE_VERSION_STRING2(a,b,c) #a "." #b "." #c
#define CYCLES_MAKE_VERSION_STRING(a,b,c) CYCLES_MAKE_VERSION_STRING2(a,b,c)

View File

@@ -134,6 +134,8 @@ private:
/** The OpenGL drawing context */
NSOpenGLContext *m_openGLContext;
bool m_coreProfile;
//static CGLEWContext *s_cglewContext;
const bool m_debug;

View File

@@ -63,6 +63,23 @@ GHOST_ContextCGL::GHOST_ContextCGL(
m_debug(contextFlags)
{
assert(openGLView != nil);
// for now be very strict about OpenGL version requested
switch (contextMajorVersion) {
case 2:
assert(contextMinorVersion == 1);
assert(contextProfileMask == 0);
m_coreProfile = false;
break;
case 3:
// Apple didn't implement 3.0 or 3.1
assert(contextMinorVersion == 2);
assert(contextProfileMask == GL_CONTEXT_CORE_PROFILE_BIT);
m_coreProfile = true;
break;
default:
assert(false);
}
}
@@ -170,6 +187,7 @@ GHOST_TSuccess GHOST_ContextCGL::updateDrawingContext()
static void makeAttribList(
std::vector<NSOpenGLPixelFormatAttribute>& attribs,
bool coreProfile,
bool stereoVisual,
int numOfAASamples,
bool needAlpha,
@@ -178,6 +196,9 @@ static void makeAttribList(
{
attribs.clear();
attribs.push_back(NSOpenGLPFAOpenGLProfile);
attribs.push_back(coreProfile ? NSOpenGLProfileVersion3_2Core : NSOpenGLProfileVersionLegacy);
// Pixel Format Attributes for the windowed NSOpenGLContext
attribs.push_back(NSOpenGLPFADoubleBuffer);
@@ -190,8 +211,7 @@ static void makeAttribList(
attribs.push_back(NSOpenGLPFANoRecovery);
}
/* Removed to allow 10.4 builds, and 2 GPUs rendering is not used anyway */
//attribs.push_back(NSOpenGLPFAAllowOfflineRenderers);
attribs.push_back(NSOpenGLPFAAllowOfflineRenderers); // for automatic GPU switching
attribs.push_back(NSOpenGLPFADepthSize);
attribs.push_back((NSOpenGLPixelFormatAttribute) 32);
@@ -263,7 +283,7 @@ GHOST_TSuccess GHOST_ContextCGL::initializeDrawingContext()
NSOpenGLPixelFormat *pixelFormat;
// TODO: keep pixel format for subsequent windows/contexts instead of recreating each time
makeAttribList(attribs, m_stereoVisual, m_numOfAASamples, needAlpha, needStencil, softwareGL);
makeAttribList(attribs, m_coreProfile, m_stereoVisual, m_numOfAASamples, needAlpha, needStencil, softwareGL);
pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:&attribs[0]];
@@ -274,7 +294,7 @@ GHOST_TSuccess GHOST_ContextCGL::initializeDrawingContext()
// (Now that I think about it, does WGL really require the code that it has for finding a lesser match?)
attribs.clear();
makeAttribList(attribs, m_stereoVisual, 0, needAlpha, needStencil, softwareGL);
makeAttribList(attribs, m_coreProfile, m_stereoVisual, 0, needAlpha, needStencil, softwareGL);
pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:&attribs[0]];
}
@@ -316,7 +336,7 @@ GHOST_TSuccess GHOST_ContextCGL::initializeDrawingContext()
[m_openGLContext release];
// create software GL context
makeAttribList(attribs, m_stereoVisual, m_numOfAASamples, needAlpha, needStencil, softwareGL);
makeAttribList(attribs, m_coreProfile, m_stereoVisual, m_numOfAASamples, needAlpha, needStencil, softwareGL);
pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:&attribs[0]];
m_openGLContext = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:s_sharedOpenGLContext];
[pixelFormat release];

View File

@@ -255,9 +255,6 @@ const bool GLXEW_ARB_create_context_robustness =
if (m_contextMajorVersion != 0) {
attribs[i++] = GLX_CONTEXT_MAJOR_VERSION_ARB;
attribs[i++] = m_contextMajorVersion;
}
if (m_contextMinorVersion != 0) {
attribs[i++] = GLX_CONTEXT_MINOR_VERSION_ARB;
attribs[i++] = m_contextMinorVersion;
}
@@ -300,8 +297,8 @@ const bool GLXEW_ARB_create_context_robustness =
}
}
else {
/* Create legacy context */
m_context = glXCreateContext(m_display, m_visualInfo, s_sharedContext, True);
/* Don't create legacy context */
fprintf(stderr, "Warning! GLX_ARB_create_context not available.\n");
}
GHOST_TSuccess success;
@@ -328,8 +325,14 @@ const bool GLXEW_ARB_create_context_robustness =
version = glGetString(GL_VERSION);
if (!version || version[0] < '2' || ((version[0] == '2') && (version[2] < '1'))) {
fprintf(stderr, "Error! Blender requires OpenGL 2.1 to run. Try updating your drivers.\n");
#if 0 // enable this when Blender switches to 3.3 core profile
if (!version || version[0] < '3' || ((version[0] == '3') && (version[2] < '3'))) {
fprintf(stderr, "Error! Blender requires OpenGL 3.3 to run. Try updating your drivers.\n");
#else
// with Mesa, the closest thing to 3.3 compatibility profile is 3.0
if (!version || version[0] < '3') {
fprintf(stderr, "Error! Blender requires OpenGL 3.0 (soon 3.3) to run. Try updating your drivers.\n");
#endif
fflush(stderr);
/* ugly, but we get crashes unless a whole bunch of systems are patched. */
exit(0);

View File

@@ -962,7 +962,7 @@ GHOST_TSuccess GHOST_ContextWGL::initializeDrawingContext()
strcmp(renderer, "GDI Generic") == 0) && version[0] == '1' && version[2] == '1')
{
MessageBox(m_hWnd, "Your system does not use 3D hardware acceleration.\n"
"Blender requires a graphics driver with OpenGL 2.1 support.\n\n"
"Blender requires a graphics driver with OpenGL 3.3 support.\n\n"
"This may be caused by:\n"
"* A missing or faulty graphics driver installation.\n"
" Blender needs a graphics card driver to work correctly.\n"
@@ -973,8 +973,8 @@ GHOST_TSuccess GHOST_ContextWGL::initializeDrawingContext()
MB_OK | MB_ICONERROR);
exit(0);
}
else if (version[0] < '2' || (version[0] == '2' && version[2] < '1')) {
MessageBox(m_hWnd, "Blender requires a graphics driver with OpenGL 2.1 support.\n\n"
else if (version[0] < '3' || (version[0] == '3' && version[2] < '3')) {
MessageBox(m_hWnd, "Blender requires a graphics driver with OpenGL 3.3 support.\n\n"
"The program will now close.",
"Blender - Unsupported Graphics Driver!",
MB_OK | MB_ICONERROR);

View File

@@ -46,14 +46,6 @@
extern "C" WGLEWContext *wglewContext;
#endif
#ifndef GHOST_OPENGL_WGL_CONTEXT_FLAGS
# ifdef WITH_GPU_DEBUG
# define GHOST_OPENGL_WGL_CONTEXT_FLAGS WGL_CONTEXT_DEBUG_BIT_ARB
# else
# define GHOST_OPENGL_WGL_CONTEXT_FLAGS 0
# endif
#endif
#ifndef GHOST_OPENGL_WGL_RESET_NOTIFICATION_STRATEGY
#define GHOST_OPENGL_WGL_RESET_NOTIFICATION_STRATEGY 0
#endif

View File

@@ -1086,82 +1086,23 @@ GHOST_TSuccess GHOST_WindowCocoa::setOrder(GHOST_TWindowOrder order)
GHOST_Context *GHOST_WindowCocoa::newDrawingContext(GHOST_TDrawingContextType type)
{
if (type == GHOST_kDrawingContextTypeOpenGL) {
#if !defined(WITH_GL_EGL)
#if defined(WITH_GL_PROFILE_CORE)
GHOST_Context *context = new GHOST_ContextCGL(
m_wantStereoVisual,
m_wantNumOfAASamples,
m_window,
m_openGLView,
#if defined(WITH_GL_PROFILE_CORE)
GL_CONTEXT_CORE_PROFILE_BIT,
3, 2,
#else
0, // no profile bit
2, 1,
#endif
GHOST_OPENGL_CGL_CONTEXT_FLAGS,
GHOST_OPENGL_CGL_RESET_NOTIFICATION_STRATEGY);
#elif defined(WITH_GL_PROFILE_ES20)
GHOST_Context *context = new GHOST_ContextCGL(
m_wantStereoVisual,
m_wantNumOfAASamples,
m_window,
m_openGLView,
CGL_CONTEXT_ES2_PROFILE_BIT_EXT,
2, 0,
GHOST_OPENGL_CGL_CONTEXT_FLAGS,
GHOST_OPENGL_CGL_RESET_NOTIFICATION_STRATEGY);
#elif defined(WITH_GL_PROFILE_COMPAT)
GHOST_Context *context = new GHOST_ContextCGL(
m_wantStereoVisual,
m_wantNumOfAASamples,
m_window,
m_openGLView,
0, // profile bit
0, 0,
m_debug_context,
GHOST_OPENGL_CGL_RESET_NOTIFICATION_STRATEGY);
#else
# error
#endif
#else
#if defined(WITH_GL_PROFILE_CORE)
GHOST_Context *context = new GHOST_ContextEGL(
m_wantStereoVisual,
m_wantNumOfAASamples,
m_window,
m_openGLView,
EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,
3, 2,
GHOST_OPENGL_EGL_CONTEXT_FLAGS,
GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY,
EGL_OPENGL_API);
#elif defined(WITH_GL_PROFILE_ES20)
GHOST_Context *context = new GHOST_ContextEGL(
m_wantStereoVisual,
m_wantNumOfAASamples,
m_window,
m_openGLView,
0, // profile bit
2, 0,
GHOST_OPENGL_EGL_CONTEXT_FLAGS,
GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY,
EGL_OPENGL_ES_API);
#elif defined(WITH_GL_PROFILE_COMPAT)
GHOST_Context *context = new GHOST_ContextEGL(
m_wantStereoVisual,
m_wantNumOfAASamples,
m_window,
m_openGLView,
0, // profile bit
0, 0,
GHOST_OPENGL_EGL_CONTEXT_FLAGS,
GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY,
EGL_OPENGL_API);
#else
# error
#endif
#endif
if (context->initializeDrawingContext())
return context;
else

View File

@@ -610,97 +610,37 @@ GHOST_TSuccess GHOST_WindowWin32::invalidate()
GHOST_Context *GHOST_WindowWin32::newDrawingContext(GHOST_TDrawingContextType type)
{
if (type == GHOST_kDrawingContextTypeOpenGL) {
#if !defined(WITH_GL_EGL)
const int profile_mask =
#if defined(WITH_GL_PROFILE_CORE)
GHOST_Context *context = new GHOST_ContextWGL(
m_wantStereoVisual,
m_wantAlphaBackground,
m_wantNumOfAASamples,
m_hWnd,
m_hDC,
WGL_CONTEXT_CORE_PROFILE_BIT_ARB,
3, 2,
GHOST_OPENGL_WGL_CONTEXT_FLAGS,
GHOST_OPENGL_WGL_RESET_NOTIFICATION_STRATEGY);
#elif defined(WITH_GL_PROFILE_ES20)
GHOST_Context *context = new GHOST_ContextWGL(
m_wantStereoVisual,
m_wantAlphaBackground,
m_wantNumOfAASamples,
m_hWnd,
m_hDC,
WGL_CONTEXT_ES2_PROFILE_BIT_EXT,
2, 0,
GHOST_OPENGL_WGL_CONTEXT_FLAGS,
GHOST_OPENGL_WGL_RESET_NOTIFICATION_STRATEGY);
WGL_CONTEXT_CORE_PROFILE_BIT_ARB;
#elif defined(WITH_GL_PROFILE_COMPAT)
WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
#else
# error // must specify either core or compat at build time
#endif
GHOST_Context *context = new GHOST_ContextWGL(
m_wantStereoVisual,
m_wantAlphaBackground,
m_wantNumOfAASamples,
m_hWnd,
m_hDC,
#if 1
0, // profile bit
2, 1, // GL version requested
profile_mask,
#if 0
3, 3, // specific GL version requested
// AMD gives us exactly this version
// NVIDIA gives at least this version <-- desired behavior
#else
// switch to this for Blender 2.8 development
WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
3, 2,
2, 1, // any GL version >= 2.1 (hopefully the latest)
// we check later to ensure it's >= 3.3 on Windows
// TODO(merwin): fix properly!
// 2.1 ignores the profile bit & is incompatible with core profile
// query version of initial dummy context, request that + profile + debug
#endif
(m_debug_context ? WGL_CONTEXT_DEBUG_BIT_ARB : 0),
GHOST_OPENGL_WGL_RESET_NOTIFICATION_STRATEGY);
#else
# error
#endif
#else
#if defined(WITH_GL_PROFILE_CORE)
GHOST_Context *context = new GHOST_ContextEGL(
m_wantStereoVisual,
m_wantNumOfAASamples,
m_hWnd,
m_hDC,
EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,
3, 2,
GHOST_OPENGL_EGL_CONTEXT_FLAGS,
GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY,
EGL_OPENGL_API);
#elif defined(WITH_GL_PROFILE_ES20)
GHOST_Context *context = new GHOST_ContextEGL(
m_wantStereoVisual,
m_wantNumOfAASamples,
m_hWnd,
m_hDC,
0, // profile bit
2, 0,
GHOST_OPENGL_EGL_CONTEXT_FLAGS,
GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY,
EGL_OPENGL_ES_API);
#elif defined(WITH_GL_PROFILE_COMPAT)
GHOST_Context *context = new GHOST_ContextEGL(
m_wantStereoVisual,
m_wantNumOfAASamples,
m_hWnd,
m_hDC,
#if 1
0, // profile bit
2, 1, // GL version requested
#else
// switch to this for Blender 2.8 development
EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT,
3, 2,
#endif
GHOST_OPENGL_EGL_CONTEXT_FLAGS,
GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY,
EGL_OPENGL_API);
#else
# error
#endif
#endif
if (context->initializeDrawingContext())
return context;
else

View File

@@ -1314,33 +1314,24 @@ GHOST_WindowX11::
GHOST_Context *GHOST_WindowX11::newDrawingContext(GHOST_TDrawingContextType type)
{
if (type == GHOST_kDrawingContextTypeOpenGL) {
#if !defined(WITH_GL_EGL)
// During development:
// try 3.3 compatibility profile
// fall back to 3.0 if needed
//
// Final Blender 2.8:
// try 3.3 core profile
// no fallbacks
const int profile_mask =
#if defined(WITH_GL_PROFILE_CORE)
GHOST_Context *context = new GHOST_ContextGLX(
m_wantStereoVisual,
m_wantNumOfAASamples,
m_window,
m_display,
m_visualInfo,
(GLXFBConfig)m_fbconfig,
GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
3, 2,
GHOST_OPENGL_GLX_CONTEXT_FLAGS | (m_is_debug_context ? GLX_CONTEXT_DEBUG_BIT_ARB : 0),
GHOST_OPENGL_GLX_RESET_NOTIFICATION_STRATEGY);
#elif defined(WITH_GL_PROFILE_ES20)
GHOST_Context *context = new GHOST_ContextGLX(
m_wantStereoVisual,
m_wantNumOfAASamples,
m_window,
m_display,
m_visualInfo,
(GLXFBConfig)m_fbconfig,
GLX_CONTEXT_ES2_PROFILE_BIT_EXT,
2, 0,
GHOST_OPENGL_GLX_CONTEXT_FLAGS | (m_is_debug_context ? GLX_CONTEXT_DEBUG_BIT_ARB : 0),
GHOST_OPENGL_GLX_RESET_NOTIFICATION_STRATEGY);
GLX_CONTEXT_CORE_PROFILE_BIT_ARB;
#elif defined(WITH_GL_PROFILE_COMPAT)
GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
#else
# error // must specify either core or compat at build time
#endif
GHOST_Context *context = new GHOST_ContextGLX(
m_wantStereoVisual,
m_wantNumOfAASamples,
@@ -1348,58 +1339,34 @@ GHOST_Context *GHOST_WindowX11::newDrawingContext(GHOST_TDrawingContextType type
m_display,
m_visualInfo,
(GLXFBConfig)m_fbconfig,
0, // profile bit
0, 0,
profile_mask,
3, 3,
GHOST_OPENGL_GLX_CONTEXT_FLAGS | (m_is_debug_context ? GLX_CONTEXT_DEBUG_BIT_ARB : 0),
GHOST_OPENGL_GLX_RESET_NOTIFICATION_STRATEGY);
#else
# error
#endif
#else
#if defined(WITH_GL_PROFILE_CORE)
GHOST_Context *context = new GHOST_ContextEGL(
m_wantStereoVisual,
m_wantNumOfAASamples,
m_window,
m_display,
EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,
3, 2,
GHOST_OPENGL_EGL_CONTEXT_FLAGS,
GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY,
EGL_OPENGL_API);
#elif defined(WITH_GL_PROFILE_ES20)
GHOST_Context *context = new GHOST_ContextEGL(
m_wantStereoVisual,
m_wantNumOfAASamples,
m_window,
m_display,
0, // profile bit
2, 0,
GHOST_OPENGL_EGL_CONTEXT_FLAGS,
GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY,
EGL_OPENGL_ES_API);
#elif defined(WITH_GL_PROFILE_COMPAT)
GHOST_Context *context = new GHOST_ContextEGL(
m_wantStereoVisual,
m_wantNumOfAASamples,
m_window,
m_display,
0, // profile bit
0, 0,
GHOST_OPENGL_EGL_CONTEXT_FLAGS,
GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY,
EGL_OPENGL_API);
#else
# error
#endif
#endif
if (context->initializeDrawingContext())
return context;
else
else {
delete context;
// since that failed try 3.0 (mostly for Mesa, which doesn't implement compatibility profile)
context = new GHOST_ContextGLX(
m_wantStereoVisual,
m_wantNumOfAASamples,
m_window,
m_display,
m_visualInfo,
(GLXFBConfig)m_fbconfig,
0, // no profile bit
3, 0,
GHOST_OPENGL_GLX_CONTEXT_FLAGS | (m_is_debug_context ? GLX_CONTEXT_DEBUG_BIT_ARB : 0),
GHOST_OPENGL_GLX_RESET_NOTIFICATION_STRATEGY);
if (context->initializeDrawingContext())
return context;
else
delete context;
}
}
return NULL;

View File

@@ -45,6 +45,9 @@ struct LibmvFrameAccessor : public FrameAccessor {
get_image_callback_(get_image_callback),
release_image_callback_(release_image_callback) { }
virtual ~LibmvFrameAccessor() {
}
libmv_InputMode get_libmv_input_mode(InputMode input_mode) {
switch (input_mode) {
#define CHECK_INPUT_MODE(mode) \

View File

@@ -117,12 +117,12 @@ protected:
* is small enough and better to be allocated in stack rather
* than in heap.
*
* TODO(sergey): Check if bare arrays could be sued by CPU evalautor.
* TODO(sergey): Check if bare arrays could be used by CPU evalautor.
*/
template <int element_size, int num_verts>
class StackAllocatedBuffer {
public:
static PatchCoordBuffer *Create(int size)
static PatchCoordBuffer *Create(int /*size*/)
{
StackAllocatedBuffer<element_size, num_verts> *buffer =
new StackAllocatedBuffer<element_size, num_verts>();

View File

@@ -943,14 +943,16 @@ operator<<( std::ostream& os, const BasicVector::Vector3Dim<Scalar>& i )
{
#if 0
char buf[256];
#if _WIN32
sprintf(buf,globVecFormatStr, (double)i[0],(double)i[1],(double)i[2]);
#else
snprintf(buf,256,globVecFormatStr, (double)i[0],(double)i[1],(double)i[2]);
#endif
# if _WIN32
sprintf(buf,globVecFormatStr, (double)i[0],(double)i[1],(double)i[2]);
# else
snprintf(buf,256,globVecFormatStr, (double)i[0],(double)i[1],(double)i[2]);
# endif
os << std::string(buf);
#else
(void)i; /* Ignored. */
#endif
return os;
return os;
}

View File

@@ -22,7 +22,7 @@ set MUST_CLEAN=
set NOBUILD=
set TARGET=
set WINDOWS_ARCH=
set TESTS_CMAKE_ARGS=
:argv_loop
if NOT "%1" == "" (
@@ -35,6 +35,8 @@ if NOT "%1" == "" (
if "%1" == "debug" (
set BUILD_TYPE=Debug
REM Build Configurations
) else if "%1" == "with_tests" (
set TESTS_CMAKE_ARGS=-DWITH_GTESTS=On
) else if "%1" == "full" (
set TARGET=Full
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^
@@ -129,9 +131,6 @@ if "%BUILD_ARCH%"=="x64" (
)
set BUILD_DIR=%BUILD_DIR%_%TARGET%_%BUILD_ARCH%_vc%BUILD_VS_VER%_%BUILD_TYPE%
if "%target%"=="Release" (
rem for vc12 check for both cuda 7.5 and 8
if "%CUDA_PATH%"=="" (
@@ -173,7 +172,7 @@ where /Q msbuild
if %ERRORLEVEL% NEQ 0 (
if "%BUILD_VS_VER%"=="12" (
rem vs12 not found, try vs14
echo Visual Studio 2012 not found, trying Visual Studio 2015.
echo Visual Studio 2013 not found, trying Visual Studio 2015.
set BUILD_VS_VER=14
set BUILD_VS_YEAR=2015
goto DetectMSVC
@@ -184,6 +183,11 @@ if %ERRORLEVEL% NEQ 0 (
goto EOF
)
)
set BUILD_DIR=%BUILD_DIR%_%TARGET%_%BUILD_ARCH%_vc%BUILD_VS_VER%_%BUILD_TYPE%
where /Q cmake
if %ERRORLEVEL% NEQ 0 (
echo Error: "CMake" command not in the PATH.
@@ -202,7 +206,7 @@ if "%TARGET%"=="" (
goto HELP
)
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -G "Visual Studio %BUILD_VS_VER% %BUILD_VS_YEAR%%WINDOWS_ARCH%"
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -G "Visual Studio %BUILD_VS_VER% %BUILD_VS_YEAR%%WINDOWS_ARCH%" %TESTS_CMAKE_ARGS%
if NOT EXIST %BUILD_DIR%\nul (
mkdir %BUILD_DIR%
)
@@ -282,6 +286,7 @@ goto EOF
echo - showhash ^(Show git hashes of source tree^)
echo.
echo Configuration options
echo - with_tests ^(enable building unit tests^)
echo - debug ^(Build an unoptimized debuggable build^)
echo - packagename [newname] ^(override default cpack package name^)
echo - x86 ^(override host autodetect and build 32 bit code^)

View File

@@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LSMinimumSystemVersion</key>
<string>10.7.0</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
@@ -47,5 +49,7 @@
<string>NSApplication</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
</dict>
</plist>

Some files were not shown because too many files have changed in this diff Show More