mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:44:02 +02:00
Orient particles to face camera but not roll with it
This commit is contained in:
parent
75a9dd13be
commit
a2c7b3bcc9
1 changed files with 5 additions and 2 deletions
|
@ -211,9 +211,12 @@ void RenderableParticleEffectEntityItem::updateRenderItem() {
|
|||
_vertices.clear();
|
||||
|
||||
// build vertices from particle positions and radiuses
|
||||
const glm::vec3 up = frustum->getUp();
|
||||
const glm::vec3 right = frustum->getRight();
|
||||
glm::vec3 frustumPosition = frustum->getPosition();
|
||||
for (auto&& particle : particleDetails) {
|
||||
glm::vec3 particleDirection = particle.position - frustumPosition;
|
||||
glm::vec3 right = glm::normalize(glm::cross(glm::vec3(0.0f, 1.0f, 0.0f), particleDirection));
|
||||
glm::vec3 up = glm::normalize(glm::cross(right, particleDirection));
|
||||
|
||||
glm::vec3 upOffset = up * particle.radius;
|
||||
glm::vec3 rightOffset = right * particle.radius;
|
||||
// generate corners of quad aligned to face the camera.
|
||||
|
|
Loading…
Reference in a new issue