More line endings.

master
Dave Parks 2010-08-19 13:08:57 -05:00
parent 2fea1d5d33
commit 45df2d70f0
6 changed files with 2351 additions and 2351 deletions

View File

@ -68,7 +68,7 @@ if (WINDOWS)
add_definitions(
/Zc:wchar_t-
/arch:SSE2
/arch:SSE2
)
endif (MSVC80 OR MSVC90)

View File

@ -1,128 +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
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)
# -*- 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)

File diff suppressed because it is too large Load Diff

View File

@ -1,158 +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;
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 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