tornavis/source/blender/makesdna/DNA_view3d_types.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

720 lines
19 KiB
C
Raw Normal View History

/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
*
* SPDX-License-Identifier: GPL-2.0-or-later */
2002-10-12 13:37:38 +02:00
/** \file
* \ingroup DNA
*/
#pragma once
2011-12-30 08:25:49 +01:00
struct BoundBox;
struct Object;
struct ViewRender;
struct SmoothView3DStore;
struct SpaceLink;
struct bGPdata;
struct wmTimer;
2002-10-12 13:37:38 +02:00
#include "DNA_defs.h"
#include "DNA_image_types.h"
#include "DNA_listBase.h"
Camera tracking integration =========================== Commiting camera tracking integration gsoc project into trunk. This commit includes: - Bundled version of libmv library (with some changes against official repo, re-sync with libmv repo a bit later) - New datatype ID called MovieClip which is optimized to work with movie clips (both of movie files and image sequences) and doing camera/motion tracking operations. - New editor called Clip Editor which is currently used for motion/tracking stuff only, but which can be easily extended to work with masks too. This editor supports: * Loading movie files/image sequences * Build proxies with different size for loaded movie clip, also supports building undistorted proxies to increase speed of playback in undistorted mode. * Manual lens distortion mode calibration using grid and grease pencil * Supervised 2D tracking using two different algorithms KLT and SAD. * Basic algorithm for feature detection * Camera motion solving. scene orientation - New constraints to "link" scene objects with solved motions from clip: * Follow Track (make object follow 2D motion of track with given name or parent object to reconstructed 3D position of track) * Camera Solver to make camera moving in the same way as reconstructed camera This commit NOT includes changes from tomato branch: - New nodes (they'll be commited as separated patch) - Automatic image offset guessing for image input node and image editor (need to do more tests and gather more feedback) - Code cleanup in libmv-capi. It's not so critical cleanup, just increasing readability and understanadability of code. Better to make this chaneg when Keir will finish his current patch. More details about this project can be found on this page: http://wiki.blender.org/index.php/User:Nazg-gul/GSoC-2011 Further development of small features would be done in trunk, bigger/experimental features would first be implemented in tomato branch.
2011-11-07 13:55:18 +01:00
#include "DNA_movieclip_types.h"
#include "DNA_object_types.h"
#include "DNA_view3d_enums.h"
Geometry Nodes: viewport preview This adds support for showing geometry passed to the Viewer in the 3d viewport (instead of just in the spreadsheet). The "viewer geometry" bypasses the group output. So it is not necessary to change the final output of the node group to be able to see the intermediate geometry. **Activation and deactivation of a viewer node** * A viewer node is activated by clicking on it. * Ctrl+shift+click on any node/socket connects it to the viewer and makes it active. * Ctrl+shift+click in empty space deactivates the active viewer. * When the active viewer is not visible anymore (e.g. another object is selected, or the current node group is exit), it is deactivated. * Clicking on the icon in the header of the Viewer node toggles whether its active or not. **Pinning** * The spreadsheet still allows pinning the active viewer as before. When pinned, the spreadsheet still references the viewer node even when it becomes inactive. * The viewport does not support pinning at the moment. It always shows the active viewer. **Attribute** * When a field is linked to the second input of the viewer node it is displayed as an overlay in the viewport. * When possible the correct domain for the attribute is determined automatically. This does not work in all cases. It falls back to the face corner domain on meshes and the point domain on curves. When necessary, the domain can be picked manually. * The spreadsheet now only shows the "Viewer" column for the domain that is selected in the Viewer node. * Instance attributes are visualized as a constant color per instance. **Viewport Options** * The attribute overlay opacity can be controlled with the "Viewer Node" setting in the overlays popover. * A viewport can be configured not to show intermediate viewer-geometry by disabling the "Viewer Node" option in the "View" menu. **Implementation Details** * The "spreadsheet context path" was generalized to a "viewer path" that is used in more places now. * The viewer node itself determines the attribute domain, evaluates the field and stores the result in a `.viewer` attribute. * A new "viewer attribute' overlay displays the data from the `.viewer` attribute. * The ground truth for the active viewer node is stored in the workspace now. Node editors, spreadsheets and viewports retrieve the active viewer from there unless they are pinned. * The depsgraph object iterator has a new "viewer path" setting. When set, the viewed geometry of the corresponding object is part of the iterator instead of the final evaluated geometry. * To support the instance attribute overlay `DupliObject` was extended to contain the information necessary for drawing the overlay. * The ctrl+shift+click operator has been refactored so that it can make existing links to viewers active again. * The auto-domain-detection in the Viewer node works by checking the "preferred domain" for every field input. If there is not exactly one preferred domain, the fallback is used. Known limitations: * Loose edges of meshes don't have the attribute overlay. This could be added separately if necessary. * Some attributes are hard to visualize as a color directly. For example, the values might have to be normalized or some should be drawn as arrays. For now, we encourage users to build node groups that generate appropriate viewer-geometry. We might include some of that functionality in future versions. Support for displaying attribute values as text in the viewport is planned as well. * There seems to be an issue with the attribute overlay for pointclouds on nvidia gpus, to be investigated. Differential Revision: https://developer.blender.org/D15954
2022-09-28 17:54:59 +02:00
#include "DNA_viewer_path_types.h"
typedef struct RegionView3D {
/** GL_PROJECTION matrix. */
float winmat[4][4];
/** GL_MODELVIEW matrix. */
float viewmat[4][4];
/** Inverse of viewmat. */
float viewinv[4][4];
/** Viewmat*winmat. */
float persmat[4][4];
/** Inverse of persmat. */
float persinv[4][4];
2023-08-21 02:05:45 +02:00
/** Offset/scale for camera GLSL texture-coordinates. */
float viewcamtexcofac[4];
/** viewmat/persmat multiplied with object matrix, while drawing and selection. */
float viewmatob[4][4];
float persmatob[4][4];
/** User defined clipping planes. */
float clip[6][4];
/**
* Clip in object space,
* means we can test for clipping in edit-mode without first going into world-space.
*/
float clip_local[6][4];
struct BoundBox *clipbb;
2022-01-24 05:34:56 +01:00
/** Allocated backup of itself while in local-view. */
struct RegionView3D *localvd;
struct ViewRender *view_render;
/** Animated smooth view. */
struct SmoothView3DStore *sms;
struct wmTimer *smooth_timer;
/** Transform gizmo matrix. */
float twmat[4][4];
/** min/max dot product on twmat xyz axis. */
float tw_axis_min[3], tw_axis_max[3];
float tw_axis_matrix[3][3];
2018-08-27 17:16:34 +02:00
float gridview DNA_DEPRECATED;
/** View rotation, must be kept normalized. */
float viewquat[4];
/** Distance from 'ofs' along -viewinv[2] vector, where result is negative as is 'ofs'. */
float dist;
/** Camera view offsets, 1.0 = viewplane moves entire width/height. */
float camdx, camdy;
/** Runtime only. */
float pixsize;
/**
* View center & orbit pivot, negative of world-space location,
* also matches `-viewinv[3][0:3]` in orthographic mode.
*/
float ofs[3];
/** Viewport zoom on the camera frame, see BKE_screen_view3d_zoom_to_fac. */
float camzoom;
/**
* Check if persp/ortho view, since 'persp' can't be used for this since
* it can have cameras assigned as well. (only set in #view3d_winmatrix_set)
*/
char is_persp;
char persp;
char view;
char view_axis_roll;
VR: Initial Virtual Reality support - Milestone 1, Scene Inspection NOTE: While most of the milestone 1 goals are there, a few smaller features and improvements are still to be done. Big picture of this milestone: Initial, OpenXR-based virtual reality support for users and foundation for advanced use cases. Maniphest Task: https://developer.blender.org/T71347 The tasks contains more information about this milestone. To be clear: This is not a feature rich VR implementation, it's focused on the initial scene inspection use case. We intentionally focused on that, further features like controller support are part of the next milestone. - How to use? Instructions on how to use this are here: https://wiki.blender.org/wiki/User:Severin/GSoC-2019/How_to_Test These will be updated and moved to a more official place (likely the manual) soon. Currently Windows Mixed Reality and Oculus devices are usable. Valve/HTC headsets don't support the OpenXR standard yet and hence, do not work with this implementation. --------------- This is the C-side implementation of the features added for initial VR support as per milestone 1. A "VR Scene Inspection" Add-on will be committed separately, to expose the VR functionality in the UI. It also adds some further features for milestone 1, namely a landmarking system (stored view locations in the VR space) Main additions/features: * Support for rendering viewports to an HMD, with good performance. * Option to sync the VR view perspective with a fully interactive, regular 3D View (VR-Mirror). * Option to disable positional tracking. Keeps the current position (calculated based on the VR eye center pose) when enabled while a VR session is running. * Some regular viewport settings for the VR view * RNA/Python-API to query and set VR session state information. * WM-XR: Layer tying Ghost-XR to the Blender specific APIs/data * wmSurface API: drawable, non-window container (manages Ghost-OpenGL and GPU context) * DNA/RNA for management of VR session settings * `--debug-xr` and `--debug-xr-time` commandline options * Utility batch & config file for using the Oculus runtime on Windows. * Most VR data is runtime only. The exception is user settings which are saved to files (`XrSessionSettings`). * VR support can be disabled through the `WITH_XR_OPENXR` compiler flag. For architecture and code documentation, see https://wiki.blender.org/wiki/Source/Interface/XR. --------------- A few thank you's: * A huge shoutout to Ray Molenkamp for his help during the project - it would have not been that successful without him! * Sebastian Koenig and Simeon Conzendorf for testing and feedback! * The reviewers, especially Brecht Van Lommel! * Dalai Felinto for pushing and managing me to get this done ;) * The OpenXR working group for providing an open standard. I think we're the first bigger application to adopt OpenXR. Congratulations to them and ourselves :) This project started as a Google Summer of Code 2019 project - "Core Support of Virtual Reality Headsets through OpenXR" (see https://wiki.blender.org/wiki/User:Severin/GSoC-2019/). Some further information, including ideas for further improvements can be found in the final GSoC report: https://wiki.blender.org/wiki/User:Severin/GSoC-2019/Final_Report Differential Revisions: D6193, D7098 Reviewed by: Brecht Van Lommel, Jeroen Bakker
2020-03-17 20:20:55 +01:00
char viewlock; /* Should usually be accessed with RV3D_LOCK_FLAGS()! */
/** Options for runtime only locking (cleared on file read) */
char runtime_viewlock; /* Should usually be accessed with RV3D_LOCK_FLAGS()! */
/** Options for quadview (store while out of quad view). */
char viewlock_quad;
VR: Initial Virtual Reality support - Milestone 1, Scene Inspection NOTE: While most of the milestone 1 goals are there, a few smaller features and improvements are still to be done. Big picture of this milestone: Initial, OpenXR-based virtual reality support for users and foundation for advanced use cases. Maniphest Task: https://developer.blender.org/T71347 The tasks contains more information about this milestone. To be clear: This is not a feature rich VR implementation, it's focused on the initial scene inspection use case. We intentionally focused on that, further features like controller support are part of the next milestone. - How to use? Instructions on how to use this are here: https://wiki.blender.org/wiki/User:Severin/GSoC-2019/How_to_Test These will be updated and moved to a more official place (likely the manual) soon. Currently Windows Mixed Reality and Oculus devices are usable. Valve/HTC headsets don't support the OpenXR standard yet and hence, do not work with this implementation. --------------- This is the C-side implementation of the features added for initial VR support as per milestone 1. A "VR Scene Inspection" Add-on will be committed separately, to expose the VR functionality in the UI. It also adds some further features for milestone 1, namely a landmarking system (stored view locations in the VR space) Main additions/features: * Support for rendering viewports to an HMD, with good performance. * Option to sync the VR view perspective with a fully interactive, regular 3D View (VR-Mirror). * Option to disable positional tracking. Keeps the current position (calculated based on the VR eye center pose) when enabled while a VR session is running. * Some regular viewport settings for the VR view * RNA/Python-API to query and set VR session state information. * WM-XR: Layer tying Ghost-XR to the Blender specific APIs/data * wmSurface API: drawable, non-window container (manages Ghost-OpenGL and GPU context) * DNA/RNA for management of VR session settings * `--debug-xr` and `--debug-xr-time` commandline options * Utility batch & config file for using the Oculus runtime on Windows. * Most VR data is runtime only. The exception is user settings which are saved to files (`XrSessionSettings`). * VR support can be disabled through the `WITH_XR_OPENXR` compiler flag. For architecture and code documentation, see https://wiki.blender.org/wiki/Source/Interface/XR. --------------- A few thank you's: * A huge shoutout to Ray Molenkamp for his help during the project - it would have not been that successful without him! * Sebastian Koenig and Simeon Conzendorf for testing and feedback! * The reviewers, especially Brecht Van Lommel! * Dalai Felinto for pushing and managing me to get this done ;) * The OpenXR working group for providing an open standard. I think we're the first bigger application to adopt OpenXR. Congratulations to them and ourselves :) This project started as a Google Summer of Code 2019 project - "Core Support of Virtual Reality Headsets through OpenXR" (see https://wiki.blender.org/wiki/User:Severin/GSoC-2019/). Some further information, including ideas for further improvements can be found in the final GSoC report: https://wiki.blender.org/wiki/User:Severin/GSoC-2019/Final_Report Differential Revisions: D6193, D7098 Reviewed by: Brecht Van Lommel, Jeroen Bakker
2020-03-17 20:20:55 +01:00
char _pad[1];
/** Normalized offset for locked view: (-1, -1) bottom left, (1, 1) upper right. */
float ofs_lock[2];
/** XXX can easily get rid of this (Julian). */
short twdrawflag;
short rflag;
/** Last view (use when switching out of camera view). */
float lviewquat[4];
/** Lpersp can never be set to 'RV3D_CAMOB'. */
char lpersp;
char lview;
char lview_axis_roll;
char _pad8[1];
/** Active rotation from NDOF or elsewhere. */
2011-07-26 04:35:46 +02:00
float rot_angle;
float rot_axis[3];
} RegionView3D;
2002-10-12 13:37:38 +02:00
typedef struct View3DCursor {
float location[3];
float rotation_quaternion[4];
float rotation_euler[3];
float rotation_axis[3], rotation_angle;
short rotation_mode;
char _pad[6];
} View3DCursor;
/** 3D Viewport Shading settings. */
typedef struct View3DShading {
/** Shading type (OB_SOLID, ..). */
char type;
/** Runtime, for toggle between rendered viewport. */
char prev_type;
char prev_type_wire;
char color_type;
short flag;
char light;
char background_type;
char cavity_type;
char wire_color_type;
/** When to preview the compositor output in the viewport. View3DShadingUseCompositor. */
char use_compositor;
char _pad;
/** FILE_MAXFILE. */
char studio_light[256];
/** FILE_MAXFILE. */
char lookdev_light[256];
/** FILE_MAXFILE. */
char matcap[256];
float shadow_intensity;
float single_color[3];
float studiolight_rot_z;
float studiolight_background;
float studiolight_intensity;
float studiolight_blur;
float object_outline_color[3];
float xray_alpha;
float xray_alpha_wire;
float cavity_valley_factor;
float cavity_ridge_factor;
float background_color[3];
float curvature_ridge_factor;
float curvature_valley_factor;
/* Render pass displayed in the viewport. Is an `eScenePassType` where one bit is set */
int render_pass;
EEVEE: Arbitrary Output Variables This patch adds support for AOVs in EEVEE. AOV Outputs can be defined in the render pass tab and used in shader materials. Both Object and World based shaders are supported. The AOV can be previewed in the viewport using the renderpass selector in the shading popover. AOV names that conflict with other AOVs are automatically corrected. AOV conflicts with render passes get a warning icon. The reason behind this is that changing render engines/passes can change the conflict, but you might not notice it. Changing this automatically would also make the materials incorrect, so best to leave this to the user. **Implementation** The patch adds a copies the AOV structures of Cycles into Blender. The goal is that the Cycles will use Blenders AOV defintions. In the Blender kernel (`layer.c`) the logic of these structures are implemented. The GLSL shader of any GPUMaterial can hold multiple outputs (the main output and the AOV outputs) based on the renderPassUBO the right output is selected. This selection uses an hash that encodes the AOV structure. The full AOV needed to be encoded when actually drawing the material pass as the AOV type changes the behavior of the AOV. This isn't known yet when the GLSL is compiled. **Future Developments** * The AOV definitions in the render layer panel isn't shared with Cycles. Cycles should be migrated to use the same viewlayer aovs. During a previous attempt this failed as the AOV validation in cycles and in Blender have implementation differences what made it crash when an aov name was invalid. This could be fixed by extending the external render engine API. * Add support to Cycles to render AOVs in the 3d viewport. * Use a drop down list for selecting AOVs in the AOV Output node. * Give user feedback when multiple AOV output nodes with the same AOV name exists in the same shader. * Fix viewing single channel images in the image editor [T83314] * Reduce viewport render time by only render needed draw passes. [T83316] Reviewed By: Brecht van Lommel, Clément Foucault Differential Revision: https://developer.blender.org/D7010
2020-12-04 08:13:54 +01:00
char aov_name[64];
struct IDProperty *prop;
void *_pad2;
} View3DShading;
/** 3D Viewport Overlay settings. */
typedef struct View3DOverlay {
int flag;
/** Edit mode settings. */
int edit_flag;
float normals_length;
float normals_constant_screen_size;
/** Paint mode settings. */
int paint_flag;
/** Weight paint mode settings. */
int wpaint_flag;
/** Alpha for texture, weight, vertex paint overlay. */
float texture_paint_mode_opacity;
float vertex_paint_mode_opacity;
float weight_paint_mode_opacity;
float sculpt_mode_mask_opacity;
2020-03-05 14:53:23 +01:00
float sculpt_mode_face_sets_opacity;
Geometry Nodes: viewport preview This adds support for showing geometry passed to the Viewer in the 3d viewport (instead of just in the spreadsheet). The "viewer geometry" bypasses the group output. So it is not necessary to change the final output of the node group to be able to see the intermediate geometry. **Activation and deactivation of a viewer node** * A viewer node is activated by clicking on it. * Ctrl+shift+click on any node/socket connects it to the viewer and makes it active. * Ctrl+shift+click in empty space deactivates the active viewer. * When the active viewer is not visible anymore (e.g. another object is selected, or the current node group is exit), it is deactivated. * Clicking on the icon in the header of the Viewer node toggles whether its active or not. **Pinning** * The spreadsheet still allows pinning the active viewer as before. When pinned, the spreadsheet still references the viewer node even when it becomes inactive. * The viewport does not support pinning at the moment. It always shows the active viewer. **Attribute** * When a field is linked to the second input of the viewer node it is displayed as an overlay in the viewport. * When possible the correct domain for the attribute is determined automatically. This does not work in all cases. It falls back to the face corner domain on meshes and the point domain on curves. When necessary, the domain can be picked manually. * The spreadsheet now only shows the "Viewer" column for the domain that is selected in the Viewer node. * Instance attributes are visualized as a constant color per instance. **Viewport Options** * The attribute overlay opacity can be controlled with the "Viewer Node" setting in the overlays popover. * A viewport can be configured not to show intermediate viewer-geometry by disabling the "Viewer Node" option in the "View" menu. **Implementation Details** * The "spreadsheet context path" was generalized to a "viewer path" that is used in more places now. * The viewer node itself determines the attribute domain, evaluates the field and stores the result in a `.viewer` attribute. * A new "viewer attribute' overlay displays the data from the `.viewer` attribute. * The ground truth for the active viewer node is stored in the workspace now. Node editors, spreadsheets and viewports retrieve the active viewer from there unless they are pinned. * The depsgraph object iterator has a new "viewer path" setting. When set, the viewed geometry of the corresponding object is part of the iterator instead of the final evaluated geometry. * To support the instance attribute overlay `DupliObject` was extended to contain the information necessary for drawing the overlay. * The ctrl+shift+click operator has been refactored so that it can make existing links to viewers active again. * The auto-domain-detection in the Viewer node works by checking the "preferred domain" for every field input. If there is not exactly one preferred domain, the fallback is used. Known limitations: * Loose edges of meshes don't have the attribute overlay. This could be added separately if necessary. * Some attributes are hard to visualize as a color directly. For example, the values might have to be normalized or some should be drawn as arrays. For now, we encourage users to build node groups that generate appropriate viewer-geometry. We might include some of that functionality in future versions. Support for displaying attribute values as text in the viewport is planned as well. * There seems to be an issue with the attribute overlay for pointclouds on nvidia gpus, to be investigated. Differential Revision: https://developer.blender.org/D15954
2022-09-28 17:54:59 +02:00
float viewer_attribute_opacity;
/** Armature edit/pose mode settings. */
float xray_alpha_bone;
float bone_wire_alpha;
/** Darken Inactive. */
float fade_alpha;
/** Other settings. */
float wireframe_threshold;
float wireframe_opacity;
float retopology_offset;
/** Grease pencil settings. */
float gpencil_paper_opacity;
float gpencil_grid_opacity;
float gpencil_fade_layer;
/** Factor for mixing vertex paint with original color */
float gpencil_vertex_paint_opacity;
/** Handles display type for curves. */
int handle_display;
/** Curves sculpt mode settings. */
float sculpt_curves_cage_opacity;
} View3DOverlay;
/** #View3DOverlay.handle_display */
typedef enum eHandleDisplay {
/* Display only selected points. */
CURVE_HANDLE_SELECTED = 0,
/* Display all handles. */
CURVE_HANDLE_ALL = 1,
/* No display handles. */
CURVE_HANDLE_NONE = 2,
} eHandleDisplay;
typedef struct View3D_Runtime {
/** Nkey panel stores stuff here. */
void *properties_storage;
void (*properties_storage_free)(void *properties_storage);
VR: Initial Virtual Reality support - Milestone 1, Scene Inspection NOTE: While most of the milestone 1 goals are there, a few smaller features and improvements are still to be done. Big picture of this milestone: Initial, OpenXR-based virtual reality support for users and foundation for advanced use cases. Maniphest Task: https://developer.blender.org/T71347 The tasks contains more information about this milestone. To be clear: This is not a feature rich VR implementation, it's focused on the initial scene inspection use case. We intentionally focused on that, further features like controller support are part of the next milestone. - How to use? Instructions on how to use this are here: https://wiki.blender.org/wiki/User:Severin/GSoC-2019/How_to_Test These will be updated and moved to a more official place (likely the manual) soon. Currently Windows Mixed Reality and Oculus devices are usable. Valve/HTC headsets don't support the OpenXR standard yet and hence, do not work with this implementation. --------------- This is the C-side implementation of the features added for initial VR support as per milestone 1. A "VR Scene Inspection" Add-on will be committed separately, to expose the VR functionality in the UI. It also adds some further features for milestone 1, namely a landmarking system (stored view locations in the VR space) Main additions/features: * Support for rendering viewports to an HMD, with good performance. * Option to sync the VR view perspective with a fully interactive, regular 3D View (VR-Mirror). * Option to disable positional tracking. Keeps the current position (calculated based on the VR eye center pose) when enabled while a VR session is running. * Some regular viewport settings for the VR view * RNA/Python-API to query and set VR session state information. * WM-XR: Layer tying Ghost-XR to the Blender specific APIs/data * wmSurface API: drawable, non-window container (manages Ghost-OpenGL and GPU context) * DNA/RNA for management of VR session settings * `--debug-xr` and `--debug-xr-time` commandline options * Utility batch & config file for using the Oculus runtime on Windows. * Most VR data is runtime only. The exception is user settings which are saved to files (`XrSessionSettings`). * VR support can be disabled through the `WITH_XR_OPENXR` compiler flag. For architecture and code documentation, see https://wiki.blender.org/wiki/Source/Interface/XR. --------------- A few thank you's: * A huge shoutout to Ray Molenkamp for his help during the project - it would have not been that successful without him! * Sebastian Koenig and Simeon Conzendorf for testing and feedback! * The reviewers, especially Brecht Van Lommel! * Dalai Felinto for pushing and managing me to get this done ;) * The OpenXR working group for providing an open standard. I think we're the first bigger application to adopt OpenXR. Congratulations to them and ourselves :) This project started as a Google Summer of Code 2019 project - "Core Support of Virtual Reality Headsets through OpenXR" (see https://wiki.blender.org/wiki/User:Severin/GSoC-2019/). Some further information, including ideas for further improvements can be found in the final GSoC report: https://wiki.blender.org/wiki/User:Severin/GSoC-2019/Final_Report Differential Revisions: D6193, D7098 Reviewed by: Brecht Van Lommel, Jeroen Bakker
2020-03-17 20:20:55 +01:00
/** Runtime only flags. */
int flag;
char _pad1[4];
2021-07-05 04:47:46 +02:00
/* Only used for overlay stats while in local-view. */
struct SceneStats *local_stats;
} View3D_Runtime;
/** 3D ViewPort Struct. */
typedef struct View3D {
DNA_DEFINE_CXX_METHODS(View3D)
struct SpaceLink *next, *prev;
/** Storage of regions for inactive spaces. */
ListBase regionbase;
char spacetype;
char link_flag;
char _pad0[6];
/* End 'SpaceLink' header. */
float viewquat[4] DNA_DEPRECATED;
float dist DNA_DEPRECATED;
Camera tracking integration =========================== Commiting camera tracking integration gsoc project into trunk. This commit includes: - Bundled version of libmv library (with some changes against official repo, re-sync with libmv repo a bit later) - New datatype ID called MovieClip which is optimized to work with movie clips (both of movie files and image sequences) and doing camera/motion tracking operations. - New editor called Clip Editor which is currently used for motion/tracking stuff only, but which can be easily extended to work with masks too. This editor supports: * Loading movie files/image sequences * Build proxies with different size for loaded movie clip, also supports building undistorted proxies to increase speed of playback in undistorted mode. * Manual lens distortion mode calibration using grid and grease pencil * Supervised 2D tracking using two different algorithms KLT and SAD. * Basic algorithm for feature detection * Camera motion solving. scene orientation - New constraints to "link" scene objects with solved motions from clip: * Follow Track (make object follow 2D motion of track with given name or parent object to reconstructed 3D position of track) * Camera Solver to make camera moving in the same way as reconstructed camera This commit NOT includes changes from tomato branch: - New nodes (they'll be commited as separated patch) - Automatic image offset guessing for image input node and image editor (need to do more tests and gather more feedback) - Code cleanup in libmv-capi. It's not so critical cleanup, just increasing readability and understanadability of code. Better to make this chaneg when Keir will finish his current patch. More details about this project can be found on this page: http://wiki.blender.org/index.php/User:Nazg-gul/GSoC-2011 Further development of small features would be done in trunk, bigger/experimental features would first be implemented in tomato branch.
2011-11-07 13:55:18 +01:00
/** Size of bundles in reconstructed data. */
float bundle_size;
/** Display style for bundle. */
char bundle_drawtype;
char drawtype DNA_DEPRECATED;
char _pad3[1];
/** Multiview current eye - for internal use. */
char multiview_eye;
int object_type_exclude_viewport;
int object_type_exclude_select;
short persp DNA_DEPRECATED;
short view DNA_DEPRECATED;
struct Object *camera, *ob_center;
rctf render_border;
2022-01-24 05:34:56 +01:00
/** Allocated backup of itself while in local-view. */
struct View3D *localvd;
/** Optional string for armature bone to define center, MAXBONENAME. */
char ob_center_bone[64];
unsigned short local_view_uid;
char _pad6[2];
int layact DNA_DEPRECATED;
unsigned short local_collections_uid;
DRWManager: New implementation. This is a new implementation of the draw manager using modern rendering practices and GPU driven culling. This only ports features that are not considered deprecated or to be removed. The old DRW API is kept working along side this new one, and does not interfeer with it. However this needed some more hacking inside the draw_view_lib.glsl. At least the create info are well separated. The reviewer might start by looking at `draw_pass_test.cc` to see the API in usage. Important files are `draw_pass.hh`, `draw_command.hh`, `draw_command_shared.hh`. In a nutshell (for a developper used to old DRW API): - `DRWShadingGroups` are replaced by `Pass<T>::Sub`. - Contrary to DRWShadingGroups, all commands recorded inside a pass or sub-pass (even binds / push_constant / uniforms) will be executed in order. - All memory is managed per object (except for Sub-Pass which are managed by their parent pass) and not from draw manager pools. So passes "can" potentially be recorded once and submitted multiple time (but this is not really encouraged for now). The only implicit link is between resource lifetime and `ResourceHandles` - Sub passes can be any level deep. - IMPORTANT: All state propagate from sub pass to subpass. There is no state stack concept anymore. Ensure the correct render state is set before drawing anything using `Pass::state_set()`. - The drawcalls now needs a `ResourceHandle` instead of an `Object *`. This is to remove any implicit dependency between `Pass` and `Manager`. This was a huge problem in old implementation since the manager did not know what to pull from the object. Now it is explicitly requested by the engine. - The pases need to be submitted to a `draw::Manager` instance which can be retrieved using `DRW_manager_get()` (for now). Internally: - All object data are stored in contiguous storage buffers. Removing a lot of complexity in the pass submission. - Draw calls are sorted and visibility tested on GPU. Making more modern culling and better instancing usage possible in the future. - Unit Tests have been added for regression testing and avoid most API breakage. - `draw::View` now contains culling data for all objects in the scene allowing caching for multiple views. - Bounding box and sphere final setup is moved to GPU. - Some global resources locations have been hardcoded to reduce complexity. What is missing: - ~~Workaround for lack of gl_BaseInstanceARB.~~ Done - ~~Object Uniform Attributes.~~ Done (Not in this patch) - Workaround for hardware supporting a maximum of 8 SSBO. Reviewed By: jbakker Differential Revision: https://developer.blender.org/D15817
2022-09-02 18:30:48 +02:00
short _pad7[2];
short debug_flag;
/** Optional bool for 3d cursor to define center. */
short ob_center_cursor;
short scenelock;
short gp_flag;
short flag;
int flag2;
float lens, grid;
float clip_start, clip_end;
float ofs[3] DNA_DEPRECATED;
char _pad[1];
/** Transform gizmo info. */
/** #V3D_GIZMO_SHOW_* */
char gizmo_flag;
char gizmo_show_object;
char gizmo_show_armature;
char gizmo_show_empty;
char gizmo_show_light;
char gizmo_show_camera;
char gridflag;
short gridlines;
/** Number of subdivisions in the grid between each highlighted grid line. */
short gridsubdiv;
Multi-View and Stereo 3D Official Documentation: http://www.blender.org/manual/render/workflows/multiview.html Implemented Features ==================== Builtin Stereo Camera * Convergence Mode * Interocular Distance * Convergence Distance * Pivot Mode Viewport * Cameras * Plane * Volume Compositor * View Switch Node * Image Node Multi-View OpenEXR support Sequencer * Image/Movie Strips 'Use Multiview' UV/Image Editor * Option to see Multi-View images in Stereo-3D or its individual images * Save/Open Multi-View (OpenEXR, Stereo3D, individual views) images I/O * Save/Open Multi-View (OpenEXR, Stereo3D, individual views) images Scene Render Views * Ability to have an arbitrary number of views in the scene Missing Bits ============ First rule of Multi-View bug report: If something is not working as it should *when Views is off* this is a severe bug, do mention this in the report. Second rule is, if something works *when Views is off* but doesn't (or crashes) when *Views is on*, this is a important bug. Do mention this in the report. Everything else is likely small todos, and may wait until we are sure none of the above is happening. Apart from that there are those known issues: * Compositor Image Node poorly working for Multi-View OpenEXR (this was working prefectly before the 'Use Multi-View' functionality) * Selecting camera from Multi-View when looking from camera is problematic * Animation Playback (ctrl+F11) doesn't support stereo formats * Wrong filepath when trying to play back animated scene * Viewport Rendering doesn't support Multi-View * Overscan Rendering * Fullscreen display modes need to warn the user * Object copy should be aware of views suffix Acknowledgments =============== * Francesco Siddi for the help with the original feature specs and design * Brecht Van Lommel for the original review of the code and design early on * Blender Foundation for the Development Fund to support the project wrap up Final patch reviewers: * Antony Riakiotakis (psy-fi) * Campbell Barton (ideasman42) * Julian Eisel (Severin) * Sergey Sharybin (nazgul) * Thomas Dinged (dingto) Code contributors of the original branch in github: * Alexey Akishin * Gabriel Caraballo
2015-04-06 15:40:12 +02:00
/** Actually only used to define the opacity of the grease pencil vertex in edit mode. */
float vertex_opacity;
2011-07-21 23:40:04 +02:00
/* XXX deprecated? */
/** Grease-Pencil Data (annotation layers). */
struct bGPdata *gpd DNA_DEPRECATED;
/** Stereoscopy settings. */
Multi-View and Stereo 3D Official Documentation: http://www.blender.org/manual/render/workflows/multiview.html Implemented Features ==================== Builtin Stereo Camera * Convergence Mode * Interocular Distance * Convergence Distance * Pivot Mode Viewport * Cameras * Plane * Volume Compositor * View Switch Node * Image Node Multi-View OpenEXR support Sequencer * Image/Movie Strips 'Use Multiview' UV/Image Editor * Option to see Multi-View images in Stereo-3D or its individual images * Save/Open Multi-View (OpenEXR, Stereo3D, individual views) images I/O * Save/Open Multi-View (OpenEXR, Stereo3D, individual views) images Scene Render Views * Ability to have an arbitrary number of views in the scene Missing Bits ============ First rule of Multi-View bug report: If something is not working as it should *when Views is off* this is a severe bug, do mention this in the report. Second rule is, if something works *when Views is off* but doesn't (or crashes) when *Views is on*, this is a important bug. Do mention this in the report. Everything else is likely small todos, and may wait until we are sure none of the above is happening. Apart from that there are those known issues: * Compositor Image Node poorly working for Multi-View OpenEXR (this was working prefectly before the 'Use Multi-View' functionality) * Selecting camera from Multi-View when looking from camera is problematic * Animation Playback (ctrl+F11) doesn't support stereo formats * Wrong filepath when trying to play back animated scene * Viewport Rendering doesn't support Multi-View * Overscan Rendering * Fullscreen display modes need to warn the user * Object copy should be aware of views suffix Acknowledgments =============== * Francesco Siddi for the help with the original feature specs and design * Brecht Van Lommel for the original review of the code and design early on * Blender Foundation for the Development Fund to support the project wrap up Final patch reviewers: * Antony Riakiotakis (psy-fi) * Campbell Barton (ideasman42) * Julian Eisel (Severin) * Sergey Sharybin (nazgul) * Thomas Dinged (dingto) Code contributors of the original branch in github: * Alexey Akishin * Gabriel Caraballo
2015-04-06 15:40:12 +02:00
short stereo3d_flag;
char stereo3d_camera;
char _pad4;
Multi-View and Stereo 3D Official Documentation: http://www.blender.org/manual/render/workflows/multiview.html Implemented Features ==================== Builtin Stereo Camera * Convergence Mode * Interocular Distance * Convergence Distance * Pivot Mode Viewport * Cameras * Plane * Volume Compositor * View Switch Node * Image Node Multi-View OpenEXR support Sequencer * Image/Movie Strips 'Use Multiview' UV/Image Editor * Option to see Multi-View images in Stereo-3D or its individual images * Save/Open Multi-View (OpenEXR, Stereo3D, individual views) images I/O * Save/Open Multi-View (OpenEXR, Stereo3D, individual views) images Scene Render Views * Ability to have an arbitrary number of views in the scene Missing Bits ============ First rule of Multi-View bug report: If something is not working as it should *when Views is off* this is a severe bug, do mention this in the report. Second rule is, if something works *when Views is off* but doesn't (or crashes) when *Views is on*, this is a important bug. Do mention this in the report. Everything else is likely small todos, and may wait until we are sure none of the above is happening. Apart from that there are those known issues: * Compositor Image Node poorly working for Multi-View OpenEXR (this was working prefectly before the 'Use Multi-View' functionality) * Selecting camera from Multi-View when looking from camera is problematic * Animation Playback (ctrl+F11) doesn't support stereo formats * Wrong filepath when trying to play back animated scene * Viewport Rendering doesn't support Multi-View * Overscan Rendering * Fullscreen display modes need to warn the user * Object copy should be aware of views suffix Acknowledgments =============== * Francesco Siddi for the help with the original feature specs and design * Brecht Van Lommel for the original review of the code and design early on * Blender Foundation for the Development Fund to support the project wrap up Final patch reviewers: * Antony Riakiotakis (psy-fi) * Campbell Barton (ideasman42) * Julian Eisel (Severin) * Sergey Sharybin (nazgul) * Thomas Dinged (dingto) Code contributors of the original branch in github: * Alexey Akishin * Gabriel Caraballo
2015-04-06 15:40:12 +02:00
float stereo3d_convergence_factor;
float stereo3d_volume_alpha;
float stereo3d_convergence_alpha;
/** Display settings. */
View3DShading shading;
View3DOverlay overlay;
Geometry Nodes: viewport preview This adds support for showing geometry passed to the Viewer in the 3d viewport (instead of just in the spreadsheet). The "viewer geometry" bypasses the group output. So it is not necessary to change the final output of the node group to be able to see the intermediate geometry. **Activation and deactivation of a viewer node** * A viewer node is activated by clicking on it. * Ctrl+shift+click on any node/socket connects it to the viewer and makes it active. * Ctrl+shift+click in empty space deactivates the active viewer. * When the active viewer is not visible anymore (e.g. another object is selected, or the current node group is exit), it is deactivated. * Clicking on the icon in the header of the Viewer node toggles whether its active or not. **Pinning** * The spreadsheet still allows pinning the active viewer as before. When pinned, the spreadsheet still references the viewer node even when it becomes inactive. * The viewport does not support pinning at the moment. It always shows the active viewer. **Attribute** * When a field is linked to the second input of the viewer node it is displayed as an overlay in the viewport. * When possible the correct domain for the attribute is determined automatically. This does not work in all cases. It falls back to the face corner domain on meshes and the point domain on curves. When necessary, the domain can be picked manually. * The spreadsheet now only shows the "Viewer" column for the domain that is selected in the Viewer node. * Instance attributes are visualized as a constant color per instance. **Viewport Options** * The attribute overlay opacity can be controlled with the "Viewer Node" setting in the overlays popover. * A viewport can be configured not to show intermediate viewer-geometry by disabling the "Viewer Node" option in the "View" menu. **Implementation Details** * The "spreadsheet context path" was generalized to a "viewer path" that is used in more places now. * The viewer node itself determines the attribute domain, evaluates the field and stores the result in a `.viewer` attribute. * A new "viewer attribute' overlay displays the data from the `.viewer` attribute. * The ground truth for the active viewer node is stored in the workspace now. Node editors, spreadsheets and viewports retrieve the active viewer from there unless they are pinned. * The depsgraph object iterator has a new "viewer path" setting. When set, the viewed geometry of the corresponding object is part of the iterator instead of the final evaluated geometry. * To support the instance attribute overlay `DupliObject` was extended to contain the information necessary for drawing the overlay. * The ctrl+shift+click operator has been refactored so that it can make existing links to viewers active again. * The auto-domain-detection in the Viewer node works by checking the "preferred domain" for every field input. If there is not exactly one preferred domain, the fallback is used. Known limitations: * Loose edges of meshes don't have the attribute overlay. This could be added separately if necessary. * Some attributes are hard to visualize as a color directly. For example, the values might have to be normalized or some should be drawn as arrays. For now, we encourage users to build node groups that generate appropriate viewer-geometry. We might include some of that functionality in future versions. Support for displaying attribute values as text in the viewport is planned as well. * There seems to be an issue with the attribute overlay for pointclouds on nvidia gpus, to be investigated. Differential Revision: https://developer.blender.org/D15954
2022-09-28 17:54:59 +02:00
/** Path to the viewer node that is currently previewed. This is retrieved from the workspace. */
ViewerPath viewer_path;
/** Runtime evaluation data (keep last). */
View3D_Runtime runtime;
2002-10-12 13:37:38 +02:00
} View3D;
/** #View3D::stereo3d_flag */
enum {
V3D_S3D_DISPCAMERAS = 1 << 0,
V3D_S3D_DISPPLANE = 1 << 1,
V3D_S3D_DISPVOLUME = 1 << 2,
};
/** #View3D::flag */
enum {
V3D_LOCAL_COLLECTIONS = 1 << 0,
V3D_FLAG_UNUSED_1 = 1 << 1, /* cleared */
V3D_HIDE_HELPLINES = 1 << 2,
V3D_FLAG_UNUSED_2 = 1 << 3, /* cleared */
V3D_XR_SESSION_MIRROR = 1 << 4,
V3D_XR_SESSION_SURFACE = 1 << 5,
V3D_FLAG_UNUSED_10 = 1 << 10, /* cleared */
V3D_SELECT_OUTLINE = 1 << 11,
V3D_FLAG_UNUSED_12 = 1 << 12, /* cleared */
V3D_GLOBAL_STATS = 1 << 13,
V3D_DRAW_CENTERS = 1 << 15,
};
2002-10-12 13:37:38 +02:00
VR: Initial Virtual Reality support - Milestone 1, Scene Inspection NOTE: While most of the milestone 1 goals are there, a few smaller features and improvements are still to be done. Big picture of this milestone: Initial, OpenXR-based virtual reality support for users and foundation for advanced use cases. Maniphest Task: https://developer.blender.org/T71347 The tasks contains more information about this milestone. To be clear: This is not a feature rich VR implementation, it's focused on the initial scene inspection use case. We intentionally focused on that, further features like controller support are part of the next milestone. - How to use? Instructions on how to use this are here: https://wiki.blender.org/wiki/User:Severin/GSoC-2019/How_to_Test These will be updated and moved to a more official place (likely the manual) soon. Currently Windows Mixed Reality and Oculus devices are usable. Valve/HTC headsets don't support the OpenXR standard yet and hence, do not work with this implementation. --------------- This is the C-side implementation of the features added for initial VR support as per milestone 1. A "VR Scene Inspection" Add-on will be committed separately, to expose the VR functionality in the UI. It also adds some further features for milestone 1, namely a landmarking system (stored view locations in the VR space) Main additions/features: * Support for rendering viewports to an HMD, with good performance. * Option to sync the VR view perspective with a fully interactive, regular 3D View (VR-Mirror). * Option to disable positional tracking. Keeps the current position (calculated based on the VR eye center pose) when enabled while a VR session is running. * Some regular viewport settings for the VR view * RNA/Python-API to query and set VR session state information. * WM-XR: Layer tying Ghost-XR to the Blender specific APIs/data * wmSurface API: drawable, non-window container (manages Ghost-OpenGL and GPU context) * DNA/RNA for management of VR session settings * `--debug-xr` and `--debug-xr-time` commandline options * Utility batch & config file for using the Oculus runtime on Windows. * Most VR data is runtime only. The exception is user settings which are saved to files (`XrSessionSettings`). * VR support can be disabled through the `WITH_XR_OPENXR` compiler flag. For architecture and code documentation, see https://wiki.blender.org/wiki/Source/Interface/XR. --------------- A few thank you's: * A huge shoutout to Ray Molenkamp for his help during the project - it would have not been that successful without him! * Sebastian Koenig and Simeon Conzendorf for testing and feedback! * The reviewers, especially Brecht Van Lommel! * Dalai Felinto for pushing and managing me to get this done ;) * The OpenXR working group for providing an open standard. I think we're the first bigger application to adopt OpenXR. Congratulations to them and ourselves :) This project started as a Google Summer of Code 2019 project - "Core Support of Virtual Reality Headsets through OpenXR" (see https://wiki.blender.org/wiki/User:Severin/GSoC-2019/). Some further information, including ideas for further improvements can be found in the final GSoC report: https://wiki.blender.org/wiki/User:Severin/GSoC-2019/Final_Report Differential Revisions: D6193, D7098 Reviewed by: Brecht Van Lommel, Jeroen Bakker
2020-03-17 20:20:55 +01:00
/** #View3D_Runtime.flag */
enum {
/** The 3D view which the XR session was created in is flagged with this. */
V3D_RUNTIME_XR_SESSION_ROOT = (1 << 0),
/** Some operators override the depth buffer for dedicated occlusion operations. */
V3D_RUNTIME_DEPTHBUF_OVERRIDDEN = (1 << 1),
VR: Initial Virtual Reality support - Milestone 1, Scene Inspection NOTE: While most of the milestone 1 goals are there, a few smaller features and improvements are still to be done. Big picture of this milestone: Initial, OpenXR-based virtual reality support for users and foundation for advanced use cases. Maniphest Task: https://developer.blender.org/T71347 The tasks contains more information about this milestone. To be clear: This is not a feature rich VR implementation, it's focused on the initial scene inspection use case. We intentionally focused on that, further features like controller support are part of the next milestone. - How to use? Instructions on how to use this are here: https://wiki.blender.org/wiki/User:Severin/GSoC-2019/How_to_Test These will be updated and moved to a more official place (likely the manual) soon. Currently Windows Mixed Reality and Oculus devices are usable. Valve/HTC headsets don't support the OpenXR standard yet and hence, do not work with this implementation. --------------- This is the C-side implementation of the features added for initial VR support as per milestone 1. A "VR Scene Inspection" Add-on will be committed separately, to expose the VR functionality in the UI. It also adds some further features for milestone 1, namely a landmarking system (stored view locations in the VR space) Main additions/features: * Support for rendering viewports to an HMD, with good performance. * Option to sync the VR view perspective with a fully interactive, regular 3D View (VR-Mirror). * Option to disable positional tracking. Keeps the current position (calculated based on the VR eye center pose) when enabled while a VR session is running. * Some regular viewport settings for the VR view * RNA/Python-API to query and set VR session state information. * WM-XR: Layer tying Ghost-XR to the Blender specific APIs/data * wmSurface API: drawable, non-window container (manages Ghost-OpenGL and GPU context) * DNA/RNA for management of VR session settings * `--debug-xr` and `--debug-xr-time` commandline options * Utility batch & config file for using the Oculus runtime on Windows. * Most VR data is runtime only. The exception is user settings which are saved to files (`XrSessionSettings`). * VR support can be disabled through the `WITH_XR_OPENXR` compiler flag. For architecture and code documentation, see https://wiki.blender.org/wiki/Source/Interface/XR. --------------- A few thank you's: * A huge shoutout to Ray Molenkamp for his help during the project - it would have not been that successful without him! * Sebastian Koenig and Simeon Conzendorf for testing and feedback! * The reviewers, especially Brecht Van Lommel! * Dalai Felinto for pushing and managing me to get this done ;) * The OpenXR working group for providing an open standard. I think we're the first bigger application to adopt OpenXR. Congratulations to them and ourselves :) This project started as a Google Summer of Code 2019 project - "Core Support of Virtual Reality Headsets through OpenXR" (see https://wiki.blender.org/wiki/User:Severin/GSoC-2019/). Some further information, including ideas for further improvements can be found in the final GSoC report: https://wiki.blender.org/wiki/User:Severin/GSoC-2019/Final_Report Differential Revisions: D6193, D7098 Reviewed by: Brecht Van Lommel, Jeroen Bakker
2020-03-17 20:20:55 +01:00
};
/** #RegionView3D::persp */
enum {
RV3D_ORTHO = 0,
RV3D_PERSP = 1,
RV3D_CAMOB = 2,
};
/** #RegionView3D::rflag */
enum {
RV3D_CLIPPING = 1 << 2,
RV3D_NAVIGATING = 1 << 3,
RV3D_GPULIGHT_UPDATE = 1 << 4,
RV3D_PAINTING = 1 << 5,
// RV3D_IS_GAME_ENGINE = 1 << 5, /* UNUSED */
/**
* Disable Z-buffer offset, skip calls to #ED_view3d_polygon_offset.
* Use when precise surface depth is needed and picking bias isn't, see #45434).
*/
RV3D_ZOFFSET_DISABLED = 1 << 6,
};
/** #RegionView3D.viewlock */
VR: Initial Virtual Reality support - Milestone 1, Scene Inspection NOTE: While most of the milestone 1 goals are there, a few smaller features and improvements are still to be done. Big picture of this milestone: Initial, OpenXR-based virtual reality support for users and foundation for advanced use cases. Maniphest Task: https://developer.blender.org/T71347 The tasks contains more information about this milestone. To be clear: This is not a feature rich VR implementation, it's focused on the initial scene inspection use case. We intentionally focused on that, further features like controller support are part of the next milestone. - How to use? Instructions on how to use this are here: https://wiki.blender.org/wiki/User:Severin/GSoC-2019/How_to_Test These will be updated and moved to a more official place (likely the manual) soon. Currently Windows Mixed Reality and Oculus devices are usable. Valve/HTC headsets don't support the OpenXR standard yet and hence, do not work with this implementation. --------------- This is the C-side implementation of the features added for initial VR support as per milestone 1. A "VR Scene Inspection" Add-on will be committed separately, to expose the VR functionality in the UI. It also adds some further features for milestone 1, namely a landmarking system (stored view locations in the VR space) Main additions/features: * Support for rendering viewports to an HMD, with good performance. * Option to sync the VR view perspective with a fully interactive, regular 3D View (VR-Mirror). * Option to disable positional tracking. Keeps the current position (calculated based on the VR eye center pose) when enabled while a VR session is running. * Some regular viewport settings for the VR view * RNA/Python-API to query and set VR session state information. * WM-XR: Layer tying Ghost-XR to the Blender specific APIs/data * wmSurface API: drawable, non-window container (manages Ghost-OpenGL and GPU context) * DNA/RNA for management of VR session settings * `--debug-xr` and `--debug-xr-time` commandline options * Utility batch & config file for using the Oculus runtime on Windows. * Most VR data is runtime only. The exception is user settings which are saved to files (`XrSessionSettings`). * VR support can be disabled through the `WITH_XR_OPENXR` compiler flag. For architecture and code documentation, see https://wiki.blender.org/wiki/Source/Interface/XR. --------------- A few thank you's: * A huge shoutout to Ray Molenkamp for his help during the project - it would have not been that successful without him! * Sebastian Koenig and Simeon Conzendorf for testing and feedback! * The reviewers, especially Brecht Van Lommel! * Dalai Felinto for pushing and managing me to get this done ;) * The OpenXR working group for providing an open standard. I think we're the first bigger application to adopt OpenXR. Congratulations to them and ourselves :) This project started as a Google Summer of Code 2019 project - "Core Support of Virtual Reality Headsets through OpenXR" (see https://wiki.blender.org/wiki/User:Severin/GSoC-2019/). Some further information, including ideas for further improvements can be found in the final GSoC report: https://wiki.blender.org/wiki/User:Severin/GSoC-2019/Final_Report Differential Revisions: D6193, D7098 Reviewed by: Brecht Van Lommel, Jeroen Bakker
2020-03-17 20:20:55 +01:00
enum {
RV3D_LOCK_ROTATION = (1 << 0),
RV3D_BOXVIEW = (1 << 1),
RV3D_BOXCLIP = (1 << 2),
RV3D_LOCK_LOCATION = (1 << 3),
RV3D_LOCK_ZOOM_AND_DOLLY = (1 << 4),
RV3D_LOCK_ANY_TRANSFORM = (RV3D_LOCK_LOCATION | RV3D_LOCK_ROTATION | RV3D_LOCK_ZOOM_AND_DOLLY),
};
2022-01-06 03:54:52 +01:00
/** Bit-wise OR of the regular lock-flags with runtime only lock-flags. */
VR: Initial Virtual Reality support - Milestone 1, Scene Inspection NOTE: While most of the milestone 1 goals are there, a few smaller features and improvements are still to be done. Big picture of this milestone: Initial, OpenXR-based virtual reality support for users and foundation for advanced use cases. Maniphest Task: https://developer.blender.org/T71347 The tasks contains more information about this milestone. To be clear: This is not a feature rich VR implementation, it's focused on the initial scene inspection use case. We intentionally focused on that, further features like controller support are part of the next milestone. - How to use? Instructions on how to use this are here: https://wiki.blender.org/wiki/User:Severin/GSoC-2019/How_to_Test These will be updated and moved to a more official place (likely the manual) soon. Currently Windows Mixed Reality and Oculus devices are usable. Valve/HTC headsets don't support the OpenXR standard yet and hence, do not work with this implementation. --------------- This is the C-side implementation of the features added for initial VR support as per milestone 1. A "VR Scene Inspection" Add-on will be committed separately, to expose the VR functionality in the UI. It also adds some further features for milestone 1, namely a landmarking system (stored view locations in the VR space) Main additions/features: * Support for rendering viewports to an HMD, with good performance. * Option to sync the VR view perspective with a fully interactive, regular 3D View (VR-Mirror). * Option to disable positional tracking. Keeps the current position (calculated based on the VR eye center pose) when enabled while a VR session is running. * Some regular viewport settings for the VR view * RNA/Python-API to query and set VR session state information. * WM-XR: Layer tying Ghost-XR to the Blender specific APIs/data * wmSurface API: drawable, non-window container (manages Ghost-OpenGL and GPU context) * DNA/RNA for management of VR session settings * `--debug-xr` and `--debug-xr-time` commandline options * Utility batch & config file for using the Oculus runtime on Windows. * Most VR data is runtime only. The exception is user settings which are saved to files (`XrSessionSettings`). * VR support can be disabled through the `WITH_XR_OPENXR` compiler flag. For architecture and code documentation, see https://wiki.blender.org/wiki/Source/Interface/XR. --------------- A few thank you's: * A huge shoutout to Ray Molenkamp for his help during the project - it would have not been that successful without him! * Sebastian Koenig and Simeon Conzendorf for testing and feedback! * The reviewers, especially Brecht Van Lommel! * Dalai Felinto for pushing and managing me to get this done ;) * The OpenXR working group for providing an open standard. I think we're the first bigger application to adopt OpenXR. Congratulations to them and ourselves :) This project started as a Google Summer of Code 2019 project - "Core Support of Virtual Reality Headsets through OpenXR" (see https://wiki.blender.org/wiki/User:Severin/GSoC-2019/). Some further information, including ideas for further improvements can be found in the final GSoC report: https://wiki.blender.org/wiki/User:Severin/GSoC-2019/Final_Report Differential Revisions: D6193, D7098 Reviewed by: Brecht Van Lommel, Jeroen Bakker
2020-03-17 20:20:55 +01:00
#define RV3D_LOCK_FLAGS(rv3d) ((rv3d)->viewlock | ((rv3d)->runtime_viewlock))
/** #RegionView3D::viewlock_quad */
enum {
RV3D_VIEWLOCK_INIT = 1 << 7,
};
/** #RegionView3D::view */
enum {
RV3D_VIEW_USER = 0,
RV3D_VIEW_FRONT = 1,
RV3D_VIEW_BACK = 2,
RV3D_VIEW_LEFT = 3,
RV3D_VIEW_RIGHT = 4,
RV3D_VIEW_TOP = 5,
RV3D_VIEW_BOTTOM = 6,
RV3D_VIEW_CAMERA = 8,
};
2016-05-31 16:19:01 +02:00
#define RV3D_VIEW_IS_AXIS(view) (((view) >= RV3D_VIEW_FRONT) && ((view) <= RV3D_VIEW_BOTTOM))
/**
* #RegionView3D.view_axis_roll
*
* Clockwise rotation to use for axis-views, when #RV3D_VIEW_IS_AXIS is true.
*/
enum {
RV3D_VIEW_AXIS_ROLL_0 = 0,
RV3D_VIEW_AXIS_ROLL_90 = 1,
RV3D_VIEW_AXIS_ROLL_180 = 2,
RV3D_VIEW_AXIS_ROLL_270 = 3,
};
#define RV3D_CLIPPING_ENABLED(v3d, rv3d) \
((rv3d) && (v3d) && ((rv3d)->rflag & RV3D_CLIPPING) && \
ELEM((v3d)->shading.type, OB_WIRE, OB_SOLID) && (rv3d)->clipbb)
/** #View3D::flag2 (int) */
enum {
V3D_HIDE_OVERLAYS = 1 << 2,
V3D_SHOW_VIEWER = 1 << 3,
V3D_SHOW_ANNOTATION = 1 << 4,
V3D_LOCK_CAMERA = 1 << 5,
V3D_FLAG2_UNUSED_6 = 1 << 6, /* cleared */
V3D_SHOW_RECONSTRUCTION = 1 << 7,
V3D_SHOW_CAMERAPATH = 1 << 8,
V3D_SHOW_BUNDLENAME = 1 << 9,
V3D_FLAG2_UNUSED_10 = 1 << 10, /* cleared */
V3D_RENDER_BORDER = 1 << 11,
V3D_FLAG2_UNUSED_12 = 1 << 12, /* cleared */
V3D_FLAG2_UNUSED_13 = 1 << 13, /* cleared */
V3D_FLAG2_UNUSED_14 = 1 << 14, /* cleared */
V3D_FLAG2_UNUSED_15 = 1 << 15, /* cleared */
V3D_XR_SHOW_CONTROLLERS = 1 << 16,
V3D_XR_SHOW_CUSTOM_OVERLAYS = 1 << 17,
};
/** #View3D::gp_flag (short) */
enum {
/** Fade all non GP objects. */
V3D_GP_FADE_OBJECTS = 1 << 0,
/** Activate paper grid. */
V3D_GP_SHOW_GRID = 1 << 1,
V3D_GP_SHOW_EDIT_LINES = 1 << 2,
V3D_GP_SHOW_MULTIEDIT_LINES = 1 << 3,
/** main switch at view level. */
V3D_GP_SHOW_ONION_SKIN = 1 << 4,
/** fade layers not active. */
V3D_GP_FADE_NOACTIVE_LAYERS = 1 << 5,
/** Fade other GPencil objects. */
V3D_GP_FADE_NOACTIVE_GPENCIL = 1 << 6,
/** Show Strokes Directions. */
V3D_GP_SHOW_STROKE_DIRECTION = 1 << 7,
/** Show Material names. */
V3D_GP_SHOW_MATERIAL_NAME = 1 << 8,
/** Show Canvas Grid on Top. */
V3D_GP_SHOW_GRID_XRAY = 1 << 9,
};
/** #View3DShading.flag */
enum {
V3D_SHADING_OBJECT_OUTLINE = (1 << 0),
V3D_SHADING_XRAY = (1 << 1),
V3D_SHADING_SHADOW = (1 << 2),
V3D_SHADING_SCENE_LIGHTS = (1 << 3),
V3D_SHADING_SPECULAR_HIGHLIGHT = (1 << 4),
V3D_SHADING_CAVITY = (1 << 5),
V3D_SHADING_MATCAP_FLIP_X = (1 << 6),
V3D_SHADING_SCENE_WORLD = (1 << 7),
V3D_SHADING_XRAY_WIREFRAME = (1 << 8),
V3D_SHADING_WORLD_ORIENTATION = (1 << 9),
V3D_SHADING_BACKFACE_CULLING = (1 << 10),
V3D_SHADING_DEPTH_OF_FIELD = (1 << 11),
V3D_SHADING_SCENE_LIGHTS_RENDER = (1 << 12),
V3D_SHADING_SCENE_WORLD_RENDER = (1 << 13),
V3D_SHADING_STUDIOLIGHT_VIEW_ROTATION = (1 << 14),
};
DRWManager: New implementation. This is a new implementation of the draw manager using modern rendering practices and GPU driven culling. This only ports features that are not considered deprecated or to be removed. The old DRW API is kept working along side this new one, and does not interfeer with it. However this needed some more hacking inside the draw_view_lib.glsl. At least the create info are well separated. The reviewer might start by looking at `draw_pass_test.cc` to see the API in usage. Important files are `draw_pass.hh`, `draw_command.hh`, `draw_command_shared.hh`. In a nutshell (for a developper used to old DRW API): - `DRWShadingGroups` are replaced by `Pass<T>::Sub`. - Contrary to DRWShadingGroups, all commands recorded inside a pass or sub-pass (even binds / push_constant / uniforms) will be executed in order. - All memory is managed per object (except for Sub-Pass which are managed by their parent pass) and not from draw manager pools. So passes "can" potentially be recorded once and submitted multiple time (but this is not really encouraged for now). The only implicit link is between resource lifetime and `ResourceHandles` - Sub passes can be any level deep. - IMPORTANT: All state propagate from sub pass to subpass. There is no state stack concept anymore. Ensure the correct render state is set before drawing anything using `Pass::state_set()`. - The drawcalls now needs a `ResourceHandle` instead of an `Object *`. This is to remove any implicit dependency between `Pass` and `Manager`. This was a huge problem in old implementation since the manager did not know what to pull from the object. Now it is explicitly requested by the engine. - The pases need to be submitted to a `draw::Manager` instance which can be retrieved using `DRW_manager_get()` (for now). Internally: - All object data are stored in contiguous storage buffers. Removing a lot of complexity in the pass submission. - Draw calls are sorted and visibility tested on GPU. Making more modern culling and better instancing usage possible in the future. - Unit Tests have been added for regression testing and avoid most API breakage. - `draw::View` now contains culling data for all objects in the scene allowing caching for multiple views. - Bounding box and sphere final setup is moved to GPU. - Some global resources locations have been hardcoded to reduce complexity. What is missing: - ~~Workaround for lack of gl_BaseInstanceARB.~~ Done - ~~Object Uniform Attributes.~~ Done (Not in this patch) - Workaround for hardware supporting a maximum of 8 SSBO. Reviewed By: jbakker Differential Revision: https://developer.blender.org/D15817
2022-09-02 18:30:48 +02:00
/** #View3D.debug_flag */
enum {
V3D_DEBUG_FREEZE_CULLING = (1 << 0),
};
#define V3D_USES_SCENE_LIGHTS(v3d) \
((((v3d)->shading.type == OB_MATERIAL) && ((v3d)->shading.flag & V3D_SHADING_SCENE_LIGHTS)) || \
(((v3d)->shading.type == OB_RENDER) && \
((v3d)->shading.flag & V3D_SHADING_SCENE_LIGHTS_RENDER)))
#define V3D_USES_SCENE_WORLD(v3d) \
((((v3d)->shading.type == OB_MATERIAL) && ((v3d)->shading.flag & V3D_SHADING_SCENE_WORLD)) || \
(((v3d)->shading.type == OB_RENDER) && \
((v3d)->shading.flag & V3D_SHADING_SCENE_WORLD_RENDER)))
/** #View3DShading.cavity_type */
enum {
V3D_SHADING_CAVITY_SSAO = 0,
V3D_SHADING_CAVITY_CURVATURE = 1,
V3D_SHADING_CAVITY_BOTH = 2,
};
/** #View3DShading.use_compositor */
typedef enum View3DShadingUseCompositor {
V3D_SHADING_USE_COMPOSITOR_DISABLED = 0,
/** The compositor is enabled only in camera view. */
V3D_SHADING_USE_COMPOSITOR_CAMERA = 1,
/** The compositor is always enabled regardless of the view. */
V3D_SHADING_USE_COMPOSITOR_ALWAYS = 2,
} View3DShadingUseCompositor;
/** #View3DOverlay.flag */
enum {
V3D_OVERLAY_FACE_ORIENTATION = (1 << 0),
V3D_OVERLAY_HIDE_CURSOR = (1 << 1),
2018-07-11 13:02:22 +02:00
V3D_OVERLAY_BONE_SELECT = (1 << 2),
V3D_OVERLAY_LOOK_DEV = (1 << 3),
2018-05-31 19:19:27 +02:00
V3D_OVERLAY_WIREFRAMES = (1 << 4),
2018-06-01 08:26:55 +02:00
V3D_OVERLAY_HIDE_TEXT = (1 << 5),
V3D_OVERLAY_HIDE_MOTION_PATHS = (1 << 6),
V3D_OVERLAY_ONION_SKINS = (1 << 7),
V3D_OVERLAY_HIDE_BONES = (1 << 8),
V3D_OVERLAY_HIDE_OBJECT_XTRAS = (1 << 9),
V3D_OVERLAY_HIDE_OBJECT_ORIGINS = (1 << 10),
V3D_OVERLAY_STATS = (1 << 11),
V3D_OVERLAY_FADE_INACTIVE = (1 << 12),
Geometry Nodes: viewport preview This adds support for showing geometry passed to the Viewer in the 3d viewport (instead of just in the spreadsheet). The "viewer geometry" bypasses the group output. So it is not necessary to change the final output of the node group to be able to see the intermediate geometry. **Activation and deactivation of a viewer node** * A viewer node is activated by clicking on it. * Ctrl+shift+click on any node/socket connects it to the viewer and makes it active. * Ctrl+shift+click in empty space deactivates the active viewer. * When the active viewer is not visible anymore (e.g. another object is selected, or the current node group is exit), it is deactivated. * Clicking on the icon in the header of the Viewer node toggles whether its active or not. **Pinning** * The spreadsheet still allows pinning the active viewer as before. When pinned, the spreadsheet still references the viewer node even when it becomes inactive. * The viewport does not support pinning at the moment. It always shows the active viewer. **Attribute** * When a field is linked to the second input of the viewer node it is displayed as an overlay in the viewport. * When possible the correct domain for the attribute is determined automatically. This does not work in all cases. It falls back to the face corner domain on meshes and the point domain on curves. When necessary, the domain can be picked manually. * The spreadsheet now only shows the "Viewer" column for the domain that is selected in the Viewer node. * Instance attributes are visualized as a constant color per instance. **Viewport Options** * The attribute overlay opacity can be controlled with the "Viewer Node" setting in the overlays popover. * A viewport can be configured not to show intermediate viewer-geometry by disabling the "Viewer Node" option in the "View" menu. **Implementation Details** * The "spreadsheet context path" was generalized to a "viewer path" that is used in more places now. * The viewer node itself determines the attribute domain, evaluates the field and stores the result in a `.viewer` attribute. * A new "viewer attribute' overlay displays the data from the `.viewer` attribute. * The ground truth for the active viewer node is stored in the workspace now. Node editors, spreadsheets and viewports retrieve the active viewer from there unless they are pinned. * The depsgraph object iterator has a new "viewer path" setting. When set, the viewed geometry of the corresponding object is part of the iterator instead of the final evaluated geometry. * To support the instance attribute overlay `DupliObject` was extended to contain the information necessary for drawing the overlay. * The ctrl+shift+click operator has been refactored so that it can make existing links to viewers active again. * The auto-domain-detection in the Viewer node works by checking the "preferred domain" for every field input. If there is not exactly one preferred domain, the fallback is used. Known limitations: * Loose edges of meshes don't have the attribute overlay. This could be added separately if necessary. * Some attributes are hard to visualize as a color directly. For example, the values might have to be normalized or some should be drawn as arrays. For now, we encourage users to build node groups that generate appropriate viewer-geometry. We might include some of that functionality in future versions. Support for displaying attribute values as text in the viewport is planned as well. * There seems to be an issue with the attribute overlay for pointclouds on nvidia gpus, to be investigated. Differential Revision: https://developer.blender.org/D15954
2022-09-28 17:54:59 +02:00
V3D_OVERLAY_VIEWER_ATTRIBUTE = (1 << 13),
V3D_OVERLAY_SCULPT_SHOW_MASK = (1 << 14),
V3D_OVERLAY_SCULPT_SHOW_FACE_SETS = (1 << 15),
V3D_OVERLAY_SCULPT_CURVES_CAGE = (1 << 16),
V3D_OVERLAY_SHOW_LIGHT_COLORS = (1 << 17),
V3D_OVERLAY_VIEWER_ATTRIBUTE_TEXT = (1 << 18),
};
/** #View3DOverlay.edit_flag */
enum {
V3D_OVERLAY_EDIT_VERT_NORMALS = (1 << 0),
V3D_OVERLAY_EDIT_LOOP_NORMALS = (1 << 1),
V3D_OVERLAY_EDIT_FACE_NORMALS = (1 << 2),
V3D_OVERLAY_EDIT_RETOPOLOGY = (1 << 3),
V3D_OVERLAY_EDIT_WEIGHT = (1 << 4),
V3D_OVERLAY_EDIT_EDGES_DEPRECATED = (1 << 5),
V3D_OVERLAY_EDIT_FACES = (1 << 6),
V3D_OVERLAY_EDIT_FACE_DOT = (1 << 7),
V3D_OVERLAY_EDIT_SEAMS = (1 << 8),
V3D_OVERLAY_EDIT_SHARP = (1 << 9),
V3D_OVERLAY_EDIT_CREASES = (1 << 10),
V3D_OVERLAY_EDIT_BWEIGHTS = (1 << 11),
V3D_OVERLAY_EDIT_FREESTYLE_EDGE = (1 << 12),
V3D_OVERLAY_EDIT_FREESTYLE_FACE = (1 << 13),
V3D_OVERLAY_EDIT_STATVIS = (1 << 14),
V3D_OVERLAY_EDIT_EDGE_LEN = (1 << 15),
V3D_OVERLAY_EDIT_EDGE_ANG = (1 << 16),
V3D_OVERLAY_EDIT_FACE_ANG = (1 << 17),
V3D_OVERLAY_EDIT_FACE_AREA = (1 << 18),
V3D_OVERLAY_EDIT_INDICES = (1 << 19),
/* Deprecated. */
// V3D_OVERLAY_EDIT_CU_HANDLES = (1 << 20),
V3D_OVERLAY_EDIT_CU_NORMALS = (1 << 21),
V3D_OVERLAY_EDIT_CONSTANT_SCREEN_SIZE_NORMALS = (1 << 22),
};
/** #View3DOverlay.paint_flag */
enum {
V3D_OVERLAY_PAINT_WIRE = (1 << 0),
};
/** #View3DOverlay.wpaint_flag */
enum {
V3D_OVERLAY_WPAINT_CONTOURS = (1 << 0),
};
/** #View3D.around */
enum {
/* center of the bounding box */
V3D_AROUND_CENTER_BOUNDS = 0,
/* center from the sum of all points divided by the total */
2018-12-14 01:01:01 +01:00
V3D_AROUND_CENTER_MEDIAN = 3,
/* pivot around the 2D/3D cursor */
V3D_AROUND_CURSOR = 1,
/* pivot around each items own origin */
V3D_AROUND_LOCAL_ORIGINS = 2,
/* pivot around the active items origin */
V3D_AROUND_ACTIVE = 4,
};
/** #View3D.gridflag */
enum {
V3D_SHOW_FLOOR = 1 << 0,
V3D_SHOW_X = 1 << 1,
V3D_SHOW_Y = 1 << 2,
V3D_SHOW_Z = 1 << 3,
V3D_SHOW_ORTHO_GRID = 1 << 4,
};
/** #TransformOrientationSlot.type */
enum {
V3D_ORIENT_GLOBAL = 0,
V3D_ORIENT_LOCAL = 1,
V3D_ORIENT_NORMAL = 2,
V3D_ORIENT_VIEW = 3,
V3D_ORIENT_GIMBAL = 4,
V3D_ORIENT_CURSOR = 5,
V3D_ORIENT_PARENT = 6,
V3D_ORIENT_CUSTOM = 1024,
/** Runtime only, never saved to DNA. */
V3D_ORIENT_CUSTOM_MATRIX = (V3D_ORIENT_CUSTOM - 1),
};
/** #View3d.gizmo_flag */
enum {
/** All gizmos. */
V3D_GIZMO_HIDE = (1 << 0),
V3D_GIZMO_HIDE_NAVIGATE = (1 << 1),
V3D_GIZMO_HIDE_CONTEXT = (1 << 2),
V3D_GIZMO_HIDE_TOOL = (1 << 3),
};
/** #View3d.gizmo_show_object */
enum {
V3D_GIZMO_SHOW_OBJECT_TRANSLATE = (1 << 0),
V3D_GIZMO_SHOW_OBJECT_ROTATE = (1 << 1),
V3D_GIZMO_SHOW_OBJECT_SCALE = (1 << 2),
};
/** #View3d.gizmo_show_armature */
enum {
/** Currently unused (WIP gizmo). */
V3D_GIZMO_SHOW_ARMATURE_BBONE = (1 << 0),
/** Not yet implemented. */
V3D_GIZMO_SHOW_ARMATURE_ROLL = (1 << 1),
};
/** #View3d.gizmo_show_empty */
enum {
V3D_GIZMO_SHOW_EMPTY_IMAGE = (1 << 0),
V3D_GIZMO_SHOW_EMPTY_FORCE_FIELD = (1 << 1),
};
/** #View3d.gizmo_show_light */
enum {
/** Use for both spot & area size. */
V3D_GIZMO_SHOW_LIGHT_SIZE = (1 << 0),
V3D_GIZMO_SHOW_LIGHT_LOOK_AT = (1 << 1),
};
/** #View3d.gizmo_show_camera */
enum {
/** Also used for ortho size. */
V3D_GIZMO_SHOW_CAMERA_LENS = (1 << 0),
V3D_GIZMO_SHOW_CAMERA_DOF_DIST = (1 << 2),
};
/** #ToolSettings.plane_depth */
typedef enum {
V3D_PLACE_DEPTH_SURFACE = 0,
V3D_PLACE_DEPTH_CURSOR_PLANE = 1,
V3D_PLACE_DEPTH_CURSOR_VIEW = 2,
} eV3DPlaceDepth;
/** #ToolSettings.plane_orient */
typedef enum {
V3D_PLACE_ORIENT_SURFACE = 0,
V3D_PLACE_ORIENT_DEFAULT = 1,
} eV3DPlaceOrient;
#define RV3D_CAMZOOM_MIN -30
#define RV3D_CAMZOOM_MAX 600
/** #BKE_screen_view3d_zoom_to_fac() values above */
#define RV3D_CAMZOOM_MIN_FACTOR 0.1657359312880714853f
#define RV3D_CAMZOOM_MAX_FACTOR 44.9852813742385702928f