载入中...
搜索中...
未找到
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:
33
36
37 bool isReady() const { return backend_.state != nullptr; }
38
39 // ---- build (preprocess + upload) ----
40 bool build(const float *positions, int vertexCount, const std::uint32_t *indices, int indexCount);
43 bool buildIcosphere(int subdiv);
44
45 // ---- per-frame ----
46 void setViewport(int width, int height, float fovYDeg, float errorPx = 1.0f);
47 void setCamera(const float view[16], const float proj[16], const float model[16],
48 const float camPos[3]);
50 void setCameraSimple(float camX, float camY, float camZ, float nearZ = 0.1f, float farZ = 100.f);
52 void setModelYaw(float yaw);
54 int update();
56 bool resolve(unsigned char *outRgba, int &outW, int &outH);
59 int getViewWidth() const { return width_; }
60 int getViewHeight() const { return height_; }
61
62 // ---- stats ----
63 int getClusterCount() const;
64 int getVisibleCount() const { return lastVisible_; }
65 int getTotalTriangleCount() const;
66 int getLodLevel(int clusterId) const;
67 int getMaxLodLevel() const;
68
69private:
70 void buildIcosphereInternal(int subdiv);
71 void updateUniforms();
72
73 VgBackend backend_;
75 VirtualGeometryBuilder::Options builderOptions_{};
76 VgUniforms uniforms_{};
77 int width_ = 1, height_ = 1;
78 int lastVisible_ = 0;
79 int visibleCapacity_ = 4096;
80 float modelYaw_ = 0.f;
81};
82
83} // namespace eve::virtualgeometry
float height
Definition Grass.cpp:235
int width
glm::mat4 view
glm::mat4 model
glm::mat4 proj
In-memory byte buffer implementing eve::Data (ref-counted).
Definition ByteData.h:11
A virtual-geometry renderer: preprocesses a mesh into a cluster DAG, uploads it to the GPU,...
bool buildIcosphere(int subdiv)
Convenience: procedural unit icosphere, subdiv subdivision levels.
void setViewport(int width, int height, float fovYDeg, float errorPx=1.0f)
int update()
Run cull + raster; returns the number of visible clusters.
VirtualGeometryRenderer(const VirtualGeometryRenderer &)=delete
VirtualGeometryRenderer & operator=(const VirtualGeometryRenderer &)=delete
void setModelYaw(float yaw)
Spin the virtualized model about Y by yaw radians each frame.
void setCameraSimple(float camX, float camY, float camZ, float nearZ=0.1f, float farZ=100.f)
Script-friendly: identity view (camera looking down -Z) + perspective.
void setCamera(const float view[16], const float proj[16], const float model[16], const float camPos[3])
bool build(const float *positions, int vertexCount, const std::uint32_t *indices, int indexCount)
bool resolve(unsigned char *outRgba, int &outW, int &outH)
eve::data::ByteData * resolveByteData()
Resolve into a heap ByteData (RGBA) for scripting/display.
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...