11 encoder.begin(_viewId, _depthTestLess, _encoder);
15 draw_billboard(
encoder, BGFX_INVALID_HANDLE, {0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 1.0f}, 1.0f);
26 bgfx::TextureHandle icon_texture,
27 const bx::Vec3& icon_center,
28 const bx::Vec3& camera_pos,
29 const bx::Vec3& camera_look_dir,
32 bx::Vec3 toCamera = bx::mul(camera_look_dir, -1.0f);
36 bx::Vec3 worldUp = {0.0f, 1.0f, 0.0f};
37 if(std::fabs(bx::dot(toCamera, worldUp)) > 0.99f)
46 bx::Vec3 right = bx::cross(worldUp, toCamera);
47 right = bx::normalize(right);
50 bx::Vec3 up = bx::cross(toCamera, right);
59 mtx[0] = up.x * half_size;
60 mtx[1] = up.y * half_size;
61 mtx[2] = up.z * half_size;
63 mtx[4] = -right.x * half_size;
64 mtx[5] = -right.y * half_size;
65 mtx[6] = -right.z * half_size;
71 mtx[12] = icon_center.x;
72 mtx[13] = icon_center.y;
73 mtx[14] = icon_center.z;
82 dd.
drawQuad(icon_texture, {0.0f, 0.0f, 1.0f}, {0.0f, 0.0f, 0.0f}, 1.0f);