载入中...
搜索中...
未找到
VirtualGeometryRenderer.h
浏览该文件的文档.
1#pragma once
2
6
7#include <cstdint>
8#include <vector>
9
10namespace eve::data {
11class ByteData;
12}
13
14namespace eve::virtualgeometry {
15
30public:
35
38
40 bool isReady() const { return backend_.state != nullptr; }
41
42 // ---- build (preprocess + upload) ----
44 bool build(const float *positions, int vertexCount, const std::uint32_t *indices, int indexCount);
46 bool build(const VirtualGeometryBuilder::MeshInput &in);
48 bool buildIcosphere(int subdiv);
49
50 // ---- per-frame ----
52 void setViewport(int width, int height, float fovYDeg, float errorPx = 1.0f);
54 void setCamera(const float view[16], const float proj[16], const float model[16],
55 const float camPos[3]);
57 void setCameraSimple(float camX, float camY, float camZ, float nearZ = 0.1f, float farZ = 100.f);
59 void setModelYaw(float yaw);
61 int update();
64 bool resolve(unsigned char *outRgba, int &outW, int &outH);
66 eve::data::ByteData *resolveByteData();
68 int getViewWidth() const { return width_; }
70 int getViewHeight() const { return height_; }
71
72 // ---- stats ----
74 int getClusterCount() const;
76 int getVisibleCount() const { return lastVisible_; }
78 int getTotalTriangleCount() const;
80 int getLodLevel(int clusterId) const;
82 int getMaxLodLevel() const;
83
84private:
85 void buildIcosphereInternal(int subdiv);
86 void updateUniforms();
87
88 VgBackend backend_;
90 VirtualGeometryBuilder::Options builderOptions_{};
91 VgUniforms uniforms_{};
92 int width_ = 1, height_ = 1;
93 int lastVisible_ = 0;
94 int visibleCapacity_ = 4096;
95 float modelYaw_ = 0.f;
96};
97
98} // namespace eve::virtualgeometry
#define EVENGINE_API_DOMAINS
Definition Export.h:110
std::uint32_t vertexCount
std::uint32_t indexCount
std::vector< std::uint32_t > indices
std::vector< float > positions
std::uint32_t height
std::uint32_t width
glm::mat4 view
glm::mat4 model
glm::mat4 proj
In-memory byte buffer implementing eve::Data (ref-counted).
Definition ByteData.h:13
A virtual-geometry renderer: preprocesses a mesh into a cluster DAG, uploads it to the GPU,...
VirtualGeometryRenderer(const VirtualGeometryRenderer &)=delete
VirtualGeometryRenderer & operator=(const VirtualGeometryRenderer &)=delete
int getVisibleCount() const
Returns the visible count.
int getViewHeight() const
Returns the view height.
int getViewWidth() const
Returns the view width.
Opaque backend state for one virtual-geometry renderer. Owned by VirtualGeometryRenderer; allocated/f...
Fully processed virtual-geometry asset (CPU representation). Produced by Builder from a Mesh; uploade...