merge up to 3.5.2 development
commit
327c99cadb
|
|
@ -10,7 +10,7 @@ syntax: glob
|
|||
.*.swp
|
||||
#OSX image cache file
|
||||
*.DS_Store
|
||||
*.orig
|
||||
#*.orig
|
||||
LICENSES
|
||||
indra/.distcc
|
||||
build-linux-*
|
||||
|
|
@ -50,6 +50,11 @@ indra/web/doc/asset-upload/plugins/verify-texture
|
|||
installed.xml
|
||||
libraries
|
||||
tarfile_tmp
|
||||
debian/secondlife-viewer*
|
||||
debian/secondlife-appearance-utility*
|
||||
debian/files
|
||||
build-stamp
|
||||
configure-stamp
|
||||
^indra/lib/python/mulib.*
|
||||
^web/locale.*
|
||||
^web/secondlife.com.*
|
||||
|
|
@ -69,4 +74,4 @@ glob:indra/newview/filters.xml
|
|||
glob:indra/newview/avatar_icons_cache.txt
|
||||
glob:indra/newview/avatar_lad.log
|
||||
glob:*.diff
|
||||
*.rej
|
||||
#*.rej
|
||||
|
|
|
|||
3
.hgtags
3
.hgtags
|
|
@ -434,3 +434,6 @@ fd6b510e83f56830e45670c428653134899d3e25 DRTVWR-305
|
|||
55339537d99afc394d1bb7fdb7d074bf321ca62f 3.5.0-beta6
|
||||
902caf2b9fdbdbc5c399c4d5ebcecaf9cb97bab8 DRTVWR-306
|
||||
5c6098fd17d40ee3a38ca6b64f6be9db7f61f0a8 3.5.0-beta7
|
||||
adc360e6bf21390d2665380951d85937cd29a604 3.5.0-release
|
||||
1ada73295ed0eaa4a772ef079c29f57069342c32 DRTVWR-310
|
||||
20cdf370f5c8be6193bef6fb3a81cc3f81275191 3.5.1-beta1
|
||||
|
|
|
|||
|
|
@ -21,6 +21,11 @@ email_status_this_is_os = true
|
|||
# Limit extent of codeticket updates to revisions after...
|
||||
codeticket_since = 3.3.0-release
|
||||
|
||||
# Override build system default toolchain
|
||||
# Note that this will only affect automated builds.
|
||||
Linux.gcc_version = /usr/bin/gcc-4.6
|
||||
Linux.cxx_version = /usr/bin/g++-4.6
|
||||
|
||||
################################################################
|
||||
#### Examples of how to set the viewer_channel ####
|
||||
#
|
||||
|
|
|
|||
118
autobuild.xml
118
autobuild.xml
|
|
@ -18,9 +18,9 @@
|
|||
<key>archive</key>
|
||||
<map>
|
||||
<key>hash</key>
|
||||
<string>b2fe1c860613a68e74d4384be418ffee</string>
|
||||
<string>e6071abd822c0688390382a26f8a782c</string>
|
||||
<key>url</key>
|
||||
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-glod/rev/232684/arch/Darwin/installer/glod-1.0pre4-darwin-20110610.tar.bz2</string>
|
||||
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-glod/rev/267984/arch/Darwin/installer/glod-1.0pre4-darwin-20121211.tar.bz2</string>
|
||||
</map>
|
||||
<key>name</key>
|
||||
<string>darwin</string>
|
||||
|
|
@ -30,9 +30,9 @@
|
|||
<key>archive</key>
|
||||
<map>
|
||||
<key>hash</key>
|
||||
<string>c0c64dae149d0892343e2ff300fd06b9</string>
|
||||
<string>176736c52b3cde6ca8e7d9e173d91731</string>
|
||||
<key>url</key>
|
||||
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-glod/rev/232684/arch/Linux/installer/glod-1.0pre4-linux-20110611.tar.bz2</string>
|
||||
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-glod/rev/268002/arch/Linux/installer/glod-1.0pre4-linux-20121212.tar.bz2</string>
|
||||
</map>
|
||||
<key>name</key>
|
||||
<string>linux</string>
|
||||
|
|
@ -606,9 +606,9 @@
|
|||
<key>archive</key>
|
||||
<map>
|
||||
<key>hash</key>
|
||||
<string>9f8a9dc39fd7c3da0fb3533782d1fddf</string>
|
||||
<string>ca95bbdabd2bed612af79a3704fdbe79</string>
|
||||
<key>url</key>
|
||||
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-freetype/rev/226814/arch/Linux/installer/freetype-2.3.9-linux-20110418.tar.bz2</string>
|
||||
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-freetype/rev/265843/arch/Linux/installer/freetype-2.3.9-linux-20121013.tar.bz2</string>
|
||||
</map>
|
||||
<key>name</key>
|
||||
<string>linux</string>
|
||||
|
|
@ -690,9 +690,9 @@
|
|||
<key>archive</key>
|
||||
<map>
|
||||
<key>hash</key>
|
||||
<string>26f2df1f0b0fa01e94e0253e322f3583</string>
|
||||
<string>1b1f1e9975e3a671c9faf32fcf4b6d43</string>
|
||||
<key>url</key>
|
||||
<string>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/glh_linear-linux-20101001.tar.bz2</string>
|
||||
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-glh_linear/rev/263308/arch/Linux/installer/glh_linear-0.0.0-linux-20120810.tar.bz2</string>
|
||||
</map>
|
||||
<key>name</key>
|
||||
<string>linux</string>
|
||||
|
|
@ -843,6 +843,42 @@
|
|||
</map>
|
||||
</map>
|
||||
</map>
|
||||
<key>gperftools</key>
|
||||
<map>
|
||||
<key>license</key>
|
||||
<string>bsd</string>
|
||||
<key>license_file</key>
|
||||
<string>LICENSES/gperftools.txt</string>
|
||||
<key>name</key>
|
||||
<string>gperftools</string>
|
||||
<key>platforms</key>
|
||||
<map>
|
||||
<key>linux</key>
|
||||
<map>
|
||||
<key>archive</key>
|
||||
<map>
|
||||
<key>hash</key>
|
||||
<string>8aedfdcf670348c18a9991ae1b384a61</string>
|
||||
<key>url</key>
|
||||
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-google-perftools/rev/262672/arch/Linux/installer/gperftools-2.0-linux-20120727.tar.bz2</string>
|
||||
</map>
|
||||
<key>name</key>
|
||||
<string>linux</string>
|
||||
</map>
|
||||
<key>windows</key>
|
||||
<map>
|
||||
<key>archive</key>
|
||||
<map>
|
||||
<key>hash</key>
|
||||
<string>f62841804acb91e1309603a84f3f0ce8</string>
|
||||
<key>url</key>
|
||||
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-google-perftools/rev/262672/arch/CYGWIN/installer/gperftools-2.0-windows-20120727.tar.bz2</string>
|
||||
</map>
|
||||
<key>name</key>
|
||||
<string>windows</string>
|
||||
</map>
|
||||
</map>
|
||||
</map>
|
||||
<key>gstreamer</key>
|
||||
<map>
|
||||
<key>license</key>
|
||||
|
|
@ -1239,6 +1275,32 @@
|
|||
</map>
|
||||
</map>
|
||||
</map>
|
||||
<key>llappearanceutility-source</key>
|
||||
<map>
|
||||
<key>license</key>
|
||||
<string>TEMPORARY</string>
|
||||
<key>license_file</key>
|
||||
<string>LICENSES/llappearanceutility.txt</string>
|
||||
<key>name</key>
|
||||
<string>llappearanceutility-source</string>
|
||||
<key>platforms</key>
|
||||
<map>
|
||||
<key>linux</key>
|
||||
<map>
|
||||
<key>archive</key>
|
||||
<map>
|
||||
<key>hash</key>
|
||||
<string>5bc44db15eb3cca021382e40e04a9a38</string>
|
||||
<key>url</key>
|
||||
<string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/llappearanceutility-source/rev/271972/arch/Linux/installer/llappearanceutility_source-0.1-linux-20130315.tar.bz2</string>
|
||||
</map>
|
||||
<key>name</key>
|
||||
<string>linux</string>
|
||||
</map>
|
||||
</map>
|
||||
<key>version</key>
|
||||
<string>0.1</string>
|
||||
</map>
|
||||
<key>llphysicsextensions_source</key>
|
||||
<map>
|
||||
<key>license</key>
|
||||
|
|
@ -1268,9 +1330,9 @@
|
|||
<key>archive</key>
|
||||
<map>
|
||||
<key>hash</key>
|
||||
<string>b706fdeed4ce2182d434043dc33d9d1d</string>
|
||||
<string>a6856b4d58a3b71321acad7e1fa9c8d4</string>
|
||||
<key>url</key>
|
||||
<string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/llphysicsextensions-source/rev/263415/arch/Linux/installer/llphysicsextensions_source-0.3-linux-20120814.tar.bz2</string>
|
||||
<string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/llphysicsextensions-source/rev/265749/arch/Linux/installer/llphysicsextensions_source-0.3-linux-20121011.tar.bz2</string>
|
||||
</map>
|
||||
<key>name</key>
|
||||
<string>linux</string>
|
||||
|
|
@ -1779,42 +1841,6 @@
|
|||
</map>
|
||||
</map>
|
||||
</map>
|
||||
<key>tcmalloc</key>
|
||||
<map>
|
||||
<key>license</key>
|
||||
<string>bsd</string>
|
||||
<key>license_file</key>
|
||||
<string>LICENSES/google-perftools.txt</string>
|
||||
<key>name</key>
|
||||
<string>tcmalloc</string>
|
||||
<key>platforms</key>
|
||||
<map>
|
||||
<key>linux</key>
|
||||
<map>
|
||||
<key>archive</key>
|
||||
<map>
|
||||
<key>hash</key>
|
||||
<string>8aedfdcf670348c18a9991ae1b384a61</string>
|
||||
<key>url</key>
|
||||
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-google-perftools/rev/262672/arch/Linux/installer/gperftools-2.0-linux-20120727.tar.bz2</string>
|
||||
</map>
|
||||
<key>name</key>
|
||||
<string>linux</string>
|
||||
</map>
|
||||
<key>windows</key>
|
||||
<map>
|
||||
<key>archive</key>
|
||||
<map>
|
||||
<key>hash</key>
|
||||
<string>f62841804acb91e1309603a84f3f0ce8</string>
|
||||
<key>url</key>
|
||||
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-google-perftools/rev/262672/arch/CYGWIN/installer/gperftools-2.0-windows-20120727.tar.bz2</string>
|
||||
</map>
|
||||
<key>name</key>
|
||||
<string>windows</string>
|
||||
</map>
|
||||
</map>
|
||||
</map>
|
||||
<key>tut</key>
|
||||
<map>
|
||||
<key>license</key>
|
||||
|
|
|
|||
108
build.sh
108
build.sh
|
|
@ -109,11 +109,23 @@ build()
|
|||
begin_section "Viewer$variant"
|
||||
|
||||
"$AUTOBUILD" build --no-configure -c $variant
|
||||
viewer_build_ok=$?
|
||||
build_ok=$?
|
||||
end_section "Viewer$variant"
|
||||
|
||||
# Run build extensions
|
||||
if [ $build_ok -eq 0 -a -d ${build_dir}/packages/build-extensions ]; then
|
||||
for extension in ${build_dir}/packages/build-extensions/*.sh; do
|
||||
. $extension
|
||||
if [ $build_ok -ne 0 ]; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# *TODO: Make this a build extension.
|
||||
package_llphysicsextensions_tpv
|
||||
tpvlib_build_ok=$?
|
||||
if [ $viewer_build_ok -eq 0 -a $tpvlib_build_ok -eq 0 ]
|
||||
if [ $build_ok -eq 0 -a $tpvlib_build_ok -eq 0 ]
|
||||
then
|
||||
echo true >"$build_dir"/build_ok
|
||||
else
|
||||
|
|
@ -255,12 +267,86 @@ then
|
|||
end_section WaitParallel
|
||||
fi
|
||||
|
||||
# build debian package
|
||||
if [ "$arch" == "Linux" ]
|
||||
then
|
||||
if $succeeded
|
||||
then
|
||||
if $build_viewer_deb && [ "$last_built_variant" == "Release" ]
|
||||
then
|
||||
begin_section "Build Viewer Debian Package"
|
||||
local have_private_repo=false
|
||||
# mangle the changelog
|
||||
dch --force-bad-version \
|
||||
--distribution unstable \
|
||||
--newversion "${VIEWER_VERSION}" \
|
||||
"Automated build #$build_id, repository $branch revision $revision." \
|
||||
>> "$build_log" 2>&1
|
||||
|
||||
# build the debian package
|
||||
$pkg_default_debuild_command >>"$build_log" 2>&1 || record_failure "\"$pkg_default_debuild_command\" failed."
|
||||
|
||||
# Unmangle the changelog file
|
||||
hg revert debian/changelog
|
||||
|
||||
end_section "Build Viewer Debian Package"
|
||||
|
||||
# Run debian extensions
|
||||
if [ -d ${build_dir}/packages/debian-extensions ]; then
|
||||
for extension in ${build_dir}/packages/debian-extensions/*.sh; do
|
||||
. $extension
|
||||
done
|
||||
fi
|
||||
# Move any .deb results.
|
||||
mkdir -p ../packages_public
|
||||
mkdir -p ../packages_private
|
||||
mv ${build_dir}/packages/*.deb ../packages_public 2>/dev/null || true
|
||||
mv ${build_dir}/packages/packages_private/*.deb ../packages_private 2>/dev/null || true
|
||||
|
||||
# upload debian package and create repository
|
||||
begin_section "Upload Debian Repository"
|
||||
for deb_file in `/bin/ls ../packages_public/*.deb ../*.deb 2>/dev/null`; do
|
||||
upload_item debian $deb_file binary/octet-stream
|
||||
done
|
||||
for deb_file in `/bin/ls ../packages_private/*.deb 2>/dev/null`; do
|
||||
upload_item debian_private $deb_file binary/octet-stream
|
||||
have_private_repo=true
|
||||
done
|
||||
|
||||
create_deb_repo
|
||||
|
||||
# Rename the local debian_repo* directories so that the master buildscript
|
||||
# doesn't make a remote repo again.
|
||||
for debian_repo_type in debian_repo debian_repo_private; do
|
||||
if [ -d "$build_log_dir/$debian_repo_type" ]; then
|
||||
mv $build_log_dir/$debian_repo_type $build_log_dir/${debian_repo_type}_pushed
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $have_private_repo = true ]; then
|
||||
eval "$python_command \"$redirect\" '\${private_S3PROXY_URL}${S3PREFIX}repo/$repo/rev/$revision/index.html'"\
|
||||
>"$build_log_dir/private.html" || fatal generating redirect
|
||||
upload_item global_redirect "$build_log_dir/private.html" text/html
|
||||
|
||||
fi
|
||||
|
||||
end_section "Upload Debian Repository"
|
||||
|
||||
else
|
||||
echo skipping debian build
|
||||
fi
|
||||
else
|
||||
echo skipping debian build due to failed build.
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# check status and upload results to S3
|
||||
if $succeeded
|
||||
then
|
||||
if $build_viewer
|
||||
then
|
||||
begin_section Upload
|
||||
begin_section Upload Installer
|
||||
# Upload installer - note that ONLY THE FIRST ITEM uploaded as "installer"
|
||||
# will appear in the version manager.
|
||||
package=$(installer_$arch)
|
||||
|
|
@ -280,8 +366,9 @@ then
|
|||
do
|
||||
upload_item symbolfile "$build_dir/$symbolfile" binary/octet-stream
|
||||
done
|
||||
|
||||
|
||||
# Upload the llphysicsextensions_tpv package, if one was produced
|
||||
# *TODO: Make this an upload-extension
|
||||
if [ -r "$build_dir/llphysicsextensions_package" ]
|
||||
then
|
||||
llphysicsextensions_package=$(cat $build_dir/llphysicsextensions_package)
|
||||
|
|
@ -295,15 +382,22 @@ then
|
|||
;;
|
||||
esac
|
||||
|
||||
# Run upload extensions
|
||||
if [ -d ${build_dir}/packages/upload-extensions ]; then
|
||||
for extension in ${build_dir}/packages/upload-extensions/*.sh; do
|
||||
. $extension
|
||||
done
|
||||
fi
|
||||
|
||||
# Upload stub installers
|
||||
upload_stub_installers "$build_dir_stubs"
|
||||
fi
|
||||
end_section Upload
|
||||
end_section Upload Installer
|
||||
else
|
||||
echo skipping viewer
|
||||
echo skipping upload of installer
|
||||
fi
|
||||
else
|
||||
echo skipping upload of build results due to failed build.
|
||||
echo skipping upload of installer due to failed build.
|
||||
fi
|
||||
|
||||
# The branch independent build.sh script invoking this script will finish processing
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
secondlife-viewer (0.3) unstable; urgency=low
|
||||
|
||||
* Initial debian configuration
|
||||
|
||||
-- Don Kjer <don@lindenlab.com> Wed, 04 Jul 2012 00:43:03 +0000
|
||||
|
||||
secondlife-viewer (0.2) unstable; urgency=low
|
||||
|
||||
* Adding default LSB headers for squeeze
|
||||
|
||||
-- Tyler Kohler <tyler@lindenlab.com> Thu, 24 Mar 2011 09:43:36 -0700
|
||||
|
||||
secondlife-viewer (0.1) unstable; urgency=low
|
||||
|
||||
* Cloned from debian package skeleton.
|
||||
|
||||
-- Lex Linden <lex@lindenlab.com> Mon, 20 Sep 2010 08:01:59 -0700
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
5
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
Source: secondlife-viewer
|
||||
Section: unknown
|
||||
Priority: extra
|
||||
Maintainer: Don Linden <don@lindenlab.com>
|
||||
Build-Depends: debhelper (>= 5)
|
||||
Homepage: http://secondlife.com
|
||||
Standards-Version: 3.7.2
|
||||
|
||||
Package: secondlife-viewer
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends},
|
||||
ia32-libs,
|
||||
ia32-libs-gtk
|
||||
Description: Second Life Viewer
|
||||
Second Life is an online virtual world developed by Linden Lab.
|
||||
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
Second Life Viewer Copyright: 2000-2012 Linden Research, Inc.
|
||||
|
||||
License:
|
||||
|
||||
3Dconnexion SDK Copyright (C) 1992-2009 3Dconnexion
|
||||
APR Copyright (C) 2011 The Apache Software Foundation
|
||||
Collada DOM Copyright 2006 Sony Computer Entertainment Inc.
|
||||
cURL Copyright (C) 1996-2010, Daniel Stenberg, (daniel@haxx.se)
|
||||
DBus/dbus-glib Copyright (C) 2002, 2003 CodeFactory AB / Copyright (C) 2003, 2004 Red Hat, Inc.
|
||||
expat Copyright (C) 1998, 1999, 2000 Thai Open Source Software Center Ltd.
|
||||
FreeType Copyright (C) 1996-2002, 2006 David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
GL Copyright (C) 1999-2004 Brian Paul.
|
||||
GLOD Copyright (C) 2003-04 Jonathan Cohen, Nat Duca, Chris Niski, Johns Hopkins University and David Luebke, Brenden Schubert, University of Virginia.
|
||||
google-perftools Copyright (c) 2005, Google Inc.
|
||||
Havok.com(TM) Copyright (C) 1999-2001, Telekinesys Research Limited.
|
||||
jpeg2000 Copyright (C) 2001, David Taubman, The University of New South Wales (UNSW)
|
||||
jpeglib Copyright (C) 1991-1998, Thomas G. Lane.
|
||||
ogg/vorbis Copyright (C) 2002, Xiphophorus
|
||||
OpenSSL Copyright (C) 1998-2008 The OpenSSL Project.
|
||||
PCRE Copyright (c) 1997-2012 University of Cambridge
|
||||
SDL Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
|
||||
SSLeay Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
xmlrpc-epi Copyright (C) 2000 Epinions, Inc.
|
||||
zlib Copyright (C) 1995-2012 Jean-loup Gailly and Mark Adler.
|
||||
|
||||
Second Life Viewer uses Havok (TM) Physics. (c)Copyright 1999-2010 Havok.com Inc. (and its Licensors). All Rights Reserved. See www.havok.com for details.
|
||||
|
||||
This software contains source code provided by NVIDIA Corporation.
|
||||
|
||||
All rights reserved. See licenses.txt for details.
|
||||
|
||||
Voice chat Audio coding: Polycom(R) Siren14(TM) (ITU-T Rec. G.722.1 Annex C)
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
#!/bin/sh
|
||||
# postinst script for secondlife-viewer
|
||||
#
|
||||
# Delete this file if you don't need it.
|
||||
#
|
||||
# see: dh_installdeb(1)
|
||||
|
||||
set -e
|
||||
|
||||
# summary of how this script can be called:
|
||||
# * <postinst> `configure' <most-recently-configured-version>
|
||||
# * <old-postinst> `abort-upgrade' <new version>
|
||||
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
|
||||
# <new-version>
|
||||
# * <postinst> `abort-remove'
|
||||
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
|
||||
# <failed-install-package> <version> `removing'
|
||||
# <conflicting-package> <version>
|
||||
# for details, see http://www.debian.org/doc/debian-policy/ or
|
||||
# the debian-policy package
|
||||
|
||||
|
||||
case "$1" in
|
||||
configure)
|
||||
;;
|
||||
|
||||
abort-upgrade|abort-remove|abort-deconfigure)
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "postinst called with unknown argument \`$1'" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# dh_installdeb will replace this with shell code automatically
|
||||
# generated by other debhelper scripts. Don't delete this!
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
exit 0
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
#!/bin/sh
|
||||
# postrm script for secondlife-viewer
|
||||
#
|
||||
# Delete this file if you don't need it.
|
||||
#
|
||||
# see: dh_installdeb(1)
|
||||
|
||||
set -e
|
||||
|
||||
# summary of how this script can be called:
|
||||
# * <postrm> `remove'
|
||||
# * <postrm> `purge'
|
||||
# * <old-postrm> `upgrade' <new-version>
|
||||
# * <new-postrm> `failed-upgrade' <old-version>
|
||||
# * <new-postrm> `abort-install'
|
||||
# * <new-postrm> `abort-install' <old-version>
|
||||
# * <new-postrm> `abort-upgrade' <old-version>
|
||||
# * <disappearer's-postrm> `disappear' <overwriter>
|
||||
# <overwriter-version>
|
||||
# for details, see http://www.debian.org/doc/debian-policy/ or
|
||||
# the debian-policy package
|
||||
|
||||
|
||||
case "$1" in
|
||||
purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "postrm called with unknown argument \`$1'" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# dh_installdeb will replace this with shell code automatically
|
||||
# generated by other debhelper scripts. Don't delete this!
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
exit 0
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
#!/bin/sh
|
||||
# preinst script for secondlife-viewer
|
||||
#
|
||||
# Delete this file if you don't need it.
|
||||
#
|
||||
# see: dh_installdeb(1)
|
||||
|
||||
set -e
|
||||
|
||||
# summary of how this script can be called:
|
||||
# * <new-preinst> `install'
|
||||
# * <new-preinst> `install' <old-version>
|
||||
# * <new-preinst> `upgrade' <old-version>
|
||||
# * <old-preinst> `abort-upgrade' <new-version>
|
||||
# for details, see http://www.debian.org/doc/debian-policy/ or
|
||||
# the debian-policy package
|
||||
|
||||
|
||||
case "$1" in
|
||||
install|upgrade)
|
||||
;;
|
||||
|
||||
abort-upgrade)
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "preinst called with unknown argument \`$1'" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# dh_installdeb will replace this with shell code automatically
|
||||
# generated by other debhelper scripts. Don't delete this!
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
exit 0
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
#!/bin/sh
|
||||
# prerm script for secondlife-viewer
|
||||
#
|
||||
# Delete this file if you don't need it.
|
||||
#
|
||||
# see: dh_installdeb(1)
|
||||
|
||||
set -e
|
||||
|
||||
# summary of how this script can be called:
|
||||
# * <prerm> `remove'
|
||||
# * <old-prerm> `upgrade' <new-version>
|
||||
# * <new-prerm> `failed-upgrade' <old-version>
|
||||
# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
|
||||
# * <deconfigured's-prerm> `deconfigure' `in-favour'
|
||||
# <package-being-installed> <version> `removing'
|
||||
# <conflicting-package> <version>
|
||||
# for details, see http://www.debian.org/doc/debian-policy/ or
|
||||
# the debian-policy package
|
||||
|
||||
|
||||
case "$1" in
|
||||
remove|upgrade|deconfigure)
|
||||
;;
|
||||
|
||||
failed-upgrade)
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "prerm called with unknown argument \`$1'" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# dh_installdeb will replace this with shell code automatically
|
||||
# generated by other debhelper scripts. Don't delete this!
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
exit 0
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
#!/usr/bin/make -f
|
||||
# -*- makefile -*-
|
||||
# Sample debian/rules that uses debhelper.
|
||||
# This file was originally written by Joey Hess and Craig Small.
|
||||
# As a special exception, when this file is copied by dh-make into a
|
||||
# dh-make output file, you may use that output file without restriction.
|
||||
# This special exception was added by Craig Small in version 0.37 of dh-make.
|
||||
|
||||
# Uncomment this to turn on verbose mode.
|
||||
#export DH_VERBOSE=1
|
||||
|
||||
BASEDIR=opt/linden
|
||||
|
||||
VIEWER_PKG=secondlife-viewer
|
||||
VIEWER_PACKAGEDIR=build-linux-i686/newview/packaged
|
||||
VIEWER_DESTDIR=$(CURDIR)/debian/$(VIEWER_PKG)
|
||||
VIEWER_VERSION:=$(shell dpkg-parsechangelog | grep ^Version | sed 's/^Version: //')
|
||||
VIEWER_INSTALLDIR:=$(BASEDIR)/viewer/SecondLife-i686-$(VIEWER_VERSION)
|
||||
|
||||
configure: configure-stamp
|
||||
configure-stamp:
|
||||
dh_testdir
|
||||
# Add here commands to configure the package.
|
||||
|
||||
touch configure-stamp
|
||||
|
||||
build: build-stamp
|
||||
|
||||
build-stamp: configure-stamp
|
||||
dh_testdir
|
||||
|
||||
# Add here commands to compile the package.
|
||||
#$(MAKE)
|
||||
#docbook-to-man debian/secondlife-viewer.sgml > secondlife-viewer.1
|
||||
|
||||
touch $@
|
||||
|
||||
clean:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
rm -f build-stamp configure-stamp
|
||||
|
||||
# Add here commands to clean up after the build process.
|
||||
#-$(MAKE) clean
|
||||
|
||||
dh_clean
|
||||
|
||||
install: build
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_clean -k
|
||||
dh_installdirs
|
||||
|
||||
# Add here commands to install the package into debian/secondlife-viewer.
|
||||
for file in $$(find $(VIEWER_PACKAGEDIR) -type f -o -type l | sed 's~$(VIEWER_PACKAGEDIR)/~~'); do \
|
||||
# create containing directory \
|
||||
install -v -m 755 -o root -g root -d "$$(dirname "$(VIEWER_DESTDIR)/$(VIEWER_INSTALLDIR)/$$file")"; \
|
||||
PERM=644; \
|
||||
if [ -x "$(VIEWER_PACKAGEDIR)/$$file" ]; then \
|
||||
PERM=755; \
|
||||
fi; \
|
||||
if [ -L "$(VIEWER_PACKAGEDIR)/$$file" ]; then \
|
||||
REAL="$$( readlink -f $(VIEWER_PACKAGEDIR)/$$file )"; \
|
||||
RELATIVE="$$( echo $$REAL | sed 's~$(CURDIR)/$(VIEWER_PACKAGEDIR)/~~' )"; \
|
||||
echo dh_link -p $(VIEWER_PKG) "$(VIEWER_INSTALLDIR)/$$RELATIVE" "$(VIEWER_INSTALLDIR)/$$file" ; \
|
||||
dh_link -p $(VIEWER_PKG) "$(VIEWER_INSTALLDIR)/$$RELATIVE" "$(VIEWER_INSTALLDIR)/$$file" ; \
|
||||
else \
|
||||
install -v -m $$PERM -o root -g root "$(VIEWER_PACKAGEDIR)/$$file" "$(VIEWER_DESTDIR)/$(VIEWER_INSTALLDIR)/$$file"; \
|
||||
fi; \
|
||||
done
|
||||
dh_link -p $(VIEWER_PKG) /$(VIEWER_INSTALLDIR)/secondlife /usr/bin/secondlife
|
||||
dh_link -p $(VIEWER_PKG) $(BASEDIR)/viewer/SecondLife-i686-$(VIEWER_VERSION) $(BASEDIR)/viewer/SecondLife
|
||||
|
||||
|
||||
# Build architecture-independent files here.
|
||||
binary-indep: build install
|
||||
# We have nothing to do by default.
|
||||
|
||||
# Build architecture-dependent files here.
|
||||
binary-arch: build install
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_installchangelogs
|
||||
dh_installdocs
|
||||
dh_installexamples
|
||||
# dh_install
|
||||
# dh_installmenu
|
||||
# dh_installdebconf
|
||||
# dh_installlogrotate
|
||||
# dh_installemacsen
|
||||
# dh_installpam
|
||||
# dh_installmime
|
||||
# dh_python
|
||||
|
||||
# To add an init script, uncomment this line and edit debian/init.d and
|
||||
# customize debian/secondlife-viewer.default to suit your needs.
|
||||
# dh_installinit
|
||||
|
||||
# To add cron jobs, uncomment this line and make a crontab file named
|
||||
# debian/cron.d, and it will be installed in /etc/cron.d/
|
||||
# dh_installcron
|
||||
|
||||
# dh_installinfo
|
||||
dh_installman
|
||||
dh_link
|
||||
# dh_strip
|
||||
dh_compress
|
||||
# dh_fixperms
|
||||
# dh_perl
|
||||
# dh_makeshlibs
|
||||
dh_installdeb
|
||||
# dh_shlibdeps
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
|
||||
binary: binary-indep binary-arch
|
||||
.PHONY: build clean binary-indep binary-arch binary install configure
|
||||
|
|
@ -29,6 +29,7 @@ endif ("${CMAKE_SOURCE_DIR}/../autobuild.xml" IS_NEWER_THAN "${CMAKE_BINARY_DIR}
|
|||
add_subdirectory(cmake)
|
||||
|
||||
add_subdirectory(${LIBS_OPEN_PREFIX}llaudio)
|
||||
add_subdirectory(${LIBS_OPEN_PREFIX}llappearance)
|
||||
add_subdirectory(${LIBS_OPEN_PREFIX}llcharacter)
|
||||
add_subdirectory(${LIBS_OPEN_PREFIX}llcommon)
|
||||
add_subdirectory(${LIBS_OPEN_PREFIX}llcorehttp)
|
||||
|
|
@ -51,70 +52,52 @@ if (WINDOWS AND EXISTS ${LIBS_CLOSED_DIR}copy_win_scripts)
|
|||
endif (WINDOWS AND EXISTS ${LIBS_CLOSED_DIR}copy_win_scripts)
|
||||
|
||||
add_custom_target(viewer)
|
||||
if (VIEWER)
|
||||
add_subdirectory(${LIBS_OPEN_PREFIX}llcrashlogger)
|
||||
add_subdirectory(${LIBS_OPEN_PREFIX}llplugin)
|
||||
add_subdirectory(${LIBS_OPEN_PREFIX}llui)
|
||||
add_subdirectory(${LIBS_OPEN_PREFIX}viewer_components)
|
||||
add_subdirectory(${LIBS_OPEN_PREFIX}llcrashlogger)
|
||||
add_subdirectory(${LIBS_OPEN_PREFIX}llplugin)
|
||||
add_subdirectory(${LIBS_OPEN_PREFIX}llui)
|
||||
add_subdirectory(${LIBS_OPEN_PREFIX}viewer_components)
|
||||
|
||||
# Legacy C++ tests. Build always, run if LL_TESTS is true.
|
||||
add_subdirectory(${VIEWER_PREFIX}test)
|
||||
# Legacy C++ tests. Build always, run if LL_TESTS is true.
|
||||
add_subdirectory(${VIEWER_PREFIX}test)
|
||||
|
||||
# viewer media plugins
|
||||
add_subdirectory(${LIBS_OPEN_PREFIX}media_plugins)
|
||||
# viewer media plugins
|
||||
add_subdirectory(${LIBS_OPEN_PREFIX}media_plugins)
|
||||
|
||||
# llplugin testbed code (is this the right way to include it?)
|
||||
if (LL_TESTS AND NOT LINUX)
|
||||
add_subdirectory(${VIEWER_PREFIX}test_apps/llplugintest)
|
||||
endif (LL_TESTS AND NOT LINUX)
|
||||
# llplugin testbed code (is this the right way to include it?)
|
||||
if (LL_TESTS AND NOT LINUX)
|
||||
add_subdirectory(${VIEWER_PREFIX}test_apps/llplugintest)
|
||||
endif (LL_TESTS AND NOT LINUX)
|
||||
|
||||
if (LINUX)
|
||||
add_subdirectory(${VIEWER_PREFIX}linux_crash_logger)
|
||||
add_dependencies(viewer linux-crash-logger-strip-target)
|
||||
elseif (DARWIN)
|
||||
add_subdirectory(${VIEWER_PREFIX}mac_crash_logger)
|
||||
add_dependencies(viewer mac-crash-logger)
|
||||
elseif (WINDOWS)
|
||||
add_subdirectory(${VIEWER_PREFIX}win_crash_logger)
|
||||
# cmake EXISTS requires an absolute path, see indra/cmake/Variables.cmake
|
||||
if (EXISTS ${VIEWER_DIR}win_setup)
|
||||
add_subdirectory(${VIEWER_DIR}win_setup)
|
||||
endif (EXISTS ${VIEWER_DIR}win_setup)
|
||||
add_subdirectory(${VIEWER_PREFIX}win_updater)
|
||||
# add_dependencies(viewer windows-updater windows-setup windows-crash-logger)
|
||||
add_dependencies(viewer windows-updater windows-crash-logger)
|
||||
elseif (SOLARIS)
|
||||
add_subdirectory(solaris_crash_logger)
|
||||
add_dependencies(viewer solaris-crash-logger)
|
||||
endif (LINUX)
|
||||
|
||||
add_subdirectory(${VIEWER_PREFIX}newview)
|
||||
add_dependencies(viewer secondlife-bin)
|
||||
endif (VIEWER)
|
||||
|
||||
# Linux builds the viewer and server in 2 separate projects
|
||||
# In order for build server to work on linux,
|
||||
# the viewer project needs a server target.
|
||||
# This is not true for mac and windows.
|
||||
if (LINUX)
|
||||
add_custom_target(server)
|
||||
if (LINUX)
|
||||
add_subdirectory(${VIEWER_PREFIX}linux_crash_logger)
|
||||
add_subdirectory(${VIEWER_PREFIX}linux_updater)
|
||||
if (INSTALL_PROPRIETARY)
|
||||
include(LLAppearanceUtility)
|
||||
add_subdirectory(${LLAPPEARANCEUTILITY_SRC_DIR} ${LLAPPEARANCEUTILITY_BIN_DIR})
|
||||
endif (INSTALL_PROPRIETARY)
|
||||
add_dependencies(viewer linux-crash-logger-strip-target linux-updater)
|
||||
elseif (DARWIN)
|
||||
add_subdirectory(${VIEWER_PREFIX}mac_crash_logger)
|
||||
add_dependencies(viewer mac-crash-logger)
|
||||
elseif (WINDOWS)
|
||||
add_subdirectory(${VIEWER_PREFIX}win_crash_logger)
|
||||
# cmake EXISTS requires an absolute path, see indra/cmake/Variables.cmake
|
||||
if (EXISTS ${VIEWER_DIR}win_setup)
|
||||
add_subdirectory(${VIEWER_DIR}win_setup)
|
||||
endif (EXISTS ${VIEWER_DIR}win_setup)
|
||||
add_subdirectory(${VIEWER_PREFIX}win_updater)
|
||||
# add_dependencies(viewer windows-updater windows-setup windows-crash-logger)
|
||||
add_dependencies(viewer windows-updater windows-crash-logger)
|
||||
elseif (SOLARIS)
|
||||
add_subdirectory(solaris_crash_logger)
|
||||
add_dependencies(viewer solaris-crash-logger)
|
||||
endif (LINUX)
|
||||
if (SERVER)
|
||||
if (NOT LINUX)
|
||||
add_custom_target(server)
|
||||
endif (NOT LINUX)
|
||||
include(${SERVER_PREFIX}Server.cmake)
|
||||
endif (SERVER)
|
||||
|
||||
# Windows builds include tools like VFS tool
|
||||
if (SERVER)
|
||||
if (WINDOWS)
|
||||
add_subdirectory(${SERVER_PREFIX}tools)
|
||||
endif (WINDOWS)
|
||||
endif (SERVER)
|
||||
add_subdirectory(${VIEWER_PREFIX}newview)
|
||||
add_dependencies(viewer secondlife-bin)
|
||||
|
||||
if (LL_TESTS)
|
||||
# Define after the custom viewer and server targets are created so
|
||||
# Define after the custom targets are created so
|
||||
# individual apps can add themselves as dependencies
|
||||
add_subdirectory(${INTEGRATION_TESTS_PREFIX}integration_tests)
|
||||
endif (LL_TESTS)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@
|
|||
#
|
||||
# Compilation options shared by all Second Life components.
|
||||
|
||||
if(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED)
|
||||
set(${CMAKE_CURRENT_LIST_FILE}_INCLUDED "YES")
|
||||
|
||||
include(Variables)
|
||||
|
||||
# Portable compilation flags.
|
||||
|
|
@ -150,41 +153,21 @@ if (LINUX)
|
|||
-pthread
|
||||
)
|
||||
|
||||
if (SERVER)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth-60")
|
||||
if (EXISTS /etc/debian_version)
|
||||
FILE(READ /etc/debian_version DEBIAN_VERSION)
|
||||
else (EXISTS /etc/debian_version)
|
||||
set(DEBIAN_VERSION "")
|
||||
endif (EXISTS /etc/debian_version)
|
||||
|
||||
if (NOT DEBIAN_VERSION STREQUAL "3.1")
|
||||
add_definitions(-DCTYPE_WORKAROUND)
|
||||
endif (NOT DEBIAN_VERSION STREQUAL "3.1")
|
||||
|
||||
if (EXISTS /usr/lib/mysql4/mysql)
|
||||
link_directories(/usr/lib/mysql4/mysql)
|
||||
endif (EXISTS /usr/lib/mysql4/mysql)
|
||||
|
||||
endif (SERVER)
|
||||
|
||||
if (VIEWER)
|
||||
add_definitions(-DAPPID=secondlife)
|
||||
add_definitions(-fvisibility=hidden)
|
||||
# don't catch SIGCHLD in our base application class for the viewer - some of our 3rd party libs may need their *own* SIGCHLD handler to work. Sigh! The viewer doesn't need to catch SIGCHLD anyway.
|
||||
add_definitions(-DLL_IGNORE_SIGCHLD)
|
||||
if (WORD_SIZE EQUAL 32)
|
||||
add_definitions(-march=pentium4)
|
||||
endif (WORD_SIZE EQUAL 32)
|
||||
add_definitions(-mfpmath=sse)
|
||||
#add_definitions(-ftree-vectorize) # THIS CRASHES GCC 3.1-3.2
|
||||
if (NOT STANDALONE)
|
||||
# this stops us requiring a really recent glibc at runtime
|
||||
add_definitions(-fno-stack-protector)
|
||||
# linking can be very memory-hungry, especially the final viewer link
|
||||
set(CMAKE_CXX_LINK_FLAGS "-Wl,--no-keep-memory")
|
||||
endif (NOT STANDALONE)
|
||||
endif (VIEWER)
|
||||
add_definitions(-DAPPID=secondlife)
|
||||
add_definitions(-fvisibility=hidden)
|
||||
# don't catch SIGCHLD in our base application class for the viewer - some of our 3rd party libs may need their *own* SIGCHLD handler to work. Sigh! The viewer doesn't need to catch SIGCHLD anyway.
|
||||
add_definitions(-DLL_IGNORE_SIGCHLD)
|
||||
if (WORD_SIZE EQUAL 32)
|
||||
add_definitions(-march=pentium4)
|
||||
endif (WORD_SIZE EQUAL 32)
|
||||
add_definitions(-mfpmath=sse)
|
||||
#add_definitions(-ftree-vectorize) # THIS CRASHES GCC 3.1-3.2
|
||||
if (NOT STANDALONE)
|
||||
# this stops us requiring a really recent glibc at runtime
|
||||
add_definitions(-fno-stack-protector)
|
||||
# linking can be very memory-hungry, especially the final viewer link
|
||||
set(CMAKE_CXX_LINK_FLAGS "-Wl,--no-keep-memory")
|
||||
endif (NOT STANDALONE)
|
||||
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-fno-inline ${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O2 ${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
|
|
@ -198,7 +181,7 @@ if (DARWIN)
|
|||
# ucontext_t struct when _XOPEN_SOURCE is not defined (rdar://problem/5578699 ).
|
||||
# As a workaround, define _XOPEN_SOURCE before including ucontext.h.
|
||||
add_definitions(-DLL_DARWIN=1 -D_XOPEN_SOURCE)
|
||||
set(CMAKE_CXX_LINK_FLAGS "-Wl,-headerpad_max_install_names,-search_paths_first")
|
||||
set(CMAKE_CXX_LINK_FLAGS "-Wl,-no_compact_unwind -Wl,-headerpad_max_install_names,-search_paths_first")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_CXX_LINK_FLAGS}")
|
||||
set(DARWIN_extra_cstar_flags "-mlong-branch -g")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${DARWIN_extra_cstar_flags}")
|
||||
|
|
@ -254,6 +237,4 @@ else (STANDALONE)
|
|||
)
|
||||
endif (STANDALONE)
|
||||
|
||||
if(SERVER)
|
||||
include_directories(${LIBS_PREBUILT_DIR}/include/havok)
|
||||
endif(SERVER)
|
||||
endif(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED)
|
||||
|
|
|
|||
|
|
@ -49,9 +49,7 @@ else (STANDALONE)
|
|||
set(APR_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/apr-1)
|
||||
|
||||
if (LINUX)
|
||||
if (VIEWER)
|
||||
list(APPEND APRUTIL_LIBRARIES ${DB_LIBRARIES} uuid)
|
||||
endif (VIEWER)
|
||||
list(APPEND APRUTIL_LIBRARIES ${DB_LIBRARIES} uuid)
|
||||
list(APPEND APRUTIL_LIBRARIES ${DB_LIBRARIES} rt)
|
||||
endif (LINUX)
|
||||
endif (STANDALONE)
|
||||
|
|
|
|||
|
|
@ -13,48 +13,66 @@ set(cmake_SOURCE_FILES
|
|||
BerkeleyDB.cmake
|
||||
Boost.cmake
|
||||
CARes.cmake
|
||||
CURL.cmake
|
||||
CMakeCopyIfDifferent.cmake
|
||||
ConfigurePkgConfig.cmake
|
||||
CURL.cmake
|
||||
Copy3rdPartyLibs.cmake
|
||||
CSharpMacros.cmake
|
||||
DBusGlib.cmake
|
||||
DeploySharedLibs.cmake
|
||||
DirectX.cmake
|
||||
DragDrop.cmake
|
||||
EXPAT.cmake
|
||||
ExamplePlugin.cmake
|
||||
FMOD.cmake
|
||||
FindAPR.cmake
|
||||
FindAutobuild.cmake
|
||||
FindBerkeleyDB.cmake
|
||||
FindCARes.cmake
|
||||
FindELFIO.cmake
|
||||
FindFMOD.cmake
|
||||
FindGLH.cmake
|
||||
FindGoogleBreakpad.cmake
|
||||
FindGooglePerfTools.cmake
|
||||
FindMono.cmake
|
||||
FindMySQL.cmake
|
||||
FindHUNSPELL.cmake
|
||||
FindJsonCpp.cmake
|
||||
FindNDOF.cmake
|
||||
FindOpenJPEG.cmake
|
||||
FindSCP.cmake
|
||||
FindXmlRpcEpi.cmake
|
||||
FindZLIB.cmake
|
||||
FMOD.cmake
|
||||
FreeType.cmake
|
||||
GLEXT.cmake
|
||||
GLH.cmake
|
||||
GLOD.cmake
|
||||
GStreamer010Plugin.cmake
|
||||
GetPrerequisites_2_8.cmake
|
||||
Glui.cmake
|
||||
Glut.cmake
|
||||
GoogleBreakpad.cmake
|
||||
GoogleMock.cmake
|
||||
GooglePerfTools.cmake
|
||||
Havok.cmake
|
||||
Hunspell.cmake
|
||||
JPEG.cmake
|
||||
JsonCpp.cmake
|
||||
LLAddBuildTest.cmake
|
||||
LLAppearance.cmake
|
||||
LLAppearanceUtility.cmake
|
||||
LLAudio.cmake
|
||||
LLCharacter.cmake
|
||||
LLCommon.cmake
|
||||
LLCrashLogger.cmake
|
||||
LLDatabase.cmake
|
||||
LLImage.cmake
|
||||
LLImageJ2COJ.cmake
|
||||
LLInventory.cmake
|
||||
LLKDU.cmake
|
||||
LLLogin.cmake
|
||||
LLMath.cmake
|
||||
LLMessage.cmake
|
||||
LLPhysicsExtensions.cmake
|
||||
LLPlugin.cmake
|
||||
LLPrimitive.cmake
|
||||
LLPhysicsExtensions.cmake
|
||||
LLRender.cmake
|
||||
LLScene.cmake
|
||||
LLSharedLibs.cmake
|
||||
LLTestCommand.cmake
|
||||
LLUI.cmake
|
||||
LLVFS.cmake
|
||||
|
|
@ -62,21 +80,26 @@ set(cmake_SOURCE_FILES
|
|||
LLXML.cmake
|
||||
LScript.cmake
|
||||
Linking.cmake
|
||||
MonoEmbed.cmake
|
||||
MySQL.cmake
|
||||
MediaPluginBase.cmake
|
||||
NDOF.cmake
|
||||
OPENAL.cmake
|
||||
OpenGL.cmake
|
||||
OpenJPEG.cmake
|
||||
OpenSSL.cmake
|
||||
PNG.cmake
|
||||
Python.cmake
|
||||
PluginAPI.cmake
|
||||
Prebuilt.cmake
|
||||
PulseAudio.cmake
|
||||
Python.cmake
|
||||
QuickTimePlugin.cmake
|
||||
TemplateCheck.cmake
|
||||
Tut.cmake
|
||||
UI.cmake
|
||||
UnixInstall.cmake
|
||||
Variables.cmake
|
||||
ViewerMiscLibs.cmake
|
||||
VisualLeakDetector.cmake
|
||||
WebKitLibPlugin.cmake
|
||||
XmlRpcEpi.cmake
|
||||
ZLIB.cmake
|
||||
)
|
||||
|
|
@ -87,10 +110,6 @@ set(master_SOURCE_FILES
|
|||
../CMakeLists.txt
|
||||
)
|
||||
|
||||
if (SERVER)
|
||||
list(APPEND master_SOURCE_FILES ../Server.cmake)
|
||||
endif (SERVER)
|
||||
|
||||
source_group("Master Rules" FILES ${master_SOURCE_FILES})
|
||||
|
||||
set_source_files_properties(${cmake_SOURCE_FILES} ${master_SOURCE_FILES}
|
||||
|
|
|
|||
|
|
@ -1,142 +0,0 @@
|
|||
# - This is a support module for easy Mono/C# handling with CMake
|
||||
# It defines the following macros:
|
||||
#
|
||||
# ADD_CS_LIBRARY (<target> <source>)
|
||||
# ADD_CS_EXECUTABLE (<target> <source>)
|
||||
# INSTALL_GAC (<target>)
|
||||
#
|
||||
# Note that the order of the arguments is important.
|
||||
#
|
||||
# You can optionally set the variable CS_FLAGS to tell the macros whether
|
||||
# to pass additional flags to the compiler. This is particularly useful to
|
||||
# set assembly references, unsafe code, etc... These flags are always reset
|
||||
# after the target was added so you don't have to care about that.
|
||||
#
|
||||
# copyright (c) 2007 Arno Rehn arno@arnorehn.de
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the GPL license.
|
||||
|
||||
|
||||
# ----- support macros -----
|
||||
MACRO(GET_CS_LIBRARY_TARGET_DIR)
|
||||
IF (NOT LIBRARY_OUTPUT_PATH)
|
||||
SET(CS_LIBRARY_TARGET_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||
ELSE (NOT LIBRARY_OUTPUT_PATH)
|
||||
SET(CS_LIBRARY_TARGET_DIR ${LIBRARY_OUTPUT_PATH})
|
||||
ENDIF (NOT LIBRARY_OUTPUT_PATH)
|
||||
ENDMACRO(GET_CS_LIBRARY_TARGET_DIR)
|
||||
|
||||
MACRO(GET_CS_EXECUTABLE_TARGET_DIR)
|
||||
IF (NOT EXECUTABLE_OUTPUT_PATH)
|
||||
SET(CS_EXECUTABLE_TARGET_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||
ELSE (NOT EXECUTABLE_OUTPUT_PATH)
|
||||
SET(CS_EXECUTABLE_TARGET_DIR ${EXECUTABLE_OUTPUT_PATH})
|
||||
ENDIF (NOT EXECUTABLE_OUTPUT_PATH)
|
||||
ENDMACRO(GET_CS_EXECUTABLE_TARGET_DIR)
|
||||
|
||||
MACRO(MAKE_PROPER_FILE_LIST)
|
||||
FOREACH(file ${ARGN})
|
||||
# first assume it's a relative path
|
||||
FILE(GLOB globbed ${CMAKE_CURRENT_SOURCE_DIR}/${file})
|
||||
IF(globbed)
|
||||
FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/${file} native)
|
||||
ELSE(globbed)
|
||||
FILE(TO_NATIVE_PATH ${file} native)
|
||||
ENDIF(globbed)
|
||||
SET(proper_file_list ${proper_file_list} ${native})
|
||||
SET(native "")
|
||||
ENDFOREACH(file)
|
||||
ENDMACRO(MAKE_PROPER_FILE_LIST)
|
||||
# ----- end support macros -----
|
||||
|
||||
MACRO(ADD_CS_LIBRARY target)
|
||||
GET_CS_LIBRARY_TARGET_DIR()
|
||||
|
||||
SET(target_DLL "${CS_LIBRARY_TARGET_DIR}/${target}.dll")
|
||||
MAKE_PROPER_FILE_LIST(${ARGN})
|
||||
FILE(RELATIVE_PATH relative_path ${CMAKE_BINARY_DIR} ${target_DLL})
|
||||
|
||||
SET(target_KEY "${CMAKE_CURRENT_SOURCE_DIR}/${target}.key")
|
||||
SET(target_CS_FLAGS "${CS_FLAGS}")
|
||||
IF(${target}_CS_FLAGS)
|
||||
LIST(APPEND target_CS_FLAGS ${${target}_CS_FLAGS})
|
||||
ENDIF(${target}_CS_FLAGS)
|
||||
IF(EXISTS ${target_KEY})
|
||||
LIST(APPEND target_CS_FLAGS -keyfile:${target_KEY})
|
||||
ENDIF(EXISTS ${target_KEY})
|
||||
|
||||
FOREACH(ref ${${target}_REFS})
|
||||
SET(ref_DLL ${CMAKE_CURRENT_BINARY_DIR}/${ref}.dll)
|
||||
IF(EXISTS ${ref_DLL})
|
||||
LIST(APPEND target_CS_FLAGS -r:${ref_DLL})
|
||||
ELSE(EXISTS ${ref_DLL})
|
||||
LIST(APPEND target_CS_FLAGS -r:${ref})
|
||||
ENDIF(EXISTS ${ref_DLL})
|
||||
ENDFOREACH(ref ${${target}_REFS})
|
||||
|
||||
ADD_CUSTOM_COMMAND (OUTPUT ${target_DLL}
|
||||
COMMAND ${MCS_EXECUTABLE} ${target_CS_FLAGS} -out:${target_DLL} -target:library ${proper_file_list}
|
||||
MAIN_DEPENDENCY ${proper_file_list}
|
||||
DEPENDS ${ARGN}
|
||||
COMMENT "Building ${relative_path}")
|
||||
ADD_CUSTOM_TARGET (${target} ALL DEPENDS ${target_DLL})
|
||||
|
||||
FOREACH(ref ${${target}_REFS})
|
||||
GET_TARGET_PROPERTY(is_target ${ref} TYPE)
|
||||
IF(is_target)
|
||||
ADD_DEPENDENCIES(${target} ${ref})
|
||||
ENDIF(is_target)
|
||||
ENDFOREACH(ref ${${target}_REFS})
|
||||
|
||||
SET(relative_path "")
|
||||
SET(proper_file_list "")
|
||||
ENDMACRO(ADD_CS_LIBRARY)
|
||||
|
||||
MACRO(ADD_CS_EXECUTABLE target)
|
||||
GET_CS_EXECUTABLE_TARGET_DIR()
|
||||
|
||||
# Seems like cmake doesn't like the ".exe" ending for custom commands.
|
||||
# If we call it ${target}.exe, 'make' will later complain about a missing rule.
|
||||
# Create a fake target instead.
|
||||
SET(target_EXE "${CS_EXECUTABLE_TARGET_DIR}/${target}.exe")
|
||||
SET(target_TOUCH "${CS_EXECUTABLE_TARGET_DIR}/${target}.exe-built")
|
||||
GET_DIRECTORY_PROPERTY(clean ADDITIONAL_MAKE_CLEAN_FILES)
|
||||
LIST(APPEND clean ${target}.exe)
|
||||
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${clean}")
|
||||
MAKE_PROPER_FILE_LIST(${ARGN})
|
||||
FILE(RELATIVE_PATH relative_path ${CMAKE_BINARY_DIR} ${target_EXE})
|
||||
SET(target_CS_FLAGS "${CS_FLAGS}")
|
||||
|
||||
FOREACH(ref ${${target}_REFS})
|
||||
SET(ref_DLL ${CMAKE_CURRENT_SOURCE_DIR}/${ref}.dll)
|
||||
IF(EXISTS ${ref_DLL})
|
||||
LIST(APPEND target_CS_FLAGS -r:${ref_DLL})
|
||||
ELSE(EXISTS ${ref_DLL})
|
||||
LIST(APPEND target_CS_FLAGS -r:${ref})
|
||||
ENDIF(EXISTS ${ref_DLL})
|
||||
ENDFOREACH(ref ${${target}_REFS})
|
||||
|
||||
ADD_CUSTOM_COMMAND (OUTPUT "${target_TOUCH}"
|
||||
COMMAND ${MCS_EXECUTABLE} ${target_CS_FLAGS} -out:${target_EXE} ${proper_file_list}
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${target_TOUCH}
|
||||
MAIN_DEPENDENCY ${ARGN}
|
||||
DEPENDS ${ARGN}
|
||||
COMMENT "Building ${relative_path}")
|
||||
ADD_CUSTOM_TARGET ("${target}" ALL DEPENDS "${target_TOUCH}")
|
||||
|
||||
FOREACH(ref ${${target}_REFS})
|
||||
GET_TARGET_PROPERTY(is_target ${ref} TYPE)
|
||||
IF(is_target)
|
||||
ADD_DEPENDENCIES(${target} ${ref})
|
||||
ENDIF(is_target)
|
||||
ENDFOREACH(ref ${${target}_REFS})
|
||||
|
||||
SET(relative_path "")
|
||||
SET(proper_file_list "")
|
||||
ENDMACRO(ADD_CS_EXECUTABLE)
|
||||
|
||||
MACRO(INSTALL_GAC target)
|
||||
GET_CS_LIBRARY_TARGET_DIR()
|
||||
|
||||
INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${GACUTIL_EXECUTABLE} -i ${CS_LIBRARY_TARGET_DIR}/${target}.dll -package 2.0)")
|
||||
ENDMACRO(INSTALL_GAC target)
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
# -*- cmake -*-
|
||||
|
||||
SET(DEBUG_PKG_CONFIG "YES")
|
||||
|
||||
# Don't change this if manually set by user.
|
||||
IF("$ENV{PKG_CONFIG_LIBDIR}" STREQUAL "")
|
||||
|
||||
# Guess at architecture-specific system library paths.
|
||||
if (WORD_SIZE EQUAL 32)
|
||||
SET(PKG_CONFIG_NO_MULTI_GUESS /usr/lib32 /usr/lib)
|
||||
SET(PKG_CONFIG_NO_MULTI_LOCAL_GUESS /usr/local/lib32 /usr/local/lib)
|
||||
SET(PKG_CONFIG_MULTI_GUESS /usr/lib/i386-linux-gnu)
|
||||
SET(PKG_CONFIG_MULTI_LOCAL_GUESS /usr/local/lib/i386-linux-gnu)
|
||||
else (WORD_SIZE EQUAL 32)
|
||||
SET(PKG_CONFIG_NO_MULTI_GUESS /usr/lib64 /usr/lib)
|
||||
SET(PKG_CONFIG_NO_MULTI_LOCAL_GUESS /usr/local/lib64 /usr/local/lib)
|
||||
SET(PKG_CONFIG_MULTI_GUESS /usr/local/lib/x86_64-linux-gnu)
|
||||
SET(PKG_CONFIG_MULTI_LOCAL_GUESS /usr/local/lib/x86_64-linux-gnu)
|
||||
endif (WORD_SIZE EQUAL 32)
|
||||
|
||||
# Use DPKG architecture, if available.
|
||||
IF (${DPKG_ARCH})
|
||||
SET(PKG_CONFIG_MULTI_GUESS /usr/lib/${DPKG_ARCH})
|
||||
SET(PKG_CONFIG_MULTI_LOCAL_GUESS /usrlocal/lib/${DPKG_ARCH})
|
||||
ENDIF (${DPKG_ARCH})
|
||||
|
||||
# Explicitly include anything listed in PKG_CONFIG_PATH
|
||||
string(REPLACE ":" ";" PKG_CONFIG_PATH_LIST "$ENV{PKG_CONFIG_PATH}")
|
||||
FOREACH(PKG_CONFIG_DIR ${PKG_CONFIG_PATH_LIST})
|
||||
SET(VALID_PKG_LIBDIRS "${VALID_PKG_LIBDIRS}:${PKG_CONFIG_DIR}/pkgconfig")
|
||||
ENDFOREACH(PKG_CONFIG_DIR)
|
||||
|
||||
# Look for valid pkgconfig directories.
|
||||
FIND_PATH(PKG_CONFIG_ENV pkgconfig ENV LD_LIBRARY_PATH)
|
||||
FIND_PATH(PKG_CONFIG_MULTI pkgconfig HINT ${PKG_CONFIG_MULTI_GUESS})
|
||||
FIND_PATH(PKG_CONFIG_MULTI_LOCAL pkgconfig HINT ${PKG_CONFIG_MULTI_LOCAL_GUESS})
|
||||
FIND_PATH(PKG_CONFIG_NO_MULTI pkgconfig HINT ${PKG_CONFIG_NO_MULTI_GUESS})
|
||||
FIND_PATH(PKG_CONFIG_NO_MULTI_LOCAL pkgconfig HINT ${PKG_CONFIG_NO_MULTI_LOCAL_GUESS})
|
||||
|
||||
# Add anything we found to our list.
|
||||
IF(NOT PKG_CONFIG_ENV STREQUAL PKG_CONFIG_ENV-NOTFOUND)
|
||||
SET(VALID_PKG_LIBDIRS "${VALID_PKG_LIBDIRS}:${PKG_CONFIG_ENV}/pkgconfig")
|
||||
ENDIF(NOT PKG_CONFIG_ENV STREQUAL PKG_CONFIG_ENV-NOTFOUND)
|
||||
|
||||
IF(NOT PKG_CONFIG_MULTI STREQUAL PKG_CONFIG_MULTI-NOTFOUND)
|
||||
SET(VALID_PKG_LIBDIRS "${VALID_PKG_LIBDIRS}:${PKG_CONFIG_MULTI}/pkgconfig")
|
||||
ENDIF(NOT PKG_CONFIG_MULTI STREQUAL PKG_CONFIG_MULTI-NOTFOUND)
|
||||
|
||||
IF(NOT PKG_CONFIG_MULTI_LOCAL STREQUAL PKG_CONFIG_MULTI_LOCAL-NOTFOUND)
|
||||
SET(VALID_PKG_LIBDIRS "${VALID_PKG_LIBDIRS}:${PKG_CONFIG_MULTI_LOCAL}/pkgconfig")
|
||||
ENDIF(NOT PKG_CONFIG_MULTI_LOCAL STREQUAL PKG_CONFIG_MULTI_LOCAL-NOTFOUND)
|
||||
|
||||
IF(NOT PKG_CONFIG_NO_MULTI STREQUAL PKG_CONFIG_NO_MULTI-NOTFOUND)
|
||||
SET(VALID_PKG_LIBDIRS "${VALID_PKG_LIBDIRS}:${PKG_CONFIG_NO_MULTI}/pkgconfig")
|
||||
ENDIF(NOT PKG_CONFIG_NO_MULTI STREQUAL PKG_CONFIG_NO_MULTI-NOTFOUND)
|
||||
|
||||
IF(NOT PKG_CONFIG_NO_MULTI_LOCAL STREQUAL PKG_CONFIG_NO_MULTI_LOCAL-NOTFOUND)
|
||||
SET(VALID_PKG_LIBDIRS "${VALID_PKG_LIBDIRS}:${PKG_CONFIG_NO_MULTI_LOCAL}/pkgconfig")
|
||||
ENDIF(NOT PKG_CONFIG_NO_MULTI_LOCAL STREQUAL PKG_CONFIG_NO_MULTI_LOCAL-NOTFOUND)
|
||||
|
||||
# Also add some non-architecture specific package locations.
|
||||
SET(VALID_PKG_LIBDIRS "${VALID_PKG_LIBDIRS}:/usr/share/pkgconfig:/usr/local/share/pkgconfig")
|
||||
|
||||
# Remove first unwanted ':'
|
||||
string(SUBSTRING ${VALID_PKG_LIBDIRS} 1 -1 VALID_PKG_LIBDIRS)
|
||||
|
||||
# Set PKG_CONFIG_LIBDIR environment.
|
||||
SET(ENV{PKG_CONFIG_LIBDIR} ${VALID_PKG_LIBDIRS})
|
||||
ENDIF("$ENV{PKG_CONFIG_LIBDIR}" STREQUAL "")
|
||||
|
||||
IF(DEBUG_PKG_CONFIG)
|
||||
MESSAGE(STATUS "Using PKG_CONFIG_LIBDIR=$ENV{PKG_CONFIG_LIBDIR}")
|
||||
ENDIF(DEBUG_PKG_CONFIG)
|
||||
|
||||
|
|
@ -266,7 +266,7 @@ elseif(LINUX)
|
|||
libdb-5.1.so
|
||||
libexpat.so
|
||||
libexpat.so.1
|
||||
libglod.so
|
||||
libGLOD.so
|
||||
libgmock_main.so
|
||||
libgmock.so.0
|
||||
libgmodule-2.0.so
|
||||
|
|
|
|||
|
|
@ -1,16 +0,0 @@
|
|||
# -*- cmake -*-
|
||||
# Copies a binary back to the source directory
|
||||
|
||||
MACRO(COPY_BACK_TO_SOURCE target)
|
||||
GET_TARGET_PROPERTY(FROM ${target} LOCATION)
|
||||
SET(TO ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
#MESSAGE("TARGET ${target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${FROM} ${TO}")
|
||||
ADD_CUSTOM_COMMAND(
|
||||
TARGET ${target} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${FROM} ${TO}
|
||||
DEPENDS ${FROM}
|
||||
COMMENT "Copying ${target} to ${CMAKE_CURRENT_BINARY_DIR}"
|
||||
)
|
||||
ENDMACRO(COPY_BACK_TO_SOURCE)
|
||||
|
||||
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
# -*- cmake -*-
|
||||
|
||||
if (VIEWER AND WINDOWS)
|
||||
if (WINDOWS)
|
||||
find_path(DIRECTX_INCLUDE_DIR dxdiag.h
|
||||
"$ENV{DXSDK_DIR}/Include"
|
||||
"$ENV{PROGRAMFILES}/Microsoft DirectX SDK (June 2010)/Include"
|
||||
"$ENV{PROGRAMFILES}/Microsoft DirectX SDK (August 2009)/Include"
|
||||
"$ENV{PROGRAMFILES}/Microsoft DirectX SDK (March 2009)/Include"
|
||||
"$ENV{PROGRAMFILES}/Microsoft DirectX SDK (August 2008)/Include"
|
||||
|
|
@ -25,6 +26,7 @@ if (VIEWER AND WINDOWS)
|
|||
|
||||
find_path(DIRECTX_LIBRARY_DIR dxguid.lib
|
||||
"$ENV{DXSDK_DIR}/Lib/x86"
|
||||
"$ENV{PROGRAMFILES}/Microsoft DirectX SDK (June 2010)/Lib/x86"
|
||||
"$ENV{PROGRAMFILES}/Microsoft DirectX SDK (August 2009)/Lib/x86"
|
||||
"$ENV{PROGRAMFILES}/Microsoft DirectX SDK (March 2009)/Lib/x86"
|
||||
"$ENV{PROGRAMFILES}/Microsoft DirectX SDK (August 2008)/Lib/x86"
|
||||
|
|
@ -43,4 +45,4 @@ if (VIEWER AND WINDOWS)
|
|||
message(FATAL_ERROR "Could not find DirectX SDK Libraries")
|
||||
endif (DIRECTX_LIBRARY_DIR)
|
||||
|
||||
endif (VIEWER AND WINDOWS)
|
||||
endif (WINDOWS)
|
||||
|
|
|
|||
|
|
@ -1,23 +1,20 @@
|
|||
# -*- cmake -*-
|
||||
|
||||
if (VIEWER)
|
||||
set(OS_DRAG_DROP ON CACHE BOOL "Build the viewer with OS level drag and drop turned on or off")
|
||||
|
||||
set(OS_DRAG_DROP ON CACHE BOOL "Build the viewer with OS level drag and drop turned on or off")
|
||||
if (OS_DRAG_DROP)
|
||||
|
||||
if (OS_DRAG_DROP)
|
||||
if (WINDOWS)
|
||||
add_definitions(-DLL_OS_DRAGDROP_ENABLED=1)
|
||||
endif (WINDOWS)
|
||||
|
||||
if (WINDOWS)
|
||||
add_definitions(-DLL_OS_DRAGDROP_ENABLED=1)
|
||||
endif (WINDOWS)
|
||||
if (DARWIN)
|
||||
add_definitions(-DLL_OS_DRAGDROP_ENABLED=1)
|
||||
endif (DARWIN)
|
||||
|
||||
if (DARWIN)
|
||||
add_definitions(-DLL_OS_DRAGDROP_ENABLED=1)
|
||||
endif (DARWIN)
|
||||
if (LINUX)
|
||||
add_definitions(-DLL_OS_DRAGDROP_ENABLED=0)
|
||||
endif (LINUX)
|
||||
|
||||
if (LINUX)
|
||||
add_definitions(-DLL_OS_DRAGDROP_ENABLED=0)
|
||||
endif (LINUX)
|
||||
endif (OS_DRAG_DROP)
|
||||
|
||||
endif (OS_DRAG_DROP)
|
||||
|
||||
endif (VIEWER)
|
||||
|
|
|
|||
|
|
@ -1,34 +0,0 @@
|
|||
# -*- cmake -*-
|
||||
|
||||
include(Python)
|
||||
include(FindSVN)
|
||||
|
||||
macro (use_svn_external _binary _path _url _rev)
|
||||
if (NOT STANDALONE)
|
||||
if(${CMAKE_BINARY_DIR}/temp/sentinel_installed IS_NEWER_THAN ${CMAKE_BINARY_DIR}/temp/${_binary}_installed)
|
||||
if(SVN_FOUND)
|
||||
if(DEBUG_EXTERNALS)
|
||||
message("cd ${_path} && ${SVN_EXECUTABLE} checkout -r ${_rev} ${_url} ${_binary}")
|
||||
endif(DEBUG_EXTERNALS)
|
||||
execute_process(COMMAND ${SVN_EXECUTABLE}
|
||||
checkout
|
||||
-r ${_rev}
|
||||
${_url}
|
||||
${_binary}
|
||||
WORKING_DIRECTORY ${_path}
|
||||
RESULT_VARIABLE ${_binary}_installed
|
||||
)
|
||||
else(SVN_FOUND)
|
||||
message(FATAL_ERROR "Failed to find SVN_EXECUTABLE")
|
||||
endif(SVN_FOUND)
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/temp/${_binary}_installed "${${_binary}_installed}")
|
||||
else(${CMAKE_BINARY_DIR}/temp/sentinel_installed IS_NEWER_THAN ${CMAKE_BINARY_DIR}/temp/${_binary}_installed)
|
||||
set(${_binary}_installed 0)
|
||||
endif(${CMAKE_BINARY_DIR}/temp/sentinel_installed IS_NEWER_THAN ${CMAKE_BINARY_DIR}/temp/${_binary}_installed)
|
||||
if(NOT ${_binary}_installed EQUAL 0)
|
||||
message(FATAL_ERROR
|
||||
"Failed to download or unpack prebuilt '${_binary}'."
|
||||
" Process returned ${${_binary}_installed}.")
|
||||
endif (NOT ${_binary}_installed EQUAL 0)
|
||||
endif (NOT STANDALONE)
|
||||
endmacro (use_svn_external _binary _path _url _rev)
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
# -*- cmake -*-
|
||||
|
||||
# - Find ELFIO
|
||||
# Find the ELFIO includes and library
|
||||
# This module defines
|
||||
# ELFIO_INCLUDE_DIR, where to find elfio.h, etc.
|
||||
# ELFIO_LIBRARIES, the libraries needed to use ELFIO.
|
||||
# ELFIO_FOUND, If false, do not try to use ELFIO.
|
||||
# also defined, but not for general use are
|
||||
# ELFIO_LIBRARY, where to find the ELFIO library.
|
||||
|
||||
FIND_PATH(ELFIO_INCLUDE_DIR ELFIO/ELFIO.h
|
||||
/usr/local/include
|
||||
/usr/include
|
||||
)
|
||||
|
||||
SET(ELFIO_NAMES ${ELFIO_NAMES} ELFIO)
|
||||
FIND_LIBRARY(ELFIO_LIBRARY
|
||||
NAMES ${ELFIO_NAMES}
|
||||
PATHS /usr/lib /usr/local/lib
|
||||
)
|
||||
|
||||
IF (ELFIO_LIBRARY AND ELFIO_INCLUDE_DIR)
|
||||
SET(ELFIO_LIBRARIES ${ELFIO_LIBRARY})
|
||||
SET(ELFIO_FOUND "YES")
|
||||
ELSE (ELFIO_LIBRARY AND ELFIO_INCLUDE_DIR)
|
||||
SET(ELFIO_FOUND "NO")
|
||||
ENDIF (ELFIO_LIBRARY AND ELFIO_INCLUDE_DIR)
|
||||
|
||||
|
||||
IF (ELFIO_FOUND)
|
||||
IF (NOT ELFIO_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found ELFIO: ${ELFIO_LIBRARIES}")
|
||||
ENDIF (NOT ELFIO_FIND_QUIETLY)
|
||||
ELSE (ELFIO_FOUND)
|
||||
IF (ELFIO_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could not find ELFIO library")
|
||||
ENDIF (ELFIO_FIND_REQUIRED)
|
||||
ENDIF (ELFIO_FOUND)
|
||||
|
||||
# Deprecated declarations.
|
||||
SET (NATIVE_ELFIO_INCLUDE_PATH ${ELFIO_INCLUDE_DIR} )
|
||||
GET_FILENAME_COMPONENT (NATIVE_ELFIO_LIB_PATH ${ELFIO_LIBRARY} PATH)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
ELFIO_LIBRARY
|
||||
ELFIO_INCLUDE_DIR
|
||||
)
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
# -*- cmake -*-
|
||||
|
||||
# - Find llqtwebkit
|
||||
# Find the llqtwebkit includes and library
|
||||
# This module defines
|
||||
# LLQTWEBKIT_INCLUDE_DIR, where to find llqtwebkit.h, etc.
|
||||
# LLQTWEBKIT_LIBRARY, the llqtwebkit library with full path.
|
||||
# LLQTWEBKIT_FOUND, If false, do not try to use llqtwebkit.
|
||||
# also defined, but not for general use are
|
||||
# LLQTWEBKIT_LIBRARIES, the libraries needed to use llqtwebkit.
|
||||
# LLQTWEBKIT_LIBRARY_DIRS, where to find the llqtwebkit library.
|
||||
# LLQTWEBKIT_DEFINITIONS - You should add_definitions(${LLQTWEBKIT_DEFINITIONS})
|
||||
# before compiling code that includes llqtwebkit library files.
|
||||
|
||||
# Try to use pkg-config first.
|
||||
# This allows to have two different libllqtwebkit packages installed:
|
||||
# one for viewer 2.x and one for viewer 1.x.
|
||||
include(FindPkgConfig)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
if (LLQtWebkit_FIND_REQUIRED AND LLQtWebkit_FIND_VERSION)
|
||||
set(_PACKAGE_ARGS libllqtwebkit>=${LLQtWebkit_FIND_VERSION} REQUIRED)
|
||||
else (LLQtWebkit_FIND_REQUIRED AND LLQtWebkit_FIND_VERSION)
|
||||
set(_PACKAGE_ARGS libllqtwebkit)
|
||||
endif (LLQtWebkit_FIND_REQUIRED AND LLQtWebkit_FIND_VERSION)
|
||||
if (NOT "${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_LESS "2.8.2")
|
||||
# As virtually nobody will have a pkg-config file for this, do this check always quiet.
|
||||
# Unfortunately cmake 2.8.2 or higher is required for pkg_check_modules to have a 'QUIET'.
|
||||
set(_PACKAGE_ARGS ${_PACKAGE_ARGS} QUIET)
|
||||
endif ()
|
||||
pkg_check_modules(LLQTWEBKIT ${_PACKAGE_ARGS})
|
||||
endif (PKG_CONFIG_FOUND)
|
||||
set(LLQTWEBKIT_DEFINITIONS ${LLQTWEBKIT_CFLAGS_OTHER})
|
||||
|
||||
find_path(LLQTWEBKIT_INCLUDE_DIR llqtwebkit.h NO_SYSTEM_ENVIRONMENT_PATH HINTS ${LLQTWEBKIT_INCLUDE_DIRS})
|
||||
|
||||
find_library(LLQTWEBKIT_LIBRARY NAMES llqtwebkit NO_SYSTEM_ENVIRONMENT_PATH HINTS ${LLQTWEBKIT_LIBRARY_DIRS})
|
||||
|
||||
if (NOT PKG_CONFIG_FOUND OR NOT LLQTWEBKIT_FOUND) # If pkg-config couldn't find it, pretend we don't have pkg-config.
|
||||
set(LLQTWEBKIT_LIBRARIES llqtwebkit)
|
||||
get_filename_component(LLQTWEBKIT_LIBRARY_DIRS ${LLQTWEBKIT_LIBRARY} PATH)
|
||||
endif (NOT PKG_CONFIG_FOUND OR NOT LLQTWEBKIT_FOUND)
|
||||
|
||||
# Handle the QUIETLY and REQUIRED arguments and set LLQTWEBKIT_FOUND
|
||||
# to TRUE if all listed variables are TRUE.
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(
|
||||
LLQTWEBKIT
|
||||
DEFAULT_MSG
|
||||
LLQTWEBKIT_LIBRARY
|
||||
LLQTWEBKIT_INCLUDE_DIR
|
||||
LLQTWEBKIT_LIBRARIES
|
||||
LLQTWEBKIT_LIBRARY_DIRS
|
||||
)
|
||||
|
||||
mark_as_advanced(
|
||||
LLQTWEBKIT_LIBRARY
|
||||
LLQTWEBKIT_INCLUDE_DIR
|
||||
LLQTWEBKIT_LIBRARIES
|
||||
LLQTWEBKIT_LIBRARY_DIRS
|
||||
LLQTWEBKIT_DEFINITIONS
|
||||
)
|
||||
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
#Find the windows manifest tool.
|
||||
|
||||
FIND_PROGRAM(HAVE_MANIFEST_TOOL NAMES mt
|
||||
PATHS
|
||||
"$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/VC/bin"
|
||||
"$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/Common7/Tools/Bin"
|
||||
"$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/SDK/v2.0/Bin")
|
||||
IF(HAVE_MANIFEST_TOOL)
|
||||
MESSAGE(STATUS "Found Mainfest Tool. Embedding custom manifests.")
|
||||
ELSE(HAVE_MANIFEST_TOOL)
|
||||
MESSAGE(FATAL_ERROR "Manifest tool, mt.exe, can't be found.")
|
||||
ENDIF(HAVE_MANIFEST_TOOL)
|
||||
|
||||
STRING(REPLACE "/MANIFEST" "/MANIFEST:NO" CMAKE_EXE_LINKER_FLAGS
|
||||
${CMAKE_EXE_LINKER_FLAGS})
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
# - Try to find the mono, mcs, gmcs and gacutil
|
||||
#
|
||||
# defines
|
||||
#
|
||||
# MONO_FOUND - system has mono, mcs, gmcs and gacutil
|
||||
# MONO_PATH - where to find 'mono'
|
||||
# MCS_PATH - where to find 'mcs'
|
||||
# GMCS_PATH - where to find 'gmcs'
|
||||
# GACUTIL_PATH - where to find 'gacutil'
|
||||
#
|
||||
# copyright (c) 2007 Arno Rehn arno@arnorehn.de
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the GPL license.
|
||||
# Removed the check for gmcs
|
||||
|
||||
FIND_PROGRAM (MONO_EXECUTABLE mono
|
||||
"$ENV{PROGRAMFILES}/Mono-1.9.1/bin"
|
||||
"$ENV{PROGRAMFILES}/Mono-1.2.6/bin"
|
||||
/bin
|
||||
/usr/bin
|
||||
/usr/local/bin
|
||||
)
|
||||
FIND_PROGRAM (MCS_EXECUTABLE mcs
|
||||
"$ENV{PROGRAMFILES}/Mono-1.9.1/bin"
|
||||
"$ENV{PROGRAMFILES}/Mono-1.2.6/bin"
|
||||
/bin
|
||||
/usr/bin
|
||||
/usr/local/bin
|
||||
)
|
||||
FIND_PROGRAM (GMCS_EXECUTABLE gmcs
|
||||
"$ENV{PROGRAMFILES}/Mono-1.9.1/bin"
|
||||
"$ENV{PROGRAMFILES}/Mono-1.2.6/bin"
|
||||
/bin
|
||||
/usr/bin
|
||||
/usr/local/bin
|
||||
)
|
||||
FIND_PROGRAM (GACUTIL_EXECUTABLE gacutil
|
||||
"$ENV{PROGRAMFILES}/Mono-1.9.1/bin"
|
||||
"$ENV{PROGRAMFILES}/Mono-1.2.6/bin"
|
||||
/bin
|
||||
/usr/bin
|
||||
/usr/local/bin
|
||||
)
|
||||
FIND_PROGRAM (ILASM_EXECUTABLE
|
||||
NAMES ilasm.bat ilasm
|
||||
NO_DEFAULT_PATH
|
||||
PATHS "$ENV{PROGRAMFILES}/Mono-1.9.1/bin" "$ENV{PROGRAMFILES}/Mono-1.2.6/bin" /bin /usr/bin /usr/local/bin
|
||||
)
|
||||
|
||||
SET (MONO_FOUND FALSE)
|
||||
|
||||
IF (MONO_EXECUTABLE AND MCS_EXECUTABLE AND GACUTIL_EXECUTABLE)
|
||||
SET (MONO_FOUND TRUE)
|
||||
ENDIF (MONO_EXECUTABLE AND MCS_EXECUTABLE AND GACUTIL_EXECUTABLE)
|
||||
|
||||
IF (MONO_FOUND)
|
||||
IF (NOT Mono_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found mono: ${MONO_EXECUTABLE}")
|
||||
MESSAGE(STATUS "Found mcs: ${MCS_EXECUTABLE}")
|
||||
MESSAGE(STATUS "Found gacutil: ${GACUTIL_EXECUTABLE}")
|
||||
ENDIF (NOT Mono_FIND_QUIETLY)
|
||||
ELSE (MONO_FOUND)
|
||||
IF (Mono_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could not find one or more of the following programs: mono, mcs, gacutil")
|
||||
ENDIF (Mono_FIND_REQUIRED)
|
||||
ENDIF (MONO_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(MONO_EXECUTABLE MCS_EXECUTABLE GACUTIL_EXECUTABLE)
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
# -*- cmake -*-
|
||||
|
||||
# - Find MySQL
|
||||
# Find the MySQL includes and library
|
||||
# This module defines
|
||||
# MYSQL_INCLUDE_DIR, where to find mysql.h, etc.
|
||||
# MYSQL_LIBRARIES, the libraries needed to use Mysql.
|
||||
# MYSQL_FOUND, If false, do not try to use Mysql.
|
||||
# also defined, but not for general use are
|
||||
# MYSQL_LIBRARY, where to find the Mysql library.
|
||||
|
||||
FIND_PATH(MYSQL_INCLUDE_DIR mysql/mysql.h
|
||||
/usr/local/include
|
||||
/usr/include
|
||||
)
|
||||
|
||||
SET(MYSQL_NAMES ${MYSQL_NAMES} mysqlclient)
|
||||
FIND_LIBRARY(MYSQL_LIBRARY
|
||||
NAMES ${MYSQL_NAMES}
|
||||
PATHS /usr/lib/mysql /usr/lib /usr/local/lib/mysql /usr/local/lib
|
||||
)
|
||||
|
||||
IF (MYSQL_LIBRARY AND MYSQL_INCLUDE_DIR)
|
||||
SET(MYSQL_LIBRARIES ${MYSQL_LIBRARY})
|
||||
SET(MYSQL_FOUND "YES")
|
||||
ELSE (MYSQL_LIBRARY AND MYSQL_INCLUDE_DIR)
|
||||
SET(MYSQL_FOUND "NO")
|
||||
ENDIF (MYSQL_LIBRARY AND MYSQL_INCLUDE_DIR)
|
||||
|
||||
|
||||
IF (MYSQL_FOUND)
|
||||
IF (NOT MYSQL_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found MySQL: ${MYSQL_LIBRARIES}")
|
||||
ENDIF (NOT MYSQL_FIND_QUIETLY)
|
||||
ELSE (MYSQL_FOUND)
|
||||
IF (MYSQL_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could not find MySQL library")
|
||||
ENDIF (MYSQL_FIND_REQUIRED)
|
||||
ENDIF (MYSQL_FOUND)
|
||||
|
||||
# Deprecated declarations.
|
||||
SET (NATIVE_MYSQL_INCLUDE_PATH ${MYSQL_INCLUDE_DIR} )
|
||||
GET_FILENAME_COMPONENT (NATIVE_MYSQL_LIB_PATH ${MYSQL_LIBRARY} PATH)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
MYSQL_LIBRARY
|
||||
MYSQL_INCLUDE_DIR
|
||||
)
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
# -*- cmake -*-
|
||||
#
|
||||
# Find the svn executable for exporting old svn:externals.
|
||||
#
|
||||
# Input variables:
|
||||
# SVN_FIND_REQUIRED - set this if configuration should fail without scp
|
||||
#
|
||||
# Output variables:
|
||||
#
|
||||
# SVN_FOUND - set if svn was found
|
||||
# SVN_EXECUTABLE - path to svn executable
|
||||
# SVN_BATCH_FLAG - how to put svn into batch mode
|
||||
|
||||
|
||||
SET(SVN_EXECUTABLE)
|
||||
FIND_PROGRAM(SVN_EXECUTABLE NAMES svn svn.exe)
|
||||
|
||||
IF (SVN_EXECUTABLE)
|
||||
SET(SVN_FOUND ON)
|
||||
ELSE (SVN_EXECUTABLE)
|
||||
SET(SVN_FOUND OFF)
|
||||
ENDIF (SVN_EXECUTABLE)
|
||||
|
||||
IF (SVN_FOUND)
|
||||
GET_FILENAME_COMPONENT(_svn_name ${SVN_EXECUTABLE} NAME_WE)
|
||||
SET(SVN_BATCH_FLAG --non-interactive)
|
||||
ELSE (SVN_FOUND)
|
||||
IF (SVN_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could not find svn executable")
|
||||
ENDIF (SVN_FIND_REQUIRED)
|
||||
ENDIF (SVN_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(SVN_EXECUTABLE SVN_FOUND SVN_BATCH_FLAG)
|
||||
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
# -*- cmake -*-
|
||||
include(Prebuilt)
|
||||
|
||||
if (NOT STANDALONE)
|
||||
use_prebuilt_binary(glext)
|
||||
use_prebuilt_binary(glh_linear)
|
||||
set(GLEXT_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include)
|
||||
endif (NOT STANDALONE)
|
||||
|
|
@ -6,4 +6,4 @@ if (NOT STANDALONE)
|
|||
endif (NOT STANDALONE)
|
||||
|
||||
set(GLOD_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include)
|
||||
set(GLOD_LIBRARIES glod)
|
||||
set(GLOD_LIBRARIES GLOD)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ if (STANDALONE)
|
|||
else (STANDALONE)
|
||||
if (WINDOWS)
|
||||
if (USE_TCMALLOC)
|
||||
use_prebuilt_binary(tcmalloc)
|
||||
use_prebuilt_binary(gperftools)
|
||||
set(TCMALLOC_LIBRARIES
|
||||
debug libtcmalloc_minimal-debug
|
||||
optimized libtcmalloc_minimal)
|
||||
|
|
@ -23,7 +23,7 @@ else (STANDALONE)
|
|||
endif (WINDOWS)
|
||||
if (LINUX)
|
||||
if (USE_TCMALLOC)
|
||||
use_prebuilt_binary(tcmalloc)
|
||||
use_prebuilt_binary(gperftools)
|
||||
set(TCMALLOC_LIBRARIES
|
||||
tcmalloc)
|
||||
else (USE_TCMALLOC)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
# -*- cmake -*-
|
||||
|
||||
if(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED)
|
||||
set(${CMAKE_CURRENT_LIST_FILE}_INCLUDED "YES")
|
||||
|
||||
use_prebuilt_binary(havok-source)
|
||||
|
||||
set(Havok_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/havok/Source)
|
||||
list(APPEND Havok_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/havok/Demo)
|
||||
|
||||
|
|
@ -8,14 +12,14 @@ set(HAVOK_DEBUG_LIBRARY_PATH ${LIBS_PREBUILT_DIR}/lib/debug/havok-fulldebug)
|
|||
set(HAVOK_RELEASE_LIBRARY_PATH ${LIBS_PREBUILT_DIR}/lib/release/havok)
|
||||
|
||||
if (LL_DEBUG_HAVOK)
|
||||
if (WIN32)
|
||||
# Always link relwithdebinfo to havok-hybrid on windows.
|
||||
set(HAVOK_RELWITHDEBINFO_LIBRARY_PATH ${LIBS_PREBUILT_DIR}/lib/debug/havok-hybrid)
|
||||
else (WIN32)
|
||||
set(HAVOK_RELWITHDEBINFO_LIBRARY_PATH ${LIBS_PREBUILT_DIR}/lib/debug/havok-fulldebug)
|
||||
endif (WIN32)
|
||||
if (WIN32)
|
||||
# Always link relwithdebinfo to havok-hybrid on windows.
|
||||
set(HAVOK_RELWITHDEBINFO_LIBRARY_PATH ${LIBS_PREBUILT_DIR}/lib/debug/havok-hybrid)
|
||||
else (WIN32)
|
||||
set(HAVOK_RELWITHDEBINFO_LIBRARY_PATH ${LIBS_PREBUILT_DIR}/lib/debug/havok-fulldebug)
|
||||
endif (WIN32)
|
||||
else (LL_DEBUG_HAVOK)
|
||||
set(HAVOK_RELWITHDEBINFO_LIBRARY_PATH ${LIBS_PREBUILT_DIR}/lib/release/havok)
|
||||
set(HAVOK_RELWITHDEBINFO_LIBRARY_PATH ${LIBS_PREBUILT_DIR}/lib/release/havok)
|
||||
endif (LL_DEBUG_HAVOK)
|
||||
|
||||
set(HAVOK_LIBS
|
||||
|
|
@ -45,39 +49,89 @@ unset(HK_DEBUG_LIBRARIES)
|
|||
unset(HK_RELEASE_LIBRARIES)
|
||||
unset(HK_RELWITHDEBINFO_LIBRARIES)
|
||||
|
||||
# *TODO: Figure out why we need to extract like this...
|
||||
foreach(HAVOK_LIB ${HAVOK_LIBS})
|
||||
find_library(HAVOK_DEBUG_LIB_${HAVOK_LIB} ${HAVOK_LIB} PATHS ${HAVOK_DEBUG_LIBRARY_PATH})
|
||||
find_library(HAVOK_RELEASE_LIB_${HAVOK_LIB} ${HAVOK_LIB} PATHS ${HAVOK_RELEASE_LIBRARY_PATH})
|
||||
find_library(HAVOK_RELWITHDEBINFO_LIB_${HAVOK_LIB} ${HAVOK_LIB} PATHS ${HAVOK_RELWITHDEBINFO_LIBRARY_PATH})
|
||||
|
||||
if(LINUX)
|
||||
set(cmd "mkdir")
|
||||
set(debug_dir "${HAVOK_DEBUG_LIBRARY_PATH}/${HAVOK_LIB}")
|
||||
set(release_dir "${HAVOK_RELEASE_LIBRARY_PATH}/${HAVOK_LIB}")
|
||||
set(relwithdebinfo_dir "${HAVOK_RELWITHDEBINFO_LIBRARY_PATH}/${HAVOK_LIB}")
|
||||
find_library(HAVOK_DEBUG_LIB_${HAVOK_LIB} ${HAVOK_LIB} PATHS ${HAVOK_DEBUG_LIBRARY_PATH})
|
||||
find_library(HAVOK_RELEASE_LIB_${HAVOK_LIB} ${HAVOK_LIB} PATHS ${HAVOK_RELEASE_LIBRARY_PATH})
|
||||
find_library(HAVOK_RELWITHDEBINFO_LIB_${HAVOK_LIB} ${HAVOK_LIB} PATHS ${HAVOK_RELWITHDEBINFO_LIBRARY_PATH})
|
||||
|
||||
if(LINUX)
|
||||
set(debug_dir "${HAVOK_DEBUG_LIBRARY_PATH}/${HAVOK_LIB}")
|
||||
set(release_dir "${HAVOK_RELEASE_LIBRARY_PATH}/${HAVOK_LIB}")
|
||||
set(relwithdebinfo_dir "${HAVOK_RELWITHDEBINFO_LIBRARY_PATH}/${HAVOK_LIB}")
|
||||
|
||||
exec_program( ${cmd} ${HAVOK_DEBUG_LIBRARY_PATH} ARGS ${debug_dir} OUTPUT_VARIABLE rv)
|
||||
exec_program( ${cmd} ${HAVOK_RELEASE_LIBRARY_PATH} ARGS ${release_dir} OUTPUT_VARIABLE rv)
|
||||
exec_program( ${cmd} ${HAVOK_RELWITHDEBINFO_LIBRARY_PATH} ARGS ${relwithdebinfo_dir} OUTPUT_VARIABLE rv)
|
||||
# Try to avoid extracting havok library each time we run cmake.
|
||||
if("${havok_${HAVOK_LIB}_extracted}" STREQUAL "" AND EXISTS "${CMAKE_BINARY_DIR}/temp/havok_${HAVOK_LIB}_extracted")
|
||||
file(READ ${CMAKE_BINARY_DIR}/temp/havok_${HAVOK_LIB}_extracted "havok_${HAVOK_LIB}_extracted")
|
||||
if(DEBUG_PREBUILT)
|
||||
message(STATUS "havok_${HAVOK_LIB}_extracted: \"${havok_${HAVOK_LIB}_extracted}\"")
|
||||
endif(DEBUG_PREBUILT)
|
||||
endif("${havok_${HAVOK_LIB}_extracted}" STREQUAL "" AND EXISTS "${CMAKE_BINARY_DIR}/temp/havok_${HAVOK_LIB}_extracted")
|
||||
|
||||
set(cmd "ar")
|
||||
set(arg " -xv")
|
||||
set(arg "${arg} ../lib${HAVOK_LIB}.a")
|
||||
exec_program( ${cmd} ${debug_dir} ARGS ${arg} OUTPUT_VARIABLE rv)
|
||||
exec_program( ${cmd} ${release_dir} ARGS ${arg} OUTPUT_VARIABLE rv)
|
||||
exec_program( ${cmd} ${relwithdebinfo_dir} ARGS ${arg} OUTPUT_VARIABLE rv)
|
||||
if(${CMAKE_BINARY_DIR}/temp/havok-source_installed IS_NEWER_THAN ${CMAKE_BINARY_DIR}/temp/havok_${HAVOK_LIB}_extracted OR NOT ${havok_${HAVOK_LIB}_extracted} EQUAL 0)
|
||||
if(DEBUG_PREBUILT)
|
||||
MESSAGE(STATUS "Extracting ${HAVOK_LIB}...")
|
||||
endif(DEBUG_PREBUILT)
|
||||
set(cmd "mkdir")
|
||||
|
||||
file(GLOB extracted_debug "${debug_dir}/*.o")
|
||||
file(GLOB extracted_release "${release_dir}/*.o")
|
||||
file(GLOB extracted_relwithdebinfo "${relwithdebinfo_dir}/*.o")
|
||||
list(APPEND HK_DEBUG_LIBRARIES ${extracted_debug})
|
||||
list(APPEND HK_RELEASE_LIBRARIES ${extracted_release})
|
||||
list(APPEND HK_RELWITHDEBINFO_LIBRARIES ${extracted_relwithdebinfo})
|
||||
else(LINUX)
|
||||
# Win32
|
||||
list(APPEND HK_DEBUG_LIBRARIES ${HAVOK_DEBUG_LIB_${HAVOK_LIB}})
|
||||
list(APPEND HK_RELEASE_LIBRARIES ${HAVOK_RELEASE_LIB_${HAVOK_LIB}})
|
||||
list(APPEND HK_RELWITHDEBINFO_LIBRARIES ${HAVOK_RELWITHDEBINFO_LIB_${HAVOK_LIB}})
|
||||
endif (LINUX)
|
||||
if(DEBUG_PREBUILT)
|
||||
MESSAGE(STATUS "${cmd} ${debug_dir}")
|
||||
endif(DEBUG_PREBUILT)
|
||||
exec_program( ${cmd} ${HAVOK_DEBUG_LIBRARY_PATH} ARGS ${debug_dir} OUTPUT_VARIABLE rv)
|
||||
|
||||
if(DEBUG_PREBUILT)
|
||||
MESSAGE(STATUS "${cmd} ${release_dir}")
|
||||
endif(DEBUG_PREBUILT)
|
||||
exec_program( ${cmd} ${HAVOK_RELEASE_LIBRARY_PATH} ARGS ${release_dir} OUTPUT_VARIABLE rv)
|
||||
|
||||
if(DEBUG_PREBUILT)
|
||||
MESSAGE(STATUS "${cmd} ${relwithdebinfo_dir}")
|
||||
endif(DEBUG_PREBUILT)
|
||||
exec_program( ${cmd} ${HAVOK_RELWITHDEBINFO_LIBRARY_PATH} ARGS ${relwithdebinfo_dir} OUTPUT_VARIABLE rv)
|
||||
|
||||
set(cmd "ar")
|
||||
set(arg " -xv")
|
||||
set(arg "${arg} ../lib${HAVOK_LIB}.a")
|
||||
if(DEBUG_PREBUILT)
|
||||
MESSAGE(STATUS "cd ${debug_dir} && ${cmd} ${arg}")
|
||||
endif(DEBUG_PREBUILT)
|
||||
exec_program( ${cmd} ${debug_dir} ARGS ${arg} OUTPUT_VARIABLE rv)
|
||||
|
||||
if(DEBUG_PREBUILT)
|
||||
MESSAGE(STATUS "cd ${release_dir} && ${cmd} ${arg}")
|
||||
endif(DEBUG_PREBUILT)
|
||||
exec_program( ${cmd} ${release_dir} ARGS ${arg} OUTPUT_VARIABLE rv)
|
||||
|
||||
if(DEBUG_PREBUILT)
|
||||
MESSAGE(STATUS "cd ${relwithdebinfo_dir} && ${cmd} ${arg}")
|
||||
endif(DEBUG_PREBUILT)
|
||||
exec_program( ${cmd} ${relwithdebinfo_dir} ARGS ${arg} OUTPUT_VARIABLE rv)
|
||||
|
||||
# Just assume success for now.
|
||||
set(havok_${HAVOK_LIB}_extracted 0)
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/temp/havok_${HAVOK_LIB}_extracted "${havok_${HAVOK_LIB}_extracted}")
|
||||
|
||||
endif(${CMAKE_BINARY_DIR}/temp/havok-source_installed IS_NEWER_THAN ${CMAKE_BINARY_DIR}/temp/havok_${HAVOK_LIB}_extracted OR NOT ${havok_${HAVOK_LIB}_extracted} EQUAL 0)
|
||||
|
||||
file(GLOB extracted_debug "${debug_dir}/*.o")
|
||||
file(GLOB extracted_release "${release_dir}/*.o")
|
||||
file(GLOB extracted_relwithdebinfo "${relwithdebinfo_dir}/*.o")
|
||||
|
||||
if(DEBUG_PREBUILT)
|
||||
MESSAGE(STATUS "extracted_debug ${debug_dir}/*.o")
|
||||
MESSAGE(STATUS "extracted_release ${release_dir}/*.o")
|
||||
MESSAGE(STATUS "extracted_relwithdebinfo ${relwithdebinfo_dir}/*.o")
|
||||
endif(DEBUG_PREBUILT)
|
||||
|
||||
list(APPEND HK_DEBUG_LIBRARIES ${extracted_debug})
|
||||
list(APPEND HK_RELEASE_LIBRARIES ${extracted_release})
|
||||
list(APPEND HK_RELWITHDEBINFO_LIBRARIES ${extracted_relwithdebinfo})
|
||||
else(LINUX)
|
||||
# Win32
|
||||
list(APPEND HK_DEBUG_LIBRARIES ${HAVOK_DEBUG_LIB_${HAVOK_LIB}})
|
||||
list(APPEND HK_RELEASE_LIBRARIES ${HAVOK_RELEASE_LIB_${HAVOK_LIB}})
|
||||
list(APPEND HK_RELWITHDEBINFO_LIBRARIES ${HAVOK_RELWITHDEBINFO_LIB_${HAVOK_LIB}})
|
||||
endif (LINUX)
|
||||
endforeach(HAVOK_LIB)
|
||||
|
||||
endif(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
# -*- cmake -*-
|
||||
|
||||
include(Variables)
|
||||
|
||||
set(LLAPPEARANCE_INCLUDE_DIRS
|
||||
${LIBS_OPEN_DIR}/llappearance
|
||||
)
|
||||
|
||||
if (BUILD_HEADLESS)
|
||||
set(LLAPPEARANCE_HEADLESS_LIBRARIES
|
||||
llappearanceheadless
|
||||
)
|
||||
endif (BUILD_HEADLESS)
|
||||
|
||||
set(LLAPPEARANCE_LIBRARIES llappearance)
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
# -*- cmake -*-
|
||||
include(Prebuilt)
|
||||
|
||||
# Linux proprietary build only
|
||||
if (INSTALL_PROPRIETARY)
|
||||
if(LINUX)
|
||||
use_prebuilt_binary(llappearanceutility-source)
|
||||
set(LLAPPEARANCEUTILITY_SRC_DIR ${LIBS_PREBUILT_DIR}/llappearanceutility/src)
|
||||
set(LLAPPEARANCEUTILITY_BIN_DIR ${CMAKE_BINARY_DIR}/llappearanceutility)
|
||||
endif (LINUX)
|
||||
endif (INSTALL_PROPRIETARY)
|
||||
|
||||
|
|
@ -10,6 +10,8 @@ set(LLCOMMON_INCLUDE_DIRS
|
|||
${LIBS_OPEN_DIR}/llcommon
|
||||
${APRUTIL_INCLUDE_DIR}
|
||||
${APR_INCLUDE_DIR}
|
||||
)
|
||||
set(LLCOMMON_SYSTEM_INCLUDE_DIRS
|
||||
${Boost_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
# -*- cmake -*-
|
||||
|
||||
include(MySQL)
|
||||
|
||||
set(LLDATABASE_INCLUDE_DIRS
|
||||
${LIBS_SERVER_DIR}/lldatabase
|
||||
${MYSQL_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
set(LLDATABASE_LIBRARIES lldatabase)
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
# -*- cmake -*-
|
||||
|
||||
include(Variables)
|
||||
include(FreeType)
|
||||
include(GLH)
|
||||
|
||||
|
|
@ -8,27 +9,12 @@ set(LLRENDER_INCLUDE_DIRS
|
|||
${GLH_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
if (SERVER AND LINUX)
|
||||
set(LLRENDER_LIBRARIES
|
||||
llrenderheadless
|
||||
)
|
||||
else (SERVER AND LINUX)
|
||||
if (BUILD_HEADLESS)
|
||||
set(LLRENDER_HEADLESS_LIBRARIES
|
||||
llrenderheadless
|
||||
)
|
||||
endif (BUILD_HEADLESS)
|
||||
set(LLRENDER_LIBRARIES
|
||||
llrender
|
||||
)
|
||||
endif (SERVER AND LINUX)
|
||||
|
||||
# mapserver requires certain files to be copied so LL_MESA_HEADLESS can be set
|
||||
# differently for different object files.
|
||||
macro (copy_server_sources )
|
||||
foreach (PREFIX ${ARGV})
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PREFIX}_server.cpp
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
ARGS -E copy ${CMAKE_CURRENT_SOURCE_DIR}/${PREFIX}.cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${PREFIX}_server.cpp
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${PREFIX}.cpp
|
||||
)
|
||||
list(APPEND server_SOURCE_FILES ${PREFIX}_server.cpp)
|
||||
endforeach (PREFIX ${_copied_SOURCES})
|
||||
endmacro (copy_server_sources _copied_SOURCES)
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
# -*- cmake -*-
|
||||
|
||||
set(LLSCENE_INCLUDE_DIRS
|
||||
${LIBS_SERVER_DIR}/llscene
|
||||
)
|
||||
|
||||
set(LLSCENE_LIBRARIES llscene)
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
# -*- cmake -*-
|
||||
|
||||
include(OpenGL)
|
||||
include(Variables)
|
||||
include(GLEXT)
|
||||
include(Prebuilt)
|
||||
|
||||
if (STANDALONE)
|
||||
|
|
@ -13,17 +14,15 @@ if (STANDALONE)
|
|||
SDL_LIBRARY
|
||||
)
|
||||
else (STANDALONE)
|
||||
use_prebuilt_binary(mesa)
|
||||
if (LINUX AND VIEWER)
|
||||
if (LINUX)
|
||||
use_prebuilt_binary(SDL)
|
||||
set (SDL_FOUND TRUE)
|
||||
set (SDL_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/i686-linux)
|
||||
set (SDL_LIBRARY SDL directfb fusion direct)
|
||||
endif (LINUX AND VIEWER)
|
||||
endif (LINUX)
|
||||
endif (STANDALONE)
|
||||
|
||||
if (SDL_FOUND)
|
||||
add_definitions(-DLL_SDL=1)
|
||||
include_directories(${SDL_INCLUDE_DIR})
|
||||
endif (SDL_FOUND)
|
||||
|
||||
|
|
@ -32,12 +31,12 @@ set(LLWINDOW_INCLUDE_DIRS
|
|||
${LIBS_OPEN_DIR}/llwindow
|
||||
)
|
||||
|
||||
if (SERVER AND LINUX)
|
||||
set(LLWINDOW_LIBRARIES
|
||||
llwindowheadless
|
||||
)
|
||||
else (SERVER AND LINUX)
|
||||
set(LLWINDOW_LIBRARIES
|
||||
llwindow
|
||||
)
|
||||
endif (SERVER AND LINUX)
|
||||
if (BUILD_HEADLESS)
|
||||
set(LLWINDOW_HEADLESS_LIBRARIES
|
||||
llwindowheadless
|
||||
)
|
||||
endif (BUILD_HEADLESS)
|
||||
|
||||
set(LLWINDOW_LIBRARIES
|
||||
llwindow
|
||||
)
|
||||
|
|
|
|||
|
|
@ -5,8 +5,10 @@ include(EXPAT)
|
|||
|
||||
set(LLXML_INCLUDE_DIRS
|
||||
${LIBS_OPEN_DIR}/llxml
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${EXPAT_INCLUDE_DIRS}
|
||||
)
|
||||
set(LLXML_SYSTEM_INCLUDE_DIRS
|
||||
${Boost_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
set(LLXML_LIBRARIES llxml)
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
# -*- cmake -*-
|
||||
|
||||
set(LLXUIXML_INCLUDE_DIRS
|
||||
${LIBS_OPEN_DIR}/llxuixml
|
||||
)
|
||||
|
||||
set(LLXUIXML_LIBRARIES llxuixml)
|
||||
|
|
@ -1,5 +1,8 @@
|
|||
# -*- cmake -*-
|
||||
|
||||
if(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED)
|
||||
set(${CMAKE_CURRENT_LIST_FILE}_INCLUDED "YES")
|
||||
|
||||
include(Variables)
|
||||
|
||||
set(ARCH_PREBUILT_DIRS ${AUTOBUILD_INSTALL_DIR}/lib)
|
||||
|
|
@ -69,3 +72,5 @@ else (WINDOWS)
|
|||
endif (WINDOWS)
|
||||
|
||||
mark_as_advanced(DL_LIBRARY PTHREAD_LIBRARY WINDOWS_LIBRARIES)
|
||||
|
||||
endif(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED)
|
||||
|
|
|
|||
|
|
@ -1,48 +0,0 @@
|
|||
# -*- cmake -*-
|
||||
|
||||
set(MONO_PREBUILT_LIBRARIES_DIR ${LIBS_PREBUILT_DIR}/mono/1.0)
|
||||
|
||||
set(MONO_PREBUILT_LIBRARIES
|
||||
Iesi.Collections.dll
|
||||
Iesi.Collections.pdb
|
||||
Mono.CompilerServices.SymbolWriter.dll
|
||||
Mono.PEToolkit.dll
|
||||
Mono.PEToolkit.pdb
|
||||
Mono.Security.dll
|
||||
PEAPI.dll
|
||||
RAIL.dll
|
||||
RAIL.pdb
|
||||
)
|
||||
|
||||
set(MONO_CORE_LIBRARIES
|
||||
System.dll
|
||||
System.Xml.dll
|
||||
mscorlib.dll)
|
||||
|
||||
if(WINDOWS)
|
||||
set(MONO_DEPENDENCIES
|
||||
DomainCreator
|
||||
DomainRegister
|
||||
LslLibrary
|
||||
LslUserScript
|
||||
Script
|
||||
ScriptTypes
|
||||
TestFormat
|
||||
UserScript
|
||||
UThread
|
||||
UThreadInjector
|
||||
)
|
||||
else(WINDOWS)
|
||||
set(MONO_DEPENDENCIES
|
||||
DomainCreator_POST_BUILD
|
||||
DomainRegister_POST_BUILD
|
||||
LslLibrary_POST_BUILD
|
||||
LslUserScript_POST_BUILD
|
||||
Script_POST_BUILD
|
||||
ScriptTypes_POST_BUILD
|
||||
TestFormat_POST_BUILD
|
||||
UserScript_POST_BUILD
|
||||
UThread_POST_BUILD
|
||||
UThreadInjector_POST_BUILD
|
||||
)
|
||||
endif(WINDOWS)
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
# -*- cmake -*-
|
||||
|
||||
include(Prebuilt)
|
||||
use_prebuilt_binary(libmono)
|
||||
|
||||
SET(GLIB_2_0 glib-2.0)
|
||||
|
||||
if (WINDOWS)
|
||||
SET(MONO_LIB mono)
|
||||
else (WINDOWS)
|
||||
SET(MONO_LIB mono)
|
||||
SET(M_LIBRARIES m)
|
||||
SET(GTHREAD_2_0 gthread-2.0)
|
||||
endif(WINDOWS)
|
||||
|
||||
|
||||
IF (DARWIN)
|
||||
|
||||
FIND_LIBRARY(MONO_LIBRARY NAMES Mono)
|
||||
# Find_file doesnt work as expected. Hardcode relative to Mono.framework.
|
||||
#FIND_FILE(GLIB_CONFIG glibconfig.h ${MONO_LIBRARY})
|
||||
#FIND_FILE(MONO_GLIB_LIBRARY glib.h ${MONO_LIBRARY})
|
||||
SET(MONO_GLIB_LIBRARY ${MONO_LIBRARY}/Headers/glib-2.0/)
|
||||
SET(GLIB_CONFIG ${MONO_LIBRARY}/Libraries/glib-2.0/include/)
|
||||
SET(MONO_LIB_DIRECTORY ${MONO_LIBRARY}/Libraries)
|
||||
|
||||
IF (MONO_LIBRARY AND MONO_GLIB_LIBRARY AND GLIB_CONFIG)
|
||||
MESSAGE(STATUS "Found Mono for embedding")
|
||||
INCLUDE_DIRECTORIES(${MONO_GLIB_LIBRARY} ${GLIB_CONFIG})
|
||||
LINK_DIRECTORIES(${MONO_LIB_DIRECTORY})
|
||||
ELSE (MONO_LIBRARY AND MONO_GLIB_LIBRARY AND GLIB_CONFIG)
|
||||
MESSAGE(FATAL_ERROR "Mono not found for embedding")
|
||||
MESSAGE(${MONO_LIBRARY})
|
||||
MESSAGE(${MONO_GLIB_LIBRARY})
|
||||
MESSAGE(${GLIB_CONFIG})
|
||||
ENDIF (MONO_LIBRARY AND MONO_GLIB_LIBRARY AND GLIB_CONFIG)
|
||||
|
||||
ELSE (DARWIN)
|
||||
|
||||
SET(MONO_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include)
|
||||
SET(GLIB_2_0_PLATFORM_INCLUDE_DIR
|
||||
${LIBS_PREBUILT_DIR}/include/glib-2.0)
|
||||
SET(GLIB_2_0_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/glib-2.0)
|
||||
|
||||
INCLUDE_DIRECTORIES(
|
||||
${MONO_INCLUDE_DIR}
|
||||
${GLIB_2_0_PLATFORM_INCLUDE_DIR}
|
||||
${GLIB_2_0_INCLUDE_DIR})
|
||||
|
||||
ENDIF (DARWIN)
|
||||
|
||||
SET(MONO_LIBRARIES
|
||||
${MONO_LIB}
|
||||
${M_LIBRARIES}
|
||||
${GLIB_2_0}
|
||||
${GTHREAD_2_0}
|
||||
)
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
# -*- cmake -*-
|
||||
include(Linking)
|
||||
include(Prebuilt)
|
||||
|
||||
use_prebuilt_binary(mysql)
|
||||
|
||||
if (LINUX)
|
||||
if (WORD_SIZE EQUAL 32 OR DEBIAN_VERSION STREQUAL "3.1")
|
||||
set(MYSQL_LIBRARIES mysqlclient)
|
||||
set(MYSQL_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include)
|
||||
else (WORD_SIZE EQUAL 32 OR DEBIAN_VERSION STREQUAL "3.1")
|
||||
# Use the native MySQL library on a 64-bit system.
|
||||
set(MYSQL_FIND_QUIETLY ON)
|
||||
set(MYSQL_FIND_REQUIRED ON)
|
||||
include(FindMySQL)
|
||||
endif (WORD_SIZE EQUAL 32 OR DEBIAN_VERSION STREQUAL "3.1")
|
||||
elseif (WINDOWS)
|
||||
set(MYSQL_LIBRARIES mysqlclient)
|
||||
set(MYSQL_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include)
|
||||
elseif (DARWIN)
|
||||
set(MYSQL_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include)
|
||||
set(MYSQL_LIBRARIES
|
||||
optimized ${ARCH_PREBUILT_DIRS_RELEASE}/libmysqlclient.a
|
||||
debug ${ARCH_PREBUILT_DIRS_DEBUG}/libmysqlclient.a
|
||||
)
|
||||
endif (LINUX)
|
||||
|
|
@ -1,8 +1,12 @@
|
|||
# -*- cmake -*-
|
||||
|
||||
include(Variables)
|
||||
include(Prebuilt)
|
||||
|
||||
if (NOT STANDALONE)
|
||||
use_prebuilt_binary(glext)
|
||||
use_prebuilt_binary(glh_linear)
|
||||
set(GLEXT_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include)
|
||||
endif (NOT STANDALONE)
|
||||
if (BUILD_HEADLESS)
|
||||
SET(OPENGL_glu_LIBRARY GLU)
|
||||
SET(OPENGL_HEADLESS_LIBRARIES OSMesa16 dl GLU)
|
||||
endif (BUILD_HEADLESS)
|
||||
|
||||
include(FindOpenGL)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
# -*- cmake -*-
|
||||
|
||||
if(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED)
|
||||
set(${CMAKE_CURRENT_LIST_FILE}_INCLUDED "YES")
|
||||
|
||||
include(FindAutobuild)
|
||||
if(INSTALL_PROPRIETARY)
|
||||
include(FindSCP)
|
||||
|
|
@ -51,3 +54,5 @@ macro (use_prebuilt_binary _binary)
|
|||
endif (NOT ${_binary}_installed EQUAL 0)
|
||||
endif (NOT STANDALONE_${_binary})
|
||||
endmacro (use_prebuilt_binary _binary)
|
||||
|
||||
endif(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ if (WINDOWS)
|
|||
elseif (EXISTS /etc/debian_version)
|
||||
# On Debian and Ubuntu, avoid Python 2.4 if possible.
|
||||
|
||||
find_program(PYTHON_EXECUTABLE python2.5 python2.3 python PATHS /usr/bin)
|
||||
find_program(PYTHON_EXECUTABLE python PATHS /usr/bin)
|
||||
|
||||
if (PYTHON_EXECUTABLE)
|
||||
set(PYTHONINTERP_FOUND ON)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
# -*- cmake -*-
|
||||
include(Prebuilt)
|
||||
include(FreeType)
|
||||
|
||||
if (STANDALONE)
|
||||
include(FindPkgConfig)
|
||||
|
|
@ -47,6 +48,7 @@ else (STANDALONE)
|
|||
pangoft2-1.0
|
||||
pangox-1.0
|
||||
pangoxft-1.0
|
||||
${FREETYPE_LIBRARIES}
|
||||
)
|
||||
endif (LINUX)
|
||||
|
||||
|
|
|
|||
|
|
@ -8,24 +8,20 @@
|
|||
# DARWIN - Mac OS X
|
||||
# LINUX - Linux
|
||||
# WINDOWS - Windows
|
||||
#
|
||||
# What to build:
|
||||
#
|
||||
# VIEWER - viewer and other viewer-side components
|
||||
# SERVER - simulator and other server-side bits
|
||||
|
||||
|
||||
# Relative and absolute paths to subtrees.
|
||||
|
||||
if(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED)
|
||||
set(${CMAKE_CURRENT_LIST_FILE}_INCLUDED "YES")
|
||||
|
||||
if(NOT DEFINED COMMON_CMAKE_DIR)
|
||||
set(COMMON_CMAKE_DIR "${CMAKE_SOURCE_DIR}/cmake")
|
||||
endif(NOT DEFINED COMMON_CMAKE_DIR)
|
||||
|
||||
set(LIBS_CLOSED_PREFIX)
|
||||
set(LIBS_OPEN_PREFIX)
|
||||
set(LIBS_SERVER_PREFIX)
|
||||
set(SCRIPTS_PREFIX ../scripts)
|
||||
set(SERVER_PREFIX)
|
||||
set(VIEWER_PREFIX)
|
||||
set(INTEGRATION_TESTS_PREFIX)
|
||||
set(LL_TESTS ON CACHE BOOL "Build and run unit and integration tests (disable for build timing runs to reduce variation")
|
||||
|
|
@ -43,9 +39,7 @@ else(LIBS_COMMON_DIR)
|
|||
endif(LIBS_COMMON_DIR)
|
||||
set(LIBS_OPEN_DIR ${LIBS_COMMON_DIR})
|
||||
|
||||
set(LIBS_SERVER_DIR ${CMAKE_SOURCE_DIR}/${LIBS_SERVER_PREFIX})
|
||||
set(SCRIPTS_DIR ${CMAKE_SOURCE_DIR}/${SCRIPTS_PREFIX})
|
||||
set(SERVER_DIR ${CMAKE_SOURCE_DIR}/${SERVER_PREFIX})
|
||||
set(VIEWER_DIR ${CMAKE_SOURCE_DIR}/${VIEWER_PREFIX})
|
||||
|
||||
set(AUTOBUILD_INSTALL_DIR ${CMAKE_BINARY_DIR}/packages)
|
||||
|
|
@ -79,21 +73,57 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|||
# If someone has specified a word size, use that to determine the
|
||||
# architecture. Otherwise, let the architecture specify the word size.
|
||||
if (WORD_SIZE EQUAL 32)
|
||||
#message(STATUS "WORD_SIZE is 32")
|
||||
set(ARCH i686)
|
||||
elseif (WORD_SIZE EQUAL 64)
|
||||
#message(STATUS "WORD_SIZE is 64")
|
||||
set(ARCH x86_64)
|
||||
else (WORD_SIZE EQUAL 32)
|
||||
#message(STATUS "WORD_SIZE is UNDEFINED")
|
||||
execute_process(COMMAND uname -m COMMAND sed s/i.86/i686/
|
||||
OUTPUT_VARIABLE ARCH OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if (ARCH STREQUAL x86_64)
|
||||
#message(STATUS "ARCH is detected as 64; ARCH is ${ARCH}")
|
||||
set(WORD_SIZE 64)
|
||||
else (ARCH STREQUAL x86_64)
|
||||
#message(STATUS "ARCH is detected as 32; ARCH is ${ARCH}")
|
||||
set(WORD_SIZE 32)
|
||||
endif (ARCH STREQUAL x86_64)
|
||||
endif (WORD_SIZE EQUAL 32)
|
||||
|
||||
if (WORD_SIZE EQUAL 32)
|
||||
set(DEB_ARCHITECTURE i386)
|
||||
set(FIND_LIBRARY_USE_LIB64_PATHS OFF)
|
||||
set(CMAKE_SYSTEM_LIBRARY_PATH /usr/lib32 ${CMAKE_SYSTEM_LIBRARY_PATH})
|
||||
else (WORD_SIZE EQUAL 32)
|
||||
set(DEB_ARCHITECTURE amd64)
|
||||
set(FIND_LIBRARY_USE_LIB64_PATHS ON)
|
||||
endif (WORD_SIZE EQUAL 32)
|
||||
|
||||
execute_process(COMMAND dpkg-architecture -a${DEB_ARCHITECTURE} -qDEB_HOST_MULTIARCH
|
||||
RESULT_VARIABLE DPKG_RESULT
|
||||
OUTPUT_VARIABLE DPKG_ARCH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
|
||||
#message (STATUS "DPKG_RESULT ${DPKG_RESULT}, DPKG_ARCH ${DPKG_ARCH}")
|
||||
if (DPKG_RESULT EQUAL 0)
|
||||
set(CMAKE_LIBRARY_ARCHITECTURE ${DPKG_ARCH})
|
||||
set(CMAKE_SYSTEM_LIBRARY_PATH /usr/lib/${DPKG_ARCH} /usr/local/lib/${DPKG_ARCH} ${CMAKE_SYSTEM_LIBRARY_PATH})
|
||||
endif (DPKG_RESULT EQUAL 0)
|
||||
|
||||
include(ConfigurePkgConfig)
|
||||
|
||||
set(LL_ARCH ${ARCH}_linux)
|
||||
set(LL_ARCH_DIR ${ARCH}-linux)
|
||||
|
||||
if (INSTALL_PROPRIETARY)
|
||||
# Only turn on headless if we can find osmesa libraries.
|
||||
include(FindPkgConfig)
|
||||
#pkg_check_modules(OSMESA osmesa)
|
||||
#if (OSMESA_FOUND)
|
||||
# set(BUILD_HEADLESS ON CACHE BOOL "Build headless libraries.")
|
||||
#endif (OSMESA_FOUND)
|
||||
endif (INSTALL_PROPRIETARY)
|
||||
|
||||
endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
|
|
@ -140,7 +170,6 @@ endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|||
# Default deploy grid
|
||||
set(GRID agni CACHE STRING "Target Grid")
|
||||
|
||||
set(VIEWER ON CACHE BOOL "Build Second Life viewer.")
|
||||
set(VIEWER_CHANNEL "Second Life Test" CACHE STRING "Viewer Channel Name")
|
||||
|
||||
if (XCODE_VERSION GREATER 4.2)
|
||||
|
|
@ -152,21 +181,8 @@ set(VERSION_BUILD "0" CACHE STRING "Revision number passed in from the outside")
|
|||
set(STANDALONE OFF CACHE BOOL "Do not use Linden-supplied prebuilt libraries.")
|
||||
set(UNATTENDED OFF CACHE BOOL "Should be set to ON for building with VC Express editions.")
|
||||
|
||||
if (NOT STANDALONE AND EXISTS ${CMAKE_SOURCE_DIR}/llphysics)
|
||||
set(SERVER ON CACHE BOOL "Build Second Life server software.")
|
||||
endif (NOT STANDALONE AND EXISTS ${CMAKE_SOURCE_DIR}/llphysics)
|
||||
|
||||
if (LINUX AND SERVER AND VIEWER)
|
||||
MESSAGE(FATAL_ERROR "
|
||||
The indra source does not currently support building SERVER and VIEWER at the same time.
|
||||
Please set one of these values to OFF in your CMake cache file.
|
||||
(either by running ccmake or by editing CMakeCache.txt by hand)
|
||||
For more information, please see JIRA DEV-14943 - Cmake Linux cannot build both VIEWER and SERVER in one build environment
|
||||
")
|
||||
endif (LINUX AND SERVER AND VIEWER)
|
||||
|
||||
|
||||
set(USE_PRECOMPILED_HEADERS ON CACHE BOOL "Enable use of precompiled header directives where supported.")
|
||||
|
||||
source_group("CMake Rules" FILES CMakeLists.txt)
|
||||
|
||||
endif(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED)
|
||||
|
|
|
|||
|
|
@ -1,15 +1,12 @@
|
|||
# -*- cmake -*-
|
||||
|
||||
if (VIEWER)
|
||||
set(INCLUDE_VLD_CMAKE OFF CACHE BOOL "Build the Windows viewer with Visual Leak Detector turned on or off")
|
||||
|
||||
set(INCLUDE_VLD_CMAKE OFF CACHE BOOL "Build the Windows viewer with Visual Leak Detector turned on or off")
|
||||
if (INCLUDE_VLD_CMAKE)
|
||||
|
||||
if (INCLUDE_VLD_CMAKE)
|
||||
if (WINDOWS)
|
||||
add_definitions(-DINCLUDE_VLD=1)
|
||||
endif (WINDOWS)
|
||||
|
||||
if (WINDOWS)
|
||||
add_definitions(-DINCLUDE_VLD=1)
|
||||
endif (WINDOWS)
|
||||
endif (INCLUDE_VLD_CMAKE)
|
||||
|
||||
endif (INCLUDE_VLD_CMAKE)
|
||||
|
||||
endif (VIEWER)
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@ include_directories(
|
|||
${LLVFS_INCLUDE_DIRS}
|
||||
${LLIMAGE_INCLUDE_DIRS}
|
||||
)
|
||||
include_directories(SYSTEM
|
||||
${LLCOMMON_SYSTEM_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
set(llimage_libtest_SOURCE_FILES
|
||||
llimage_libtest.cpp
|
||||
|
|
|
|||
|
|
@ -34,6 +34,10 @@ include_directories(
|
|||
${LLXML_INCLUDE_DIRS}
|
||||
${LIBS_PREBUILD_DIR}/include/hunspell
|
||||
)
|
||||
include_directories(SYSTEM
|
||||
${LLCOMMON_SYSTEM_INCLUDE_DIRS}
|
||||
${LLXML_SYSTEM_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
set(llui_libtest_SOURCE_FILES
|
||||
llui_libtest.cpp
|
||||
|
|
|
|||
|
|
@ -20,6 +20,10 @@ include_directories(
|
|||
${LLVFS_INCLUDE_DIRS}
|
||||
${LLXML_INCLUDE_DIRS}
|
||||
)
|
||||
include_directories(SYSTEM
|
||||
${LLCOMMON_SYSTEM_INCLUDE_DIRS}
|
||||
${LLXML_SYSTEM_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
set(linux_crash_logger_SOURCE_FILES
|
||||
linux_crash_logger.cpp
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
# -*- cmake -*-
|
||||
|
||||
project(linux_updater)
|
||||
|
||||
include(00-Common)
|
||||
include(CURL)
|
||||
include(CARes)
|
||||
include(OpenSSL)
|
||||
include(UI)
|
||||
include(LLCommon)
|
||||
include(LLMessage)
|
||||
include(LLVFS)
|
||||
include(LLXML)
|
||||
include(LLUI)
|
||||
include(Linking)
|
||||
|
||||
include_directories(
|
||||
${LLCOMMON_INCLUDE_DIRS}
|
||||
${LLVFS_INCLUDE_DIRS}
|
||||
${LLXML_INCLUDE_DIRS}
|
||||
${LLUI_INCLUDE_DIRS}
|
||||
${CURL_INCLUDE_DIRS}
|
||||
${CARES_INCLUDE_DIRS}
|
||||
${OPENSSL_INCLUDE_DIRS}
|
||||
${UI_INCLUDE_DIRS}
|
||||
)
|
||||
include_directories(SYSTEM
|
||||
${LLCOMMON_SYSTEM_INCLUDE_DIRS}
|
||||
${LLXML_SYSTEM_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
set(linux_updater_SOURCE_FILES linux_updater.cpp)
|
||||
|
||||
set(linux_updater_HEADER_FILES CMakeLists.txt)
|
||||
|
||||
set_source_files_properties(${linux_updater_HEADER_FILES}
|
||||
PROPERTIES HEADER_FILES_ONLY TRUE)
|
||||
|
||||
list(APPEND linux_updater_SOURCE_FILES ${linux_updater_HEADER_FILES})
|
||||
|
||||
add_executable(linux-updater ${linux_updater_SOURCE_FILES})
|
||||
|
||||
target_link_libraries(linux-updater
|
||||
${CURL_LIBRARIES}
|
||||
${CARES_LIBRARIES}
|
||||
${OPENSSL_LIBRARIES}
|
||||
${CRYPTO_LIBRARIES}
|
||||
${LLMESSAGE_LIBRARIES}
|
||||
${UI_LIBRARIES}
|
||||
${LLXML_LIBRARIES}
|
||||
${LLUI_LIBRARIES}
|
||||
${LLVFS_LIBRARIES}
|
||||
${LLCOMMON_LIBRARIES}
|
||||
)
|
||||
|
||||
add_custom_target(linux-updater-target ALL
|
||||
DEPENDS linux-updater)
|
||||
|
|
@ -0,0 +1,924 @@
|
|||
/**
|
||||
* @file linux_updater.cpp
|
||||
* @author Kyle Ambroff <ambroff@lindenlab.com>, Tofu Linden
|
||||
* @brief Viewer update program for unix platforms that support GTK+
|
||||
*
|
||||
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "linden_common.h"
|
||||
#include "llerrorcontrol.h"
|
||||
#include "llfile.h"
|
||||
#include "lldir.h"
|
||||
#include "lldiriterator.h"
|
||||
|
||||
/*==========================================================================*|
|
||||
// IQA-490: Use of LLTrans -- by this program at least -- appears to be buggy.
|
||||
// With it, the 3.3.2 beta 1 linux-updater.bin crashes; without it seems stable.
|
||||
#include "llxmlnode.h"
|
||||
#include "lltrans.h"
|
||||
|*==========================================================================*/
|
||||
|
||||
static class LLTrans
|
||||
{
|
||||
public:
|
||||
LLTrans();
|
||||
static std::string getString(const std::string& key);
|
||||
|
||||
private:
|
||||
std::string _getString(const std::string& key) const;
|
||||
|
||||
typedef std::map<std::string, std::string> MessageMap;
|
||||
MessageMap mMessages;
|
||||
} sLLTransInstance;
|
||||
|
||||
#include <curl/curl.h>
|
||||
#include <map>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
extern "C" {
|
||||
#include <gtk/gtk.h>
|
||||
}
|
||||
|
||||
const guint UPDATE_PROGRESS_TIMEOUT = 100;
|
||||
const guint UPDATE_PROGRESS_TEXT_TIMEOUT = 1000;
|
||||
const guint ROTATE_IMAGE_TIMEOUT = 8000;
|
||||
|
||||
typedef struct _updater_app_state {
|
||||
std::string app_name;
|
||||
std::string url;
|
||||
std::string file;
|
||||
std::string image_dir;
|
||||
std::string dest_dir;
|
||||
std::string strings_dirs;
|
||||
std::string strings_file;
|
||||
|
||||
LLDirIterator *image_dir_iter;
|
||||
|
||||
GtkWidget *window;
|
||||
GtkWidget *progress_bar;
|
||||
GtkWidget *image;
|
||||
|
||||
double progress_value;
|
||||
bool activity_mode;
|
||||
|
||||
guint image_rotation_timeout_id;
|
||||
guint progress_update_timeout_id;
|
||||
guint update_progress_text_timeout_id;
|
||||
|
||||
bool failure;
|
||||
} UpdaterAppState;
|
||||
|
||||
// List of entries from strings.xml to always replace
|
||||
static std::set<std::string> default_trans_args;
|
||||
void init_default_trans_args()
|
||||
{
|
||||
default_trans_args.insert("SECOND_LIFE"); // World
|
||||
default_trans_args.insert("APP_NAME");
|
||||
default_trans_args.insert("SECOND_LIFE_GRID");
|
||||
default_trans_args.insert("SUPPORT_SITE");
|
||||
}
|
||||
|
||||
bool translate_init(std::string comma_delim_path_list,
|
||||
std::string base_xml_name)
|
||||
{
|
||||
return true;
|
||||
/*==========================================================================*|
|
||||
init_default_trans_args();
|
||||
|
||||
// extract paths string vector from comma-delimited flat string
|
||||
std::vector<std::string> paths;
|
||||
LLStringUtil::getTokens(comma_delim_path_list, paths, ","); // split over ','
|
||||
|
||||
for(std::vector<std::string>::iterator it = paths.begin(), end_it = paths.end();
|
||||
it != end_it;
|
||||
++it)
|
||||
{
|
||||
(*it) = gDirUtilp->findSkinnedFilename(*it, base_xml_name);
|
||||
}
|
||||
|
||||
// suck the translation xml files into memory
|
||||
LLXMLNodePtr root;
|
||||
bool success = LLXMLNode::getLayeredXMLNode(root, paths);
|
||||
if (!success)
|
||||
{
|
||||
// couldn't load string table XML
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// get those strings out of the XML
|
||||
LLTrans::parseStrings(root, default_trans_args);
|
||||
return true;
|
||||
}
|
||||
|*==========================================================================*/
|
||||
}
|
||||
|
||||
|
||||
void updater_app_ui_init(void);
|
||||
void updater_app_quit(UpdaterAppState *app_state);
|
||||
void parse_args_and_init(int argc, char **argv, UpdaterAppState *app_state);
|
||||
std::string next_image_filename(std::string& image_path, LLDirIterator& iter);
|
||||
void display_error(GtkWidget *parent, std::string title, std::string message);
|
||||
BOOL install_package(std::string package_file, std::string destination);
|
||||
BOOL spawn_viewer(UpdaterAppState *app_state);
|
||||
|
||||
extern "C" {
|
||||
void on_window_closed(GtkWidget *sender, GdkEvent *event, gpointer state);
|
||||
gpointer worker_thread_cb(gpointer *data);
|
||||
int download_progress_cb(gpointer data, double t, double d, double utotal, double ulnow);
|
||||
gboolean rotate_image_cb(gpointer data);
|
||||
gboolean progress_update_timeout(gpointer data);
|
||||
gboolean update_progress_text_timeout(gpointer data);
|
||||
}
|
||||
|
||||
void updater_app_ui_init(UpdaterAppState *app_state)
|
||||
{
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *summary_label;
|
||||
GtkWidget *description_label;
|
||||
GtkWidget *frame;
|
||||
|
||||
llassert(app_state != NULL);
|
||||
|
||||
// set up window and main container
|
||||
std::string window_title = LLTrans::getString("UpdaterWindowTitle");
|
||||
app_state->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title(GTK_WINDOW(app_state->window),
|
||||
window_title.c_str());
|
||||
gtk_window_set_resizable(GTK_WINDOW(app_state->window), FALSE);
|
||||
gtk_window_set_position(GTK_WINDOW(app_state->window),
|
||||
GTK_WIN_POS_CENTER_ALWAYS);
|
||||
|
||||
gtk_container_set_border_width(GTK_CONTAINER(app_state->window), 12);
|
||||
g_signal_connect(G_OBJECT(app_state->window), "delete-event",
|
||||
G_CALLBACK(on_window_closed), app_state);
|
||||
|
||||
vbox = gtk_vbox_new(FALSE, 6);
|
||||
gtk_container_add(GTK_CONTAINER(app_state->window), vbox);
|
||||
|
||||
// set top label
|
||||
std::ostringstream label_ostr;
|
||||
label_ostr << "<big><b>"
|
||||
<< LLTrans::getString("UpdaterNowUpdating")
|
||||
<< "</b></big>";
|
||||
|
||||
summary_label = gtk_label_new(NULL);
|
||||
gtk_label_set_use_markup(GTK_LABEL(summary_label), TRUE);
|
||||
gtk_label_set_markup(GTK_LABEL(summary_label),
|
||||
label_ostr.str().c_str());
|
||||
gtk_misc_set_alignment(GTK_MISC(summary_label), 0, 0.5);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), summary_label, FALSE, FALSE, 0);
|
||||
|
||||
// create the description label
|
||||
description_label = gtk_label_new(LLTrans::getString("UpdaterUpdatingDescriptive").c_str());
|
||||
gtk_label_set_line_wrap(GTK_LABEL(description_label), TRUE);
|
||||
gtk_misc_set_alignment(GTK_MISC(description_label), 0, 0.5);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), description_label, FALSE, FALSE, 0);
|
||||
|
||||
// If an image path has been set, load the background images
|
||||
if (!app_state->image_dir.empty()) {
|
||||
frame = gtk_frame_new(NULL);
|
||||
gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
|
||||
|
||||
// load the first image
|
||||
app_state->image = gtk_image_new_from_file
|
||||
(next_image_filename(app_state->image_dir, *app_state->image_dir_iter).c_str());
|
||||
gtk_widget_set_size_request(app_state->image, 340, 310);
|
||||
gtk_container_add(GTK_CONTAINER(frame), app_state->image);
|
||||
|
||||
// rotate the images every 5 seconds
|
||||
app_state->image_rotation_timeout_id = g_timeout_add
|
||||
(ROTATE_IMAGE_TIMEOUT, rotate_image_cb, app_state);
|
||||
}
|
||||
|
||||
// set up progress bar, and update it roughly every 1/10 of a second
|
||||
app_state->progress_bar = gtk_progress_bar_new();
|
||||
gtk_progress_bar_set_text(GTK_PROGRESS_BAR(app_state->progress_bar),
|
||||
LLTrans::getString("UpdaterProgressBarTextWithEllipses").c_str());
|
||||
gtk_box_pack_start(GTK_BOX(vbox),
|
||||
app_state->progress_bar, FALSE, TRUE, 0);
|
||||
app_state->progress_update_timeout_id = g_timeout_add
|
||||
(UPDATE_PROGRESS_TIMEOUT, progress_update_timeout, app_state);
|
||||
app_state->update_progress_text_timeout_id = g_timeout_add
|
||||
(UPDATE_PROGRESS_TEXT_TIMEOUT, update_progress_text_timeout, app_state);
|
||||
|
||||
gtk_widget_show_all(app_state->window);
|
||||
}
|
||||
|
||||
gboolean rotate_image_cb(gpointer data)
|
||||
{
|
||||
UpdaterAppState *app_state;
|
||||
std::string filename;
|
||||
|
||||
llassert(data != NULL);
|
||||
app_state = (UpdaterAppState *) data;
|
||||
|
||||
filename = next_image_filename(app_state->image_dir, *app_state->image_dir_iter);
|
||||
|
||||
gdk_threads_enter();
|
||||
gtk_image_set_from_file(GTK_IMAGE(app_state->image), filename.c_str());
|
||||
gdk_threads_leave();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
std::string next_image_filename(std::string& image_path, LLDirIterator& iter)
|
||||
{
|
||||
std::string image_filename;
|
||||
iter.next(image_filename);
|
||||
return gDirUtilp->add(image_path, image_filename);
|
||||
}
|
||||
|
||||
void on_window_closed(GtkWidget *sender, GdkEvent* event, gpointer data)
|
||||
{
|
||||
UpdaterAppState *app_state;
|
||||
|
||||
llassert(data != NULL);
|
||||
app_state = (UpdaterAppState *) data;
|
||||
|
||||
updater_app_quit(app_state);
|
||||
}
|
||||
|
||||
void updater_app_quit(UpdaterAppState *app_state)
|
||||
{
|
||||
if (app_state != NULL)
|
||||
{
|
||||
g_source_remove(app_state->progress_update_timeout_id);
|
||||
|
||||
if (!app_state->image_dir.empty())
|
||||
{
|
||||
g_source_remove(app_state->image_rotation_timeout_id);
|
||||
}
|
||||
}
|
||||
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
void display_error(GtkWidget *parent, std::string title, std::string message)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
|
||||
dialog = gtk_message_dialog_new(GTK_WINDOW(parent),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_OK,
|
||||
"%s", message.c_str());
|
||||
gtk_window_set_title(GTK_WINDOW(dialog), title.c_str());
|
||||
gtk_dialog_run(GTK_DIALOG(dialog));
|
||||
gtk_widget_destroy(dialog);
|
||||
}
|
||||
|
||||
gpointer worker_thread_cb(gpointer data)
|
||||
{
|
||||
UpdaterAppState *app_state;
|
||||
CURL *curl;
|
||||
CURLcode result;
|
||||
FILE *package_file;
|
||||
GError *error = NULL;
|
||||
int fd;
|
||||
|
||||
//g_return_val_if_fail (data != NULL, NULL);
|
||||
app_state = (UpdaterAppState *) data;
|
||||
|
||||
try {
|
||||
|
||||
if(!app_state->url.empty())
|
||||
{
|
||||
char* tmp_local_filename = NULL;
|
||||
// create temporary file to store the package.
|
||||
fd = g_file_open_tmp
|
||||
("secondlife-update-XXXXXX", &tmp_local_filename, &error);
|
||||
if (error != NULL)
|
||||
{
|
||||
llerrs << "Unable to create temporary file: "
|
||||
<< error->message
|
||||
<< llendl;
|
||||
|
||||
g_error_free(error);
|
||||
throw 0;
|
||||
}
|
||||
|
||||
if(tmp_local_filename != NULL)
|
||||
{
|
||||
app_state->file = tmp_local_filename;
|
||||
g_free(tmp_local_filename);
|
||||
}
|
||||
|
||||
package_file = fdopen(fd, "wb");
|
||||
if (package_file == NULL)
|
||||
{
|
||||
llerrs << "Failed to create temporary file: "
|
||||
<< app_state->file.c_str()
|
||||
<< llendl;
|
||||
|
||||
gdk_threads_enter();
|
||||
display_error(app_state->window,
|
||||
LLTrans::getString("UpdaterFailDownloadTitle"),
|
||||
LLTrans::getString("UpdaterFailUpdateDescriptive"));
|
||||
gdk_threads_leave();
|
||||
throw 0;
|
||||
}
|
||||
|
||||
// initialize curl and start downloading the package
|
||||
llinfos << "Downloading package: " << app_state->url << llendl;
|
||||
|
||||
curl = curl_easy_init();
|
||||
if (curl == NULL)
|
||||
{
|
||||
llerrs << "Failed to initialize libcurl" << llendl;
|
||||
|
||||
gdk_threads_enter();
|
||||
display_error(app_state->window,
|
||||
LLTrans::getString("UpdaterFailDownloadTitle"),
|
||||
LLTrans::getString("UpdaterFailUpdateDescriptive"));
|
||||
gdk_threads_leave();
|
||||
throw 0;
|
||||
}
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_URL, app_state->url.c_str());
|
||||
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, TRUE);
|
||||
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, TRUE);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, package_file);
|
||||
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, FALSE);
|
||||
curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION,
|
||||
&download_progress_cb);
|
||||
curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, app_state);
|
||||
|
||||
result = curl_easy_perform(curl);
|
||||
fclose(package_file);
|
||||
curl_easy_cleanup(curl);
|
||||
|
||||
if (result)
|
||||
{
|
||||
llerrs << "Failed to download update: "
|
||||
<< app_state->url
|
||||
<< llendl;
|
||||
|
||||
gdk_threads_enter();
|
||||
display_error(app_state->window,
|
||||
LLTrans::getString("UpdaterFailDownloadTitle"),
|
||||
LLTrans::getString("UpdaterFailUpdateDescriptive"));
|
||||
gdk_threads_leave();
|
||||
|
||||
throw 0;
|
||||
}
|
||||
}
|
||||
|
||||
// now pulse the progres bar back and forth while the package is
|
||||
// being unpacked
|
||||
gdk_threads_enter();
|
||||
std::string installing_msg = LLTrans::getString("UpdaterNowInstalling");
|
||||
gtk_progress_bar_set_text(
|
||||
GTK_PROGRESS_BAR(app_state->progress_bar),
|
||||
installing_msg.c_str());
|
||||
app_state->activity_mode = TRUE;
|
||||
gdk_threads_leave();
|
||||
|
||||
// *TODO: if the destination is not writable, terminate this
|
||||
// thread and show file chooser?
|
||||
if (!install_package(app_state->file.c_str(), app_state->dest_dir))
|
||||
{
|
||||
llwarns << "Failed to install package to destination: "
|
||||
<< app_state->dest_dir
|
||||
<< llendl;
|
||||
|
||||
gdk_threads_enter();
|
||||
display_error(app_state->window,
|
||||
LLTrans::getString("UpdaterFailInstallTitle"),
|
||||
LLTrans::getString("UpdaterFailUpdateDescriptive"));
|
||||
//"Failed to update " + app_state->app_name,
|
||||
gdk_threads_leave();
|
||||
throw 0;
|
||||
}
|
||||
|
||||
// try to spawn the new viewer
|
||||
if (!spawn_viewer(app_state))
|
||||
{
|
||||
llwarns << "Viewer was not installed properly in : "
|
||||
<< app_state->dest_dir
|
||||
<< llendl;
|
||||
|
||||
gdk_threads_enter();
|
||||
display_error(app_state->window,
|
||||
LLTrans::getString("UpdaterFailStartTitle"),
|
||||
LLTrans::getString("UpdaterFailUpdateDescriptive"));
|
||||
gdk_threads_leave();
|
||||
throw 0;
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
app_state->failure = TRUE;
|
||||
}
|
||||
|
||||
gdk_threads_enter();
|
||||
updater_app_quit(app_state);
|
||||
gdk_threads_leave();
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
gboolean less_anal_gspawnsync(gchar **argv,
|
||||
gchar **stderr_output,
|
||||
gint *child_exit_status,
|
||||
GError **spawn_error)
|
||||
{
|
||||
// store current SIGCHLD handler if there is one, replace with default
|
||||
// handler to make glib happy
|
||||
struct sigaction sigchld_backup;
|
||||
struct sigaction sigchld_appease_glib;
|
||||
sigchld_appease_glib.sa_handler = SIG_DFL;
|
||||
sigemptyset(&sigchld_appease_glib.sa_mask);
|
||||
sigchld_appease_glib.sa_flags = 0;
|
||||
sigaction(SIGCHLD, &sigchld_appease_glib, &sigchld_backup);
|
||||
|
||||
gboolean rtn = g_spawn_sync(NULL,
|
||||
argv,
|
||||
NULL,
|
||||
(GSpawnFlags) (G_SPAWN_STDOUT_TO_DEV_NULL),
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
stderr_output,
|
||||
child_exit_status,
|
||||
spawn_error);
|
||||
|
||||
// restore SIGCHLD handler
|
||||
sigaction(SIGCHLD, &sigchld_backup, NULL);
|
||||
|
||||
return rtn;
|
||||
}
|
||||
|
||||
|
||||
// perform a rename, or perform a (prompted) root rename if that fails
|
||||
int
|
||||
rename_with_sudo_fallback(const std::string& filename, const std::string& newname)
|
||||
{
|
||||
int rtncode = ::rename(filename.c_str(), newname.c_str());
|
||||
lldebugs << "rename result is: " << rtncode << " / " << errno << llendl;
|
||||
if (rtncode && (EACCES == errno || EPERM == errno || EXDEV == errno))
|
||||
{
|
||||
llinfos << "Permission problem in rename, or moving between different mount points. Retrying as a mv under a sudo." << llendl;
|
||||
// failed due to permissions, try again as a gksudo or kdesu mv wrapper hack
|
||||
char *sudo_cmd = NULL;
|
||||
sudo_cmd = g_find_program_in_path("gksudo");
|
||||
if (!sudo_cmd)
|
||||
{
|
||||
sudo_cmd = g_find_program_in_path("kdesu");
|
||||
}
|
||||
if (sudo_cmd)
|
||||
{
|
||||
char *mv_cmd = NULL;
|
||||
mv_cmd = g_find_program_in_path("mv");
|
||||
if (mv_cmd)
|
||||
{
|
||||
char *src_string_copy = g_strdup(filename.c_str());
|
||||
char *dst_string_copy = g_strdup(newname.c_str());
|
||||
char* argv[] =
|
||||
{
|
||||
sudo_cmd,
|
||||
mv_cmd,
|
||||
src_string_copy,
|
||||
dst_string_copy,
|
||||
NULL
|
||||
};
|
||||
|
||||
gchar *stderr_output = NULL;
|
||||
gint child_exit_status = 0;
|
||||
GError *spawn_error = NULL;
|
||||
if (!less_anal_gspawnsync(argv, &stderr_output,
|
||||
&child_exit_status, &spawn_error))
|
||||
{
|
||||
llwarns << "Failed to spawn child process: "
|
||||
<< spawn_error->message
|
||||
<< llendl;
|
||||
}
|
||||
else if (child_exit_status)
|
||||
{
|
||||
llwarns << "mv command failed: "
|
||||
<< (stderr_output ? stderr_output : "(no reason given)")
|
||||
<< llendl;
|
||||
}
|
||||
else
|
||||
{
|
||||
// everything looks good, clear the error code
|
||||
rtncode = 0;
|
||||
}
|
||||
|
||||
g_free(src_string_copy);
|
||||
g_free(dst_string_copy);
|
||||
if (spawn_error) g_error_free(spawn_error);
|
||||
}
|
||||
}
|
||||
}
|
||||
return rtncode;
|
||||
}
|
||||
|
||||
gboolean install_package(std::string package_file, std::string destination)
|
||||
{
|
||||
char *tar_cmd = NULL;
|
||||
std::ostringstream command;
|
||||
|
||||
// Find the absolute path to the 'tar' command.
|
||||
tar_cmd = g_find_program_in_path("tar");
|
||||
if (!tar_cmd)
|
||||
{
|
||||
llerrs << "`tar' was not found in $PATH" << llendl;
|
||||
return FALSE;
|
||||
}
|
||||
llinfos << "Found tar command: " << tar_cmd << llendl;
|
||||
|
||||
// Unpack the tarball in a temporary place first, then move it to
|
||||
// its final destination
|
||||
std::string tmp_dest_dir = gDirUtilp->getTempFilename();
|
||||
if (LLFile::mkdir(tmp_dest_dir, 0744))
|
||||
{
|
||||
llerrs << "Failed to create directory: "
|
||||
<< destination
|
||||
<< llendl;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
char *package_file_string_copy = g_strdup(package_file.c_str());
|
||||
char *tmp_dest_dir_string_copy = g_strdup(tmp_dest_dir.c_str());
|
||||
gchar *argv[8] = {
|
||||
tar_cmd,
|
||||
const_cast<gchar*>("--strip"), const_cast<gchar*>("1"),
|
||||
const_cast<gchar*>("-xjf"),
|
||||
package_file_string_copy,
|
||||
const_cast<gchar*>("-C"), tmp_dest_dir_string_copy,
|
||||
NULL,
|
||||
};
|
||||
|
||||
llinfos << "Untarring package: " << package_file << llendl;
|
||||
|
||||
// store current SIGCHLD handler if there is one, replace with default
|
||||
// handler to make glib happy
|
||||
struct sigaction sigchld_backup;
|
||||
struct sigaction sigchld_appease_glib;
|
||||
sigchld_appease_glib.sa_handler = SIG_DFL;
|
||||
sigemptyset(&sigchld_appease_glib.sa_mask);
|
||||
sigchld_appease_glib.sa_flags = 0;
|
||||
sigaction(SIGCHLD, &sigchld_appease_glib, &sigchld_backup);
|
||||
|
||||
gchar *stderr_output = NULL;
|
||||
gint child_exit_status = 0;
|
||||
GError *untar_error = NULL;
|
||||
if (!less_anal_gspawnsync(argv, &stderr_output,
|
||||
&child_exit_status, &untar_error))
|
||||
{
|
||||
llwarns << "Failed to spawn child process: "
|
||||
<< untar_error->message
|
||||
<< llendl;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (child_exit_status)
|
||||
{
|
||||
llwarns << "Untar command failed: "
|
||||
<< (stderr_output ? stderr_output : "(no reason given)")
|
||||
<< llendl;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_free(tar_cmd);
|
||||
g_free(package_file_string_copy);
|
||||
g_free(tmp_dest_dir_string_copy);
|
||||
g_free(stderr_output);
|
||||
if (untar_error) g_error_free(untar_error);
|
||||
|
||||
// move the existing package out of the way if it exists
|
||||
if (gDirUtilp->fileExists(destination))
|
||||
{
|
||||
std::string backup_dir = destination + ".backup";
|
||||
int oldcounter = 1;
|
||||
while (gDirUtilp->fileExists(backup_dir))
|
||||
{
|
||||
// find a foo.backup.N folder name that isn't taken yet
|
||||
backup_dir = destination + ".backup." + llformat("%d", oldcounter);
|
||||
++oldcounter;
|
||||
}
|
||||
|
||||
if (rename_with_sudo_fallback(destination, backup_dir))
|
||||
{
|
||||
llwarns << "Failed to move directory: '"
|
||||
<< destination << "' -> '" << backup_dir
|
||||
<< llendl;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// The package has been unpacked in a staging directory, now we just
|
||||
// need to move it to its destination.
|
||||
if (rename_with_sudo_fallback(tmp_dest_dir, destination))
|
||||
{
|
||||
llwarns << "Failed to move installation to the destination: "
|
||||
<< destination
|
||||
<< llendl;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// \0/ Success!
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean progress_update_timeout(gpointer data)
|
||||
{
|
||||
UpdaterAppState *app_state;
|
||||
|
||||
llassert(data != NULL);
|
||||
|
||||
app_state = (UpdaterAppState *) data;
|
||||
|
||||
gdk_threads_enter();
|
||||
if (app_state->activity_mode)
|
||||
{
|
||||
gtk_progress_bar_pulse
|
||||
(GTK_PROGRESS_BAR(app_state->progress_bar));
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_progress_set_value(GTK_PROGRESS(app_state->progress_bar),
|
||||
app_state->progress_value);
|
||||
}
|
||||
gdk_threads_leave();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean update_progress_text_timeout(gpointer data)
|
||||
{
|
||||
UpdaterAppState *app_state;
|
||||
|
||||
llassert(data != NULL);
|
||||
app_state = (UpdaterAppState *) data;
|
||||
|
||||
if (app_state->activity_mode == TRUE)
|
||||
{
|
||||
// We no longer need this timeout, it will be removed.
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!app_state->progress_value)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
std::string progress_text = llformat((LLTrans::getString("UpdaterProgressBarText")+" (%.0f%%)").c_str(), app_state->progress_value);
|
||||
|
||||
gdk_threads_enter();
|
||||
gtk_progress_bar_set_text(GTK_PROGRESS_BAR(app_state->progress_bar),
|
||||
progress_text.c_str());
|
||||
gdk_threads_leave();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int download_progress_cb(gpointer data,
|
||||
double t,
|
||||
double d,
|
||||
double utotal,
|
||||
double ulnow)
|
||||
{
|
||||
UpdaterAppState *app_state;
|
||||
|
||||
llassert(data != NULL);
|
||||
app_state = (UpdaterAppState *) data;
|
||||
|
||||
if (t <= 0.0)
|
||||
{
|
||||
app_state->progress_value = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
app_state->progress_value = d * 100.0 / t;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL spawn_viewer(UpdaterAppState *app_state)
|
||||
{
|
||||
llassert(app_state != NULL);
|
||||
|
||||
std::string cmd = app_state->dest_dir + "/secondlife";
|
||||
GError *error = NULL;
|
||||
|
||||
// We want to spawn the Viewer on the same display as the updater app
|
||||
gboolean success = gdk_spawn_command_line_on_screen
|
||||
(gtk_widget_get_screen(app_state->window), cmd.c_str(), &error);
|
||||
|
||||
if (!success)
|
||||
{
|
||||
llwarns << "Failed to launch viewer: " << error->message
|
||||
<< llendl;
|
||||
}
|
||||
|
||||
if (error) g_error_free(error);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
void show_usage_and_exit()
|
||||
{
|
||||
std::cout << "Usage: linux-updater <--url URL | --file FILE> --name NAME --dest PATH --stringsdir PATH1,PATH2 --stringsfile FILE"
|
||||
<< "[--image-dir PATH]"
|
||||
<< std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void parse_args_and_init(int argc, char **argv, UpdaterAppState *app_state)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
if ((!strcmp(argv[i], "--url")) && (++i < argc))
|
||||
{
|
||||
app_state->url = argv[i];
|
||||
}
|
||||
else if ((!strcmp(argv[i], "--file")) && (++i < argc))
|
||||
{
|
||||
app_state->file = argv[i];
|
||||
}
|
||||
else if ((!strcmp(argv[i], "--name")) && (++i < argc))
|
||||
{
|
||||
app_state->app_name = argv[i];
|
||||
}
|
||||
else if ((!strcmp(argv[i], "--image-dir")) && (++i < argc))
|
||||
{
|
||||
app_state->image_dir = argv[i];
|
||||
app_state->image_dir_iter = new LLDirIterator(argv[i], "*.jpg");
|
||||
}
|
||||
else if ((!strcmp(argv[i], "--dest")) && (++i < argc))
|
||||
{
|
||||
app_state->dest_dir = argv[i];
|
||||
}
|
||||
else if ((!strcmp(argv[i], "--stringsdir")) && (++i < argc))
|
||||
{
|
||||
app_state->strings_dirs = argv[i];
|
||||
}
|
||||
else if ((!strcmp(argv[i], "--stringsfile")) && (++i < argc))
|
||||
{
|
||||
app_state->strings_file = argv[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
// show usage, an invalid option was given.
|
||||
show_usage_and_exit();
|
||||
}
|
||||
}
|
||||
|
||||
if (app_state->app_name.empty()
|
||||
|| (app_state->url.empty() && app_state->file.empty())
|
||||
|| app_state->dest_dir.empty())
|
||||
{
|
||||
show_usage_and_exit();
|
||||
}
|
||||
|
||||
app_state->progress_value = 0.0;
|
||||
app_state->activity_mode = FALSE;
|
||||
app_state->failure = FALSE;
|
||||
|
||||
translate_init(app_state->strings_dirs, app_state->strings_file);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
UpdaterAppState* app_state = new UpdaterAppState;
|
||||
|
||||
parse_args_and_init(argc, argv, app_state);
|
||||
|
||||
// Initialize logger, and rename old log file
|
||||
gDirUtilp->initAppDirs("SecondLife");
|
||||
LLError::initForApplication
|
||||
(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, ""));
|
||||
std::string old_log_file = gDirUtilp->getExpandedFilename
|
||||
(LL_PATH_LOGS, "updater.log.old");
|
||||
std::string log_file =
|
||||
gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "updater.log");
|
||||
LLFile::rename(log_file, old_log_file);
|
||||
LLError::logToFile(log_file);
|
||||
|
||||
// initialize gthreads and gtk+
|
||||
if (!g_thread_supported())
|
||||
{
|
||||
g_thread_init(NULL);
|
||||
gdk_threads_init();
|
||||
}
|
||||
|
||||
gtk_init(&argc, &argv);
|
||||
|
||||
// create UI
|
||||
updater_app_ui_init(app_state);
|
||||
|
||||
//llinfos << "SAMPLE TRANSLATION IS: " << LLTrans::getString("LoginInProgress") << llendl;
|
||||
|
||||
// create download thread
|
||||
g_thread_create(GThreadFunc(worker_thread_cb), app_state, FALSE, NULL);
|
||||
|
||||
gdk_threads_enter();
|
||||
gtk_main();
|
||||
gdk_threads_leave();
|
||||
|
||||
// Delete the file only if created from url download.
|
||||
if(!app_state->url.empty() && !app_state->file.empty())
|
||||
{
|
||||
if (gDirUtilp->fileExists(app_state->file))
|
||||
{
|
||||
LLFile::remove(app_state->file);
|
||||
}
|
||||
}
|
||||
|
||||
bool success = !app_state->failure;
|
||||
delete app_state->image_dir_iter;
|
||||
delete app_state;
|
||||
return success ? 0 : 1;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* Dummy LLTrans implementation (IQA-490)
|
||||
*****************************************************************************/
|
||||
static LLTrans sStaticStrings;
|
||||
|
||||
// lookup
|
||||
std::string LLTrans::_getString(const std::string& key) const
|
||||
{
|
||||
MessageMap::const_iterator found = mMessages.find(key);
|
||||
if (found != mMessages.end())
|
||||
{
|
||||
return found->second;
|
||||
}
|
||||
LL_WARNS("linux_updater") << "No message for key '" << key
|
||||
<< "' -- add to LLTrans::LLTrans() in linux_updater.cpp"
|
||||
<< LL_ENDL;
|
||||
return key;
|
||||
}
|
||||
|
||||
// static lookup
|
||||
std::string LLTrans::getString(const std::string& key)
|
||||
{
|
||||
return sLLTransInstance._getString(key);
|
||||
}
|
||||
|
||||
// initialization
|
||||
LLTrans::LLTrans()
|
||||
{
|
||||
typedef std::pair<const char*, const char*> Pair;
|
||||
static const Pair data[] =
|
||||
{
|
||||
Pair("UpdaterFailDownloadTitle",
|
||||
"Failed to download update"),
|
||||
Pair("UpdaterFailInstallTitle",
|
||||
"Failed to install update"),
|
||||
Pair("UpdaterFailStartTitle",
|
||||
"Failed to start viewer"),
|
||||
Pair("UpdaterFailUpdateDescriptive",
|
||||
"An error occurred while updating Second Life. "
|
||||
"Please download the latest version from www.secondlife.com."),
|
||||
Pair("UpdaterNowInstalling",
|
||||
"Installing Second Life..."),
|
||||
Pair("UpdaterNowUpdating",
|
||||
"Now updating Second Life..."),
|
||||
Pair("UpdaterProgressBarText",
|
||||
"Downloading update"),
|
||||
Pair("UpdaterProgressBarTextWithEllipses",
|
||||
"Downloading update..."),
|
||||
Pair("UpdaterUpdatingDescriptive",
|
||||
"Your Second Life Viewer is being updated to the latest release. "
|
||||
"This may take some time, so please be patient."),
|
||||
Pair("UpdaterWindowTitle",
|
||||
"Second Life Update")
|
||||
};
|
||||
|
||||
BOOST_FOREACH(Pair pair, data)
|
||||
{
|
||||
mMessages[pair.first] = pair.second;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
# -*- cmake -*-
|
||||
|
||||
project(llappearance)
|
||||
|
||||
include(00-Common)
|
||||
include(LLCommon)
|
||||
include(LLCharacter)
|
||||
include(LLImage)
|
||||
include(LLInventory)
|
||||
include(LLMath)
|
||||
include(LLMessage)
|
||||
include(LLRender)
|
||||
include(LLVFS)
|
||||
include(LLWindow)
|
||||
include(LLXML)
|
||||
include(Linking)
|
||||
|
||||
include_directories(
|
||||
${LLCOMMON_INCLUDE_DIRS}
|
||||
${LLCHARACTER_INCLUDE_DIRS}
|
||||
${LLIMAGE_INCLUDE_DIRS}
|
||||
${LLINVENTORY_INCLUDE_DIRS}
|
||||
${LLMATH_INCLUDE_DIRS}
|
||||
${LLRENDER_INCLUDE_DIRS}
|
||||
${LLVFS_INCLUDE_DIRS}
|
||||
${LLWINDOW_INCLUDE_DIRS}
|
||||
${LLXML_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
set(llappearance_SOURCE_FILES
|
||||
llavatarappearance.cpp
|
||||
llavatarjoint.cpp
|
||||
llavatarjointmesh.cpp
|
||||
lldriverparam.cpp
|
||||
lllocaltextureobject.cpp
|
||||
llpolyskeletaldistortion.cpp
|
||||
llpolymesh.cpp
|
||||
llpolymorph.cpp
|
||||
lltexglobalcolor.cpp
|
||||
lltexlayer.cpp
|
||||
lltexlayerparams.cpp
|
||||
lltexturemanagerbridge.cpp
|
||||
llwearable.cpp
|
||||
llwearabledata.cpp
|
||||
llwearabletype.cpp
|
||||
llviewervisualparam.cpp
|
||||
llavatarappearancedefines.cpp
|
||||
)
|
||||
|
||||
set(llappearance_HEADER_FILES
|
||||
CMakeLists.txt
|
||||
|
||||
llavatarappearance.h
|
||||
llavatarjoint.h
|
||||
llavatarjointmesh.h
|
||||
lldriverparam.h
|
||||
lljointpickname.h
|
||||
lllocaltextureobject.h
|
||||
llpolyskeletaldistortion.h
|
||||
llpolymesh.h
|
||||
llpolymorph.h
|
||||
lltexglobalcolor.h
|
||||
lltexlayer.h
|
||||
lltexlayerparams.h
|
||||
lltexturemanagerbridge.h
|
||||
llwearable.h
|
||||
llwearabledata.h
|
||||
llwearabletype.h
|
||||
llviewervisualparam.h
|
||||
llavatarappearancedefines.h
|
||||
)
|
||||
|
||||
set_source_files_properties(${llappearance_HEADER_FILES}
|
||||
PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
|
||||
list(APPEND llappearance_SOURCE_FILES ${llappearance_HEADER_FILES})
|
||||
|
||||
add_library (llappearance ${llappearance_SOURCE_FILES})
|
||||
|
||||
target_link_libraries(llappearance
|
||||
${LLCHARACTER_LIBRARIES}
|
||||
${LLINVENTORY_LIBRARIES}
|
||||
${LLIMAGE_LIBRARIES}
|
||||
${LLRENDER_LIBRARIES}
|
||||
${LLVFS_LIBRARIES}
|
||||
${LLMATH_LIBRARIES}
|
||||
${LLXML_LIBRARIES}
|
||||
${LLMATH_LIBRARIES}
|
||||
${LLCOMMON_LIBRARIES}
|
||||
)
|
||||
|
||||
if (BUILD_HEADLESS)
|
||||
add_library (llappearanceheadless ${llappearance_SOURCE_FILES})
|
||||
|
||||
target_link_libraries(llappearanceheadless
|
||||
${LLCHARACTER_LIBRARIES}
|
||||
${LLINVENTORY_LIBRARIES}
|
||||
${LLIMAGE_LIBRARIES}
|
||||
${LLRENDERHEADLESS_LIBRARIES}
|
||||
${LLVFS_LIBRARIES}
|
||||
${LLMATH_LIBRARIES}
|
||||
${LLXML_LIBRARIES}
|
||||
${LLMATH_LIBRARIES}
|
||||
${LLCOMMON_LIBRARIES}
|
||||
)
|
||||
endif (BUILD_HEADLESS)
|
||||
|
||||
#add unit tests
|
||||
#if (LL_TESTS)
|
||||
# INCLUDE(LLAddBuildTest)
|
||||
# SET(llappearance_TEST_SOURCE_FILES
|
||||
# # no real unit tests yet!
|
||||
# )
|
||||
# LL_ADD_PROJECT_UNIT_TESTS(llappearance "${llappearance_TEST_SOURCE_FILES}")
|
||||
|
||||
#set(TEST_DEBUG on)
|
||||
# set(test_libs llappearance ${LLCOMMON_LIBRARIES})
|
||||
#endif (LL_TESTS)
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,448 @@
|
|||
/**
|
||||
* @file llavatarappearance.h
|
||||
* @brief Declaration of LLAvatarAppearance class
|
||||
*
|
||||
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#ifndef LL_AVATAR_APPEARANCE_H
|
||||
#define LL_AVATAR_APPEARANCE_H
|
||||
|
||||
#include "llcharacter.h"
|
||||
#include "llavatarappearancedefines.h"
|
||||
#include "llavatarjointmesh.h"
|
||||
#include "lldriverparam.h"
|
||||
#include "lltexlayer.h"
|
||||
#include "llviewervisualparam.h"
|
||||
#include "llxmltree.h"
|
||||
|
||||
class LLTexLayerSet;
|
||||
class LLTexGlobalColor;
|
||||
class LLTexGlobalColorInfo;
|
||||
class LLWearableData;
|
||||
class LLAvatarBoneInfo;
|
||||
class LLAvatarSkeletonInfo;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// LLAvatarAppearance
|
||||
//
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
class LLAvatarAppearance : public LLCharacter
|
||||
{
|
||||
LOG_CLASS(LLAvatarAppearance);
|
||||
|
||||
protected:
|
||||
struct LLAvatarXmlInfo;
|
||||
|
||||
/********************************************************************************
|
||||
** **
|
||||
** INITIALIZATION
|
||||
**/
|
||||
private:
|
||||
// Hide default constructor.
|
||||
LLAvatarAppearance() {}
|
||||
|
||||
public:
|
||||
LLAvatarAppearance(LLWearableData* wearable_data);
|
||||
virtual ~LLAvatarAppearance();
|
||||
|
||||
static void initClass(); // initializes static members
|
||||
static void cleanupClass(); // Cleanup data that's only init'd once per class.
|
||||
virtual void initInstance(); // Called after construction to initialize the instance.
|
||||
virtual BOOL loadSkeletonNode();
|
||||
BOOL loadMeshNodes();
|
||||
BOOL loadLayersets();
|
||||
|
||||
|
||||
/** Initialization
|
||||
** **
|
||||
*******************************************************************************/
|
||||
|
||||
/********************************************************************************
|
||||
** **
|
||||
** INHERITED
|
||||
**/
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// LLCharacter interface and related
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
/*virtual*/ LLJoint* getCharacterJoint(U32 num);
|
||||
|
||||
/*virtual*/ const char* getAnimationPrefix() { return "avatar"; }
|
||||
/*virtual*/ LLVector3 getVolumePos(S32 joint_index, LLVector3& volume_offset);
|
||||
/*virtual*/ LLJoint* findCollisionVolume(U32 volume_id);
|
||||
/*virtual*/ S32 getCollisionVolumeID(std::string &name);
|
||||
/*virtual*/ LLPolyMesh* getHeadMesh();
|
||||
/*virtual*/ LLPolyMesh* getUpperBodyMesh();
|
||||
|
||||
/** Inherited
|
||||
** **
|
||||
*******************************************************************************/
|
||||
|
||||
/********************************************************************************
|
||||
** **
|
||||
** STATE
|
||||
**/
|
||||
public:
|
||||
virtual bool isSelf() const { return false; } // True if this avatar is for this viewer's agent
|
||||
virtual BOOL isValid() const;
|
||||
virtual BOOL isUsingServerBakes() const = 0;
|
||||
virtual BOOL isUsingLocalAppearance() const = 0;
|
||||
virtual BOOL isEditingAppearance() const = 0;
|
||||
|
||||
bool isBuilt() const { return mIsBuilt; }
|
||||
|
||||
|
||||
/** State
|
||||
** **
|
||||
*******************************************************************************/
|
||||
|
||||
/********************************************************************************
|
||||
** **
|
||||
** SKELETON
|
||||
**/
|
||||
|
||||
protected:
|
||||
virtual LLAvatarJoint* createAvatarJoint() = 0;
|
||||
virtual LLAvatarJoint* createAvatarJoint(S32 joint_num) = 0;
|
||||
virtual LLAvatarJointMesh* createAvatarJointMesh() = 0;
|
||||
public:
|
||||
F32 getPelvisToFoot() const { return mPelvisToFoot; }
|
||||
/*virtual*/ LLJoint* getRootJoint() { return mRoot; }
|
||||
|
||||
LLVector3 mHeadOffset; // current head position
|
||||
LLAvatarJoint *mRoot;
|
||||
|
||||
typedef std::map<std::string, LLJoint*> joint_map_t;
|
||||
joint_map_t mJointMap;
|
||||
|
||||
void computeBodySize();
|
||||
|
||||
|
||||
protected:
|
||||
static BOOL parseSkeletonFile(const std::string& filename);
|
||||
virtual void buildCharacter();
|
||||
virtual BOOL loadAvatar();
|
||||
virtual void bodySizeChanged() = 0;
|
||||
|
||||
BOOL setupBone(const LLAvatarBoneInfo* info, LLJoint* parent, S32 ¤t_volume_num, S32 ¤t_joint_num);
|
||||
BOOL allocateCharacterJoints(U32 num);
|
||||
BOOL buildSkeleton(const LLAvatarSkeletonInfo *info);
|
||||
protected:
|
||||
void clearSkeleton();
|
||||
BOOL mIsBuilt; // state of deferred character building
|
||||
typedef std::vector<LLAvatarJoint*> avatar_joint_list_t;
|
||||
avatar_joint_list_t mSkeleton;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Pelvis height adjustment members.
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
LLVector3 mBodySize;
|
||||
LLVector3 mAvatarOffset;
|
||||
protected:
|
||||
F32 mPelvisToFoot;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Cached pointers to well known joints
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
LLJoint* mPelvisp;
|
||||
LLJoint* mTorsop;
|
||||
LLJoint* mChestp;
|
||||
LLJoint* mNeckp;
|
||||
LLJoint* mHeadp;
|
||||
LLJoint* mSkullp;
|
||||
LLJoint* mEyeLeftp;
|
||||
LLJoint* mEyeRightp;
|
||||
LLJoint* mHipLeftp;
|
||||
LLJoint* mHipRightp;
|
||||
LLJoint* mKneeLeftp;
|
||||
LLJoint* mKneeRightp;
|
||||
LLJoint* mAnkleLeftp;
|
||||
LLJoint* mAnkleRightp;
|
||||
LLJoint* mFootLeftp;
|
||||
LLJoint* mFootRightp;
|
||||
LLJoint* mWristLeftp;
|
||||
LLJoint* mWristRightp;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// XML parse tree
|
||||
//--------------------------------------------------------------------
|
||||
protected:
|
||||
static LLXmlTree sXMLTree; // avatar config file
|
||||
static LLXmlTree sSkeletonXMLTree; // avatar skeleton file
|
||||
|
||||
static LLAvatarSkeletonInfo* sAvatarSkeletonInfo;
|
||||
static LLAvatarXmlInfo* sAvatarXmlInfo;
|
||||
|
||||
|
||||
/** Skeleton
|
||||
** **
|
||||
*******************************************************************************/
|
||||
|
||||
|
||||
/********************************************************************************
|
||||
** **
|
||||
** RENDERING
|
||||
**/
|
||||
public:
|
||||
BOOL mIsDummy; // for special views
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Morph masks
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
void addMaskedMorph(LLAvatarAppearanceDefines::EBakedTextureIndex index, LLVisualParam* morph_target, BOOL invert, std::string layer);
|
||||
virtual void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components, LLAvatarAppearanceDefines::EBakedTextureIndex index = LLAvatarAppearanceDefines::BAKED_NUM_INDICES) = 0;
|
||||
|
||||
/** Rendering
|
||||
** **
|
||||
*******************************************************************************/
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Composites
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
virtual void invalidateComposite(LLTexLayerSet* layerset, BOOL upload_result) = 0;
|
||||
|
||||
/********************************************************************************
|
||||
** **
|
||||
** MESHES
|
||||
**/
|
||||
|
||||
public:
|
||||
virtual void updateMeshTextures() = 0;
|
||||
virtual void dirtyMesh() = 0; // Dirty the avatar mesh
|
||||
protected:
|
||||
virtual void dirtyMesh(S32 priority) = 0; // Dirty the avatar mesh, with priority
|
||||
|
||||
protected:
|
||||
typedef std::multimap<std::string, LLPolyMesh*> polymesh_map_t;
|
||||
polymesh_map_t mPolyMeshes;
|
||||
avatar_joint_list_t mMeshLOD;
|
||||
|
||||
/** Meshes
|
||||
** **
|
||||
*******************************************************************************/
|
||||
|
||||
/********************************************************************************
|
||||
** **
|
||||
** APPEARANCE
|
||||
**/
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Clothing colors (convenience functions to access visual parameters)
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
void setClothesColor(LLAvatarAppearanceDefines::ETextureIndex te, const LLColor4& new_color, BOOL upload_bake);
|
||||
LLColor4 getClothesColor(LLAvatarAppearanceDefines::ETextureIndex te);
|
||||
static BOOL teToColorParams(LLAvatarAppearanceDefines::ETextureIndex te, U32 *param_name);
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Global colors
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
LLColor4 getGlobalColor(const std::string& color_name ) const;
|
||||
virtual void onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL upload_bake) = 0;
|
||||
protected:
|
||||
LLTexGlobalColor* mTexSkinColor;
|
||||
LLTexGlobalColor* mTexHairColor;
|
||||
LLTexGlobalColor* mTexEyeColor;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Visibility
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
static LLColor4 getDummyColor();
|
||||
/** Appearance
|
||||
** **
|
||||
*******************************************************************************/
|
||||
|
||||
/********************************************************************************
|
||||
** **
|
||||
** WEARABLES
|
||||
**/
|
||||
|
||||
public:
|
||||
LLWearableData* getWearableData() { return mWearableData; }
|
||||
const LLWearableData* getWearableData() const { return mWearableData; }
|
||||
virtual BOOL isTextureDefined(LLAvatarAppearanceDefines::ETextureIndex te, U32 index = 0 ) const = 0;
|
||||
virtual BOOL isWearingWearableType(LLWearableType::EType type ) const;
|
||||
|
||||
private:
|
||||
LLWearableData* mWearableData;
|
||||
|
||||
/********************************************************************************
|
||||
** **
|
||||
** BAKED TEXTURES
|
||||
**/
|
||||
public:
|
||||
LLTexLayerSet* getAvatarLayerSet(LLAvatarAppearanceDefines::EBakedTextureIndex baked_index) const;
|
||||
|
||||
protected:
|
||||
virtual LLTexLayerSet* createTexLayerSet() = 0;
|
||||
|
||||
protected:
|
||||
class LLMaskedMorph;
|
||||
typedef std::deque<LLMaskedMorph *> morph_list_t;
|
||||
struct BakedTextureData
|
||||
{
|
||||
LLUUID mLastTextureID;
|
||||
LLTexLayerSet* mTexLayerSet; // Only exists for self
|
||||
bool mIsLoaded;
|
||||
bool mIsUsed;
|
||||
LLAvatarAppearanceDefines::ETextureIndex mTextureIndex;
|
||||
U32 mMaskTexName;
|
||||
// Stores pointers to the joint meshes that this baked texture deals with
|
||||
avatar_joint_mesh_list_t mJointMeshes;
|
||||
morph_list_t mMaskedMorphs;
|
||||
};
|
||||
typedef std::vector<BakedTextureData> bakedtexturedata_vec_t;
|
||||
bakedtexturedata_vec_t mBakedTextureDatas;
|
||||
|
||||
/********************************************************************************
|
||||
** **
|
||||
** PHYSICS
|
||||
**/
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Collision volumes
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
S32 mNumCollisionVolumes;
|
||||
LLAvatarJointCollisionVolume* mCollisionVolumes;
|
||||
protected:
|
||||
BOOL allocateCollisionVolumes(U32 num);
|
||||
|
||||
/** Physics
|
||||
** **
|
||||
*******************************************************************************/
|
||||
|
||||
/********************************************************************************
|
||||
** **
|
||||
** SUPPORT CLASSES
|
||||
**/
|
||||
|
||||
struct LLAvatarXmlInfo
|
||||
{
|
||||
LLAvatarXmlInfo();
|
||||
~LLAvatarXmlInfo();
|
||||
|
||||
BOOL parseXmlSkeletonNode(LLXmlTreeNode* root);
|
||||
BOOL parseXmlMeshNodes(LLXmlTreeNode* root);
|
||||
BOOL parseXmlColorNodes(LLXmlTreeNode* root);
|
||||
BOOL parseXmlLayerNodes(LLXmlTreeNode* root);
|
||||
BOOL parseXmlDriverNodes(LLXmlTreeNode* root);
|
||||
BOOL parseXmlMorphNodes(LLXmlTreeNode* root);
|
||||
|
||||
struct LLAvatarMeshInfo
|
||||
{
|
||||
typedef std::pair<LLViewerVisualParamInfo*,BOOL> morph_info_pair_t; // LLPolyMorphTargetInfo stored here
|
||||
typedef std::vector<morph_info_pair_t> morph_info_list_t;
|
||||
|
||||
LLAvatarMeshInfo() : mLOD(0), mMinPixelArea(.1f) {}
|
||||
~LLAvatarMeshInfo()
|
||||
{
|
||||
morph_info_list_t::iterator iter;
|
||||
for (iter = mPolyMorphTargetInfoList.begin(); iter != mPolyMorphTargetInfoList.end(); iter++)
|
||||
{
|
||||
delete iter->first;
|
||||
}
|
||||
mPolyMorphTargetInfoList.clear();
|
||||
}
|
||||
|
||||
std::string mType;
|
||||
S32 mLOD;
|
||||
std::string mMeshFileName;
|
||||
std::string mReferenceMeshName;
|
||||
F32 mMinPixelArea;
|
||||
morph_info_list_t mPolyMorphTargetInfoList;
|
||||
};
|
||||
typedef std::vector<LLAvatarMeshInfo*> mesh_info_list_t;
|
||||
mesh_info_list_t mMeshInfoList;
|
||||
|
||||
typedef std::vector<LLViewerVisualParamInfo*> skeletal_distortion_info_list_t; // LLPolySkeletalDistortionInfo stored here
|
||||
skeletal_distortion_info_list_t mSkeletalDistortionInfoList;
|
||||
|
||||
struct LLAvatarAttachmentInfo
|
||||
{
|
||||
LLAvatarAttachmentInfo()
|
||||
: mGroup(-1), mAttachmentID(-1), mPieMenuSlice(-1), mVisibleFirstPerson(FALSE),
|
||||
mIsHUDAttachment(FALSE), mHasPosition(FALSE), mHasRotation(FALSE) {}
|
||||
std::string mName;
|
||||
std::string mJointName;
|
||||
LLVector3 mPosition;
|
||||
LLVector3 mRotationEuler;
|
||||
S32 mGroup;
|
||||
S32 mAttachmentID;
|
||||
S32 mPieMenuSlice;
|
||||
BOOL mVisibleFirstPerson;
|
||||
BOOL mIsHUDAttachment;
|
||||
BOOL mHasPosition;
|
||||
BOOL mHasRotation;
|
||||
};
|
||||
typedef std::vector<LLAvatarAttachmentInfo*> attachment_info_list_t;
|
||||
attachment_info_list_t mAttachmentInfoList;
|
||||
|
||||
LLTexGlobalColorInfo *mTexSkinColorInfo;
|
||||
LLTexGlobalColorInfo *mTexHairColorInfo;
|
||||
LLTexGlobalColorInfo *mTexEyeColorInfo;
|
||||
|
||||
typedef std::vector<LLTexLayerSetInfo*> layer_info_list_t;
|
||||
layer_info_list_t mLayerInfoList;
|
||||
|
||||
typedef std::vector<LLDriverParamInfo*> driver_info_list_t;
|
||||
driver_info_list_t mDriverInfoList;
|
||||
|
||||
struct LLAvatarMorphInfo
|
||||
{
|
||||
LLAvatarMorphInfo()
|
||||
: mInvert(FALSE) {}
|
||||
std::string mName;
|
||||
std::string mRegion;
|
||||
std::string mLayer;
|
||||
BOOL mInvert;
|
||||
};
|
||||
|
||||
typedef std::vector<LLAvatarMorphInfo*> morph_info_list_t;
|
||||
morph_info_list_t mMorphMaskInfoList;
|
||||
};
|
||||
|
||||
|
||||
class LLMaskedMorph
|
||||
{
|
||||
public:
|
||||
LLMaskedMorph(LLVisualParam *morph_target, BOOL invert, std::string layer);
|
||||
|
||||
LLVisualParam *mMorphTarget;
|
||||
BOOL mInvert;
|
||||
std::string mLayer;
|
||||
};
|
||||
/** Support Classes
|
||||
** **
|
||||
*******************************************************************************/
|
||||
};
|
||||
|
||||
#endif // LL_AVATAR_APPEARANCE_H
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* @file llvoavatar.cpp
|
||||
* @brief Implementation of LLVOAvatar class which is a derivation fo LLViewerObject
|
||||
* @file llavatarappearancedefines.cpp
|
||||
* @brief Implementation of LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
|
|
@ -24,21 +24,20 @@
|
|||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
#include "llvoavatardefines.h"
|
||||
#include "llviewercontrol.h" // gSavedSettings
|
||||
#include "linden_common.h"
|
||||
#include "llavatarappearancedefines.h"
|
||||
|
||||
const S32 LLVOAvatarDefines::SCRATCH_TEX_WIDTH = 512;
|
||||
const S32 LLVOAvatarDefines::SCRATCH_TEX_HEIGHT = 512;
|
||||
const S32 LLVOAvatarDefines::IMPOSTOR_PERIOD = 2;
|
||||
const S32 LLAvatarAppearanceDefines::SCRATCH_TEX_WIDTH = 512;
|
||||
const S32 LLAvatarAppearanceDefines::SCRATCH_TEX_HEIGHT = 512;
|
||||
const S32 LLAvatarAppearanceDefines::IMPOSTOR_PERIOD = 2;
|
||||
|
||||
using namespace LLVOAvatarDefines;
|
||||
using namespace LLAvatarAppearanceDefines;
|
||||
|
||||
/*********************************************************************************
|
||||
* Edit this function to add/remove/change textures and mesh definitions for avatars.
|
||||
*/
|
||||
|
||||
LLVOAvatarDictionary::Textures::Textures()
|
||||
LLAvatarAppearanceDictionary::Textures::Textures()
|
||||
{
|
||||
addEntry(TEX_HEAD_BODYPAINT, new TextureEntry("head_bodypaint", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_SKIN));
|
||||
addEntry(TEX_UPPER_SHIRT, new TextureEntry("upper_shirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultShirtUUID", LLWearableType::WT_SHIRT));
|
||||
|
|
@ -66,15 +65,15 @@ LLVOAvatarDictionary::Textures::Textures()
|
|||
addEntry(TEX_UPPER_TATTOO, new TextureEntry("upper_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_TATTOO));
|
||||
addEntry(TEX_LOWER_TATTOO, new TextureEntry("lower_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_TATTOO));
|
||||
|
||||
addEntry(TEX_HEAD_BAKED, new TextureEntry("head-baked", FALSE, BAKED_HEAD));
|
||||
addEntry(TEX_UPPER_BAKED, new TextureEntry("upper-baked", FALSE, BAKED_UPPER));
|
||||
addEntry(TEX_LOWER_BAKED, new TextureEntry("lower-baked", FALSE, BAKED_LOWER));
|
||||
addEntry(TEX_EYES_BAKED, new TextureEntry("eyes-baked", FALSE, BAKED_EYES));
|
||||
addEntry(TEX_HAIR_BAKED, new TextureEntry("hair-baked", FALSE, BAKED_HAIR));
|
||||
addEntry(TEX_SKIRT_BAKED, new TextureEntry("skirt-baked", FALSE, BAKED_SKIRT));
|
||||
addEntry(TEX_HEAD_BAKED, new TextureEntry("head-baked", FALSE, BAKED_HEAD, "head"));
|
||||
addEntry(TEX_UPPER_BAKED, new TextureEntry("upper-baked", FALSE, BAKED_UPPER, "upper"));
|
||||
addEntry(TEX_LOWER_BAKED, new TextureEntry("lower-baked", FALSE, BAKED_LOWER, "lower"));
|
||||
addEntry(TEX_EYES_BAKED, new TextureEntry("eyes-baked", FALSE, BAKED_EYES, "eyes"));
|
||||
addEntry(TEX_HAIR_BAKED, new TextureEntry("hair-baked", FALSE, BAKED_HAIR, "hair"));
|
||||
addEntry(TEX_SKIRT_BAKED, new TextureEntry("skirt-baked", FALSE, BAKED_SKIRT, "skirt"));
|
||||
}
|
||||
|
||||
LLVOAvatarDictionary::BakedTextures::BakedTextures()
|
||||
LLAvatarAppearanceDictionary::BakedTextures::BakedTextures()
|
||||
{
|
||||
// Baked textures
|
||||
addEntry(BAKED_HEAD, new BakedEntry(TEX_HEAD_BAKED,
|
||||
|
|
@ -110,36 +109,36 @@ LLVOAvatarDictionary::BakedTextures::BakedTextures()
|
|||
2, LLWearableType::WT_HAIR, LLWearableType::WT_ALPHA));
|
||||
}
|
||||
|
||||
LLVOAvatarDictionary::Meshes::Meshes()
|
||||
LLAvatarAppearanceDictionary::MeshEntries::MeshEntries()
|
||||
{
|
||||
// Meshes
|
||||
addEntry(MESH_ID_HAIR, new MeshEntry(BAKED_HAIR, "hairMesh", 6, LLViewerJoint::PN_4));
|
||||
addEntry(MESH_ID_HEAD, new MeshEntry(BAKED_HEAD, "headMesh", 5, LLViewerJoint::PN_5));
|
||||
addEntry(MESH_ID_EYELASH, new MeshEntry(BAKED_HEAD, "eyelashMesh", 1, LLViewerJoint::PN_0)); // no baked mesh associated currently
|
||||
addEntry(MESH_ID_UPPER_BODY, new MeshEntry(BAKED_UPPER, "upperBodyMesh", 5, LLViewerJoint::PN_1));
|
||||
addEntry(MESH_ID_LOWER_BODY, new MeshEntry(BAKED_LOWER, "lowerBodyMesh", 5, LLViewerJoint::PN_2));
|
||||
addEntry(MESH_ID_EYEBALL_LEFT, new MeshEntry(BAKED_EYES, "eyeBallLeftMesh", 2, LLViewerJoint::PN_3));
|
||||
addEntry(MESH_ID_EYEBALL_RIGHT, new MeshEntry(BAKED_EYES, "eyeBallRightMesh", 2, LLViewerJoint::PN_3));
|
||||
addEntry(MESH_ID_SKIRT, new MeshEntry(BAKED_SKIRT, "skirtMesh", 5, LLViewerJoint::PN_5));
|
||||
// MeshEntries
|
||||
addEntry(MESH_ID_HAIR, new MeshEntry(BAKED_HAIR, "hairMesh", 6, PN_4));
|
||||
addEntry(MESH_ID_HEAD, new MeshEntry(BAKED_HEAD, "headMesh", 5, PN_5));
|
||||
addEntry(MESH_ID_EYELASH, new MeshEntry(BAKED_HEAD, "eyelashMesh", 1, PN_0)); // no baked mesh associated currently
|
||||
addEntry(MESH_ID_UPPER_BODY, new MeshEntry(BAKED_UPPER, "upperBodyMesh", 5, PN_1));
|
||||
addEntry(MESH_ID_LOWER_BODY, new MeshEntry(BAKED_LOWER, "lowerBodyMesh", 5, PN_2));
|
||||
addEntry(MESH_ID_EYEBALL_LEFT, new MeshEntry(BAKED_EYES, "eyeBallLeftMesh", 2, PN_3));
|
||||
addEntry(MESH_ID_EYEBALL_RIGHT, new MeshEntry(BAKED_EYES, "eyeBallRightMesh", 2, PN_3));
|
||||
addEntry(MESH_ID_SKIRT, new MeshEntry(BAKED_SKIRT, "skirtMesh", 5, PN_5));
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*********************************************************************************/
|
||||
|
||||
LLVOAvatarDictionary::LLVOAvatarDictionary()
|
||||
LLAvatarAppearanceDictionary::LLAvatarAppearanceDictionary()
|
||||
{
|
||||
createAssociations();
|
||||
}
|
||||
|
||||
//virtual
|
||||
LLVOAvatarDictionary::~LLVOAvatarDictionary()
|
||||
LLAvatarAppearanceDictionary::~LLAvatarAppearanceDictionary()
|
||||
{
|
||||
}
|
||||
|
||||
// Baked textures are composites of textures; for each such composited texture,
|
||||
// map it to the baked texture.
|
||||
void LLVOAvatarDictionary::createAssociations()
|
||||
void LLAvatarAppearanceDictionary::createAssociations()
|
||||
{
|
||||
for (BakedTextures::const_iterator iter = mBakedTextures.begin(); iter != mBakedTextures.end(); iter++)
|
||||
{
|
||||
|
|
@ -160,7 +159,7 @@ void LLVOAvatarDictionary::createAssociations()
|
|||
|
||||
}
|
||||
|
||||
LLVOAvatarDictionary::TextureEntry::TextureEntry(const std::string &name,
|
||||
LLAvatarAppearanceDictionary::TextureEntry::TextureEntry(const std::string &name,
|
||||
bool is_local_texture,
|
||||
EBakedTextureIndex baked_texture_index,
|
||||
const std::string &default_image_name,
|
||||
|
|
@ -175,17 +174,17 @@ LLVOAvatarDictionary::TextureEntry::TextureEntry(const std::string &name,
|
|||
{
|
||||
}
|
||||
|
||||
LLVOAvatarDictionary::MeshEntry::MeshEntry(EBakedTextureIndex baked_index,
|
||||
LLAvatarAppearanceDictionary::MeshEntry::MeshEntry(EBakedTextureIndex baked_index,
|
||||
const std::string &name,
|
||||
U8 level,
|
||||
LLViewerJoint::PickName pick) :
|
||||
LLJointPickName pick) :
|
||||
LLDictionaryEntry(name),
|
||||
mBakedID(baked_index),
|
||||
mLOD(level),
|
||||
mPickName(pick)
|
||||
{
|
||||
}
|
||||
LLVOAvatarDictionary::BakedEntry::BakedEntry(ETextureIndex tex_index,
|
||||
LLAvatarAppearanceDictionary::BakedEntry::BakedEntry(ETextureIndex tex_index,
|
||||
const std::string &name,
|
||||
const std::string &hash_name,
|
||||
U32 num_local_textures,
|
||||
|
|
@ -216,18 +215,18 @@ LLVOAvatarDictionary::BakedEntry::BakedEntry(ETextureIndex tex_index,
|
|||
}
|
||||
|
||||
// static
|
||||
ETextureIndex LLVOAvatarDictionary::bakedToLocalTextureIndex(EBakedTextureIndex index)
|
||||
ETextureIndex LLAvatarAppearanceDictionary::bakedToLocalTextureIndex(EBakedTextureIndex index)
|
||||
{
|
||||
return LLVOAvatarDictionary::getInstance()->getBakedTexture(index)->mTextureIndex;
|
||||
return LLAvatarAppearanceDictionary::getInstance()->getBakedTexture(index)->mTextureIndex;
|
||||
}
|
||||
|
||||
//static
|
||||
EBakedTextureIndex LLVOAvatarDictionary::findBakedByRegionName(std::string name)
|
||||
// static
|
||||
EBakedTextureIndex LLAvatarAppearanceDictionary::findBakedByRegionName(std::string name)
|
||||
{
|
||||
U8 index = 0;
|
||||
while (index < BAKED_NUM_INDICES)
|
||||
{
|
||||
const BakedEntry *be = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex) index);
|
||||
const BakedEntry *be = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex) index);
|
||||
if (be && be->mName.compare(name) == 0)
|
||||
{
|
||||
// baked texture found
|
||||
|
|
@ -239,23 +238,30 @@ EBakedTextureIndex LLVOAvatarDictionary::findBakedByRegionName(std::string name)
|
|||
return BAKED_NUM_INDICES;
|
||||
}
|
||||
|
||||
//static
|
||||
const LLUUID LLVOAvatarDictionary::getDefaultTextureImageID(ETextureIndex index)
|
||||
// static
|
||||
EBakedTextureIndex LLAvatarAppearanceDictionary::findBakedByImageName(std::string name)
|
||||
{
|
||||
const TextureEntry *texture_dict = getInstance()->getTexture(index);
|
||||
const std::string &default_image_name = texture_dict->mDefaultImageName;
|
||||
if (default_image_name == "")
|
||||
U8 index = 0;
|
||||
while (index < BAKED_NUM_INDICES)
|
||||
{
|
||||
return IMG_DEFAULT_AVATAR;
|
||||
}
|
||||
else
|
||||
{
|
||||
return LLUUID(gSavedSettings.getString(default_image_name));
|
||||
const BakedEntry *be = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex) index);
|
||||
if (be)
|
||||
{
|
||||
const TextureEntry *te = LLAvatarAppearanceDictionary::getInstance()->getTexture(be->mTextureIndex);
|
||||
if (te && te->mDefaultImageName.compare(name) == 0)
|
||||
{
|
||||
// baked texture found
|
||||
return (EBakedTextureIndex) index;
|
||||
}
|
||||
}
|
||||
index++;
|
||||
}
|
||||
// baked texture could not be found
|
||||
return BAKED_NUM_INDICES;
|
||||
}
|
||||
|
||||
// static
|
||||
LLWearableType::EType LLVOAvatarDictionary::getTEWearableType(ETextureIndex index )
|
||||
LLWearableType::EType LLAvatarAppearanceDictionary::getTEWearableType(ETextureIndex index )
|
||||
{
|
||||
return getInstance()->getTexture(index)->mWearableType;
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* @file llvoavatar.h
|
||||
* @brief Declaration of LLVOAvatar class which is a derivation fo
|
||||
* @file llavatarappearancedefines.h
|
||||
* @brief Various LLAvatarAppearance related definitions
|
||||
* LLViewerObject
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||
|
|
@ -25,26 +25,30 @@
|
|||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#ifndef LLVOAVATAR_DEFINES_H
|
||||
#define LLVOAVATAR_DEFINES_H
|
||||
#ifndef LL_AVATARAPPEARANCE_DEFINES_H
|
||||
#define LL_AVATARAPPEARANCE_DEFINES_H
|
||||
|
||||
#include <vector>
|
||||
#include "llwearable.h"
|
||||
#include "llviewerjoint.h"
|
||||
#include "lljointpickname.h"
|
||||
#include "lldictionary.h"
|
||||
#include "llwearabletype.h"
|
||||
#include "lluuid.h"
|
||||
|
||||
namespace LLVOAvatarDefines
|
||||
namespace LLAvatarAppearanceDefines
|
||||
{
|
||||
|
||||
extern const S32 SCRATCH_TEX_WIDTH;
|
||||
extern const S32 SCRATCH_TEX_HEIGHT;
|
||||
extern const S32 IMPOSTOR_PERIOD;
|
||||
|
||||
static const U32 AVATAR_HOVER = 11001;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Enums
|
||||
//--------------------------------------------------------------------
|
||||
enum ETextureIndex
|
||||
{
|
||||
TEX_INVALID = -1,
|
||||
TEX_HEAD_BODYPAINT = 0,
|
||||
TEX_UPPER_SHIRT,
|
||||
TEX_LOWER_PANTS,
|
||||
|
|
@ -111,21 +115,21 @@ typedef std::vector<EMeshIndex> mesh_vec_t;
|
|||
typedef std::vector<LLWearableType::EType> wearables_vec_t;
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// LLVOAvatarDictionary
|
||||
// LLAvatarAppearanceDictionary
|
||||
//
|
||||
// Holds dictionary static entries for textures, baked textures, meshes, etc.; i.e.
|
||||
// information that is common to all avatars.
|
||||
//
|
||||
// This holds const data - it is initialized once and the contents never change after that.
|
||||
//------------------------------------------------------------------------
|
||||
class LLVOAvatarDictionary : public LLSingleton<LLVOAvatarDictionary>
|
||||
class LLAvatarAppearanceDictionary : public LLSingleton<LLAvatarAppearanceDictionary>
|
||||
{
|
||||
//--------------------------------------------------------------------
|
||||
// Constructors and Destructors
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
LLVOAvatarDictionary();
|
||||
virtual ~LLVOAvatarDictionary();
|
||||
LLAvatarAppearanceDictionary();
|
||||
virtual ~LLAvatarAppearanceDictionary();
|
||||
private:
|
||||
void createAssociations();
|
||||
|
||||
|
|
@ -166,20 +170,20 @@ public:
|
|||
MeshEntry(EBakedTextureIndex baked_index,
|
||||
const std::string &name, // names of mesh types as they are used in avatar_lad.xml
|
||||
U8 level,
|
||||
LLViewerJoint::PickName pick);
|
||||
LLJointPickName pick);
|
||||
// Levels of Detail for each mesh. Must match levels of detail present in avatar_lad.xml
|
||||
// Otherwise meshes will be unable to be found, or levels of detail will be ignored
|
||||
const U8 mLOD;
|
||||
const EBakedTextureIndex mBakedID;
|
||||
const LLViewerJoint::PickName mPickName;
|
||||
const LLJointPickName mPickName;
|
||||
};
|
||||
|
||||
struct Meshes : public LLDictionary<EMeshIndex, MeshEntry>
|
||||
struct MeshEntries : public LLDictionary<EMeshIndex, MeshEntry>
|
||||
{
|
||||
Meshes();
|
||||
} mMeshes;
|
||||
const MeshEntry* getMesh(EMeshIndex index) const { return mMeshes.lookup(index); }
|
||||
const Meshes& getMeshes() const { return mMeshes; }
|
||||
MeshEntries();
|
||||
} mMeshEntries;
|
||||
const MeshEntry* getMeshEntry(EMeshIndex index) const { return mMeshEntries.lookup(index); }
|
||||
const MeshEntries& getMeshEntries() const { return mMeshEntries; }
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Baked Textures
|
||||
|
|
@ -215,14 +219,13 @@ public:
|
|||
|
||||
// find a baked texture index based on its name
|
||||
static EBakedTextureIndex findBakedByRegionName(std::string name);
|
||||
|
||||
static const LLUUID getDefaultTextureImageID(ETextureIndex index);
|
||||
static EBakedTextureIndex findBakedByImageName(std::string name);
|
||||
|
||||
// Given a texture entry, determine which wearable type owns it.
|
||||
static LLWearableType::EType getTEWearableType(ETextureIndex index);
|
||||
|
||||
}; // End LLVOAvatarDictionary
|
||||
}; // End LLAvatarAppearanceDictionary
|
||||
|
||||
} // End namespace LLVOAvatarDefines
|
||||
} // End namespace LLAvatarAppearanceDefines
|
||||
|
||||
#endif //LL_VO_AVATARDEFINES_H
|
||||
#endif //LL_AVATARAPPEARANCE_DEFINES_H
|
||||
|
|
@ -0,0 +1,326 @@
|
|||
/**
|
||||
* @file llavatarjoint.cpp
|
||||
* @brief Implementation of LLAvatarJoint class
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Header Files
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "llavatarjoint.h"
|
||||
|
||||
#include "llgl.h"
|
||||
#include "llrender.h"
|
||||
#include "llmath.h"
|
||||
#include "llglheaders.h"
|
||||
#include "llavatarappearance.h"
|
||||
|
||||
const F32 DEFAULT_AVATAR_JOINT_LOD = 0.0f;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Static Data
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL LLAvatarJoint::sDisableLOD = FALSE;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLAvatarJoint()
|
||||
// Class Constructors
|
||||
//-----------------------------------------------------------------------------
|
||||
LLAvatarJoint::LLAvatarJoint() :
|
||||
LLJoint()
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
LLAvatarJoint::LLAvatarJoint(const std::string &name, LLJoint *parent) :
|
||||
LLJoint(name, parent)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
LLAvatarJoint::LLAvatarJoint(S32 joint_num) :
|
||||
LLJoint(joint_num)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
void LLAvatarJoint::init()
|
||||
{
|
||||
mValid = FALSE;
|
||||
mComponents = SC_JOINT | SC_BONE | SC_AXES;
|
||||
mMinPixelArea = DEFAULT_AVATAR_JOINT_LOD;
|
||||
mPickName = PN_DEFAULT;
|
||||
mVisible = TRUE;
|
||||
mMeshID = 0;
|
||||
mIsTransparent = FALSE;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// ~LLAvatarJoint()
|
||||
// Class Destructor
|
||||
//-----------------------------------------------------------------------------
|
||||
LLAvatarJoint::~LLAvatarJoint()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// setValid()
|
||||
//--------------------------------------------------------------------
|
||||
void LLAvatarJoint::setValid( BOOL valid, BOOL recursive )
|
||||
{
|
||||
//----------------------------------------------------------------
|
||||
// set visibility for this joint
|
||||
//----------------------------------------------------------------
|
||||
mValid = valid;
|
||||
|
||||
//----------------------------------------------------------------
|
||||
// set visibility for children
|
||||
//----------------------------------------------------------------
|
||||
if (recursive)
|
||||
{
|
||||
for (child_list_t::iterator iter = mChildren.begin();
|
||||
iter != mChildren.end(); ++iter)
|
||||
{
|
||||
LLAvatarJoint* joint = (LLAvatarJoint*)(*iter);
|
||||
joint->setValid(valid, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// setSkeletonComponents()
|
||||
//--------------------------------------------------------------------
|
||||
void LLAvatarJoint::setSkeletonComponents( U32 comp, BOOL recursive )
|
||||
{
|
||||
mComponents = comp;
|
||||
if (recursive)
|
||||
{
|
||||
for (child_list_t::iterator iter = mChildren.begin();
|
||||
iter != mChildren.end(); ++iter)
|
||||
{
|
||||
LLAvatarJoint* joint = dynamic_cast<LLAvatarJoint*>(*iter);
|
||||
joint->setSkeletonComponents(comp, recursive);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLAvatarJoint::setVisible(BOOL visible, BOOL recursive)
|
||||
{
|
||||
mVisible = visible;
|
||||
|
||||
if (recursive)
|
||||
{
|
||||
for (child_list_t::iterator iter = mChildren.begin();
|
||||
iter != mChildren.end(); ++iter)
|
||||
{
|
||||
LLAvatarJoint* joint = (LLAvatarJoint*)(*iter);
|
||||
joint->setVisible(visible, recursive);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLAvatarJoint::updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area)
|
||||
{
|
||||
for (child_list_t::iterator iter = mChildren.begin();
|
||||
iter != mChildren.end(); ++iter)
|
||||
{
|
||||
LLAvatarJoint* joint = dynamic_cast<LLAvatarJoint*>(*iter);
|
||||
joint->updateFaceSizes(num_vertices, num_indices, pixel_area);
|
||||
}
|
||||
}
|
||||
|
||||
void LLAvatarJoint::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind, bool terse_update)
|
||||
{
|
||||
for (child_list_t::iterator iter = mChildren.begin();
|
||||
iter != mChildren.end(); ++iter)
|
||||
{
|
||||
LLAvatarJoint* joint = dynamic_cast<LLAvatarJoint*>(*iter);
|
||||
joint->updateFaceData(face, pixel_area, damp_wind, terse_update);
|
||||
}
|
||||
}
|
||||
|
||||
void LLAvatarJoint::updateJointGeometry()
|
||||
{
|
||||
for (child_list_t::iterator iter = mChildren.begin();
|
||||
iter != mChildren.end(); ++iter)
|
||||
{
|
||||
LLAvatarJoint* joint = dynamic_cast<LLAvatarJoint*>(*iter);
|
||||
joint->updateJointGeometry();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BOOL LLAvatarJoint::updateLOD(F32 pixel_area, BOOL activate)
|
||||
{
|
||||
BOOL lod_changed = FALSE;
|
||||
BOOL found_lod = FALSE;
|
||||
|
||||
for (child_list_t::iterator iter = mChildren.begin();
|
||||
iter != mChildren.end(); ++iter)
|
||||
{
|
||||
LLAvatarJoint* joint = dynamic_cast<LLAvatarJoint*>(*iter);
|
||||
F32 jointLOD = joint->getLOD();
|
||||
|
||||
if (found_lod || jointLOD == DEFAULT_AVATAR_JOINT_LOD)
|
||||
{
|
||||
// we've already found a joint to enable, so enable the rest as alternatives
|
||||
lod_changed |= joint->updateLOD(pixel_area, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pixel_area >= jointLOD || sDisableLOD)
|
||||
{
|
||||
lod_changed |= joint->updateLOD(pixel_area, TRUE);
|
||||
found_lod = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
lod_changed |= joint->updateLOD(pixel_area, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
return lod_changed;
|
||||
}
|
||||
|
||||
void LLAvatarJoint::dump()
|
||||
{
|
||||
for (child_list_t::iterator iter = mChildren.begin();
|
||||
iter != mChildren.end(); ++iter)
|
||||
{
|
||||
LLAvatarJoint* joint = dynamic_cast<LLAvatarJoint*>(*iter);
|
||||
joint->dump();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LLAvatarJoint::setMeshesToChildren()
|
||||
{
|
||||
removeAllChildren();
|
||||
for (avatar_joint_mesh_list_t::iterator iter = mMeshParts.begin();
|
||||
iter != mMeshParts.end(); iter++)
|
||||
{
|
||||
addChild((*iter));
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLAvatarJointCollisionVolume()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
LLAvatarJointCollisionVolume::LLAvatarJointCollisionVolume()
|
||||
{
|
||||
mUpdateXform = FALSE;
|
||||
}
|
||||
|
||||
/*virtual*/
|
||||
U32 LLAvatarJointCollisionVolume::render( F32 pixelArea, BOOL first_pass, BOOL is_dummy )
|
||||
{
|
||||
llerrs << "Cannot call render() on LLAvatarJointCollisionVolume" << llendl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
LLVector3 LLAvatarJointCollisionVolume::getVolumePos(LLVector3 &offset)
|
||||
{
|
||||
mUpdateXform = TRUE;
|
||||
|
||||
LLVector3 result = offset;
|
||||
result.scaleVec(getScale());
|
||||
result.rotVec(getWorldRotation());
|
||||
result += getWorldPosition();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void LLAvatarJointCollisionVolume::renderCollision()
|
||||
{
|
||||
updateWorldMatrix();
|
||||
|
||||
gGL.pushMatrix();
|
||||
gGL.multMatrix( &mXform.getWorldMatrix().mMatrix[0][0] );
|
||||
|
||||
gGL.diffuseColor3f( 0.f, 0.f, 1.f );
|
||||
|
||||
gGL.begin(LLRender::LINES);
|
||||
|
||||
LLVector3 v[] =
|
||||
{
|
||||
LLVector3(1,0,0),
|
||||
LLVector3(-1,0,0),
|
||||
LLVector3(0,1,0),
|
||||
LLVector3(0,-1,0),
|
||||
|
||||
LLVector3(0,0,-1),
|
||||
LLVector3(0,0,1),
|
||||
};
|
||||
|
||||
//sides
|
||||
gGL.vertex3fv(v[0].mV);
|
||||
gGL.vertex3fv(v[2].mV);
|
||||
|
||||
gGL.vertex3fv(v[0].mV);
|
||||
gGL.vertex3fv(v[3].mV);
|
||||
|
||||
gGL.vertex3fv(v[1].mV);
|
||||
gGL.vertex3fv(v[2].mV);
|
||||
|
||||
gGL.vertex3fv(v[1].mV);
|
||||
gGL.vertex3fv(v[3].mV);
|
||||
|
||||
|
||||
//top
|
||||
gGL.vertex3fv(v[0].mV);
|
||||
gGL.vertex3fv(v[4].mV);
|
||||
|
||||
gGL.vertex3fv(v[1].mV);
|
||||
gGL.vertex3fv(v[4].mV);
|
||||
|
||||
gGL.vertex3fv(v[2].mV);
|
||||
gGL.vertex3fv(v[4].mV);
|
||||
|
||||
gGL.vertex3fv(v[3].mV);
|
||||
gGL.vertex3fv(v[4].mV);
|
||||
|
||||
|
||||
//bottom
|
||||
gGL.vertex3fv(v[0].mV);
|
||||
gGL.vertex3fv(v[5].mV);
|
||||
|
||||
gGL.vertex3fv(v[1].mV);
|
||||
gGL.vertex3fv(v[5].mV);
|
||||
|
||||
gGL.vertex3fv(v[2].mV);
|
||||
gGL.vertex3fv(v[5].mV);
|
||||
|
||||
gGL.vertex3fv(v[3].mV);
|
||||
gGL.vertex3fv(v[5].mV);
|
||||
|
||||
gGL.end();
|
||||
|
||||
gGL.popMatrix();
|
||||
}
|
||||
|
||||
|
||||
// End
|
||||
|
|
@ -0,0 +1,140 @@
|
|||
/**
|
||||
* @file llavatarjoint.h
|
||||
* @brief Implementation of LLAvatarJoint class
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#ifndef LL_LLAVATARJOINT_H
|
||||
#define LL_LLAVATARJOINT_H
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Header Files
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "lljoint.h"
|
||||
#include "lljointpickname.h"
|
||||
|
||||
class LLFace;
|
||||
class LLAvatarJointMesh;
|
||||
|
||||
extern const F32 DEFAULT_AVATAR_JOINT_LOD;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// class LLViewerJoint
|
||||
//-----------------------------------------------------------------------------
|
||||
class LLAvatarJoint :
|
||||
public LLJoint
|
||||
{
|
||||
public:
|
||||
LLAvatarJoint();
|
||||
LLAvatarJoint(S32 joint_num);
|
||||
// *TODO: Only used for LLVOAvatarSelf::mScreenp. *DOES NOT INITIALIZE mResetAfterRestoreOldXform*
|
||||
LLAvatarJoint(const std::string &name, LLJoint *parent = NULL);
|
||||
virtual ~LLAvatarJoint();
|
||||
|
||||
// Gets the validity of this joint
|
||||
BOOL getValid() { return mValid; }
|
||||
|
||||
// Sets the validity of this joint
|
||||
virtual void setValid( BOOL valid, BOOL recursive=FALSE );
|
||||
|
||||
// Returns true if this object is transparent.
|
||||
// This is used to determine in which order to draw objects.
|
||||
virtual BOOL isTransparent() { return mIsTransparent; }
|
||||
|
||||
// Returns true if this object should inherit scale modifiers from its immediate parent
|
||||
virtual BOOL inheritScale() { return FALSE; }
|
||||
|
||||
enum Components
|
||||
{
|
||||
SC_BONE = 1,
|
||||
SC_JOINT = 2,
|
||||
SC_AXES = 4
|
||||
};
|
||||
|
||||
// Selects which skeleton components to draw
|
||||
void setSkeletonComponents( U32 comp, BOOL recursive = TRUE );
|
||||
|
||||
// Returns which skeleton components are enables for drawing
|
||||
U32 getSkeletonComponents() { return mComponents; }
|
||||
|
||||
// Sets the level of detail for this node as a minimum
|
||||
// pixel area threshold. If the current pixel area for this
|
||||
// object is less than the specified threshold, the node is
|
||||
// not traversed. In addition, if a value is specified (not
|
||||
// default of 0.0), and the pixel area is larger than the
|
||||
// specified minimum, the node is rendered, but no other siblings
|
||||
// of this node under the same parent will be.
|
||||
F32 getLOD() { return mMinPixelArea; }
|
||||
void setLOD( F32 pixelArea ) { mMinPixelArea = pixelArea; }
|
||||
|
||||
void setPickName(LLJointPickName name) { mPickName = name; }
|
||||
LLJointPickName getPickName() { return mPickName; }
|
||||
|
||||
void setVisible( BOOL visible, BOOL recursive );
|
||||
|
||||
// Takes meshes in mMeshParts and sets each one as a child joint
|
||||
void setMeshesToChildren();
|
||||
|
||||
// LLViewerJoint interface
|
||||
virtual U32 render( F32 pixelArea, BOOL first_pass = TRUE, BOOL is_dummy = FALSE ) = 0;
|
||||
virtual void updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area);
|
||||
virtual void updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind = FALSE, bool terse_update = false);
|
||||
virtual BOOL updateLOD(F32 pixel_area, BOOL activate);
|
||||
virtual void updateJointGeometry();
|
||||
virtual void dump();
|
||||
|
||||
|
||||
public:
|
||||
static BOOL sDisableLOD;
|
||||
avatar_joint_mesh_list_t mMeshParts; //LLViewerJointMesh*
|
||||
void setMeshID( S32 id ) {mMeshID = id;}
|
||||
|
||||
protected:
|
||||
void init();
|
||||
|
||||
BOOL mValid;
|
||||
BOOL mIsTransparent;
|
||||
U32 mComponents;
|
||||
F32 mMinPixelArea;
|
||||
LLJointPickName mPickName;
|
||||
BOOL mVisible;
|
||||
S32 mMeshID;
|
||||
};
|
||||
|
||||
class LLAvatarJointCollisionVolume : public LLAvatarJoint
|
||||
{
|
||||
public:
|
||||
LLAvatarJointCollisionVolume();
|
||||
virtual ~LLAvatarJointCollisionVolume() {};
|
||||
|
||||
/*virtual*/ BOOL inheritScale() { return TRUE; }
|
||||
/*virtual*/ U32 render( F32 pixelArea, BOOL first_pass = TRUE, BOOL is_dummy = FALSE );
|
||||
|
||||
void renderCollision();
|
||||
|
||||
LLVector3 getVolumePos(LLVector3 &offset);
|
||||
};
|
||||
|
||||
#endif // LL_LLAVATARJOINT_H
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,375 @@
|
|||
/**
|
||||
* @file LLAvatarJointMesh.cpp
|
||||
* @brief Implementation of LLAvatarJointMesh class
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Header Files
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "linden_common.h"
|
||||
#include "imageids.h"
|
||||
#include "llfasttimer.h"
|
||||
#include "llrender.h"
|
||||
|
||||
#include "llavatarjointmesh.h"
|
||||
#include "llavatarappearance.h"
|
||||
//#include "llapr.h"
|
||||
//#include "llbox.h"
|
||||
//#include "lldrawable.h"
|
||||
//#include "lldrawpoolavatar.h"
|
||||
//#include "lldrawpoolbump.h"
|
||||
//#include "lldynamictexture.h"
|
||||
//#include "llface.h"
|
||||
//#include "llgldbg.h"
|
||||
//#include "llglheaders.h"
|
||||
#include "lltexlayer.h"
|
||||
//#include "llviewercamera.h"
|
||||
//#include "llviewercontrol.h"
|
||||
//#include "llviewertexturelist.h"
|
||||
//#include "llsky.h"
|
||||
//#include "pipeline.h"
|
||||
//#include "llviewershadermgr.h"
|
||||
#include "llmath.h"
|
||||
#include "v4math.h"
|
||||
#include "m3math.h"
|
||||
#include "m4math.h"
|
||||
#include "llmatrix4a.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLAvatarJointMesh::LLSkinJoint
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLSkinJoint
|
||||
//-----------------------------------------------------------------------------
|
||||
LLSkinJoint::LLSkinJoint()
|
||||
{
|
||||
mJoint = NULL;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// ~LLSkinJoint
|
||||
//-----------------------------------------------------------------------------
|
||||
LLSkinJoint::~LLSkinJoint()
|
||||
{
|
||||
mJoint = NULL;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLSkinJoint::setupSkinJoint()
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL LLSkinJoint::setupSkinJoint( LLAvatarJoint *joint)
|
||||
{
|
||||
// find the named joint
|
||||
mJoint = joint;
|
||||
if ( !mJoint )
|
||||
{
|
||||
llinfos << "Can't find joint" << llendl;
|
||||
}
|
||||
|
||||
// compute the inverse root skin matrix
|
||||
mRootToJointSkinOffset.clearVec();
|
||||
|
||||
LLVector3 rootSkinOffset;
|
||||
while (joint)
|
||||
{
|
||||
rootSkinOffset += joint->getSkinOffset();
|
||||
joint = (LLAvatarJoint*)joint->getParent();
|
||||
}
|
||||
|
||||
mRootToJointSkinOffset = -rootSkinOffset;
|
||||
mRootToParentJointSkinOffset = mRootToJointSkinOffset;
|
||||
mRootToParentJointSkinOffset += mJoint->getSkinOffset();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLAvatarJointMesh
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
BOOL LLAvatarJointMesh::sPipelineRender = FALSE;
|
||||
EAvatarRenderPass LLAvatarJointMesh::sRenderPass = AVATAR_RENDER_PASS_SINGLE;
|
||||
U32 LLAvatarJointMesh::sClothingMaskImageName = 0;
|
||||
LLColor4 LLAvatarJointMesh::sClothingInnerColor;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLAvatarJointMesh()
|
||||
//-----------------------------------------------------------------------------
|
||||
LLAvatarJointMesh::LLAvatarJointMesh()
|
||||
:
|
||||
mTexture( NULL ),
|
||||
mLayerSet( NULL ),
|
||||
mTestImageName( 0 ),
|
||||
mFaceIndexCount(0)
|
||||
{
|
||||
|
||||
mColor[0] = 1.0f;
|
||||
mColor[1] = 1.0f;
|
||||
mColor[2] = 1.0f;
|
||||
mColor[3] = 1.0f;
|
||||
mShiny = 0.0f;
|
||||
mCullBackFaces = TRUE;
|
||||
|
||||
mMesh = NULL;
|
||||
|
||||
mNumSkinJoints = 0;
|
||||
mSkinJoints = NULL;
|
||||
|
||||
mFace = NULL;
|
||||
|
||||
mMeshID = 0;
|
||||
mUpdateXform = FALSE;
|
||||
|
||||
mValid = FALSE;
|
||||
|
||||
mIsTransparent = FALSE;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// ~LLAvatarJointMesh()
|
||||
// Class Destructor
|
||||
//-----------------------------------------------------------------------------
|
||||
LLAvatarJointMesh::~LLAvatarJointMesh()
|
||||
{
|
||||
mMesh = NULL;
|
||||
mTexture = NULL;
|
||||
freeSkinData();
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLAvatarJointMesh::allocateSkinData()
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL LLAvatarJointMesh::allocateSkinData( U32 numSkinJoints )
|
||||
{
|
||||
mSkinJoints = new LLSkinJoint[ numSkinJoints ];
|
||||
mNumSkinJoints = numSkinJoints;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLAvatarJointMesh::freeSkinData()
|
||||
//-----------------------------------------------------------------------------
|
||||
void LLAvatarJointMesh::freeSkinData()
|
||||
{
|
||||
mNumSkinJoints = 0;
|
||||
delete [] mSkinJoints;
|
||||
mSkinJoints = NULL;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// LLAvatarJointMesh::getColor()
|
||||
//--------------------------------------------------------------------
|
||||
void LLAvatarJointMesh::getColor( F32 *red, F32 *green, F32 *blue, F32 *alpha )
|
||||
{
|
||||
*red = mColor[0];
|
||||
*green = mColor[1];
|
||||
*blue = mColor[2];
|
||||
*alpha = mColor[3];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// LLAvatarJointMesh::setColor()
|
||||
//--------------------------------------------------------------------
|
||||
void LLAvatarJointMesh::setColor( F32 red, F32 green, F32 blue, F32 alpha )
|
||||
{
|
||||
mColor[0] = red;
|
||||
mColor[1] = green;
|
||||
mColor[2] = blue;
|
||||
mColor[3] = alpha;
|
||||
}
|
||||
|
||||
void LLAvatarJointMesh::setColor( const LLColor4& color )
|
||||
{
|
||||
mColor = color;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// LLAvatarJointMesh::getTexture()
|
||||
//--------------------------------------------------------------------
|
||||
//LLViewerTexture *LLAvatarJointMesh::getTexture()
|
||||
//{
|
||||
// return mTexture;
|
||||
//}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// LLAvatarJointMesh::setTexture()
|
||||
//--------------------------------------------------------------------
|
||||
void LLAvatarJointMesh::setTexture( LLGLTexture *texture )
|
||||
{
|
||||
mTexture = texture;
|
||||
|
||||
// texture and dynamic_texture are mutually exclusive
|
||||
if( texture )
|
||||
{
|
||||
mLayerSet = NULL;
|
||||
//texture->bindTexture(0);
|
||||
//texture->setClamp(TRUE, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BOOL LLAvatarJointMesh::hasGLTexture() const
|
||||
{
|
||||
return mTexture.notNull() && mTexture->hasGLTexture();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// LLAvatarJointMesh::setLayerSet()
|
||||
// Sets the shape texture (takes precedence over normal texture)
|
||||
//--------------------------------------------------------------------
|
||||
void LLAvatarJointMesh::setLayerSet( LLTexLayerSet* layer_set )
|
||||
{
|
||||
mLayerSet = layer_set;
|
||||
|
||||
// texture and dynamic_texture are mutually exclusive
|
||||
if( layer_set )
|
||||
{
|
||||
mTexture = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL LLAvatarJointMesh::hasComposite() const
|
||||
{
|
||||
return (mLayerSet && mLayerSet->hasComposite());
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// LLAvatarJointMesh::getMesh()
|
||||
//--------------------------------------------------------------------
|
||||
LLPolyMesh *LLAvatarJointMesh::getMesh()
|
||||
{
|
||||
return mMesh;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLAvatarJointMesh::setMesh()
|
||||
//-----------------------------------------------------------------------------
|
||||
void LLAvatarJointMesh::setMesh( LLPolyMesh *mesh )
|
||||
{
|
||||
// set the mesh pointer
|
||||
mMesh = mesh;
|
||||
|
||||
// release any existing skin joints
|
||||
freeSkinData();
|
||||
|
||||
if ( mMesh == NULL )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// acquire the transform from the mesh object
|
||||
setPosition( mMesh->getPosition() );
|
||||
setRotation( mMesh->getRotation() );
|
||||
setScale( mMesh->getScale() );
|
||||
|
||||
// create skin joints if necessary
|
||||
if ( mMesh->hasWeights() && !mMesh->isLOD())
|
||||
{
|
||||
U32 numJointNames = mMesh->getNumJointNames();
|
||||
|
||||
allocateSkinData( numJointNames );
|
||||
std::string *jointNames = mMesh->getJointNames();
|
||||
|
||||
U32 jn;
|
||||
for (jn = 0; jn < numJointNames; jn++)
|
||||
{
|
||||
//llinfos << "Setting up joint " << jointNames[jn] << llendl;
|
||||
LLAvatarJoint* joint = (LLAvatarJoint*)(getRoot()->findJoint(jointNames[jn]) );
|
||||
mSkinJoints[jn].setupSkinJoint( joint );
|
||||
}
|
||||
}
|
||||
|
||||
// setup joint array
|
||||
if (!mMesh->isLOD())
|
||||
{
|
||||
setupJoint((LLAvatarJoint*)getRoot());
|
||||
}
|
||||
|
||||
// llinfos << "joint render entries: " << mMesh->mJointRenderData.count() << llendl;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// setupJoint()
|
||||
//-----------------------------------------------------------------------------
|
||||
void LLAvatarJointMesh::setupJoint(LLAvatarJoint* current_joint)
|
||||
{
|
||||
// llinfos << "Mesh: " << getName() << llendl;
|
||||
|
||||
// S32 joint_count = 0;
|
||||
U32 sj;
|
||||
for (sj=0; sj<mNumSkinJoints; sj++)
|
||||
{
|
||||
LLSkinJoint &js = mSkinJoints[sj];
|
||||
|
||||
if (js.mJoint != current_joint)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// we've found a skinjoint for this joint..
|
||||
|
||||
// is the last joint in the array our parent?
|
||||
if(mMesh->mJointRenderData.count() && mMesh->mJointRenderData[mMesh->mJointRenderData.count() - 1]->mWorldMatrix == ¤t_joint->getParent()->getWorldMatrix())
|
||||
{
|
||||
// ...then just add ourselves
|
||||
LLAvatarJoint* jointp = js.mJoint;
|
||||
mMesh->mJointRenderData.put(new LLJointRenderData(&jointp->getWorldMatrix(), &js));
|
||||
// llinfos << "joint " << joint_count << js.mJoint->getName() << llendl;
|
||||
// joint_count++;
|
||||
}
|
||||
// otherwise add our parent and ourselves
|
||||
else
|
||||
{
|
||||
mMesh->mJointRenderData.put(new LLJointRenderData(¤t_joint->getParent()->getWorldMatrix(), NULL));
|
||||
// llinfos << "joint " << joint_count << current_joint->getParent()->getName() << llendl;
|
||||
// joint_count++;
|
||||
mMesh->mJointRenderData.put(new LLJointRenderData(¤t_joint->getWorldMatrix(), &js));
|
||||
// llinfos << "joint " << joint_count << current_joint->getName() << llendl;
|
||||
// joint_count++;
|
||||
}
|
||||
}
|
||||
|
||||
// depth-first traversal
|
||||
for (LLJoint::child_list_t::iterator iter = current_joint->mChildren.begin();
|
||||
iter != current_joint->mChildren.end(); ++iter)
|
||||
{
|
||||
LLAvatarJoint* child_joint = (LLAvatarJoint*)(*iter);
|
||||
setupJoint(child_joint);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// End
|
||||
|
|
@ -0,0 +1,145 @@
|
|||
/**
|
||||
* @file llavatarjointmesh.h
|
||||
* @brief Declaration of LLAvatarJointMesh class
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#ifndef LL_LLAVATARJOINTMESH_H
|
||||
#define LL_LLAVATARJOINTMESH_H
|
||||
|
||||
#include "llavatarjoint.h"
|
||||
#include "llgltexture.h"
|
||||
#include "llpolymesh.h"
|
||||
#include "v4color.h"
|
||||
|
||||
class LLDrawable;
|
||||
class LLFace;
|
||||
class LLCharacter;
|
||||
class LLTexLayerSet;
|
||||
|
||||
typedef enum e_avatar_render_pass
|
||||
{
|
||||
AVATAR_RENDER_PASS_SINGLE,
|
||||
AVATAR_RENDER_PASS_CLOTHING_INNER,
|
||||
AVATAR_RENDER_PASS_CLOTHING_OUTER
|
||||
} EAvatarRenderPass;
|
||||
|
||||
class LLSkinJoint
|
||||
{
|
||||
public:
|
||||
LLSkinJoint();
|
||||
~LLSkinJoint();
|
||||
BOOL setupSkinJoint( LLAvatarJoint *joint);
|
||||
|
||||
LLAvatarJoint *mJoint;
|
||||
LLVector3 mRootToJointSkinOffset;
|
||||
LLVector3 mRootToParentJointSkinOffset;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// class LLViewerJointMesh
|
||||
//-----------------------------------------------------------------------------
|
||||
class LLAvatarJointMesh : public virtual LLAvatarJoint
|
||||
{
|
||||
protected:
|
||||
LLColor4 mColor; // color value
|
||||
// LLColor4 mSpecular; // specular color (always white for now)
|
||||
F32 mShiny; // shiny value
|
||||
LLPointer<LLGLTexture> mTexture; // ptr to a global texture
|
||||
LLTexLayerSet* mLayerSet; // ptr to a layer set owned by the avatar
|
||||
U32 mTestImageName; // handle to a temporary texture for previewing uploads
|
||||
LLPolyMesh* mMesh; // ptr to a global polymesh
|
||||
BOOL mCullBackFaces; // true by default
|
||||
LLFace* mFace; // ptr to a face w/ AGP copy of mesh
|
||||
|
||||
U32 mFaceIndexCount;
|
||||
|
||||
U32 mNumSkinJoints;
|
||||
LLSkinJoint* mSkinJoints;
|
||||
S32 mMeshID;
|
||||
|
||||
public:
|
||||
static BOOL sPipelineRender;
|
||||
//RN: this is here for testing purposes
|
||||
static U32 sClothingMaskImageName;
|
||||
static EAvatarRenderPass sRenderPass;
|
||||
static LLColor4 sClothingInnerColor;
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
LLAvatarJointMesh();
|
||||
|
||||
// Destructor
|
||||
virtual ~LLAvatarJointMesh();
|
||||
|
||||
// Gets the shape color
|
||||
void getColor( F32 *red, F32 *green, F32 *blue, F32 *alpha );
|
||||
|
||||
// Sets the shape color
|
||||
void setColor( F32 red, F32 green, F32 blue, F32 alpha );
|
||||
void setColor( const LLColor4& color );
|
||||
|
||||
// Sets the shininess
|
||||
void setSpecular( const LLColor4& color, F32 shiny ) { /*mSpecular = color;*/ mShiny = shiny; };
|
||||
|
||||
// Sets the shape texture
|
||||
void setTexture( LLGLTexture *texture );
|
||||
|
||||
BOOL hasGLTexture() const;
|
||||
|
||||
void setTestTexture( U32 name ) { mTestImageName = name; }
|
||||
|
||||
// Sets layer set responsible for a dynamic shape texture (takes precedence over normal texture)
|
||||
void setLayerSet( LLTexLayerSet* layer_set );
|
||||
|
||||
BOOL hasComposite() const;
|
||||
|
||||
// Gets the poly mesh
|
||||
LLPolyMesh *getMesh();
|
||||
|
||||
// Sets the poly mesh
|
||||
void setMesh( LLPolyMesh *mesh );
|
||||
|
||||
// Sets up joint matrix data for rendering
|
||||
void setupJoint(LLAvatarJoint* current_joint);
|
||||
|
||||
// Render time method to upload batches of joint matrices
|
||||
void uploadJointMatrices();
|
||||
|
||||
// Sets ID for picking
|
||||
void setMeshID( S32 id ) {mMeshID = id;}
|
||||
|
||||
// Gets ID for picking
|
||||
S32 getMeshID() { return mMeshID; }
|
||||
|
||||
void setIsTransparent(BOOL is_transparent) { mIsTransparent = is_transparent; }
|
||||
|
||||
private:
|
||||
// Allocate skin data
|
||||
BOOL allocateSkinData( U32 numSkinJoints );
|
||||
|
||||
// Free skin data
|
||||
void freeSkinData();
|
||||
};
|
||||
|
||||
#endif // LL_LLAVATARJOINTMESH_H
|
||||
|
|
@ -24,22 +24,20 @@
|
|||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
#include "linden_common.h"
|
||||
|
||||
#include "lldriverparam.h"
|
||||
|
||||
#include "llfasttimer.h"
|
||||
#include "llvoavatar.h"
|
||||
#include "llvoavatarself.h"
|
||||
#include "llagent.h"
|
||||
#include "llavatarappearance.h"
|
||||
#include "llwearable.h"
|
||||
#include "llagentwearables.h"
|
||||
#include "llwearabledata.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLDriverParamInfo
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
LLDriverParamInfo::LLDriverParamInfo()
|
||||
LLDriverParamInfo::LLDriverParamInfo() :
|
||||
mDriverParam(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -112,12 +110,14 @@ void LLDriverParamInfo::toStream(std::ostream &out)
|
|||
|
||||
out << std::endl;
|
||||
|
||||
if(isAgentAvatarValid())
|
||||
if(mDriverParam && mDriverParam->getAvatarAppearance()->isSelf() &&
|
||||
mDriverParam->getAvatarAppearance()->isValid())
|
||||
{
|
||||
for (entry_info_list_t::iterator iter = mDrivenInfoList.begin(); iter != mDrivenInfoList.end(); iter++)
|
||||
{
|
||||
LLDrivenEntryInfo driven = *iter;
|
||||
LLViewerVisualParam *param = (LLViewerVisualParam*)gAgentAvatarp->getVisualParam(driven.mDrivenID);
|
||||
LLViewerVisualParam *param =
|
||||
(LLViewerVisualParam*)mDriverParam->getAvatarAppearance()->getVisualParam(driven.mDrivenID);
|
||||
if (param)
|
||||
{
|
||||
param->getInfo()->toStream(out);
|
||||
|
|
@ -139,7 +139,9 @@ void LLDriverParamInfo::toStream(std::ostream &out)
|
|||
}
|
||||
else
|
||||
{
|
||||
llwarns << "could not get parameter " << driven.mDrivenID << " from avatar " << gAgentAvatarp.get() << " for driver parameter " << getID() << llendl;
|
||||
llwarns << "could not get parameter " << driven.mDrivenID << " from avatar "
|
||||
<< mDriverParam->getAvatarAppearance()
|
||||
<< " for driver parameter " << getID() << llendl;
|
||||
}
|
||||
out << std::endl;
|
||||
}
|
||||
|
|
@ -150,19 +152,16 @@ void LLDriverParamInfo::toStream(std::ostream &out)
|
|||
// LLDriverParam
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
LLDriverParam::LLDriverParam(LLVOAvatar *avatarp) :
|
||||
LLDriverParam::LLDriverParam(LLAvatarAppearance *appearance, LLWearable* wearable /* = NULL */) :
|
||||
mCurrentDistortionParam( NULL ),
|
||||
mAvatarp(avatarp),
|
||||
mWearablep(NULL)
|
||||
{
|
||||
mDefaultVec.clear();
|
||||
}
|
||||
|
||||
LLDriverParam::LLDriverParam(LLWearable *wearablep) :
|
||||
mCurrentDistortionParam( NULL ),
|
||||
mAvatarp(NULL),
|
||||
mWearablep(wearablep)
|
||||
mAvatarAppearance(appearance),
|
||||
mWearablep(wearable)
|
||||
{
|
||||
llassert(mAvatarAppearance);
|
||||
if (mWearablep)
|
||||
{
|
||||
llassert(mAvatarAppearance->isSelf());
|
||||
}
|
||||
mDefaultVec.clear();
|
||||
}
|
||||
|
||||
|
|
@ -177,67 +176,25 @@ BOOL LLDriverParam::setInfo(LLDriverParamInfo *info)
|
|||
return FALSE;
|
||||
mInfo = info;
|
||||
mID = info->mID;
|
||||
info->mDriverParam = this;
|
||||
|
||||
setWeight(getDefaultWeight(), FALSE );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void LLDriverParam::setWearable(LLWearable *wearablep)
|
||||
{
|
||||
if (wearablep)
|
||||
{
|
||||
mWearablep = wearablep;
|
||||
mAvatarp = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void LLDriverParam::setAvatar(LLVOAvatar *avatarp)
|
||||
{
|
||||
if (avatarp)
|
||||
{
|
||||
mWearablep = NULL;
|
||||
mAvatarp = avatarp;
|
||||
}
|
||||
}
|
||||
|
||||
/*virtual*/ LLViewerVisualParam* LLDriverParam::cloneParam(LLWearable* wearable) const
|
||||
{
|
||||
LLDriverParam *new_param;
|
||||
if (wearable)
|
||||
{
|
||||
new_param = new LLDriverParam(wearable);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mWearablep)
|
||||
{
|
||||
new_param = new LLDriverParam(mWearablep);
|
||||
}
|
||||
else
|
||||
{
|
||||
new_param = new LLDriverParam(mAvatarp);
|
||||
}
|
||||
}
|
||||
llassert(wearable);
|
||||
LLDriverParam *new_param = new LLDriverParam(mAvatarAppearance, wearable);
|
||||
// FIXME DRANO this clobbers mWearablep, which means any code
|
||||
// currently using mWearablep is wrong, or at least untested.
|
||||
*new_param = *this;
|
||||
//new_param->mWearablep = wearable;
|
||||
// new_param->mDriven.clear(); // clear driven list to avoid overwriting avatar driven params from wearables.
|
||||
return new_param;
|
||||
}
|
||||
|
||||
#if 0 // obsolete
|
||||
BOOL LLDriverParam::parseData(LLXmlTreeNode* node)
|
||||
{
|
||||
LLDriverParamInfo* info = new LLDriverParamInfo;
|
||||
|
||||
info->parseXml(node);
|
||||
if (!setInfo(info))
|
||||
{
|
||||
delete info;
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
void LLDriverParam::setWeight(F32 weight, BOOL upload_bake)
|
||||
{
|
||||
F32 min_weight = getMinWeight();
|
||||
|
|
@ -456,6 +413,20 @@ const LLVector4a* LLDriverParam::getNextDistortion(U32 *index, LLPolyMesh **poly
|
|||
return v;
|
||||
};
|
||||
|
||||
S32 LLDriverParam::getDrivenParamsCount() const
|
||||
{
|
||||
return mDriven.size();
|
||||
}
|
||||
|
||||
const LLViewerVisualParam* LLDriverParam::getDrivenParam(S32 index) const
|
||||
{
|
||||
if (0 > index || index >= mDriven.size())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return mDriven[index].mParam;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// setAnimationTarget()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -511,6 +482,7 @@ BOOL LLDriverParam::linkDrivenParams(visual_param_mapper mapper, BOOL only_cross
|
|||
if (!found)
|
||||
{
|
||||
LLViewerVisualParam* param = (LLViewerVisualParam*)mapper(driven_id);
|
||||
if (param) param->setParamLocation(this->getParamLocation());
|
||||
bool push = param && (!only_cross_params || param->getCrossWearable());
|
||||
if (push)
|
||||
{
|
||||
|
|
@ -555,7 +527,7 @@ void LLDriverParam::updateCrossDrivenParams(LLWearableType::EType driven_type)
|
|||
// Thus this wearable needs to get updates from the driver wearable.
|
||||
// The call to setVisualParamWeight seems redundant, but is necessary
|
||||
// as the number of driven wearables has changed since the last update. -Nyx
|
||||
LLWearable *wearable = gAgentWearables.getTopWearable(driver_type);
|
||||
LLWearable *wearable = mAvatarAppearance->getWearableData()->getTopWearable(driver_type);
|
||||
if (wearable)
|
||||
{
|
||||
wearable->setVisualParamWeight(mID, wearable->getVisualParamWeight(mID), false);
|
||||
|
|
@ -623,13 +595,22 @@ F32 LLDriverParam::getDrivenWeight(const LLDrivenEntry* driven, F32 input_weight
|
|||
|
||||
void LLDriverParam::setDrivenWeight(LLDrivenEntry *driven, F32 driven_weight, bool upload_bake)
|
||||
{
|
||||
if(isAgentAvatarValid() &&
|
||||
mWearablep &&
|
||||
driven->mParam->getCrossWearable() &&
|
||||
mWearablep->isOnTop())
|
||||
bool use_self = false;
|
||||
if(mWearablep &&
|
||||
mAvatarAppearance->isValid() &&
|
||||
driven->mParam->getCrossWearable())
|
||||
{
|
||||
LLWearable* wearable = dynamic_cast<LLWearable*> (mWearablep);
|
||||
if (mAvatarAppearance->getWearableData()->isOnTop(wearable))
|
||||
{
|
||||
use_self = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (use_self)
|
||||
{
|
||||
// call setWeight through LLVOAvatarSelf so other wearables can be updated with the correct values
|
||||
gAgentAvatarp->setVisualParamWeight( (LLVisualParam*)driven->mParam, driven_weight, upload_bake );
|
||||
mAvatarAppearance->setVisualParamWeight( (LLVisualParam*)driven->mParam, driven_weight, upload_bake );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -30,8 +30,8 @@
|
|||
#include "llviewervisualparam.h"
|
||||
#include "llwearabletype.h"
|
||||
|
||||
class LLPhysicsMotion;
|
||||
class LLVOAvatar;
|
||||
class LLAvatarAppearance;
|
||||
class LLDriverParam;
|
||||
class LLWearable;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -71,6 +71,7 @@ public:
|
|||
protected:
|
||||
typedef std::deque<LLDrivenEntryInfo> entry_info_list_t;
|
||||
entry_info_list_t mDrivenInfoList;
|
||||
LLDriverParam* mDriverParam; // backpointer
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -78,10 +79,11 @@ protected:
|
|||
LL_ALIGN_PREFIX(16)
|
||||
class LLDriverParam : public LLViewerVisualParam
|
||||
{
|
||||
friend class LLPhysicsMotion; // physics motion needs to access driven params directly.
|
||||
private:
|
||||
// Hide the default constructor. Force construction with LLAvatarAppearance.
|
||||
LLDriverParam() {}
|
||||
public:
|
||||
LLDriverParam(LLVOAvatar *avatarp);
|
||||
LLDriverParam(LLWearable *wearablep);
|
||||
LLDriverParam(LLAvatarAppearance *appearance, LLWearable* wearable = NULL);
|
||||
~LLDriverParam();
|
||||
|
||||
void* operator new(size_t size)
|
||||
|
|
@ -99,14 +101,14 @@ public:
|
|||
// This sets mInfo and calls initialization functions
|
||||
BOOL setInfo(LLDriverParamInfo *info);
|
||||
|
||||
void setWearable(LLWearable *wearablep);
|
||||
void setAvatar(LLVOAvatar *avatarp);
|
||||
LLAvatarAppearance* getAvatarAppearance() { return mAvatarAppearance; }
|
||||
const LLAvatarAppearance* getAvatarAppearance() const { return mAvatarAppearance; }
|
||||
|
||||
void updateCrossDrivenParams(LLWearableType::EType driven_type);
|
||||
|
||||
/*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable) const;
|
||||
|
||||
// LLVisualParam Virtual functions
|
||||
///*virtual*/ BOOL parseData(LLXmlTreeNode* node);
|
||||
/*virtual*/ void apply( ESex sex ) {} // apply is called separately for each driven param.
|
||||
/*virtual*/ void setWeight(F32 weight, BOOL upload_bake);
|
||||
/*virtual*/ void setAnimationTarget( F32 target_value, BOOL upload_bake );
|
||||
|
|
@ -122,6 +124,9 @@ public:
|
|||
/*virtual*/ const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh);
|
||||
/*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh);
|
||||
|
||||
S32 getDrivenParamsCount() const;
|
||||
const LLViewerVisualParam* getDrivenParam(S32 index) const;
|
||||
|
||||
protected:
|
||||
F32 getDrivenWeight(const LLDrivenEntry* driven, F32 input_weight);
|
||||
void setDrivenWeight(LLDrivenEntry *driven, F32 driven_weight, bool upload_bake);
|
||||
|
|
@ -132,7 +137,7 @@ protected:
|
|||
entry_list_t mDriven;
|
||||
LLViewerVisualParam* mCurrentDistortionParam;
|
||||
// Backlink only; don't make this an LLPointer.
|
||||
LLVOAvatar* mAvatarp;
|
||||
LLAvatarAppearance* mAvatarAppearance;
|
||||
LLWearable* mWearablep;
|
||||
} LL_ALIGN_POSTFIX(16);
|
||||
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
/**
|
||||
* @file lljointpickname.h
|
||||
* @brief Defines OpenGL seleciton stack names
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
|
||||
#ifndef LL_LLJOINTPICKNAME_H
|
||||
#define LL_LLJOINTPICKNAME_H
|
||||
|
||||
class LLAvatarJointMesh;
|
||||
|
||||
// Sets the OpenGL selection stack name that is pushed and popped
|
||||
// with this joint state. The default value indicates that no name
|
||||
// should be pushed/popped.
|
||||
enum LLJointPickName
|
||||
{
|
||||
PN_DEFAULT = -1,
|
||||
PN_0 = 0,
|
||||
PN_1 = 1,
|
||||
PN_2 = 2,
|
||||
PN_3 = 3,
|
||||
PN_4 = 4,
|
||||
PN_5 = 5
|
||||
};
|
||||
|
||||
typedef std::vector<LLAvatarJointMesh*> avatar_joint_mesh_list_t;
|
||||
|
||||
#endif // LL_LLJOINTPICKNAME_H
|
||||
|
|
@ -23,13 +23,14 @@
|
|||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
#include "linden_common.h"
|
||||
|
||||
#include "lllocaltextureobject.h"
|
||||
|
||||
#include "llimage.h"
|
||||
#include "llrender.h"
|
||||
#include "lltexlayer.h"
|
||||
#include "llviewertexture.h"
|
||||
#include "lltextureentry.h"
|
||||
#include "llgltexture.h"
|
||||
#include "lluuid.h"
|
||||
#include "llwearable.h"
|
||||
|
||||
|
|
@ -41,7 +42,7 @@ LLLocalTextureObject::LLLocalTextureObject() :
|
|||
mImage = NULL;
|
||||
}
|
||||
|
||||
LLLocalTextureObject::LLLocalTextureObject(LLViewerFetchedTexture* image, const LLUUID& id) :
|
||||
LLLocalTextureObject::LLLocalTextureObject(LLGLTexture* image, const LLUUID& id) :
|
||||
mIsBakedReady(FALSE),
|
||||
mDiscard(MAX_DISCARD_LEVEL+1)
|
||||
{
|
||||
|
|
@ -77,7 +78,7 @@ LLLocalTextureObject::~LLLocalTextureObject()
|
|||
{
|
||||
}
|
||||
|
||||
LLViewerFetchedTexture* LLLocalTextureObject::getImage() const
|
||||
LLGLTexture* LLLocalTextureObject::getImage() const
|
||||
{
|
||||
return mImage;
|
||||
}
|
||||
|
|
@ -126,7 +127,7 @@ BOOL LLLocalTextureObject::getBakedReady() const
|
|||
return mIsBakedReady;
|
||||
}
|
||||
|
||||
void LLLocalTextureObject::setImage(LLViewerFetchedTexture* new_image)
|
||||
void LLLocalTextureObject::setImage(LLGLTexture* new_image)
|
||||
{
|
||||
mImage = new_image;
|
||||
}
|
||||
|
|
@ -29,11 +29,10 @@
|
|||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include "llviewertexture.h"
|
||||
#include "llpointer.h"
|
||||
#include "llgltexture.h"
|
||||
|
||||
class LLUUID;
|
||||
class LLTexLayer;
|
||||
class LLTextureEntry;
|
||||
class LLTexLayerTemplate;
|
||||
class LLWearable;
|
||||
|
||||
|
|
@ -44,11 +43,11 @@ class LLLocalTextureObject
|
|||
{
|
||||
public:
|
||||
LLLocalTextureObject();
|
||||
LLLocalTextureObject(LLViewerFetchedTexture* image, const LLUUID& id);
|
||||
LLLocalTextureObject(LLGLTexture* image, const LLUUID& id);
|
||||
LLLocalTextureObject(const LLLocalTextureObject& lto);
|
||||
~LLLocalTextureObject();
|
||||
|
||||
LLViewerFetchedTexture* getImage() const;
|
||||
LLGLTexture* getImage() const;
|
||||
LLTexLayer* getTexLayer(U32 index) const;
|
||||
LLTexLayer* getTexLayer(const std::string &name);
|
||||
U32 getNumTexLayers() const;
|
||||
|
|
@ -56,7 +55,7 @@ public:
|
|||
S32 getDiscard() const;
|
||||
BOOL getBakedReady() const;
|
||||
|
||||
void setImage(LLViewerFetchedTexture* new_image);
|
||||
void setImage(LLGLTexture* new_image);
|
||||
BOOL setTexLayer(LLTexLayer *new_tex_layer, U32 index);
|
||||
BOOL addTexLayer(LLTexLayer *new_tex_layer, LLWearable *wearable);
|
||||
BOOL addTexLayer(LLTexLayerTemplate *new_tex_layer, LLWearable *wearable);
|
||||
|
|
@ -70,7 +69,7 @@ protected:
|
|||
|
||||
private:
|
||||
|
||||
LLPointer<LLViewerFetchedTexture> mImage;
|
||||
LLPointer<LLGLTexture> mImage;
|
||||
// NOTE: LLLocalTextureObject should be the exclusive owner of mTexEntry and mTexLayer
|
||||
// using shared pointers here only for smart assignment & cleanup
|
||||
// do NOT create new shared pointers to these objects, or keep pointers to them around
|
||||
|
|
@ -27,25 +27,24 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Header Files
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
|
||||
#include "linden_common.h"
|
||||
#include "llpolymesh.h"
|
||||
#include "llfasttimer.h"
|
||||
#include "llmemory.h"
|
||||
|
||||
#include "llviewercontrol.h"
|
||||
//#include "llviewercontrol.h"
|
||||
#include "llxmltree.h"
|
||||
#include "llvoavatar.h"
|
||||
#include "llavatarappearance.h"
|
||||
#include "llwearable.h"
|
||||
#include "lldir.h"
|
||||
#include "llvolume.h"
|
||||
#include "llendianswizzle.h"
|
||||
|
||||
#include "llpolymesh.h"
|
||||
|
||||
#define HEADER_ASCII "Linden Mesh 1.0"
|
||||
#define HEADER_BINARY "Linden Binary Mesh 1.0"
|
||||
|
||||
extern LLControlGroup gSavedSettings; // read only
|
||||
//extern LLControlGroup gSavedSettings; // read only
|
||||
|
||||
LLPolyMorphData *clone_morph_param_duplicate(const LLPolyMorphData *src_data,
|
||||
const std::string &name);
|
||||
|
|
@ -241,7 +240,7 @@ BOOL LLPolyMeshSharedData::allocateVertexData( U32 numVertices )
|
|||
mBaseNormals[i].clear();
|
||||
mBaseBinormals[i].clear();
|
||||
mTexCoords[i].clear();
|
||||
mWeights[i] = 0.f;
|
||||
mWeights[i] = 0.f;
|
||||
}
|
||||
mNumVertices = numVertices;
|
||||
return TRUE;
|
||||
|
|
@ -1046,250 +1045,4 @@ F32* LLPolyMesh::getWritableWeights() const
|
|||
return mSharedData->mWeights;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLPolySkeletalDistortionInfo()
|
||||
//-----------------------------------------------------------------------------
|
||||
LLPolySkeletalDistortionInfo::LLPolySkeletalDistortionInfo()
|
||||
{
|
||||
}
|
||||
|
||||
BOOL LLPolySkeletalDistortionInfo::parseXml(LLXmlTreeNode* node)
|
||||
{
|
||||
llassert( node->hasName( "param" ) && node->getChildByName( "param_skeleton" ) );
|
||||
|
||||
if (!LLViewerVisualParamInfo::parseXml(node))
|
||||
return FALSE;
|
||||
|
||||
LLXmlTreeNode* skeletalParam = node->getChildByName("param_skeleton");
|
||||
|
||||
if (NULL == skeletalParam)
|
||||
{
|
||||
llwarns << "Failed to getChildByName(\"param_skeleton\")"
|
||||
<< llendl;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for( LLXmlTreeNode* bone = skeletalParam->getFirstChild(); bone; bone = skeletalParam->getNextChild() )
|
||||
{
|
||||
if (bone->hasName("bone"))
|
||||
{
|
||||
std::string name;
|
||||
LLVector3 scale;
|
||||
LLVector3 pos;
|
||||
BOOL haspos = FALSE;
|
||||
|
||||
static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name");
|
||||
if (!bone->getFastAttributeString(name_string, name))
|
||||
{
|
||||
llwarns << "No bone name specified for skeletal param." << llendl;
|
||||
continue;
|
||||
}
|
||||
|
||||
static LLStdStringHandle scale_string = LLXmlTree::addAttributeString("scale");
|
||||
if (!bone->getFastAttributeVector3(scale_string, scale))
|
||||
{
|
||||
llwarns << "No scale specified for bone " << name << "." << llendl;
|
||||
continue;
|
||||
}
|
||||
|
||||
// optional offset deformation (translation)
|
||||
static LLStdStringHandle offset_string = LLXmlTree::addAttributeString("offset");
|
||||
if (bone->getFastAttributeVector3(offset_string, pos))
|
||||
{
|
||||
haspos = TRUE;
|
||||
}
|
||||
mBoneInfoList.push_back(LLPolySkeletalBoneInfo(name, scale, pos, haspos));
|
||||
}
|
||||
else
|
||||
{
|
||||
llwarns << "Unrecognized element " << bone->getName() << " in skeletal distortion" << llendl;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLPolySkeletalDistortion()
|
||||
//-----------------------------------------------------------------------------
|
||||
LLPolySkeletalDistortion::LLPolySkeletalDistortion(LLVOAvatar *avatarp)
|
||||
{
|
||||
mAvatar = avatarp;
|
||||
mDefaultVec.splat(0.001f);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// ~LLPolySkeletalDistortion()
|
||||
//-----------------------------------------------------------------------------
|
||||
LLPolySkeletalDistortion::~LLPolySkeletalDistortion()
|
||||
{
|
||||
}
|
||||
|
||||
BOOL LLPolySkeletalDistortion::setInfo(LLPolySkeletalDistortionInfo *info)
|
||||
{
|
||||
llassert(mInfo == NULL);
|
||||
if (info->mID < 0)
|
||||
return FALSE;
|
||||
mInfo = info;
|
||||
mID = info->mID;
|
||||
setWeight(getDefaultWeight(), FALSE );
|
||||
|
||||
LLPolySkeletalDistortionInfo::bone_info_list_t::iterator iter;
|
||||
for (iter = getInfo()->mBoneInfoList.begin(); iter != getInfo()->mBoneInfoList.end(); iter++)
|
||||
{
|
||||
LLPolySkeletalBoneInfo *bone_info = &(*iter);
|
||||
LLJoint* joint = mAvatar->getJoint(bone_info->mBoneName);
|
||||
if (!joint)
|
||||
{
|
||||
llwarns << "Joint " << bone_info->mBoneName << " not found." << llendl;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (mJointScales.find(joint) != mJointScales.end())
|
||||
{
|
||||
llwarns << "Scale deformation already supplied for joint " << joint->getName() << "." << llendl;
|
||||
}
|
||||
|
||||
// store it
|
||||
mJointScales[joint] = bone_info->mScaleDeformation;
|
||||
|
||||
// apply to children that need to inherit it
|
||||
for (LLJoint::child_list_t::iterator iter = joint->mChildren.begin();
|
||||
iter != joint->mChildren.end(); ++iter)
|
||||
{
|
||||
LLViewerJoint* child_joint = (LLViewerJoint*)(*iter);
|
||||
if (child_joint->inheritScale())
|
||||
{
|
||||
LLVector3 childDeformation = LLVector3(child_joint->getScale());
|
||||
childDeformation.scaleVec(bone_info->mScaleDeformation);
|
||||
mJointScales[child_joint] = childDeformation;
|
||||
}
|
||||
}
|
||||
|
||||
if (bone_info->mHasPositionDeformation)
|
||||
{
|
||||
if (mJointOffsets.find(joint) != mJointOffsets.end())
|
||||
{
|
||||
llwarns << "Offset deformation already supplied for joint " << joint->getName() << "." << llendl;
|
||||
}
|
||||
mJointOffsets[joint] = bone_info->mPositionDeformation;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*virtual*/ LLViewerVisualParam* LLPolySkeletalDistortion::cloneParam(LLWearable* wearable) const
|
||||
{
|
||||
LLPolySkeletalDistortion *new_param = new LLPolySkeletalDistortion(mAvatar);
|
||||
*new_param = *this;
|
||||
return new_param;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// apply()
|
||||
//-----------------------------------------------------------------------------
|
||||
static LLFastTimer::DeclareTimer FTM_POLYSKELETAL_DISTORTION_APPLY("Skeletal Distortion");
|
||||
|
||||
void LLPolySkeletalDistortion::apply( ESex avatar_sex )
|
||||
{
|
||||
LLFastTimer t(FTM_POLYSKELETAL_DISTORTION_APPLY);
|
||||
|
||||
F32 effective_weight = ( getSex() & avatar_sex ) ? mCurWeight : getDefaultWeight();
|
||||
|
||||
LLJoint* joint;
|
||||
joint_vec_map_t::iterator iter;
|
||||
|
||||
for (iter = mJointScales.begin();
|
||||
iter != mJointScales.end();
|
||||
iter++)
|
||||
{
|
||||
joint = iter->first;
|
||||
LLVector3 newScale = joint->getScale();
|
||||
LLVector3 scaleDelta = iter->second;
|
||||
newScale = newScale + (effective_weight * scaleDelta) - (mLastWeight * scaleDelta);
|
||||
joint->setScale(newScale);
|
||||
}
|
||||
|
||||
for (iter = mJointOffsets.begin();
|
||||
iter != mJointOffsets.end();
|
||||
iter++)
|
||||
{
|
||||
joint = iter->first;
|
||||
LLVector3 newPosition = joint->getPosition();
|
||||
LLVector3 positionDelta = iter->second;
|
||||
newPosition = newPosition + (effective_weight * positionDelta) - (mLastWeight * positionDelta);
|
||||
joint->setPosition(newPosition);
|
||||
}
|
||||
|
||||
if (mLastWeight != mCurWeight && !mIsAnimating)
|
||||
{
|
||||
mAvatar->setSkeletonSerialNum(mAvatar->getSkeletonSerialNum() + 1);
|
||||
}
|
||||
mLastWeight = mCurWeight;
|
||||
}
|
||||
|
||||
|
||||
LLPolyMorphData *clone_morph_param_duplicate(const LLPolyMorphData *src_data,
|
||||
const std::string &name)
|
||||
{
|
||||
LLPolyMorphData* cloned_morph_data = new LLPolyMorphData(*src_data);
|
||||
cloned_morph_data->mName = name;
|
||||
for (U32 v=0; v < cloned_morph_data->mNumIndices; v++)
|
||||
{
|
||||
cloned_morph_data->mCoords[v] = src_data->mCoords[v];
|
||||
cloned_morph_data->mNormals[v] = src_data->mNormals[v];
|
||||
cloned_morph_data->mBinormals[v] = src_data->mBinormals[v];
|
||||
}
|
||||
return cloned_morph_data;
|
||||
}
|
||||
|
||||
LLPolyMorphData *clone_morph_param_direction(const LLPolyMorphData *src_data,
|
||||
const LLVector3 &direction,
|
||||
const std::string &name)
|
||||
{
|
||||
LLPolyMorphData* cloned_morph_data = new LLPolyMorphData(*src_data);
|
||||
cloned_morph_data->mName = name;
|
||||
LLVector4a dir;
|
||||
dir.load3(direction.mV);
|
||||
|
||||
for (U32 v=0; v < cloned_morph_data->mNumIndices; v++)
|
||||
{
|
||||
cloned_morph_data->mCoords[v] = dir;
|
||||
cloned_morph_data->mNormals[v].clear();
|
||||
cloned_morph_data->mBinormals[v].clear();
|
||||
}
|
||||
return cloned_morph_data;
|
||||
}
|
||||
|
||||
LLPolyMorphData *clone_morph_param_cleavage(const LLPolyMorphData *src_data,
|
||||
F32 scale,
|
||||
const std::string &name)
|
||||
{
|
||||
LLPolyMorphData* cloned_morph_data = new LLPolyMorphData(*src_data);
|
||||
cloned_morph_data->mName = name;
|
||||
|
||||
LLVector4a sc;
|
||||
sc.splat(scale);
|
||||
|
||||
LLVector4a nsc;
|
||||
nsc.set(scale, -scale, scale, scale);
|
||||
|
||||
for (U32 v=0; v < cloned_morph_data->mNumIndices; v++)
|
||||
{
|
||||
if (cloned_morph_data->mCoords[v][1] < 0)
|
||||
{
|
||||
cloned_morph_data->mCoords[v].setMul(src_data->mCoords[v],nsc);
|
||||
cloned_morph_data->mNormals[v].setMul(src_data->mNormals[v],nsc);
|
||||
cloned_morph_data->mBinormals[v].setMul(src_data->mBinormals[v],nsc);
|
||||
}
|
||||
else
|
||||
{
|
||||
cloned_morph_data->mCoords[v].setMul(src_data->mCoords[v],sc);
|
||||
cloned_morph_data->mNormals[v].setMul(src_data->mNormals[v], sc);
|
||||
cloned_morph_data->mBinormals[v].setMul(src_data->mBinormals[v],sc);
|
||||
}
|
||||
}
|
||||
return cloned_morph_data;
|
||||
}
|
||||
|
||||
// End
|
||||
|
|
@ -24,8 +24,8 @@
|
|||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#ifndef LL_LLPOLYMESH_H
|
||||
#define LL_LLPOLYMESH_H
|
||||
#ifndef LL_LLPOLYMESHINTERFACE_H
|
||||
#define LL_LLPOLYMESHINTERFACE_H
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
|
@ -39,7 +39,7 @@
|
|||
//#include "lldarray.h"
|
||||
|
||||
class LLSkinJoint;
|
||||
class LLVOAvatar;
|
||||
class LLAvatarAppearance;
|
||||
class LLWearable;
|
||||
|
||||
//#define USE_STRIPS // Use tri-strips for rendering.
|
||||
|
|
@ -319,8 +319,8 @@ public:
|
|||
|
||||
BOOL isLOD() { return mSharedData && mSharedData->isLOD(); }
|
||||
|
||||
void setAvatar(LLVOAvatar* avatarp) { mAvatarp = avatarp; }
|
||||
LLVOAvatar* getAvatar() { return mAvatarp; }
|
||||
void setAvatar(LLAvatarAppearance* avatarp) { mAvatarp = avatarp; }
|
||||
LLAvatarAppearance* getAvatar() { return mAvatarp; }
|
||||
|
||||
LLDynamicArray<LLJointRenderData*> mJointRenderData;
|
||||
|
||||
|
|
@ -362,90 +362,8 @@ protected:
|
|||
static LLPolyMeshSharedDataTable sGlobalSharedMeshList;
|
||||
|
||||
// Backlink only; don't make this an LLPointer.
|
||||
LLVOAvatar* mAvatarp;
|
||||
LLAvatarAppearance* mAvatarp;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLPolySkeletalDeformationInfo
|
||||
// Shared information for LLPolySkeletalDeformations
|
||||
//-----------------------------------------------------------------------------
|
||||
struct LLPolySkeletalBoneInfo
|
||||
{
|
||||
LLPolySkeletalBoneInfo(std::string &name, LLVector3 &scale, LLVector3 &pos, BOOL haspos)
|
||||
: mBoneName(name),
|
||||
mScaleDeformation(scale),
|
||||
mPositionDeformation(pos),
|
||||
mHasPositionDeformation(haspos) {}
|
||||
std::string mBoneName;
|
||||
LLVector3 mScaleDeformation;
|
||||
LLVector3 mPositionDeformation;
|
||||
BOOL mHasPositionDeformation;
|
||||
};
|
||||
|
||||
class LLPolySkeletalDistortionInfo : public LLViewerVisualParamInfo
|
||||
{
|
||||
friend class LLPolySkeletalDistortion;
|
||||
public:
|
||||
LLPolySkeletalDistortionInfo();
|
||||
/*virtual*/ ~LLPolySkeletalDistortionInfo() {};
|
||||
|
||||
/*virtual*/ BOOL parseXml(LLXmlTreeNode* node);
|
||||
|
||||
protected:
|
||||
typedef std::vector<LLPolySkeletalBoneInfo> bone_info_list_t;
|
||||
bone_info_list_t mBoneInfoList;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLPolySkeletalDeformation
|
||||
// A set of joint scale data for deforming the avatar mesh
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
LL_ALIGN_PREFIX(16)
|
||||
class LLPolySkeletalDistortion : public LLViewerVisualParam
|
||||
{
|
||||
public:
|
||||
LLPolySkeletalDistortion(LLVOAvatar *avatarp);
|
||||
~LLPolySkeletalDistortion();
|
||||
|
||||
void* operator new(size_t size)
|
||||
{
|
||||
return ll_aligned_malloc_16(size);
|
||||
}
|
||||
|
||||
void operator delete(void* ptr)
|
||||
{
|
||||
ll_aligned_free_16(ptr);
|
||||
}
|
||||
|
||||
// Special: These functions are overridden by child classes
|
||||
LLPolySkeletalDistortionInfo* getInfo() const { return (LLPolySkeletalDistortionInfo*)mInfo; }
|
||||
// This sets mInfo and calls initialization functions
|
||||
BOOL setInfo(LLPolySkeletalDistortionInfo *info);
|
||||
|
||||
/*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable) const;
|
||||
|
||||
// LLVisualParam Virtual functions
|
||||
///*virtual*/ BOOL parseData(LLXmlTreeNode* node);
|
||||
/*virtual*/ void apply( ESex sex );
|
||||
|
||||
// LLViewerVisualParam Virtual functions
|
||||
/*virtual*/ F32 getTotalDistortion() { return 0.1f; }
|
||||
/*virtual*/ const LLVector4a& getAvgDistortion() { return mDefaultVec; }
|
||||
/*virtual*/ F32 getMaxDistortion() { return 0.1f; }
|
||||
/*virtual*/ LLVector4a getVertexDistortion(S32 index, LLPolyMesh *poly_mesh){return LLVector4a(0.001f, 0.001f, 0.001f);}
|
||||
/*virtual*/ const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh){index = 0; poly_mesh = NULL; return &mDefaultVec;};
|
||||
/*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh){index = 0; poly_mesh = NULL; return NULL;};
|
||||
|
||||
protected:
|
||||
LL_ALIGN_16(LLVector4a mDefaultVec);
|
||||
|
||||
typedef std::map<LLJoint*, LLVector3> joint_vec_map_t;
|
||||
joint_vec_map_t mJointScales;
|
||||
joint_vec_map_t mJointOffsets;
|
||||
// Backlink only; don't make this an LLPointer.
|
||||
LLVOAvatar *mAvatar;
|
||||
} LL_ALIGN_POSTFIX(16);
|
||||
|
||||
#endif // LL_LLPOLYMESH_H
|
||||
#endif // LL_LLPOLYMESHINTERFACE_H
|
||||
|
||||
|
|
@ -27,13 +27,14 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Header Files
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
|
||||
#include "llpolymorph.h"
|
||||
#include "llvoavatar.h"
|
||||
#include "llavatarappearance.h"
|
||||
#include "llavatarjoint.h"
|
||||
#include "llwearable.h"
|
||||
#include "llxmltree.h"
|
||||
#include "llendianswizzle.h"
|
||||
#include "llpolymesh.h"
|
||||
|
||||
//#include "../tools/imdebug/imdebug.h"
|
||||
|
||||
|
|
@ -343,7 +344,7 @@ BOOL LLPolyMorphTarget::setInfo(LLPolyMorphTargetInfo* info)
|
|||
mID = info->mID;
|
||||
setWeight(getDefaultWeight(), FALSE );
|
||||
|
||||
LLVOAvatar* avatarp = mMesh->getAvatar();
|
||||
LLAvatarAppearance* avatarp = mMesh->getAvatar();
|
||||
LLPolyMorphTargetInfo::volume_info_list_t::iterator iter;
|
||||
for (iter = getInfo()->mVolumeInfoList.begin(); iter != getInfo()->mVolumeInfoList.end(); iter++)
|
||||
{
|
||||
|
|
@ -32,10 +32,10 @@
|
|||
|
||||
#include "llviewervisualparam.h"
|
||||
|
||||
class LLAvatarJointCollisionVolume;
|
||||
class LLPolyMeshSharedData;
|
||||
class LLVOAvatar;
|
||||
class LLVector2;
|
||||
class LLViewerJointCollisionVolume;
|
||||
class LLAvatarJointCollisionVolume;
|
||||
class LLWearable;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -119,10 +119,10 @@ struct LLPolyVolumeMorphInfo
|
|||
|
||||
struct LLPolyVolumeMorph
|
||||
{
|
||||
LLPolyVolumeMorph(LLViewerJointCollisionVolume* volume, LLVector3 scale, LLVector3 pos)
|
||||
LLPolyVolumeMorph(LLAvatarJointCollisionVolume* volume, LLVector3 scale, LLVector3 pos)
|
||||
: mVolume(volume), mScale(scale), mPos(pos) {};
|
||||
|
||||
LLViewerJointCollisionVolume* mVolume;
|
||||
LLAvatarJointCollisionVolume* mVolume;
|
||||
LLVector3 mScale;
|
||||
LLVector3 mPos;
|
||||
};
|
||||
|
|
@ -0,0 +1,293 @@
|
|||
/**
|
||||
* @file llpolyskeletaldistortion.cpp
|
||||
* @brief Implementation of LLPolySkeletalDistortion classes
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Header Files
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "llpreprocessor.h"
|
||||
#include "llerrorlegacy.h"
|
||||
//#include "llcommon.h"
|
||||
//#include "llmemory.h"
|
||||
#include "llavatarappearance.h"
|
||||
#include "llavatarjoint.h"
|
||||
#include "llpolymorph.h"
|
||||
//#include "llviewercontrol.h"
|
||||
//#include "llxmltree.h"
|
||||
//#include "llvoavatar.h"
|
||||
#include "llwearable.h"
|
||||
//#include "lldir.h"
|
||||
//#include "llvolume.h"
|
||||
//#include "llendianswizzle.h"
|
||||
|
||||
#include "llpolyskeletaldistortion.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLPolySkeletalDistortionInfo()
|
||||
//-----------------------------------------------------------------------------
|
||||
LLPolySkeletalDistortionInfo::LLPolySkeletalDistortionInfo()
|
||||
{
|
||||
}
|
||||
|
||||
BOOL LLPolySkeletalDistortionInfo::parseXml(LLXmlTreeNode* node)
|
||||
{
|
||||
llassert( node->hasName( "param" ) && node->getChildByName( "param_skeleton" ) );
|
||||
|
||||
if (!LLViewerVisualParamInfo::parseXml(node))
|
||||
return FALSE;
|
||||
|
||||
LLXmlTreeNode* skeletalParam = node->getChildByName("param_skeleton");
|
||||
|
||||
if (NULL == skeletalParam)
|
||||
{
|
||||
llwarns << "Failed to getChildByName(\"param_skeleton\")"
|
||||
<< llendl;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for( LLXmlTreeNode* bone = skeletalParam->getFirstChild(); bone; bone = skeletalParam->getNextChild() )
|
||||
{
|
||||
if (bone->hasName("bone"))
|
||||
{
|
||||
std::string name;
|
||||
LLVector3 scale;
|
||||
LLVector3 pos;
|
||||
BOOL haspos = FALSE;
|
||||
|
||||
static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name");
|
||||
if (!bone->getFastAttributeString(name_string, name))
|
||||
{
|
||||
llwarns << "No bone name specified for skeletal param." << llendl;
|
||||
continue;
|
||||
}
|
||||
|
||||
static LLStdStringHandle scale_string = LLXmlTree::addAttributeString("scale");
|
||||
if (!bone->getFastAttributeVector3(scale_string, scale))
|
||||
{
|
||||
llwarns << "No scale specified for bone " << name << "." << llendl;
|
||||
continue;
|
||||
}
|
||||
|
||||
// optional offset deformation (translation)
|
||||
static LLStdStringHandle offset_string = LLXmlTree::addAttributeString("offset");
|
||||
if (bone->getFastAttributeVector3(offset_string, pos))
|
||||
{
|
||||
haspos = TRUE;
|
||||
}
|
||||
mBoneInfoList.push_back(LLPolySkeletalBoneInfo(name, scale, pos, haspos));
|
||||
}
|
||||
else
|
||||
{
|
||||
llwarns << "Unrecognized element " << bone->getName() << " in skeletal distortion" << llendl;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLPolySkeletalDistortion()
|
||||
//-----------------------------------------------------------------------------
|
||||
LLPolySkeletalDistortion::LLPolySkeletalDistortion(LLAvatarAppearance *avatarp)
|
||||
{
|
||||
mAvatar = avatarp;
|
||||
mDefaultVec.splat(0.001f);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// ~LLPolySkeletalDistortion()
|
||||
//-----------------------------------------------------------------------------
|
||||
LLPolySkeletalDistortion::~LLPolySkeletalDistortion()
|
||||
{
|
||||
}
|
||||
|
||||
BOOL LLPolySkeletalDistortion::setInfo(LLPolySkeletalDistortionInfo *info)
|
||||
{
|
||||
llassert(mInfo == NULL);
|
||||
if (info->mID < 0)
|
||||
return FALSE;
|
||||
mInfo = info;
|
||||
mID = info->mID;
|
||||
setWeight(getDefaultWeight(), FALSE );
|
||||
|
||||
LLPolySkeletalDistortionInfo::bone_info_list_t::iterator iter;
|
||||
for (iter = getInfo()->mBoneInfoList.begin(); iter != getInfo()->mBoneInfoList.end(); iter++)
|
||||
{
|
||||
LLPolySkeletalBoneInfo *bone_info = &(*iter);
|
||||
LLJoint* joint = mAvatar->getJoint(bone_info->mBoneName);
|
||||
if (!joint)
|
||||
{
|
||||
llwarns << "Joint " << bone_info->mBoneName << " not found." << llendl;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (mJointScales.find(joint) != mJointScales.end())
|
||||
{
|
||||
llwarns << "Scale deformation already supplied for joint " << joint->getName() << "." << llendl;
|
||||
}
|
||||
|
||||
// store it
|
||||
mJointScales[joint] = bone_info->mScaleDeformation;
|
||||
|
||||
// apply to children that need to inherit it
|
||||
for (LLJoint::child_list_t::iterator iter = joint->mChildren.begin();
|
||||
iter != joint->mChildren.end(); ++iter)
|
||||
{
|
||||
LLAvatarJoint* child_joint = (LLAvatarJoint*)(*iter);
|
||||
if (child_joint->inheritScale())
|
||||
{
|
||||
LLVector3 childDeformation = LLVector3(child_joint->getScale());
|
||||
childDeformation.scaleVec(bone_info->mScaleDeformation);
|
||||
mJointScales[child_joint] = childDeformation;
|
||||
}
|
||||
}
|
||||
|
||||
if (bone_info->mHasPositionDeformation)
|
||||
{
|
||||
if (mJointOffsets.find(joint) != mJointOffsets.end())
|
||||
{
|
||||
llwarns << "Offset deformation already supplied for joint " << joint->getName() << "." << llendl;
|
||||
}
|
||||
mJointOffsets[joint] = bone_info->mPositionDeformation;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*virtual*/ LLViewerVisualParam* LLPolySkeletalDistortion::cloneParam(LLWearable* wearable) const
|
||||
{
|
||||
LLPolySkeletalDistortion *new_param = new LLPolySkeletalDistortion(mAvatar);
|
||||
*new_param = *this;
|
||||
return new_param;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// apply()
|
||||
//-----------------------------------------------------------------------------
|
||||
static LLFastTimer::DeclareTimer FTM_POLYSKELETAL_DISTORTION_APPLY("Skeletal Distortion");
|
||||
|
||||
void LLPolySkeletalDistortion::apply( ESex avatar_sex )
|
||||
{
|
||||
LLFastTimer t(FTM_POLYSKELETAL_DISTORTION_APPLY);
|
||||
|
||||
F32 effective_weight = ( getSex() & avatar_sex ) ? mCurWeight : getDefaultWeight();
|
||||
|
||||
LLJoint* joint;
|
||||
joint_vec_map_t::iterator iter;
|
||||
|
||||
for (iter = mJointScales.begin();
|
||||
iter != mJointScales.end();
|
||||
iter++)
|
||||
{
|
||||
joint = iter->first;
|
||||
LLVector3 newScale = joint->getScale();
|
||||
LLVector3 scaleDelta = iter->second;
|
||||
newScale = newScale + (effective_weight * scaleDelta) - (mLastWeight * scaleDelta);
|
||||
joint->setScale(newScale);
|
||||
}
|
||||
|
||||
for (iter = mJointOffsets.begin();
|
||||
iter != mJointOffsets.end();
|
||||
iter++)
|
||||
{
|
||||
joint = iter->first;
|
||||
LLVector3 newPosition = joint->getPosition();
|
||||
LLVector3 positionDelta = iter->second;
|
||||
newPosition = newPosition + (effective_weight * positionDelta) - (mLastWeight * positionDelta);
|
||||
joint->setPosition(newPosition);
|
||||
}
|
||||
|
||||
if (mLastWeight != mCurWeight && !mIsAnimating)
|
||||
{
|
||||
mAvatar->setSkeletonSerialNum(mAvatar->getSkeletonSerialNum() + 1);
|
||||
}
|
||||
mLastWeight = mCurWeight;
|
||||
}
|
||||
|
||||
|
||||
LLPolyMorphData *clone_morph_param_duplicate(const LLPolyMorphData *src_data,
|
||||
const std::string &name)
|
||||
{
|
||||
LLPolyMorphData* cloned_morph_data = new LLPolyMorphData(*src_data);
|
||||
cloned_morph_data->mName = name;
|
||||
for (U32 v=0; v < cloned_morph_data->mNumIndices; v++)
|
||||
{
|
||||
cloned_morph_data->mCoords[v] = src_data->mCoords[v];
|
||||
cloned_morph_data->mNormals[v] = src_data->mNormals[v];
|
||||
cloned_morph_data->mBinormals[v] = src_data->mBinormals[v];
|
||||
}
|
||||
return cloned_morph_data;
|
||||
}
|
||||
|
||||
LLPolyMorphData *clone_morph_param_direction(const LLPolyMorphData *src_data,
|
||||
const LLVector3 &direction,
|
||||
const std::string &name)
|
||||
{
|
||||
LLPolyMorphData* cloned_morph_data = new LLPolyMorphData(*src_data);
|
||||
cloned_morph_data->mName = name;
|
||||
LLVector4a dir;
|
||||
dir.load3(direction.mV);
|
||||
|
||||
for (U32 v=0; v < cloned_morph_data->mNumIndices; v++)
|
||||
{
|
||||
cloned_morph_data->mCoords[v] = dir;
|
||||
cloned_morph_data->mNormals[v].clear();
|
||||
cloned_morph_data->mBinormals[v].clear();
|
||||
}
|
||||
return cloned_morph_data;
|
||||
}
|
||||
|
||||
LLPolyMorphData *clone_morph_param_cleavage(const LLPolyMorphData *src_data,
|
||||
F32 scale,
|
||||
const std::string &name)
|
||||
{
|
||||
LLPolyMorphData* cloned_morph_data = new LLPolyMorphData(*src_data);
|
||||
cloned_morph_data->mName = name;
|
||||
|
||||
LLVector4a sc;
|
||||
sc.splat(scale);
|
||||
|
||||
LLVector4a nsc;
|
||||
nsc.set(scale, -scale, scale, scale);
|
||||
|
||||
for (U32 v=0; v < cloned_morph_data->mNumIndices; v++)
|
||||
{
|
||||
if (cloned_morph_data->mCoords[v][1] < 0)
|
||||
{
|
||||
cloned_morph_data->mCoords[v].setMul(src_data->mCoords[v],nsc);
|
||||
cloned_morph_data->mNormals[v].setMul(src_data->mNormals[v],nsc);
|
||||
cloned_morph_data->mBinormals[v].setMul(src_data->mBinormals[v],nsc);
|
||||
}
|
||||
else
|
||||
{
|
||||
cloned_morph_data->mCoords[v].setMul(src_data->mCoords[v],sc);
|
||||
cloned_morph_data->mNormals[v].setMul(src_data->mNormals[v], sc);
|
||||
cloned_morph_data->mBinormals[v].setMul(src_data->mBinormals[v],sc);
|
||||
}
|
||||
}
|
||||
return cloned_morph_data;
|
||||
}
|
||||
|
||||
// End
|
||||
|
|
@ -0,0 +1,131 @@
|
|||
/**
|
||||
* @file llpolyskeletaldistortion.h
|
||||
* @brief Implementation of LLPolyMesh class
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#ifndef LL_LLPOLYSKELETALDISTORTION_H
|
||||
#define LL_LLPOLYSKELETALDISTORTION_H
|
||||
|
||||
#include "llcommon.h"
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include "llstl.h"
|
||||
|
||||
#include "v3math.h"
|
||||
#include "v2math.h"
|
||||
#include "llquaternion.h"
|
||||
//#include "llpolymorph.h"
|
||||
#include "lljoint.h"
|
||||
#include "llviewervisualparam.h"
|
||||
//#include "lldarray.h"
|
||||
|
||||
//class LLSkinJoint;
|
||||
class LLAvatarAppearance;
|
||||
|
||||
//#define USE_STRIPS // Use tri-strips for rendering.
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLPolySkeletalDeformationInfo
|
||||
// Shared information for LLPolySkeletalDeformations
|
||||
//-----------------------------------------------------------------------------
|
||||
struct LLPolySkeletalBoneInfo
|
||||
{
|
||||
LLPolySkeletalBoneInfo(std::string &name, LLVector3 &scale, LLVector3 &pos, BOOL haspos)
|
||||
: mBoneName(name),
|
||||
mScaleDeformation(scale),
|
||||
mPositionDeformation(pos),
|
||||
mHasPositionDeformation(haspos) {}
|
||||
std::string mBoneName;
|
||||
LLVector3 mScaleDeformation;
|
||||
LLVector3 mPositionDeformation;
|
||||
BOOL mHasPositionDeformation;
|
||||
};
|
||||
|
||||
LL_ALIGN_PREFIX(16)
|
||||
class LLPolySkeletalDistortionInfo : public LLViewerVisualParamInfo
|
||||
{
|
||||
friend class LLPolySkeletalDistortion;
|
||||
public:
|
||||
|
||||
LLPolySkeletalDistortionInfo();
|
||||
/*virtual*/ ~LLPolySkeletalDistortionInfo() {};
|
||||
|
||||
/*virtual*/ BOOL parseXml(LLXmlTreeNode* node);
|
||||
|
||||
protected:
|
||||
typedef std::vector<LLPolySkeletalBoneInfo> bone_info_list_t;
|
||||
bone_info_list_t mBoneInfoList;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLPolySkeletalDeformation
|
||||
// A set of joint scale data for deforming the avatar mesh
|
||||
//-----------------------------------------------------------------------------
|
||||
class LLPolySkeletalDistortion : public LLViewerVisualParam
|
||||
{
|
||||
public:
|
||||
void* operator new(size_t size)
|
||||
{
|
||||
return ll_aligned_malloc_16(size);
|
||||
}
|
||||
|
||||
void operator delete(void* ptr)
|
||||
{
|
||||
ll_aligned_free_16(ptr);
|
||||
}
|
||||
|
||||
LLPolySkeletalDistortion(LLAvatarAppearance *avatarp);
|
||||
~LLPolySkeletalDistortion();
|
||||
|
||||
// Special: These functions are overridden by child classes
|
||||
LLPolySkeletalDistortionInfo* getInfo() const { return (LLPolySkeletalDistortionInfo*)mInfo; }
|
||||
// This sets mInfo and calls initialization functions
|
||||
BOOL setInfo(LLPolySkeletalDistortionInfo *info);
|
||||
|
||||
/*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable) const;
|
||||
|
||||
// LLVisualParam Virtual functions
|
||||
///*virtual*/ BOOL parseData(LLXmlTreeNode* node);
|
||||
/*virtual*/ void apply( ESex sex );
|
||||
|
||||
// LLViewerVisualParam Virtual functions
|
||||
/*virtual*/ F32 getTotalDistortion() { return 0.1f; }
|
||||
/*virtual*/ const LLVector4a& getAvgDistortion() { return mDefaultVec; }
|
||||
/*virtual*/ F32 getMaxDistortion() { return 0.1f; }
|
||||
/*virtual*/ LLVector4a getVertexDistortion(S32 index, LLPolyMesh *poly_mesh){return LLVector4a(0.001f, 0.001f, 0.001f);}
|
||||
/*virtual*/ const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh){index = 0; poly_mesh = NULL; return &mDefaultVec;};
|
||||
/*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh){index = 0; poly_mesh = NULL; return NULL;};
|
||||
|
||||
protected:
|
||||
LL_ALIGN_16(LLVector4a mDefaultVec);
|
||||
typedef std::map<LLJoint*, LLVector3> joint_vec_map_t;
|
||||
joint_vec_map_t mJointScales;
|
||||
joint_vec_map_t mJointOffsets;
|
||||
// Backlink only; don't make this an LLPointer.
|
||||
LLAvatarAppearance *mAvatar;
|
||||
} LL_ALIGN_POSTFIX(16);
|
||||
|
||||
#endif // LL_LLPOLYSKELETALDISTORTION_H
|
||||
|
||||
|
|
@ -24,20 +24,20 @@
|
|||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
#include "llagent.h"
|
||||
#include "linden_common.h"
|
||||
#include "llavatarappearance.h"
|
||||
#include "lltexlayer.h"
|
||||
#include "llvoavatar.h"
|
||||
#include "llwearable.h"
|
||||
#include "lltexglobalcolor.h"
|
||||
|
||||
class LLWearable;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLTexGlobalColor
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
LLTexGlobalColor::LLTexGlobalColor(LLVOAvatar* avatar)
|
||||
LLTexGlobalColor::LLTexGlobalColor(LLAvatarAppearance* appearance)
|
||||
:
|
||||
mAvatar(avatar),
|
||||
mAvatarAppearance(appearance),
|
||||
mInfo(NULL)
|
||||
{
|
||||
}
|
||||
|
|
@ -91,7 +91,7 @@ const std::string& LLTexGlobalColor::getName() const
|
|||
// LLTexParamGlobalColor
|
||||
//-----------------------------------------------------------------------------
|
||||
LLTexParamGlobalColor::LLTexParamGlobalColor(LLTexGlobalColor* tex_global_color) :
|
||||
LLTexLayerParamColor(tex_global_color->getAvatar()),
|
||||
LLTexLayerParamColor(tex_global_color->getAvatarAppearance()),
|
||||
mTexGlobalColor(tex_global_color)
|
||||
{
|
||||
}
|
||||
|
|
@ -105,7 +105,7 @@ LLTexParamGlobalColor::LLTexParamGlobalColor(LLTexGlobalColor* tex_global_color)
|
|||
|
||||
void LLTexParamGlobalColor::onGlobalColorChanged(bool upload_bake)
|
||||
{
|
||||
mAvatar->onGlobalColorChanged(mTexGlobalColor, upload_bake);
|
||||
mAvatarAppearance->onGlobalColorChanged(mTexGlobalColor, upload_bake);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* @file lltexglobalcolor.h
|
||||
* @brief This is global texture color info used by llvoavatar.
|
||||
* @brief This is global texture color info used by llavatarappearance.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
|
|
@ -30,31 +30,31 @@
|
|||
#include "lltexlayer.h"
|
||||
#include "lltexlayerparams.h"
|
||||
|
||||
class LLVOAvatar;
|
||||
class LLAvatarAppearance;
|
||||
class LLWearable;
|
||||
class LLTexGlobalColorInfo;
|
||||
|
||||
class LLTexGlobalColor
|
||||
{
|
||||
public:
|
||||
LLTexGlobalColor( LLVOAvatar* avatar );
|
||||
LLTexGlobalColor( LLAvatarAppearance* appearance );
|
||||
~LLTexGlobalColor();
|
||||
|
||||
LLTexGlobalColorInfo* getInfo() const { return mInfo; }
|
||||
// This sets mInfo and calls initialization functions
|
||||
BOOL setInfo(LLTexGlobalColorInfo *info);
|
||||
|
||||
LLVOAvatar* getAvatar() const { return mAvatar; }
|
||||
LLAvatarAppearance* getAvatarAppearance() const { return mAvatarAppearance; }
|
||||
LLColor4 getColor() const;
|
||||
const std::string& getName() const;
|
||||
|
||||
private:
|
||||
param_color_list_t mParamGlobalColorList;
|
||||
LLVOAvatar* mAvatar; // just backlink, don't LLPointer
|
||||
LLAvatarAppearance* mAvatarAppearance; // just backlink, don't LLPointer
|
||||
LLTexGlobalColorInfo *mInfo;
|
||||
};
|
||||
|
||||
// Used by llvoavatar to determine skin/eye/hair color.
|
||||
// Used by llavatarappearance to determine skin/eye/hair color.
|
||||
class LLTexGlobalColorInfo
|
||||
{
|
||||
friend class LLTexGlobalColor;
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -28,14 +28,15 @@
|
|||
#define LL_LLTEXLAYER_H
|
||||
|
||||
#include <deque>
|
||||
#include "lldynamictexture.h"
|
||||
#include "llvoavatardefines.h"
|
||||
#include "llglslshader.h"
|
||||
#include "llgltexture.h"
|
||||
#include "llavatarappearancedefines.h"
|
||||
#include "lltexlayerparams.h"
|
||||
|
||||
class LLVOAvatar;
|
||||
class LLVOAvatarSelf;
|
||||
class LLAvatarAppearance;
|
||||
class LLImageTGA;
|
||||
class LLImageRaw;
|
||||
class LLLocalTextureObject;
|
||||
class LLXmlTreeNode;
|
||||
class LLTexLayerSet;
|
||||
class LLTexLayerSetInfo;
|
||||
|
|
@ -71,6 +72,8 @@ public:
|
|||
|
||||
const LLTexLayerInfo* getInfo() const { return mInfo; }
|
||||
virtual BOOL setInfo(const LLTexLayerInfo *info, LLWearable* wearable); // sets mInfo, calls initialization functions
|
||||
LLWearableType::EType getWearableType() const;
|
||||
LLAvatarAppearanceDefines::ETextureIndex getLocalTextureIndex() const;
|
||||
|
||||
const std::string& getName() const;
|
||||
const LLTexLayerSet* const getTexLayerSet() const { return mTexLayerSet; }
|
||||
|
|
@ -88,6 +91,8 @@ public:
|
|||
ERenderPass getRenderPass() const;
|
||||
BOOL isVisibilityMask() const;
|
||||
|
||||
virtual void asLLSD(LLSD& sd) const {}
|
||||
|
||||
protected:
|
||||
const std::string& getGlobalColor() const;
|
||||
LLViewerVisualParam* getVisualParamPtr(S32 index) const;
|
||||
|
|
@ -113,7 +118,7 @@ protected:
|
|||
class LLTexLayerTemplate : public LLTexLayerInterface
|
||||
{
|
||||
public:
|
||||
LLTexLayerTemplate(LLTexLayerSet* const layer_set);
|
||||
LLTexLayerTemplate(LLTexLayerSet* const layer_set, LLAvatarAppearance* const appearance);
|
||||
LLTexLayerTemplate(const LLTexLayerTemplate &layer);
|
||||
/*virtual*/ ~LLTexLayerTemplate();
|
||||
/*virtual*/ BOOL render(S32 x, S32 y, S32 width, S32 height);
|
||||
|
|
@ -126,7 +131,9 @@ public:
|
|||
protected:
|
||||
U32 updateWearableCache() const;
|
||||
LLTexLayer* getLayer(U32 i) const;
|
||||
LLAvatarAppearance* getAvatarAppearance() const { return mAvatarAppearance; }
|
||||
private:
|
||||
LLAvatarAppearance* const mAvatarAppearance; // note: backlink only; don't make this an LLPointer.
|
||||
typedef std::vector<LLWearable*> wearable_cache_t;
|
||||
mutable wearable_cache_t mWearableCache; // mutable b/c most get- require updating this cache
|
||||
};
|
||||
|
|
@ -153,17 +160,18 @@ public:
|
|||
BOOL findNetColor(LLColor4* color) const;
|
||||
/*virtual*/ BOOL blendAlphaTexture(S32 x, S32 y, S32 width, S32 height); // Multiplies a single alpha texture against the frame buffer
|
||||
/*virtual*/ void gatherAlphaMasks(U8 *data, S32 originX, S32 originY, S32 width, S32 height);
|
||||
BOOL renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLColor4 &layer_color);
|
||||
void renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLColor4 &layer_color, bool force_render);
|
||||
void addAlphaMask(U8 *data, S32 originX, S32 originY, S32 width, S32 height);
|
||||
/*virtual*/ BOOL isInvisibleAlphaMask() const;
|
||||
|
||||
void setLTO(LLLocalTextureObject *lto) { mLocalTextureObject = lto; }
|
||||
LLLocalTextureObject* getLTO() { return mLocalTextureObject; }
|
||||
|
||||
/*virtual*/ void asLLSD(LLSD& sd) const;
|
||||
|
||||
static void calculateTexLayerColor(const param_color_list_t ¶m_list, LLColor4 &net_color);
|
||||
protected:
|
||||
LLUUID getUUID() const;
|
||||
private:
|
||||
typedef std::map<U32, U8*> alpha_cache_t;
|
||||
alpha_cache_t mAlphaCache;
|
||||
LLLocalTextureObject* mLocalTextureObject;
|
||||
|
|
@ -179,8 +187,14 @@ class LLTexLayerSet
|
|||
{
|
||||
friend class LLTexLayerSetBuffer;
|
||||
public:
|
||||
LLTexLayerSet(LLVOAvatarSelf* const avatar);
|
||||
~LLTexLayerSet();
|
||||
LLTexLayerSet(LLAvatarAppearance* const appearance);
|
||||
virtual ~LLTexLayerSet();
|
||||
|
||||
LLTexLayerSetBuffer* getComposite();
|
||||
const LLTexLayerSetBuffer* getComposite() const; // Do not create one if it doesn't exist.
|
||||
virtual void createComposite() = 0;
|
||||
void destroyComposite();
|
||||
void gatherMorphMaskAlpha(U8 *data, S32 origin_x, S32 origin_y, S32 width, S32 height);
|
||||
|
||||
const LLTexLayerSetInfo* getInfo() const { return mInfo; }
|
||||
BOOL setInfo(const LLTexLayerSetInfo *info); // This sets mInfo and calls initialization functions
|
||||
|
|
@ -189,45 +203,34 @@ public:
|
|||
void renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height, bool forceClear = false);
|
||||
|
||||
BOOL isBodyRegion(const std::string& region) const;
|
||||
LLTexLayerSetBuffer* getComposite();
|
||||
const LLTexLayerSetBuffer* getComposite() const; // Do not create one if it doesn't exist.
|
||||
void requestUpdate();
|
||||
void requestUpload();
|
||||
void cancelUpload();
|
||||
void updateComposite();
|
||||
BOOL isLocalTextureDataAvailable() const;
|
||||
BOOL isLocalTextureDataFinal() const;
|
||||
void createComposite();
|
||||
void destroyComposite();
|
||||
void setUpdatesEnabled(BOOL b);
|
||||
BOOL getUpdatesEnabled() const { return mUpdatesEnabled; }
|
||||
void deleteCaches();
|
||||
void gatherMorphMaskAlpha(U8 *data, S32 width, S32 height);
|
||||
void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components);
|
||||
BOOL isMorphValid() const;
|
||||
virtual void requestUpdate() = 0;
|
||||
void invalidateMorphMasks();
|
||||
void deleteCaches();
|
||||
LLTexLayerInterface* findLayerByName(const std::string& name);
|
||||
void cloneTemplates(LLLocalTextureObject *lto, LLVOAvatarDefines::ETextureIndex tex_index, LLWearable* wearable);
|
||||
void cloneTemplates(LLLocalTextureObject *lto, LLAvatarAppearanceDefines::ETextureIndex tex_index, LLWearable* wearable);
|
||||
|
||||
LLVOAvatarSelf* getAvatar() const { return mAvatar; }
|
||||
LLAvatarAppearance* getAvatarAppearance() const { return mAvatarAppearance; }
|
||||
const std::string getBodyRegionName() const;
|
||||
BOOL hasComposite() const { return (mComposite.notNull()); }
|
||||
LLVOAvatarDefines::EBakedTextureIndex getBakedTexIndex() { return mBakedTexIndex; }
|
||||
void setBakedTexIndex(LLVOAvatarDefines::EBakedTextureIndex index) { mBakedTexIndex = index; }
|
||||
LLAvatarAppearanceDefines::EBakedTextureIndex getBakedTexIndex() const { return mBakedTexIndex; }
|
||||
void setBakedTexIndex(LLAvatarAppearanceDefines::EBakedTextureIndex index) { mBakedTexIndex = index; }
|
||||
BOOL isVisible() const { return mIsVisible; }
|
||||
|
||||
static BOOL sHasCaches;
|
||||
|
||||
private:
|
||||
virtual void asLLSD(LLSD& sd) const;
|
||||
|
||||
protected:
|
||||
typedef std::vector<LLTexLayerInterface *> layer_list_t;
|
||||
layer_list_t mLayerList;
|
||||
layer_list_t mMaskLayerList;
|
||||
LLPointer<LLTexLayerSetBuffer> mComposite;
|
||||
LLVOAvatarSelf* const mAvatar; // note: backlink only; don't make this an LLPointer.
|
||||
BOOL mUpdatesEnabled;
|
||||
LLAvatarAppearance* const mAvatarAppearance; // note: backlink only; don't make this an LLPointer.
|
||||
BOOL mIsVisible;
|
||||
|
||||
LLVOAvatarDefines::EBakedTextureIndex mBakedTexIndex;
|
||||
LLAvatarAppearanceDefines::EBakedTextureIndex mBakedTexIndex;
|
||||
const LLTexLayerSetInfo* mInfo;
|
||||
};
|
||||
|
||||
|
|
@ -243,8 +246,10 @@ public:
|
|||
LLTexLayerSetInfo();
|
||||
~LLTexLayerSetInfo();
|
||||
BOOL parseXml(LLXmlTreeNode* node);
|
||||
void createVisualParams(LLVOAvatar *avatar);
|
||||
private:
|
||||
void createVisualParams(LLAvatarAppearance *appearance);
|
||||
S32 getWidth() const { return mWidth; }
|
||||
S32 getHeight() const { return mHeight; }
|
||||
protected:
|
||||
std::string mBodyRegion;
|
||||
S32 mWidth;
|
||||
S32 mHeight;
|
||||
|
|
@ -259,78 +264,27 @@ private:
|
|||
//
|
||||
// The composite image that a LLTexLayerSet writes to. Each LLTexLayerSet has one.
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
class LLTexLayerSetBuffer : public LLViewerDynamicTexture
|
||||
class LLTexLayerSetBuffer : public virtual LLRefCount
|
||||
{
|
||||
LOG_CLASS(LLTexLayerSetBuffer);
|
||||
|
||||
public:
|
||||
LLTexLayerSetBuffer(LLTexLayerSet* const owner, S32 width, S32 height);
|
||||
LLTexLayerSetBuffer(LLTexLayerSet* const owner);
|
||||
virtual ~LLTexLayerSetBuffer();
|
||||
|
||||
public:
|
||||
/*virtual*/ S8 getType() const;
|
||||
BOOL isInitialized(void) const;
|
||||
static void dumpTotalByteCount();
|
||||
const std::string dumpTextureInfo() const;
|
||||
virtual void restoreGLTexture();
|
||||
virtual void destroyGLTexture();
|
||||
protected:
|
||||
void pushProjection() const;
|
||||
void popProjection() const;
|
||||
private:
|
||||
LLTexLayerSet* const mTexLayerSet;
|
||||
static S32 sGLByteCount;
|
||||
virtual void preRenderTexLayerSet();
|
||||
virtual void midRenderTexLayerSet(BOOL success) {}
|
||||
virtual void postRenderTexLayerSet(BOOL success);
|
||||
virtual S32 getCompositeOriginX() const = 0;
|
||||
virtual S32 getCompositeOriginY() const = 0;
|
||||
virtual S32 getCompositeWidth() const = 0;
|
||||
virtual S32 getCompositeHeight() const = 0;
|
||||
BOOL renderTexLayerSet();
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Render
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
/*virtual*/ BOOL needsRender();
|
||||
protected:
|
||||
BOOL render(S32 x, S32 y, S32 width, S32 height);
|
||||
virtual void preRender(BOOL clear_depth);
|
||||
virtual void postRender(BOOL success);
|
||||
virtual BOOL render();
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Uploads
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
void requestUpload();
|
||||
void cancelUpload();
|
||||
BOOL uploadNeeded() const; // We need to upload a new texture
|
||||
BOOL uploadInProgress() const; // We have started uploading a new texture and are awaiting the result
|
||||
BOOL uploadPending() const; // We are expecting a new texture to be uploaded at some point
|
||||
static void onTextureUploadComplete(const LLUUID& uuid,
|
||||
void* userdata,
|
||||
S32 result, LLExtStat ext_status);
|
||||
protected:
|
||||
BOOL isReadyToUpload() const;
|
||||
void doUpload(); // Does a read back and upload.
|
||||
void conditionalRestartUploadTimer();
|
||||
private:
|
||||
BOOL mNeedsUpload; // Whether we need to send our baked textures to the server
|
||||
U32 mNumLowresUploads; // Number of times we've sent a lowres version of our baked textures to the server
|
||||
BOOL mUploadPending; // Whether we have received back the new baked textures
|
||||
LLUUID mUploadID; // The current upload process (null if none).
|
||||
LLFrameTimer mNeedsUploadTimer; // Tracks time since upload was requested and performed.
|
||||
S32 mUploadFailCount; // Number of consecutive upload failures
|
||||
LLFrameTimer mUploadRetryTimer; // Tracks time since last upload failure.
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Updates
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
void requestUpdate();
|
||||
BOOL requestUpdateImmediate();
|
||||
protected:
|
||||
BOOL isReadyToUpdate() const;
|
||||
void doUpdate();
|
||||
void restartUpdateTimer();
|
||||
private:
|
||||
BOOL mNeedsUpdate; // Whether we need to locally update our baked textures
|
||||
U32 mNumLowresUpdates; // Number of times we've locally updated with lowres version of our baked textures
|
||||
LLFrameTimer mNeedsUpdateTimer; // Tracks time since update was requested and performed.
|
||||
LLTexLayerSet* const mTexLayerSet;
|
||||
};
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
|
@ -342,7 +296,7 @@ class LLTexLayerStaticImageList : public LLSingleton<LLTexLayerStaticImageList>
|
|||
public:
|
||||
LLTexLayerStaticImageList();
|
||||
~LLTexLayerStaticImageList();
|
||||
LLViewerTexture* getTexture(const std::string& file_name, BOOL is_mask);
|
||||
LLGLTexture* getTexture(const std::string& file_name, BOOL is_mask);
|
||||
LLImageTGA* getImageTGA(const std::string& file_name);
|
||||
void deleteCachedImages();
|
||||
void dumpByteCount() const;
|
||||
|
|
@ -350,7 +304,7 @@ protected:
|
|||
BOOL loadImageRaw(const std::string& file_name, LLImageRaw* image_raw);
|
||||
private:
|
||||
LLStringTable mImageNames;
|
||||
typedef std::map<const char*, LLPointer<LLViewerTexture> > texture_map_t;
|
||||
typedef std::map<const char*, LLPointer<LLGLTexture> > texture_map_t;
|
||||
texture_map_t mStaticImageList;
|
||||
typedef std::map<const char*, LLPointer<LLImageTGA> > image_tga_map_t;
|
||||
image_tga_map_t mStaticImageListTGA;
|
||||
|
|
@ -358,23 +312,4 @@ private:
|
|||
S32 mTGABytes;
|
||||
};
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// LLBakedUploadData
|
||||
//
|
||||
// Used by LLTexLayerSetBuffer for a callback.
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
struct LLBakedUploadData
|
||||
{
|
||||
LLBakedUploadData(const LLVOAvatarSelf* avatar,
|
||||
LLTexLayerSet* layerset,
|
||||
const LLUUID& id,
|
||||
bool highest_res);
|
||||
~LLBakedUploadData() {}
|
||||
const LLUUID mID;
|
||||
const LLVOAvatarSelf* mAvatar; // note: backlink only; don't LLPointer
|
||||
LLTexLayerSet* mTexLayerSet;
|
||||
const U64 mStartTime; // for measuring baked texture upload time
|
||||
const bool mIsHighestRes; // whether this is a "final" bake, or intermediate low res
|
||||
};
|
||||
|
||||
#endif // LL_LLTEXLAYER_H
|
||||
|
|
@ -24,27 +24,28 @@
|
|||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
#include "linden_common.h"
|
||||
|
||||
#include "lltexlayerparams.h"
|
||||
|
||||
#include "llagentcamera.h"
|
||||
#include "llavatarappearance.h"
|
||||
#include "llimagetga.h"
|
||||
#include "llquantize.h"
|
||||
#include "lltexlayer.h"
|
||||
#include "llvoavatarself.h"
|
||||
#include "lltexturemanagerbridge.h"
|
||||
#include "../llui/llui.h"
|
||||
#include "llwearable.h"
|
||||
#include "llui.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLTexLayerParam
|
||||
//-----------------------------------------------------------------------------
|
||||
LLTexLayerParam::LLTexLayerParam(LLTexLayerInterface *layer) :
|
||||
mTexLayer(layer),
|
||||
mAvatar(NULL)
|
||||
mAvatarAppearance(NULL)
|
||||
{
|
||||
if (mTexLayer != NULL)
|
||||
{
|
||||
mAvatar = mTexLayer->getTexLayerSet()->getAvatar();
|
||||
mAvatarAppearance = mTexLayer->getTexLayerSet()->getAvatarAppearance();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -52,20 +53,21 @@ LLTexLayerParam::LLTexLayerParam(LLTexLayerInterface *layer) :
|
|||
}
|
||||
}
|
||||
|
||||
LLTexLayerParam::LLTexLayerParam(LLVOAvatar *avatar) :
|
||||
mTexLayer(NULL)
|
||||
LLTexLayerParam::LLTexLayerParam(LLAvatarAppearance *appearance) :
|
||||
mTexLayer(NULL),
|
||||
mAvatarAppearance(appearance)
|
||||
{
|
||||
mAvatar = avatar;
|
||||
}
|
||||
|
||||
|
||||
BOOL LLTexLayerParam::setInfo(LLViewerVisualParamInfo *info, BOOL add_to_avatar )
|
||||
{
|
||||
BOOL LLTexLayerParam::setInfo(LLViewerVisualParamInfo *info, BOOL add_to_appearance)
|
||||
{
|
||||
LLViewerVisualParam::setInfo(info);
|
||||
|
||||
if (add_to_avatar)
|
||||
if (add_to_appearance)
|
||||
{
|
||||
mAvatar->addVisualParam( this);
|
||||
mAvatarAppearance->addVisualParam( this);
|
||||
this->setParamLocation(mAvatarAppearance->isSelf() ? LOC_AV_SELF : LOC_AV_OTHER);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
|
@ -96,7 +98,7 @@ void LLTexLayerParamAlpha::getCacheByteCount(S32* gl_bytes)
|
|||
iter != sInstances.end(); iter++)
|
||||
{
|
||||
LLTexLayerParamAlpha* instance = *iter;
|
||||
LLViewerTexture* tex = instance->mCachedProcessedTexture;
|
||||
LLGLTexture* tex = instance->mCachedProcessedTexture;
|
||||
if (tex)
|
||||
{
|
||||
S32 bytes = (S32)tex->getWidth() * tex->getHeight() * tex->getComponents();
|
||||
|
|
@ -120,8 +122,8 @@ LLTexLayerParamAlpha::LLTexLayerParamAlpha(LLTexLayerInterface* layer) :
|
|||
sInstances.push_front(this);
|
||||
}
|
||||
|
||||
LLTexLayerParamAlpha::LLTexLayerParamAlpha(LLVOAvatar* avatar) :
|
||||
LLTexLayerParam(avatar),
|
||||
LLTexLayerParamAlpha::LLTexLayerParamAlpha(LLAvatarAppearance* appearance) :
|
||||
LLTexLayerParam(appearance),
|
||||
mCachedProcessedTexture(NULL),
|
||||
mNeedsCreateTexture(FALSE),
|
||||
mStaticImageInvalid(FALSE),
|
||||
|
|
@ -173,13 +175,10 @@ void LLTexLayerParamAlpha::setWeight(F32 weight, BOOL upload_bake)
|
|||
{
|
||||
mCurWeight = new_weight;
|
||||
|
||||
if ((mAvatar->getSex() & getSex()) && (mAvatar->isSelf() && !mIsDummy)) // only trigger a baked texture update if we're changing a wearable's visual param.
|
||||
if ((mAvatarAppearance->getSex() & getSex()) &&
|
||||
(mAvatarAppearance->isSelf() && !mIsDummy)) // only trigger a baked texture update if we're changing a wearable's visual param.
|
||||
{
|
||||
if (isAgentAvatarValid() && !gAgentAvatarp->isUsingBakedTextures())
|
||||
{
|
||||
upload_bake = FALSE;
|
||||
}
|
||||
mAvatar->invalidateComposite(mTexLayer->getTexLayerSet(), upload_bake);
|
||||
mAvatarAppearance->invalidateComposite(mTexLayer->getTexLayerSet(), upload_bake);
|
||||
mTexLayer->invalidateMorphMasks();
|
||||
}
|
||||
}
|
||||
|
|
@ -218,11 +217,11 @@ BOOL LLTexLayerParamAlpha::getSkip() const
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
const LLVOAvatar *avatar = mTexLayer->getTexLayerSet()->getAvatar();
|
||||
const LLAvatarAppearance *appearance = mTexLayer->getTexLayerSet()->getAvatarAppearance();
|
||||
|
||||
if (((LLTexLayerParamAlphaInfo *)getInfo())->mSkipIfZeroWeight)
|
||||
{
|
||||
F32 effective_weight = (avatar->getSex() & getSex()) ? mCurWeight : getDefaultWeight();
|
||||
F32 effective_weight = (appearance->getSex() & getSex()) ? mCurWeight : getDefaultWeight();
|
||||
if (is_approx_zero(effective_weight))
|
||||
{
|
||||
return TRUE;
|
||||
|
|
@ -230,7 +229,7 @@ BOOL LLTexLayerParamAlpha::getSkip() const
|
|||
}
|
||||
|
||||
LLWearableType::EType type = (LLWearableType::EType)getWearableType();
|
||||
if ((type != LLWearableType::WT_INVALID) && !avatar->isWearingWearableType(type))
|
||||
if ((type != LLWearableType::WT_INVALID) && !appearance->isWearingWearableType(type))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -239,8 +238,10 @@ BOOL LLTexLayerParamAlpha::getSkip() const
|
|||
}
|
||||
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_TEX_LAYER_PARAM_ALPHA("alpha render");
|
||||
BOOL LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height)
|
||||
{
|
||||
LLFastTimer t(FTM_TEX_LAYER_PARAM_ALPHA);
|
||||
BOOL success = TRUE;
|
||||
|
||||
if (!mTexLayer)
|
||||
|
|
@ -248,7 +249,7 @@ BOOL LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height)
|
|||
return success;
|
||||
}
|
||||
|
||||
F32 effective_weight = (mTexLayer->getTexLayerSet()->getAvatar()->getSex() & getSex()) ? mCurWeight : getDefaultWeight();
|
||||
F32 effective_weight = (mTexLayer->getTexLayerSet()->getAvatarAppearance()->getSex() & getSex()) ? mCurWeight : getDefaultWeight();
|
||||
BOOL weight_changed = effective_weight != mCachedEffectiveWeight;
|
||||
if (getSkip())
|
||||
{
|
||||
|
|
@ -290,12 +291,12 @@ BOOL LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height)
|
|||
(mCachedProcessedTexture->getHeight() != image_tga_height) ||
|
||||
(weight_changed))
|
||||
{
|
||||
// llinfos << "Building Cached Alpha: " << mName << ": (" << mStaticImageRaw->getWidth() << ", " << mStaticImageRaw->getHeight() << ") " << effective_weight << llendl;
|
||||
mCachedEffectiveWeight = effective_weight;
|
||||
|
||||
if (!mCachedProcessedTexture)
|
||||
{
|
||||
mCachedProcessedTexture = LLViewerTextureManager::getLocalTexture(image_tga_width, image_tga_height, 1, FALSE);
|
||||
llassert(gTextureManagerBridgep);
|
||||
mCachedProcessedTexture = gTextureManagerBridgep->getLocalTexture(image_tga_width, image_tga_height, 1, FALSE);
|
||||
|
||||
// We now have something in one of our caches
|
||||
LLTexLayerSet::sHasCaches |= mCachedProcessedTexture ? TRUE : FALSE;
|
||||
|
|
@ -308,6 +309,7 @@ BOOL LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height)
|
|||
mStaticImageRaw = new LLImageRaw;
|
||||
mStaticImageTGA->decodeAndProcess(mStaticImageRaw, info->mDomain, effective_weight);
|
||||
mNeedsCreateTexture = TRUE;
|
||||
lldebugs << "Built Cached Alpha: " << info->mStaticImageFileName << ": (" << mStaticImageRaw->getWidth() << ", " << mStaticImageRaw->getHeight() << ") " << "Domain: " << info->mDomain << " Weight: " << effective_weight << llendl;
|
||||
}
|
||||
|
||||
if (mCachedProcessedTexture)
|
||||
|
|
@ -332,7 +334,7 @@ BOOL LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height)
|
|||
|
||||
// Don't keep the cache for other people's avatars
|
||||
// (It's not really a "cache" in that case, but the logic is the same)
|
||||
if (!mAvatar->isSelf())
|
||||
if (!mAvatarAppearance->isSelf())
|
||||
{
|
||||
mCachedProcessedTexture = NULL;
|
||||
}
|
||||
|
|
@ -402,8 +404,8 @@ LLTexLayerParamColor::LLTexLayerParamColor(LLTexLayerInterface* layer) :
|
|||
{
|
||||
}
|
||||
|
||||
LLTexLayerParamColor::LLTexLayerParamColor(LLVOAvatar *avatar) :
|
||||
LLTexLayerParam(avatar),
|
||||
LLTexLayerParamColor::LLTexLayerParamColor(LLAvatarAppearance *appearance) :
|
||||
LLTexLayerParam(appearance),
|
||||
mAvgDistortionVec(1.f, 1.f, 1.f)
|
||||
{
|
||||
}
|
||||
|
|
@ -425,7 +427,7 @@ LLColor4 LLTexLayerParamColor::getNetColor() const
|
|||
|
||||
llassert(info->mNumColors >= 1);
|
||||
|
||||
F32 effective_weight = (mAvatar && (mAvatar->getSex() & getSex())) ? mCurWeight : getDefaultWeight();
|
||||
F32 effective_weight = (mAvatarAppearance && (mAvatarAppearance->getSex() & getSex())) ? mCurWeight : getDefaultWeight();
|
||||
|
||||
S32 index_last = info->mNumColors - 1;
|
||||
F32 scaled_weight = effective_weight * index_last;
|
||||
|
|
@ -470,12 +472,12 @@ void LLTexLayerParamColor::setWeight(F32 weight, BOOL upload_bake)
|
|||
return;
|
||||
}
|
||||
|
||||
if ((mAvatar->getSex() & getSex()) && (mAvatar->isSelf() && !mIsDummy)) // only trigger a baked texture update if we're changing a wearable's visual param.
|
||||
if ((mAvatarAppearance->getSex() & getSex()) && (mAvatarAppearance->isSelf() && !mIsDummy)) // only trigger a baked texture update if we're changing a wearable's visual param.
|
||||
{
|
||||
onGlobalColorChanged(upload_bake);
|
||||
if (mTexLayer)
|
||||
{
|
||||
mAvatar->invalidateComposite(mTexLayer->getTexLayerSet(), upload_bake);
|
||||
mAvatarAppearance->invalidateComposite(mTexLayer->getTexLayerSet(), upload_bake);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -27,14 +27,16 @@
|
|||
#ifndef LL_LLTEXLAYERPARAMS_H
|
||||
#define LL_LLTEXLAYERPARAMS_H
|
||||
|
||||
#include "llpointer.h"
|
||||
#include "v4color.h"
|
||||
#include "llviewervisualparam.h"
|
||||
|
||||
class LLAvatarAppearance;
|
||||
class LLImageRaw;
|
||||
class LLImageTGA;
|
||||
class LLTexLayer;
|
||||
class LLTexLayerInterface;
|
||||
class LLViewerTexture;
|
||||
class LLVOAvatar;
|
||||
class LLGLTexture;
|
||||
class LLWearable;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
|
@ -45,13 +47,13 @@ class LLTexLayerParam : public LLViewerVisualParam
|
|||
{
|
||||
public:
|
||||
LLTexLayerParam(LLTexLayerInterface *layer);
|
||||
LLTexLayerParam(LLVOAvatar *avatar);
|
||||
/*virtual*/ BOOL setInfo(LLViewerVisualParamInfo *info, BOOL add_to_avatar );
|
||||
LLTexLayerParam(LLAvatarAppearance *appearance);
|
||||
/*virtual*/ BOOL setInfo(LLViewerVisualParamInfo *info, BOOL add_to_appearance);
|
||||
/*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable) const = 0;
|
||||
|
||||
protected:
|
||||
LLTexLayerInterface* mTexLayer;
|
||||
LLVOAvatar* mAvatar;
|
||||
LLAvatarAppearance* mAvatarAppearance;
|
||||
};
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
|
@ -63,7 +65,7 @@ class LLTexLayerParamAlpha : public LLTexLayerParam
|
|||
{
|
||||
public:
|
||||
LLTexLayerParamAlpha( LLTexLayerInterface* layer );
|
||||
LLTexLayerParamAlpha( LLVOAvatar* avatar );
|
||||
LLTexLayerParamAlpha( LLAvatarAppearance* appearance );
|
||||
/*virtual*/ ~LLTexLayerParamAlpha();
|
||||
|
||||
void* operator new(size_t size)
|
||||
|
|
@ -100,7 +102,7 @@ public:
|
|||
BOOL getMultiplyBlend() const;
|
||||
|
||||
private:
|
||||
LLPointer<LLViewerTexture> mCachedProcessedTexture;
|
||||
LLPointer<LLGLTexture> mCachedProcessedTexture;
|
||||
LLPointer<LLImageTGA> mStaticImageTGA;
|
||||
LLPointer<LLImageRaw> mStaticImageRaw;
|
||||
BOOL mNeedsCreateTexture;
|
||||
|
|
@ -153,7 +155,7 @@ public:
|
|||
};
|
||||
|
||||
LLTexLayerParamColor( LLTexLayerInterface* layer );
|
||||
LLTexLayerParamColor( LLVOAvatar* avatar );
|
||||
LLTexLayerParamColor( LLAvatarAppearance* appearance );
|
||||
|
||||
void* operator new(size_t size)
|
||||
{
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
* @file lltexturemanagerbridge.cpp
|
||||
* @brief Defined a null texture manager bridge. Applications must provide their own bridge implementaton.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#include "lltexturemanagerbridge.h"
|
||||
|
||||
// Define a null texture manager bridge. Applications must provide their own bridge implementaton.
|
||||
LLTextureManagerBridge* gTextureManagerBridgep = NULL;
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
/**
|
||||
* @file lltexturemanagerbridge.h
|
||||
* @brief Bridge to an application-specific texture manager.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#ifndef LL_TEXTUREMANAGERBRIDGE_H
|
||||
#define LL_TEXTUREMANAGERBRIDGE_H
|
||||
|
||||
#include "llavatarappearancedefines.h"
|
||||
#include "llpointer.h"
|
||||
#include "llgltexture.h"
|
||||
|
||||
// Abstract bridge interface
|
||||
class LLTextureManagerBridge
|
||||
{
|
||||
public:
|
||||
virtual LLPointer<LLGLTexture> getLocalTexture(BOOL usemipmaps = TRUE, BOOL generate_gl_tex = TRUE) = 0;
|
||||
virtual LLPointer<LLGLTexture> getLocalTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps, BOOL generate_gl_tex = TRUE) = 0;
|
||||
virtual LLGLTexture* getFetchedTexture(const LLUUID &image_id) = 0;
|
||||
};
|
||||
|
||||
extern LLTextureManagerBridge* gTextureManagerBridgep;
|
||||
|
||||
#endif // LL_TEXTUREMANAGERBRIDGE_H
|
||||
|
||||
|
|
@ -27,11 +27,10 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Header Files
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
#include "linden_common.h"
|
||||
|
||||
#include "llviewervisualparam.h"
|
||||
#include "llxmltree.h"
|
||||
#include "llui.h"
|
||||
#include "llwearable.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -0,0 +1,781 @@
|
|||
/**
|
||||
* @file llwearable.cpp
|
||||
* @brief LLWearable class implementation
|
||||
*
|
||||
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#include "linden_common.h"
|
||||
|
||||
#include "llavatarappearance.h"
|
||||
#include "lllocaltextureobject.h"
|
||||
#include "lltexlayer.h"
|
||||
#include "lltexturemanagerbridge.h"
|
||||
#include "llvisualparam.h"
|
||||
#include "llavatarappearancedefines.h"
|
||||
#include "llwearable.h"
|
||||
|
||||
using namespace LLAvatarAppearanceDefines;
|
||||
|
||||
// static
|
||||
S32 LLWearable::sCurrentDefinitionVersion = 1;
|
||||
|
||||
// Private local functions
|
||||
static std::string terse_F32_to_string(F32 f);
|
||||
|
||||
// virtual
|
||||
LLWearable::~LLWearable()
|
||||
{
|
||||
}
|
||||
|
||||
const std::string& LLWearable::getTypeLabel() const
|
||||
{
|
||||
return LLWearableType::getTypeLabel(mType);
|
||||
}
|
||||
|
||||
const std::string& LLWearable::getTypeName() const
|
||||
{
|
||||
return LLWearableType::getTypeName(mType);
|
||||
}
|
||||
|
||||
LLAssetType::EType LLWearable::getAssetType() const
|
||||
{
|
||||
return LLWearableType::getAssetType(mType);
|
||||
}
|
||||
|
||||
BOOL LLWearable::exportFile(LLFILE* fp) const
|
||||
{
|
||||
llofstream ofs(fp);
|
||||
return exportStream(ofs);
|
||||
}
|
||||
|
||||
// virtual
|
||||
BOOL LLWearable::exportStream( std::ostream& output_stream ) const
|
||||
{
|
||||
if (!output_stream.good()) return FALSE;
|
||||
|
||||
// header and version
|
||||
output_stream << "LLWearable version " << mDefinitionVersion << "\n";
|
||||
// name
|
||||
output_stream << mName << "\n";
|
||||
// description
|
||||
output_stream << mDescription << "\n";
|
||||
|
||||
// permissions
|
||||
if( !mPermissions.exportLegacyStream( output_stream ) )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// sale info
|
||||
if( !mSaleInfo.exportLegacyStream( output_stream ) )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// wearable type
|
||||
output_stream << "type " << (S32) getType() << "\n";
|
||||
|
||||
// parameters
|
||||
output_stream << "parameters " << mVisualParamIndexMap.size() << "\n";
|
||||
|
||||
for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin();
|
||||
iter != mVisualParamIndexMap.end();
|
||||
++iter)
|
||||
{
|
||||
S32 param_id = iter->first;
|
||||
const LLVisualParam* param = iter->second;
|
||||
F32 param_weight = param->getWeight();
|
||||
output_stream << param_id << " " << terse_F32_to_string( param_weight ) << "\n";
|
||||
}
|
||||
|
||||
// texture entries
|
||||
output_stream << "textures " << mTEMap.size() << "\n";
|
||||
|
||||
for (te_map_t::const_iterator iter = mTEMap.begin(); iter != mTEMap.end(); ++iter)
|
||||
{
|
||||
S32 te = iter->first;
|
||||
const LLUUID& image_id = iter->second->getID();
|
||||
output_stream << te << " " << image_id << "\n";
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void LLWearable::createVisualParams(LLAvatarAppearance *avatarp)
|
||||
{
|
||||
for (LLViewerVisualParam* param = (LLViewerVisualParam*) avatarp->getFirstVisualParam();
|
||||
param;
|
||||
param = (LLViewerVisualParam*) avatarp->getNextVisualParam())
|
||||
{
|
||||
if (param->getWearableType() == mType)
|
||||
{
|
||||
LLVisualParam *clone_param = param->cloneParam(this);
|
||||
clone_param->setParamLocation(LOC_UNKNOWN);
|
||||
clone_param->setParamLocation(LOC_WEARABLE);
|
||||
addVisualParam(clone_param);
|
||||
}
|
||||
}
|
||||
|
||||
// resync driver parameters to point to the newly cloned driven parameters
|
||||
for (visual_param_index_map_t::iterator param_iter = mVisualParamIndexMap.begin();
|
||||
param_iter != mVisualParamIndexMap.end();
|
||||
++param_iter)
|
||||
{
|
||||
LLVisualParam* param = param_iter->second;
|
||||
LLVisualParam*(LLWearable::*wearable_function)(S32)const = &LLWearable::getVisualParam;
|
||||
// need this line to disambiguate between versions of LLCharacter::getVisualParam()
|
||||
LLVisualParam*(LLAvatarAppearance::*param_function)(S32)const = &LLAvatarAppearance::getVisualParam;
|
||||
param->resetDrivenParams();
|
||||
if(!param->linkDrivenParams(boost::bind(wearable_function,(LLWearable*)this, _1), false))
|
||||
{
|
||||
if( !param->linkDrivenParams(boost::bind(param_function,avatarp,_1 ), true))
|
||||
{
|
||||
llwarns << "could not link driven params for wearable " << getName() << " id: " << param->getID() << llendl;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLWearable::createLayers(S32 te, LLAvatarAppearance *avatarp)
|
||||
{
|
||||
LLTexLayerSet *layer_set = NULL;
|
||||
const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture((ETextureIndex)te);
|
||||
if (texture_dict->mIsUsedByBakedTexture)
|
||||
{
|
||||
const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
|
||||
|
||||
layer_set = avatarp->getAvatarLayerSet(baked_index);
|
||||
}
|
||||
|
||||
if (layer_set)
|
||||
{
|
||||
layer_set->cloneTemplates(mTEMap[te], (ETextureIndex)te, this);
|
||||
}
|
||||
else
|
||||
{
|
||||
llerrs << "could not find layerset for LTO in wearable!" << llendl;
|
||||
}
|
||||
}
|
||||
|
||||
LLWearable::EImportResult LLWearable::importFile(LLFILE* fp, LLAvatarAppearance* avatarp )
|
||||
{
|
||||
llifstream ifs(fp);
|
||||
return importStream(ifs, avatarp);
|
||||
}
|
||||
|
||||
// virtual
|
||||
LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream, LLAvatarAppearance* avatarp )
|
||||
{
|
||||
// *NOTE: changing the type or size of this buffer will require
|
||||
// changes in the fscanf() code below.
|
||||
// We are using a local max buffer size here to avoid issues
|
||||
// if MAX_STRING size changes.
|
||||
const U32 PARSE_BUFFER_SIZE = 2048;
|
||||
char buffer[PARSE_BUFFER_SIZE]; /* Flawfinder: ignore */
|
||||
char uuid_buffer[37]; /* Flawfinder: ignore */
|
||||
|
||||
// This data is being generated on the viewer.
|
||||
// Impose some sane limits on parameter and texture counts.
|
||||
const S32 MAX_WEARABLE_ASSET_TEXTURES = 100;
|
||||
const S32 MAX_WEARABLE_ASSET_PARAMETERS = 1000;
|
||||
|
||||
if(!avatarp)
|
||||
{
|
||||
return LLWearable::FAILURE;
|
||||
}
|
||||
|
||||
// read header and version
|
||||
if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE))
|
||||
{
|
||||
llwarns << "Failed to read wearable asset input stream." << llendl;
|
||||
return LLWearable::FAILURE;
|
||||
}
|
||||
if ( 1 != sscanf( /* Flawfinder: ignore */
|
||||
buffer,
|
||||
"LLWearable version %d\n",
|
||||
&mDefinitionVersion ) )
|
||||
{
|
||||
return LLWearable::BAD_HEADER;
|
||||
}
|
||||
|
||||
// Hack to allow wearables with definition version 24 to still load.
|
||||
// This should only affect lindens and NDA'd testers who have saved wearables in 2.0
|
||||
// the extra check for version == 24 can be removed before release, once internal testers
|
||||
// have loaded these wearables again. See hack pt 2 at bottom of function to ensure that
|
||||
// these wearables get re-saved with version definition 22.
|
||||
if( mDefinitionVersion > LLWearable::sCurrentDefinitionVersion && mDefinitionVersion != 24 )
|
||||
{
|
||||
llwarns << "Wearable asset has newer version (" << mDefinitionVersion << ") than XML (" << LLWearable::sCurrentDefinitionVersion << ")" << llendl;
|
||||
return LLWearable::FAILURE;
|
||||
}
|
||||
|
||||
// name may be empty
|
||||
if (!input_stream.good())
|
||||
{
|
||||
llwarns << "Bad Wearable asset: early end of input stream "
|
||||
<< "while reading name" << llendl;
|
||||
return LLWearable::FAILURE;
|
||||
}
|
||||
input_stream.getline(buffer, PARSE_BUFFER_SIZE);
|
||||
mName = buffer;
|
||||
|
||||
// description may be empty
|
||||
if (!input_stream.good())
|
||||
{
|
||||
llwarns << "Bad Wearable asset: early end of input stream "
|
||||
<< "while reading description" << llendl;
|
||||
return LLWearable::FAILURE;
|
||||
}
|
||||
input_stream.getline(buffer, PARSE_BUFFER_SIZE);
|
||||
mDescription = buffer;
|
||||
|
||||
// permissions may have extra empty lines before the correct line
|
||||
if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE))
|
||||
{
|
||||
llwarns << "Bad Wearable asset: early end of input stream "
|
||||
<< "while reading permissions" << llendl;
|
||||
return LLWearable::FAILURE;
|
||||
}
|
||||
S32 perm_version = -1;
|
||||
if ( 1 != sscanf( buffer, " permissions %d\n", &perm_version ) ||
|
||||
perm_version != 0 )
|
||||
{
|
||||
llwarns << "Bad Wearable asset: missing valid permissions" << llendl;
|
||||
return LLWearable::FAILURE;
|
||||
}
|
||||
if( !mPermissions.importLegacyStream( input_stream ) )
|
||||
{
|
||||
return LLWearable::FAILURE;
|
||||
}
|
||||
|
||||
// sale info
|
||||
if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE))
|
||||
{
|
||||
llwarns << "Bad Wearable asset: early end of input stream "
|
||||
<< "while reading sale info" << llendl;
|
||||
return LLWearable::FAILURE;
|
||||
}
|
||||
S32 sale_info_version = -1;
|
||||
if ( 1 != sscanf( buffer, " sale_info %d\n", &sale_info_version ) ||
|
||||
sale_info_version != 0 )
|
||||
{
|
||||
llwarns << "Bad Wearable asset: missing valid sale_info" << llendl;
|
||||
return LLWearable::FAILURE;
|
||||
}
|
||||
// Sale info used to contain next owner perm. It is now in the
|
||||
// permissions. Thus, we read that out, and fix legacy
|
||||
// objects. It's possible this op would fail, but it should pick
|
||||
// up the vast majority of the tasks.
|
||||
BOOL has_perm_mask = FALSE;
|
||||
U32 perm_mask = 0;
|
||||
if( !mSaleInfo.importLegacyStream(input_stream, has_perm_mask, perm_mask) )
|
||||
{
|
||||
return LLWearable::FAILURE;
|
||||
}
|
||||
if(has_perm_mask)
|
||||
{
|
||||
// fair use fix.
|
||||
if(!(perm_mask & PERM_COPY))
|
||||
{
|
||||
perm_mask |= PERM_TRANSFER;
|
||||
}
|
||||
mPermissions.setMaskNext(perm_mask);
|
||||
}
|
||||
|
||||
// wearable type
|
||||
if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE))
|
||||
{
|
||||
llwarns << "Bad Wearable asset: early end of input stream "
|
||||
<< "while reading type" << llendl;
|
||||
return LLWearable::FAILURE;
|
||||
}
|
||||
S32 type = -1;
|
||||
if ( 1 != sscanf( buffer, "type %d\n", &type ) )
|
||||
{
|
||||
llwarns << "Bad Wearable asset: bad type" << llendl;
|
||||
return LLWearable::FAILURE;
|
||||
}
|
||||
if( 0 <= type && type < LLWearableType::WT_COUNT )
|
||||
{
|
||||
setType((LLWearableType::EType)type, avatarp);
|
||||
}
|
||||
else
|
||||
{
|
||||
mType = LLWearableType::WT_COUNT;
|
||||
llwarns << "Bad Wearable asset: bad type #" << type << llendl;
|
||||
return LLWearable::FAILURE;
|
||||
}
|
||||
|
||||
// parameters header
|
||||
if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE))
|
||||
{
|
||||
llwarns << "Bad Wearable asset: early end of input stream "
|
||||
<< "while reading parameters header" << llendl;
|
||||
return LLWearable::FAILURE;
|
||||
}
|
||||
S32 num_parameters = -1;
|
||||
if ( 1 != sscanf( buffer, "parameters %d\n", &num_parameters ) )
|
||||
{
|
||||
llwarns << "Bad Wearable asset: missing parameters block" << llendl;
|
||||
return LLWearable::FAILURE;
|
||||
}
|
||||
if ( num_parameters > MAX_WEARABLE_ASSET_PARAMETERS )
|
||||
{
|
||||
llwarns << "Bad Wearable asset: too many parameters, "
|
||||
<< num_parameters << llendl;
|
||||
return LLWearable::FAILURE;
|
||||
}
|
||||
if( num_parameters != mVisualParamIndexMap.size() )
|
||||
{
|
||||
llwarns << "Wearable parameter mismatch. Reading in "
|
||||
<< num_parameters << " from file, but created "
|
||||
<< mVisualParamIndexMap.size()
|
||||
<< " from avatar parameters. type: "
|
||||
<< getType() << llendl;
|
||||
}
|
||||
|
||||
// parameters
|
||||
S32 i;
|
||||
for( i = 0; i < num_parameters; i++ )
|
||||
{
|
||||
if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE))
|
||||
{
|
||||
llwarns << "Bad Wearable asset: early end of input stream "
|
||||
<< "while reading parameter #" << i << llendl;
|
||||
return LLWearable::FAILURE;
|
||||
}
|
||||
S32 param_id = 0;
|
||||
F32 param_weight = 0.f;
|
||||
if ( 2 != sscanf( buffer, "%d %f\n", ¶m_id, ¶m_weight ) )
|
||||
{
|
||||
llwarns << "Bad Wearable asset: bad parameter, #" << i << llendl;
|
||||
return LLWearable::FAILURE;
|
||||
}
|
||||
mSavedVisualParamMap[param_id] = param_weight;
|
||||
}
|
||||
|
||||
// textures header
|
||||
if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE))
|
||||
{
|
||||
llwarns << "Bad Wearable asset: early end of input stream "
|
||||
<< "while reading textures header" << i << llendl;
|
||||
return LLWearable::FAILURE;
|
||||
}
|
||||
S32 num_textures = -1;
|
||||
if ( 1 != sscanf( buffer, "textures %d\n", &num_textures) )
|
||||
{
|
||||
llwarns << "Bad Wearable asset: missing textures block" << llendl;
|
||||
return LLWearable::FAILURE;
|
||||
}
|
||||
if ( num_textures > MAX_WEARABLE_ASSET_TEXTURES )
|
||||
{
|
||||
llwarns << "Bad Wearable asset: too many textures, "
|
||||
<< num_textures << llendl;
|
||||
return LLWearable::FAILURE;
|
||||
}
|
||||
|
||||
// textures
|
||||
for( i = 0; i < num_textures; i++ )
|
||||
{
|
||||
if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE))
|
||||
{
|
||||
llwarns << "Bad Wearable asset: early end of input stream "
|
||||
<< "while reading textures #" << i << llendl;
|
||||
return LLWearable::FAILURE;
|
||||
}
|
||||
S32 te = 0;
|
||||
if ( 2 != sscanf( /* Flawfinder: ignore */
|
||||
buffer,
|
||||
"%d %36s\n",
|
||||
&te, uuid_buffer) )
|
||||
{
|
||||
llwarns << "Bad Wearable asset: bad texture, #" << i << llendl;
|
||||
return LLWearable::FAILURE;
|
||||
}
|
||||
|
||||
if( !LLUUID::validate( uuid_buffer ) )
|
||||
{
|
||||
llwarns << "Bad Wearable asset: bad texture uuid: "
|
||||
<< uuid_buffer << llendl;
|
||||
return LLWearable::FAILURE;
|
||||
}
|
||||
LLUUID id = LLUUID(uuid_buffer);
|
||||
LLGLTexture* image = gTextureManagerBridgep->getFetchedTexture( id );
|
||||
if( mTEMap.find(te) != mTEMap.end() )
|
||||
{
|
||||
delete mTEMap[te];
|
||||
}
|
||||
if( mSavedTEMap.find(te) != mSavedTEMap.end() )
|
||||
{
|
||||
delete mSavedTEMap[te];
|
||||
}
|
||||
|
||||
LLUUID textureid(uuid_buffer);
|
||||
mTEMap[te] = new LLLocalTextureObject(image, textureid);
|
||||
mSavedTEMap[te] = new LLLocalTextureObject(image, textureid);
|
||||
createLayers(te, avatarp);
|
||||
}
|
||||
|
||||
// copy all saved param values to working params
|
||||
revertValues();
|
||||
|
||||
return LLWearable::SUCCESS;
|
||||
}
|
||||
|
||||
BOOL LLWearable::getNextPopulatedLine(std::istream& input_stream, char* buffer, U32 buffer_size)
|
||||
{
|
||||
if (!input_stream.good())
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
input_stream.getline(buffer, buffer_size);
|
||||
}
|
||||
while (input_stream.good() && buffer[0]=='\0');
|
||||
|
||||
return (buffer[0] != '\0');
|
||||
}
|
||||
|
||||
|
||||
void LLWearable::setType(LLWearableType::EType type, LLAvatarAppearance *avatarp)
|
||||
{
|
||||
mType = type;
|
||||
createVisualParams(avatarp);
|
||||
}
|
||||
|
||||
|
||||
LLLocalTextureObject* LLWearable::getLocalTextureObject(S32 index)
|
||||
{
|
||||
te_map_t::iterator iter = mTEMap.find(index);
|
||||
if( iter != mTEMap.end() )
|
||||
{
|
||||
LLLocalTextureObject* lto = iter->second;
|
||||
return lto;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const LLLocalTextureObject* LLWearable::getLocalTextureObject(S32 index) const
|
||||
{
|
||||
te_map_t::const_iterator iter = mTEMap.find(index);
|
||||
if( iter != mTEMap.end() )
|
||||
{
|
||||
const LLLocalTextureObject* lto = iter->second;
|
||||
return lto;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
std::vector<LLLocalTextureObject*> LLWearable::getLocalTextureListSeq()
|
||||
{
|
||||
std::vector<LLLocalTextureObject*> result;
|
||||
|
||||
for(te_map_t::const_iterator iter = mTEMap.begin();
|
||||
iter != mTEMap.end(); iter++)
|
||||
{
|
||||
LLLocalTextureObject* lto = iter->second;
|
||||
result.push_back(lto);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void LLWearable::setLocalTextureObject(S32 index, LLLocalTextureObject <o)
|
||||
{
|
||||
if( mTEMap.find(index) != mTEMap.end() )
|
||||
{
|
||||
mTEMap.erase(index);
|
||||
}
|
||||
mTEMap[index] = new LLLocalTextureObject(lto);
|
||||
}
|
||||
|
||||
void LLWearable::revertValues()
|
||||
{
|
||||
// FIXME DRANO - this triggers changes to driven params on avatar, potentially clobbering baked appearance.
|
||||
|
||||
//update saved settings so wearable is no longer dirty
|
||||
// non-driver params first
|
||||
for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++)
|
||||
{
|
||||
S32 id = iter->first;
|
||||
F32 value = iter->second;
|
||||
LLVisualParam *param = getVisualParam(id);
|
||||
if(param && !dynamic_cast<LLDriverParam*>(param) )
|
||||
{
|
||||
setVisualParamWeight(id, value, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
//then driver params
|
||||
for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++)
|
||||
{
|
||||
S32 id = iter->first;
|
||||
F32 value = iter->second;
|
||||
LLVisualParam *param = getVisualParam(id);
|
||||
if(param && dynamic_cast<LLDriverParam*>(param) )
|
||||
{
|
||||
setVisualParamWeight(id, value, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
// make sure that saved values are sane
|
||||
for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++)
|
||||
{
|
||||
S32 id = iter->first;
|
||||
LLVisualParam *param = getVisualParam(id);
|
||||
if( param )
|
||||
{
|
||||
mSavedVisualParamMap[id] = param->getWeight();
|
||||
}
|
||||
}
|
||||
|
||||
syncImages(mSavedTEMap, mTEMap);
|
||||
}
|
||||
|
||||
void LLWearable::saveValues()
|
||||
{
|
||||
//update saved settings so wearable is no longer dirty
|
||||
mSavedVisualParamMap.clear();
|
||||
for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin(); iter != mVisualParamIndexMap.end(); ++iter)
|
||||
{
|
||||
S32 id = iter->first;
|
||||
LLVisualParam *wearable_param = iter->second;
|
||||
F32 value = wearable_param->getWeight();
|
||||
mSavedVisualParamMap[id] = value;
|
||||
}
|
||||
|
||||
// Deep copy of mTEMap (copies only those tes that are current, filling in defaults where needed)
|
||||
syncImages(mTEMap, mSavedTEMap);
|
||||
}
|
||||
|
||||
void LLWearable::syncImages(te_map_t &src, te_map_t &dst)
|
||||
{
|
||||
// Deep copy of src (copies only those tes that are current, filling in defaults where needed)
|
||||
for( S32 te = 0; te < TEX_NUM_INDICES; te++ )
|
||||
{
|
||||
if (LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex) te) == mType)
|
||||
{
|
||||
te_map_t::const_iterator iter = src.find(te);
|
||||
LLUUID image_id;
|
||||
LLGLTexture *image = NULL;
|
||||
LLLocalTextureObject *lto = NULL;
|
||||
if(iter != src.end())
|
||||
{
|
||||
// there's a Local Texture Object in the source image map. Use this to populate the values to store in the destination image map.
|
||||
lto = iter->second;
|
||||
image = lto->getImage();
|
||||
image_id = lto->getID();
|
||||
}
|
||||
else
|
||||
{
|
||||
// there is no Local Texture Object in the source image map. Get defaults values for populating the destination image map.
|
||||
image_id = getDefaultTextureImageID((ETextureIndex) te);
|
||||
image = gTextureManagerBridgep->getFetchedTexture( image_id );
|
||||
}
|
||||
|
||||
if( dst.find(te) != dst.end() )
|
||||
{
|
||||
// there's already an entry in the destination map for the texture. Just update its values.
|
||||
dst[te]->setImage(image);
|
||||
dst[te]->setID(image_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
// no entry found in the destination map, we need to create a new Local Texture Object
|
||||
dst[te] = new LLLocalTextureObject(image, image_id);
|
||||
}
|
||||
|
||||
if( lto )
|
||||
{
|
||||
// If we pulled values from a Local Texture Object in the source map, make sure the proper flags are set in the new (or updated) entry in the destination map.
|
||||
dst[te]->setBakedReady(lto->getBakedReady());
|
||||
dst[te]->setDiscard(lto->getDiscard());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLWearable::destroyTextures()
|
||||
{
|
||||
for( te_map_t::iterator iter = mTEMap.begin(); iter != mTEMap.end(); ++iter )
|
||||
{
|
||||
LLLocalTextureObject *lto = iter->second;
|
||||
delete lto;
|
||||
}
|
||||
mTEMap.clear();
|
||||
for( te_map_t::iterator iter = mSavedTEMap.begin(); iter != mSavedTEMap.end(); ++iter )
|
||||
{
|
||||
LLLocalTextureObject *lto = iter->second;
|
||||
delete lto;
|
||||
}
|
||||
mSavedTEMap.clear();
|
||||
}
|
||||
|
||||
void LLWearable::addVisualParam(LLVisualParam *param)
|
||||
{
|
||||
if( mVisualParamIndexMap[param->getID()] )
|
||||
{
|
||||
delete mVisualParamIndexMap[param->getID()];
|
||||
}
|
||||
param->setIsDummy(FALSE);
|
||||
param->setParamLocation(LOC_WEARABLE);
|
||||
mVisualParamIndexMap[param->getID()] = param;
|
||||
mSavedVisualParamMap[param->getID()] = param->getDefaultWeight();
|
||||
}
|
||||
|
||||
|
||||
void LLWearable::setVisualParamWeight(S32 param_index, F32 value, BOOL upload_bake)
|
||||
{
|
||||
if( is_in_map(mVisualParamIndexMap, param_index ) )
|
||||
{
|
||||
LLVisualParam *wearable_param = mVisualParamIndexMap[param_index];
|
||||
wearable_param->setWeight(value, upload_bake);
|
||||
}
|
||||
else
|
||||
{
|
||||
llerrs << "LLWearable::setVisualParam passed invalid parameter index: " << param_index << " for wearable type: " << this->getName() << llendl;
|
||||
}
|
||||
}
|
||||
|
||||
F32 LLWearable::getVisualParamWeight(S32 param_index) const
|
||||
{
|
||||
if( is_in_map(mVisualParamIndexMap, param_index ) )
|
||||
{
|
||||
const LLVisualParam *wearable_param = mVisualParamIndexMap.find(param_index)->second;
|
||||
return wearable_param->getWeight();
|
||||
}
|
||||
else
|
||||
{
|
||||
llwarns << "LLWerable::getVisualParam passed invalid parameter index: " << param_index << " for wearable type: " << this->getName() << llendl;
|
||||
}
|
||||
return (F32)-1.0;
|
||||
}
|
||||
|
||||
LLVisualParam* LLWearable::getVisualParam(S32 index) const
|
||||
{
|
||||
visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.find(index);
|
||||
return (iter == mVisualParamIndexMap.end()) ? NULL : iter->second;
|
||||
}
|
||||
|
||||
|
||||
void LLWearable::getVisualParams(visual_param_vec_t &list)
|
||||
{
|
||||
visual_param_index_map_t::iterator iter = mVisualParamIndexMap.begin();
|
||||
visual_param_index_map_t::iterator end = mVisualParamIndexMap.end();
|
||||
|
||||
// add all visual params to the passed-in vector
|
||||
for( ; iter != end; ++iter )
|
||||
{
|
||||
list.push_back(iter->second);
|
||||
}
|
||||
}
|
||||
|
||||
void LLWearable::animateParams(F32 delta, BOOL upload_bake)
|
||||
{
|
||||
for(visual_param_index_map_t::iterator iter = mVisualParamIndexMap.begin();
|
||||
iter != mVisualParamIndexMap.end();
|
||||
++iter)
|
||||
{
|
||||
LLVisualParam *param = (LLVisualParam*) iter->second;
|
||||
param->animate(delta, upload_bake);
|
||||
}
|
||||
}
|
||||
|
||||
LLColor4 LLWearable::getClothesColor(S32 te) const
|
||||
{
|
||||
LLColor4 color;
|
||||
U32 param_name[3];
|
||||
if( LLAvatarAppearance::teToColorParams( (LLAvatarAppearanceDefines::ETextureIndex)te, param_name ) )
|
||||
{
|
||||
for( U8 index = 0; index < 3; index++ )
|
||||
{
|
||||
color.mV[index] = getVisualParamWeight(param_name[index]);
|
||||
}
|
||||
}
|
||||
return color;
|
||||
}
|
||||
|
||||
void LLWearable::setClothesColor( S32 te, const LLColor4& new_color, BOOL upload_bake )
|
||||
{
|
||||
U32 param_name[3];
|
||||
if( LLAvatarAppearance::teToColorParams( (LLAvatarAppearanceDefines::ETextureIndex)te, param_name ) )
|
||||
{
|
||||
for( U8 index = 0; index < 3; index++ )
|
||||
{
|
||||
setVisualParamWeight(param_name[index], new_color.mV[index], upload_bake);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLWearable::writeToAvatar(LLAvatarAppearance* avatarp)
|
||||
{
|
||||
if (!avatarp) return;
|
||||
|
||||
// Pull params
|
||||
for( LLVisualParam* param = avatarp->getFirstVisualParam(); param; param = avatarp->getNextVisualParam() )
|
||||
{
|
||||
// cross-wearable parameters are not authoritative, as they are driven by a different wearable. So don't copy the values to the
|
||||
// avatar object if cross wearable. Cross wearable params get their values from the avatar, they shouldn't write the other way.
|
||||
if( (((LLViewerVisualParam*)param)->getWearableType() == mType) && (!((LLViewerVisualParam*)param)->getCrossWearable()) )
|
||||
{
|
||||
S32 param_id = param->getID();
|
||||
F32 weight = getVisualParamWeight(param_id);
|
||||
|
||||
avatarp->setVisualParamWeight( param_id, weight, FALSE );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::string terse_F32_to_string(F32 f)
|
||||
{
|
||||
std::string r = llformat("%.2f", f);
|
||||
S32 len = r.length();
|
||||
|
||||
// "1.20" -> "1.2"
|
||||
// "24.00" -> "24."
|
||||
while (len > 0 && ('0' == r[len - 1]))
|
||||
{
|
||||
r.erase(len-1, 1);
|
||||
len--;
|
||||
}
|
||||
if ('.' == r[len - 1])
|
||||
{
|
||||
// "24." -> "24"
|
||||
r.erase(len-1, 1);
|
||||
}
|
||||
else if (('-' == r[0]) && ('0' == r[1]))
|
||||
{
|
||||
// "-0.59" -> "-.59"
|
||||
r.erase(1, 1);
|
||||
}
|
||||
else if ('0' == r[0])
|
||||
{
|
||||
// "0.59" -> ".59"
|
||||
r.erase(0, 1);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
@ -27,31 +27,25 @@
|
|||
#ifndef LL_LLWEARABLE_H
|
||||
#define LL_LLWEARABLE_H
|
||||
|
||||
#include "lluuid.h"
|
||||
#include "llstring.h"
|
||||
#include "llavatarappearancedefines.h"
|
||||
#include "llextendedstatus.h"
|
||||
#include "llpermissions.h"
|
||||
#include "llsaleinfo.h"
|
||||
#include "llassetstorage.h"
|
||||
#include "llwearabletype.h"
|
||||
#include "llfile.h"
|
||||
#include "lllocaltextureobject.h"
|
||||
|
||||
class LLViewerInventoryItem;
|
||||
class LLMD5;
|
||||
class LLVisualParam;
|
||||
class LLTexGlobalColorInfo;
|
||||
class LLTexGlobalColor;
|
||||
class LLAvatarAppearance;
|
||||
|
||||
// Abstract class.
|
||||
class LLWearable
|
||||
{
|
||||
friend class LLWearableList;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Constructors and destructors
|
||||
//--------------------------------------------------------------------
|
||||
private:
|
||||
// Private constructors used by LLWearableList
|
||||
LLWearable(const LLTransactionID& transactionID);
|
||||
LLWearable(const LLAssetID& assetID);
|
||||
public:
|
||||
virtual ~LLWearable();
|
||||
|
||||
|
|
@ -59,11 +53,8 @@ public:
|
|||
// Accessors
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
const LLUUID& getItemID() const;
|
||||
const LLAssetID& getAssetID() const { return mAssetID; }
|
||||
const LLTransactionID& getTransactionID() const { return mTransactionID; }
|
||||
LLWearableType::EType getType() const { return mType; }
|
||||
void setType(LLWearableType::EType type);
|
||||
LLWearableType::EType getType() const { return mType; }
|
||||
void setType(LLWearableType::EType type, LLAvatarAppearance *avatarp);
|
||||
const std::string& getName() const { return mName; }
|
||||
void setName(const std::string& name) { mName = name; }
|
||||
const std::string& getDescription() const { return mDescription; }
|
||||
|
|
@ -77,32 +68,26 @@ public:
|
|||
LLAssetType::EType getAssetType() const;
|
||||
S32 getDefinitionVersion() const { return mDefinitionVersion; }
|
||||
void setDefinitionVersion( S32 new_version ) { mDefinitionVersion = new_version; }
|
||||
static S32 getCurrentDefinitionVersion() { return LLWearable::sCurrentDefinitionVersion; }
|
||||
|
||||
public:
|
||||
typedef std::vector<LLVisualParam*> visual_param_vec_t;
|
||||
|
||||
BOOL isDirty() const;
|
||||
BOOL isOldVersion() const;
|
||||
|
||||
void writeToAvatar();
|
||||
void removeFromAvatar( BOOL upload_bake ) { LLWearable::removeFromAvatar( mType, upload_bake ); }
|
||||
static void removeFromAvatar( LLWearableType::EType type, BOOL upload_bake );
|
||||
virtual void writeToAvatar(LLAvatarAppearance* avatarp);
|
||||
|
||||
enum EImportResult
|
||||
{
|
||||
FAILURE = 0,
|
||||
SUCCESS,
|
||||
BAD_HEADER
|
||||
};
|
||||
BOOL exportFile(LLFILE* file) const;
|
||||
BOOL importFile(LLFILE* file);
|
||||
|
||||
void setParamsToDefaults();
|
||||
void setTexturesToDefaults();
|
||||
|
||||
void saveNewAsset() const;
|
||||
static void onSaveNewAssetComplete( const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status );
|
||||
|
||||
void copyDataFrom(const LLWearable* src);
|
||||
EImportResult importFile(LLFILE* file, LLAvatarAppearance* avatarp );
|
||||
virtual BOOL exportStream( std::ostream& output_stream ) const;
|
||||
virtual EImportResult importStream( std::istream& input_stream, LLAvatarAppearance* avatarp );
|
||||
|
||||
static void setCurrentDefinitionVersion( S32 version ) { LLWearable::sCurrentDefinitionVersion = version; }
|
||||
|
||||
friend std::ostream& operator<<(std::ostream &s, const LLWearable &w);
|
||||
void setItemID(const LLUUID& item_id);
|
||||
virtual LLUUID getDefaultTextureImageID(LLAvatarAppearanceDefines::ETextureIndex index) const = 0;
|
||||
|
||||
LLLocalTextureObject* getLocalTextureObject(S32 index);
|
||||
const LLLocalTextureObject* getLocalTextureObject(S32 index) const;
|
||||
|
|
@ -110,7 +95,6 @@ public:
|
|||
|
||||
void setLocalTextureObject(S32 index, LLLocalTextureObject <o);
|
||||
void addVisualParam(LLVisualParam *param);
|
||||
void setVisualParams();
|
||||
void setVisualParamWeight(S32 index, F32 value, BOOL upload_bake);
|
||||
F32 getVisualParamWeight(S32 index) const;
|
||||
LLVisualParam* getVisualParam(S32 index) const;
|
||||
|
|
@ -120,27 +104,22 @@ public:
|
|||
LLColor4 getClothesColor(S32 te) const;
|
||||
void setClothesColor( S32 te, const LLColor4& new_color, BOOL upload_bake );
|
||||
|
||||
void revertValues();
|
||||
void saveValues();
|
||||
void pullCrossWearableValues();
|
||||
virtual void revertValues();
|
||||
virtual void saveValues();
|
||||
|
||||
BOOL isOnTop() const;
|
||||
// Something happened that requires the wearable to be updated (e.g. worn/unworn).
|
||||
virtual void setUpdated() const = 0;
|
||||
|
||||
// Something happened that requires the wearable's label to be updated (e.g. worn/unworn).
|
||||
void setLabelUpdated() const;
|
||||
// Update the baked texture hash.
|
||||
virtual void addToBakedTextureHash(LLMD5& hash) const = 0;
|
||||
|
||||
// the wearable was worn. make sure the name of the wearable object matches the LLViewerInventoryItem,
|
||||
// not the wearable asset itself.
|
||||
void refreshName();
|
||||
|
||||
private:
|
||||
protected:
|
||||
typedef std::map<S32, LLLocalTextureObject*> te_map_t;
|
||||
typedef std::map<S32, LLVisualParam *> visual_param_index_map_t;
|
||||
|
||||
void createLayers(S32 te);
|
||||
void createVisualParams();
|
||||
void syncImages(te_map_t &src, te_map_t &dst);
|
||||
void destroyTextures();
|
||||
void destroyTextures();
|
||||
void createVisualParams(LLAvatarAppearance *avatarp);
|
||||
void createLayers(S32 te, LLAvatarAppearance *avatarp);
|
||||
BOOL getNextPopulatedLine(std::istream& input_stream, char* buffer, U32 buffer_size);
|
||||
|
||||
static S32 sCurrentDefinitionVersion; // Depends on the current state of the avatar_lad.xml.
|
||||
S32 mDefinitionVersion; // Depends on the state of the avatar_lad.xml when this asset was created.
|
||||
|
|
@ -148,18 +127,16 @@ private:
|
|||
std::string mDescription;
|
||||
LLPermissions mPermissions;
|
||||
LLSaleInfo mSaleInfo;
|
||||
LLAssetID mAssetID;
|
||||
LLTransactionID mTransactionID;
|
||||
LLWearableType::EType mType;
|
||||
|
||||
typedef std::map<S32, F32> param_map_t;
|
||||
param_map_t mSavedVisualParamMap; // last saved version of visual params
|
||||
|
||||
typedef std::map<S32, LLVisualParam *> visual_param_index_map_t;
|
||||
visual_param_index_map_t mVisualParamIndexMap;
|
||||
|
||||
te_map_t mTEMap; // maps TE to LocalTextureObject
|
||||
te_map_t mSavedTEMap; // last saved version of TEMap
|
||||
LLUUID mItemID; // ID of the inventory item in the agent's inventory
|
||||
};
|
||||
|
||||
#endif // LL_LLWEARABLE_H
|
||||
|
|
@ -0,0 +1,360 @@
|
|||
/**
|
||||
* @file llwearabledata.cpp
|
||||
* @brief LLWearableData class implementation
|
||||
*
|
||||
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#include "linden_common.h"
|
||||
|
||||
#include "llwearabledata.h"
|
||||
|
||||
#include "llavatarappearance.h"
|
||||
#include "llavatarappearancedefines.h"
|
||||
#include "lldriverparam.h"
|
||||
#include "llmd5.h"
|
||||
|
||||
LLWearableData::LLWearableData() :
|
||||
mAvatarAppearance(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
// virtual
|
||||
LLWearableData::~LLWearableData()
|
||||
{
|
||||
}
|
||||
|
||||
using namespace LLAvatarAppearanceDefines;
|
||||
|
||||
LLWearable* LLWearableData::getWearable(const LLWearableType::EType type, U32 index)
|
||||
{
|
||||
wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(type);
|
||||
if (wearable_iter == mWearableDatas.end())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
wearableentry_vec_t& wearable_vec = wearable_iter->second;
|
||||
if (index>=wearable_vec.size())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
return wearable_vec[index];
|
||||
}
|
||||
}
|
||||
|
||||
void LLWearableData::setWearable(const LLWearableType::EType type, U32 index, LLWearable *wearable)
|
||||
{
|
||||
LLWearable *old_wearable = getWearable(type,index);
|
||||
if (!old_wearable)
|
||||
{
|
||||
pushWearable(type,wearable);
|
||||
return;
|
||||
}
|
||||
|
||||
wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(type);
|
||||
if (wearable_iter == mWearableDatas.end())
|
||||
{
|
||||
llwarns << "invalid type, type " << type << " index " << index << llendl;
|
||||
return;
|
||||
}
|
||||
wearableentry_vec_t& wearable_vec = wearable_iter->second;
|
||||
if (index>=wearable_vec.size())
|
||||
{
|
||||
llwarns << "invalid index, type " << type << " index " << index << llendl;
|
||||
}
|
||||
else
|
||||
{
|
||||
wearable_vec[index] = wearable;
|
||||
old_wearable->setUpdated();
|
||||
const BOOL removed = FALSE;
|
||||
wearableUpdated(wearable, removed);
|
||||
}
|
||||
}
|
||||
|
||||
U32 LLWearableData::pushWearable(const LLWearableType::EType type,
|
||||
LLWearable *wearable,
|
||||
bool trigger_updated /* = true */)
|
||||
{
|
||||
if (wearable == NULL)
|
||||
{
|
||||
// no null wearables please!
|
||||
llwarns << "Null wearable sent for type " << type << llendl;
|
||||
return MAX_CLOTHING_PER_TYPE;
|
||||
}
|
||||
if (type < LLWearableType::WT_COUNT || mWearableDatas[type].size() < MAX_CLOTHING_PER_TYPE)
|
||||
{
|
||||
mWearableDatas[type].push_back(wearable);
|
||||
if (trigger_updated)
|
||||
{
|
||||
const BOOL removed = FALSE;
|
||||
wearableUpdated(wearable, removed);
|
||||
}
|
||||
return mWearableDatas[type].size()-1;
|
||||
}
|
||||
return MAX_CLOTHING_PER_TYPE;
|
||||
}
|
||||
|
||||
// virtual
|
||||
void LLWearableData::wearableUpdated(LLWearable *wearable, BOOL removed)
|
||||
{
|
||||
wearable->setUpdated();
|
||||
// FIXME DRANO avoid updating params via wearables when rendering server-baked appearance.
|
||||
#if 0
|
||||
if (mAvatarAppearance->isUsingServerBakes() && !mAvatarAppearance->isUsingLocalAppearance())
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (!removed)
|
||||
{
|
||||
pullCrossWearableValues(wearable->getType());
|
||||
}
|
||||
}
|
||||
|
||||
void LLWearableData::popWearable(LLWearable *wearable)
|
||||
{
|
||||
if (wearable == NULL)
|
||||
{
|
||||
// nothing to do here. move along.
|
||||
return;
|
||||
}
|
||||
|
||||
U32 index = getWearableIndex(wearable);
|
||||
const LLWearableType::EType type = wearable->getType();
|
||||
|
||||
if (index < MAX_CLOTHING_PER_TYPE && index < getWearableCount(type))
|
||||
{
|
||||
popWearable(type, index);
|
||||
}
|
||||
}
|
||||
|
||||
void LLWearableData::popWearable(const LLWearableType::EType type, U32 index)
|
||||
{
|
||||
LLWearable *wearable = getWearable(type, index);
|
||||
if (wearable)
|
||||
{
|
||||
mWearableDatas[type].erase(mWearableDatas[type].begin() + index);
|
||||
const BOOL removed = TRUE;
|
||||
wearableUpdated(wearable, removed);
|
||||
}
|
||||
}
|
||||
|
||||
void LLWearableData::clearWearableType(const LLWearableType::EType type)
|
||||
{
|
||||
wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(type);
|
||||
if (wearable_iter == mWearableDatas.end())
|
||||
{
|
||||
return;
|
||||
}
|
||||
wearableentry_vec_t& wearable_vec = wearable_iter->second;
|
||||
wearable_vec.clear();
|
||||
}
|
||||
|
||||
bool LLWearableData::swapWearables(const LLWearableType::EType type, U32 index_a, U32 index_b)
|
||||
{
|
||||
wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(type);
|
||||
if (wearable_iter == mWearableDatas.end())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
wearableentry_vec_t& wearable_vec = wearable_iter->second;
|
||||
if (0 > index_a || index_a >= wearable_vec.size()) return false;
|
||||
if (0 > index_b || index_b >= wearable_vec.size()) return false;
|
||||
|
||||
LLWearable* wearable = wearable_vec[index_a];
|
||||
wearable_vec[index_a] = wearable_vec[index_b];
|
||||
wearable_vec[index_b] = wearable;
|
||||
return true;
|
||||
}
|
||||
|
||||
void LLWearableData::pullCrossWearableValues(const LLWearableType::EType type)
|
||||
{
|
||||
llassert(mAvatarAppearance);
|
||||
// scan through all of the avatar's visual parameters
|
||||
for (LLViewerVisualParam* param = (LLViewerVisualParam*) mAvatarAppearance->getFirstVisualParam();
|
||||
param;
|
||||
param = (LLViewerVisualParam*) mAvatarAppearance->getNextVisualParam())
|
||||
{
|
||||
if( param )
|
||||
{
|
||||
LLDriverParam *driver_param = dynamic_cast<LLDriverParam*>(param);
|
||||
if(driver_param)
|
||||
{
|
||||
// parameter is a driver parameter, have it update its cross-driven params
|
||||
driver_param->updateCrossDrivenParams(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
U32 LLWearableData::getWearableIndex(const LLWearable *wearable) const
|
||||
{
|
||||
if (wearable == NULL)
|
||||
{
|
||||
return MAX_CLOTHING_PER_TYPE;
|
||||
}
|
||||
|
||||
const LLWearableType::EType type = wearable->getType();
|
||||
wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type);
|
||||
if (wearable_iter == mWearableDatas.end())
|
||||
{
|
||||
llwarns << "tried to get wearable index with an invalid type!" << llendl;
|
||||
return MAX_CLOTHING_PER_TYPE;
|
||||
}
|
||||
const wearableentry_vec_t& wearable_vec = wearable_iter->second;
|
||||
for(U32 index = 0; index < wearable_vec.size(); index++)
|
||||
{
|
||||
if (wearable_vec[index] == wearable)
|
||||
{
|
||||
return index;
|
||||
}
|
||||
}
|
||||
|
||||
return MAX_CLOTHING_PER_TYPE;
|
||||
}
|
||||
|
||||
BOOL LLWearableData::isOnTop(LLWearable* wearable) const
|
||||
{
|
||||
if (!wearable) return FALSE;
|
||||
const LLWearableType::EType type = wearable->getType();
|
||||
return ( getTopWearable(type) == wearable );
|
||||
}
|
||||
|
||||
const LLWearable* LLWearableData::getWearable(const LLWearableType::EType type, U32 index) const
|
||||
{
|
||||
wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type);
|
||||
if (wearable_iter == mWearableDatas.end())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
const wearableentry_vec_t& wearable_vec = wearable_iter->second;
|
||||
if (index>=wearable_vec.size())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
return wearable_vec[index];
|
||||
}
|
||||
}
|
||||
|
||||
LLWearable* LLWearableData::getTopWearable(const LLWearableType::EType type)
|
||||
{
|
||||
U32 count = getWearableCount(type);
|
||||
if ( count == 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return getWearable(type, count-1);
|
||||
}
|
||||
|
||||
const LLWearable* LLWearableData::getTopWearable(const LLWearableType::EType type) const
|
||||
{
|
||||
U32 count = getWearableCount(type);
|
||||
if ( count == 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return getWearable(type, count-1);
|
||||
}
|
||||
|
||||
LLWearable* LLWearableData::getBottomWearable(const LLWearableType::EType type)
|
||||
{
|
||||
if (getWearableCount(type) == 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return getWearable(type, 0);
|
||||
}
|
||||
|
||||
const LLWearable* LLWearableData::getBottomWearable(const LLWearableType::EType type) const
|
||||
{
|
||||
if (getWearableCount(type) == 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return getWearable(type, 0);
|
||||
}
|
||||
|
||||
U32 LLWearableData::getWearableCount(const LLWearableType::EType type) const
|
||||
{
|
||||
wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type);
|
||||
if (wearable_iter == mWearableDatas.end())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
const wearableentry_vec_t& wearable_vec = wearable_iter->second;
|
||||
return wearable_vec.size();
|
||||
}
|
||||
|
||||
U32 LLWearableData::getWearableCount(const U32 tex_index) const
|
||||
{
|
||||
const LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType((LLAvatarAppearanceDefines::ETextureIndex)tex_index);
|
||||
return getWearableCount(wearable_type);
|
||||
}
|
||||
|
||||
LLUUID LLWearableData::computeBakedTextureHash(LLAvatarAppearanceDefines::EBakedTextureIndex baked_index,
|
||||
BOOL generate_valid_hash) // Set to false if you want to upload the baked texture w/o putting it in the cache
|
||||
{
|
||||
LLUUID hash_id;
|
||||
bool hash_computed = false;
|
||||
LLMD5 hash;
|
||||
const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture(baked_index);
|
||||
|
||||
for (U8 i=0; i < baked_dict->mWearables.size(); i++)
|
||||
{
|
||||
const LLWearableType::EType baked_type = baked_dict->mWearables[i];
|
||||
const U32 num_wearables = getWearableCount(baked_type);
|
||||
for (U32 index = 0; index < num_wearables; ++index)
|
||||
{
|
||||
const LLWearable* wearable = getWearable(baked_type,index);
|
||||
if (wearable)
|
||||
{
|
||||
wearable->addToBakedTextureHash(hash);
|
||||
hash_computed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (hash_computed)
|
||||
{
|
||||
hash.update((const unsigned char*)baked_dict->mWearablesHashID.mData, UUID_BYTES);
|
||||
|
||||
if (!generate_valid_hash)
|
||||
{
|
||||
invalidateBakedTextureHash(hash);
|
||||
}
|
||||
hash.finalize();
|
||||
hash.raw_digest(hash_id.mData);
|
||||
}
|
||||
|
||||
return hash_id;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
/**
|
||||
* @file llwearabledata.h
|
||||
* @brief LLWearableData class header file
|
||||
*
|
||||
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#ifndef LL_WEARABLEDATA_H
|
||||
#define LL_WEARABLEDATA_H
|
||||
|
||||
#include "llavatarappearancedefines.h"
|
||||
#include "llwearable.h"
|
||||
#include "llerror.h"
|
||||
|
||||
class LLAvatarAppearance;
|
||||
|
||||
class LLWearableData
|
||||
{
|
||||
// *TODO: Figure out why this is causing compile error.
|
||||
//LOG_CLASS(LLWearableData);
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Constructors / destructors / Initializers
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
LLWearableData();
|
||||
virtual ~LLWearableData();
|
||||
|
||||
void setAvatarAppearance(LLAvatarAppearance* appearance) { mAvatarAppearance = appearance; }
|
||||
|
||||
protected:
|
||||
//--------------------------------------------------------------------
|
||||
// Accessors
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
LLWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/);
|
||||
const LLWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/) const;
|
||||
LLWearable* getTopWearable(const LLWearableType::EType type);
|
||||
const LLWearable* getTopWearable(const LLWearableType::EType type) const;
|
||||
LLWearable* getBottomWearable(const LLWearableType::EType type);
|
||||
const LLWearable* getBottomWearable(const LLWearableType::EType type) const;
|
||||
U32 getWearableCount(const LLWearableType::EType type) const;
|
||||
U32 getWearableCount(const U32 tex_index) const;
|
||||
U32 getWearableIndex(const LLWearable *wearable) const;
|
||||
|
||||
BOOL isOnTop(LLWearable* wearable) const;
|
||||
|
||||
static const U32 MAX_CLOTHING_PER_TYPE = 5;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Setters
|
||||
//--------------------------------------------------------------------
|
||||
protected:
|
||||
// Low-level data structure setter - public access is via setWearableItem, etc.
|
||||
void setWearable(const LLWearableType::EType type, U32 index, LLWearable *wearable);
|
||||
U32 pushWearable(const LLWearableType::EType type, LLWearable *wearable,
|
||||
bool trigger_updated = true);
|
||||
virtual void wearableUpdated(LLWearable *wearable, BOOL removed);
|
||||
void popWearable(LLWearable *wearable);
|
||||
void popWearable(const LLWearableType::EType type, U32 index);
|
||||
void clearWearableType(const LLWearableType::EType type);
|
||||
bool swapWearables(const LLWearableType::EType type, U32 index_a, U32 index_b);
|
||||
|
||||
private:
|
||||
void pullCrossWearableValues(const LLWearableType::EType type);
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Server Communication
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
LLUUID computeBakedTextureHash(LLAvatarAppearanceDefines::EBakedTextureIndex baked_index,
|
||||
BOOL generate_valid_hash = TRUE);
|
||||
protected:
|
||||
virtual void invalidateBakedTextureHash(LLMD5& hash) const {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Member variables
|
||||
//--------------------------------------------------------------------
|
||||
protected:
|
||||
LLAvatarAppearance* mAvatarAppearance;
|
||||
typedef std::vector<LLWearable*> wearableentry_vec_t; // all wearables of a certain type (EG all shirts)
|
||||
typedef std::map<LLWearableType::EType, wearableentry_vec_t> wearableentry_map_t; // wearable "categories" arranged by wearable type
|
||||
wearableentry_map_t mWearableDatas;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // LL_WEARABLEDATA_H
|
||||
|
||||
|
|
@ -24,23 +24,35 @@
|
|||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
#include "linden_common.h"
|
||||
#include "llwearabletype.h"
|
||||
#include "llinventoryfunctions.h"
|
||||
#include "lltrans.h"
|
||||
#include "llinventorytype.h"
|
||||
|
||||
static LLTranslationBridge* sTrans = NULL;
|
||||
|
||||
// static
|
||||
void LLWearableType::initClass(LLTranslationBridge* trans)
|
||||
{
|
||||
sTrans = trans;
|
||||
}
|
||||
|
||||
void LLWearableType::cleanupClass()
|
||||
{
|
||||
delete sTrans;
|
||||
}
|
||||
|
||||
struct WearableEntry : public LLDictionaryEntry
|
||||
{
|
||||
WearableEntry(const std::string &name,
|
||||
const std::string& default_new_name,
|
||||
LLAssetType::EType assetType,
|
||||
LLInventoryIcon::EIconName iconName,
|
||||
LLInventoryType::EIconName iconName,
|
||||
BOOL disable_camera_switch = FALSE,
|
||||
BOOL allow_multiwear = TRUE) :
|
||||
LLDictionaryEntry(name),
|
||||
mAssetType(assetType),
|
||||
mDefaultNewName(default_new_name),
|
||||
mLabel(LLTrans::getString(name)),
|
||||
mLabel(sTrans->getString(name)),
|
||||
mIconName(iconName),
|
||||
mDisableCameraSwitch(disable_camera_switch),
|
||||
mAllowMultiwear(allow_multiwear)
|
||||
|
|
@ -50,7 +62,7 @@ struct WearableEntry : public LLDictionaryEntry
|
|||
const LLAssetType::EType mAssetType;
|
||||
const std::string mLabel;
|
||||
const std::string mDefaultNewName; //keep mLabel for backward compatibility
|
||||
LLInventoryIcon::EIconName mIconName;
|
||||
LLInventoryType::EIconName mIconName;
|
||||
BOOL mDisableCameraSwitch;
|
||||
BOOL mAllowMultiwear;
|
||||
};
|
||||
|
|
@ -64,26 +76,26 @@ public:
|
|||
|
||||
LLWearableDictionary::LLWearableDictionary()
|
||||
{
|
||||
addEntry(LLWearableType::WT_SHAPE, new WearableEntry("shape", "New Shape", LLAssetType::AT_BODYPART, LLInventoryIcon::ICONNAME_BODYPART_SHAPE, FALSE, FALSE));
|
||||
addEntry(LLWearableType::WT_SKIN, new WearableEntry("skin", "New Skin", LLAssetType::AT_BODYPART, LLInventoryIcon::ICONNAME_BODYPART_SKIN, FALSE, FALSE));
|
||||
addEntry(LLWearableType::WT_HAIR, new WearableEntry("hair", "New Hair", LLAssetType::AT_BODYPART, LLInventoryIcon::ICONNAME_BODYPART_HAIR, FALSE, FALSE));
|
||||
addEntry(LLWearableType::WT_EYES, new WearableEntry("eyes", "New Eyes", LLAssetType::AT_BODYPART, LLInventoryIcon::ICONNAME_BODYPART_EYES, FALSE, FALSE));
|
||||
addEntry(LLWearableType::WT_SHIRT, new WearableEntry("shirt", "New Shirt", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_SHIRT, FALSE, TRUE));
|
||||
addEntry(LLWearableType::WT_PANTS, new WearableEntry("pants", "New Pants", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_PANTS, FALSE, TRUE));
|
||||
addEntry(LLWearableType::WT_SHOES, new WearableEntry("shoes", "New Shoes", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_SHOES, FALSE, TRUE));
|
||||
addEntry(LLWearableType::WT_SOCKS, new WearableEntry("socks", "New Socks", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_SOCKS, FALSE, TRUE));
|
||||
addEntry(LLWearableType::WT_JACKET, new WearableEntry("jacket", "New Jacket", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_JACKET, FALSE, TRUE));
|
||||
addEntry(LLWearableType::WT_GLOVES, new WearableEntry("gloves", "New Gloves", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_GLOVES, FALSE, TRUE));
|
||||
addEntry(LLWearableType::WT_UNDERSHIRT, new WearableEntry("undershirt", "New Undershirt", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_UNDERSHIRT, FALSE, TRUE));
|
||||
addEntry(LLWearableType::WT_UNDERPANTS, new WearableEntry("underpants", "New Underpants", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_UNDERPANTS, FALSE, TRUE));
|
||||
addEntry(LLWearableType::WT_SKIRT, new WearableEntry("skirt", "New Skirt", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_SKIRT, FALSE, TRUE));
|
||||
addEntry(LLWearableType::WT_ALPHA, new WearableEntry("alpha", "New Alpha", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_ALPHA, FALSE, TRUE));
|
||||
addEntry(LLWearableType::WT_TATTOO, new WearableEntry("tattoo", "New Tattoo", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_TATTOO, FALSE, TRUE));
|
||||
addEntry(LLWearableType::WT_SHAPE, new WearableEntry("shape", "New Shape", LLAssetType::AT_BODYPART, LLInventoryType::ICONNAME_BODYPART_SHAPE, FALSE, FALSE));
|
||||
addEntry(LLWearableType::WT_SKIN, new WearableEntry("skin", "New Skin", LLAssetType::AT_BODYPART, LLInventoryType::ICONNAME_BODYPART_SKIN, FALSE, FALSE));
|
||||
addEntry(LLWearableType::WT_HAIR, new WearableEntry("hair", "New Hair", LLAssetType::AT_BODYPART, LLInventoryType::ICONNAME_BODYPART_HAIR, FALSE, FALSE));
|
||||
addEntry(LLWearableType::WT_EYES, new WearableEntry("eyes", "New Eyes", LLAssetType::AT_BODYPART, LLInventoryType::ICONNAME_BODYPART_EYES, FALSE, FALSE));
|
||||
addEntry(LLWearableType::WT_SHIRT, new WearableEntry("shirt", "New Shirt", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_SHIRT, FALSE, TRUE));
|
||||
addEntry(LLWearableType::WT_PANTS, new WearableEntry("pants", "New Pants", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_PANTS, FALSE, TRUE));
|
||||
addEntry(LLWearableType::WT_SHOES, new WearableEntry("shoes", "New Shoes", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_SHOES, FALSE, TRUE));
|
||||
addEntry(LLWearableType::WT_SOCKS, new WearableEntry("socks", "New Socks", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_SOCKS, FALSE, TRUE));
|
||||
addEntry(LLWearableType::WT_JACKET, new WearableEntry("jacket", "New Jacket", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_JACKET, FALSE, TRUE));
|
||||
addEntry(LLWearableType::WT_GLOVES, new WearableEntry("gloves", "New Gloves", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_GLOVES, FALSE, TRUE));
|
||||
addEntry(LLWearableType::WT_UNDERSHIRT, new WearableEntry("undershirt", "New Undershirt", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_UNDERSHIRT, FALSE, TRUE));
|
||||
addEntry(LLWearableType::WT_UNDERPANTS, new WearableEntry("underpants", "New Underpants", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_UNDERPANTS, FALSE, TRUE));
|
||||
addEntry(LLWearableType::WT_SKIRT, new WearableEntry("skirt", "New Skirt", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_SKIRT, FALSE, TRUE));
|
||||
addEntry(LLWearableType::WT_ALPHA, new WearableEntry("alpha", "New Alpha", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_ALPHA, FALSE, TRUE));
|
||||
addEntry(LLWearableType::WT_TATTOO, new WearableEntry("tattoo", "New Tattoo", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_TATTOO, FALSE, TRUE));
|
||||
|
||||
addEntry(LLWearableType::WT_PHYSICS, new WearableEntry("physics", "New Physics", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_PHYSICS, TRUE, TRUE));
|
||||
addEntry(LLWearableType::WT_PHYSICS, new WearableEntry("physics", "New Physics", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_PHYSICS, TRUE, TRUE));
|
||||
|
||||
addEntry(LLWearableType::WT_INVALID, new WearableEntry("invalid", "Invalid Wearable", LLAssetType::AT_NONE, LLInventoryIcon::ICONNAME_NONE, FALSE, FALSE));
|
||||
addEntry(LLWearableType::WT_NONE, new WearableEntry("none", "Invalid Wearable", LLAssetType::AT_NONE, LLInventoryIcon::ICONNAME_NONE, FALSE, FALSE));
|
||||
addEntry(LLWearableType::WT_INVALID, new WearableEntry("invalid", "Invalid Wearable", LLAssetType::AT_NONE, LLInventoryType::ICONNAME_NONE, FALSE, FALSE));
|
||||
addEntry(LLWearableType::WT_NONE, new WearableEntry("none", "Invalid Wearable", LLAssetType::AT_NONE, LLInventoryType::ICONNAME_NONE, FALSE, FALSE));
|
||||
}
|
||||
|
||||
// static
|
||||
|
|
@ -131,7 +143,7 @@ LLAssetType::EType LLWearableType::getAssetType(LLWearableType::EType type)
|
|||
}
|
||||
|
||||
// static
|
||||
LLInventoryIcon::EIconName LLWearableType::getIconName(LLWearableType::EType type)
|
||||
LLInventoryType::EIconName LLWearableType::getIconName(LLWearableType::EType type)
|
||||
{
|
||||
const LLWearableDictionary *dict = LLWearableDictionary::getInstance();
|
||||
const WearableEntry *entry = dict->lookup(type);
|
||||
|
|
@ -29,9 +29,16 @@
|
|||
|
||||
#include "llassettype.h"
|
||||
#include "lldictionary.h"
|
||||
#include "llinventoryicon.h"
|
||||
#include "llinventorytype.h"
|
||||
#include "llsingleton.h"
|
||||
|
||||
class LLTranslationBridge
|
||||
{
|
||||
public:
|
||||
virtual std::string getString(const std::string &xml_desc) = 0;
|
||||
};
|
||||
|
||||
|
||||
class LLWearableType
|
||||
{
|
||||
public:
|
||||
|
|
@ -59,12 +66,15 @@ public:
|
|||
WT_NONE = -1,
|
||||
};
|
||||
|
||||
static void initClass(LLTranslationBridge* trans); // initializes static members
|
||||
static void cleanupClass(); // initializes static members
|
||||
|
||||
static const std::string& getTypeName(EType type);
|
||||
static const std::string& getTypeDefaultNewName(EType type);
|
||||
static const std::string& getTypeLabel(EType type);
|
||||
static LLAssetType::EType getAssetType(EType type);
|
||||
static EType typeNameToType(const std::string& type_name);
|
||||
static LLInventoryIcon::EIconName getIconName(EType type);
|
||||
static LLInventoryType::EIconName getIconName(EType type);
|
||||
static BOOL getDisableCameraSwitch(EType type);
|
||||
static BOOL getAllowMultiwear(EType type);
|
||||
|
||||
|
|
@ -88,6 +88,10 @@ list(APPEND llaudio_SOURCE_FILES ${llaudio_HEADER_FILES})
|
|||
add_library (llaudio ${llaudio_SOURCE_FILES})
|
||||
target_link_libraries(
|
||||
llaudio
|
||||
${LLCOMMON_LIBRARIES}
|
||||
${LLMATH_LIBRARIES}
|
||||
${LLMESSAGE_LIBRARIES}
|
||||
${LLVFS_LIBRARIES}
|
||||
${VORBISENC_LIBRARIES}
|
||||
${VORBISFILE_LIBRARIES}
|
||||
${VORBIS_LIBRARIES}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,10 @@ include_directories(
|
|||
${LLVFS_INCLUDE_DIRS}
|
||||
${LLXML_INCLUDE_DIRS}
|
||||
)
|
||||
include_directories(SYSTEM
|
||||
${LLCOMMON_SYSTEM_INCLUDE_DIRS}
|
||||
${LLXML_SYSTEM_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
set(llcharacter_SOURCE_FILES
|
||||
llanimationstates.cpp
|
||||
|
|
@ -76,6 +80,15 @@ list(APPEND llcharacter_SOURCE_FILES ${llcharacter_HEADER_FILES})
|
|||
|
||||
add_library (llcharacter ${llcharacter_SOURCE_FILES})
|
||||
|
||||
target_link_libraries(
|
||||
llcharacter
|
||||
${LLCOMMON_LIBRARIES}
|
||||
${LLMATH_LIBRARIES}
|
||||
${LLMESSAGE_LIBRARIES}
|
||||
${LLVFS_LIBRARIES}
|
||||
${LLXML_LIBRARIES}
|
||||
)
|
||||
|
||||
|
||||
# Add tests
|
||||
if (LL_TESTS)
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@ void LLCharacter::removeAnimationData(std::string name)
|
|||
//-----------------------------------------------------------------------------
|
||||
// setVisualParamWeight()
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL LLCharacter::setVisualParamWeight(LLVisualParam* which_param, F32 weight, BOOL upload_bake)
|
||||
BOOL LLCharacter::setVisualParamWeight(const LLVisualParam* which_param, F32 weight, BOOL upload_bake)
|
||||
{
|
||||
S32 index = which_param->getID();
|
||||
visual_param_index_map_t::iterator index_iter = mVisualParamIndexMap.find(index);
|
||||
|
|
|
|||
|
|
@ -93,13 +93,6 @@ public:
|
|||
// get the height & normal of the ground under a point
|
||||
virtual void getGround(const LLVector3 &inPos, LLVector3 &outPos, LLVector3 &outNorm) = 0;
|
||||
|
||||
// allocate an array of joints for the character skeleton
|
||||
// this must be overloaded to support joint subclasses,
|
||||
// and is called implicitly from buildSkeleton().
|
||||
// Note this must handle reallocation as it will be called
|
||||
// each time buildSkeleton() is called.
|
||||
virtual BOOL allocateCharacterJoints( U32 num ) = 0;
|
||||
|
||||
// skeleton joint accessor to support joint subclasses
|
||||
virtual LLJoint *getCharacterJoint( U32 i ) = 0;
|
||||
|
||||
|
|
@ -197,7 +190,7 @@ public:
|
|||
void addVisualParam(LLVisualParam *param);
|
||||
void addSharedVisualParam(LLVisualParam *param);
|
||||
|
||||
virtual BOOL setVisualParamWeight(LLVisualParam *which_param, F32 weight, BOOL upload_bake = FALSE );
|
||||
virtual BOOL setVisualParamWeight(const LLVisualParam *which_param, F32 weight, BOOL upload_bake = FALSE );
|
||||
virtual BOOL setVisualParamWeight(const char* param_name, F32 weight, BOOL upload_bake = FALSE );
|
||||
virtual BOOL setVisualParamWeight(S32 index, F32 weight, BOOL upload_bake = FALSE );
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,9 @@ S32 LLJoint::sNumTouches = 0;
|
|||
// LLJoint()
|
||||
// Class Constructor
|
||||
//-----------------------------------------------------------------------------
|
||||
LLJoint::LLJoint()
|
||||
|
||||
|
||||
void LLJoint::init()
|
||||
{
|
||||
mName = "unnamed";
|
||||
mParent = NULL;
|
||||
|
|
@ -48,7 +50,20 @@ LLJoint::LLJoint()
|
|||
mXform.setScale(LLVector3(1.0f, 1.0f, 1.0f));
|
||||
mDirtyFlags = MATRIX_DIRTY | ROTATION_DIRTY | POSITION_DIRTY;
|
||||
mUpdateXform = TRUE;
|
||||
mJointNum = -1;
|
||||
}
|
||||
|
||||
LLJoint::LLJoint() :
|
||||
mJointNum(-1)
|
||||
{
|
||||
init();
|
||||
touch();
|
||||
mResetAfterRestoreOldXform = false;
|
||||
}
|
||||
|
||||
LLJoint::LLJoint(S32 joint_num) :
|
||||
mJointNum(joint_num)
|
||||
{
|
||||
init();
|
||||
touch();
|
||||
mResetAfterRestoreOldXform = false;
|
||||
}
|
||||
|
|
@ -58,15 +73,12 @@ LLJoint::LLJoint()
|
|||
// LLJoint()
|
||||
// Class Constructor
|
||||
//-----------------------------------------------------------------------------
|
||||
LLJoint::LLJoint(const std::string &name, LLJoint *parent)
|
||||
LLJoint::LLJoint(const std::string &name, LLJoint *parent) :
|
||||
mJointNum(0)
|
||||
{
|
||||
mName = "unnamed";
|
||||
mParent = NULL;
|
||||
mXform.setScaleChildOffset(TRUE);
|
||||
mXform.setScale(LLVector3(1.0f, 1.0f, 1.0f));
|
||||
mDirtyFlags = MATRIX_DIRTY | ROTATION_DIRTY | POSITION_DIRTY;
|
||||
init();
|
||||
mUpdateXform = FALSE;
|
||||
mJointNum = 0;
|
||||
// *TODO: mResetAfterRestoreOldXform is not initialized!!!
|
||||
|
||||
setName(name);
|
||||
if (parent)
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue