2023-08-15 16:20:26 +02:00
|
|
|
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
2023-07-07 14:19:52 +02:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
/** \file
|
|
|
|
* \ingroup bke
|
|
|
|
*/
|
|
|
|
|
2023-07-10 19:49:54 +02:00
|
|
|
#include "BLI_array.hh"
|
2023-11-20 00:36:19 +01:00
|
|
|
#include "BLI_bounds_types.hh"
|
2023-07-10 19:49:54 +02:00
|
|
|
#include "BLI_math_vector_types.hh"
|
|
|
|
|
2023-07-07 14:19:52 +02:00
|
|
|
struct BMEditMesh;
|
|
|
|
|
2023-07-10 19:49:54 +02:00
|
|
|
namespace blender::bke {
|
|
|
|
|
2023-07-07 14:19:52 +02:00
|
|
|
struct EditMeshData {
|
2024-04-03 03:09:55 +02:00
|
|
|
/**
|
|
|
|
* Deformed positions calculated by modifiers in the modifier stack that can can process an
|
|
|
|
* edit mesh input. When this is not empty, the other arrays will depend on the values.
|
|
|
|
*/
|
2024-03-28 23:25:24 +01:00
|
|
|
Array<float3> vert_positions;
|
2023-07-07 14:19:52 +02:00
|
|
|
|
2024-04-03 03:09:55 +02:00
|
|
|
/**
|
|
|
|
* Lazily initialized vertex normal cache (used when `vert_positions` is set.
|
|
|
|
* Access via #BKE_editmesh_cache_ensure_vert_normals instead of directly.
|
|
|
|
*/
|
2024-03-28 23:25:24 +01:00
|
|
|
Array<float3> vert_normals;
|
2024-04-03 03:09:55 +02:00
|
|
|
/**
|
|
|
|
* Lazily initialized face normal cache (used when `vert_positions` is set.
|
|
|
|
* Access via #BKE_editmesh_cache_ensure_face_normals instead of directly.
|
|
|
|
*/
|
2024-03-28 23:25:24 +01:00
|
|
|
Array<float3> face_normals;
|
2024-04-03 03:09:55 +02:00
|
|
|
/**
|
|
|
|
* Cache of face centers, also depends on `vert_positions` when it is not empty.
|
|
|
|
* Access via #BKE_editmesh_cache_ensure_face_centers instead of directly.
|
|
|
|
*/
|
2024-03-28 23:25:24 +01:00
|
|
|
Array<float3> face_centers;
|
2023-07-07 14:19:52 +02:00
|
|
|
};
|
|
|
|
|
2023-07-10 19:49:54 +02:00
|
|
|
} // namespace blender::bke
|
|
|
|
|
2024-04-02 23:36:23 +02:00
|
|
|
blender::Span<blender::float3> BKE_editmesh_cache_ensure_face_normals(
|
|
|
|
BMEditMesh &em, blender::bke::EditMeshData &emd);
|
|
|
|
blender::Span<blender::float3> BKE_editmesh_cache_ensure_vert_normals(
|
|
|
|
BMEditMesh &em, blender::bke::EditMeshData &emd);
|
2023-07-07 14:19:52 +02:00
|
|
|
|
2024-04-02 23:36:23 +02:00
|
|
|
blender::Span<blender::float3> BKE_editmesh_cache_ensure_face_centers(
|
|
|
|
BMEditMesh &em, blender::bke::EditMeshData &emd);
|
2023-07-07 14:19:52 +02:00
|
|
|
|
2023-11-20 00:36:19 +01:00
|
|
|
std::optional<blender::Bounds<blender::float3>> BKE_editmesh_cache_calc_minmax(
|
2023-12-04 21:22:00 +01:00
|
|
|
const BMEditMesh &em, const blender::bke::EditMeshData &emd);
|