2011-02-21 06:58:46 +00:00
|
|
|
/*
|
2009-10-03 15:35:01 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
2011-11-29 10:54:47 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2009-10-03 15:35:01 +00:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2009-10-03 15:35:01 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2005 Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*/
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
* \ingroup gpu
|
2011-02-21 06:58:46 +00:00
|
|
|
*/
|
|
|
|
|
2009-10-03 15:35:01 +00:00
|
|
|
#pragma once
|
|
|
|
|
2015-07-17 12:25:05 +02:00
|
|
|
#include <stddef.h>
|
|
|
|
|
2020-03-02 15:28:47 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2012-12-30 18:24:54 +00:00
|
|
|
struct BMesh;
|
2012-05-10 20:33:09 +00:00
|
|
|
struct CCGElem;
|
|
|
|
struct CCGKey;
|
|
|
|
struct DMFlagMat;
|
Remove Blender Internal and legacy viewport from Blender 2.8.
Brecht authored this commit, but he gave me the honours to actually
do it. Here it goes; Blender Internal. Bye bye, you did great!
* Point density, voxel data, ocean, environment map textures were removed,
as these only worked within BI rendering. Note that the ocean modifier
and the Cycles point density shader node continue to work.
* Dynamic paint using material shading was removed, as this only worked
with BI. If we ever wanted to support this again probably it should go
through the baking API.
* GPU shader export through the Python API was removed. This only worked
for the old BI GLSL shaders, which no longer exists. Doing something
similar for Eevee would be significantly more complicated because it
uses a lot of multiplass rendering and logic outside the shader, it's
probably impractical.
* Collada material import / export code is mostly gone, as it only worked
for BI materials. We need to add Cycles / Eevee material support at some
point.
* The mesh noise operator was removed since it only worked with BI
material texture slots. A displacement modifier can be used instead.
* The delete texture paint slot operator was removed since it only worked
for BI material texture slots. Could be added back with node support.
* Not all legacy viewport features are supported in the new viewport, but
their code was removed. If we need to bring anything back we can look at
older git revisions.
* There is some legacy viewport code that I could not remove yet, and some
that I probably missed.
* Shader node execution code was left mostly intact, even though it is not
used anywhere now. We may eventually use this to replace the texture
nodes with Cycles / Eevee shader nodes.
* The Cycles Bake panel now includes settings for baking multires normal
and displacement maps. The underlying code needs to be merged properly,
and we plan to add back support for multires AO baking and add support
to Cycles baking for features like vertex color, displacement, and other
missing baking features.
* This commit removes DNA and the Python API for BI material, lamp, world
and scene settings. This breaks a lot of addons.
* There is more DNA that can be removed or renamed, where Cycles or Eevee
are reusing some old BI properties but the names are not really correct
anymore.
* Texture slots for materials, lamps and world were removed. They remain
for brushes, particles and freestyle linestyles.
* 'BLENDER_RENDER' remains in the COMPAT_ENGINES of UI panels. Cycles and
other renderers use this to find all panels to show, minus a few panels
that they have their own replacement for.
2018-04-19 17:34:44 +02:00
|
|
|
struct GSet;
|
|
|
|
struct MLoop;
|
2019-05-14 20:20:01 +10:00
|
|
|
struct MLoopCol;
|
Remove Blender Internal and legacy viewport from Blender 2.8.
Brecht authored this commit, but he gave me the honours to actually
do it. Here it goes; Blender Internal. Bye bye, you did great!
* Point density, voxel data, ocean, environment map textures were removed,
as these only worked within BI rendering. Note that the ocean modifier
and the Cycles point density shader node continue to work.
* Dynamic paint using material shading was removed, as this only worked
with BI. If we ever wanted to support this again probably it should go
through the baking API.
* GPU shader export through the Python API was removed. This only worked
for the old BI GLSL shaders, which no longer exists. Doing something
similar for Eevee would be significantly more complicated because it
uses a lot of multiplass rendering and logic outside the shader, it's
probably impractical.
* Collada material import / export code is mostly gone, as it only worked
for BI materials. We need to add Cycles / Eevee material support at some
point.
* The mesh noise operator was removed since it only worked with BI
material texture slots. A displacement modifier can be used instead.
* The delete texture paint slot operator was removed since it only worked
for BI material texture slots. Could be added back with node support.
* Not all legacy viewport features are supported in the new viewport, but
their code was removed. If we need to bring anything back we can look at
older git revisions.
* There is some legacy viewport code that I could not remove yet, and some
that I probably missed.
* Shader node execution code was left mostly intact, even though it is not
used anywhere now. We may eventually use this to replace the texture
nodes with Cycles / Eevee shader nodes.
* The Cycles Bake panel now includes settings for baking multires normal
and displacement maps. The underlying code needs to be merged properly,
and we plan to add back support for multires AO baking and add support
to Cycles baking for features like vertex color, displacement, and other
missing baking features.
* This commit removes DNA and the Python API for BI material, lamp, world
and scene settings. This breaks a lot of addons.
* There is more DNA that can be removed or renamed, where Cycles or Eevee
are reusing some old BI properties but the names are not really correct
anymore.
* Texture slots for materials, lamps and world were removed. They remain
for brushes, particles and freestyle linestyles.
* 'BLENDER_RENDER' remains in the COMPAT_ENGINES of UI panels. Cycles and
other renderers use this to find all panels to show, minus a few panels
that they have their own replacement for.
2018-04-19 17:34:44 +02:00
|
|
|
struct MLoopTri;
|
|
|
|
struct MPoly;
|
2020-09-30 11:51:13 +10:00
|
|
|
struct MPropCol;
|
2015-07-16 16:22:28 +02:00
|
|
|
struct MVert;
|
2019-12-17 10:08:47 +11:00
|
|
|
struct Mesh;
|
Remove Blender Internal and legacy viewport from Blender 2.8.
Brecht authored this commit, but he gave me the honours to actually
do it. Here it goes; Blender Internal. Bye bye, you did great!
* Point density, voxel data, ocean, environment map textures were removed,
as these only worked within BI rendering. Note that the ocean modifier
and the Cycles point density shader node continue to work.
* Dynamic paint using material shading was removed, as this only worked
with BI. If we ever wanted to support this again probably it should go
through the baking API.
* GPU shader export through the Python API was removed. This only worked
for the old BI GLSL shaders, which no longer exists. Doing something
similar for Eevee would be significantly more complicated because it
uses a lot of multiplass rendering and logic outside the shader, it's
probably impractical.
* Collada material import / export code is mostly gone, as it only worked
for BI materials. We need to add Cycles / Eevee material support at some
point.
* The mesh noise operator was removed since it only worked with BI
material texture slots. A displacement modifier can be used instead.
* The delete texture paint slot operator was removed since it only worked
for BI material texture slots. Could be added back with node support.
* Not all legacy viewport features are supported in the new viewport, but
their code was removed. If we need to bring anything back we can look at
older git revisions.
* There is some legacy viewport code that I could not remove yet, and some
that I probably missed.
* Shader node execution code was left mostly intact, even though it is not
used anywhere now. We may eventually use this to replace the texture
nodes with Cycles / Eevee shader nodes.
* The Cycles Bake panel now includes settings for baking multires normal
and displacement maps. The underlying code needs to be merged properly,
and we plan to add back support for multires AO baking and add support
to Cycles baking for features like vertex color, displacement, and other
missing baking features.
* This commit removes DNA and the Python API for BI material, lamp, world
and scene settings. This breaks a lot of addons.
* There is more DNA that can be removed or renamed, where Cycles or Eevee
are reusing some old BI properties but the names are not really correct
anymore.
* Texture slots for materials, lamps and world were removed. They remain
for brushes, particles and freestyle linestyles.
* 'BLENDER_RENDER' remains in the COMPAT_ENGINES of UI panels. Cycles and
other renderers use this to find all panels to show, minus a few panels
that they have their own replacement for.
2018-04-19 17:34:44 +02:00
|
|
|
struct PBVH;
|
2020-04-03 08:29:09 -06:00
|
|
|
struct SubdivCCG;
|
2015-07-14 16:48:23 +02:00
|
|
|
|
2018-09-27 15:54:10 +02:00
|
|
|
/* Buffers for drawing from PBVH grids. */
|
2014-01-02 22:22:36 +02:00
|
|
|
typedef struct GPU_PBVH_Buffers GPU_PBVH_Buffers;
|
2012-02-22 22:48:34 +00:00
|
|
|
|
2019-09-27 22:42:57 +02:00
|
|
|
/* Build must be called once before using the other functions, used every time
|
|
|
|
* mesh topology changes. Threaded. */
|
2020-05-14 15:27:11 +02:00
|
|
|
GPU_PBVH_Buffers *GPU_pbvh_mesh_buffers_build(const struct MPoly *mpoly,
|
2015-07-17 03:36:03 +10:00
|
|
|
const struct MLoop *mloop,
|
|
|
|
const struct MLoopTri *looptri,
|
2020-09-04 20:59:13 +02:00
|
|
|
const struct MVert *mvert,
|
2015-07-17 03:36:03 +10:00
|
|
|
const int *face_indices,
|
2020-09-04 20:59:13 +02:00
|
|
|
const int *sculpt_face_sets,
|
2019-10-09 19:03:57 +02:00
|
|
|
const int face_indices_len,
|
|
|
|
const struct Mesh *mesh);
|
2012-02-22 22:48:34 +00:00
|
|
|
|
2017-05-11 22:03:50 +10:00
|
|
|
GPU_PBVH_Buffers *GPU_pbvh_grid_buffers_build(int totgrid, unsigned int **grid_hidden);
|
2012-02-22 22:48:34 +00:00
|
|
|
|
2017-05-11 22:03:50 +10:00
|
|
|
GPU_PBVH_Buffers *GPU_pbvh_bmesh_buffers_build(bool smooth_shading);
|
2012-12-30 18:24:54 +00:00
|
|
|
|
2019-09-27 22:42:57 +02:00
|
|
|
/* Free part of data for update. Not thread safe, must run in OpenGL main thread. */
|
|
|
|
void GPU_pbvh_bmesh_buffers_update_free(GPU_PBVH_Buffers *buffers);
|
|
|
|
void GPU_pbvh_grid_buffers_update_free(GPU_PBVH_Buffers *buffers,
|
|
|
|
const struct DMFlagMat *grid_flag_mats,
|
2020-07-13 11:27:09 +02:00
|
|
|
const int *grid_indices);
|
2014-05-05 21:13:27 +03:00
|
|
|
|
2019-09-27 22:42:57 +02:00
|
|
|
/* Update mesh buffers without topology changes. Threaded. */
|
2018-01-12 17:35:26 +01:00
|
|
|
enum {
|
2018-01-15 11:38:56 +01:00
|
|
|
GPU_PBVH_BUFFERS_SHOW_MASK = (1 << 1),
|
2020-03-05 14:53:23 +01:00
|
|
|
GPU_PBVH_BUFFERS_SHOW_VCOL = (1 << 2),
|
|
|
|
GPU_PBVH_BUFFERS_SHOW_SCULPT_FACE_SETS = (1 << 3),
|
2018-01-12 17:35:26 +01:00
|
|
|
};
|
|
|
|
|
2017-05-11 22:03:50 +10:00
|
|
|
void GPU_pbvh_mesh_buffers_update(GPU_PBVH_Buffers *buffers,
|
2015-07-16 16:22:28 +02:00
|
|
|
const struct MVert *mvert,
|
2015-07-11 03:25:28 +10:00
|
|
|
const float *vmask,
|
2019-04-16 14:00:16 +02:00
|
|
|
const struct MLoopCol *vcol,
|
2020-03-05 14:53:23 +01:00
|
|
|
const int *sculpt_face_sets,
|
|
|
|
const int face_sets_color_seed,
|
2020-03-09 20:10:56 +01:00
|
|
|
const int face_sets_color_default,
|
Sculpt Vertex Colors: Initial implementation
Sculpt Vertex Colors is a painting system that runs inside sculpt mode, reusing all its tools and optimizations. This provides much better performance, easier to maintain code and more advanced features (new brush engine, filters, symmetry options, masks and face sets compatibility...). This is also the initial step for future features like vertex painting in Multires and brushes that can sculpt and paint at the same time.
This commit includes:
- SCULPT_UNDO_COLOR for undo support in sculpt mode
- SCULPT_UPDATE_COLOR and PBVH flags and rendering
- Sculpt Color API functions
- Sculpt capability for sculpt tools (only enabled in the Paint Brush for now)
- Rendering support in workbench (default to Sculpt Vertex Colors except in Vertex Paint)
- Conversion operator between MPropCol (Sculpt Vertex Colors) and MLoopCol (Vertex Paint)
- Remesher reprojection in the Voxel Remehser
- Paint Brush and Smear Brush with color smoothing in alt-smooth mode
- Parameters for the new brush engine (density, opacity, flow, wet paint mixing, tip scale) implemented in Sculpt Vertex Colors
- Color Filter
- Color picker (uses S shortcut, replaces smooth)
- Color selector in the top bar
Reviewed By: brecht
Maniphest Tasks: T72866
Differential Revision: https://developer.blender.org/D5975
2020-06-22 20:05:28 +02:00
|
|
|
const struct MPropCol *vtcol,
|
2018-01-12 17:35:26 +01:00
|
|
|
const int update_flags);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-05-11 22:03:50 +10:00
|
|
|
void GPU_pbvh_bmesh_buffers_update(GPU_PBVH_Buffers *buffers,
|
|
|
|
struct BMesh *bm,
|
|
|
|
struct GSet *bm_faces,
|
|
|
|
struct GSet *bm_unique_verts,
|
|
|
|
struct GSet *bm_other_verts,
|
2018-01-12 17:35:26 +01:00
|
|
|
const int update_flags);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-05-11 22:03:50 +10:00
|
|
|
void GPU_pbvh_grid_buffers_update(GPU_PBVH_Buffers *buffers,
|
2020-04-01 01:03:20 +02:00
|
|
|
struct SubdivCCG *subdiv_ccg,
|
2017-05-11 22:03:50 +10:00
|
|
|
struct CCGElem **grids,
|
|
|
|
const struct DMFlagMat *grid_flag_mats,
|
|
|
|
int *grid_indices,
|
|
|
|
int totgrid,
|
2020-04-01 01:03:20 +02:00
|
|
|
const int *sculpt_face_sets,
|
|
|
|
const int face_sets_color_seed,
|
|
|
|
const int face_sets_color_default,
|
2017-05-11 22:03:50 +10:00
|
|
|
const struct CCGKey *key,
|
2018-01-12 17:35:26 +01:00
|
|
|
const int update_flags);
|
2012-02-22 22:48:34 +00:00
|
|
|
|
2019-09-27 22:42:57 +02:00
|
|
|
/* Finish update. Not thread safe, must run in OpenGL main thread. */
|
|
|
|
void GPU_pbvh_buffers_update_flush(GPU_PBVH_Buffers *buffers);
|
|
|
|
|
|
|
|
/* Free buffers. Not thread safe, must run in OpenGL main thread. */
|
|
|
|
void GPU_pbvh_buffers_free(GPU_PBVH_Buffers *buffers);
|
|
|
|
|
2014-05-05 21:13:27 +03:00
|
|
|
/* draw */
|
2019-02-14 20:24:13 +01:00
|
|
|
struct GPUBatch *GPU_pbvh_buffers_batch_get(GPU_PBVH_Buffers *buffers, bool fast, bool wires);
|
2012-02-22 22:48:34 +00:00
|
|
|
|
2019-05-04 00:46:26 +02:00
|
|
|
short GPU_pbvh_buffers_material_index_get(GPU_PBVH_Buffers *buffers);
|
|
|
|
|
2020-03-21 18:09:43 +01:00
|
|
|
bool GPU_pbvh_buffers_has_overlays(GPU_PBVH_Buffers *buffers);
|
2018-08-24 16:46:42 +02:00
|
|
|
|
2020-03-02 15:28:47 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|