|
Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
|
How much texture a mesh's surface holds: UV units per world unit of its own surface. More...
#include "../core/Types.hpp"#include "../renderer/rhi/GfxEnums.hpp"#include <cmath>#include <cstring>

Go to the source code of this file.
Namespaces | |
| namespace | esengine |
| namespace | esengine::resource |
Functions | |
| f32 | esengine::resource::meshUvDensity (const u8 *vertexBytes, usize vertexByteCount, u32 vertexStride, u32 positionOffset, u32 uvOffset, const u32 *indices, usize indexCount) |
How much texture a mesh's surface holds: UV units per world unit of its own surface.
The square root of the mesh's UV area over its surface area, both summed over its triangles. A texture side texels across, drawn on it, puts side * density texels on a world unit of the mesh at its own size — which is what a view compares with the pixels a world unit covers to say how big a texture it needs. An average over the whole mesh: a mesh that packs one part of its surface much denser than another is answered for the mean.
Header-only: vertex bytes, their layout and the triangle list are the whole input. 0 for a mesh without float positions and a float first UV set, which no view then asks for a size of.
Definition in file MeshUvDensity.hpp.