Merge pull request #3468 from secondlife/rye/forever-3339
Fall back mul_mat4_vec3 to scalar implementation to attempt crash mitigationmaster
commit
aa02a5b3f4
|
|
@ -33,6 +33,9 @@ class LLRotation;
|
|||
#include <assert.h>
|
||||
#include "llpreprocessor.h"
|
||||
#include "llmemory.h"
|
||||
#include "glm/vec3.hpp"
|
||||
#include "glm/vec4.hpp"
|
||||
#include "glm/gtc/type_ptr.hpp"
|
||||
|
||||
///////////////////////////////////
|
||||
// FIRST TIME USERS PLEASE READ
|
||||
|
|
@ -364,6 +367,16 @@ public:
|
|||
|
||||
inline operator LLQuad() const;
|
||||
|
||||
explicit inline operator glm::vec3() const
|
||||
{
|
||||
return glm::make_vec3(getF32ptr());
|
||||
};
|
||||
|
||||
explicit inline operator glm::vec4() const
|
||||
{
|
||||
return glm::make_vec4(getF32ptr());
|
||||
};
|
||||
|
||||
private:
|
||||
LLQuad mQ{};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -31,6 +31,11 @@
|
|||
#include "llmath.h"
|
||||
|
||||
#include "llsd.h"
|
||||
|
||||
#include "glm/vec3.hpp"
|
||||
#include "glm/vec4.hpp"
|
||||
#include "glm/gtc/type_ptr.hpp"
|
||||
|
||||
class LLVector2;
|
||||
class LLVector4;
|
||||
class LLVector4a;
|
||||
|
|
@ -66,6 +71,11 @@ class LLVector3
|
|||
explicit LLVector3(const LLVector4a& vec); // Initializes LLVector4 to (vec[0]. vec[1], vec[2])
|
||||
explicit LLVector3(const LLSD& sd);
|
||||
|
||||
// GLM interop
|
||||
explicit LLVector3(const glm::vec3& vec); // Initializes LLVector3 to (vec[0]. vec[1], vec[2])
|
||||
explicit LLVector3(const glm::vec4& vec); // Initializes LLVector3 to (vec[0]. vec[1], vec[2])
|
||||
explicit inline operator glm::vec3() const; // Initializes glm::vec3 to (vec[0]. vec[1], vec[2])
|
||||
explicit inline operator glm::vec4() const; // Initializes glm::vec4 to (vec[0]. vec[1], vec[2], 1)
|
||||
|
||||
LLSD getValue() const;
|
||||
|
||||
|
|
@ -92,6 +102,8 @@ class LLVector3
|
|||
inline void set(const F32 *vec); // Sets LLVector3 to vec
|
||||
const LLVector3& set(const LLVector4 &vec);
|
||||
const LLVector3& set(const LLVector3d &vec);// Sets LLVector3 to vec
|
||||
inline void set(const glm::vec4& vec); // Sets LLVector3 to vec
|
||||
inline void set(const glm::vec3& vec); // Sets LLVector3 to vec
|
||||
|
||||
inline void setVec(F32 x, F32 y, F32 z); // deprecated
|
||||
inline void setVec(const LLVector3 &vec); // deprecated
|
||||
|
|
@ -190,6 +202,20 @@ inline LLVector3::LLVector3(const F32 *vec)
|
|||
mV[VZ] = vec[VZ];
|
||||
}
|
||||
|
||||
inline LLVector3::LLVector3(const glm::vec3& vec)
|
||||
{
|
||||
mV[VX] = vec.x;
|
||||
mV[VY] = vec.y;
|
||||
mV[VZ] = vec.z;
|
||||
}
|
||||
|
||||
inline LLVector3::LLVector3(const glm::vec4& vec)
|
||||
{
|
||||
mV[VX] = vec.x;
|
||||
mV[VY] = vec.y;
|
||||
mV[VZ] = vec.z;
|
||||
}
|
||||
|
||||
/*
|
||||
inline LLVector3::LLVector3(const LLVector3 ©)
|
||||
{
|
||||
|
|
@ -259,6 +285,20 @@ inline void LLVector3::set(const F32 *vec)
|
|||
mV[2] = vec[2];
|
||||
}
|
||||
|
||||
inline void LLVector3::set(const glm::vec4& vec)
|
||||
{
|
||||
mV[VX] = vec.x;
|
||||
mV[VY] = vec.y;
|
||||
mV[VZ] = vec.z;
|
||||
}
|
||||
|
||||
inline void LLVector3::set(const glm::vec3& vec)
|
||||
{
|
||||
mV[VX] = vec.x;
|
||||
mV[VY] = vec.y;
|
||||
mV[VZ] = vec.z;
|
||||
}
|
||||
|
||||
// deprecated
|
||||
inline void LLVector3::setVec(F32 x, F32 y, F32 z)
|
||||
{
|
||||
|
|
@ -471,6 +511,17 @@ inline LLVector3 operator-(const LLVector3 &a)
|
|||
return LLVector3( -a.mV[0], -a.mV[1], -a.mV[2] );
|
||||
}
|
||||
|
||||
inline LLVector3::operator glm::vec3() const
|
||||
{
|
||||
// Do not use glm::make_vec3 it can result in a buffer overrun on some platforms due to glm::vec3 being a simd vector internally
|
||||
return glm::vec3(mV[VX], mV[VY], mV[VZ]);
|
||||
}
|
||||
|
||||
inline LLVector3::operator glm::vec4() const
|
||||
{
|
||||
return glm::vec4(mV[VX], mV[VY], mV[VZ], 1.f);
|
||||
}
|
||||
|
||||
inline F32 dist_vec(const LLVector3 &a, const LLVector3 &b)
|
||||
{
|
||||
F32 x = a.mV[0] - b.mV[0];
|
||||
|
|
|
|||
|
|
@ -32,6 +32,10 @@
|
|||
#include "v3math.h"
|
||||
#include "v2math.h"
|
||||
|
||||
#include "glm/vec3.hpp"
|
||||
#include "glm/vec4.hpp"
|
||||
#include "glm/gtc/type_ptr.hpp"
|
||||
|
||||
class LLMatrix3;
|
||||
class LLMatrix4;
|
||||
class LLQuaternion;
|
||||
|
|
@ -73,6 +77,11 @@ class LLVector4
|
|||
mV[3] = (F32)sd[3].asReal();
|
||||
}
|
||||
|
||||
// GLM interop
|
||||
explicit LLVector4(const glm::vec3& vec); // Initializes LLVector4 to (vec, 1)
|
||||
explicit LLVector4(const glm::vec4& vec); // Initializes LLVector4 to vec
|
||||
explicit operator glm::vec3() const; // Initializes glm::vec3 to (vec[0]. vec[1], vec[2])
|
||||
explicit operator glm::vec4() const; // Initializes glm::vec4 to (vec[0]. vec[1], vec[2], vec[3])
|
||||
|
||||
inline bool isFinite() const; // checks to see if all values of LLVector3 are finite
|
||||
|
||||
|
|
@ -85,6 +94,8 @@ class LLVector4
|
|||
inline void set(const LLVector4 &vec); // Sets LLVector4 to vec
|
||||
inline void set(const LLVector3 &vec, F32 w = 1.f); // Sets LLVector4 to LLVector3 vec
|
||||
inline void set(const F32 *vec); // Sets LLVector4 to vec
|
||||
inline void set(const glm::vec4& vec); // Sets LLVector4 to vec
|
||||
inline void set(const glm::vec3& vec, F32 w = 1.f); // Sets LLVector4 to LLVector3 vec with w defaulted to 1
|
||||
|
||||
inline void setVec(F32 x, F32 y, F32 z); // deprecated
|
||||
inline void setVec(F32 x, F32 y, F32 z, F32 w); // deprecated
|
||||
|
|
@ -223,6 +234,21 @@ inline LLVector4::LLVector4(const LLSD &sd)
|
|||
setValue(sd);
|
||||
}
|
||||
|
||||
inline LLVector4::LLVector4(const glm::vec3& vec)
|
||||
{
|
||||
mV[VX] = vec.x;
|
||||
mV[VY] = vec.y;
|
||||
mV[VZ] = vec.z;
|
||||
mV[VW] = 1.f;
|
||||
}
|
||||
|
||||
inline LLVector4::LLVector4(const glm::vec4& vec)
|
||||
{
|
||||
mV[VX] = vec.x;
|
||||
mV[VY] = vec.y;
|
||||
mV[VZ] = vec.z;
|
||||
mV[VW] = vec.w;
|
||||
}
|
||||
|
||||
inline bool LLVector4::isFinite() const
|
||||
{
|
||||
|
|
@ -297,6 +323,21 @@ inline void LLVector4::set(const F32 *vec)
|
|||
mV[VW] = vec[VW];
|
||||
}
|
||||
|
||||
inline void LLVector4::set(const glm::vec4& vec)
|
||||
{
|
||||
mV[VX] = vec.x;
|
||||
mV[VY] = vec.y;
|
||||
mV[VZ] = vec.z;
|
||||
mV[VW] = vec.w;
|
||||
}
|
||||
|
||||
inline void LLVector4::set(const glm::vec3& vec, F32 w)
|
||||
{
|
||||
mV[VX] = vec.x;
|
||||
mV[VY] = vec.y;
|
||||
mV[VZ] = vec.z;
|
||||
mV[VW] = w;
|
||||
}
|
||||
|
||||
// deprecated
|
||||
inline void LLVector4::setVec(F32 x, F32 y, F32 z)
|
||||
|
|
@ -466,6 +507,16 @@ inline LLVector4 operator-(const LLVector4 &a)
|
|||
return LLVector4( -a.mV[VX], -a.mV[VY], -a.mV[VZ] );
|
||||
}
|
||||
|
||||
inline LLVector4::operator glm::vec3() const
|
||||
{
|
||||
return glm::vec3(mV[VX], mV[VY], mV[VZ]);
|
||||
}
|
||||
|
||||
inline LLVector4::operator glm::vec4() const
|
||||
{
|
||||
return glm::make_vec4(mV);
|
||||
}
|
||||
|
||||
inline F32 dist_vec(const LLVector4 &a, const LLVector4 &b)
|
||||
{
|
||||
LLVector4 vec = a - b;
|
||||
|
|
|
|||
|
|
@ -737,9 +737,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));
|
||||
}
|
||||
|
||||
|
|
@ -794,7 +793,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;
|
||||
|
||||
|
|
@ -2088,12 +2087,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);
|
||||
|
|
@ -2123,4 +2124,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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -975,9 +975,9 @@ void renderAssetDebug(LLViewerObject* obj, Asset* asset)
|
|||
|
||||
LLVector4a t;
|
||||
agent_to_asset.affineTransform(gDebugRaycastStart, t);
|
||||
start = glm::make_vec4(t.getF32ptr());
|
||||
start = vec4(t);
|
||||
agent_to_asset.affineTransform(gDebugRaycastEnd, t);
|
||||
end = glm::make_vec4(t.getF32ptr());
|
||||
end = vec4(t);
|
||||
|
||||
start.w = end.w = 1.0;
|
||||
|
||||
|
|
|
|||
|
|
@ -472,9 +472,9 @@ bool LLGLTFPreviewTexture::render()
|
|||
|
||||
gPipeline.setupHWLights();
|
||||
glm::mat4 mat = get_current_modelview();
|
||||
glm::vec4 transformed_light_dir = glm::make_vec4(light_dir.mV);
|
||||
glm::vec4 transformed_light_dir(light_dir);
|
||||
transformed_light_dir = mat * transformed_light_dir;
|
||||
SetTemporarily<LLVector4> force_sun_direction_high_graphics(&gPipeline.mTransformedSunDir, LLVector4(glm::value_ptr(transformed_light_dir)));
|
||||
SetTemporarily<LLVector4> force_sun_direction_high_graphics(&gPipeline.mTransformedSunDir, LLVector4(transformed_light_dir));
|
||||
// Override lights to ensure the sun is always shining from a certain direction (low graphics)
|
||||
// See also force_sun_direction_high_graphics and fixup_shader_constants
|
||||
{
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent,
|
|||
LLRect world_view_rect = gViewerWindow->getWorldViewRectRaw();
|
||||
glm::ivec4 viewport(world_view_rect.mLeft, world_view_rect.mBottom, world_view_rect.getWidth(), world_view_rect.getHeight());
|
||||
|
||||
glm::vec3 win_coord = glm::project(glm::make_vec3(render_pos.mV), get_current_modelview(), get_current_projection(), viewport);
|
||||
glm::vec3 win_coord = glm::project(glm::vec3(render_pos), get_current_modelview(), get_current_projection(), viewport);
|
||||
|
||||
//fonts all render orthographically, set up projection``
|
||||
gGL.matrixMode(LLRender::MM_PROJECTION);
|
||||
|
|
|
|||
|
|
@ -660,11 +660,11 @@ void LLPanelPrimMediaControls::updateShape()
|
|||
for(; vert_it != vert_end; ++vert_it)
|
||||
{
|
||||
// project silhouette vertices into screen space
|
||||
glm::vec3 screen_vert(glm::make_vec3(vert_it->mV));
|
||||
glm::vec3 screen_vert(*vert_it);
|
||||
screen_vert = mul_mat4_vec3(mat, screen_vert);
|
||||
|
||||
// add to screenspace bounding box
|
||||
update_min_max(min, max, LLVector3(glm::value_ptr(screen_vert)));
|
||||
update_min_max(min, max, LLVector3(screen_vert));
|
||||
}
|
||||
|
||||
// convert screenspace bbox to pixels (in screen coords)
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ bool LLReflectionMap::getBox(LLMatrix4& box)
|
|||
glm::mat4 mv(get_current_modelview());
|
||||
LLVector3 s = mViewerObject->getScale().scaledVec(LLVector3(0.5f, 0.5f, 0.5f));
|
||||
mRadius = s.magVec();
|
||||
glm::mat4 scale = glm::scale(glm::make_vec3(s.mV));
|
||||
glm::mat4 scale = glm::scale(glm::vec3(s));
|
||||
if (mViewerObject->mDrawable != nullptr)
|
||||
{
|
||||
// object to agent space (no scale)
|
||||
|
|
|
|||
|
|
@ -1093,8 +1093,8 @@ void LLSettingsVOWater::applySpecial(void *ptarget, bool force)
|
|||
|
||||
LLVector4 waterPlane(enorm.x, enorm.y, enorm.z, -glm::dot(ep, enorm));
|
||||
|
||||
norm = glm::make_vec3(gPipeline.mHeroProbeManager.mMirrorNormal.mV);
|
||||
p = glm::make_vec3(gPipeline.mHeroProbeManager.mMirrorPosition.mV);
|
||||
norm = glm::vec3(gPipeline.mHeroProbeManager.mMirrorNormal);
|
||||
p = glm::vec3(gPipeline.mHeroProbeManager.mMirrorPosition);
|
||||
enorm = mul_mat4_vec3(invtrans, norm);
|
||||
enorm = glm::normalize(enorm);
|
||||
ep = mul_mat4_vec3(mat, p);
|
||||
|
|
|
|||
|
|
@ -420,7 +420,7 @@ bool LLViewerCamera::projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoord
|
|||
|
||||
LLRect world_view_rect = gViewerWindow->getWorldViewRectRaw();
|
||||
glm::ivec4 viewport(world_view_rect.mLeft, world_view_rect.mBottom, world_view_rect.getWidth(), world_view_rect.getHeight());
|
||||
glm::vec3 win_coord = glm::project(glm::make_vec3(pos_agent.mV), get_current_modelview(), get_current_projection(), viewport);
|
||||
glm::vec3 win_coord = glm::project(glm::vec3(pos_agent), get_current_modelview(), get_current_projection(), viewport);
|
||||
|
||||
{
|
||||
// convert screen coordinates to virtual UI coordinates
|
||||
|
|
@ -514,7 +514,7 @@ bool LLViewerCamera::projectPosAgentToScreenEdge(const LLVector3 &pos_agent,
|
|||
LLRect world_view_rect = gViewerWindow->getWorldViewRectRaw();
|
||||
|
||||
glm::ivec4 viewport(world_view_rect.mLeft, world_view_rect.mBottom, world_view_rect.getWidth(), world_view_rect.getHeight());
|
||||
glm::vec3 win_coord = glm::project(glm::make_vec3(pos_agent.mV), get_current_modelview(), get_current_projection(), viewport);
|
||||
glm::vec3 win_coord = glm::project(glm::vec3(pos_agent), get_current_modelview(), get_current_projection(), viewport);
|
||||
|
||||
{
|
||||
win_coord.x /= gViewerWindow->getDisplayScale().mV[VX];
|
||||
|
|
|
|||
|
|
@ -1928,8 +1928,8 @@ bool LLVOAvatar::lineSegmentIntersect(const LLVector4a& start, const LLVector4a&
|
|||
glm::mat4 inverse = glm::inverse(mat);
|
||||
glm::mat4 norm_mat = glm::transpose(inverse);
|
||||
|
||||
glm::vec3 p1(glm::make_vec3(start.getF32ptr()));
|
||||
glm::vec3 p2(glm::make_vec3(end.getF32ptr()));
|
||||
glm::vec3 p1(start);
|
||||
glm::vec3 p2(end);
|
||||
|
||||
p1 = mul_mat4_vec3(inverse, p1);
|
||||
p2 = mul_mat4_vec3(inverse, p2);
|
||||
|
|
@ -1937,12 +1937,12 @@ bool LLVOAvatar::lineSegmentIntersect(const LLVector4a& start, const LLVector4a&
|
|||
LLVector3 position;
|
||||
LLVector3 norm;
|
||||
|
||||
if (linesegment_sphere(LLVector3(glm::value_ptr(p1)), LLVector3(glm::value_ptr(p2)), LLVector3(0,0,0), 1.f, position, norm))
|
||||
if (linesegment_sphere(LLVector3(p1), LLVector3(p2), LLVector3(0,0,0), 1.f, position, norm))
|
||||
{
|
||||
glm::vec3 res_pos(glm::make_vec3(position.mV));
|
||||
glm::vec3 res_pos(position);
|
||||
res_pos = mul_mat4_vec3(mat, res_pos);
|
||||
|
||||
glm::vec3 res_norm(glm::make_vec3(norm.mV));
|
||||
glm::vec3 res_norm(norm);
|
||||
res_norm = glm::normalize(res_norm);
|
||||
res_norm = glm::mat3(norm_mat) * res_norm;
|
||||
|
||||
|
|
|
|||
|
|
@ -8396,13 +8396,13 @@ void LLPipeline::renderDeferredLighting()
|
|||
|
||||
setupHWLights(); // to set mSun/MoonDir;
|
||||
|
||||
glm::vec4 tc(glm::make_vec4(mSunDir.mV));
|
||||
glm::vec4 tc(mSunDir);
|
||||
tc = mat * tc;
|
||||
mTransformedSunDir.set(glm::value_ptr(tc));
|
||||
mTransformedSunDir.set(tc);
|
||||
|
||||
glm::vec4 tc_moon(glm::make_vec4(mMoonDir.mV));
|
||||
glm::vec4 tc_moon(mMoonDir);
|
||||
tc_moon = mat * tc_moon;
|
||||
mTransformedMoonDir.set(glm::value_ptr(tc_moon));
|
||||
mTransformedMoonDir.set(tc_moon);
|
||||
|
||||
if ((RenderDeferredSSAO && !gCubeSnapshot) || RenderShadowDetail > 0)
|
||||
{
|
||||
|
|
@ -8655,7 +8655,7 @@ void LLPipeline::renderDeferredLighting()
|
|||
continue;
|
||||
}
|
||||
|
||||
glm::vec3 tc(glm::make_vec3(c));
|
||||
glm::vec3 tc(center);
|
||||
tc = mul_mat4_vec3(mat, tc);
|
||||
|
||||
fullscreen_lights.push_back(LLVector4(tc.x, tc.y, tc.z, s));
|
||||
|
|
@ -8762,13 +8762,12 @@ void LLPipeline::renderDeferredLighting()
|
|||
LLDrawable* drawablep = *iter;
|
||||
LLVOVolume* volume = drawablep->getVOVolume();
|
||||
LLVector3 center = drawablep->getPositionAgent();
|
||||
F32* c = center.mV;
|
||||
F32 light_size_final = volume->getLightRadius() * 1.5f;
|
||||
F32 light_falloff_final = volume->getLightFalloff(DEFERRED_LIGHT_FALLOFF);
|
||||
|
||||
sVisibleLightCount++;
|
||||
|
||||
glm::vec3 tc(glm::make_vec3(c));
|
||||
glm::vec3 tc(center);
|
||||
tc = mul_mat4_vec3(mat, tc);
|
||||
|
||||
setupSpotLight(gDeferredMultiSpotLightProgram, drawablep);
|
||||
|
|
@ -9903,10 +9902,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
|
|||
LLVector3 lightDir = -caster_dir;
|
||||
lightDir.normVec();
|
||||
|
||||
glm::vec3 light_dir(glm::make_vec3(lightDir.mV));
|
||||
|
||||
//create light space camera matrix
|
||||
|
||||
LLVector3 at = lightDir;
|
||||
|
||||
LLVector3 up = camera.getAtAxis();
|
||||
|
|
@ -9958,9 +9954,9 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
|
|||
//get good split distances for frustum
|
||||
for (U32 i = 0; i < fp.size(); ++i)
|
||||
{
|
||||
glm::vec3 v(glm::make_vec3(fp[i].mV));
|
||||
glm::vec3 v(fp[i]);
|
||||
v = mul_mat4_vec3(saved_view, v);
|
||||
fp[i].setVec(glm::value_ptr(v));
|
||||
fp[i] = LLVector3(v);
|
||||
}
|
||||
|
||||
min = fp[0];
|
||||
|
|
@ -10109,9 +10105,9 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
|
|||
|
||||
for (U32 i = 0; i < fp.size(); i++)
|
||||
{
|
||||
glm::vec3 p = glm::make_vec3(fp[i].mV);
|
||||
glm::vec3 p(fp[i]);
|
||||
p = mul_mat4_vec3(view[j], p);
|
||||
wpf.push_back(LLVector3(glm::value_ptr(p)));
|
||||
wpf.push_back(LLVector3(p));
|
||||
}
|
||||
|
||||
min = wpf[0];
|
||||
|
|
@ -10312,19 +10308,19 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
|
|||
view[j] = glm::inverse(view[j]);
|
||||
//llassert(origin.isFinite());
|
||||
|
||||
glm::vec3 origin_agent(glm::make_vec3(origin.mV));
|
||||
glm::vec3 origin_agent(origin);
|
||||
|
||||
//translate view to origin
|
||||
origin_agent = mul_mat4_vec3(view[j], origin_agent);
|
||||
|
||||
eye = LLVector3(glm::value_ptr(origin_agent));
|
||||
eye = LLVector3(origin_agent);
|
||||
//llassert(eye.isFinite());
|
||||
if (!hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot)
|
||||
{
|
||||
mShadowFrustOrigin[j] = eye;
|
||||
}
|
||||
|
||||
view[j] = look(LLVector3(glm::value_ptr(origin_agent)), lightDir, -up);
|
||||
view[j] = look(LLVector3(origin_agent), lightDir, -up);
|
||||
|
||||
F32 fx = 1.f/tanf(fovx);
|
||||
F32 fz = 1.f/tanf(fovz);
|
||||
|
|
|
|||
Loading…
Reference in New Issue