载入中...
搜索中...
未找到
StrandsDatas.h
浏览该文件的文档.
1#pragma once
2
3#include "common/Result.h"
4
5#include <cstddef>
6#include <cstdint>
7#include <span>
8#include <vector>
9
10#include <glm/vec3.hpp>
11
12namespace eve::graphics::hair {
13
19 glm::vec3 position{0.f};
20 float radius = 0.001f;
22 float u = 0.f;
23};
24
30 uint32_t pointOffset = 0;
31 uint32_t pointCount = 0;
32 float length = 0.f;
33};
34
45public:
47 void setPoints(std::vector<StrandPoint> points);
49 void setCurves(std::vector<StrandCurve> curves);
50
52 [[nodiscard]] uint32_t addPoint(const StrandPoint &point);
54 [[nodiscard]] uint32_t addCurve(const StrandCurve &curve);
55
57 void clear();
58
63 [[nodiscard]] Result<void> validate() const;
64
65 [[nodiscard]] size_t pointCount() const { return points_.size(); }
66 [[nodiscard]] size_t curveCount() const { return curves_.size(); }
67
69 [[nodiscard]] std::span<const StrandPoint> points() const { return points_; }
71 [[nodiscard]] std::span<const StrandCurve> curves() const { return curves_; }
72
77 [[nodiscard]] std::span<const StrandPoint> curvePoints(size_t curveIndex) const;
78
80 void computeBounds(glm::vec3 &outMin, glm::vec3 &outMax) const;
81
82private:
83 std::vector<StrandPoint> points_;
84 std::vector<StrandCurve> curves_;
85};
86
87} // namespace eve::graphics::hair
#define EVENGINE_API_BACKENDS
Definition Export.h:108
std::shared_ptr< const std::vector< glm::vec2 > > points
Move-only, checked operation results for the common layer.
Heightmap curve
glm::vec3 point
Move-only operation result carrying either a value or Status.
Definition Result.h:155
CPU-authoritative strand buffer (UE FHairStrandsDatas analogue).
std::span< const StrandCurve > curves() const
Borrowed curves; invalidated by mutation.
std::span< const StrandPoint > points() const
Borrowed points; invalidated by mutation.
Procedural hair/fur card meshes + material/LOD helpers (no strand simulation).
Definition Graphics.h:58
One strand as a contiguous point range. @ownership Value type owned by StrandsDatas.
One control point on a hair curve (UE FHairStrandsDatas point analogue). @ownership Value type owned ...
float u
Root-to-tip parameter in [0, 1].