Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
esengine::impostor Namespace Reference

Functions

glm::vec2 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 decode (glm::vec2 uv)
 The direction a point of the unit square unfolds to.
glm::vec3 frameDirection (u32 i, u32 j, u32 frames)
 The direction, from the object toward the camera, that frame (i, j) is taken from.
glm::uvec2 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 pictureUp (const glm::vec3 &d)
 The up a picture is taken with from d: world up laid flat across the view.

Function Documentation

◆ decode()

glm::vec3 esengine::impostor::decode ( glm::vec2 uv)
inline

The direction a point of the unit square unfolds to.

Definition at line 35 of file ImpostorFrames.hpp.

Referenced by frameDirection().

◆ encode()

glm::vec2 esengine::impostor::encode ( glm::vec3 d)
inline

Where on the unit square a direction of the upper hemisphere folds to. Below the horizon is taken as on it.

Definition at line 26 of file ImpostorFrames.hpp.

Referenced by nearestFrame().

◆ frameDirection()

glm::vec3 esengine::impostor::frameDirection ( u32 i,
u32 j,
u32 frames )
inline

The direction, from the object toward the camera, that frame (i, j) is taken from.

Definition at line 43 of file ImpostorFrames.hpp.

References decode().

◆ nearestFrame()

glm::uvec2 esengine::impostor::nearestFrame ( const glm::vec3 & d,
u32 frames )
inline

The frame taken nearest d, a direction from the object toward the viewer in the object's own space.

Definition at line 49 of file ImpostorFrames.hpp.

References encode().

◆ pictureUp()

glm::vec3 esengine::impostor::pictureUp ( const glm::vec3 & d)
inline

The up a picture is taken with from d: world up laid flat across the view.

Straight overhead there is no such thing, and -Z stands in (the bake's camera looks down with the object's -Z at the top of the picture). The card is drawn with the same rule, so a picture and its card agree on which way is up.

Definition at line 63 of file ImpostorFrames.hpp.