2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2008-12-19 12:14:58 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 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.
|
2008-12-19 12:14:58 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s): Blender Foundation, full recode and added functions
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
2011-02-27 20:29:51 +00:00
|
|
|
/** \file blender/editors/space_view3d/drawobject.c
|
|
|
|
* \ingroup spview3d
|
|
|
|
*/
|
|
|
|
|
2008-12-19 12:14:58 +00:00
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
|
|
#include "DNA_camera_types.h"
|
|
|
|
#include "DNA_curve_types.h"
|
2012-07-08 20:36:00 +00:00
|
|
|
#include "DNA_constraint_types.h" /* for drawing constraint */
|
2008-12-19 12:14:58 +00:00
|
|
|
#include "DNA_lamp_types.h"
|
|
|
|
#include "DNA_lattice_types.h"
|
|
|
|
#include "DNA_material_types.h"
|
2012-02-19 22:17:30 +00:00
|
|
|
#include "DNA_mesh_types.h"
|
2008-12-19 12:14:58 +00:00
|
|
|
#include "DNA_meta_types.h"
|
2013-03-31 19:52:37 +00:00
|
|
|
#include "DNA_rigidbody_types.h"
|
2008-12-19 12:14:58 +00:00
|
|
|
#include "DNA_scene_types.h"
|
2009-07-30 15:00:26 +00:00
|
|
|
#include "DNA_smoke_types.h"
|
2008-12-19 12:14:58 +00:00
|
|
|
#include "DNA_world_types.h"
|
2012-04-30 08:24:44 +00:00
|
|
|
#include "DNA_object_types.h"
|
2008-12-19 12:14:58 +00:00
|
|
|
|
2014-04-17 15:14:07 +10:00
|
|
|
#include "BLI_listbase.h"
|
|
|
|
#include "BLI_link_utils.h"
|
|
|
|
#include "BLI_string.h"
|
2009-11-10 20:43:45 +00:00
|
|
|
#include "BLI_math.h"
|
2014-04-17 15:14:07 +10:00
|
|
|
#include "BLI_memarena.h"
|
2008-12-19 12:14:58 +00:00
|
|
|
|
2012-07-08 20:36:00 +00:00
|
|
|
#include "BKE_anim.h" /* for the where_on_path function */
|
2012-03-22 13:27:24 +00:00
|
|
|
#include "BKE_armature.h"
|
2011-11-05 13:00:39 +00:00
|
|
|
#include "BKE_camera.h"
|
2015-03-25 20:08:12 +01:00
|
|
|
#include "BKE_colortools.h"
|
2012-07-08 20:36:00 +00:00
|
|
|
#include "BKE_constraint.h" /* for the get_constraint_target function */
|
2017-07-21 11:53:13 +02:00
|
|
|
#include "BKE_context.h"
|
2011-09-14 00:37:27 +00:00
|
|
|
#include "BKE_curve.h"
|
2008-12-19 12:14:58 +00:00
|
|
|
#include "BKE_DerivedMesh.h"
|
|
|
|
#include "BKE_deform.h"
|
|
|
|
#include "BKE_displist.h"
|
|
|
|
#include "BKE_font.h"
|
|
|
|
#include "BKE_global.h"
|
|
|
|
#include "BKE_image.h"
|
|
|
|
#include "BKE_key.h"
|
2017-05-04 09:47:17 +02:00
|
|
|
#include "BKE_layer.h"
|
2008-12-19 12:14:58 +00:00
|
|
|
#include "BKE_lattice.h"
|
2013-12-26 17:24:42 +06:00
|
|
|
#include "BKE_main.h"
|
2008-12-19 12:14:58 +00:00
|
|
|
#include "BKE_mesh.h"
|
2018-06-05 16:58:08 +02:00
|
|
|
#include "BKE_mesh_runtime.h"
|
2008-12-19 12:14:58 +00:00
|
|
|
#include "BKE_material.h"
|
|
|
|
#include "BKE_mball.h"
|
|
|
|
#include "BKE_modifier.h"
|
2014-02-26 19:40:04 +06:00
|
|
|
#include "BKE_movieclip.h"
|
2008-12-19 12:14:58 +00:00
|
|
|
#include "BKE_object.h"
|
2009-08-15 19:48:50 +00:00
|
|
|
#include "BKE_paint.h"
|
2016-12-28 17:30:58 +01:00
|
|
|
#include "BKE_particle.h"
|
|
|
|
#include "BKE_pointcache.h"
|
2011-11-06 06:08:18 +00:00
|
|
|
#include "BKE_scene.h"
|
2015-08-05 15:11:50 +02:00
|
|
|
#include "BKE_subsurf.h"
|
2009-08-16 11:16:04 +00:00
|
|
|
#include "BKE_unit.h"
|
2011-11-07 12:55:18 +00:00
|
|
|
#include "BKE_tracking.h"
|
2011-01-07 19:18:31 +00:00
|
|
|
|
2013-04-13 20:31:52 +00:00
|
|
|
#include "BKE_editmesh.h"
|
2008-12-19 12:14:58 +00:00
|
|
|
|
2017-07-21 11:53:13 +02:00
|
|
|
#include "DEG_depsgraph.h"
|
2018-04-06 12:07:27 +02:00
|
|
|
#include "DEG_depsgraph_query.h"
|
2017-07-21 11:53:13 +02:00
|
|
|
|
2011-05-09 16:31:54 +00:00
|
|
|
#include "IMB_imbuf.h"
|
|
|
|
#include "IMB_imbuf_types.h"
|
|
|
|
|
2008-12-19 12:14:58 +00:00
|
|
|
#include "BIF_gl.h"
|
|
|
|
#include "BIF_glutil.h"
|
|
|
|
|
|
|
|
#include "GPU_draw.h"
|
2014-07-23 15:24:07 +02:00
|
|
|
#include "GPU_select.h"
|
2015-12-05 22:11:31 +01:00
|
|
|
#include "GPU_basic_shader.h"
|
2015-12-06 21:20:19 +01:00
|
|
|
#include "GPU_shader.h"
|
2016-09-29 14:47:38 -04:00
|
|
|
#include "GPU_immediate.h"
|
2017-04-05 18:30:14 +10:00
|
|
|
#include "GPU_immediate_util.h"
|
2016-10-25 05:31:25 -04:00
|
|
|
#include "GPU_batch.h"
|
2016-10-18 20:57:36 -04:00
|
|
|
#include "GPU_matrix.h"
|
2018-06-27 19:07:23 -06:00
|
|
|
#include "GPU_state.h"
|
|
|
|
#include "GPU_framebuffer.h"
|
2008-12-19 12:14:58 +00:00
|
|
|
|
2008-12-30 13:16:14 +00:00
|
|
|
#include "ED_mesh.h"
|
2016-12-28 17:30:58 +01:00
|
|
|
#include "ED_particle.h"
|
2009-05-18 16:42:34 +00:00
|
|
|
#include "ED_screen.h"
|
2009-10-27 19:53:34 +00:00
|
|
|
#include "ED_sculpt.h"
|
2008-12-19 12:14:58 +00:00
|
|
|
#include "ED_types.h"
|
|
|
|
|
|
|
|
#include "UI_resources.h"
|
2013-01-22 11:18:41 +00:00
|
|
|
#include "UI_interface_icons.h"
|
2008-12-19 12:14:58 +00:00
|
|
|
|
|
|
|
#include "WM_api.h"
|
2009-05-05 23:10:32 +00:00
|
|
|
#include "BLF_api.h"
|
2008-12-19 12:14:58 +00:00
|
|
|
|
2012-10-10 03:13:02 +00:00
|
|
|
#include "view3d_intern.h" /* bad level include */
|
2008-12-19 12:14:58 +00:00
|
|
|
|
2017-04-21 21:14:11 +10:00
|
|
|
#include "../../draw/intern/draw_cache_impl.h" /* bad level include (temporary) */
|
|
|
|
|
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
|
|
|
int view3d_effective_drawtype(const struct View3D *v3d)
|
|
|
|
{
|
|
|
|
if (v3d->drawtype == OB_RENDER) {
|
|
|
|
return v3d->prev_drawtype;
|
2008-12-19 12:14:58 +00:00
|
|
|
}
|
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
|
|
|
return v3d->drawtype;
|
|
|
|
}
|
2008-12-19 12:14:58 +00:00
|
|
|
|
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
|
|
|
static bool check_ob_drawface_dot(Scene *sce, View3D *vd, char dt)
|
|
|
|
{
|
|
|
|
if ((sce->toolsettings->selectmode & SCE_SELECT_FACE) == 0)
|
|
|
|
return false;
|
2011-12-15 20:38:23 +00:00
|
|
|
|
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
|
|
|
if (G.f & G_BACKBUFSEL)
|
|
|
|
return false;
|
2011-12-15 20:38:23 +00:00
|
|
|
|
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
|
|
|
if ((vd->flag & V3D_ZBUF_SELECT) == 0)
|
|
|
|
return true;
|
2011-12-15 20:38:23 +00:00
|
|
|
|
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
|
|
|
/* if its drawing textures with zbuf sel, then don't draw dots */
|
|
|
|
if (dt == OB_TEXTURE && vd->drawtype == OB_TEXTURE)
|
|
|
|
return false;
|
2011-12-15 20:38:23 +00:00
|
|
|
|
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
|
|
|
if ((vd->drawtype >= OB_SOLID) && (vd->flag2 & V3D_SOLID_TEX))
|
|
|
|
return false;
|
2013-08-03 22:03:15 +00:00
|
|
|
|
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
|
|
|
return true;
|
|
|
|
}
|
2013-08-03 22:03:15 +00:00
|
|
|
|
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
|
|
|
/* ----------------- OpenGL Circle Drawing - Tables for Optimized Drawing Speed ------------------ */
|
|
|
|
/* 32 values of sin function (still same result!) */
|
|
|
|
#define CIRCLE_RESOL 32
|
2013-08-03 22:03:15 +00:00
|
|
|
|
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
|
|
|
static const float sinval[CIRCLE_RESOL] = {
|
|
|
|
0.00000000,
|
|
|
|
0.20129852,
|
|
|
|
0.39435585,
|
|
|
|
0.57126821,
|
|
|
|
0.72479278,
|
|
|
|
0.84864425,
|
|
|
|
0.93775213,
|
|
|
|
0.98846832,
|
|
|
|
0.99871650,
|
|
|
|
0.96807711,
|
|
|
|
0.89780453,
|
|
|
|
0.79077573,
|
|
|
|
0.65137248,
|
|
|
|
0.48530196,
|
|
|
|
0.29936312,
|
|
|
|
0.10116832,
|
|
|
|
-0.10116832,
|
|
|
|
-0.29936312,
|
|
|
|
-0.48530196,
|
|
|
|
-0.65137248,
|
|
|
|
-0.79077573,
|
|
|
|
-0.89780453,
|
|
|
|
-0.96807711,
|
|
|
|
-0.99871650,
|
|
|
|
-0.98846832,
|
|
|
|
-0.93775213,
|
|
|
|
-0.84864425,
|
|
|
|
-0.72479278,
|
|
|
|
-0.57126821,
|
|
|
|
-0.39435585,
|
|
|
|
-0.20129852,
|
|
|
|
0.00000000
|
|
|
|
};
|
2013-08-03 22:03:15 +00:00
|
|
|
|
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
|
|
|
/* 32 values of cos function (still same result!) */
|
|
|
|
static const float cosval[CIRCLE_RESOL] = {
|
|
|
|
1.00000000,
|
|
|
|
0.97952994,
|
|
|
|
0.91895781,
|
|
|
|
0.82076344,
|
|
|
|
0.68896691,
|
|
|
|
0.52896401,
|
|
|
|
0.34730525,
|
|
|
|
0.15142777,
|
|
|
|
-0.05064916,
|
|
|
|
-0.25065253,
|
|
|
|
-0.44039415,
|
|
|
|
-0.61210598,
|
|
|
|
-0.75875812,
|
|
|
|
-0.87434661,
|
|
|
|
-0.95413925,
|
|
|
|
-0.99486932,
|
|
|
|
-0.99486932,
|
|
|
|
-0.95413925,
|
|
|
|
-0.87434661,
|
|
|
|
-0.75875812,
|
|
|
|
-0.61210598,
|
|
|
|
-0.44039415,
|
|
|
|
-0.25065253,
|
|
|
|
-0.05064916,
|
|
|
|
0.15142777,
|
|
|
|
0.34730525,
|
|
|
|
0.52896401,
|
|
|
|
0.68896691,
|
|
|
|
0.82076344,
|
|
|
|
0.91895781,
|
|
|
|
0.97952994,
|
|
|
|
1.00000000
|
|
|
|
};
|
2013-08-03 22:03:15 +00:00
|
|
|
|
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
|
|
|
static void circball_array_fill(float verts[CIRCLE_RESOL][3], const float cent[3], float rad, const float tmat[4][4])
|
|
|
|
{
|
|
|
|
float vx[3], vy[3];
|
|
|
|
float *viter = (float *)verts;
|
2017-03-06 16:21:59 +01:00
|
|
|
|
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
|
|
|
mul_v3_v3fl(vx, tmat[0], rad);
|
|
|
|
mul_v3_v3fl(vy, tmat[1], rad);
|
2017-03-06 16:21:59 +01:00
|
|
|
|
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
|
|
|
for (unsigned int a = 0; a < CIRCLE_RESOL; a++, viter += 3) {
|
|
|
|
viter[0] = cent[0] + sinval[a] * vx[0] + cosval[a] * vy[0];
|
|
|
|
viter[1] = cent[1] + sinval[a] * vx[1] + cosval[a] * vy[1];
|
|
|
|
viter[2] = cent[2] + sinval[a] * vx[2] + cosval[a] * vy[2];
|
2008-12-19 12:14:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
void imm_drawcircball(const float cent[3], float rad, const float tmat[4][4], unsigned pos)
|
2017-03-10 03:15:58 +11:00
|
|
|
{
|
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
|
|
|
float verts[CIRCLE_RESOL][3];
|
2017-03-10 03:15:58 +11:00
|
|
|
|
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
|
|
|
circball_array_fill(verts, cent, rad, tmat);
|
2017-03-10 03:15:58 +11:00
|
|
|
|
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
|
|
|
immBegin(GWN_PRIM_LINE_LOOP, CIRCLE_RESOL);
|
|
|
|
for (int i = 0; i < CIRCLE_RESOL; ++i) {
|
|
|
|
immVertex3fv(pos, verts[i]);
|
2017-03-10 03:15:58 +11:00
|
|
|
}
|
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
|
|
|
immEnd();
|
2017-03-10 03:15:58 +11:00
|
|
|
}
|
|
|
|
|
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
|
|
|
#ifdef VIEW3D_CAMERA_BORDER_HACK
|
|
|
|
unsigned char view3d_camera_border_hack_col[3];
|
|
|
|
bool view3d_camera_border_hack_test = false;
|
|
|
|
#endif
|
|
|
|
|
2008-12-19 12:14:58 +00:00
|
|
|
/* ***************** BACKBUF SEL (BBS) ********* */
|
2011-09-18 17:10:28 +00:00
|
|
|
|
2017-08-17 07:13:02 +10:00
|
|
|
#ifdef USE_MESH_DM_SELECT
|
2012-04-09 07:06:06 +00:00
|
|
|
static void bbs_obmode_mesh_verts__mapFunc(void *userData, int index, const float co[3],
|
|
|
|
const float UNUSED(no_f[3]), const short UNUSED(no_s[3]))
|
2011-08-09 16:32:15 +00:00
|
|
|
{
|
2014-06-19 18:36:49 +10:00
|
|
|
drawMVertOffset_userData *data = userData;
|
2011-09-19 02:43:03 +00:00
|
|
|
MVert *mv = &data->mvert[index];
|
2011-08-09 16:32:15 +00:00
|
|
|
|
2011-09-18 01:09:18 +00:00
|
|
|
if (!(mv->flag & ME_HIDE)) {
|
2017-03-07 18:10:43 +01:00
|
|
|
int selcol;
|
|
|
|
GPU_select_index_get(data->offset + index, &selcol);
|
2017-05-18 22:33:34 +10:00
|
|
|
immAttrib1u(data->col, selcol);
|
2017-03-07 18:10:43 +01:00
|
|
|
immVertex3fv(data->pos, co);
|
2011-09-18 01:09:18 +00:00
|
|
|
}
|
2011-08-09 16:32:15 +00:00
|
|
|
}
|
2011-09-18 17:10:28 +00:00
|
|
|
|
2011-09-18 01:09:18 +00:00
|
|
|
static void bbs_obmode_mesh_verts(Object *ob, DerivedMesh *dm, int offset)
|
2011-08-09 16:32:15 +00:00
|
|
|
{
|
2014-06-19 18:36:49 +10:00
|
|
|
drawMVertOffset_userData data;
|
2011-09-18 01:09:18 +00:00
|
|
|
Mesh *me = ob->data;
|
|
|
|
MVert *mvert = me->mvert;
|
|
|
|
data.mvert = mvert;
|
2014-06-19 18:36:49 +10:00
|
|
|
data.offset = offset;
|
2017-03-07 18:10:43 +01:00
|
|
|
|
2017-05-05 10:36:09 +10:00
|
|
|
const int imm_len = dm->getNumVerts(dm);
|
2017-03-08 15:02:41 +01:00
|
|
|
|
2017-05-05 10:36:09 +10:00
|
|
|
if (imm_len == 0) return;
|
2017-03-08 15:02:41 +01:00
|
|
|
|
2017-06-19 20:18:04 +10:00
|
|
|
Gwn_VertFormat *format = immVertexFormat();
|
|
|
|
data.pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
|
|
|
|
data.col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U32, 1, GWN_FETCH_INT);
|
2017-03-07 18:10:43 +01:00
|
|
|
|
2017-05-17 13:31:01 +10:00
|
|
|
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32);
|
2017-03-07 18:10:43 +01:00
|
|
|
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_point_size(UI_GetThemeValuef(TH_VERTEX_SIZE));
|
2017-03-07 18:10:43 +01:00
|
|
|
|
2017-06-19 20:18:04 +10:00
|
|
|
immBeginAtMost(GWN_PRIM_POINTS, imm_len);
|
2013-07-22 22:59:47 +00:00
|
|
|
dm->foreachMappedVert(dm, bbs_obmode_mesh_verts__mapFunc, &data, DM_FOREACH_NOP);
|
2017-03-07 18:10:43 +01:00
|
|
|
immEnd();
|
|
|
|
|
|
|
|
immUnbindProgram();
|
2011-08-09 16:32:15 +00:00
|
|
|
}
|
2017-08-17 07:13:02 +10:00
|
|
|
#else
|
|
|
|
static void bbs_obmode_mesh_verts(Object *ob, DerivedMesh *UNUSED(dm), int offset)
|
|
|
|
{
|
|
|
|
Mesh *me = ob->data;
|
|
|
|
Gwn_Batch *batch = DRW_mesh_batch_cache_get_verts_with_select_id(me, offset);
|
|
|
|
GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32);
|
|
|
|
GWN_batch_draw(batch);
|
|
|
|
}
|
|
|
|
#endif
|
2008-12-19 12:14:58 +00:00
|
|
|
|
2017-08-17 01:38:07 +10:00
|
|
|
#ifdef USE_MESH_DM_SELECT
|
2012-04-09 07:06:06 +00:00
|
|
|
static void bbs_mesh_verts__mapFunc(void *userData, int index, const float co[3],
|
|
|
|
const float UNUSED(no_f[3]), const short UNUSED(no_s[3]))
|
2008-12-19 12:14:58 +00:00
|
|
|
{
|
2014-06-19 18:36:49 +10:00
|
|
|
drawBMOffset_userData *data = userData;
|
|
|
|
BMVert *eve = BM_vert_at_index(data->bm, index);
|
2008-12-19 12:14:58 +00:00
|
|
|
|
2012-02-12 10:51:45 +00:00
|
|
|
if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
|
2017-03-07 18:10:43 +01:00
|
|
|
int selcol;
|
|
|
|
GPU_select_index_get(data->offset + index, &selcol);
|
2017-05-18 22:33:34 +10:00
|
|
|
immAttrib1u(data->col, selcol);
|
2017-03-07 18:10:43 +01:00
|
|
|
immVertex3fv(data->pos, co);
|
2008-12-19 12:14:58 +00:00
|
|
|
}
|
|
|
|
}
|
2009-05-18 08:46:04 +00:00
|
|
|
static void bbs_mesh_verts(BMEditMesh *em, DerivedMesh *dm, int offset)
|
2008-12-19 12:14:58 +00:00
|
|
|
{
|
2017-03-07 18:10:43 +01:00
|
|
|
drawBMOffset_userData data;
|
|
|
|
data.bm = em->bm;
|
|
|
|
data.offset = offset;
|
2017-06-19 20:18:04 +10:00
|
|
|
Gwn_VertFormat *format = immVertexFormat();
|
|
|
|
data.pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
|
|
|
|
data.col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U32, 1, GWN_FETCH_INT);
|
2017-03-07 18:10:43 +01:00
|
|
|
|
2017-05-17 13:31:01 +10:00
|
|
|
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32);
|
2017-03-07 18:10:43 +01:00
|
|
|
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_point_size(UI_GetThemeValuef(TH_VERTEX_SIZE));
|
2017-03-07 18:10:43 +01:00
|
|
|
|
2017-06-19 20:18:04 +10:00
|
|
|
immBeginAtMost(GWN_PRIM_POINTS, em->bm->totvert);
|
2014-06-19 18:36:49 +10:00
|
|
|
dm->foreachMappedVert(dm, bbs_mesh_verts__mapFunc, &data, DM_FOREACH_NOP);
|
2017-03-07 18:10:43 +01:00
|
|
|
immEnd();
|
|
|
|
|
|
|
|
immUnbindProgram();
|
2012-10-11 03:25:19 +00:00
|
|
|
}
|
2017-08-17 01:38:07 +10:00
|
|
|
#else
|
|
|
|
static void bbs_mesh_verts(BMEditMesh *em, DerivedMesh *UNUSED(dm), int offset)
|
|
|
|
{
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_point_size(UI_GetThemeValuef(TH_VERTEX_SIZE));
|
2017-12-04 12:32:45 -02:00
|
|
|
|
2017-08-17 01:38:07 +10:00
|
|
|
Mesh *me = em->ob->data;
|
|
|
|
Gwn_Batch *batch = DRW_mesh_batch_cache_get_verts_with_select_id(me, offset);
|
|
|
|
GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32);
|
|
|
|
GWN_batch_draw(batch);
|
|
|
|
}
|
|
|
|
#endif
|
2008-12-19 12:14:58 +00:00
|
|
|
|
2017-08-17 01:38:07 +10:00
|
|
|
#ifdef USE_MESH_DM_SELECT
|
2017-05-05 10:36:09 +10:00
|
|
|
static void bbs_mesh_wire__mapFunc(void *userData, int index, const float v0co[3], const float v1co[3])
|
|
|
|
{
|
|
|
|
drawBMOffset_userData *data = userData;
|
|
|
|
BMEdge *eed = BM_edge_at_index(data->bm, index);
|
|
|
|
|
|
|
|
if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
|
|
|
|
int selcol;
|
|
|
|
GPU_select_index_get(data->offset + index, &selcol);
|
2017-05-18 22:33:34 +10:00
|
|
|
immAttrib1u(data->col, selcol);
|
2017-05-05 10:36:09 +10:00
|
|
|
immVertex3fv(data->pos, v0co);
|
|
|
|
immVertex3fv(data->pos, v1co);
|
|
|
|
}
|
|
|
|
}
|
2017-05-19 14:15:49 +02:00
|
|
|
|
2009-05-18 08:46:04 +00:00
|
|
|
static void bbs_mesh_wire(BMEditMesh *em, DerivedMesh *dm, int offset)
|
2008-12-19 12:14:58 +00:00
|
|
|
{
|
2017-03-07 18:10:43 +01:00
|
|
|
drawBMOffset_userData data;
|
|
|
|
data.bm = em->bm;
|
|
|
|
data.offset = offset;
|
|
|
|
|
2017-06-19 20:18:04 +10:00
|
|
|
Gwn_VertFormat *format = immVertexFormat();
|
2017-05-05 10:36:09 +10:00
|
|
|
|
|
|
|
const int imm_len = dm->getNumEdges(dm) * 2;
|
|
|
|
|
|
|
|
if (imm_len == 0) return;
|
|
|
|
|
2017-06-19 20:18:04 +10:00
|
|
|
data.pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
|
|
|
|
data.col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U32, 1, GWN_FETCH_INT);
|
2017-05-05 10:36:09 +10:00
|
|
|
|
2017-05-17 13:31:01 +10:00
|
|
|
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32);
|
2017-05-05 10:36:09 +10:00
|
|
|
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_line_width(1.0f);
|
2017-05-05 10:36:09 +10:00
|
|
|
|
2017-06-19 20:18:04 +10:00
|
|
|
immBeginAtMost(GWN_PRIM_LINES, imm_len);
|
2017-05-05 10:36:09 +10:00
|
|
|
dm->foreachMappedEdge(dm, bbs_mesh_wire__mapFunc, &data);
|
|
|
|
immEnd();
|
|
|
|
|
|
|
|
immUnbindProgram();
|
2012-10-11 03:25:19 +00:00
|
|
|
}
|
2017-08-17 01:38:07 +10:00
|
|
|
#else
|
|
|
|
static void bbs_mesh_wire(BMEditMesh *em, DerivedMesh *UNUSED(dm), int offset)
|
|
|
|
{
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_line_width(1.0f);
|
2017-12-04 15:30:56 -02:00
|
|
|
|
2017-08-17 01:38:07 +10:00
|
|
|
Mesh *me = em->ob->data;
|
|
|
|
Gwn_Batch *batch = DRW_mesh_batch_cache_get_edges_with_select_id(me, offset);
|
|
|
|
GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32);
|
|
|
|
GWN_batch_draw(batch);
|
|
|
|
}
|
|
|
|
#endif
|
2008-12-19 12:14:58 +00:00
|
|
|
|
2017-08-17 01:38:07 +10:00
|
|
|
#ifdef USE_MESH_DM_SELECT
|
2017-05-05 10:36:09 +10:00
|
|
|
static void bbs_mesh_face(BMEditMesh *em, DerivedMesh *dm, const bool use_select)
|
|
|
|
{
|
|
|
|
UNUSED_VARS(dm);
|
|
|
|
|
|
|
|
drawBMOffset_userData data;
|
|
|
|
data.bm = em->bm;
|
|
|
|
|
|
|
|
const int tri_len = em->tottri;
|
|
|
|
const int imm_len = tri_len * 3;
|
2017-05-17 13:26:09 +10:00
|
|
|
const char hflag_skip = use_select ? BM_ELEM_HIDDEN : (BM_ELEM_HIDDEN | BM_ELEM_SELECT);
|
2017-05-05 10:36:09 +10:00
|
|
|
|
|
|
|
if (imm_len == 0) return;
|
|
|
|
|
2017-06-19 20:18:04 +10:00
|
|
|
Gwn_VertFormat *format = immVertexFormat();
|
|
|
|
data.pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
|
|
|
|
data.col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U32, 1, GWN_FETCH_INT);
|
2017-05-05 10:36:09 +10:00
|
|
|
|
2017-05-17 13:31:01 +10:00
|
|
|
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32);
|
2017-05-05 10:36:09 +10:00
|
|
|
|
2017-06-19 20:18:04 +10:00
|
|
|
immBeginAtMost(GWN_PRIM_TRIS, imm_len);
|
2017-05-05 10:36:09 +10:00
|
|
|
|
|
|
|
if (use_select == false) {
|
|
|
|
int selcol;
|
|
|
|
GPU_select_index_get(0, &selcol);
|
2017-05-18 22:33:34 +10:00
|
|
|
immAttrib1u(data.col, selcol);
|
2017-05-05 10:36:09 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
int index = 0;
|
|
|
|
while (index < tri_len) {
|
|
|
|
const BMFace *f = em->looptris[index][0]->f;
|
|
|
|
const int ntris = f->len - 2;
|
|
|
|
if (!BM_elem_flag_test(f, hflag_skip)) {
|
|
|
|
if (use_select) {
|
|
|
|
int selcol;
|
|
|
|
GPU_select_index_get(BM_elem_index_get(f) + 1, &selcol);
|
2017-05-18 22:33:34 +10:00
|
|
|
immAttrib1u(data.col, selcol);
|
2017-05-05 10:36:09 +10:00
|
|
|
}
|
|
|
|
for (int t = 0; t < ntris; t++) {
|
|
|
|
immVertex3fv(data.pos, em->looptris[index][0]->v->co);
|
|
|
|
immVertex3fv(data.pos, em->looptris[index][1]->v->co);
|
|
|
|
immVertex3fv(data.pos, em->looptris[index][2]->v->co);
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
index += ntris;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
immEnd();
|
|
|
|
|
|
|
|
immUnbindProgram();
|
|
|
|
}
|
2017-08-17 01:38:07 +10:00
|
|
|
#else
|
|
|
|
static void bbs_mesh_face(BMEditMesh *em, DerivedMesh *UNUSED(dm), const bool use_select)
|
|
|
|
{
|
|
|
|
Mesh *me = em->ob->data;
|
|
|
|
Gwn_Batch *batch;
|
2008-12-19 12:14:58 +00:00
|
|
|
|
2017-08-17 01:38:07 +10:00
|
|
|
if (use_select) {
|
|
|
|
batch = DRW_mesh_batch_cache_get_triangles_with_select_id(me, true, 1);
|
|
|
|
GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32);
|
|
|
|
GWN_batch_draw(batch);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
int selcol;
|
|
|
|
GPU_select_index_get(0, &selcol);
|
|
|
|
batch = DRW_mesh_batch_cache_get_triangles_with_select_mask(me, true);
|
|
|
|
GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_UNIFORM_COLOR_U32);
|
2018-02-26 20:07:39 +01:00
|
|
|
GWN_batch_uniform_1ui(batch, "color", selcol);
|
2017-08-17 01:38:07 +10:00
|
|
|
GWN_batch_draw(batch);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef USE_MESH_DM_SELECT
|
2012-04-09 07:06:06 +00:00
|
|
|
static void bbs_mesh_solid__drawCenter(void *userData, int index, const float cent[3], const float UNUSED(no[3]))
|
2008-12-19 12:14:58 +00:00
|
|
|
{
|
2017-03-07 18:10:43 +01:00
|
|
|
drawBMOffset_userData *data = (drawBMOffset_userData *)userData;
|
2014-06-19 18:36:49 +10:00
|
|
|
BMFace *efa = BM_face_at_index(userData, index);
|
2008-12-19 12:14:58 +00:00
|
|
|
|
2012-02-12 10:51:45 +00:00
|
|
|
if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
|
2017-03-07 18:10:43 +01:00
|
|
|
int selcol;
|
|
|
|
GPU_select_index_get(index + 1, &selcol);
|
2017-05-18 22:33:34 +10:00
|
|
|
immAttrib1u(data->col, selcol);
|
2017-03-07 18:10:43 +01:00
|
|
|
immVertex3fv(data->pos, cent);
|
2008-12-19 12:14:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-05-05 10:36:09 +10:00
|
|
|
static void bbs_mesh_face_dot(BMEditMesh *em, DerivedMesh *dm)
|
|
|
|
{
|
|
|
|
drawBMOffset_userData data; /* don't use offset */
|
|
|
|
data.bm = em->bm;
|
2017-06-19 20:18:04 +10:00
|
|
|
Gwn_VertFormat *format = immVertexFormat();
|
|
|
|
data.pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
|
|
|
|
data.col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U32, 1, GWN_FETCH_INT);
|
2017-05-05 10:36:09 +10:00
|
|
|
|
2017-05-17 13:31:01 +10:00
|
|
|
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32);
|
2017-05-05 10:36:09 +10:00
|
|
|
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_point_size(UI_GetThemeValuef(TH_FACEDOT_SIZE));
|
2017-05-05 10:36:09 +10:00
|
|
|
|
2017-06-19 20:18:04 +10:00
|
|
|
immBeginAtMost(GWN_PRIM_POINTS, em->bm->totface);
|
2017-05-05 10:36:09 +10:00
|
|
|
dm->foreachMappedFaceCenter(dm, bbs_mesh_solid__drawCenter, &data, DM_FOREACH_NOP);
|
|
|
|
immEnd();
|
|
|
|
|
|
|
|
immUnbindProgram();
|
|
|
|
}
|
2017-08-17 01:38:07 +10:00
|
|
|
#else
|
|
|
|
static void bbs_mesh_face_dot(BMEditMesh *em, DerivedMesh *UNUSED(dm))
|
|
|
|
{
|
|
|
|
Mesh *me = em->ob->data;
|
|
|
|
Gwn_Batch *batch = DRW_mesh_batch_cache_get_facedots_with_select_id(me, 1);
|
|
|
|
GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32);
|
|
|
|
GWN_batch_draw(batch);
|
|
|
|
}
|
|
|
|
#endif
|
2017-05-05 10:36:09 +10:00
|
|
|
|
2008-12-19 12:14:58 +00:00
|
|
|
/* two options, facecolors or black */
|
2009-05-18 08:46:04 +00:00
|
|
|
static void bbs_mesh_solid_EM(BMEditMesh *em, Scene *scene, View3D *v3d,
|
2014-06-19 18:36:49 +10:00
|
|
|
Object *ob, DerivedMesh *dm, bool use_faceselect)
|
2008-12-19 12:14:58 +00:00
|
|
|
{
|
2014-06-19 18:36:49 +10:00
|
|
|
if (use_faceselect) {
|
2017-05-05 10:36:09 +10:00
|
|
|
bbs_mesh_face(em, dm, true);
|
2008-12-19 12:14:58 +00:00
|
|
|
|
2012-02-22 16:52:06 +00:00
|
|
|
if (check_ob_drawface_dot(scene, v3d, ob->dt)) {
|
2017-05-05 10:36:09 +10:00
|
|
|
bbs_mesh_face_dot(em, dm);
|
2008-12-19 12:14:58 +00:00
|
|
|
}
|
2012-02-22 16:52:06 +00:00
|
|
|
}
|
|
|
|
else {
|
2017-05-05 10:36:09 +10:00
|
|
|
bbs_mesh_face(em, dm, false);
|
2008-12-19 12:14:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-17 07:13:02 +10:00
|
|
|
#ifdef USE_MESH_DM_SELECT
|
2016-06-25 20:16:33 +10:00
|
|
|
/* must have called GPU_framebuffer_index_set beforehand */
|
2012-03-08 06:47:05 +00:00
|
|
|
static DMDrawOption bbs_mesh_solid_hide2__setDrawOpts(void *userData, int index)
|
2011-08-09 16:32:15 +00:00
|
|
|
{
|
|
|
|
Mesh *me = userData;
|
2008-12-19 12:14:58 +00:00
|
|
|
|
2012-02-05 03:25:13 +00:00
|
|
|
if (!(me->mpoly[index].flag & ME_HIDE)) {
|
2012-03-08 06:47:05 +00:00
|
|
|
return DM_DRAW_OPTION_NORMAL;
|
2012-02-22 16:52:06 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-03-08 06:47:05 +00:00
|
|
|
return DM_DRAW_OPTION_SKIP;
|
2011-08-09 16:32:15 +00:00
|
|
|
}
|
|
|
|
}
|
2012-12-23 08:20:44 +00:00
|
|
|
|
2018-04-06 12:07:27 +02:00
|
|
|
static void bbs_mesh_solid_verts(Depsgraph *depsgraph, Scene *scene, Object *ob)
|
2012-12-23 08:20:44 +00:00
|
|
|
{
|
|
|
|
Mesh *me = ob->data;
|
2018-04-06 12:07:27 +02:00
|
|
|
DerivedMesh *dm = mesh_get_derived_final(depsgraph, scene, ob, scene->customdata_mask);
|
2012-12-23 08:20:44 +00:00
|
|
|
|
2014-04-09 19:51:29 +03:00
|
|
|
DM_update_materials(dm, ob);
|
|
|
|
|
2017-07-11 14:05:59 +10:00
|
|
|
/* Only draw faces to mask out verts, we don't want their selection ID's. */
|
|
|
|
const int G_f_orig = G.f;
|
|
|
|
G.f &= ~G_BACKBUFSEL;
|
2012-12-23 08:20:44 +00:00
|
|
|
|
2017-07-11 14:05:59 +10:00
|
|
|
dm->drawMappedFaces(dm, bbs_mesh_solid_hide2__setDrawOpts, NULL, NULL, me, DM_DRAW_SKIP_HIDDEN);
|
|
|
|
|
|
|
|
G.f |= (G_f_orig & G_BACKBUFSEL);
|
2016-03-23 21:01:21 +11:00
|
|
|
|
2012-12-23 08:20:44 +00:00
|
|
|
bbs_obmode_mesh_verts(ob, dm, 1);
|
|
|
|
bm_vertoffs = me->totvert + 1;
|
|
|
|
dm->release(dm);
|
|
|
|
}
|
2017-08-17 07:13:02 +10:00
|
|
|
#else
|
2018-04-06 12:07:27 +02:00
|
|
|
static void bbs_mesh_solid_verts(Depsgraph *UNUSED(depsgraph), Scene *UNUSED(scene), Object *ob)
|
2017-08-17 07:13:02 +10:00
|
|
|
{
|
|
|
|
Mesh *me = ob->data;
|
|
|
|
|
|
|
|
/* Only draw faces to mask out verts, we don't want their selection ID's. */
|
|
|
|
const int G_f_orig = G.f;
|
|
|
|
G.f &= ~G_BACKBUFSEL;
|
|
|
|
|
|
|
|
{
|
|
|
|
int selcol;
|
|
|
|
Gwn_Batch *batch;
|
|
|
|
GPU_select_index_get(0, &selcol);
|
|
|
|
batch = DRW_mesh_batch_cache_get_triangles_with_select_mask(me, true);
|
|
|
|
GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_UNIFORM_COLOR_U32);
|
2018-02-26 20:07:39 +01:00
|
|
|
GWN_batch_uniform_1ui(batch, "color", selcol);
|
2017-08-17 07:13:02 +10:00
|
|
|
GWN_batch_draw(batch);
|
|
|
|
}
|
|
|
|
|
|
|
|
G.f |= (G_f_orig & G_BACKBUFSEL);
|
|
|
|
|
|
|
|
bbs_obmode_mesh_verts(ob, NULL, 1);
|
|
|
|
bm_vertoffs = me->totvert + 1;
|
|
|
|
}
|
|
|
|
#endif
|
2012-12-23 08:20:44 +00:00
|
|
|
|
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
|
|
|
static void bbs_mesh_solid_faces(Scene *UNUSED(scene), Object *ob)
|
2008-12-19 12:14:58 +00:00
|
|
|
{
|
2015-03-30 00:51:00 -04:00
|
|
|
Mesh *me = ob->data;
|
2017-06-19 20:18:04 +10:00
|
|
|
Gwn_Batch *batch;
|
2017-05-05 05:17:31 +10:00
|
|
|
if ((me->editflag & ME_EDIT_PAINT_FACE_SEL)) {
|
2017-08-17 01:38:07 +10:00
|
|
|
batch = DRW_mesh_batch_cache_get_triangles_with_select_id(me, true, 1);
|
2017-05-05 05:17:31 +10:00
|
|
|
}
|
|
|
|
else {
|
2017-08-17 01:38:07 +10:00
|
|
|
batch = DRW_mesh_batch_cache_get_triangles_with_select_id(me, false, 1);
|
2017-05-05 05:17:31 +10:00
|
|
|
}
|
2017-08-16 20:31:32 +10:00
|
|
|
GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32);
|
2017-06-19 20:18:04 +10:00
|
|
|
GWN_batch_draw(batch);
|
2008-12-19 12:14:58 +00:00
|
|
|
}
|
|
|
|
|
2017-08-16 12:45:11 +10:00
|
|
|
void draw_object_backbufsel(
|
2018-05-24 20:35:51 +02:00
|
|
|
Depsgraph *depsgraph, Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob,
|
|
|
|
short select_mode)
|
2008-12-19 12:14:58 +00:00
|
|
|
{
|
2012-03-25 23:54:33 +00:00
|
|
|
ToolSettings *ts = scene->toolsettings;
|
2018-05-24 20:35:51 +02:00
|
|
|
if (select_mode == -1) {
|
|
|
|
select_mode = ts->selectmode;
|
|
|
|
}
|
2008-12-19 12:14:58 +00:00
|
|
|
|
2018-07-15 15:27:15 +02:00
|
|
|
GPU_matrix_mul(ob->obmat);
|
2008-12-19 12:14:58 +00:00
|
|
|
|
2018-06-27 19:07:23 -06:00
|
|
|
glClearDepth(1.0); GPU_clear(GPU_DEPTH_BIT);
|
|
|
|
GPU_depth_test(true);
|
2008-12-19 12:14:58 +00:00
|
|
|
|
2012-03-25 23:54:33 +00:00
|
|
|
switch (ob->type) {
|
2012-03-18 06:01:33 +00:00
|
|
|
case OB_MESH:
|
2018-04-05 18:20:27 +02:00
|
|
|
if (ob->mode & OB_MODE_EDIT) {
|
2012-03-25 23:54:33 +00:00
|
|
|
Mesh *me = ob->data;
|
|
|
|
BMEditMesh *em = me->edit_btmesh;
|
2009-02-19 23:53:40 +00:00
|
|
|
|
2018-04-06 12:07:27 +02:00
|
|
|
DerivedMesh *dm = editbmesh_get_derived_cage(depsgraph, scene, ob, em, CD_MASK_BAREMESH);
|
2008-12-19 12:14:58 +00:00
|
|
|
|
2013-10-28 02:05:33 +00:00
|
|
|
BM_mesh_elem_table_ensure(em->bm, BM_VERT | BM_EDGE | BM_FACE);
|
2008-12-19 12:14:58 +00:00
|
|
|
|
2014-04-10 01:16:17 +03:00
|
|
|
DM_update_materials(dm, ob);
|
|
|
|
|
2018-05-24 20:35:51 +02:00
|
|
|
bbs_mesh_solid_EM(em, scene, v3d, ob, dm, (select_mode & SCE_SELECT_FACE) != 0);
|
|
|
|
if (select_mode & SCE_SELECT_FACE)
|
2012-03-25 23:54:33 +00:00
|
|
|
bm_solidoffs = 1 + em->bm->totface;
|
2017-12-08 12:42:00 -02:00
|
|
|
else {
|
2012-03-25 23:54:33 +00:00
|
|
|
bm_solidoffs = 1;
|
2017-12-08 12:42:00 -02:00
|
|
|
}
|
2008-12-19 12:14:58 +00:00
|
|
|
|
2013-12-09 20:59:29 +11:00
|
|
|
ED_view3d_polygon_offset(rv3d, 1.0);
|
2008-12-19 12:14:58 +00:00
|
|
|
|
2017-12-04 12:05:06 -02:00
|
|
|
/* we draw edges if edge select mode */
|
2018-05-24 20:35:51 +02:00
|
|
|
if (select_mode & SCE_SELECT_EDGE) {
|
2017-12-04 12:05:06 -02:00
|
|
|
bbs_mesh_wire(em, dm, bm_solidoffs);
|
|
|
|
bm_wireoffs = bm_solidoffs + em->bm->totedge;
|
|
|
|
}
|
2017-12-08 12:42:00 -02:00
|
|
|
else {
|
|
|
|
/* `bm_vertoffs` is calculated from `bm_wireoffs`. (otherwise see T53512) */
|
|
|
|
bm_wireoffs = bm_solidoffs;
|
|
|
|
}
|
2011-08-09 16:32:15 +00:00
|
|
|
|
2017-05-05 07:06:15 +10:00
|
|
|
/* we draw verts if vert select mode. */
|
2018-05-24 20:35:51 +02:00
|
|
|
if (select_mode & SCE_SELECT_VERTEX) {
|
2012-03-18 06:01:33 +00:00
|
|
|
bbs_mesh_verts(em, dm, bm_wireoffs);
|
2012-03-25 23:54:33 +00:00
|
|
|
bm_vertoffs = bm_wireoffs + em->bm->totvert;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
bm_vertoffs = bm_wireoffs;
|
2012-03-18 06:01:33 +00:00
|
|
|
}
|
|
|
|
|
2013-12-09 20:59:29 +11:00
|
|
|
ED_view3d_polygon_offset(rv3d, 0.0);
|
2011-08-09 16:32:15 +00:00
|
|
|
|
|
|
|
dm->release(dm);
|
|
|
|
}
|
2011-09-13 06:39:17 +00:00
|
|
|
else {
|
2012-03-25 23:54:33 +00:00
|
|
|
Mesh *me = ob->data;
|
2012-12-22 14:25:34 +00:00
|
|
|
if ((me->editflag & ME_EDIT_PAINT_VERT_SEL) &&
|
2017-09-29 17:10:15 +10:00
|
|
|
/* currently vertex select supports weight paint and vertex paint*/
|
2018-04-05 18:20:27 +02:00
|
|
|
((ob->mode & OB_MODE_WEIGHT_PAINT) || (ob->mode & OB_MODE_VERTEX_PAINT)))
|
2012-03-18 06:01:33 +00:00
|
|
|
{
|
2018-04-06 12:07:27 +02:00
|
|
|
bbs_mesh_solid_verts(depsgraph, scene, ob);
|
2012-03-18 06:01:33 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-12-23 08:20:44 +00:00
|
|
|
bbs_mesh_solid_faces(scene, ob);
|
2012-03-18 06:01:33 +00:00
|
|
|
}
|
2011-09-13 06:39:17 +00:00
|
|
|
}
|
2012-03-18 06:01:33 +00:00
|
|
|
break;
|
|
|
|
case OB_CURVE:
|
|
|
|
case OB_SURF:
|
|
|
|
break;
|
2008-12-19 12:14:58 +00:00
|
|
|
}
|
|
|
|
|
2018-07-15 15:27:15 +02:00
|
|
|
GPU_matrix_set(rv3d->viewmat);
|
2008-12-19 12:14:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-08-16 12:45:11 +10:00
|
|
|
void ED_draw_object_facemap(
|
2018-04-06 12:07:27 +02:00
|
|
|
Depsgraph *depsgraph, Scene *scene, Object *ob, const float col[4], const int facemap)
|
2017-06-10 10:42:35 +10:00
|
|
|
{
|
|
|
|
DerivedMesh *dm = NULL;
|
|
|
|
|
|
|
|
/* happens on undo */
|
|
|
|
if (ob->type != OB_MESH || !ob->data)
|
|
|
|
return;
|
|
|
|
|
2017-07-26 05:10:20 +10:00
|
|
|
/* Temporary, happens on undo, would resolve but will eventually move away from DM. */
|
|
|
|
if (ob->derivedFinal == NULL) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-04-06 12:07:27 +02:00
|
|
|
dm = mesh_get_derived_final(depsgraph, scene, ob, CD_MASK_BAREMESH);
|
2017-06-10 10:42:35 +10:00
|
|
|
if (!dm || !CustomData_has_layer(&dm->polyData, CD_FACEMAP))
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
glFrontFace((ob->transflag & OB_NEG_SCALE) ? GL_CW : GL_CCW);
|
2018-06-04 09:39:04 +02:00
|
|
|
|
2017-06-10 10:42:35 +10:00
|
|
|
#if 0
|
|
|
|
DM_update_materials(dm, ob);
|
|
|
|
|
|
|
|
/* add polygon offset so we draw above the original surface */
|
|
|
|
glPolygonOffset(1.0, 1.0);
|
|
|
|
|
|
|
|
GPU_facemap_setup(dm);
|
|
|
|
|
|
|
|
glColor4fv(col);
|
|
|
|
|
|
|
|
gpuPushAttrib(GL_ENABLE_BIT);
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_blend(true);
|
2017-06-10 10:42:35 +10:00
|
|
|
glDisable(GL_LIGHTING);
|
|
|
|
|
|
|
|
/* always draw using backface culling */
|
|
|
|
glEnable(GL_CULL_FACE);
|
|
|
|
glCullFace(GL_BACK);
|
|
|
|
|
|
|
|
if (dm->drawObject->facemapindices) {
|
|
|
|
glDrawElements(GL_TRIANGLES, dm->drawObject->facemap_count[facemap] * 3, GL_UNSIGNED_INT,
|
|
|
|
(int *)NULL + dm->drawObject->facemap_start[facemap] * 3);
|
|
|
|
}
|
|
|
|
gpuPopAttrib();
|
|
|
|
|
|
|
|
GPU_buffers_unbind();
|
|
|
|
|
|
|
|
glPolygonOffset(0.0, 0.0);
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
/* Just to create the data to pass to immediate mode, grr! */
|
|
|
|
Mesh *me = ob->data;
|
|
|
|
const int *facemap_data = CustomData_get_layer(&me->pdata, CD_FACEMAP);
|
|
|
|
if (facemap_data) {
|
2017-06-19 20:18:04 +10:00
|
|
|
Gwn_VertFormat *format = immVertexFormat();
|
2018-07-08 12:48:04 +02:00
|
|
|
uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
|
2017-06-10 10:42:35 +10:00
|
|
|
|
|
|
|
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
|
|
|
immUniformColor4fv(col);
|
|
|
|
|
|
|
|
/* XXX, alpha isn't working yet, not sure why. */
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
|
|
|
|
GPU_blend(true);
|
2017-06-10 10:42:35 +10:00
|
|
|
|
|
|
|
MVert *mvert;
|
|
|
|
|
|
|
|
MPoly *mpoly;
|
|
|
|
int mpoly_len;
|
|
|
|
|
|
|
|
MLoop *mloop;
|
|
|
|
int mloop_len;
|
|
|
|
|
|
|
|
if (dm && CustomData_has_layer(&dm->polyData, CD_FACEMAP)) {
|
|
|
|
mvert = dm->getVertArray(dm);
|
|
|
|
mpoly = dm->getPolyArray(dm);
|
|
|
|
mloop = dm->getLoopArray(dm);
|
|
|
|
|
|
|
|
mpoly_len = dm->getNumPolys(dm);
|
|
|
|
mloop_len = dm->getNumLoops(dm);
|
|
|
|
|
|
|
|
facemap_data = CustomData_get_layer(&dm->polyData, CD_FACEMAP);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
mvert = me->mvert;
|
|
|
|
mpoly = me->mpoly;
|
|
|
|
mloop = me->mloop;
|
|
|
|
|
|
|
|
mpoly_len = me->totpoly;
|
|
|
|
mloop_len = me->totloop;
|
|
|
|
|
|
|
|
facemap_data = CustomData_get_layer(&me->pdata, CD_FACEMAP);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* use gawain immediate mode fore now */
|
|
|
|
const int looptris_len = poly_to_tri_count(mpoly_len, mloop_len);
|
2017-06-19 20:18:04 +10:00
|
|
|
immBeginAtMost(GWN_PRIM_TRIS, looptris_len * 3);
|
2017-06-10 10:42:35 +10:00
|
|
|
|
|
|
|
MPoly *mp;
|
|
|
|
int i;
|
|
|
|
for (mp = mpoly, i = 0; i < mpoly_len; i++, mp++) {
|
|
|
|
if (facemap_data[i] == facemap) {
|
|
|
|
/* Weak, fan-fill, use until we have derived-mesh replaced. */
|
|
|
|
const MLoop *ml_start = &mloop[mp->loopstart];
|
|
|
|
const MLoop *ml_a = ml_start + 1;
|
|
|
|
const MLoop *ml_b = ml_start + 2;
|
|
|
|
for (int j = 2; j < mp->totloop; j++) {
|
|
|
|
immVertex3fv(pos, mvert[ml_start->v].co);
|
|
|
|
immVertex3fv(pos, mvert[ml_a->v].co);
|
|
|
|
immVertex3fv(pos, mvert[ml_b->v].co);
|
|
|
|
|
|
|
|
ml_a++;
|
|
|
|
ml_b++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
immEnd();
|
|
|
|
|
|
|
|
immUnbindProgram();
|
|
|
|
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_blend(false);
|
2017-06-10 10:42:35 +10:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
dm->release(dm);
|
|
|
|
}
|