|
Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
|
Which direction each picture of an impostor atlas is taken from, and which picture a view is shown. More...
#include "../../core/Types.hpp"#include "../../math/Math.hpp"#include <algorithm>#include <cmath>

Go to the source code of this file.
Namespaces | |
| namespace | esengine |
| namespace | esengine::impostor |
Functions | |
| glm::vec2 | esengine::impostor::encode (glm::vec3 d) |
| Where on the unit square a direction of the upper hemisphere folds to. Below the horizon is taken as on it. | |
| glm::vec3 | esengine::impostor::decode (glm::vec2 uv) |
| The direction a point of the unit square unfolds to. | |
| glm::vec3 | esengine::impostor::frameDirection (u32 i, u32 j, u32 frames) |
The direction, from the object toward the camera, that frame (i, j) is taken from. | |
| glm::uvec2 | esengine::impostor::nearestFrame (const glm::vec3 &d, u32 frames) |
The frame taken nearest d, a direction from the object toward the viewer in the object's own space. | |
| glm::vec3 | esengine::impostor::pictureUp (const glm::vec3 &d) |
The up a picture is taken with from d: world up laid flat across the view. | |
Which direction each picture of an impostor atlas is taken from, and which picture a view is shown.
The pictures cover the upper half of a sphere on a hemi-octahedral grid: the square folds onto the hemisphere with its centre straight above and its edges round the horizon, so every grid point is a usable direction and the pictures are spread evenly. Frame (i, j) is taken from the grid point at (i, j) / (frames - 1), so the horizon is in the set. The SDK's bake places its cameras by the same rule (impostorFrameDirection in sdk/src/render/impostor.ts); the two are held to each other by tests on both sides.
Header-only and free of the renderer: a direction and a frame count are the whole input.
Definition in file ImpostorFrames.hpp.