载入中...
搜索中...
未找到
StaticMeshSurface.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
6#include "common/Result.h"
7
8#include <cstdint>
9#include <memory>
10#include <string>
11#include <vector>
12
13namespace eve::building {
14
17public:
19 enum class HitSelection { Highest, Lowest, ClosestToReference };
20
22 struct Config {
23 std::string surfaceId;
24 uint64_t surfaceRevision = 0;
25 std::vector<std::string> tags;
26 HitSelection hitSelection = HitSelection::Highest;
27 float referenceHeight = 0.f;
28 bool orientNormalsToGridUp = true;
29 uint32_t leafTriangleCount = 8;
30 };
31
41 create(Config config, std::vector<float> vertices, std::vector<uint32_t> indices,
42 std::vector<float> normals = {});
43
53 sample(const PlacementWorld &world, float planeX, float planeY) const;
54
56 const Config &config() const { return config_; }
58 size_t triangleCount() const { return indices_.size() / 3; }
60 size_t nodeCount() const { return nodes_.size(); }
61
62private:
63 struct Bounds {
64 float minX;
65 float minY;
66 float minZ;
67 float maxX;
68 float maxY;
69 float maxZ;
70 };
71 struct Node {
72 Bounds bounds;
73 uint32_t first = 0;
74 uint32_t count = 0;
75 uint32_t left = 0;
76 uint32_t right = 0;
77 bool leaf = false;
78 };
79
80 StaticMeshSurface(Config config, std::vector<float> vertices,
81 std::vector<uint32_t> indices, std::vector<float> normals);
82 uint32_t buildNode(uint32_t first, uint32_t count);
83
84 Config config_;
85 std::vector<float> vertices_;
86 std::vector<uint32_t> indices_;
87 std::vector<float> normals_;
88 std::vector<uint32_t> triangleOrder_;
89 std::vector<Bounds> triangleBounds_;
90 std::vector<Node> nodes_;
91};
92
93} // namespace eve::building
#define EVENGINE_API_WORLD
Definition Export.h:109
std::vector< std::uint32_t > indices
std::vector< float > normals
HexVec3 left
HexVec3 right
std::int32_t first
World3D * world
std::vector< Point > vertices
Move-only, checked operation results for the common layer.
std::uint32_t count
Move-only operation result carrying either a value or Status.
Definition Result.h:155
格子型建筑放置世界(脚本可直接操作)。
Immutable world-space triangle mesh accelerated for placement-surface projection.
size_t triangleCount() const
Number of source triangles indexed by the BVH.
HitSelection
Deterministic policy for multiple triangles under one plane coordinate.
size_t nodeCount() const
Number of BVH nodes, including leaves.
const Config & config() const
Return the immutable construction configuration.
建筑放置模块入口:定义 / 放置世界 / 鬼影 / 变更事件的脚本绑定点。 设计文档:docs/dev/建筑放置系统设计.md
Definition Building.cpp:7
Immutable identity, hit policy and metadata for one static mesh snapshot.
glm::vec4 bounds