2022-02-10 23:07:11 +01:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
* Copyright 2001-2002 NaN Holding BV. All rights reserved. */
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2012-02-17 19:59:41 +01:00
|
|
|
#pragma once
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2019-02-17 22:08:12 +01:00
|
|
|
/** \file
|
|
|
|
* \ingroup bke
|
|
|
|
* \brief display list (or rather multi purpose list) stuff.
|
2011-02-18 14:05:18 +01:00
|
|
|
*/
|
2006-12-05 18:42:03 +01:00
|
|
|
#include "BKE_customdata.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "DNA_customdata_types.h"
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 05:28:02 +01:00
|
|
|
|
2020-03-02 15:07:49 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2020-09-08 09:15:09 +02:00
|
|
|
/** #DispList.type */
|
|
|
|
enum {
|
2021-06-24 07:56:58 +02:00
|
|
|
/** A closed polygon (that can be filled). */
|
2020-09-08 09:15:09 +02:00
|
|
|
DL_POLY = 0,
|
2021-06-24 07:56:58 +02:00
|
|
|
/** An open polygon. */
|
2020-09-08 09:15:09 +02:00
|
|
|
DL_SEGM = 1,
|
2021-06-24 07:56:58 +02:00
|
|
|
/** A grid surface that respects #DL_CYCL_U & #DL_CYCL_V. */
|
2020-09-08 09:15:09 +02:00
|
|
|
DL_SURF = 2,
|
|
|
|
/** Triangles. */
|
|
|
|
DL_INDEX3 = 4,
|
|
|
|
/** Quads, with support for triangles (when values of the 3rd and 4th indices match). */
|
|
|
|
DL_INDEX4 = 5,
|
|
|
|
// DL_VERTCOL = 6, /* UNUSED */
|
|
|
|
/** Isolated points. */
|
|
|
|
DL_VERTS = 7,
|
|
|
|
};
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2020-09-08 09:15:09 +02:00
|
|
|
/** #DispList.type */
|
2016-06-25 03:24:25 +02:00
|
|
|
enum {
|
|
|
|
/** U/V swapped here compared with #Nurb.flagu, #Nurb.flagv and #CU_NURB_CYCLIC */
|
|
|
|
DL_CYCL_U = (1 << 0),
|
|
|
|
DL_CYCL_V = (1 << 1),
|
|
|
|
|
|
|
|
DL_FRONT_CURVE = (1 << 2),
|
|
|
|
DL_BACK_CURVE = (1 << 3),
|
|
|
|
};
|
2002-10-12 13:37:38 +02:00
|
|
|
|
|
|
|
/* prototypes */
|
|
|
|
|
2018-04-06 12:07:27 +02:00
|
|
|
struct Depsgraph;
|
2018-06-11 12:14:18 +02:00
|
|
|
struct ListBase;
|
2019-01-28 11:08:24 +01:00
|
|
|
struct Mesh;
|
2018-06-11 12:14:18 +02:00
|
|
|
struct Object;
|
|
|
|
struct Scene;
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2021-06-07 20:29:37 +02:00
|
|
|
/* Used for curves, nurbs, meta-balls. */
|
2002-10-12 13:37:38 +02:00
|
|
|
typedef struct DispList {
|
2010-03-22 10:30:00 +01:00
|
|
|
struct DispList *next, *prev;
|
|
|
|
short type, flag;
|
|
|
|
int parts, nr;
|
2021-06-07 20:29:37 +02:00
|
|
|
short col, rt; /* Currently only used for smooth flag. */
|
2002-10-12 13:37:38 +02:00
|
|
|
float *verts, *nors;
|
|
|
|
int *index;
|
2005-06-17 23:04:27 +02:00
|
|
|
int charidx;
|
2012-05-12 22:39:39 +02:00
|
|
|
int totindex; /* indexed array drawing surfaces */
|
2002-10-12 13:37:38 +02:00
|
|
|
} DispList;
|
|
|
|
|
2021-04-01 01:07:15 +02:00
|
|
|
void BKE_displist_copy(struct ListBase *lbn, const struct ListBase *lb);
|
2012-05-07 08:58:03 +02:00
|
|
|
DispList *BKE_displist_find(struct ListBase *lb, int type);
|
|
|
|
void BKE_displist_normals_add(struct ListBase *lb);
|
2021-04-01 01:07:15 +02:00
|
|
|
void BKE_displist_count(const struct ListBase *lb, int *totvert, int *totface, int *tottri);
|
2012-05-07 08:58:03 +02:00
|
|
|
void BKE_displist_free(struct ListBase *lb);
|
|
|
|
|
2017-08-16 04:45:11 +02:00
|
|
|
void BKE_displist_make_curveTypes(struct Depsgraph *depsgraph,
|
2021-04-01 01:07:15 +02:00
|
|
|
const struct Scene *scene,
|
2018-11-28 18:14:40 +01:00
|
|
|
struct Object *ob,
|
2022-01-07 01:38:08 +01:00
|
|
|
bool for_render);
|
2018-04-06 12:07:27 +02:00
|
|
|
void BKE_displist_make_mball(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob);
|
2012-05-07 08:58:03 +02:00
|
|
|
|
Geometry Nodes: Support modifier on curve objects
With this commit, curve objects support the geometry nodes modifier.
Curves objects now evaluate to `CurveEval` unless there was a previous
implicit conversion (tessellating modifiers, mesh modifiers, or the
settings in the curve "Geometry" panel). In the new code, curves are
only considered to be the wire edges-- any generated surface is a mesh
instead, stored in the evaluated geometry set.
The consolidation of concepts mentioned above allows remove a lot of
code that had to do with maintaining the `DispList` type temporarily
for modifiers and rendering. Instead, render engines see a separate
object for the mesh from the mesh geometry component, and when the
curve object evaluates to a curve, the `CurveEval` is always used for
drawing wire edges.
However, currently the `DispList` type is still maintained and used as
an intermediate step in implicit mesh conversion. In the future, more
uses of it could be changed to use `CurveEval` and `Mesh` instead.
This is mostly not changed behavior, it is just a formalization of
existing logic after recent fixes for 2.8 versions last year and two
years ago. Also, in the future more functionality can be converted
to nodes, removing cases of implicit conversions. For more discussion
on that topic, see T89676.
The `use_fill_deform` option is removed. It has not worked properly
since 2.62, and the choice for filling a curve before or after
deformation will work much better and be clearer with a node system.
Applying the geometry nodes modifier to generate a curve is not
implemented with this commit, so applying the modifier won't work
at all. This is a separate technical challenge, and should be solved
in a separate step.
Differential Revision: https://developer.blender.org/D11597
2021-09-11 20:54:40 +02:00
|
|
|
void BKE_curve_calc_modifiers_pre(struct Depsgraph *depsgraph,
|
2021-04-01 01:07:15 +02:00
|
|
|
const struct Scene *scene,
|
2021-02-20 17:05:13 +01:00
|
|
|
struct Object *ob,
|
|
|
|
struct ListBase *source_nurb,
|
|
|
|
struct ListBase *target_nurb,
|
2022-01-07 01:38:08 +01:00
|
|
|
bool for_render);
|
2021-04-01 01:07:15 +02:00
|
|
|
bool BKE_displist_surfindex_get(
|
|
|
|
const struct DispList *dl, int a, int *b, int *p1, int *p2, int *p3, int *p4);
|
2021-02-20 17:05:13 +01:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* \param normal_proj: Optional normal that's used to project the scan-fill verts into 2D coords.
|
|
|
|
* Pass this along if known since it saves time calculating the normal.
|
|
|
|
* This is also used to initialize #DispList.nors (one normal per display list).
|
2021-12-14 08:35:23 +01:00
|
|
|
* \param flip_normal: Flip the normal (same as passing \a normal_proj negated).
|
2021-12-07 07:19:15 +01:00
|
|
|
*/
|
2021-02-12 23:06:17 +01:00
|
|
|
void BKE_displist_fill(const struct ListBase *dispbase,
|
2013-04-26 23:04:12 +02:00
|
|
|
struct ListBase *to,
|
|
|
|
const float normal_proj[3],
|
2022-01-07 01:38:08 +01:00
|
|
|
bool flip_normal);
|
2012-05-07 08:58:03 +02:00
|
|
|
|
2021-04-01 01:07:15 +02:00
|
|
|
float BKE_displist_calc_taper(struct Depsgraph *depsgraph,
|
|
|
|
const struct Scene *scene,
|
|
|
|
struct Object *taperobj,
|
|
|
|
int cur,
|
|
|
|
int tot);
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
|
2021-04-01 01:07:15 +02:00
|
|
|
void BKE_displist_minmax(const struct ListBase *dispbase, float min[3], float max[3]);
|
2013-08-21 09:40:19 +02:00
|
|
|
|
2020-03-02 15:07:49 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|