Integrate SIMD API from oreh/server-trunk-oreh
parent
bd0b3a2dde
commit
2fea1d5d33
|
|
@ -68,6 +68,7 @@ if (WINDOWS)
|
|||
|
||||
add_definitions(
|
||||
/Zc:wchar_t-
|
||||
/arch:SSE2
|
||||
)
|
||||
endif (MSVC80 OR MSVC90)
|
||||
|
||||
|
|
|
|||
|
|
@ -1151,7 +1151,7 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8
|
|||
constraint->mPositions[joint_num] = new_pos;
|
||||
}
|
||||
constraint->mFixupDistanceRMS *= 1.f / (constraint->mTotalLength * (F32)(shared_data->mChainLength - 1));
|
||||
constraint->mFixupDistanceRMS = fsqrtf(constraint->mFixupDistanceRMS);
|
||||
constraint->mFixupDistanceRMS = (F32) sqrt(constraint->mFixupDistanceRMS);
|
||||
|
||||
//reset old joint rots
|
||||
for (joint_num = 0; joint_num <= shared_data->mChainLength; joint_num++)
|
||||
|
|
|
|||
|
|
@ -1,118 +1,128 @@
|
|||
# -*- cmake -*-
|
||||
|
||||
project(llmath)
|
||||
|
||||
include(00-Common)
|
||||
include(LLCommon)
|
||||
|
||||
include_directories(
|
||||
${LLCOMMON_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
set(llmath_SOURCE_FILES
|
||||
llbbox.cpp
|
||||
llbboxlocal.cpp
|
||||
llcamera.cpp
|
||||
llcoordframe.cpp
|
||||
llline.cpp
|
||||
llmodularmath.cpp
|
||||
llperlin.cpp
|
||||
llquaternion.cpp
|
||||
llrect.cpp
|
||||
llsphere.cpp
|
||||
llvolume.cpp
|
||||
llvolumemgr.cpp
|
||||
llvolumeoctree.cpp
|
||||
llsdutil_math.cpp
|
||||
m3math.cpp
|
||||
m4math.cpp
|
||||
raytrace.cpp
|
||||
v2math.cpp
|
||||
v3color.cpp
|
||||
v3dmath.cpp
|
||||
v3math.cpp
|
||||
v4color.cpp
|
||||
v4coloru.cpp
|
||||
v4math.cpp
|
||||
xform.cpp
|
||||
)
|
||||
|
||||
set(llmath_HEADER_FILES
|
||||
CMakeLists.txt
|
||||
|
||||
camera.h
|
||||
coordframe.h
|
||||
llbbox.h
|
||||
llbboxlocal.h
|
||||
llcamera.h
|
||||
llcoord.h
|
||||
llcoordframe.h
|
||||
llinterp.h
|
||||
llline.h
|
||||
llmath.h
|
||||
llmodularmath.h
|
||||
lloctree.h
|
||||
llperlin.h
|
||||
llplane.h
|
||||
llquantize.h
|
||||
llquaternion.h
|
||||
llrect.h
|
||||
llsphere.h
|
||||
lltreenode.h
|
||||
llv4math.h
|
||||
llv4matrix3.h
|
||||
llv4matrix4.h
|
||||
llv4vector3.h
|
||||
llvector4a.h
|
||||
llmatrix4a.h
|
||||
llvolume.h
|
||||
llvolumemgr.h
|
||||
llvolumeoctree.h
|
||||
llsdutil_math.h
|
||||
m3math.h
|
||||
m4math.h
|
||||
raytrace.h
|
||||
v2math.h
|
||||
v3color.h
|
||||
v3dmath.h
|
||||
v3math.h
|
||||
v4color.h
|
||||
v4coloru.h
|
||||
v4math.h
|
||||
xform.h
|
||||
)
|
||||
|
||||
set_source_files_properties(${llmath_HEADER_FILES}
|
||||
PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
|
||||
list(APPEND llmath_SOURCE_FILES ${llmath_HEADER_FILES})
|
||||
|
||||
add_library (llmath ${llmath_SOURCE_FILES})
|
||||
|
||||
# Add tests
|
||||
if (LL_TESTS)
|
||||
include(LLAddBuildTest)
|
||||
# UNIT TESTS
|
||||
SET(llmath_TEST_SOURCE_FILES
|
||||
llbboxlocal.cpp
|
||||
llmodularmath.cpp
|
||||
llrect.cpp
|
||||
v2math.cpp
|
||||
v3color.cpp
|
||||
v4color.cpp
|
||||
v4coloru.cpp
|
||||
)
|
||||
LL_ADD_PROJECT_UNIT_TESTS(llmath "${llmath_TEST_SOURCE_FILES}")
|
||||
|
||||
# INTEGRATION TESTS
|
||||
set(test_libs llmath llcommon ${LLCOMMON_LIBRARIES} ${WINDOWS_LIBRARIES})
|
||||
# TODO: Some of these need refactoring to be proper Unit tests rather than Integration tests.
|
||||
LL_ADD_INTEGRATION_TEST(llbbox llbbox.cpp "${test_libs}")
|
||||
LL_ADD_INTEGRATION_TEST(llquaternion llquaternion.cpp "${test_libs}")
|
||||
LL_ADD_INTEGRATION_TEST(mathmisc "" "${test_libs}")
|
||||
LL_ADD_INTEGRATION_TEST(m3math "" "${test_libs}")
|
||||
LL_ADD_INTEGRATION_TEST(v3dmath v3dmath.cpp "${test_libs}")
|
||||
LL_ADD_INTEGRATION_TEST(v3math v3math.cpp "${test_libs}")
|
||||
LL_ADD_INTEGRATION_TEST(v4math v4math.cpp "${test_libs}")
|
||||
LL_ADD_INTEGRATION_TEST(xform xform.cpp "${test_libs}")
|
||||
endif (LL_TESTS)
|
||||
# -*- cmake -*-
|
||||
|
||||
project(llmath)
|
||||
|
||||
include(00-Common)
|
||||
include(LLCommon)
|
||||
|
||||
include_directories(
|
||||
${LLCOMMON_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
set(llmath_SOURCE_FILES
|
||||
llbbox.cpp
|
||||
llbboxlocal.cpp
|
||||
llcamera.cpp
|
||||
llcoordframe.cpp
|
||||
llline.cpp
|
||||
llmatrix3a.cpp
|
||||
llmodularmath.cpp
|
||||
llperlin.cpp
|
||||
llquaternion.cpp
|
||||
llrect.cpp
|
||||
llsphere.cpp
|
||||
llvector4a.cpp
|
||||
llvolume.cpp
|
||||
llvolumemgr.cpp
|
||||
llvolumeoctree.cpp
|
||||
llsdutil_math.cpp
|
||||
m3math.cpp
|
||||
m4math.cpp
|
||||
raytrace.cpp
|
||||
v2math.cpp
|
||||
v3color.cpp
|
||||
v3dmath.cpp
|
||||
v3math.cpp
|
||||
v4color.cpp
|
||||
v4coloru.cpp
|
||||
v4math.cpp
|
||||
xform.cpp
|
||||
)
|
||||
|
||||
set(llmath_HEADER_FILES
|
||||
CMakeLists.txt
|
||||
|
||||
camera.h
|
||||
coordframe.h
|
||||
llbbox.h
|
||||
llbboxlocal.h
|
||||
llcamera.h
|
||||
llcoord.h
|
||||
llcoordframe.h
|
||||
llinterp.h
|
||||
llline.h
|
||||
llmath.h
|
||||
llmatrix3a.h
|
||||
llmatrix3a.inl
|
||||
llmodularmath.h
|
||||
lloctree.h
|
||||
llperlin.h
|
||||
llplane.h
|
||||
llquantize.h
|
||||
llquaternion.h
|
||||
llquaternion2.h
|
||||
llquaternion2.inl
|
||||
llrect.h
|
||||
llsimdmath.h
|
||||
llsimdtypes.h
|
||||
llsimdtypes.inl
|
||||
llsphere.h
|
||||
lltreenode.h
|
||||
llvector4a.h
|
||||
llvector4a.inl
|
||||
llvector4logical.h
|
||||
llv4math.h
|
||||
llv4matrix3.h
|
||||
llv4matrix4.h
|
||||
llv4vector3.h
|
||||
llvolume.h
|
||||
llvolumemgr.h
|
||||
llvolumeoctree.h
|
||||
llsdutil_math.h
|
||||
m3math.h
|
||||
m4math.h
|
||||
raytrace.h
|
||||
v2math.h
|
||||
v3color.h
|
||||
v3dmath.h
|
||||
v3math.h
|
||||
v4color.h
|
||||
v4coloru.h
|
||||
v4math.h
|
||||
xform.h
|
||||
)
|
||||
|
||||
set_source_files_properties(${llmath_HEADER_FILES}
|
||||
PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
|
||||
list(APPEND llmath_SOURCE_FILES ${llmath_HEADER_FILES})
|
||||
|
||||
add_library (llmath ${llmath_SOURCE_FILES})
|
||||
|
||||
# Add tests
|
||||
if (LL_TESTS)
|
||||
include(LLAddBuildTest)
|
||||
# UNIT TESTS
|
||||
SET(llmath_TEST_SOURCE_FILES
|
||||
llbboxlocal.cpp
|
||||
llmodularmath.cpp
|
||||
llrect.cpp
|
||||
v2math.cpp
|
||||
v3color.cpp
|
||||
v4color.cpp
|
||||
v4coloru.cpp
|
||||
)
|
||||
LL_ADD_PROJECT_UNIT_TESTS(llmath "${llmath_TEST_SOURCE_FILES}")
|
||||
|
||||
# INTEGRATION TESTS
|
||||
set(test_libs llmath llcommon ${LLCOMMON_LIBRARIES} ${WINDOWS_LIBRARIES})
|
||||
# TODO: Some of these need refactoring to be proper Unit tests rather than Integration tests.
|
||||
LL_ADD_INTEGRATION_TEST(llbbox llbbox.cpp "${test_libs}")
|
||||
LL_ADD_INTEGRATION_TEST(llquaternion llquaternion.cpp "${test_libs}")
|
||||
LL_ADD_INTEGRATION_TEST(mathmisc "" "${test_libs}")
|
||||
LL_ADD_INTEGRATION_TEST(m3math "" "${test_libs}")
|
||||
LL_ADD_INTEGRATION_TEST(v3dmath v3dmath.cpp "${test_libs}")
|
||||
LL_ADD_INTEGRATION_TEST(v3math v3math.cpp "${test_libs}")
|
||||
LL_ADD_INTEGRATION_TEST(v4math v4math.cpp "${test_libs}")
|
||||
LL_ADD_INTEGRATION_TEST(xform xform.cpp "${test_libs}")
|
||||
endif (LL_TESTS)
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ const LLCamera& LLCamera::operator=(const LLCamera& rhs)
|
|||
{
|
||||
memcpy(this, &rhs, sizeof(LLCamera));
|
||||
alignPlanes();
|
||||
LLVector4a::memcpyNonAliased16((F32*) mAgentPlanes, (F32*) rhs.mAgentPlanes, 4*7);
|
||||
LLVector4a::memcpyNonAliased16((F32*) mAgentPlanes, (F32*) rhs.mAgentPlanes, 4*7*sizeof(F32));
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -142,7 +142,7 @@ public:
|
|||
|
||||
S32 getOctant(const LLVector4a& pos) const //get the octant pos is in
|
||||
{
|
||||
return pos.greaterThan4(mD[CENTER]).getComparisonMask() & 0x7;
|
||||
return pos.greaterThan(mD[CENTER]).getGatheredBits() & 0x7;
|
||||
}
|
||||
|
||||
inline bool isInside(const LLVector4a& pos, const F32& rad) const
|
||||
|
|
@ -157,13 +157,13 @@ public:
|
|||
|
||||
bool isInside(const LLVector4a& pos) const
|
||||
{
|
||||
S32 gt = pos.greaterThan4(mD[MAX]).getComparisonMask() & 0x7;
|
||||
S32 gt = pos.greaterThan(mD[MAX]).getGatheredBits() & 0x7;
|
||||
if (gt)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
S32 lt = pos.lessEqual4(mD[MIN]).getComparisonMask() & 0x7;
|
||||
S32 lt = pos.lessEqual(mD[MIN]).getGatheredBits() & 0x7;
|
||||
if (lt)
|
||||
{
|
||||
return false;
|
||||
|
|
@ -206,13 +206,13 @@ public:
|
|||
{
|
||||
const LLVector4a& pos = data->getPositionGroup();
|
||||
|
||||
LLVector4a gt = pos.greaterThan4(center);
|
||||
LLVector4a gt = pos.greaterThan(center);
|
||||
|
||||
LLVector4a up;
|
||||
up.mQ = _mm_and_ps(size.mQ, gt.mQ);
|
||||
up = _mm_and_ps(size, gt);
|
||||
|
||||
LLVector4a down;
|
||||
down.mQ = _mm_andnot_ps(gt.mQ, size.mQ);
|
||||
down = _mm_andnot_ps(gt, size);
|
||||
|
||||
center.add(up);
|
||||
center.sub(down);
|
||||
|
|
@ -326,9 +326,8 @@ public:
|
|||
LLVector4a val;
|
||||
val.setSub(center, getCenter());
|
||||
val.setAbs(val);
|
||||
LLVector4a app_zero;
|
||||
app_zero.mQ = F_APPROXIMATELY_ZERO_4A;
|
||||
S32 lt = val.lessThan4(app_zero).getComparisonMask() & 0x7;
|
||||
|
||||
S32 lt = val.lessThan(LLVector4a::getEpsilon()).getGatheredBits() & 0x7;
|
||||
|
||||
if( lt == 0x7 )
|
||||
{
|
||||
|
|
@ -642,7 +641,7 @@ public:
|
|||
LLVector4a val;
|
||||
val.setSub(v, BaseType::mD[BaseType::CENTER]);
|
||||
val.setAbs(val);
|
||||
S32 lt = val.lessThan4(MAX_MAG).getComparisonMask() & 0x7;
|
||||
S32 lt = val.lessThan(MAX_MAG).getGatheredBits() & 0x7;
|
||||
|
||||
if (lt != 0x7)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,152 +1,158 @@
|
|||
/**
|
||||
* @file llquantize.h
|
||||
* @brief useful routines for quantizing floats to various length ints
|
||||
* and back out again
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2001-2009, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#ifndef LL_LLQUANTIZE_H
|
||||
#define LL_LLQUANTIZE_H
|
||||
|
||||
const U16 U16MAX = 65535;
|
||||
const F32 OOU16MAX = 1.f/(F32)(U16MAX);
|
||||
|
||||
const U8 U8MAX = 255;
|
||||
const F32 OOU8MAX = 1.f/(F32)(U8MAX);
|
||||
|
||||
const U8 FIRSTVALIDCHAR = 54;
|
||||
const U8 MAXSTRINGVAL = U8MAX - FIRSTVALIDCHAR; //we don't allow newline or null
|
||||
|
||||
|
||||
inline U16 F32_to_U16_ROUND(F32 val, F32 lower, F32 upper)
|
||||
{
|
||||
val = llclamp(val, lower, upper);
|
||||
// make sure that the value is positive and normalized to <0, 1>
|
||||
val -= lower;
|
||||
val /= (upper - lower);
|
||||
|
||||
// round the value. Sreturn the U16
|
||||
return (U16)(llround(val*U16MAX));
|
||||
}
|
||||
|
||||
|
||||
inline U16 F32_to_U16(F32 val, F32 lower, F32 upper)
|
||||
{
|
||||
val = llclamp(val, lower, upper);
|
||||
// make sure that the value is positive and normalized to <0, 1>
|
||||
val -= lower;
|
||||
val /= (upper - lower);
|
||||
|
||||
// return the U16
|
||||
return (U16)(llfloor(val*U16MAX));
|
||||
}
|
||||
|
||||
inline F32 U16_to_F32(U16 ival, F32 lower, F32 upper)
|
||||
{
|
||||
F32 val = ival*OOU16MAX;
|
||||
F32 delta = (upper - lower);
|
||||
val *= delta;
|
||||
val += lower;
|
||||
|
||||
F32 max_error = delta*OOU16MAX;
|
||||
|
||||
// make sure that zero's come through as zero
|
||||
if (fabsf(val) < max_error)
|
||||
val = 0.f;
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
inline U8 F32_to_U8_ROUND(F32 val, F32 lower, F32 upper)
|
||||
{
|
||||
val = llclamp(val, lower, upper);
|
||||
// make sure that the value is positive and normalized to <0, 1>
|
||||
val -= lower;
|
||||
val /= (upper - lower);
|
||||
|
||||
// return the rounded U8
|
||||
return (U8)(llround(val*U8MAX));
|
||||
}
|
||||
|
||||
|
||||
inline U8 F32_to_U8(F32 val, F32 lower, F32 upper)
|
||||
{
|
||||
val = llclamp(val, lower, upper);
|
||||
// make sure that the value is positive and normalized to <0, 1>
|
||||
val -= lower;
|
||||
val /= (upper - lower);
|
||||
|
||||
// return the U8
|
||||
return (U8)(llfloor(val*U8MAX));
|
||||
}
|
||||
|
||||
inline F32 U8_to_F32(U8 ival, F32 lower, F32 upper)
|
||||
{
|
||||
F32 val = ival*OOU8MAX;
|
||||
F32 delta = (upper - lower);
|
||||
val *= delta;
|
||||
val += lower;
|
||||
|
||||
F32 max_error = delta*OOU8MAX;
|
||||
|
||||
// make sure that zero's come through as zero
|
||||
if (fabsf(val) < max_error)
|
||||
val = 0.f;
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
inline U8 F32_TO_STRING(F32 val, F32 lower, F32 upper)
|
||||
{
|
||||
val = llclamp(val, lower, upper); //[lower, upper]
|
||||
// make sure that the value is positive and normalized to <0, 1>
|
||||
val -= lower; //[0, upper-lower]
|
||||
val /= (upper - lower); //[0,1]
|
||||
val = val * MAXSTRINGVAL; //[0, MAXSTRINGVAL]
|
||||
val = floor(val + 0.5f); //[0, MAXSTRINGVAL]
|
||||
|
||||
U8 stringVal = (U8)(val) + FIRSTVALIDCHAR; //[FIRSTVALIDCHAR, MAXSTRINGVAL + FIRSTVALIDCHAR]
|
||||
return stringVal;
|
||||
}
|
||||
|
||||
inline F32 STRING_TO_F32(U8 ival, F32 lower, F32 upper)
|
||||
{
|
||||
// remove empty space left for NULL, newline, etc.
|
||||
ival -= FIRSTVALIDCHAR; //[0, MAXSTRINGVAL]
|
||||
|
||||
F32 val = (F32)ival * (1.f / (F32)MAXSTRINGVAL); //[0, 1]
|
||||
F32 delta = (upper - lower);
|
||||
val *= delta; //[0, upper - lower]
|
||||
val += lower; //[lower, upper]
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
#endif
|
||||
/**
|
||||
* @file llquantize.h
|
||||
* @brief useful routines for quantizing floats to various length ints
|
||||
* and back out again
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2001-2009, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#ifndef LL_LLQUANTIZE_H
|
||||
#define LL_LLQUANTIZE_H
|
||||
|
||||
const U16 U16MAX = 65535;
|
||||
LL_ALIGN_16( const F32 F_U16MAX_4A[4] ) = { 65535.f, 65535.f, 65535.f, 65535.f };
|
||||
|
||||
const F32 OOU16MAX = 1.f/(F32)(U16MAX);
|
||||
LL_ALIGN_16( const F32 F_OOU16MAX_4A[4] ) = { OOU16MAX, OOU16MAX, OOU16MAX, OOU16MAX };
|
||||
|
||||
const U8 U8MAX = 255;
|
||||
LL_ALIGN_16( const F32 F_U8MAX_4A[4] ) = { 255.f, 255.f, 255.f, 255.f };
|
||||
|
||||
const F32 OOU8MAX = 1.f/(F32)(U8MAX);
|
||||
LL_ALIGN_16( const F32 F_OOU8MAX_4A[4] ) = { OOU8MAX, OOU8MAX, OOU8MAX, OOU8MAX };
|
||||
|
||||
const U8 FIRSTVALIDCHAR = 54;
|
||||
const U8 MAXSTRINGVAL = U8MAX - FIRSTVALIDCHAR; //we don't allow newline or null
|
||||
|
||||
|
||||
inline U16 F32_to_U16_ROUND(F32 val, F32 lower, F32 upper)
|
||||
{
|
||||
val = llclamp(val, lower, upper);
|
||||
// make sure that the value is positive and normalized to <0, 1>
|
||||
val -= lower;
|
||||
val /= (upper - lower);
|
||||
|
||||
// round the value. Sreturn the U16
|
||||
return (U16)(llround(val*U16MAX));
|
||||
}
|
||||
|
||||
|
||||
inline U16 F32_to_U16(F32 val, F32 lower, F32 upper)
|
||||
{
|
||||
val = llclamp(val, lower, upper);
|
||||
// make sure that the value is positive and normalized to <0, 1>
|
||||
val -= lower;
|
||||
val /= (upper - lower);
|
||||
|
||||
// return the U16
|
||||
return (U16)(llfloor(val*U16MAX));
|
||||
}
|
||||
|
||||
inline F32 U16_to_F32(U16 ival, F32 lower, F32 upper)
|
||||
{
|
||||
F32 val = ival*OOU16MAX;
|
||||
F32 delta = (upper - lower);
|
||||
val *= delta;
|
||||
val += lower;
|
||||
|
||||
F32 max_error = delta*OOU16MAX;
|
||||
|
||||
// make sure that zero's come through as zero
|
||||
if (fabsf(val) < max_error)
|
||||
val = 0.f;
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
inline U8 F32_to_U8_ROUND(F32 val, F32 lower, F32 upper)
|
||||
{
|
||||
val = llclamp(val, lower, upper);
|
||||
// make sure that the value is positive and normalized to <0, 1>
|
||||
val -= lower;
|
||||
val /= (upper - lower);
|
||||
|
||||
// return the rounded U8
|
||||
return (U8)(llround(val*U8MAX));
|
||||
}
|
||||
|
||||
|
||||
inline U8 F32_to_U8(F32 val, F32 lower, F32 upper)
|
||||
{
|
||||
val = llclamp(val, lower, upper);
|
||||
// make sure that the value is positive and normalized to <0, 1>
|
||||
val -= lower;
|
||||
val /= (upper - lower);
|
||||
|
||||
// return the U8
|
||||
return (U8)(llfloor(val*U8MAX));
|
||||
}
|
||||
|
||||
inline F32 U8_to_F32(U8 ival, F32 lower, F32 upper)
|
||||
{
|
||||
F32 val = ival*OOU8MAX;
|
||||
F32 delta = (upper - lower);
|
||||
val *= delta;
|
||||
val += lower;
|
||||
|
||||
F32 max_error = delta*OOU8MAX;
|
||||
|
||||
// make sure that zero's come through as zero
|
||||
if (fabsf(val) < max_error)
|
||||
val = 0.f;
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
inline U8 F32_TO_STRING(F32 val, F32 lower, F32 upper)
|
||||
{
|
||||
val = llclamp(val, lower, upper); //[lower, upper]
|
||||
// make sure that the value is positive and normalized to <0, 1>
|
||||
val -= lower; //[0, upper-lower]
|
||||
val /= (upper - lower); //[0,1]
|
||||
val = val * MAXSTRINGVAL; //[0, MAXSTRINGVAL]
|
||||
val = floor(val + 0.5f); //[0, MAXSTRINGVAL]
|
||||
|
||||
U8 stringVal = (U8)(val) + FIRSTVALIDCHAR; //[FIRSTVALIDCHAR, MAXSTRINGVAL + FIRSTVALIDCHAR]
|
||||
return stringVal;
|
||||
}
|
||||
|
||||
inline F32 STRING_TO_F32(U8 ival, F32 lower, F32 upper)
|
||||
{
|
||||
// remove empty space left for NULL, newline, etc.
|
||||
ival -= FIRSTVALIDCHAR; //[0, MAXSTRINGVAL]
|
||||
|
||||
F32 val = (F32)ival * (1.f / (F32)MAXSTRINGVAL); //[0, 1]
|
||||
F32 delta = (upper - lower);
|
||||
val *= delta; //[0, upper - lower]
|
||||
val += lower; //[lower, upper]
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -45,7 +45,7 @@
|
|||
#include "v4math.h"
|
||||
#include "m4math.h"
|
||||
#include "m3math.h"
|
||||
#include "llmatrix4a.h"
|
||||
#include "llmatrix3a.h"
|
||||
#include "lloctree.h"
|
||||
#include "lldarray.h"
|
||||
#include "llvolume.h"
|
||||
|
|
@ -53,6 +53,7 @@
|
|||
#include "llstl.h"
|
||||
#include "llsdserialize.h"
|
||||
#include "llvector4a.h"
|
||||
#include "llmatrix4a.h"
|
||||
|
||||
#define DEBUG_SILHOUETTE_BINORMALS 0
|
||||
#define DEBUG_SILHOUETTE_NORMALS 0 // TomY: Use this to display normals using the silhouette
|
||||
|
|
@ -161,7 +162,7 @@ BOOL LLTriangleRayIntersect(const LLVector4a& vert0, const LLVector4a& vert1, co
|
|||
LLVector4a det;
|
||||
det.setAllDot3(edge1, pvec);
|
||||
|
||||
if (det.greaterEqual4(LLVector4a::getApproximatelyZero()).getComparisonMask() & 0x7)
|
||||
if (det.greaterEqual(LLVector4a::getEpsilon()).getGatheredBits() & 0x7)
|
||||
{
|
||||
/* calculate distance from vert0 to ray origin */
|
||||
LLVector4a tvec;
|
||||
|
|
@ -171,8 +172,8 @@ BOOL LLTriangleRayIntersect(const LLVector4a& vert0, const LLVector4a& vert1, co
|
|||
LLVector4a u;
|
||||
u.setAllDot3(tvec,pvec);
|
||||
|
||||
if ((u.greaterEqual4(LLVector4a::getZero()).getComparisonMask() & 0x7) &&
|
||||
(u.lessEqual4(det).getComparisonMask() & 0x7))
|
||||
if ((u.greaterEqual(LLVector4a::getZero()).getGatheredBits() & 0x7) &&
|
||||
(u.lessEqual(det).getGatheredBits() & 0x7))
|
||||
{
|
||||
/* prepare to test V parameter */
|
||||
LLVector4a qvec;
|
||||
|
|
@ -188,8 +189,8 @@ BOOL LLTriangleRayIntersect(const LLVector4a& vert0, const LLVector4a& vert1, co
|
|||
LLVector4a sum_uv;
|
||||
sum_uv.setAdd(u, v);
|
||||
|
||||
S32 v_gequal = v.greaterEqual4(LLVector4a::getZero()).getComparisonMask() & 0x7;
|
||||
S32 sum_lequal = sum_uv.lessEqual4(det).getComparisonMask() & 0x7;
|
||||
S32 v_gequal = v.greaterEqual(LLVector4a::getZero()).getGatheredBits() & 0x7;
|
||||
S32 sum_lequal = sum_uv.lessEqual(det).getGatheredBits() & 0x7;
|
||||
|
||||
if (v_gequal && sum_lequal)
|
||||
{
|
||||
|
|
@ -230,7 +231,7 @@ BOOL LLTriangleRayIntersectTwoSided(const LLVector4a& vert0, const LLVector4a& v
|
|||
pvec.setCross3(dir, edge2);
|
||||
|
||||
/* if determinant is near zero, ray lies in plane of triangle */
|
||||
F32 det = edge1.dot3(pvec);
|
||||
F32 det = edge1.dot3(pvec).getF32();
|
||||
|
||||
|
||||
if (det > -F_APPROXIMATELY_ZERO && det < F_APPROXIMATELY_ZERO)
|
||||
|
|
@ -245,7 +246,7 @@ BOOL LLTriangleRayIntersectTwoSided(const LLVector4a& vert0, const LLVector4a& v
|
|||
tvec.setSub(orig, vert0);
|
||||
|
||||
/* calculate U parameter and test bounds */
|
||||
u = (tvec.dot3(pvec)) * inv_det;
|
||||
u = (tvec.dot3(pvec).getF32()) * inv_det;
|
||||
if (u < 0.f || u > 1.f)
|
||||
{
|
||||
return FALSE;
|
||||
|
|
@ -255,7 +256,7 @@ BOOL LLTriangleRayIntersectTwoSided(const LLVector4a& vert0, const LLVector4a& v
|
|||
tvec.sub(edge1);
|
||||
|
||||
/* calculate V parameter and test bounds */
|
||||
v = (dir.dot3(tvec)) * inv_det;
|
||||
v = (dir.dot3(tvec).getF32()) * inv_det;
|
||||
|
||||
if (v < 0.f || u + v > 1.f)
|
||||
{
|
||||
|
|
@ -263,7 +264,7 @@ BOOL LLTriangleRayIntersectTwoSided(const LLVector4a& vert0, const LLVector4a& v
|
|||
}
|
||||
|
||||
/* calculate t, ray intersects triangle */
|
||||
t = (edge2.dot3(tvec)) * inv_det;
|
||||
t = (edge2.dot3(tvec).getF32()) * inv_det;
|
||||
|
||||
intersection_a = u;
|
||||
intersection_b = v;
|
||||
|
|
@ -326,20 +327,20 @@ public:
|
|||
//stretch by triangles in node
|
||||
tri = *iter;
|
||||
|
||||
min.setMin(*tri->mV[0]);
|
||||
min.setMin(*tri->mV[1]);
|
||||
min.setMin(*tri->mV[2]);
|
||||
min.setMin(min, *tri->mV[0]);
|
||||
min.setMin(min, *tri->mV[1]);
|
||||
min.setMin(min, *tri->mV[2]);
|
||||
|
||||
max.setMax(*tri->mV[0]);
|
||||
max.setMax(*tri->mV[1]);
|
||||
max.setMax(*tri->mV[2]);
|
||||
max.setMax(max, *tri->mV[0]);
|
||||
max.setMax(max, *tri->mV[1]);
|
||||
max.setMax(max, *tri->mV[2]);
|
||||
}
|
||||
|
||||
for (S32 i = 0; i < branch->getChildCount(); ++i)
|
||||
{ //stretch by child extents
|
||||
LLVolumeOctreeListener* child = (LLVolumeOctreeListener*) branch->getChild(i)->getListener(0);
|
||||
min.setMin(child->mExtents[0]);
|
||||
max.setMax(child->mExtents[1]);
|
||||
min.setMin(min, child->mExtents[0]);
|
||||
max.setMax(min, child->mExtents[1]);
|
||||
}
|
||||
}
|
||||
else if (branch->getChildCount() != 0)
|
||||
|
|
@ -352,8 +353,8 @@ public:
|
|||
for (S32 i = 1; i < branch->getChildCount(); ++i)
|
||||
{ //stretch by child extents
|
||||
child = (LLVolumeOctreeListener*) branch->getChild(i)->getListener(0);
|
||||
min.setMin(child->mExtents[0]);
|
||||
max.setMax(child->mExtents[1]);
|
||||
min.setMin(min, child->mExtents[0]);
|
||||
max.setMax(max, child->mExtents[1]);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -2011,7 +2012,7 @@ const LLVolumeFace::VertexData& LLVolumeFace::VertexData::operator=(const LLVolu
|
|||
if (this != &rhs)
|
||||
{
|
||||
init();
|
||||
LLVector4a::memcpyNonAliased16((F32*) mData, (F32*) rhs.mData, 8);
|
||||
LLVector4a::memcpyNonAliased16((F32*) mData, (F32*) rhs.mData, 8*sizeof(F32));
|
||||
mTexCoord = rhs.mTexCoord;
|
||||
}
|
||||
return *this;
|
||||
|
|
@ -2055,8 +2056,8 @@ void LLVolumeFace::VertexData::setNormal(const LLVector4a& norm)
|
|||
|
||||
bool LLVolumeFace::VertexData::operator<(const LLVolumeFace::VertexData& rhs)const
|
||||
{
|
||||
const F32* lp = this->getPosition().getF32();
|
||||
const F32* rp = rhs.getPosition().getF32();
|
||||
const F32* lp = this->getPosition().getF32ptr();
|
||||
const F32* rp = rhs.getPosition().getF32ptr();
|
||||
|
||||
if (lp[0] != rp[0])
|
||||
{
|
||||
|
|
@ -2073,8 +2074,8 @@ bool LLVolumeFace::VertexData::operator<(const LLVolumeFace::VertexData& rhs)con
|
|||
return lp[2] < rp[2];
|
||||
}
|
||||
|
||||
lp = getNormal().getF32();
|
||||
rp = rhs.getNormal().getF32();
|
||||
lp = getNormal().getF32ptr();
|
||||
rp = rhs.getNormal().getF32ptr();
|
||||
|
||||
if (lp[0] != rp[0])
|
||||
{
|
||||
|
|
@ -2101,23 +2102,23 @@ bool LLVolumeFace::VertexData::operator<(const LLVolumeFace::VertexData& rhs)con
|
|||
|
||||
bool LLVolumeFace::VertexData::operator==(const LLVolumeFace::VertexData& rhs)const
|
||||
{
|
||||
return mData[POSITION].equal3(rhs.getPosition()) &&
|
||||
mData[NORMAL].equal3(rhs.getNormal()) &&
|
||||
return mData[POSITION].equals3(rhs.getPosition()) &&
|
||||
mData[NORMAL].equals3(rhs.getNormal()) &&
|
||||
mTexCoord == rhs.mTexCoord;
|
||||
}
|
||||
|
||||
bool LLVolumeFace::VertexData::compareNormal(const LLVolumeFace::VertexData& rhs, F32 angle_cutoff) const
|
||||
{
|
||||
bool retval = false;
|
||||
if (rhs.mData[POSITION].equal3(mData[POSITION]) && rhs.mTexCoord == mTexCoord)
|
||||
if (rhs.mData[POSITION].equals3(mData[POSITION]) && rhs.mTexCoord == mTexCoord)
|
||||
{
|
||||
if (angle_cutoff > 1.f)
|
||||
{
|
||||
retval = (mData[NORMAL].equal3(rhs.mData[NORMAL]));
|
||||
retval = (mData[NORMAL].equals3(rhs.mData[NORMAL]));
|
||||
}
|
||||
else
|
||||
{
|
||||
F32 cur_angle = rhs.mData[NORMAL].dot3(mData[NORMAL]);
|
||||
F32 cur_angle = rhs.mData[NORMAL].dot3(mData[NORMAL]).getF32();
|
||||
retval = cur_angle > angle_cutoff;
|
||||
}
|
||||
}
|
||||
|
|
@ -2331,8 +2332,8 @@ bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size)
|
|||
}
|
||||
else
|
||||
{
|
||||
min.setMin(*pos_out);
|
||||
max.setMax(*pos_out);
|
||||
min.setMin(min, *pos_out);
|
||||
max.setMax(max, *pos_out);
|
||||
}
|
||||
|
||||
pos_out++;
|
||||
|
|
@ -2944,7 +2945,7 @@ void sculpt_calc_mesh_resolution(U16 width, U16 height, U8 type, F32 detail, S32
|
|||
ratio = (F32) width / (F32) height;
|
||||
|
||||
|
||||
s = (S32)fsqrtf(((F32)vertices / ratio));
|
||||
s = (S32)(F32) sqrt(((F32)vertices / ratio));
|
||||
|
||||
s = llmax(s, 4); // no degenerate sizes, please
|
||||
t = vertices / s;
|
||||
|
|
@ -5280,16 +5281,15 @@ LLVolumeFace& LLVolumeFace::operator=(const LLVolumeFace& src)
|
|||
|
||||
freeData();
|
||||
|
||||
LLVector4a::memcpyNonAliased16((F32*) mExtents, (F32*) src.mExtents, 12);
|
||||
LLVector4a::memcpyNonAliased16((F32*) mExtents, (F32*) src.mExtents, 12*sizeof(F32));
|
||||
|
||||
resizeVertices(src.mNumVertices);
|
||||
resizeIndices(src.mNumIndices);
|
||||
|
||||
if (mNumVertices)
|
||||
{
|
||||
S32 vert_size = mNumVertices*4;
|
||||
S32 vert_size = mNumVertices*4*sizeof(F32);
|
||||
S32 tc_size = (mNumVertices*8+0xF) & ~0xF;
|
||||
tc_size /= 4;
|
||||
|
||||
LLVector4a::memcpyNonAliased16((F32*) mPositions, (F32*) src.mPositions, vert_size);
|
||||
LLVector4a::memcpyNonAliased16((F32*) mNormals, (F32*) src.mNormals, vert_size);
|
||||
|
|
@ -5322,8 +5322,7 @@ LLVolumeFace& LLVolumeFace::operator=(const LLVolumeFace& src)
|
|||
if (mNumIndices)
|
||||
{
|
||||
S32 idx_size = (mNumIndices*2+0xF) & ~0xF;
|
||||
idx_size /= 4;
|
||||
|
||||
|
||||
LLVector4a::memcpyNonAliased16((F32*) mIndices, (F32*) src.mIndices, idx_size);
|
||||
}
|
||||
|
||||
|
|
@ -5388,9 +5387,9 @@ void LLVolumeFace::getVertexData(U16 index, LLVolumeFace::VertexData& cv)
|
|||
|
||||
bool LLVolumeFace::VertexMapData::operator==(const LLVolumeFace::VertexData& rhs) const
|
||||
{
|
||||
return getPosition().equal3(rhs.getPosition()) &&
|
||||
return getPosition().equals3(rhs.getPosition()) &&
|
||||
mTexCoord == rhs.mTexCoord &&
|
||||
getNormal().equal3(rhs.getNormal());
|
||||
getNormal().equals3(rhs.getNormal());
|
||||
}
|
||||
|
||||
bool LLVolumeFace::VertexMapData::ComparePosition::operator()(const LLVector3& a, const LLVector3& b) const
|
||||
|
|
@ -5423,7 +5422,7 @@ void LLVolumeFace::optimize(F32 angle_cutoff)
|
|||
getVertexData(index, cv);
|
||||
|
||||
BOOL found = FALSE;
|
||||
VertexMapData::PointMap::iterator point_iter = point_map.find(LLVector3(cv.getPosition().getF32()));
|
||||
VertexMapData::PointMap::iterator point_iter = point_map.find(LLVector3(cv.getPosition().getF32ptr()));
|
||||
if (point_iter != point_map.end())
|
||||
{ //duplicate point might exist
|
||||
for (U32 j = 0; j < point_iter->second.size(); ++j)
|
||||
|
|
@ -5455,7 +5454,7 @@ void LLVolumeFace::optimize(F32 angle_cutoff)
|
|||
}
|
||||
else
|
||||
{
|
||||
point_map[LLVector3(d.getPosition().getF32())].push_back(d);
|
||||
point_map[LLVector3(d.getPosition().getF32ptr())].push_back(d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5491,12 +5490,12 @@ void LLVolumeFace::createOctree()
|
|||
tri->mIndex[2] = mIndices[i+2];
|
||||
|
||||
LLVector4a min = v0;
|
||||
min.setMin(v1);
|
||||
min.setMin(v2);
|
||||
min.setMin(min, v1);
|
||||
min.setMin(min, v2);
|
||||
|
||||
LLVector4a max = v0;
|
||||
max.setMax(v1);
|
||||
max.setMax(v2);
|
||||
max.setMax(max, v1);
|
||||
max.setMax(max, v2);
|
||||
|
||||
LLVector4a center;
|
||||
center.setAdd(min, max);
|
||||
|
|
@ -5507,7 +5506,7 @@ void LLVolumeFace::createOctree()
|
|||
LLVector4a size;
|
||||
size.setSub(max,min);
|
||||
|
||||
tri->mRadius = size.length3() * 0.5f;
|
||||
tri->mRadius = size.getLength3().getF32() * 0.5f;
|
||||
|
||||
mOctree->insert(tri);
|
||||
}
|
||||
|
|
@ -5655,12 +5654,13 @@ BOOL LLVolumeFace::createUnCutCubeCap(LLVolume* volume, BOOL partial_build)
|
|||
|
||||
if (gx == 0 && gy == 0)
|
||||
{
|
||||
min = max = newVert.getPosition();
|
||||
min = newVert.getPosition();
|
||||
max = min;
|
||||
}
|
||||
else
|
||||
{
|
||||
min.setMin(newVert.getPosition());
|
||||
max.setMax(newVert.getPosition());
|
||||
min.setMin(min, newVert.getPosition());
|
||||
max.setMax(max, newVert.getPosition());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5795,7 +5795,8 @@ BOOL LLVolumeFace::createCap(LLVolume* volume, BOOL partial_build)
|
|||
|
||||
if (i == 0)
|
||||
{
|
||||
min = max = pos[i];
|
||||
max = pos[i];
|
||||
min = max;
|
||||
min_uv = max_uv = tc[i];
|
||||
}
|
||||
else
|
||||
|
|
@ -5848,8 +5849,8 @@ BOOL LLVolumeFace::createCap(LLVolume* volume, BOOL partial_build)
|
|||
|
||||
for (S32 i = 0; i < num_vertices; i++)
|
||||
{
|
||||
binorm[i].load4a((F32*) &binormal.mQ);
|
||||
norm[i].load4a((F32*) &normal.mQ);
|
||||
binorm[i].load4a(binormal.getF32ptr());
|
||||
norm[i].load4a(normal.getF32ptr());
|
||||
}
|
||||
|
||||
if (partial_build)
|
||||
|
|
@ -6186,7 +6187,7 @@ void LLVolumeFace::pushVertex(const LLVector4a& pos, const LLVector4a& norm, con
|
|||
LLVector4a* dst = (LLVector4a*) ll_aligned_malloc_16(new_size);
|
||||
if (mPositions)
|
||||
{
|
||||
LLVector4a::memcpyNonAliased16((F32*) dst, (F32*) mPositions, old_size/4);
|
||||
LLVector4a::memcpyNonAliased16((F32*) dst, (F32*) mPositions, old_size);
|
||||
ll_aligned_free_16(mPositions);
|
||||
}
|
||||
mPositions = dst;
|
||||
|
|
@ -6195,7 +6196,7 @@ void LLVolumeFace::pushVertex(const LLVector4a& pos, const LLVector4a& norm, con
|
|||
dst = (LLVector4a*) ll_aligned_malloc_16(new_size);
|
||||
if (mNormals)
|
||||
{
|
||||
LLVector4a::memcpyNonAliased16((F32*) dst, (F32*) mNormals, old_size/4);
|
||||
LLVector4a::memcpyNonAliased16((F32*) dst, (F32*) mNormals, old_size);
|
||||
ll_aligned_free_16(mNormals);
|
||||
}
|
||||
mNormals = dst;
|
||||
|
|
@ -6209,7 +6210,7 @@ void LLVolumeFace::pushVertex(const LLVector4a& pos, const LLVector4a& norm, con
|
|||
LLVector2* dst = (LLVector2*) ll_aligned_malloc_16(new_size);
|
||||
if (mTexCoords)
|
||||
{
|
||||
LLVector4a::memcpyNonAliased16((F32*) dst, (F32*) mTexCoords, old_size/4);
|
||||
LLVector4a::memcpyNonAliased16((F32*) dst, (F32*) mTexCoords, old_size);
|
||||
ll_aligned_free_16(mTexCoords);
|
||||
}
|
||||
}
|
||||
|
|
@ -6268,7 +6269,7 @@ void LLVolumeFace::pushIndex(const U16& idx)
|
|||
U16* dst = (U16*) ll_aligned_malloc_16(new_size);
|
||||
if (mIndices)
|
||||
{
|
||||
LLVector4a::memcpyNonAliased16((F32*) dst, (F32*) mIndices, old_size/4);
|
||||
LLVector4a::memcpyNonAliased16((F32*) dst, (F32*) mIndices, old_size);
|
||||
ll_aligned_free_16(mIndices);
|
||||
}
|
||||
mIndices = dst;
|
||||
|
|
@ -6319,9 +6320,9 @@ void LLVolumeFace::appendFace(const LLVolumeFace& face, LLMatrix4& mat_in, LLMat
|
|||
|
||||
if (mNumVertices > 0)
|
||||
{ //copy old buffers
|
||||
LLVector4a::memcpyNonAliased16((F32*) new_pos, (F32*) mPositions, mNumVertices*4);
|
||||
LLVector4a::memcpyNonAliased16((F32*) new_norm, (F32*) mNormals, mNumVertices*4);
|
||||
LLVector4a::memcpyNonAliased16((F32*) new_tc, (F32*) mTexCoords, mNumVertices*2);
|
||||
LLVector4a::memcpyNonAliased16((F32*) new_pos, (F32*) mPositions, mNumVertices*4*sizeof(F32));
|
||||
LLVector4a::memcpyNonAliased16((F32*) new_norm, (F32*) mNormals, mNumVertices*4*sizeof(F32));
|
||||
LLVector4a::memcpyNonAliased16((F32*) new_tc, (F32*) mTexCoords, mNumVertices*2*sizeof(F32));
|
||||
}
|
||||
|
||||
//free old buffer space
|
||||
|
|
@ -6382,7 +6383,7 @@ void LLVolumeFace::appendFace(const LLVolumeFace& face, LLMatrix4& mat_in, LLMat
|
|||
if (mNumIndices > 0)
|
||||
{ //copy old index buffer
|
||||
S32 old_size = (mNumIndices*2+0xF) & ~0xF;
|
||||
LLVector4a::memcpyNonAliased16((F32*) new_indices, (F32*) mIndices, old_size/4);
|
||||
LLVector4a::memcpyNonAliased16((F32*) new_indices, (F32*) mIndices, old_size);
|
||||
}
|
||||
|
||||
//free old index buffer
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ namespace tut
|
|||
F32 x = 2.2345f, y = 3.5678f ;
|
||||
LLVector2 vec2(x,y);
|
||||
ensure("magVecSquared:Fail ", is_approx_equal(vec2.magVecSquared(), (x*x + y*y)));
|
||||
ensure("magVec:Fail ", is_approx_equal(vec2.magVec(), fsqrtf(x*x + y*y)));
|
||||
ensure("magVec:Fail ", is_approx_equal(vec2.magVec(), (F32) sqrt(x*x + y*y)));
|
||||
}
|
||||
|
||||
template<> template<>
|
||||
|
|
@ -413,7 +413,7 @@ namespace tut
|
|||
ensure_equals("dist_vec_squared values are not equal",val2, val1);
|
||||
|
||||
val1 = dist_vec(vec2, vec3);
|
||||
val2 = fsqrtf((x1 - x2)*(x1 - x2) + (y1 - y2)* (y1 - y2));
|
||||
val2 = (F32) sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)* (y1 - y2));
|
||||
ensure_equals("dist_vec values are not equal",val2, val1);
|
||||
}
|
||||
|
||||
|
|
@ -437,7 +437,7 @@ namespace tut
|
|||
LLVector2 vec2(x1, y1);
|
||||
|
||||
F32 vecMag = vec2.normVec();
|
||||
F32 mag = fsqrtf(x1*x1 + y1*y1);
|
||||
F32 mag = (F32) sqrt(x1*x1 + y1*y1);
|
||||
|
||||
F32 oomag = 1.f / mag;
|
||||
val1 = x1 * oomag;
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ namespace tut
|
|||
F32 r = 2.3436212f, g = 1231.f, b = 4.7849321232f;
|
||||
LLColor3 llcolor3(r,g,b);
|
||||
ensure("magVecSquared:Fail ", is_approx_equal(llcolor3.magVecSquared(), (r*r + g*g + b*b)));
|
||||
ensure("magVec:Fail ", is_approx_equal(llcolor3.magVec(), fsqrtf(r*r + g*g + b*b)));
|
||||
ensure("magVec:Fail ", is_approx_equal(llcolor3.magVec(), (F32) sqrt(r*r + g*g + b*b)));
|
||||
}
|
||||
|
||||
template<> template<>
|
||||
|
|
@ -109,7 +109,7 @@ namespace tut
|
|||
F32 val1, val2,val3;
|
||||
LLColor3 llcolor3(r,g,b);
|
||||
F32 vecMag = llcolor3.normVec();
|
||||
F32 mag = fsqrtf(r*r + g*g + b*b);
|
||||
F32 mag = (F32) sqrt(r*r + g*g + b*b);
|
||||
F32 oomag = 1.f / mag;
|
||||
val1 = r * oomag;
|
||||
val2 = g * oomag;
|
||||
|
|
@ -292,7 +292,7 @@ namespace tut
|
|||
F32 r1 =1.f, g1 = 2.f,b1 = 1.2f, r2 = -2.3f, g2 = 1.11f, b2 = 1234.234f;
|
||||
LLColor3 llcolor3(r1,g1,b1),llcolor3a(r2,g2,b2);
|
||||
F32 val = distVec(llcolor3,llcolor3a);
|
||||
ensure("distVec failed ", is_approx_equal(fsqrtf((r1-r2)*(r1-r2) + (g1-g2)*(g1-g2) + (b1-b2)*(b1-b2)) ,val));
|
||||
ensure("distVec failed ", is_approx_equal((F32) sqrt((r1-r2)*(r1-r2) + (g1-g2)*(g1-g2) + (b1-b2)*(b1-b2)) ,val));
|
||||
|
||||
F32 val1 = distVec_squared(llcolor3,llcolor3a);
|
||||
ensure("distVec_squared failed ", is_approx_equal(((r1-r2)*(r1-r2) + (g1-g2)*(g1-g2) + (b1-b2)*(b1-b2)) ,val1));
|
||||
|
|
|
|||
|
|
@ -409,7 +409,7 @@ namespace tut
|
|||
LLVector3d vec3D(x,y,z);
|
||||
F64 res = (x*x + y*y + z*z) - vec3D.magVecSquared();
|
||||
ensure("1:magVecSquared:Fail ", ((-F_APPROXIMATELY_ZERO <= res)&& (res <=F_APPROXIMATELY_ZERO)));
|
||||
res = fsqrtf(x*x + y*y + z*z) - vec3D.magVec();
|
||||
res = (F32) sqrt(x*x + y*y + z*z) - vec3D.magVec();
|
||||
ensure("2:magVec: Fail ", ((-F_APPROXIMATELY_ZERO <= res)&& (res <=F_APPROXIMATELY_ZERO)));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ namespace tut
|
|||
F32 x = 2.32f, y = 1.212f, z = -.12f;
|
||||
LLVector3 vec3(x,y,z);
|
||||
ensure("1:magVecSquared:Fail ", is_approx_equal(vec3.magVecSquared(), (x*x + y*y + z*z)));
|
||||
ensure("2:magVec:Fail ", is_approx_equal(vec3.magVec(), fsqrtf(x*x + y*y + z*z)));
|
||||
ensure("2:magVec:Fail ", is_approx_equal(vec3.magVec(), (F32) sqrt(x*x + y*y + z*z)));
|
||||
}
|
||||
|
||||
template<> template<>
|
||||
|
|
@ -515,7 +515,7 @@ namespace tut
|
|||
F32 val1,val2;
|
||||
LLVector3 vec3(x1,y1,z1),vec3a(x2,y2,z2);
|
||||
val1 = dist_vec(vec3,vec3a);
|
||||
val2 = fsqrtf((x1 - x2)*(x1 - x2) + (y1 - y2)* (y1 - y2) + (z1 - z2)* (z1 -z2));
|
||||
val2 = (F32) sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)* (y1 - y2) + (z1 - z2)* (z1 -z2));
|
||||
ensure_equals("1:dist_vec: Fail ",val2, val1);
|
||||
val1 = dist_vec_squared(vec3,vec3a);
|
||||
val2 =((x1 - x2)*(x1 - x2) + (y1 - y2)* (y1 - y2) + (z1 - z2)* (z1 -z2));
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ namespace tut
|
|||
F32 r = 0x20, g = 0xFFFF, b = 0xFF;
|
||||
LLColor4 llcolor4(r,g,b);
|
||||
ensure("magVecSquared:Fail ", is_approx_equal(llcolor4.magVecSquared(), (r*r + g*g + b*b)));
|
||||
ensure("magVec:Fail ", is_approx_equal(llcolor4.magVec(), fsqrtf(r*r + g*g + b*b)));
|
||||
ensure("magVec:Fail ", is_approx_equal(llcolor4.magVec(), (F32) sqrt(r*r + g*g + b*b)));
|
||||
}
|
||||
|
||||
template<> template<>
|
||||
|
|
@ -170,7 +170,7 @@ namespace tut
|
|||
F32 r = 0x20, g = 0xFFFF, b = 0xFF;
|
||||
LLColor4 llcolor4(r,g,b);
|
||||
F32 vecMag = llcolor4.normVec();
|
||||
F32 mag = fsqrtf(r*r + g*g + b*b);
|
||||
F32 mag = (F32) sqrt(r*r + g*g + b*b);
|
||||
F32 oomag = 1.f / mag;
|
||||
F32 val1 = r * oomag, val2 = g * oomag, val3 = b * oomag;
|
||||
ensure("1:normVec failed ", (is_approx_equal(val1, llcolor4.mV[0]) && is_approx_equal(val2, llcolor4.mV[1]) && is_approx_equal(val3, llcolor4.mV[2]) && is_approx_equal(vecMag, mag)));
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ namespace tut
|
|||
U8 r = 0x12, g = 0xFF, b = 0xAF;
|
||||
LLColor4U llcolor4u(r,g,b);
|
||||
ensure("magVecSquared:Fail ", is_approx_equal(llcolor4u.magVecSquared(), (F32)(r*r + g*g + b*b)));
|
||||
ensure("magVec:Fail ", is_approx_equal(llcolor4u.magVec(), fsqrtf(r*r + g*g + b*b)));
|
||||
ensure("magVec:Fail ", is_approx_equal(llcolor4u.magVec(), (F32) sqrt((F32) (r*r + g*g + b*b))));
|
||||
}
|
||||
|
||||
template<> template<>
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ namespace tut
|
|||
{
|
||||
F32 x = 10.f, y = -2.3f, z = -.023f;
|
||||
LLVector4 vec4(x,y,z);
|
||||
ensure("magVec:Fail ", is_approx_equal(vec4.magVec(), fsqrtf(x*x + y*y + z*z)));
|
||||
ensure("magVec:Fail ", is_approx_equal(vec4.magVec(), (F32) sqrt(x*x + y*y + z*z)));
|
||||
ensure("magVecSquared:Fail ", is_approx_equal(vec4.magVecSquared(), (x*x + y*y + z*z)));
|
||||
}
|
||||
|
||||
|
|
@ -343,7 +343,7 @@ namespace tut
|
|||
F32 val1,val2;
|
||||
LLVector4 vec4(x1,y1,z1),vec4a(x2,y2,z2);
|
||||
val1 = dist_vec(vec4,vec4a);
|
||||
val2 = fsqrtf((x1 - x2)*(x1 - x2) + (y1 - y2)* (y1 - y2) + (z1 - z2)* (z1 -z2));
|
||||
val2 = (F32) sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)* (y1 - y2) + (z1 - z2)* (z1 -z2));
|
||||
ensure_equals("dist_vec: Fail ",val2, val1);
|
||||
val1 = dist_vec_squared(vec4,vec4a);
|
||||
val2 =((x1 - x2)*(x1 - x2) + (y1 - y2)* (y1 - y2) + (z1 - z2)* (z1 -z2));
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ F32 dist_vec(const LLVector2 &a, const LLVector2 &b)
|
|||
{
|
||||
F32 x = a.mV[0] - b.mV[0];
|
||||
F32 y = a.mV[1] - b.mV[1];
|
||||
return fsqrtf( x*x + y*y );
|
||||
return (F32) sqrt( x*x + y*y );
|
||||
}
|
||||
|
||||
F32 dist_vec_squared(const LLVector2 &a, const LLVector2 &b)
|
||||
|
|
|
|||
|
|
@ -225,7 +225,7 @@ inline void LLVector2::setVec(const F32 *vec)
|
|||
|
||||
inline F32 LLVector2::length(void) const
|
||||
{
|
||||
return fsqrtf(mV[0]*mV[0] + mV[1]*mV[1]);
|
||||
return (F32) sqrt(mV[0]*mV[0] + mV[1]*mV[1]);
|
||||
}
|
||||
|
||||
inline F32 LLVector2::lengthSquared(void) const
|
||||
|
|
@ -235,7 +235,7 @@ inline F32 LLVector2::lengthSquared(void) const
|
|||
|
||||
inline F32 LLVector2::normalize(void)
|
||||
{
|
||||
F32 mag = fsqrtf(mV[0]*mV[0] + mV[1]*mV[1]);
|
||||
F32 mag = (F32) sqrt(mV[0]*mV[0] + mV[1]*mV[1]);
|
||||
F32 oomag;
|
||||
|
||||
if (mag > FP_MAG_THRESHOLD)
|
||||
|
|
@ -262,7 +262,7 @@ inline bool LLVector2::isFinite() const
|
|||
// deprecated
|
||||
inline F32 LLVector2::magVec(void) const
|
||||
{
|
||||
return fsqrtf(mV[0]*mV[0] + mV[1]*mV[1]);
|
||||
return (F32) sqrt(mV[0]*mV[0] + mV[1]*mV[1]);
|
||||
}
|
||||
|
||||
// deprecated
|
||||
|
|
@ -274,7 +274,7 @@ inline F32 LLVector2::magVecSquared(void) const
|
|||
// deprecated
|
||||
inline F32 LLVector2::normVec(void)
|
||||
{
|
||||
F32 mag = fsqrtf(mV[0]*mV[0] + mV[1]*mV[1]);
|
||||
F32 mag = (F32) sqrt(mV[0]*mV[0] + mV[1]*mV[1]);
|
||||
F32 oomag;
|
||||
|
||||
if (mag > FP_MAG_THRESHOLD)
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ inline F32 LLColor3::brightness(void) const
|
|||
|
||||
inline F32 LLColor3::length(void) const
|
||||
{
|
||||
return fsqrtf(mV[0]*mV[0] + mV[1]*mV[1] + mV[2]*mV[2]);
|
||||
return (F32) sqrt(mV[0]*mV[0] + mV[1]*mV[1] + mV[2]*mV[2]);
|
||||
}
|
||||
|
||||
inline F32 LLColor3::lengthSquared(void) const
|
||||
|
|
@ -294,7 +294,7 @@ inline F32 LLColor3::lengthSquared(void) const
|
|||
|
||||
inline F32 LLColor3::normalize(void)
|
||||
{
|
||||
F32 mag = fsqrtf(mV[0]*mV[0] + mV[1]*mV[1] + mV[2]*mV[2]);
|
||||
F32 mag = (F32) sqrt(mV[0]*mV[0] + mV[1]*mV[1] + mV[2]*mV[2]);
|
||||
F32 oomag;
|
||||
|
||||
if (mag)
|
||||
|
|
@ -310,7 +310,7 @@ inline F32 LLColor3::normalize(void)
|
|||
// deprecated
|
||||
inline F32 LLColor3::magVec(void) const
|
||||
{
|
||||
return fsqrtf(mV[0]*mV[0] + mV[1]*mV[1] + mV[2]*mV[2]);
|
||||
return (F32) sqrt(mV[0]*mV[0] + mV[1]*mV[1] + mV[2]*mV[2]);
|
||||
}
|
||||
|
||||
// deprecated
|
||||
|
|
@ -322,7 +322,7 @@ inline F32 LLColor3::magVecSquared(void) const
|
|||
// deprecated
|
||||
inline F32 LLColor3::normVec(void)
|
||||
{
|
||||
F32 mag = fsqrtf(mV[0]*mV[0] + mV[1]*mV[1] + mV[2]*mV[2]);
|
||||
F32 mag = (F32) sqrt(mV[0]*mV[0] + mV[1]*mV[1] + mV[2]*mV[2]);
|
||||
F32 oomag;
|
||||
|
||||
if (mag)
|
||||
|
|
@ -444,7 +444,7 @@ inline F32 distVec(const LLColor3 &a, const LLColor3 &b)
|
|||
F32 x = a.mV[0] - b.mV[0];
|
||||
F32 y = a.mV[1] - b.mV[1];
|
||||
F32 z = a.mV[2] - b.mV[2];
|
||||
return fsqrtf( x*x + y*y + z*z );
|
||||
return (F32) sqrt( x*x + y*y + z*z );
|
||||
}
|
||||
|
||||
inline F32 distVec_squared(const LLColor3 &a, const LLColor3 &b)
|
||||
|
|
|
|||
|
|
@ -240,7 +240,7 @@ inline const LLVector3d& LLVector3d::setVec(const F64 *vec)
|
|||
|
||||
inline F64 LLVector3d::normVec(void)
|
||||
{
|
||||
F64 mag = fsqrtf(mdV[0]*mdV[0] + mdV[1]*mdV[1] + mdV[2]*mdV[2]);
|
||||
F64 mag = (F32) sqrt(mdV[0]*mdV[0] + mdV[1]*mdV[1] + mdV[2]*mdV[2]);
|
||||
F64 oomag;
|
||||
|
||||
if (mag > FP_MAG_THRESHOLD)
|
||||
|
|
@ -262,7 +262,7 @@ inline F64 LLVector3d::normVec(void)
|
|||
|
||||
inline F64 LLVector3d::normalize(void)
|
||||
{
|
||||
F64 mag = fsqrtf(mdV[0]*mdV[0] + mdV[1]*mdV[1] + mdV[2]*mdV[2]);
|
||||
F64 mag = (F32) sqrt(mdV[0]*mdV[0] + mdV[1]*mdV[1] + mdV[2]*mdV[2]);
|
||||
F64 oomag;
|
||||
|
||||
if (mag > FP_MAG_THRESHOLD)
|
||||
|
|
@ -286,7 +286,7 @@ inline F64 LLVector3d::normalize(void)
|
|||
|
||||
inline F64 LLVector3d::magVec(void) const
|
||||
{
|
||||
return fsqrtf(mdV[0]*mdV[0] + mdV[1]*mdV[1] + mdV[2]*mdV[2]);
|
||||
return (F32) sqrt(mdV[0]*mdV[0] + mdV[1]*mdV[1] + mdV[2]*mdV[2]);
|
||||
}
|
||||
|
||||
inline F64 LLVector3d::magVecSquared(void) const
|
||||
|
|
@ -296,7 +296,7 @@ inline F64 LLVector3d::magVecSquared(void) const
|
|||
|
||||
inline F64 LLVector3d::length(void) const
|
||||
{
|
||||
return fsqrtf(mdV[0]*mdV[0] + mdV[1]*mdV[1] + mdV[2]*mdV[2]);
|
||||
return (F32) sqrt(mdV[0]*mdV[0] + mdV[1]*mdV[1] + mdV[2]*mdV[2]);
|
||||
}
|
||||
|
||||
inline F64 LLVector3d::lengthSquared(void) const
|
||||
|
|
@ -406,7 +406,7 @@ inline F64 dist_vec(const LLVector3d &a, const LLVector3d &b)
|
|||
F64 x = a.mdV[0] - b.mdV[0];
|
||||
F64 y = a.mdV[1] - b.mdV[1];
|
||||
F64 z = a.mdV[2] - b.mdV[2];
|
||||
return fsqrtf( x*x + y*y + z*z );
|
||||
return (F32) sqrt( x*x + y*y + z*z );
|
||||
}
|
||||
|
||||
inline F64 dist_vec_squared(const LLVector3d &a, const LLVector3d &b)
|
||||
|
|
|
|||
|
|
@ -282,7 +282,7 @@ inline void LLVector3::setVec(const F32 *vec)
|
|||
|
||||
inline F32 LLVector3::normalize(void)
|
||||
{
|
||||
F32 mag = fsqrtf(mV[0]*mV[0] + mV[1]*mV[1] + mV[2]*mV[2]);
|
||||
F32 mag = (F32) sqrt(mV[0]*mV[0] + mV[1]*mV[1] + mV[2]*mV[2]);
|
||||
F32 oomag;
|
||||
|
||||
if (mag > FP_MAG_THRESHOLD)
|
||||
|
|
@ -305,7 +305,7 @@ inline F32 LLVector3::normalize(void)
|
|||
// deprecated
|
||||
inline F32 LLVector3::normVec(void)
|
||||
{
|
||||
F32 mag = fsqrtf(mV[0]*mV[0] + mV[1]*mV[1] + mV[2]*mV[2]);
|
||||
F32 mag = (F32) sqrt(mV[0]*mV[0] + mV[1]*mV[1] + mV[2]*mV[2]);
|
||||
F32 oomag;
|
||||
|
||||
if (mag > FP_MAG_THRESHOLD)
|
||||
|
|
@ -329,7 +329,7 @@ inline F32 LLVector3::normVec(void)
|
|||
|
||||
inline F32 LLVector3::length(void) const
|
||||
{
|
||||
return fsqrtf(mV[0]*mV[0] + mV[1]*mV[1] + mV[2]*mV[2]);
|
||||
return (F32) sqrt(mV[0]*mV[0] + mV[1]*mV[1] + mV[2]*mV[2]);
|
||||
}
|
||||
|
||||
inline F32 LLVector3::lengthSquared(void) const
|
||||
|
|
@ -339,7 +339,7 @@ inline F32 LLVector3::lengthSquared(void) const
|
|||
|
||||
inline F32 LLVector3::magVec(void) const
|
||||
{
|
||||
return fsqrtf(mV[0]*mV[0] + mV[1]*mV[1] + mV[2]*mV[2]);
|
||||
return (F32) sqrt(mV[0]*mV[0] + mV[1]*mV[1] + mV[2]*mV[2]);
|
||||
}
|
||||
|
||||
inline F32 LLVector3::magVecSquared(void) const
|
||||
|
|
@ -473,7 +473,7 @@ inline F32 dist_vec(const LLVector3 &a, const LLVector3 &b)
|
|||
F32 x = a.mV[0] - b.mV[0];
|
||||
F32 y = a.mV[1] - b.mV[1];
|
||||
F32 z = a.mV[2] - b.mV[2];
|
||||
return fsqrtf( x*x + y*y + z*z );
|
||||
return (F32) sqrt( x*x + y*y + z*z );
|
||||
}
|
||||
|
||||
inline F32 dist_vec_squared(const LLVector3 &a, const LLVector3 &b)
|
||||
|
|
|
|||
|
|
@ -392,7 +392,7 @@ inline const LLColor4& LLColor4::setAlpha(F32 a)
|
|||
|
||||
inline F32 LLColor4::length(void) const
|
||||
{
|
||||
return fsqrtf(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]);
|
||||
return (F32) sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]);
|
||||
}
|
||||
|
||||
inline F32 LLColor4::lengthSquared(void) const
|
||||
|
|
@ -402,7 +402,7 @@ inline F32 LLColor4::lengthSquared(void) const
|
|||
|
||||
inline F32 LLColor4::normalize(void)
|
||||
{
|
||||
F32 mag = fsqrtf(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]);
|
||||
F32 mag = (F32) sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]);
|
||||
F32 oomag;
|
||||
|
||||
if (mag)
|
||||
|
|
@ -418,7 +418,7 @@ inline F32 LLColor4::normalize(void)
|
|||
// deprecated
|
||||
inline F32 LLColor4::magVec(void) const
|
||||
{
|
||||
return fsqrtf(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]);
|
||||
return (F32) sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]);
|
||||
}
|
||||
|
||||
// deprecated
|
||||
|
|
@ -430,7 +430,7 @@ inline F32 LLColor4::magVecSquared(void) const
|
|||
// deprecated
|
||||
inline F32 LLColor4::normVec(void)
|
||||
{
|
||||
F32 mag = fsqrtf(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]);
|
||||
F32 mag = (F32) sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]);
|
||||
F32 oomag;
|
||||
|
||||
if (mag)
|
||||
|
|
|
|||
|
|
@ -300,7 +300,7 @@ inline const LLColor4U& LLColor4U::setAlpha(U8 a)
|
|||
|
||||
inline F32 LLColor4U::length(void) const
|
||||
{
|
||||
return fsqrtf( ((F32)mV[VX]) * mV[VX] + ((F32)mV[VY]) * mV[VY] + ((F32)mV[VZ]) * mV[VZ] );
|
||||
return (F32) sqrt( ((F32)mV[VX]) * mV[VX] + ((F32)mV[VY]) * mV[VY] + ((F32)mV[VZ]) * mV[VZ] );
|
||||
}
|
||||
|
||||
inline F32 LLColor4U::lengthSquared(void) const
|
||||
|
|
@ -311,7 +311,7 @@ inline F32 LLColor4U::lengthSquared(void) const
|
|||
// deprecated
|
||||
inline F32 LLColor4U::magVec(void) const
|
||||
{
|
||||
return fsqrtf( ((F32)mV[VX]) * mV[VX] + ((F32)mV[VY]) * mV[VY] + ((F32)mV[VZ]) * mV[VZ] );
|
||||
return (F32) sqrt( ((F32)mV[VX]) * mV[VX] + ((F32)mV[VY]) * mV[VY] + ((F32)mV[VZ]) * mV[VZ] );
|
||||
}
|
||||
|
||||
// deprecated
|
||||
|
|
|
|||
|
|
@ -321,7 +321,7 @@ inline void LLVector4::setVec(const F32 *vec)
|
|||
|
||||
inline F32 LLVector4::length(void) const
|
||||
{
|
||||
return fsqrtf(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]);
|
||||
return (F32) sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]);
|
||||
}
|
||||
|
||||
inline F32 LLVector4::lengthSquared(void) const
|
||||
|
|
@ -331,7 +331,7 @@ inline F32 LLVector4::lengthSquared(void) const
|
|||
|
||||
inline F32 LLVector4::magVec(void) const
|
||||
{
|
||||
return fsqrtf(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]);
|
||||
return (F32) sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]);
|
||||
}
|
||||
|
||||
inline F32 LLVector4::magVecSquared(void) const
|
||||
|
|
@ -463,7 +463,7 @@ inline LLVector4 lerp(const LLVector4 &a, const LLVector4 &b, F32 u)
|
|||
|
||||
inline F32 LLVector4::normalize(void)
|
||||
{
|
||||
F32 mag = fsqrtf(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]);
|
||||
F32 mag = (F32) sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]);
|
||||
F32 oomag;
|
||||
|
||||
if (mag > FP_MAG_THRESHOLD)
|
||||
|
|
@ -486,7 +486,7 @@ inline F32 LLVector4::normalize(void)
|
|||
// deprecated
|
||||
inline F32 LLVector4::normVec(void)
|
||||
{
|
||||
F32 mag = fsqrtf(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]);
|
||||
F32 mag = (F32) sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]);
|
||||
F32 oomag;
|
||||
|
||||
if (mag > FP_MAG_THRESHOLD)
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
#include "llsdmessagebuilder.h"
|
||||
|
||||
#include "llmessagetemplate.h"
|
||||
#include "llmath.h"
|
||||
#include "llquaternion.h"
|
||||
#include "llsdutil.h"
|
||||
#include "llsdutil_math.h"
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
#include "lltemplatemessagebuilder.h"
|
||||
|
||||
#include "llmessagetemplate.h"
|
||||
#include "llmath.h"
|
||||
#include "llquaternion.h"
|
||||
#include "u64.h"
|
||||
#include "v3dmath.h"
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
#include "llfasttimer.h"
|
||||
#include "llmessagebuilder.h"
|
||||
#include "llmessagetemplate.h"
|
||||
#include "llmath.h"
|
||||
#include "llquaternion.h"
|
||||
#include "message.h"
|
||||
#include "u64.h"
|
||||
|
|
|
|||
|
|
@ -924,7 +924,7 @@ LLVector3 LLRender::getUITranslation()
|
|||
{
|
||||
llerrs << "UI offset stack empty." << llendl;
|
||||
}
|
||||
return LLVector3(mUIOffset[mUIStackDepth-1].getF32());
|
||||
return LLVector3(mUIOffset[mUIStackDepth-1].getF32ptr());
|
||||
}
|
||||
|
||||
LLVector3 LLRender::getUIScale()
|
||||
|
|
@ -933,7 +933,7 @@ LLVector3 LLRender::getUIScale()
|
|||
{
|
||||
llerrs << "UI scale stack empty." << llendl;
|
||||
}
|
||||
return LLVector3(mUIScale[mUIStackDepth-1].getF32());
|
||||
return LLVector3(mUIScale[mUIStackDepth-1].getF32ptr());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1210,7 +1210,7 @@ void LLAgent::startAutoPilotGlobal(const LLVector3d &target_global, const std::s
|
|||
else
|
||||
{
|
||||
// Guess at a reasonable stop distance.
|
||||
mAutoPilotStopDistance = fsqrtf( distance );
|
||||
mAutoPilotStopDistance = (F32) sqrt( distance );
|
||||
if (mAutoPilotStopDistance < 0.5f)
|
||||
{
|
||||
mAutoPilotStopDistance = 0.5f;
|
||||
|
|
|
|||
|
|
@ -743,7 +743,7 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update)
|
|||
}
|
||||
else
|
||||
{
|
||||
pos = LLVector3(getPositionGroup().getF32());
|
||||
pos = LLVector3(getPositionGroup().getF32ptr());
|
||||
}
|
||||
|
||||
pos -= camera.getOrigin();
|
||||
|
|
@ -824,7 +824,7 @@ void LLDrawable::shiftPos(const LLVector4a &shift_vector)
|
|||
for (S32 i = 0; i < getNumFaces(); i++)
|
||||
{
|
||||
LLFace *facep = getFace(i);
|
||||
facep->mCenterAgent += LLVector3(shift_vector.getF32());
|
||||
facep->mCenterAgent += LLVector3(shift_vector.getF32ptr());
|
||||
facep->mExtents[0].add(shift_vector);
|
||||
facep->mExtents[1].add(shift_vector);
|
||||
|
||||
|
|
@ -1153,13 +1153,13 @@ void LLSpatialBridge::updateSpatialExtents()
|
|||
LLVector4a max;
|
||||
max.setAdd(center, delta);
|
||||
|
||||
newMin.setMin(min);
|
||||
newMax.setMax(max);
|
||||
newMin.setMin(newMin, min);
|
||||
newMax.setMax(newMax, max);
|
||||
}
|
||||
|
||||
LLVector4a diagonal;
|
||||
diagonal.setSub(newMax, newMin);
|
||||
mRadius = diagonal.length3() * 0.5f;
|
||||
mRadius = diagonal.getLength3().getF32() * 0.5f;
|
||||
|
||||
mPositionGroup->setAdd(newMin,newMax);
|
||||
mPositionGroup->mul(0.5f);
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
|
||||
#include "llvoavatar.h"
|
||||
#include "m3math.h"
|
||||
#include "llmatrix4a.h"
|
||||
|
||||
#include "llagent.h" //for gAgent.needsRenderAvatar()
|
||||
#include "lldrawable.h"
|
||||
|
|
@ -495,7 +496,7 @@ S32 LLDrawPoolAvatar::getNumPasses()
|
|||
}
|
||||
else
|
||||
{
|
||||
return 3;
|
||||
return 4;
|
||||
}
|
||||
#else
|
||||
if (LLPipeline::sImpostorRender)
|
||||
|
|
@ -814,26 +815,46 @@ void LLDrawPoolAvatar::endSkinned()
|
|||
#if LL_MESH_ENABLED
|
||||
void LLDrawPoolAvatar::beginRiggedSimple()
|
||||
{
|
||||
if (LLPipeline::sUnderWaterRender)
|
||||
if (sShaderLevel > 0)
|
||||
{
|
||||
sVertexProgram = &gSkinnedObjectSimpleWaterProgram;
|
||||
if (LLPipeline::sUnderWaterRender)
|
||||
{
|
||||
sVertexProgram = &gSkinnedObjectSimpleWaterProgram;
|
||||
}
|
||||
else
|
||||
{
|
||||
sVertexProgram = &gSkinnedObjectSimpleProgram;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sVertexProgram = &gSkinnedObjectSimpleProgram;
|
||||
if (LLPipeline::sUnderWaterRender)
|
||||
{
|
||||
sVertexProgram = &gObjectSimpleWaterProgram;
|
||||
}
|
||||
else
|
||||
{
|
||||
sVertexProgram = &gObjectSimpleProgram;
|
||||
}
|
||||
}
|
||||
|
||||
sDiffuseChannel = 0;
|
||||
sVertexProgram->bind();
|
||||
LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT);
|
||||
if (sShaderLevel > 0 || gPipeline.canUseVertexShaders())
|
||||
{
|
||||
sDiffuseChannel = 0;
|
||||
sVertexProgram->bind();
|
||||
LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
void LLDrawPoolAvatar::endRiggedSimple()
|
||||
{
|
||||
LLVertexBuffer::unbind();
|
||||
sVertexProgram->unbind();
|
||||
sVertexProgram = NULL;
|
||||
LLVertexBuffer::sWeight4Loc = -1;
|
||||
if (sShaderLevel > 0 || gPipeline.canUseVertexShaders())
|
||||
{
|
||||
sVertexProgram->unbind();
|
||||
sVertexProgram = NULL;
|
||||
LLVertexBuffer::sWeight4Loc = -1;
|
||||
}
|
||||
}
|
||||
|
||||
void LLDrawPoolAvatar::beginRiggedAlpha()
|
||||
|
|
@ -1281,8 +1302,10 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass)
|
|||
}
|
||||
|
||||
#if LL_MESH_ENABLED
|
||||
void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLFace* face, const LLMeshSkinInfo* skin, LLVolume* volume, const LLVolumeFace& vol_face)
|
||||
void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, LLFace* face, const LLMeshSkinInfo* skin, LLVolume* volume, const LLVolumeFace& vol_face)
|
||||
{
|
||||
LLVertexBuffer* buffer = face->mVertexBuffer;
|
||||
|
||||
U32 data_mask = 0;
|
||||
for (U32 i = 0; i < face->mRiggedIndex.size(); ++i)
|
||||
{
|
||||
|
|
@ -1292,17 +1315,23 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLFace* face, const LLMeshSk
|
|||
}
|
||||
}
|
||||
|
||||
LLVertexBuffer* buff = face->mVertexBuffer;
|
||||
|
||||
if (!buff ||
|
||||
buff->getTypeMask() != data_mask ||
|
||||
buff->getRequestedVerts() != vol_face.mNumVertices)
|
||||
if (!buffer ||
|
||||
buffer->getTypeMask() != data_mask ||
|
||||
buffer->getRequestedVerts() != vol_face.mNumVertices)
|
||||
{
|
||||
face->setGeomIndex(0);
|
||||
face->setIndicesIndex(0);
|
||||
face->setSize(vol_face.mNumVertices, vol_face.mNumIndices, true);
|
||||
|
||||
face->mVertexBuffer = new LLVertexBuffer(data_mask, 0);
|
||||
if (sShaderLevel > 0)
|
||||
{
|
||||
face->mVertexBuffer = new LLVertexBuffer(data_mask, GL_DYNAMIC_DRAW_ARB);
|
||||
}
|
||||
else
|
||||
{
|
||||
face->mVertexBuffer = new LLVertexBuffer(data_mask, GL_STREAM_DRAW_ARB);
|
||||
}
|
||||
|
||||
face->mVertexBuffer->allocateBuffer(face->getGeomCount(), face->getIndicesCount(), true);
|
||||
|
||||
U16 offset = 0;
|
||||
|
|
@ -1319,7 +1348,83 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLFace* face, const LLMeshSk
|
|||
LLMatrix3 mat_normal(mat3);
|
||||
|
||||
face->getGeometryVolume(*volume, face->getTEOffset(), mat_vert, mat_normal, offset, true);
|
||||
buff = face->mVertexBuffer;
|
||||
buffer = face->mVertexBuffer;
|
||||
}
|
||||
|
||||
if (sShaderLevel <= 0 && face->mLastSkinTime < avatar->getLastSkinTime())
|
||||
{ //perform software vertex skinning for this face
|
||||
LLStrider<LLVector3> position;
|
||||
LLStrider<LLVector3> normal;
|
||||
|
||||
buffer->getVertexStrider(position);
|
||||
buffer->getNormalStrider(normal);
|
||||
|
||||
LLVector4a* pos = (LLVector4a*) position.get();
|
||||
LLVector4a* norm = (LLVector4a*) normal.get();
|
||||
|
||||
//build matrix palette
|
||||
LLMatrix4a mp[64];
|
||||
LLMatrix4* mat = (LLMatrix4*) mp;
|
||||
|
||||
for (U32 j = 0; j < skin->mJointNames.size(); ++j)
|
||||
{
|
||||
LLJoint* joint = avatar->getJoint(skin->mJointNames[j]);
|
||||
if (joint)
|
||||
{
|
||||
mat[j] = skin->mInvBindMatrix[j];
|
||||
mat[j] *= joint->getWorldMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
LLVector4a* weight = vol_face.mWeights;
|
||||
|
||||
LLMatrix4a bind_shape_matrix;
|
||||
bind_shape_matrix.loadu(skin->mBindShapeMatrix);
|
||||
|
||||
for (U32 j = 0; j < buffer->getRequestedVerts(); ++j)
|
||||
{
|
||||
LLMatrix4a final_mat;
|
||||
final_mat.clear();
|
||||
|
||||
S32 idx[4];
|
||||
|
||||
LLVector4 wght;
|
||||
|
||||
F32 scale = 0.f;
|
||||
for (U32 k = 0; k < 4; k++)
|
||||
{
|
||||
F32 w = weight[j][k];
|
||||
|
||||
idx[k] = (S32) floorf(w);
|
||||
wght[k] = w - floorf(w);
|
||||
scale += wght[k];
|
||||
}
|
||||
|
||||
wght *= 1.f/scale;
|
||||
|
||||
for (U32 k = 0; k < 4; k++)
|
||||
{
|
||||
F32 w = wght[k];
|
||||
|
||||
LLMatrix4a src;
|
||||
src.setMul(mp[idx[k]], w);
|
||||
|
||||
final_mat.add(src);
|
||||
}
|
||||
|
||||
|
||||
LLVector4a& v = vol_face.mPositions[j];
|
||||
LLVector4a t;
|
||||
LLVector4a dst;
|
||||
bind_shape_matrix.affineTransform(v, t);
|
||||
final_mat.affineTransform(t, dst);
|
||||
pos[j] = dst;
|
||||
|
||||
LLVector4a& n = vol_face.mNormals[j];
|
||||
bind_shape_matrix.rotate(n, t);
|
||||
final_mat.rotate(t, dst);
|
||||
norm[j] = dst;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1371,7 +1476,7 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow)
|
|||
stop_glerror();
|
||||
|
||||
const LLVolumeFace& vol_face = volume->getVolumeFace(te);
|
||||
updateRiggedFaceVertexBuffer(face, skin, volume, vol_face);
|
||||
updateRiggedFaceVertexBuffer(avatar, face, skin, volume, vol_face);
|
||||
|
||||
stop_glerror();
|
||||
|
||||
|
|
@ -1381,30 +1486,37 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow)
|
|||
|
||||
if (buff)
|
||||
{
|
||||
LLMatrix4 mat[64];
|
||||
if (sShaderLevel > 0)
|
||||
{ //upload matrix palette to shader
|
||||
LLMatrix4 mat[64];
|
||||
|
||||
for (U32 i = 0; i < skin->mJointNames.size(); ++i)
|
||||
{
|
||||
LLJoint* joint = avatar->getJoint(skin->mJointNames[i]);
|
||||
if (joint)
|
||||
for (U32 i = 0; i < skin->mJointNames.size(); ++i)
|
||||
{
|
||||
mat[i] = skin->mInvBindMatrix[i];
|
||||
mat[i] *= joint->getWorldMatrix();
|
||||
LLJoint* joint = avatar->getJoint(skin->mJointNames[i]);
|
||||
if (joint)
|
||||
{
|
||||
mat[i] = skin->mInvBindMatrix[i];
|
||||
mat[i] *= joint->getWorldMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
stop_glerror();
|
||||
|
||||
LLDrawPoolAvatar::sVertexProgram->uniformMatrix4fv("matrixPalette",
|
||||
skin->mJointNames.size(),
|
||||
FALSE,
|
||||
(GLfloat*) mat[0].mMatrix);
|
||||
LLDrawPoolAvatar::sVertexProgram->uniformMatrix4fv("matrixPalette[0]",
|
||||
skin->mJointNames.size(),
|
||||
FALSE,
|
||||
(GLfloat*) mat[0].mMatrix);
|
||||
|
||||
stop_glerror();
|
||||
}
|
||||
else
|
||||
{
|
||||
data_mask &= ~LLVertexBuffer::MAP_WEIGHT4;
|
||||
}
|
||||
|
||||
stop_glerror();
|
||||
|
||||
LLDrawPoolAvatar::sVertexProgram->uniformMatrix4fv("matrixPalette",
|
||||
skin->mJointNames.size(),
|
||||
FALSE,
|
||||
(GLfloat*) mat[0].mMatrix);
|
||||
LLDrawPoolAvatar::sVertexProgram->uniformMatrix4fv("matrixPalette[0]",
|
||||
skin->mJointNames.size(),
|
||||
FALSE,
|
||||
(GLfloat*) mat[0].mMatrix);
|
||||
|
||||
stop_glerror();
|
||||
|
||||
buff->setBuffer(data_mask);
|
||||
|
||||
|
|
|
|||
|
|
@ -138,7 +138,8 @@ public:
|
|||
void endDeferredRiggedSimple();
|
||||
void endDeferredRiggedBump();
|
||||
|
||||
void updateRiggedFaceVertexBuffer(LLFace* facep,
|
||||
void updateRiggedFaceVertexBuffer(LLVOAvatar* avatar,
|
||||
LLFace* facep,
|
||||
const LLMeshSkinInfo* skin,
|
||||
LLVolume* volume,
|
||||
const LLVolumeFace& vol_face);
|
||||
|
|
|
|||
|
|
@ -106,8 +106,8 @@ void planarProjection(LLVector2 &tc, const LLVector4a& normal,
|
|||
LLVector4a tangent;
|
||||
tangent.setCross3(binormal,normal);
|
||||
|
||||
tc.mV[1] = -((tangent.dot3(vec))*2 - 0.5f);
|
||||
tc.mV[0] = 1.0f+((binormal.dot3(vec))*2 - 0.5f);
|
||||
tc.mV[1] = -((tangent.dot3(vec).getF32())*2 - 0.5f);
|
||||
tc.mV[0] = 1.0f+((binormal.dot3(vec).getF32())*2 - 0.5f);
|
||||
}
|
||||
|
||||
void sphericalProjection(LLVector2 &tc, const LLVector4a& normal,
|
||||
|
|
@ -156,6 +156,7 @@ void LLFace::init(LLDrawable* drawablep, LLViewerObject* objp)
|
|||
|
||||
mLastUpdateTime = gFrameTimeSeconds;
|
||||
mLastMoveTime = 0.f;
|
||||
mLastSkinTime = gFrameTimeSeconds;
|
||||
mVSize = 0.f;
|
||||
mPixelArea = 16.f;
|
||||
mState = GLOBAL;
|
||||
|
|
@ -828,8 +829,8 @@ BOOL LLFace::genVolumeBBoxes(const LLVolume &volume, S32 f,
|
|||
LLVector4a max;
|
||||
max.setAdd(center, delta);
|
||||
|
||||
newMin.setMin(min);
|
||||
newMax.setMax(max);
|
||||
newMin.setMin(newMin,min);
|
||||
newMax.setMax(newMax,max);
|
||||
}
|
||||
|
||||
if (!mDrawablep->isActive())
|
||||
|
|
@ -844,11 +845,11 @@ BOOL LLFace::genVolumeBBoxes(const LLVolume &volume, S32 f,
|
|||
t.mul(0.5f);
|
||||
|
||||
//VECTORIZE THIS
|
||||
mCenterLocal.set(t.getF32());
|
||||
mCenterLocal.set(t.getF32ptr());
|
||||
|
||||
t.setSub(newMax,newMin);
|
||||
t.mul(0.5f);
|
||||
mBoundingSphereRadius = t.length3();
|
||||
mBoundingSphereRadius = t.getLength3().getF32();
|
||||
|
||||
updateCenterAgent();
|
||||
}
|
||||
|
|
@ -1313,7 +1314,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
|||
{
|
||||
if (!do_xform)
|
||||
{
|
||||
LLVector4a::memcpyNonAliased16((F32*) tex_coords.get(), (F32*) vf.mTexCoords, num_vertices*2);
|
||||
LLVector4a::memcpyNonAliased16((F32*) tex_coords.get(), (F32*) vf.mTexCoords, num_vertices*2*sizeof(F32));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1529,13 +1530,13 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
|||
if (mDrawablep->isActive())
|
||||
{
|
||||
LLVector3 t;
|
||||
t.set(binormal.getF32());
|
||||
t.set(binormal.getF32ptr());
|
||||
t *= bump_quat;
|
||||
binormal.load3(t.mV);
|
||||
}
|
||||
|
||||
binormal.normalize3fast();
|
||||
tc += LLVector2( bump_s_primary_light_ray.dot3(tangent), bump_t_primary_light_ray.dot3(binormal) );
|
||||
tc += LLVector2( bump_s_primary_light_ray.dot3(tangent).getF32(), bump_t_primary_light_ray.dot3(binormal).getF32() );
|
||||
|
||||
*tex_coords2++ = tc;
|
||||
}
|
||||
|
|
@ -1583,7 +1584,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
|||
|
||||
if (rebuild_weights && vf.mWeights)
|
||||
{
|
||||
LLVector4a::memcpyNonAliased16((F32*) weights, (F32*) vf.mWeights, num_vertices*4);
|
||||
LLVector4a::memcpyNonAliased16((F32*) weights, (F32*) vf.mWeights, num_vertices*4*sizeof(F32));
|
||||
}
|
||||
|
||||
if (rebuild_color)
|
||||
|
|
@ -1705,21 +1706,21 @@ BOOL LLFace::calcPixelArea(F32& cos_angle_to_view_dir, F32& radius)
|
|||
|
||||
LLViewerCamera* camera = LLViewerCamera::getInstance();
|
||||
|
||||
F32 size_squared = size.dot3(size);
|
||||
F32 size_squared = size.dot3(size).getF32();
|
||||
LLVector4a lookAt;
|
||||
LLVector4a t;
|
||||
t.load3(camera->getOrigin().mV);
|
||||
lookAt.setSub(center, t);
|
||||
F32 dist = lookAt.length3();
|
||||
F32 dist = lookAt.getLength3().getF32();
|
||||
lookAt.normalize3fast() ;
|
||||
|
||||
//get area of circle around node
|
||||
F32 app_angle = atanf(fsqrtf(size_squared) / dist);
|
||||
F32 app_angle = atanf((F32) sqrt(size_squared) / dist);
|
||||
radius = app_angle*LLDrawable::sCurPixelAngle;
|
||||
mPixelArea = radius*radius * 3.14159f;
|
||||
LLVector4a x_axis;
|
||||
x_axis.load3(camera->getXAxis().mV);
|
||||
cos_angle_to_view_dir = lookAt.dot3(x_axis);
|
||||
cos_angle_to_view_dir = lookAt.dot3(x_axis).getF32();
|
||||
|
||||
//if has media, check if the face is out of the view frustum.
|
||||
if(hasMedia())
|
||||
|
|
|
|||
|
|
@ -240,6 +240,7 @@ public:
|
|||
LLPointer<LLVertexBuffer> mVertexBuffer;
|
||||
LLPointer<LLVertexBuffer> mLastVertexBuffer;
|
||||
F32 mLastUpdateTime;
|
||||
F32 mLastSkinTime;
|
||||
F32 mLastMoveTime;
|
||||
LLMatrix4* mTextureMatrix;
|
||||
LLDrawInfo* mDrawInfo;
|
||||
|
|
@ -274,7 +275,7 @@ private:
|
|||
|
||||
S32 mReferenceIndex;
|
||||
std::vector<S32> mRiggedIndex;
|
||||
|
||||
|
||||
F32 mVSize;
|
||||
F32 mPixelArea;
|
||||
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ void LLVolumeImplFlexible::onParameterChanged(U16 param_type, LLNetworkData *dat
|
|||
void LLVolumeImplFlexible::onShift(const LLVector4a &shift_vector)
|
||||
{
|
||||
//VECTORIZE THIS
|
||||
LLVector3 shift(shift_vector.getF32());
|
||||
LLVector3 shift(shift_vector.getF32ptr());
|
||||
for (int section = 0; section < (1<<FLEXIBLE_OBJECT_MAX_SECTIONS)+1; ++section)
|
||||
{
|
||||
mSection[section].mPosition += shift;
|
||||
|
|
|
|||
|
|
@ -302,7 +302,7 @@ BOOL LLHUDIcon::lineSegmentIntersect(const LLVector3& start, const LLVector3& en
|
|||
{
|
||||
dir.mul(t);
|
||||
starta.add(dir);
|
||||
*intersection = LLVector3((F32*) &starta.mQ);
|
||||
*intersection = LLVector3(starta.getF32ptr());
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -362,7 +362,7 @@ void LLPanelNearByMedia::updateListItem(LLScrollListItem* item, LLViewerMediaImp
|
|||
debug_str += llformat("%g/", (float)impl->getInterest());
|
||||
|
||||
// proximity distance is actually distance squared -- display it as straight distance.
|
||||
debug_str += llformat("%g/", fsqrtf(impl->getProximityDistance()));
|
||||
debug_str += llformat("%g/", (F32) sqrt(impl->getProximityDistance()));
|
||||
|
||||
// s += llformat("%g/", (float)impl->getCPUUsage());
|
||||
// s += llformat("%g/", (float)impl->getApproximateTextureInterest());
|
||||
|
|
|
|||
|
|
@ -576,8 +576,8 @@ void LLPanelPrimMediaControls::updateShape()
|
|||
const LLVolumeFace& vf = volume->getVolumeFace(mTargetObjectFace);
|
||||
|
||||
LLVector3 ext[2];
|
||||
ext[0].set(vf.mExtents[0].getF32());
|
||||
ext[1].set(vf.mExtents[1].getF32());
|
||||
ext[0].set(vf.mExtents[0].getF32ptr());
|
||||
ext[1].set(vf.mExtents[1].getF32ptr());
|
||||
|
||||
LLVector3 center = (ext[0]+ext[1])*0.5f;
|
||||
LLVector3 size = (ext[1]-ext[0])*0.5f;
|
||||
|
|
|
|||
|
|
@ -1124,13 +1124,13 @@ void LLSelectMgr::getGrid(LLVector3& origin, LLQuaternion &rotation, LLVector3 &
|
|||
size.setSub(max_extents, min_extents);
|
||||
size.mul(0.5f);
|
||||
|
||||
mGridOrigin.set(center.getF32());
|
||||
mGridOrigin.set(center.getF32ptr());
|
||||
LLDrawable* drawable = first_grid_object->mDrawable;
|
||||
if (drawable && drawable->isActive())
|
||||
{
|
||||
mGridOrigin = mGridOrigin * first_grid_object->getRenderMatrix();
|
||||
}
|
||||
mGridScale.set(size.getF32());
|
||||
mGridScale.set(size.getF32ptr());
|
||||
}
|
||||
}
|
||||
else // GRID_MODE_WORLD or just plain default
|
||||
|
|
@ -3543,7 +3543,7 @@ void LLSelectMgr::deselectAllIfTooFar()
|
|||
{
|
||||
if (mDebugSelectMgr)
|
||||
{
|
||||
llinfos << "Selection manager: auto-deselecting, select_dist = " << fsqrtf(select_dist_sq) << llendl;
|
||||
llinfos << "Selection manager: auto-deselecting, select_dist = " << (F32) sqrt(select_dist_sq) << llendl;
|
||||
llinfos << "agent pos global = " << gAgent.getPositionGlobal() << llendl;
|
||||
llinfos << "selection pos global = " << selectionCenter << llendl;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ U8* get_box_fan_indices(LLCamera* camera, const LLVector4a& center)
|
|||
LLVector4a origin;
|
||||
origin.load3(camera->getOrigin().mV);
|
||||
|
||||
S32 cypher = center.greaterThan4(origin).getComparisonMask() & 0x7;
|
||||
S32 cypher = center.greaterThan(origin).getGatheredBits() & 0x7;
|
||||
|
||||
return sOcclusionIndices+cypher*8;
|
||||
}
|
||||
|
|
@ -253,7 +253,7 @@ void LLSpatialGroup::buildOcclusion()
|
|||
r2.splat(0.25f);
|
||||
r2.add(mBounds[1]);
|
||||
|
||||
r.setMin(r2);
|
||||
r.setMin(r, r2);
|
||||
|
||||
LLVector4a* v = mOcclusionVerts;
|
||||
const LLVector4a& c = mBounds[0];
|
||||
|
|
@ -775,8 +775,8 @@ BOOL LLSpatialGroup::boundObjects(BOOL empty, LLVector4a& minOut, LLVector4a& ma
|
|||
}
|
||||
else
|
||||
{
|
||||
minOut.setMin(newMin);
|
||||
maxOut.setMax(newMax);
|
||||
minOut.setMin(minOut, newMin);
|
||||
maxOut.setMax(maxOut, newMax);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
|
@ -1220,8 +1220,8 @@ void LLSpatialGroup::updateDistance(LLCamera &camera)
|
|||
#endif
|
||||
if (!getData().empty())
|
||||
{
|
||||
mRadius = mSpatialPartition->mRenderByGroup ? mObjectBounds[1].length3() :
|
||||
(F32) mOctreeNode->getSize().length3();
|
||||
mRadius = mSpatialPartition->mRenderByGroup ? mObjectBounds[1].getLength3().getF32() :
|
||||
(F32) mOctreeNode->getSize().getLength3().getF32();
|
||||
mDistance = mSpatialPartition->calcDistance(this, camera);
|
||||
mPixelArea = mSpatialPartition->calcPixelArea(this, camera);
|
||||
}
|
||||
|
|
@ -1241,7 +1241,7 @@ F32 LLSpatialPartition::calcDistance(LLSpatialGroup* group, LLCamera& camera)
|
|||
{
|
||||
LLVector4a v = eye;
|
||||
|
||||
dist = eye.length3();
|
||||
dist = eye.getLength3().getF32();
|
||||
eye.normalize3fast();
|
||||
|
||||
if (!group->isState(LLSpatialGroup::ALPHA_DIRTY))
|
||||
|
|
@ -1253,7 +1253,7 @@ F32 LLSpatialPartition::calcDistance(LLSpatialGroup* group, LLCamera& camera)
|
|||
LLVector4a diff;
|
||||
diff.setSub(view_angle, *group->mLastUpdateViewAngle);
|
||||
|
||||
if (diff.length3() > 0.64f)
|
||||
if (diff.getLength3().getF32() > 0.64f)
|
||||
{
|
||||
*group->mViewAngle = view_angle;
|
||||
*group->mLastUpdateViewAngle = view_angle;
|
||||
|
|
@ -1279,11 +1279,11 @@ F32 LLSpatialPartition::calcDistance(LLSpatialGroup* group, LLCamera& camera)
|
|||
t.mul(group->mObjectBounds[1]);
|
||||
v.sub(t);
|
||||
|
||||
group->mDepth = v.dot3(ata);
|
||||
group->mDepth = v.dot3(ata).getF32();
|
||||
}
|
||||
else
|
||||
{
|
||||
dist = eye.length3();
|
||||
dist = eye.getLength3().getF32();
|
||||
}
|
||||
|
||||
if (dist < 16.f)
|
||||
|
|
@ -1497,8 +1497,8 @@ BOOL LLSpatialGroup::rebound()
|
|||
const LLVector4a& max = group->mExtents[1];
|
||||
const LLVector4a& min = group->mExtents[0];
|
||||
|
||||
newMax.setMax(max);
|
||||
newMin.setMin(min);
|
||||
newMax.setMax(newMax, max);
|
||||
newMin.setMin(newMin, min);
|
||||
}
|
||||
|
||||
boundObjects(FALSE, newMin, newMax);
|
||||
|
|
@ -2196,8 +2196,8 @@ BOOL LLSpatialPartition::getVisibleExtents(LLCamera& camera, LLVector3& visMin,
|
|||
LLOctreeCullVisExtents vis(&camera, visMina, visMaxa);
|
||||
vis.traverse(mOctree);
|
||||
|
||||
visMin.set(visMina.getF32());
|
||||
visMax.set(visMaxa.getF32());
|
||||
visMin.set(visMina.getF32ptr());
|
||||
visMax.set(visMaxa.getF32ptr());
|
||||
return vis.mEmpty;
|
||||
}
|
||||
|
||||
|
|
@ -2280,13 +2280,13 @@ BOOL earlyFail(LLCamera* camera, LLSpatialGroup* group)
|
|||
LLVector4a max;
|
||||
max.setAdd(c,r);
|
||||
|
||||
S32 lt = e.lessThan4(min).getComparisonMask() & 0x7;
|
||||
S32 lt = e.lessThan(min).getGatheredBits() & 0x7;
|
||||
if (lt)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
S32 gt = e.greaterThan4(max).getComparisonMask() & 0x7;
|
||||
S32 gt = e.greaterThan(max).getGatheredBits() & 0x7;
|
||||
if (gt)
|
||||
{
|
||||
return FALSE;
|
||||
|
|
@ -2745,8 +2745,8 @@ void renderNormals(LLDrawable* drawablep)
|
|||
p.setAdd(face.mPositions[j], n);
|
||||
|
||||
gGL.color4f(1,1,1,1);
|
||||
gGL.vertex3fv(face.mPositions[j].getF32());
|
||||
gGL.vertex3fv(p.getF32());
|
||||
gGL.vertex3fv(face.mPositions[j].getF32ptr());
|
||||
gGL.vertex3fv(p.getF32ptr());
|
||||
|
||||
if (face.mBinormals)
|
||||
{
|
||||
|
|
@ -2754,8 +2754,8 @@ void renderNormals(LLDrawable* drawablep)
|
|||
p.setAdd(face.mPositions[j], n);
|
||||
|
||||
gGL.color4f(0,1,1,1);
|
||||
gGL.vertex3fv(face.mPositions[j].getF32());
|
||||
gGL.vertex3fv(p.getF32());
|
||||
gGL.vertex3fv(face.mPositions[j].getF32ptr());
|
||||
gGL.vertex3fv(p.getF32ptr());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3024,8 +3024,8 @@ public:
|
|||
LLVolumeOctreeListener* vl = (LLVolumeOctreeListener*) branch->getListener(0);
|
||||
|
||||
LLVector3 center, size;
|
||||
center.set(vl->mBounds[0].getF32());
|
||||
size.set(vl->mBounds[1].getF32());
|
||||
center.set(vl->mBounds[0].getF32ptr());
|
||||
size.set(vl->mBounds[1].getF32ptr());
|
||||
|
||||
drawBoxOutline(center, size);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -810,7 +810,7 @@ BOOL LLViewerCamera::areVertsVisible(LLViewerObject* volumep, BOOL all_verts)
|
|||
render_mata.affineTransform(t, vec);
|
||||
}
|
||||
|
||||
BOOL in_frustum = pointInFrustum(LLVector3(vec.getF32())) > 0;
|
||||
BOOL in_frustum = pointInFrustum(LLVector3(vec.getF32ptr())) > 0;
|
||||
|
||||
if (( !in_frustum && all_verts) ||
|
||||
(in_frustum && !all_verts))
|
||||
|
|
|
|||
|
|
@ -726,8 +726,8 @@ void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_w
|
|||
|
||||
U32 words = num_verts*4;
|
||||
|
||||
LLVector4a::memcpyNonAliased16(v, (F32*) mMesh->getCoords(), words);
|
||||
LLVector4a::memcpyNonAliased16(n, (F32*) mMesh->getNormals(), words);
|
||||
LLVector4a::memcpyNonAliased16(v, (F32*) mMesh->getCoords(), words*sizeof(F32));
|
||||
LLVector4a::memcpyNonAliased16(n, (F32*) mMesh->getNormals(), words*sizeof(F32));
|
||||
|
||||
|
||||
if (!terse_update)
|
||||
|
|
@ -740,9 +740,9 @@ void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_w
|
|||
F32* vw = (F32*) vertex_weightsp.get();
|
||||
F32* cw = (F32*) clothing_weightsp.get();
|
||||
|
||||
LLVector4a::memcpyNonAliased16(tc, (F32*) mMesh->getTexCoords(), num_verts*2);
|
||||
LLVector4a::memcpyNonAliased16(vw, (F32*) mMesh->getWeights(), num_verts);
|
||||
LLVector4a::memcpyNonAliased16(cw, (F32*) mMesh->getClothingWeights(), num_verts*4);
|
||||
LLVector4a::memcpyNonAliased16(tc, (F32*) mMesh->getTexCoords(), num_verts*2*sizeof(F32));
|
||||
LLVector4a::memcpyNonAliased16(vw, (F32*) mMesh->getWeights(), num_verts*sizeof(F32));
|
||||
LLVector4a::memcpyNonAliased16(cw, (F32*) mMesh->getClothingWeights(), num_verts*4*sizeof(F32));
|
||||
}
|
||||
|
||||
const U32 idx_count = mMesh->getNumFaces()*3;
|
||||
|
|
|
|||
|
|
@ -764,7 +764,7 @@ void LLViewerJoystick::moveAvatar(bool reset)
|
|||
sDelta[RX_I] += (cur_delta[RX_I] - sDelta[RX_I]) * time * feather;
|
||||
sDelta[RY_I] += (cur_delta[RY_I] - sDelta[RY_I]) * time * feather;
|
||||
|
||||
handleRun(fsqrtf(sDelta[Z_I]*sDelta[Z_I] + sDelta[X_I]*sDelta[X_I]));
|
||||
handleRun((F32) sqrt(sDelta[Z_I]*sDelta[Z_I] + sDelta[X_I]*sDelta[X_I]));
|
||||
|
||||
// Allow forward/backward movement some priority
|
||||
if (dom_axis == Z_I)
|
||||
|
|
|
|||
|
|
@ -865,7 +865,7 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
|
|||
|
||||
// Set the low priority size for downsampling to approximately the size the texture is displayed at.
|
||||
{
|
||||
F32 approximate_interest_dimension = fsqrtf(pimpl->getInterest());
|
||||
F32 approximate_interest_dimension = (F32) sqrt(pimpl->getInterest());
|
||||
|
||||
pimpl->setLowPrioritySizeLimit(llround(approximate_interest_dimension));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2973,7 +2973,7 @@ F32 LLViewerObject::getBinRadius()
|
|||
const LLVector4a* ext = mDrawable->getSpatialExtents();
|
||||
LLVector4a diff;
|
||||
diff.setSub(ext[1], ext[0]);
|
||||
return diff.length3();
|
||||
return diff.getLength3().getF32();
|
||||
}
|
||||
|
||||
return getScale().magVec();
|
||||
|
|
|
|||
|
|
@ -161,8 +161,8 @@ LLViewerPartGroup::LLViewerPartGroup(const LLVector3 ¢er_agent, const F32 bo
|
|||
|
||||
if (group != NULL)
|
||||
{
|
||||
LLVector3 center(group->mOctreeNode->getCenter().getF32());
|
||||
LLVector3 size(group->mOctreeNode->getSize().getF32());
|
||||
LLVector3 center(group->mOctreeNode->getCenter().getF32ptr());
|
||||
LLVector3 size(group->mOctreeNode->getSize().getF32ptr());
|
||||
size += LLVector3(0.01f, 0.01f, 0.01f);
|
||||
mMinObjPos = center - size;
|
||||
mMaxObjPos = center + size;
|
||||
|
|
|
|||
|
|
@ -1580,7 +1580,7 @@ F32 LLViewerFetchedTexture::calcDecodePriority()
|
|||
|
||||
S32 cur_discard = getCurrentDiscardLevelForFetching();
|
||||
bool have_all_data = (cur_discard >= 0 && (cur_discard <= mDesiredDiscardLevel));
|
||||
F32 pixel_priority = fsqrtf(mMaxVirtualSize);
|
||||
F32 pixel_priority = (F32) sqrt(mMaxVirtualSize);
|
||||
|
||||
F32 priority = 0.f;
|
||||
|
||||
|
|
|
|||
|
|
@ -675,6 +675,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
|
|||
mTexHairColor( NULL ),
|
||||
mTexEyeColor( NULL ),
|
||||
mNeedsSkin(FALSE),
|
||||
mLastSkinTime(0.f),
|
||||
mUpdatePeriod(1),
|
||||
mFullyLoaded(FALSE),
|
||||
mPreviousFullyLoaded(FALSE),
|
||||
|
|
@ -1356,7 +1357,7 @@ void LLVOAvatar::updateSpatialExtents(LLVector4a& newMin, LLVector4a &newMax)
|
|||
if (isImpostor() && !needsImpostorUpdate())
|
||||
{
|
||||
LLVector3 delta = getRenderPosition() -
|
||||
((LLVector3(mDrawable->getPositionGroup().getF32())-mImpostorOffset));
|
||||
((LLVector3(mDrawable->getPositionGroup().getF32ptr())-mImpostorOffset));
|
||||
|
||||
newMin.load3( (mLastAnimExtents[0] + delta).mV);
|
||||
newMax.load3( (mLastAnimExtents[1] + delta).mV);
|
||||
|
|
@ -1364,12 +1365,12 @@ void LLVOAvatar::updateSpatialExtents(LLVector4a& newMin, LLVector4a &newMax)
|
|||
else
|
||||
{
|
||||
getSpatialExtents(newMin,newMax);
|
||||
mLastAnimExtents[0].set(newMin.getF32());
|
||||
mLastAnimExtents[1].set(newMax.getF32());
|
||||
mLastAnimExtents[0].set(newMin.getF32ptr());
|
||||
mLastAnimExtents[1].set(newMax.getF32ptr());
|
||||
LLVector4a pos_group;
|
||||
pos_group.setAdd(newMin,newMax);
|
||||
pos_group.mul(0.5f);
|
||||
mImpostorOffset = LLVector3(pos_group.getF32())-getRenderPosition();
|
||||
mImpostorOffset = LLVector3(pos_group.getF32ptr())-getRenderPosition();
|
||||
mDrawable->setPositionGroup(pos_group);
|
||||
}
|
||||
}
|
||||
|
|
@ -1435,7 +1436,7 @@ void LLVOAvatar::getSpatialExtents(LLVector4a& newMin, LLVector4a& newMax)
|
|||
distance.setSub(ext[1], ext[0]);
|
||||
LLVector4a max_span(max_attachment_span);
|
||||
|
||||
S32 lt = distance.lessThan4(max_span).getComparisonMask() & 0x7;
|
||||
S32 lt = distance.lessThan(max_span).getGatheredBits() & 0x7;
|
||||
|
||||
// Only add the prim to spatial extents calculations if it isn't a megaprim.
|
||||
// max_attachment_span calculated at the start of the function
|
||||
|
|
@ -2533,14 +2534,14 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update)
|
|||
getSpatialExtents(ext[0], ext[1]);
|
||||
LLVector4a diff;
|
||||
diff.setSub(ext[1], mImpostorExtents[1]);
|
||||
if (diff.length3() > 0.05f)
|
||||
if (diff.getLength3().getF32() > 0.05f)
|
||||
{
|
||||
mNeedsImpostorUpdate = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
diff.setSub(ext[0], mImpostorExtents[0]);
|
||||
if (diff.length3() > 0.05f)
|
||||
if (diff.getLength3().getF32() > 0.05f)
|
||||
{
|
||||
mNeedsImpostorUpdate = TRUE;
|
||||
}
|
||||
|
|
@ -3887,7 +3888,8 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass)
|
|||
mMeshLOD[MESH_ID_HAIR]->updateJointGeometry();
|
||||
}
|
||||
mNeedsSkin = FALSE;
|
||||
|
||||
mLastSkinTime = gFrameTimeSeconds;
|
||||
|
||||
LLVertexBuffer* vb = mDrawable->getFace(0)->mVertexBuffer;
|
||||
if (vb)
|
||||
{
|
||||
|
|
@ -4231,7 +4233,7 @@ void LLVOAvatar::updateTextures()
|
|||
|
||||
if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_AREA))
|
||||
{
|
||||
setDebugText(llformat("%4.0f:%4.0f", fsqrtf(mMinPixelArea),fsqrtf(mMaxPixelArea)));
|
||||
setDebugText(llformat("%4.0f:%4.0f", (F32) sqrt(mMinPixelArea),(F32) sqrt(mMaxPixelArea)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -5443,7 +5445,7 @@ void LLVOAvatar::setPixelAreaAndAngle(LLAgent &agent)
|
|||
}
|
||||
else
|
||||
{
|
||||
F32 radius = size.length3();
|
||||
F32 radius = size.getLength3().getF32();
|
||||
mAppAngle = (F32) atan2( radius, range) * RAD_TO_DEG;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -345,6 +345,7 @@ public:
|
|||
U32 renderImpostor(LLColor4U color = LLColor4U(255,255,255,255), S32 diffuse_channel = 0);
|
||||
U32 renderRigid();
|
||||
U32 renderSkinned(EAvatarRenderPass pass);
|
||||
F32 getLastSkinTime() { return mLastSkinTime; }
|
||||
U32 renderSkinnedAttachments();
|
||||
U32 renderTransparent(BOOL first_pass);
|
||||
void renderCollisionVolumes();
|
||||
|
|
@ -357,6 +358,8 @@ private:
|
|||
bool shouldAlphaMask();
|
||||
|
||||
BOOL mNeedsSkin; // avatar has been animated and verts have not been updated
|
||||
F32 mLastSkinTime; //value of gFrameTimeSeconds at last skin update
|
||||
|
||||
S32 mUpdatePeriod;
|
||||
S32 mNumInitFaces; //number of faces generated when creating the avatar drawable, does not inculde splitted faces due to long vertex buffer.
|
||||
|
||||
|
|
|
|||
|
|
@ -328,7 +328,7 @@ void LLVOGrass::updateTextures()
|
|||
{
|
||||
if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_AREA))
|
||||
{
|
||||
setDebugText(llformat("%4.0f", fsqrtf(mPixelArea)));
|
||||
setDebugText(llformat("%4.0f", (F32) sqrt(mPixelArea)));
|
||||
}
|
||||
getTEImage(0)->addTextureStats(mPixelArea);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -999,8 +999,8 @@ BOOL LLVOSurfacePatch::lineSegmentIntersect(const LLVector3& start, const LLVect
|
|||
const LLVector4a* exta = mDrawable->getSpatialExtents();
|
||||
|
||||
LLVector3 ext[2];
|
||||
ext[0].set(exta[0].getF32());
|
||||
ext[1].set(exta[1].getF32());
|
||||
ext[0].set(exta[0].getF32ptr());
|
||||
ext[1].set(exta[1].getF32ptr());
|
||||
|
||||
F32 rad = (delta*tdelta).magVecSquared();
|
||||
|
||||
|
|
|
|||
|
|
@ -254,8 +254,8 @@ void LLVOTextBubble::getGeometry(S32 idx,
|
|||
LLVector2* dst_tc = (LLVector2*) texcoordsp.get();
|
||||
LLVector2* src_tc = (LLVector2*) face.mTexCoords;
|
||||
|
||||
LLVector4a::memcpyNonAliased16((F32*) dst_norm, (F32*) src_norm, face.mNumVertices*4);
|
||||
LLVector4a::memcpyNonAliased16((F32*) dst_tc, (F32*) src_tc, face.mNumVertices*2);
|
||||
LLVector4a::memcpyNonAliased16((F32*) dst_norm, (F32*) src_norm, face.mNumVertices*4*sizeof(F32));
|
||||
LLVector4a::memcpyNonAliased16((F32*) dst_tc, (F32*) src_tc, face.mNumVertices*2*sizeof(F32));
|
||||
|
||||
|
||||
for (U32 i = 0; i < face.mNumVertices; i++)
|
||||
|
|
|
|||
|
|
@ -472,7 +472,7 @@ void LLVOTree::updateTextures()
|
|||
{
|
||||
if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_AREA))
|
||||
{
|
||||
setDebugText(llformat("%4.0f", fsqrtf(mPixelArea)));
|
||||
setDebugText(llformat("%4.0f", (F32) sqrt(mPixelArea)));
|
||||
}
|
||||
mTreeImagep->addTextureStats(mPixelArea);
|
||||
}
|
||||
|
|
@ -1278,8 +1278,8 @@ BOOL LLVOTree::lineSegmentIntersect(const LLVector3& start, const LLVector3& end
|
|||
|
||||
//VECTORIZE THIS
|
||||
LLVector3 ext[2];
|
||||
ext[0].set(exta[0].getF32());
|
||||
ext[1].set(exta[1].getF32());
|
||||
ext[0].set(exta[0].getF32ptr());
|
||||
ext[1].set(exta[1].getF32ptr());
|
||||
|
||||
LLVector3 center = (ext[1]+ext[0])*0.5f;
|
||||
LLVector3 size = (ext[1]-ext[0]);
|
||||
|
|
|
|||
|
|
@ -696,7 +696,7 @@ void LLVOVolume::updateTextureVirtualSize()
|
|||
const LLTextureEntry *te = face->getTextureEntry();
|
||||
LLViewerTexture *imagep = face->getTexture();
|
||||
if (!imagep || !te ||
|
||||
face->mExtents[0].equal3(face->mExtents[1]))
|
||||
face->mExtents[0].equals3(face->mExtents[1]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
@ -820,15 +820,15 @@ void LLVOVolume::updateTextureVirtualSize()
|
|||
|
||||
if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_AREA))
|
||||
{
|
||||
setDebugText(llformat("%.0f:%.0f", fsqrtf(min_vsize),fsqrtf(max_vsize)));
|
||||
setDebugText(llformat("%.0f:%.0f", (F32) sqrt(min_vsize),(F32) sqrt(max_vsize)));
|
||||
}
|
||||
else if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_PRIORITY))
|
||||
{
|
||||
setDebugText(llformat("%.0f:%.0f", fsqrtf(min_vsize),fsqrtf(max_vsize)));
|
||||
setDebugText(llformat("%.0f:%.0f", (F32) sqrt(min_vsize),(F32) sqrt(max_vsize)));
|
||||
}
|
||||
else if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_FACE_AREA))
|
||||
{
|
||||
setDebugText(llformat("%.0f:%.0f", fsqrtf(min_vsize),fsqrtf(max_vsize)));
|
||||
setDebugText(llformat("%.0f:%.0f", (F32) sqrt(min_vsize),(F32) sqrt(max_vsize)));
|
||||
}
|
||||
|
||||
if (mPixelArea == 0)
|
||||
|
|
@ -1355,8 +1355,8 @@ BOOL LLVOVolume::genBBoxes(BOOL force_global)
|
|||
}
|
||||
else
|
||||
{
|
||||
min.setMin(face->mExtents[0]);
|
||||
max.setMax(face->mExtents[1]);
|
||||
min.setMin(min, face->mExtents[0]);
|
||||
max.setMax(max, face->mExtents[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1864,7 +1864,7 @@ LLVector3 LLVOVolume::getApproximateFaceNormal(U8 face_id)
|
|||
result.add(face.mNormals[i]);
|
||||
}
|
||||
|
||||
LLVector3 ret((F32*) &result.mQ);
|
||||
LLVector3 ret(result.getF32ptr());
|
||||
ret = volumeDirectionToAgent(ret);
|
||||
ret.normVec();
|
||||
}
|
||||
|
|
@ -3075,7 +3075,7 @@ F32 LLVOVolume::getBinRadius()
|
|||
LLVector4a rad;
|
||||
rad.setSub(ext[1], ext[0]);
|
||||
|
||||
radius = rad.length3()*0.5f;
|
||||
radius = rad.getLength3().getF32()*0.5f;
|
||||
}
|
||||
else if (mDrawable->isStatic())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -591,7 +591,7 @@ void LLWorld::updateVisibilities()
|
|||
region_list_t::iterator curiter = iter++;
|
||||
LLViewerRegion* regionp = *curiter;
|
||||
F32 height = regionp->getLand().getMaxZ() - regionp->getLand().getMinZ();
|
||||
F32 radius = 0.5f*fsqrtf(height * height + diagonal_squared);
|
||||
F32 radius = 0.5f*(F32) sqrt(height * height + diagonal_squared);
|
||||
if (!regionp->getLand().hasZData()
|
||||
|| LLViewerCamera::getInstance()->sphereInFrustum(regionp->getCenterAgent(), radius))
|
||||
{
|
||||
|
|
@ -612,7 +612,7 @@ void LLWorld::updateVisibilities()
|
|||
}
|
||||
|
||||
F32 height = regionp->getLand().getMaxZ() - regionp->getLand().getMinZ();
|
||||
F32 radius = 0.5f*fsqrtf(height * height + diagonal_squared);
|
||||
F32 radius = 0.5f*(F32) sqrt(height * height + diagonal_squared);
|
||||
if (LLViewerCamera::getInstance()->sphereInFrustum(regionp->getCenterAgent(), radius))
|
||||
{
|
||||
regionp->calculateCameraDistance();
|
||||
|
|
|
|||
|
|
@ -1522,7 +1522,7 @@ F32 LLPipeline::calcPixelArea(const LLVector4a& center, const LLVector4a& size,
|
|||
|
||||
LLVector4a lookAt;
|
||||
lookAt.setSub(center, origin);
|
||||
F32 dist = lookAt.length3();
|
||||
F32 dist = lookAt.getLength3().getF32();
|
||||
|
||||
//ramp down distance for nearby objects
|
||||
//shrink dist by dist/16.
|
||||
|
|
@ -1534,7 +1534,7 @@ F32 LLPipeline::calcPixelArea(const LLVector4a& center, const LLVector4a& size,
|
|||
}
|
||||
|
||||
//get area of circle around node
|
||||
F32 app_angle = atanf(size.length3()/dist);
|
||||
F32 app_angle = atanf(size.getLength3().getF32()/dist);
|
||||
F32 radius = app_angle*LLDrawable::sCurPixelAngle;
|
||||
return radius*radius * F_PI;
|
||||
}
|
||||
|
|
@ -4671,7 +4671,7 @@ static F32 calc_light_dist(LLVOVolume* light, const LLVector3& cam_pos, F32 max_
|
|||
{
|
||||
return max_dist;
|
||||
}
|
||||
F32 dist = fsqrtf(dist2);
|
||||
F32 dist = (F32) sqrt(dist2);
|
||||
dist *= 1.f / inten;
|
||||
dist -= radius;
|
||||
if (selected)
|
||||
|
|
@ -6980,7 +6980,7 @@ void LLPipeline::renderDeferredLighting()
|
|||
|
||||
LLVector4a center;
|
||||
center.load3(drawablep->getPositionAgent().mV);
|
||||
const F32* c = center.getF32();
|
||||
const F32* c = center.getF32ptr();
|
||||
F32 s = volume->getLightRadius()*1.5f;
|
||||
|
||||
LLColor3 col = volume->getLightColor();
|
||||
|
|
@ -7078,7 +7078,7 @@ void LLPipeline::renderDeferredLighting()
|
|||
|
||||
LLVector4a center;
|
||||
center.load3(drawablep->getPositionAgent().mV);
|
||||
const F32* c = center.getF32();
|
||||
const F32* c = center.getF32ptr();
|
||||
F32 s = volume->getLightRadius()*1.5f;
|
||||
|
||||
sVisibleLightCount++;
|
||||
|
|
@ -9184,8 +9184,8 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
|
|||
up.mul(up);
|
||||
up.normalize3fast();
|
||||
|
||||
tdim.mV[0] = fabsf(half_height.dot3(left));
|
||||
tdim.mV[1] = fabsf(half_height.dot3(up));
|
||||
tdim.mV[0] = fabsf(half_height.dot3(left).getF32());
|
||||
tdim.mV[1] = fabsf(half_height.dot3(up).getF32());
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
|
|
|
|||
Loading…
Reference in New Issue