2023-08-16 00:20:26 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
2023-07-07 08:19:52 -04:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
/** \file
|
|
|
|
|
* \ingroup bke
|
|
|
|
|
*/
|
|
|
|
|
|
2025-01-28 15:27:34 +01:00
|
|
|
#include <optional>
|
|
|
|
|
|
2023-07-10 19:49:54 +02:00
|
|
|
#include "BLI_array.hh"
|
2023-11-19 18:36:19 -05:00
|
|
|
#include "BLI_bounds_types.hh"
|
2023-07-10 19:49:54 +02:00
|
|
|
#include "BLI_math_vector_types.hh"
|
|
|
|
|
|
2023-07-07 08:19:52 -04:00
|
|
|
struct BMEditMesh;
|
|
|
|
|
|
2023-07-10 19:49:54 +02:00
|
|
|
namespace blender::bke {
|
|
|
|
|
|
2023-07-07 08:19:52 -04:00
|
|
|
struct EditMeshData {
|
2024-04-02 21:09:55 -04:00
|
|
|
/**
|
2024-07-14 18:55:43 +10:00
|
|
|
* Deformed positions calculated by modifiers in the modifier stack that can process an
|
2024-04-02 21:09:55 -04:00
|
|
|
* edit mesh input. When this is not empty, the other arrays will depend on the values.
|
|
|
|
|
*/
|
2024-03-28 18:25:24 -04:00
|
|
|
Array<float3> vert_positions;
|
2023-07-07 08:19:52 -04:00
|
|
|
|
2024-04-02 21:09:55 -04: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 18:25:24 -04:00
|
|
|
Array<float3> vert_normals;
|
2024-04-02 21:09:55 -04: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 18:25:24 -04:00
|
|
|
Array<float3> face_normals;
|
2024-04-02 21:09:55 -04: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 18:25:24 -04:00
|
|
|
Array<float3> face_centers;
|
2023-07-07 08:19:52 -04:00
|
|
|
};
|
|
|
|
|
|
2023-07-10 19:49:54 +02:00
|
|
|
} // namespace blender::bke
|
|
|
|
|
|
2024-04-02 17:36:23 -04: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 08:19:52 -04:00
|
|
|
|
2024-04-02 17:36:23 -04:00
|
|
|
blender::Span<blender::float3> BKE_editmesh_cache_ensure_face_centers(
|
|
|
|
|
BMEditMesh &em, blender::bke::EditMeshData &emd);
|
2023-07-07 08:19:52 -04:00
|
|
|
|
2023-11-19 18:36:19 -05:00
|
|
|
std::optional<blender::Bounds<blender::float3>> BKE_editmesh_cache_calc_minmax(
|
2023-12-04 15:22:00 -05:00
|
|
|
const BMEditMesh &em, const blender::bke::EditMeshData &emd);
|