diff options
Diffstat (limited to 'indra/llrender')
| -rw-r--r-- | indra/llrender/llrender.cpp | 22 | 
1 files changed, 12 insertions, 10 deletions
| diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 37e15b96c3..9f3f42d6d5 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -751,9 +751,8 @@ void LLLightState::setPosition(const LLVector4& position)      ++gGL.mLightHash;      mPosition = position;      //transform position by current modelview matrix -    glm::vec4 pos(glm::make_vec4(position.mV)); -    const glm::mat4& mat = gGL.getModelviewMatrix(); -    pos = mat * pos; +    glm::vec4 pos(position); +    pos = gGL.getModelviewMatrix() * pos;      mPosition.set(glm::value_ptr(pos));  } @@ -808,7 +807,7 @@ void LLLightState::setSpotDirection(const LLVector3& direction)      ++gGL.mLightHash;      //transform direction by current modelview matrix -    glm::vec3 dir(glm::make_vec3(direction.mV)); +    glm::vec3 dir(direction);      const glm::mat3 mat(gGL.getModelviewMatrix());      dir = mat * dir; @@ -2106,12 +2105,14 @@ void set_last_projection(const glm::mat4& mat)  glm::vec3 mul_mat4_vec3(const glm::mat4& mat, const glm::vec3& vec)  { -    //const float w = vec[0] * mat[0][3] + vec[1] * mat[1][3] + vec[2] * mat[2][3] + mat[3][3]; -    //return glm::vec3( -    //    (vec[0] * mat[0][0] + vec[1] * mat[1][0] + vec[2] * mat[2][0] + mat[3][0]) / w, -    //    (vec[0] * mat[0][1] + vec[1] * mat[1][1] + vec[2] * mat[2][1] + mat[3][1]) / w, -    //    (vec[0] * mat[0][2] + vec[1] * mat[1][2] + vec[2] * mat[2][2] + mat[3][2]) / w -    //); +#if 1 // SIMD path results in strange crashes. Fall back to scalar for now. +    const float w = vec[0] * mat[0][3] + vec[1] * mat[1][3] + vec[2] * mat[2][3] + mat[3][3]; +    return glm::vec3( +       (vec[0] * mat[0][0] + vec[1] * mat[1][0] + vec[2] * mat[2][0] + mat[3][0]) / w, +       (vec[0] * mat[0][1] + vec[1] * mat[1][1] + vec[2] * mat[2][1] + mat[3][1]) / w, +       (vec[0] * mat[0][2] + vec[1] * mat[1][2] + vec[2] * mat[2][2] + mat[3][2]) / w +    ); +#else      LLVector4a x, y, z, s, t, p, q;      x.splat(vec.x); @@ -2141,4 +2142,5 @@ glm::vec3 mul_mat4_vec3(const glm::mat4& mat, const glm::vec3& vec)      res.setAdd(x, z);      res.div(q);      return glm::make_vec3(res.getF32ptr()); +#endif  } | 
