Merge branch 'master' of github.com:singularity-viewer/SingularityViewer
This commit is contained in:
6
README
6
README
@@ -18,7 +18,7 @@ as those based upon the OpenSim platform.
|
||||
Singulariy is maintained by a small group of volunteers who can be contacted
|
||||
both, in-world (SingularityViewer group) as well on IRC (#SingularityViewer
|
||||
@ FreeNode). Bug requests and features requests can be submitted through our
|
||||
Issue Tracket (http://code.google.com/p/singularity-viewer/issues/list or from
|
||||
Issue Tracker (http://code.google.com/p/singularity-viewer/issues/list or from
|
||||
the viewer menu: Help --> Bug Reporting --> Singularity Issue Tracker...)
|
||||
|
||||
|
||||
@@ -33,6 +33,6 @@ As this Readme grows out of date, please refer to
|
||||
History
|
||||
|
||||
The Singularity viewer was started by Siana Gearz in November 2010 by forking it
|
||||
of the Ascent Viewer, by Balseraph Software Group, which in turn was based upon
|
||||
source code released by Linden Lab.
|
||||
from the Ascent Viewer, by Balseraph Software Group, which in turn was based upon
|
||||
source code modified from the snowglobe source code released by Linden Lab.
|
||||
|
||||
|
||||
@@ -248,6 +248,7 @@ Celierra Darling
|
||||
VWR-6975
|
||||
Cron Stardust
|
||||
VWR-10579
|
||||
STORM-1919
|
||||
Cypren Christenson
|
||||
SNOW-129
|
||||
SNOW-140
|
||||
|
||||
@@ -378,6 +378,14 @@
|
||||
<boolean>true</boolean>
|
||||
</map>
|
||||
|
||||
<key>WindLightRefresh</key>
|
||||
<map>
|
||||
<key>flavor</key>
|
||||
<string>llsd</string>
|
||||
<key>trusted-sender</key>
|
||||
<boolean>true</boolean>
|
||||
</map>
|
||||
|
||||
<key>ParcelVoiceInfo</key>
|
||||
<map>
|
||||
<key>flavor</key>
|
||||
@@ -386,7 +394,6 @@
|
||||
<boolean>true</boolean>
|
||||
</map>
|
||||
|
||||
|
||||
<key>ParcelNavigateMedia</key>
|
||||
<map>
|
||||
<key>flavor</key>
|
||||
@@ -656,7 +663,7 @@
|
||||
<boolean>false</boolean>
|
||||
|
||||
<key>RequestTextureDownload</key>
|
||||
<boolean>false</boolean>
|
||||
<boolean>true</boolean>
|
||||
|
||||
<key>EventQueueGet</key>
|
||||
<boolean>false</boolean>
|
||||
@@ -708,6 +715,9 @@
|
||||
|
||||
<key>FetchLib2</key>
|
||||
<boolean>true</boolean>
|
||||
|
||||
<key>UploadBakedTexture</key>
|
||||
<boolean>true</boolean>
|
||||
</map>
|
||||
|
||||
<key>messageBans</key>
|
||||
|
||||
@@ -48,6 +48,7 @@ add_custom_target(prepare DEPENDS ${prepare_depends})
|
||||
add_subdirectory(cmake)
|
||||
add_subdirectory(${LIBS_OPEN_PREFIX}aistatemachine)
|
||||
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}llimage)
|
||||
|
||||
@@ -29,7 +29,7 @@ if (WINDOWS)
|
||||
# Don't build DLLs.
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Od /Zi /MDd /arch:SSE2"
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Od /Zi /MDd /MP /arch:SSE2"
|
||||
CACHE STRING "C++ compiler debug options" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
||||
"${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od /Zi /MD /MP /arch:SSE2"
|
||||
|
||||
@@ -41,6 +41,7 @@ set(cmake_SOURCE_FILES
|
||||
Hunspell.cmake
|
||||
JPEG.cmake
|
||||
LLAddBuildTest.cmake
|
||||
LLAppearance.cmake
|
||||
LLAudio.cmake
|
||||
LLCharacter.cmake
|
||||
LLCommon.cmake
|
||||
|
||||
@@ -2,54 +2,52 @@
|
||||
|
||||
include(Linking)
|
||||
|
||||
if(INSTALL_PROPRIETARY)
|
||||
include(Prebuilt)
|
||||
use_prebuilt_binary(fmodex)
|
||||
endif(INSTALL_PROPRIETARY)
|
||||
|
||||
find_library(FMODEX_LIBRARY
|
||||
NAMES fmodex fmodexL fmodex_vc fmodexL_vc
|
||||
PATHS
|
||||
optimized ${ARCH_PREBUILT_DIRS_RELEASE}
|
||||
debug ${ARCH_PREBUILT_DIRS_DEBUG}
|
||||
)
|
||||
|
||||
if (NOT FMODEX_LIBRARY)
|
||||
set(FMODEX_SDK_DIR CACHE PATH "Path to the FMOD Ex SDK.")
|
||||
if (FMODEX_SDK_DIR)
|
||||
find_library(FMODEX_LIBRARY
|
||||
fmodex_vc fmodexL_vc fmodex fmodexL fmodex64 fmodexL64
|
||||
PATHS
|
||||
${FMODEX_SDK_DIR}/api/lib
|
||||
${FMODEX_SDK_DIR}/api
|
||||
${FMODEX_SDK_DIR}/lib
|
||||
${FMODEX_SDK_DIR}
|
||||
)
|
||||
|
||||
if(WORD_SIZE EQUAL 32)
|
||||
find_library(FMODEX_LIBRARY
|
||||
fmodex_vc fmodexL_vc fmodex fmodexL
|
||||
PATHS
|
||||
"${FMODEX_SDK_DIR}/api/lib"
|
||||
"${FMODEX_SDK_DIR}/api"
|
||||
"${FMODEX_SDK_DIR}/lib"
|
||||
"${FMODEX_SDK_DIR}"
|
||||
)
|
||||
elseif(WORD_SIZE EQUAL 64)
|
||||
find_library(FMODEX_LIBRARY
|
||||
fmodex64 fmodexL64
|
||||
PATHS
|
||||
"${FMODEX_SDK_DIR}/api/lib"
|
||||
"${FMODEX_SDK_DIR}/api"
|
||||
"${FMODEX_SDK_DIR}/lib"
|
||||
"${FMODEX_SDK_DIR}"
|
||||
)
|
||||
endif(WORD_SIZE EQUAL 32)
|
||||
endif(FMODEX_SDK_DIR)
|
||||
if(WINDOWS AND NOT FMODEX_LIBRARY)
|
||||
set(FMODEX_PROG_DIR "$ENV{PROGRAMFILES}/FMOD SoundSystem/FMOD Programmers API Windows")
|
||||
find_library(FMODEX_LIBRARY
|
||||
fmodex_vc fmodexL_vc
|
||||
PATHS
|
||||
${FMODEX_PROG_DIR}/api/lib
|
||||
${FMODEX_PROG_DIR}/api
|
||||
${FMODEX_PROG_DIR}
|
||||
"${FMODEX_PROG_DIR}/api/lib"
|
||||
"${FMODEX_PROG_DIR}/api"
|
||||
"${FMODEX_PROG_DIR}"
|
||||
)
|
||||
if(FMODEX_LIBRARY)
|
||||
message(STATUS "Found fmodex in ${FMODEX_PROG_DIR}")
|
||||
set(FMODEX_SDK_DIR ${FMODEX_PROG_DIR})
|
||||
set(FMODEX_SDK_DIR ${FMODEX_PROG_DIR} CACHE PATH "Path to the FMOD Ex SDK." FORCE)
|
||||
set(FMODEX_SDK_DIR "${FMODEX_PROG_DIR}")
|
||||
set(FMODEX_SDK_DIR "${FMODEX_PROG_DIR}" CACHE PATH "Path to the FMOD Ex SDK." FORCE)
|
||||
endif(FMODEX_LIBRARY)
|
||||
endif(WINDOWS AND NOT FMODEX_LIBRARY)
|
||||
endif (NOT FMODEX_LIBRARY)
|
||||
|
||||
find_path(FMODEX_INCLUDE_DIR fmod.hpp
|
||||
${LIBS_PREBUILT_DIR}/include/fmodex
|
||||
${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/fmodex
|
||||
${FMODEX_SDK_DIR}/api/inc
|
||||
${FMODEX_SDK_DIR}/inc
|
||||
${FMODEX_SDK_DIR}
|
||||
"${LIBS_PREBUILT_DIR}/include/fmodex"
|
||||
"${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/fmodex"
|
||||
"${FMODEX_SDK_DIR}/api/inc"
|
||||
"${FMODEX_SDK_DIR}/inc"
|
||||
"${FMODEX_SDK_DIR}"
|
||||
)
|
||||
|
||||
if(DARWIN)
|
||||
|
||||
@@ -3,16 +3,18 @@
|
||||
# - Find JSONCpp
|
||||
# Find the JSONCpp includes and library
|
||||
# This module defines
|
||||
# JSONCPP_INCLUDE_DIR, where to find json.h, etc.
|
||||
# JSONCPP_LIBRARIES, the libraries needed to use jsoncpp.
|
||||
# JSONCPP_FOUND, If false, do not try to use jsoncpp.
|
||||
# also defined, but not for general use are
|
||||
# JSONCPP_LIBRARY, where to find the jsoncpp library.
|
||||
# JSONCPP_FOUND, System has libjsoncpp.
|
||||
# JSONCPP_INCLUDE_DIRS - The libjsoncpp include directories.
|
||||
# JSONCPP_LIBRARIES - The libraries needed to use libjsoncpp.
|
||||
# JSONCPP_DEFINITIONS - Compiler switches required for using libjsoncpp.
|
||||
|
||||
FIND_PATH(JSONCPP_INCLUDE_DIR json/json.h
|
||||
/usr/local/include
|
||||
/usr/include
|
||||
)
|
||||
FIND_PACKAGE(PkgConfig)
|
||||
PKG_CHECK_MODULES(PC_JSONCPP jsoncpp)
|
||||
SET(JSONCPP_DEFINITIONS ${PC_JSONCPP_CFLAGS_OTHER})
|
||||
|
||||
FIND_PATH(JSONCPP_INCLUDE_DIR json/reader.h
|
||||
HINTS ${PC_JSONCPP_INCLUDE_DIR} ${PC_JSONCPP_INCLUDE_DIRS}
|
||||
PATH_SUFFIXES jsoncpp)
|
||||
|
||||
# Get the GCC compiler version
|
||||
EXEC_PROGRAM(${CMAKE_CXX_COMPILER}
|
||||
@@ -22,39 +24,16 @@ EXEC_PROGRAM(${CMAKE_CXX_COMPILER}
|
||||
)
|
||||
|
||||
# Try to find a library that was compiled with the same compiler version as we currently use.
|
||||
SET(JSONCPP_NAMES ${JSONCPP_NAMES} libjson_linux-gcc-${_gcc_COMPILER_VERSION}_libmt.so)
|
||||
IF (STANDALONE)
|
||||
# On standalone, assume that the system installed library was compiled with the used compiler.
|
||||
SET(JSONCPP_NAMES ${JSONCPP_NAMES} libjson.so)
|
||||
ENDIF (STANDALONE)
|
||||
FIND_LIBRARY(JSONCPP_LIBRARY
|
||||
NAMES ${JSONCPP_NAMES}
|
||||
PATHS /usr/lib /usr/local/lib
|
||||
)
|
||||
NAMES libjson_linux-gcc-${_gcc_COMPILER_VERSION}_libmt.so libjsoncpp.so
|
||||
HINTS ${PC_JSONCPP_LIBDIR} ${PC_JSONCPP_LIBRARY_DIRS}
|
||||
PATHS /usr/lib /usr/local/lib)
|
||||
|
||||
IF (JSONCPP_LIBRARY AND JSONCPP_INCLUDE_DIR)
|
||||
SET(JSONCPP_LIBRARIES ${JSONCPP_LIBRARY})
|
||||
SET(JSONCPP_FOUND "YES")
|
||||
ELSE (JSONCPP_LIBRARY AND JSONCPP_INCLUDE_DIR)
|
||||
SET(JSONCPP_FOUND "NO")
|
||||
ENDIF (JSONCPP_LIBRARY AND JSONCPP_INCLUDE_DIR)
|
||||
SET(JSONCPP_LIBRARIES ${JSONCPP_LIBRARY})
|
||||
SET(JSONCPP_INCLUDE_DIRS ${JSONCPP_INCLUDE_DIR})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(JSONCPP DEFAULT_MSG
|
||||
JSONCPP_LIBRARY JSONCPP_INCLUDE_DIR)
|
||||
|
||||
IF (JSONCPP_FOUND)
|
||||
IF (NOT JSONCPP_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found JSONCpp: ${JSONCPP_LIBRARIES}")
|
||||
ENDIF (NOT JSONCPP_FIND_QUIETLY)
|
||||
ELSE (JSONCPP_FOUND)
|
||||
IF (JSONCPP_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could not find JSONCpp library")
|
||||
ENDIF (JSONCPP_FIND_REQUIRED)
|
||||
ENDIF (JSONCPP_FOUND)
|
||||
|
||||
# Deprecated declarations.
|
||||
SET (NATIVE_JSONCPP_INCLUDE_PATH ${JSONCPP_INCLUDE_DIR} )
|
||||
GET_FILENAME_COMPONENT (NATIVE_JSONCPP_LIB_PATH ${JSONCPP_LIBRARY} PATH)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
JSONCPP_LIBRARY
|
||||
JSONCPP_INCLUDE_DIR
|
||||
)
|
||||
MARK_AS_ADVANCED(JSONCPP_LIBRARY JSONCPP_INCLUDE_DIR)
|
||||
|
||||
@@ -11,10 +11,10 @@ else (STANDALONE)
|
||||
if (LINUX OR WINDOWS AND NOT WORD_SIZE EQUAL 64)
|
||||
use_prebuilt_binary(gperftools)
|
||||
endif (LINUX OR WINDOWS AND NOT WORD_SIZE EQUAL 64)
|
||||
if (WINDOWS)
|
||||
if (WINDOWS AND NOT DISABLE_TCMALLOC)
|
||||
set(TCMALLOC_LIBRARIES libtcmalloc_minimal.lib)
|
||||
set(TCMALLOC_LINKER_FLAGS "/INCLUDE:\"__tcmalloc\"")
|
||||
endif (WINDOWS)
|
||||
endif (WINDOWS AND NOT DISABLE_TCMALLOC)
|
||||
if (LINUX)
|
||||
if(USE_GOOGLE_PERFTOOLS)
|
||||
set(TCMALLOC_LIBRARIES tcmalloc)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
include(Prebuilt)
|
||||
|
||||
set(JSONCPP_FIND_QUIETLY ON)
|
||||
set(JSONCPP_FIND_QUIETLY OFF)
|
||||
set(JSONCPP_FIND_REQUIRED ON)
|
||||
|
||||
if (STANDALONE)
|
||||
|
||||
11
indra/cmake/LLAppearance.cmake
Normal file
11
indra/cmake/LLAppearance.cmake
Normal file
@@ -0,0 +1,11 @@
|
||||
# -*- cmake -*-
|
||||
|
||||
include(Variables)
|
||||
|
||||
set(LLAPPEARANCE_INCLUDE_DIRS
|
||||
${LIBS_OPEN_DIR}/llappearance
|
||||
)
|
||||
|
||||
set(LLAPPEARANCE_LIBRARIES llappearance)
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ include(Prebuilt)
|
||||
set(OpenSSL_FIND_QUIETLY ON)
|
||||
set(OpenSSL_FIND_REQUIRED ON)
|
||||
|
||||
if (STANDALONE)
|
||||
if (STANDALONE OR USE_SYSTEM_OPENSSL)
|
||||
include(FindOpenSSL)
|
||||
else (STANDALONE)
|
||||
else (STANDALONE OR USE_SYSTEM_OPENSSL)
|
||||
use_prebuilt_binary(openSSL)
|
||||
if (WINDOWS)
|
||||
set(OPENSSL_LIBRARIES ssleay32 libeay32)
|
||||
@@ -14,7 +14,7 @@ else (STANDALONE)
|
||||
set(OPENSSL_LIBRARIES ssl)
|
||||
endif (WINDOWS)
|
||||
set(OPENSSL_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include)
|
||||
endif (STANDALONE)
|
||||
endif (STANDALONE OR USE_SYSTEM_OPENSSL)
|
||||
|
||||
if (LINUX OR DARWIN)
|
||||
set(CRYPTO_LIBRARIES crypto)
|
||||
|
||||
@@ -30,6 +30,7 @@ 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(DISABLE_TCMALLOC OFF CACHE BOOL "Disable linkage of TCMalloc. (64bit builds automatically disable TCMalloc)")
|
||||
set(LL_TESTS OFF CACHE BOOL "Build and run unit and integration tests (disable for build timing runs to reduce variation)")
|
||||
set(VISTA_ICON OFF CACHE BOOL "Allow vista icon with pre 2008 Visual Studio IDEs. (Assumes replacement old rcdll.dll with new rcdll.dll from win sdk 7.0 or later)")
|
||||
|
||||
|
||||
@@ -236,8 +236,10 @@ void stop_recording_backtraces(void)
|
||||
channel_ct backtrace DDCN("BACKTRACE"); //!< This debug channel is used for backtraces.
|
||||
channel_ct statemachine DDCN("STATEMACHINE"); //!< This debug channel is used for output related to class AIStateMachine.
|
||||
channel_ct caps DDCN("CAPS"); //!< This debug channel is used for output related to Capabilities.
|
||||
channel_ct curl DDCN("CURL"); //!< This debug channel is used for output related to Curl.
|
||||
channel_ct curlio DDCN("CURLIO"); //!< This debug channel is used to print debug output of libcurl.
|
||||
channel_ct curl DDCN("CURL"); //!< This debug channel is used for output related to AICurl.
|
||||
channel_ct curlio DDCN("CURLIO"); //!< This debug channel is used to print debug output of libcurl. This includes all HTTP network traffic.
|
||||
channel_ct curltr DDCN("CURLTR"); //!< This debug channel is used to print libcurl API calls.
|
||||
channel_ct snapshot DDCN("SNAPSHOT"); //!< This debug channel is used for output related to snapshots.
|
||||
|
||||
} // namespace dc
|
||||
} // namespace DEBUGCHANNELS
|
||||
|
||||
@@ -207,6 +207,8 @@ extern CWD_API channel_ct statemachine;
|
||||
extern CWD_API channel_ct caps;
|
||||
extern CWD_API channel_ct curl;
|
||||
extern CWD_API channel_ct curlio;
|
||||
extern CWD_API channel_ct curltr;
|
||||
extern CWD_API channel_ct snapshot;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -782,13 +782,14 @@ Commands:
|
||||
|
||||
Command-options for "configure":
|
||||
We use cmake variables to change the build configuration.
|
||||
-DSERVER:BOOL=OFF Don't configure simulator/dataserver/etc
|
||||
-DVIEWER:BOOL=OFF Don't configure the viewer
|
||||
-DPACKAGE:BOOL=ON Create "package" target to make installers
|
||||
-DLOCALIZESETUP:BOOL=ON Create one win_setup target per supported language
|
||||
-DLL_TESTS:BOOL=OFF Don't generate unit test projects
|
||||
-DEXAMPLEPLUGIN:BOOL=OFF Don't generate example plugin project
|
||||
-VISTA_ICON:BOOL=ON Allow pre-2008 VS to use vista-optimized resource file. (Requires updated rcdll.dll!)
|
||||
-DSERVER:BOOL=OFF Don't configure simulator/dataserver/etc
|
||||
-DVIEWER:BOOL=OFF Don't configure the viewer
|
||||
-DPACKAGE:BOOL=ON Create "package" target to make installers
|
||||
-DLOCALIZESETUP:BOOL=ON Create one win_setup target per supported language
|
||||
-DLL_TESTS:BOOL=OFF Don't generate unit test projects
|
||||
-DEXAMPLEPLUGIN:BOOL=OFF Don't generate example plugin project
|
||||
-DDISABLE_TCMALLOC:BOOL=ON Disable linkage of TCMalloc. (64bit builds automatically disable TCMalloc)
|
||||
-DVISTA_ICON:BOOL=ON Allow pre-2008 VS to use vista-optimized resource file. (Requires updated rcdll.dll!)
|
||||
|
||||
Examples:
|
||||
Set up a viewer-only project for your system:
|
||||
|
||||
@@ -7,14 +7,15 @@ include(00-Common)
|
||||
|
||||
# OPENJPEG version number, useful for packaging and doxygen doc:
|
||||
set(OPENJPEG_VERSION_MAJOR 1)
|
||||
set(OPENJPEG_VERSION_MINOR 4)
|
||||
set(OPENJPEG_VERSION_BUILD 0)
|
||||
set(OPENJPEG_VERSION_MINOR 5)
|
||||
set(OPENJPEG_VERSION_BUILD 2)
|
||||
set(OPENJPEG_VERSION
|
||||
"${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}")
|
||||
|
||||
set(openjpeg_SOURCE_FILES
|
||||
bio.c
|
||||
cio.c
|
||||
cidx_manager.c
|
||||
dwt.c
|
||||
event.c
|
||||
image.c
|
||||
@@ -26,20 +27,26 @@ set(openjpeg_SOURCE_FILES
|
||||
mqc.c
|
||||
openjpeg.c
|
||||
pi.c
|
||||
phix_manager.c
|
||||
ppix_manager.c
|
||||
raw.c
|
||||
t1.c
|
||||
t2.c
|
||||
tcd.c
|
||||
tgt.c
|
||||
thix_manager.c
|
||||
tpix_manager.c
|
||||
)
|
||||
|
||||
set(openjpeg_HEADER_FILES
|
||||
bio.h
|
||||
cio.h
|
||||
cidx_manager.h
|
||||
dwt.h
|
||||
event.h
|
||||
event.h
|
||||
fix.h
|
||||
image.h
|
||||
indexbox_manager.h
|
||||
int.h
|
||||
j2k.h
|
||||
j2k_lib.h
|
||||
@@ -48,6 +55,7 @@ set(openjpeg_HEADER_FILES
|
||||
mct.h
|
||||
mqc.h
|
||||
openjpeg.h
|
||||
opj_config.h
|
||||
opj_includes.h
|
||||
opj_malloc.h
|
||||
pi.h
|
||||
|
||||
211
indra/libopenjpeg/cidx_manager.c
Normal file
211
indra/libopenjpeg/cidx_manager.c
Normal file
@@ -0,0 +1,211 @@
|
||||
/*
|
||||
* $Id: cidx_manager.c 897 2011-08-28 21:43:57Z Kaori.Hagihara@gmail.com $
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||
* Copyright (c) 2003-2004, Yannick Verschueren
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "opj_includes.h"
|
||||
|
||||
|
||||
/*
|
||||
* Write CPTR Codestream finder box
|
||||
*
|
||||
* @param[in] coff offset of j2k codestream
|
||||
* @param[in] clen length of j2k codestream
|
||||
* @param[in] cio file output handle
|
||||
*/
|
||||
void write_cptr(int coff, int clen, opj_cio_t *cio);
|
||||
|
||||
|
||||
/*
|
||||
* Write main header index table (box)
|
||||
*
|
||||
* @param[in] coff offset of j2k codestream
|
||||
* @param[in] cstr_info codestream information
|
||||
* @param[in] cio file output handle
|
||||
* @return length of mainmhix box
|
||||
*/
|
||||
int write_mainmhix( int coff, opj_codestream_info_t cstr_info, opj_cio_t *cio);
|
||||
|
||||
|
||||
/*
|
||||
* Check if EPH option is used
|
||||
*
|
||||
* @param[in] coff offset of j2k codestream
|
||||
* @param[in] markers marker information
|
||||
* @param[in] marknum number of markers
|
||||
* @param[in] cio file output handle
|
||||
* @return true if EPH is used
|
||||
*/
|
||||
opj_bool check_EPHuse( int coff, opj_marker_info_t *markers, int marknum, opj_cio_t *cio);
|
||||
|
||||
|
||||
int write_cidx( int offset, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t cstr_info, int j2klen)
|
||||
{
|
||||
int len, i, lenp;
|
||||
opj_jp2_box_t *box;
|
||||
int num_box = 0;
|
||||
opj_bool EPHused;
|
||||
(void)image; /* unused ? */
|
||||
|
||||
lenp = -1;
|
||||
box = (opj_jp2_box_t *)opj_calloc( 32, sizeof(opj_jp2_box_t));
|
||||
|
||||
for (i=0;i<2;i++){
|
||||
|
||||
if(i)
|
||||
cio_seek( cio, lenp);
|
||||
|
||||
lenp = cio_tell( cio);
|
||||
|
||||
cio_skip( cio, 4); /* L [at the end] */
|
||||
cio_write( cio, JPIP_CIDX, 4); /* CIDX */
|
||||
write_cptr( offset, cstr_info.codestream_size, cio);
|
||||
|
||||
write_manf( i, num_box, box, cio);
|
||||
|
||||
num_box = 0;
|
||||
box[num_box].length = write_mainmhix( offset, cstr_info, cio);
|
||||
box[num_box].type = JPIP_MHIX;
|
||||
num_box++;
|
||||
|
||||
box[num_box].length = write_tpix( offset, cstr_info, j2klen, cio);
|
||||
box[num_box].type = JPIP_TPIX;
|
||||
num_box++;
|
||||
|
||||
box[num_box].length = write_thix( offset, cstr_info, cio);
|
||||
box[num_box].type = JPIP_THIX;
|
||||
num_box++;
|
||||
|
||||
EPHused = check_EPHuse( offset, cstr_info.marker, cstr_info.marknum, cio);
|
||||
|
||||
box[num_box].length = write_ppix( offset, cstr_info, EPHused, j2klen, cio);
|
||||
box[num_box].type = JPIP_PPIX;
|
||||
num_box++;
|
||||
|
||||
box[num_box].length = write_phix( offset, cstr_info, EPHused, j2klen, cio);
|
||||
box[num_box].type = JPIP_PHIX;
|
||||
num_box++;
|
||||
|
||||
len = cio_tell( cio)-lenp;
|
||||
cio_seek( cio, lenp);
|
||||
cio_write( cio, len, 4); /* L */
|
||||
cio_seek( cio, lenp+len);
|
||||
}
|
||||
|
||||
opj_free( box);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
void write_cptr(int coff, int clen, opj_cio_t *cio)
|
||||
{
|
||||
int len, lenp;
|
||||
|
||||
lenp = cio_tell( cio);
|
||||
cio_skip( cio, 4); /* L [at the end] */
|
||||
cio_write( cio, JPIP_CPTR, 4); /* T */
|
||||
cio_write( cio, 0, 2); /* DR A PRECISER !! */
|
||||
cio_write( cio, 0, 2); /* CONT */
|
||||
cio_write( cio, coff, 8); /* COFF A PRECISER !! */
|
||||
cio_write( cio, clen, 8); /* CLEN */
|
||||
len = cio_tell( cio) - lenp;
|
||||
cio_seek( cio, lenp);
|
||||
cio_write( cio, len, 4); /* L */
|
||||
cio_seek( cio, lenp+len);
|
||||
}
|
||||
|
||||
void write_manf(int second, int v, opj_jp2_box_t *box, opj_cio_t *cio)
|
||||
{
|
||||
int len, lenp, i;
|
||||
|
||||
lenp = cio_tell( cio);
|
||||
cio_skip( cio, 4); /* L [at the end] */
|
||||
cio_write( cio, JPIP_MANF,4); /* T */
|
||||
|
||||
if (second){ /* Write only during the second pass */
|
||||
for( i=0; i<v; i++){
|
||||
cio_write( cio, box[i].length, 4); /* Box length */
|
||||
cio_write( cio, box[i].type, 4); /* Box type */
|
||||
}
|
||||
}
|
||||
|
||||
len = cio_tell( cio) - lenp;
|
||||
cio_seek( cio, lenp);
|
||||
cio_write( cio, len, 4); /* L */
|
||||
cio_seek( cio, lenp+len);
|
||||
}
|
||||
|
||||
int write_mainmhix( int coff, opj_codestream_info_t cstr_info, opj_cio_t *cio)
|
||||
{
|
||||
int i;
|
||||
int len, lenp;
|
||||
|
||||
lenp = cio_tell( cio);
|
||||
cio_skip( cio, 4); /* L [at the end] */
|
||||
cio_write( cio, JPIP_MHIX, 4); /* MHIX */
|
||||
|
||||
cio_write( cio, cstr_info.main_head_end-cstr_info.main_head_start+1, 8); /* TLEN */
|
||||
|
||||
for(i = 1; i < cstr_info.marknum; i++){ /* Marker restricted to 1 apparition, skip SOC marker */
|
||||
cio_write( cio, cstr_info.marker[i].type, 2);
|
||||
cio_write( cio, 0, 2);
|
||||
cio_write( cio, cstr_info.marker[i].pos-coff, 8);
|
||||
cio_write( cio, cstr_info.marker[i].len, 2);
|
||||
}
|
||||
|
||||
len = cio_tell( cio) - lenp;
|
||||
cio_seek( cio, lenp);
|
||||
cio_write( cio, len, 4); /* L */
|
||||
cio_seek( cio, lenp+len);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
opj_bool check_EPHuse( int coff, opj_marker_info_t *markers, int marknum, opj_cio_t *cio)
|
||||
{
|
||||
opj_bool EPHused = OPJ_FALSE;
|
||||
int i=0;
|
||||
int org_pos;
|
||||
unsigned int Scod;
|
||||
|
||||
for(i = 0; i < marknum; i++){
|
||||
if( markers[i].type == J2K_MS_COD){
|
||||
org_pos = cio_tell( cio);
|
||||
cio_seek( cio, coff+markers[i].pos+2);
|
||||
|
||||
Scod = cio_read( cio, 1);
|
||||
if( ((Scod >> 2) & 1))
|
||||
EPHused = OPJ_TRUE;
|
||||
cio_seek( cio, org_pos);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
return EPHused;
|
||||
}
|
||||
56
indra/libopenjpeg/cidx_manager.h
Normal file
56
indra/libopenjpeg/cidx_manager.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* $Id: cidx_manager.h 897 2011-08-28 21:43:57Z Kaori.Hagihara@gmail.com $
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||
* Copyright (c) 2003-2004, Yannick Verschueren
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*! \file
|
||||
* \brief Modification of jpip.h from 2KAN indexer
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CIDX_MANAGER_H_
|
||||
# define CIDX_MANAGER_H_
|
||||
|
||||
#include "openjpeg.h"
|
||||
|
||||
|
||||
/*
|
||||
* Write Codestream index box (superbox)
|
||||
*
|
||||
* @param[in] offset offset of j2k codestream
|
||||
* @param[in] cio file output handle
|
||||
* @param[in] image image data
|
||||
* @param[in] cstr_info codestream information
|
||||
* @param[in] j2klen length of j2k codestream
|
||||
* @return length of cidx box
|
||||
*/
|
||||
int write_cidx( int offset, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t cstr_info, int j2klen);
|
||||
|
||||
|
||||
#endif /* !CIDX_MANAGER_H_ */
|
||||
@@ -126,13 +126,13 @@ unsigned char *cio_getbp(opj_cio_t *cio) {
|
||||
/*
|
||||
* Write a byte.
|
||||
*/
|
||||
bool cio_byteout(opj_cio_t *cio, unsigned char v) {
|
||||
opj_bool cio_byteout(opj_cio_t *cio, unsigned char v) {
|
||||
if (cio->bp >= cio->end) {
|
||||
opj_event_msg(cio->cinfo, EVT_ERROR, "write error\n");
|
||||
return false;
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
*cio->bp++ = v;
|
||||
return true;
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -152,7 +152,7 @@ unsigned char cio_bytein(opj_cio_t *cio) {
|
||||
* v : value to write
|
||||
* n : number of bytes to write
|
||||
*/
|
||||
unsigned int cio_write(opj_cio_t *cio, unsigned int v, int n) {
|
||||
unsigned int cio_write(opj_cio_t *cio, unsigned int64 v, int n) {
|
||||
int i;
|
||||
for (i = n - 1; i >= 0; i--) {
|
||||
if( !cio_byteout(cio, (unsigned char) ((v >> (i << 3)) & 0xff)) )
|
||||
|
||||
@@ -31,6 +31,13 @@
|
||||
|
||||
#ifndef __CIO_H
|
||||
#define __CIO_H
|
||||
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||
#define int64 __int64
|
||||
#else
|
||||
#define int64 long long
|
||||
#endif
|
||||
|
||||
/**
|
||||
@file cio.h
|
||||
@brief Implementation of a byte input-output process (CIO)
|
||||
@@ -63,7 +70,7 @@ Write some bytes
|
||||
@param n Number of bytes to write
|
||||
@return Returns the number of bytes written or 0 if an error occured
|
||||
*/
|
||||
unsigned int cio_write(opj_cio_t *cio, unsigned int v, int n);
|
||||
unsigned int cio_write(opj_cio_t *cio, unsigned int64 v, int n);
|
||||
/**
|
||||
Read some bytes
|
||||
@param cio CIO handle
|
||||
|
||||
@@ -64,12 +64,12 @@ typedef struct v4dwt_local {
|
||||
int cas ;
|
||||
} v4dwt_t ;
|
||||
|
||||
static const float dwt_alpha = 1.586134342f; // 12994
|
||||
static const float dwt_beta = 0.052980118f; // 434
|
||||
static const float dwt_gamma = -0.882911075f; // -7233
|
||||
static const float dwt_delta = -0.443506852f; // -3633
|
||||
static const float dwt_alpha = 1.586134342f; /* 12994 */
|
||||
static const float dwt_beta = 0.052980118f; /* 434 */
|
||||
static const float dwt_gamma = -0.882911075f; /* -7233 */
|
||||
static const float dwt_delta = -0.443506852f; /* -3633 */
|
||||
|
||||
static const float K = 1.230174105f; // 10078
|
||||
static const float K = 1.230174105f; /* 10078 */
|
||||
/* FIXME: What is this constant? */
|
||||
static const float c13318 = 1.625732422f;
|
||||
|
||||
@@ -527,7 +527,7 @@ static void dwt_decode_tile(opj_tcd_tilecomp_t* tilec, int numres, DWT1DFN dwt_1
|
||||
|
||||
int w = tilec->x1 - tilec->x0;
|
||||
|
||||
h.mem = (int *)opj_aligned_malloc(dwt_decode_max_resolution(tr, numres) * sizeof(int));
|
||||
h.mem = (int*)opj_aligned_malloc(dwt_decode_max_resolution(tr, numres) * sizeof(int));
|
||||
v.mem = h.mem;
|
||||
|
||||
while( --numres) {
|
||||
@@ -570,7 +570,7 @@ static void v4dwt_interleave_h(v4dwt_t* restrict w, float* restrict a, int x, in
|
||||
int count = w->sn;
|
||||
int i, k;
|
||||
for(k = 0; k < 2; ++k){
|
||||
if (count + 3 * x < size && ((long) a & 0x0f) == 0 && ((long) bi & 0x0f) == 0 && (x & 0x0f) == 0) {
|
||||
if (count + 3 * x < size && ((size_t) a & 0x0f) == 0 && ((size_t) bi & 0x0f) == 0 && (x & 0x0f) == 0) {
|
||||
/* Fast code path */
|
||||
for(i = 0; i < count; ++i){
|
||||
int j = i;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, Hervé Drolon, FreeImage Team
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -26,6 +26,42 @@
|
||||
|
||||
#include "opj_includes.h"
|
||||
|
||||
/* ==========================================================
|
||||
Utility functions
|
||||
==========================================================*/
|
||||
|
||||
#ifdef OPJ_CODE_NOT_USED
|
||||
#ifndef _WIN32
|
||||
static char*
|
||||
i2a(unsigned i, char *a, unsigned r) {
|
||||
if (i/r > 0) a = i2a(i/r,a,r);
|
||||
*a = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"[i%r];
|
||||
return a+1;
|
||||
}
|
||||
|
||||
/**
|
||||
Transforms integer i into an ascii string and stores the result in a;
|
||||
string is encoded in the base indicated by r.
|
||||
@param i Number to be converted
|
||||
@param a String result
|
||||
@param r Base of value; must be in the range 2 - 36
|
||||
@return Returns a
|
||||
*/
|
||||
static char *
|
||||
_itoa(int i, char *a, int r) {
|
||||
r = ((r < 2) || (r > 36)) ? 10 : r;
|
||||
if(i < 0) {
|
||||
*a = '-';
|
||||
*i2a(-i, a+1, r) = 0;
|
||||
}
|
||||
else *i2a(i, a, r) = 0;
|
||||
return a;
|
||||
}
|
||||
|
||||
#endif /* !_WIN32 */
|
||||
#endif
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
opj_event_mgr_t* OPJ_CALLCONV opj_set_event_mgr(opj_common_ptr cinfo, opj_event_mgr_t *event_mgr, void *context) {
|
||||
if(cinfo) {
|
||||
opj_event_mgr_t *previous = cinfo->event_mgr;
|
||||
@@ -37,7 +73,7 @@ opj_event_mgr_t* OPJ_CALLCONV opj_set_event_mgr(opj_common_ptr cinfo, opj_event_
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool opj_event_msg(opj_common_ptr cinfo, int event_type, const char *fmt, ...) {
|
||||
opj_bool opj_event_msg(opj_common_ptr cinfo, int event_type, const char *fmt, ...) {
|
||||
#define MSG_SIZE 512 /* 512 bytes should be more than enough for a short message */
|
||||
opj_msg_callback msg_handler = NULL;
|
||||
|
||||
@@ -57,30 +93,29 @@ bool opj_event_msg(opj_common_ptr cinfo, int event_type, const char *fmt, ...) {
|
||||
break;
|
||||
}
|
||||
if(msg_handler == NULL) {
|
||||
return false;
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
if ((fmt != NULL) && (event_mgr != NULL)) {
|
||||
va_list arg;
|
||||
int str_length/*, i, j*/; /* UniPG */
|
||||
char message[MSG_SIZE];
|
||||
memset(message, 0, MSG_SIZE);
|
||||
/* initialize the optional parameter list */
|
||||
va_start(arg, fmt);
|
||||
/* check the length of the format string */
|
||||
str_length = (strlen(fmt) > MSG_SIZE) ? MSG_SIZE : strlen(fmt);
|
||||
/* parse the format string and put the result in 'message' */
|
||||
vsprintf(message, fmt, arg); /* UniPG */
|
||||
str_length = vsnprintf(message, MSG_SIZE, fmt, arg); /* UniPG */
|
||||
/* deinitialize the optional parameter list */
|
||||
va_end(arg);
|
||||
|
||||
/* output the message to the user program */
|
||||
msg_handler(message, cinfo->client_data);
|
||||
if( str_length > -1 && str_length < MSG_SIZE )
|
||||
msg_handler(message, cinfo->client_data);
|
||||
else return OPJ_FALSE;
|
||||
}
|
||||
|
||||
return true;
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, Herv<EFBFBD> Drolon, FreeImage Team
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -49,7 +49,7 @@ Write formatted data to a string and send the string to a user callback.
|
||||
@param fmt Format-control string (plus optionnal arguments)
|
||||
@return Returns true if successful, returns false otherwise
|
||||
*/
|
||||
bool opj_event_msg(opj_common_ptr cinfo, int event_type, const char *fmt, ...);
|
||||
opj_bool opj_event_msg(opj_common_ptr cinfo, int event_type, const char *fmt, ...);
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/*@}*/
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, Herv Drolon, FreeImage Team
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
opj_image_t* opj_image_create0(void) {
|
||||
opj_image_t *image = (opj_image_t*)opj_calloc(1, sizeof(opj_image_t));
|
||||
image->comps=NULL;
|
||||
return image;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, Herv<EFBFBD> Drolon, FreeImage Team
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
118
indra/libopenjpeg/indexbox_manager.h
Normal file
118
indra/libopenjpeg/indexbox_manager.h
Normal file
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* $Id: indexbox_manager.h 897 2011-08-28 21:43:57Z Kaori.Hagihara@gmail.com $
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||
* Copyright (c) 2003-2004, Yannick Verschueren
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*! \file
|
||||
* \brief Modification of jpip.c from 2KAN indexer
|
||||
*/
|
||||
|
||||
#ifndef INDEXBOX_MANAGER_H_
|
||||
# define INDEXBOX_MANAGER_H_
|
||||
|
||||
#include "openjpeg.h"
|
||||
#include "j2k.h" /* needed to use jp2.h */
|
||||
#include "jp2.h"
|
||||
|
||||
#define JPIP_CIDX 0x63696478 /* Codestream index */
|
||||
#define JPIP_CPTR 0x63707472 /* Codestream Finder Box */
|
||||
#define JPIP_MANF 0x6d616e66 /* Manifest Box */
|
||||
#define JPIP_FAIX 0x66616978 /* Fragment array Index box */
|
||||
#define JPIP_MHIX 0x6d686978 /* Main Header Index Table */
|
||||
#define JPIP_TPIX 0x74706978 /* Tile-part Index Table box */
|
||||
#define JPIP_THIX 0x74686978 /* Tile header Index Table box */
|
||||
#define JPIP_PPIX 0x70706978 /* Precinct Packet Index Table box */
|
||||
#define JPIP_PHIX 0x70686978 /* Packet Header index Table */
|
||||
#define JPIP_FIDX 0x66696478 /* File Index */
|
||||
#define JPIP_FPTR 0x66707472 /* File Finder */
|
||||
#define JPIP_PRXY 0x70727879 /* Proxy boxes */
|
||||
#define JPIP_IPTR 0x69707472 /* Index finder box */
|
||||
#define JPIP_PHLD 0x70686c64 /* Place holder */
|
||||
|
||||
|
||||
/*
|
||||
* Write tile-part Index table box (superbox)
|
||||
*
|
||||
* @param[in] coff offset of j2k codestream
|
||||
* @param[in] cstr_info codestream information
|
||||
* @param[in] j2klen length of j2k codestream
|
||||
* @param[in] cio file output handle
|
||||
* @return length of tpix box
|
||||
*/
|
||||
int write_tpix( int coff, opj_codestream_info_t cstr_info, int j2klen, opj_cio_t *cio);
|
||||
|
||||
|
||||
/*
|
||||
* Write tile header index table box (superbox)
|
||||
*
|
||||
* @param[in] coff offset of j2k codestream
|
||||
* @param[in] cstr_info codestream information pointer
|
||||
* @param[in] cio file output handle
|
||||
* @return length of thix box
|
||||
*/
|
||||
int write_thix( int coff, opj_codestream_info_t cstr_info, opj_cio_t *cio);
|
||||
|
||||
|
||||
/*
|
||||
* Write precinct packet index table box (superbox)
|
||||
*
|
||||
* @param[in] coff offset of j2k codestream
|
||||
* @param[in] cstr_info codestream information
|
||||
* @param[in] EPHused true if EPH option used
|
||||
* @param[in] j2klen length of j2k codestream
|
||||
* @param[in] cio file output handle
|
||||
* @return length of ppix box
|
||||
*/
|
||||
int write_ppix( int coff, opj_codestream_info_t cstr_info, opj_bool EPHused, int j2klen, opj_cio_t *cio);
|
||||
|
||||
|
||||
/*
|
||||
* Write packet header index table box (superbox)
|
||||
*
|
||||
* @param[in] coff offset of j2k codestream
|
||||
* @param[in] cstr_info codestream information
|
||||
* @param[in] EPHused true if EPH option used
|
||||
* @param[in] j2klen length of j2k codestream
|
||||
* @param[in] cio file output handle
|
||||
* @return length of ppix box
|
||||
*/
|
||||
int write_phix( int coff, opj_codestream_info_t cstr_info, opj_bool EPHused, int j2klen, opj_cio_t *cio);
|
||||
|
||||
/*
|
||||
* Wriet manifest box (box)
|
||||
*
|
||||
* @param[in] second number to be visited
|
||||
* @param[in] v number of boxes
|
||||
* @param[in] box box to be manifested
|
||||
* @param[in] cio file output handle
|
||||
*/
|
||||
void write_manf(int second, int v, opj_jp2_box_t *box, opj_cio_t *cio);
|
||||
|
||||
|
||||
#endif /* !INDEXBOX_MANAGER_H_ */
|
||||
@@ -6,6 +6,7 @@
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2006-2007, Parvatha Elangovan
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -228,6 +229,23 @@ Read an unknown marker
|
||||
@param j2k J2K handle
|
||||
*/
|
||||
static void j2k_read_unk(opj_j2k_t *j2k);
|
||||
/**
|
||||
Add main header marker information
|
||||
@param cstr_info Codestream information structure
|
||||
@param type marker type
|
||||
@param pos byte offset of marker segment
|
||||
@param len length of marker segment
|
||||
*/
|
||||
static void j2k_add_mhmarker(opj_codestream_info_t *cstr_info, unsigned short int type, int pos, int len);
|
||||
/**
|
||||
Add tile header marker information
|
||||
@param tileno tile index number
|
||||
@param cstr_info Codestream information structure
|
||||
@param type marker type
|
||||
@param pos byte offset of marker segment
|
||||
@param len length of marker segment
|
||||
*/
|
||||
static void j2k_add_tlmarker( int tileno, opj_codestream_info_t *cstr_info, unsigned short int type, int pos, int len);
|
||||
|
||||
/*@}*/
|
||||
|
||||
@@ -258,80 +276,6 @@ char *j2k_convert_progression_order(OPJ_PROG_ORDER prg_order){
|
||||
return po->str_prog;
|
||||
}
|
||||
|
||||
void j2k_dump_image(FILE *fd, opj_image_t * img) {
|
||||
int compno;
|
||||
fprintf(fd, "image {\n");
|
||||
fprintf(fd, " x0=%d, y0=%d, x1=%d, y1=%d\n", img->x0, img->y0, img->x1, img->y1);
|
||||
fprintf(fd, " numcomps=%d\n", img->numcomps);
|
||||
for (compno = 0; compno < img->numcomps; compno++) {
|
||||
opj_image_comp_t *comp = &img->comps[compno];
|
||||
fprintf(fd, " comp %d {\n", compno);
|
||||
fprintf(fd, " dx=%d, dy=%d\n", comp->dx, comp->dy);
|
||||
fprintf(fd, " prec=%d\n", comp->prec);
|
||||
//fprintf(fd, " bpp=%d\n", comp->bpp);
|
||||
fprintf(fd, " sgnd=%d\n", comp->sgnd);
|
||||
fprintf(fd, " }\n");
|
||||
}
|
||||
fprintf(fd, "}\n");
|
||||
}
|
||||
|
||||
void j2k_dump_cp(FILE *fd, opj_image_t * img, opj_cp_t * cp) {
|
||||
int tileno, compno, layno, bandno, resno, numbands;
|
||||
fprintf(fd, "coding parameters {\n");
|
||||
fprintf(fd, " tx0=%d, ty0=%d\n", cp->tx0, cp->ty0);
|
||||
fprintf(fd, " tdx=%d, tdy=%d\n", cp->tdx, cp->tdy);
|
||||
fprintf(fd, " tw=%d, th=%d\n", cp->tw, cp->th);
|
||||
for (tileno = 0; tileno < cp->tw * cp->th; tileno++) {
|
||||
opj_tcp_t *tcp = &cp->tcps[tileno];
|
||||
fprintf(fd, " tile %d {\n", tileno);
|
||||
fprintf(fd, " csty=%x\n", tcp->csty);
|
||||
fprintf(fd, " prg=%d\n", tcp->prg);
|
||||
fprintf(fd, " numlayers=%d\n", tcp->numlayers);
|
||||
fprintf(fd, " mct=%d\n", tcp->mct);
|
||||
fprintf(fd, " rates=");
|
||||
for (layno = 0; layno < tcp->numlayers; layno++) {
|
||||
fprintf(fd, "%.1f ", tcp->rates[layno]);
|
||||
}
|
||||
fprintf(fd, "\n");
|
||||
for (compno = 0; compno < img->numcomps; compno++) {
|
||||
opj_tccp_t *tccp = &tcp->tccps[compno];
|
||||
fprintf(fd, " comp %d {\n", compno);
|
||||
fprintf(fd, " csty=%x\n", tccp->csty);
|
||||
fprintf(fd, " numresolutions=%d\n", tccp->numresolutions);
|
||||
fprintf(fd, " cblkw=%d\n", tccp->cblkw);
|
||||
fprintf(fd, " cblkh=%d\n", tccp->cblkh);
|
||||
fprintf(fd, " cblksty=%x\n", tccp->cblksty);
|
||||
fprintf(fd, " qmfbid=%d\n", tccp->qmfbid);
|
||||
fprintf(fd, " qntsty=%d\n", tccp->qntsty);
|
||||
fprintf(fd, " numgbits=%d\n", tccp->numgbits);
|
||||
fprintf(fd, " roishift=%d\n", tccp->roishift);
|
||||
fprintf(fd, " stepsizes=");
|
||||
numbands = tccp->qntsty == J2K_CCP_QNTSTY_SIQNT ? 1 : tccp->numresolutions * 3 - 2;
|
||||
for (bandno = 0; bandno < numbands; bandno++) {
|
||||
fprintf(fd, "(%d,%d) ", tccp->stepsizes[bandno].mant,
|
||||
tccp->stepsizes[bandno].expn);
|
||||
}
|
||||
fprintf(fd, "\n");
|
||||
|
||||
if (tccp->csty & J2K_CCP_CSTY_PRT) {
|
||||
fprintf(fd, " prcw=");
|
||||
for (resno = 0; resno < tccp->numresolutions; resno++) {
|
||||
fprintf(fd, "%d ", tccp->prcw[resno]);
|
||||
}
|
||||
fprintf(fd, "\n");
|
||||
fprintf(fd, " prch=");
|
||||
for (resno = 0; resno < tccp->numresolutions; resno++) {
|
||||
fprintf(fd, "%d ", tccp->prch[resno]);
|
||||
}
|
||||
fprintf(fd, "\n");
|
||||
}
|
||||
fprintf(fd, " }\n");
|
||||
}
|
||||
fprintf(fd, " }\n");
|
||||
}
|
||||
fprintf(fd, "}\n");
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
static int j2k_get_num_tp(opj_cp_t *cp,int pino,int tileno){
|
||||
char *prog;
|
||||
@@ -371,6 +315,9 @@ static int j2k_get_num_tp(opj_cp_t *cp,int pino,int tileno){
|
||||
/** mem allocation for TLM marker*/
|
||||
int j2k_calculate_tp(opj_cp_t *cp,int img_numcomp,opj_image_t *image,opj_j2k_t *j2k ){
|
||||
int pino,tileno,totnum_tp=0;
|
||||
|
||||
OPJ_ARG_NOT_USED(img_numcomp);
|
||||
|
||||
j2k->cur_totnum_tp = (int *) opj_malloc(cp->tw * cp->th * sizeof(int));
|
||||
for (tileno = 0; tileno < cp->tw * cp->th; tileno++) {
|
||||
int cur_totnum_tp = 0;
|
||||
@@ -399,12 +346,14 @@ static void j2k_write_soc(opj_j2k_t *j2k) {
|
||||
opj_cio_t *cio = j2k->cio;
|
||||
cio_write(cio, J2K_MS_SOC, 2);
|
||||
|
||||
if(j2k->cstr_info)
|
||||
j2k_add_mhmarker(j2k->cstr_info, J2K_MS_SOC, cio_tell(cio), 0);
|
||||
|
||||
/* UniPG>> */
|
||||
#ifdef USE_JPWL
|
||||
|
||||
/* update markers struct */
|
||||
j2k_add_marker(j2k->cstr_info, J2K_MS_SOC, cio_tell(cio) - 2, 2);
|
||||
|
||||
#endif /* USE_JPWL */
|
||||
/* <<UniPG */
|
||||
}
|
||||
@@ -425,7 +374,7 @@ static void j2k_write_siz(opj_j2k_t *j2k) {
|
||||
opj_cio_t *cio = j2k->cio;
|
||||
opj_image_t *image = j2k->image;
|
||||
opj_cp_t *cp = j2k->cp;
|
||||
|
||||
|
||||
cio_write(cio, J2K_MS_SIZ, 2); /* SIZ */
|
||||
lenp = cio_tell(cio);
|
||||
cio_skip(cio, 2);
|
||||
@@ -448,6 +397,9 @@ static void j2k_write_siz(opj_j2k_t *j2k) {
|
||||
cio_seek(cio, lenp);
|
||||
cio_write(cio, len, 2); /* Lsiz */
|
||||
cio_seek(cio, lenp + len);
|
||||
|
||||
if(j2k->cstr_info)
|
||||
j2k_add_mhmarker(j2k->cstr_info, J2K_MS_SIZ, lenp, len);
|
||||
}
|
||||
|
||||
static void j2k_read_siz(opj_j2k_t *j2k) {
|
||||
@@ -516,6 +468,12 @@ static void j2k_read_siz(opj_j2k_t *j2k) {
|
||||
}
|
||||
#endif /* USE_JPWL */
|
||||
|
||||
/* prevent division by zero */
|
||||
if (!(cp->tdx * cp->tdy)) {
|
||||
opj_event_msg(j2k->cinfo, EVT_ERROR, "JPWL: invalid tile size (tdx: %d, tdy: %d)\n", cp->tdx, cp->tdy);
|
||||
return;
|
||||
}
|
||||
|
||||
image->comps = (opj_image_comp_t*) opj_calloc(image->numcomps, sizeof(opj_image_comp_t));
|
||||
for (i = 0; i < image->numcomps; i++) {
|
||||
int tmp, w, h;
|
||||
@@ -554,6 +512,12 @@ static void j2k_read_siz(opj_j2k_t *j2k) {
|
||||
}
|
||||
#endif /* USE_JPWL */
|
||||
|
||||
/* prevent division by zero */
|
||||
if (!(image->comps[i].dx * image->comps[i].dy)) {
|
||||
opj_event_msg(j2k->cinfo, EVT_ERROR, "JPWL: invalid component size (dx: %d, dy: %d)\n", image->comps[i].dx, image->comps[i].dy);
|
||||
return;
|
||||
}
|
||||
|
||||
/* TODO: unused ? */
|
||||
w = int_ceildiv(image->x1 - image->x0, image->comps[i].dx);
|
||||
h = int_ceildiv(image->y1 - image->y0, image->comps[i].dy);
|
||||
@@ -606,7 +570,17 @@ static void j2k_read_siz(opj_j2k_t *j2k) {
|
||||
#endif /* USE_JPWL */
|
||||
|
||||
cp->tcps = (opj_tcp_t*) opj_calloc(cp->tw * cp->th, sizeof(opj_tcp_t));
|
||||
if (cp->tcps == NULL)
|
||||
{
|
||||
opj_event_msg(j2k->cinfo, EVT_ERROR, "Out of memory\n");
|
||||
return;
|
||||
}
|
||||
cp->tileno = (int*) opj_malloc(cp->tw * cp->th * sizeof(int));
|
||||
if (cp->tileno == NULL)
|
||||
{
|
||||
opj_event_msg(j2k->cinfo, EVT_ERROR, "Out of memory\n");
|
||||
return;
|
||||
}
|
||||
cp->tileno_size = 0;
|
||||
|
||||
#ifdef USE_JPWL
|
||||
@@ -678,6 +652,11 @@ static void j2k_write_com(opj_j2k_t *j2k) {
|
||||
cio_seek(cio, lenp);
|
||||
cio_write(cio, len, 2);
|
||||
cio_seek(cio, lenp + len);
|
||||
|
||||
|
||||
if(j2k->cstr_info)
|
||||
j2k_add_mhmarker(j2k->cstr_info, J2K_MS_COM, lenp, len);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -721,12 +700,18 @@ static void j2k_read_cox(opj_j2k_t *j2k, int compno) {
|
||||
|
||||
tccp->numresolutions = cio_read(cio, 1) + 1; /* SPcox (D) */
|
||||
|
||||
// If user wants to remove more resolutions than the codestream contains, return error
|
||||
/* If user wants to remove more resolutions than the codestream contains, return error*/
|
||||
if (cp->reduce >= tccp->numresolutions) {
|
||||
opj_event_msg(j2k->cinfo, EVT_ERROR, "Error decoding component %d.\nThe number of resolutions to remove is higher than the number "
|
||||
"of resolutions of this component\nModify the cp_reduce parameter.\n\n", compno);
|
||||
"of resolutions of this component\nModify the cp_reduce parameter.\n\n", compno);
|
||||
j2k->state |= J2K_STATE_ERR;
|
||||
}
|
||||
if( tccp->numresolutions > J2K_MAXRLVLS ) {
|
||||
opj_event_msg(j2k->cinfo, EVT_ERROR, "Error decoding component %d.\nThe number of resolutions is too big: %d vs max= %d. Truncating.\n\n",
|
||||
compno, tccp->numresolutions, J2K_MAXRLVLS);
|
||||
j2k->state |= J2K_STATE_ERR;
|
||||
tccp->numresolutions = J2K_MAXRLVLS;
|
||||
}
|
||||
|
||||
tccp->cblkw = cio_read(cio, 1) + 2; /* SPcox (E) */
|
||||
tccp->cblkh = cio_read(cio, 1) + 2; /* SPcox (F) */
|
||||
@@ -781,6 +766,10 @@ static void j2k_write_cod(opj_j2k_t *j2k) {
|
||||
cio_seek(cio, lenp);
|
||||
cio_write(cio, len, 2); /* Lcod */
|
||||
cio_seek(cio, lenp + len);
|
||||
|
||||
if(j2k->cstr_info)
|
||||
j2k_add_mhmarker(j2k->cstr_info, J2K_MS_COD, lenp, len);
|
||||
|
||||
}
|
||||
|
||||
static void j2k_read_cod(opj_j2k_t *j2k) {
|
||||
@@ -846,6 +835,12 @@ static void j2k_read_coc(opj_j2k_t *j2k) {
|
||||
|
||||
len = cio_read(cio, 2); /* Lcoc */
|
||||
compno = cio_read(cio, image->numcomps <= 256 ? 1 : 2); /* Ccoc */
|
||||
if (compno >= image->numcomps) {
|
||||
opj_event_msg(j2k->cinfo, EVT_ERROR,
|
||||
"bad component number in COC (%d out of a maximum of %d)\n",
|
||||
compno, image->numcomps);
|
||||
return;
|
||||
}
|
||||
tcp->tccps[compno].csty = cio_read(cio, 1); /* Scoc */
|
||||
j2k_read_cox(j2k, compno);
|
||||
}
|
||||
@@ -909,6 +904,15 @@ static void j2k_read_qcx(opj_j2k_t *j2k, int compno, int len) {
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
#else
|
||||
/* We check whether there are too many subbands */
|
||||
if ((numbands < 0) || (numbands >= J2K_MAXBANDS)) {
|
||||
opj_event_msg(j2k->cinfo, EVT_WARNING ,
|
||||
"bad number of subbands in Sqcx (%d) regarding to J2K_MAXBANDS (%d) \n"
|
||||
"- limiting number of bands to J2K_MAXBANDS and try to move to the next markers\n", numbands, J2K_MAXBANDS);
|
||||
}
|
||||
|
||||
#endif /* USE_JPWL */
|
||||
|
||||
for (bandno = 0; bandno < numbands; bandno++) {
|
||||
@@ -921,8 +925,10 @@ static void j2k_read_qcx(opj_j2k_t *j2k, int compno, int len) {
|
||||
expn = tmp >> 11;
|
||||
mant = tmp & 0x7ff;
|
||||
}
|
||||
tccp->stepsizes[bandno].expn = expn;
|
||||
tccp->stepsizes[bandno].mant = mant;
|
||||
if (bandno < J2K_MAXBANDS){
|
||||
tccp->stepsizes[bandno].expn = expn;
|
||||
tccp->stepsizes[bandno].mant = mant;
|
||||
}
|
||||
}
|
||||
|
||||
/* Add Antonin : if scalar_derived -> compute other stepsizes */
|
||||
@@ -950,6 +956,9 @@ static void j2k_write_qcd(opj_j2k_t *j2k) {
|
||||
cio_seek(cio, lenp);
|
||||
cio_write(cio, len, 2); /* Lqcd */
|
||||
cio_seek(cio, lenp + len);
|
||||
|
||||
if(j2k->cstr_info)
|
||||
j2k_add_mhmarker(j2k->cstr_info, J2K_MS_QCD, lenp, len);
|
||||
}
|
||||
|
||||
static void j2k_read_qcd(opj_j2k_t *j2k) {
|
||||
@@ -986,7 +995,7 @@ static void j2k_read_qcc(opj_j2k_t *j2k) {
|
||||
int len, compno;
|
||||
int numcomp = j2k->image->numcomps;
|
||||
opj_cio_t *cio = j2k->cio;
|
||||
|
||||
|
||||
len = cio_read(cio, 2); /* Lqcc */
|
||||
compno = cio_read(cio, numcomp <= 256 ? 1 : 2); /* Cqcc */
|
||||
|
||||
@@ -1013,9 +1022,16 @@ static void j2k_read_qcc(opj_j2k_t *j2k) {
|
||||
|
||||
/* keep your private count of tiles */
|
||||
backup_compno++;
|
||||
};
|
||||
}
|
||||
#endif /* USE_JPWL */
|
||||
|
||||
if ((compno < 0) || (compno >= numcomp)) {
|
||||
opj_event_msg(j2k->cinfo, EVT_ERROR,
|
||||
"bad component number in QCC (%d out of a maximum of %d)\n",
|
||||
compno, j2k->image->numcomps);
|
||||
return;
|
||||
}
|
||||
|
||||
j2k_read_qcx(j2k, compno, len - 2 - (numcomp <= 256 ? 1 : 2));
|
||||
}
|
||||
|
||||
@@ -1271,6 +1287,10 @@ static void j2k_write_sot(opj_j2k_t *j2k) {
|
||||
j2k_add_marker(j2k->cstr_info, J2K_MS_SOT, j2k->sot_start, len + 2);
|
||||
#endif /* USE_JPWL */
|
||||
/* <<UniPG */
|
||||
|
||||
if( j2k->cstr_info && j2k->cur_tp_num==0){
|
||||
j2k_add_tlmarker( j2k->curtileno, j2k->cstr_info, J2K_MS_SOT, lenp, len);
|
||||
}
|
||||
}
|
||||
|
||||
static void j2k_read_sot(opj_j2k_t *j2k) {
|
||||
@@ -1354,6 +1374,11 @@ static void j2k_read_sot(opj_j2k_t *j2k) {
|
||||
|
||||
partno = cio_read(cio, 1);
|
||||
numparts = cio_read(cio, 1);
|
||||
|
||||
if (partno >= numparts) {
|
||||
opj_event_msg(j2k->cinfo, EVT_WARNING, "SOT marker inconsistency in tile %d: tile-part index greater (%d) than number of tile-parts (%d)\n", tileno, partno, numparts);
|
||||
numparts = partno+1;
|
||||
}
|
||||
|
||||
j2k->curtileno = tileno;
|
||||
j2k->cur_tp_num = partno;
|
||||
@@ -1369,15 +1394,14 @@ static void j2k_read_sot(opj_j2k_t *j2k) {
|
||||
j2k->cstr_info->tile[tileno].tileno = tileno;
|
||||
j2k->cstr_info->tile[tileno].start_pos = cio_tell(cio) - 12;
|
||||
j2k->cstr_info->tile[tileno].end_pos = j2k->cstr_info->tile[tileno].start_pos + totlen - 1;
|
||||
j2k->cstr_info->tile[tileno].num_tps = numparts;
|
||||
if (numparts)
|
||||
j2k->cstr_info->tile[tileno].tp = (opj_tp_info_t *) opj_malloc(numparts * sizeof(opj_tp_info_t));
|
||||
else
|
||||
j2k->cstr_info->tile[tileno].tp = (opj_tp_info_t *) opj_malloc(10 * sizeof(opj_tp_info_t)); // Fixme (10)
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
j2k->cstr_info->tile[tileno].end_pos += totlen;
|
||||
}
|
||||
}
|
||||
j2k->cstr_info->tile[tileno].num_tps = numparts;
|
||||
if (numparts)
|
||||
j2k->cstr_info->tile[tileno].tp = (opj_tp_info_t *) opj_realloc(j2k->cstr_info->tile[tileno].tp, numparts * sizeof(opj_tp_info_t));
|
||||
else
|
||||
j2k->cstr_info->tile[tileno].tp = (opj_tp_info_t *) opj_realloc(j2k->cstr_info->tile[tileno].tp, 10 * sizeof(opj_tp_info_t)); /* Fixme (10)*/
|
||||
j2k->cstr_info->tile[tileno].tp[partno].tp_start_pos = cio_tell(cio) - 12;
|
||||
j2k->cstr_info->tile[tileno].tp[partno].tp_end_pos =
|
||||
j2k->cstr_info->tile[tileno].tp[partno].tp_start_pos + totlen - 1;
|
||||
@@ -1413,6 +1437,11 @@ static void j2k_write_sod(opj_j2k_t *j2k, void *tile_coder) {
|
||||
tcd->cur_tp_num = j2k->cur_tp_num;
|
||||
|
||||
cio_write(cio, J2K_MS_SOD, 2);
|
||||
|
||||
if( j2k->cstr_info && j2k->cur_tp_num==0){
|
||||
j2k_add_tlmarker( j2k->curtileno, j2k->cstr_info, J2K_MS_SOD, cio_tell(cio), 0);
|
||||
}
|
||||
|
||||
if (j2k->curtileno == 0) {
|
||||
j2k->sod_start = cio_tell(cio) + j2k->pos_correction;
|
||||
}
|
||||
@@ -1487,7 +1516,7 @@ static void j2k_read_sod(opj_j2k_t *j2k) {
|
||||
|
||||
if (len == cio_numbytesleft(cio) + 1) {
|
||||
truncate = 1; /* Case of a truncate codestream */
|
||||
}
|
||||
}
|
||||
|
||||
data = j2k->tile_data[curtileno];
|
||||
data = (unsigned char*) opj_realloc(data, (j2k->tile_len[curtileno] + len) * sizeof(unsigned char));
|
||||
@@ -1548,6 +1577,13 @@ static void j2k_read_rgn(opj_j2k_t *j2k) {
|
||||
};
|
||||
#endif /* USE_JPWL */
|
||||
|
||||
if (compno >= numcomps) {
|
||||
opj_event_msg(j2k->cinfo, EVT_ERROR,
|
||||
"bad component number in RGN (%d out of a maximum of %d)\n",
|
||||
compno, j2k->image->numcomps);
|
||||
return;
|
||||
}
|
||||
|
||||
tcp->tccps[compno].roishift = cio_read(cio, 1); /* SPrgn */
|
||||
}
|
||||
|
||||
@@ -1566,7 +1602,7 @@ static void j2k_write_eoc(opj_j2k_t *j2k) {
|
||||
|
||||
static void j2k_read_eoc(opj_j2k_t *j2k) {
|
||||
int i, tileno;
|
||||
bool success;
|
||||
opj_bool success = OPJ_FALSE;
|
||||
|
||||
/* if packets should be decoded */
|
||||
if (j2k->cp->limit_decoding != DECODE_ALL_BUT_PACKETS) {
|
||||
@@ -1574,12 +1610,17 @@ static void j2k_read_eoc(opj_j2k_t *j2k) {
|
||||
tcd_malloc_decode(tcd, j2k->image, j2k->cp);
|
||||
for (i = 0; i < j2k->cp->tileno_size; i++) {
|
||||
tcd_malloc_decode_tile(tcd, j2k->image, j2k->cp, i, j2k->cstr_info);
|
||||
tileno = j2k->cp->tileno[i];
|
||||
success = tcd_decode_tile(tcd, j2k->tile_data[tileno], j2k->tile_len[tileno], tileno, j2k->cstr_info);
|
||||
opj_free(j2k->tile_data[tileno]);
|
||||
j2k->tile_data[tileno] = NULL;
|
||||
tcd_free_decode_tile(tcd, i);
|
||||
if (success == false) {
|
||||
if (j2k->cp->tileno[i] != -1)
|
||||
{
|
||||
tileno = j2k->cp->tileno[i];
|
||||
success = tcd_decode_tile(tcd, j2k->tile_data[tileno], j2k->tile_len[tileno], tileno, j2k->cstr_info);
|
||||
opj_free(j2k->tile_data[tileno]);
|
||||
j2k->tile_data[tileno] = NULL;
|
||||
tcd_free_decode_tile(tcd, i);
|
||||
}
|
||||
else
|
||||
success = OPJ_FALSE;
|
||||
if (success == OPJ_FALSE) {
|
||||
j2k->state |= J2K_STATE_ERR;
|
||||
break;
|
||||
}
|
||||
@@ -1749,6 +1790,14 @@ void j2k_destroy_decompress(opj_j2k_t *j2k) {
|
||||
opj_free(j2k->tile_len);
|
||||
}
|
||||
if(j2k->tile_data != NULL) {
|
||||
if(j2k->cp != NULL) {
|
||||
for (i = 0; i < j2k->cp->tileno_size; i++) {
|
||||
int tileno = j2k->cp->tileno[i];
|
||||
opj_free(j2k->tile_data[tileno]);
|
||||
j2k->tile_data[tileno] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
opj_free(j2k->tile_data);
|
||||
}
|
||||
if(j2k->default_tcp != NULL) {
|
||||
@@ -1834,7 +1883,7 @@ opj_image_t* j2k_decode(opj_j2k_t *j2k, opj_cio_t *cio, opj_codestream_info_t *c
|
||||
if (j2k->cp->correct) {
|
||||
|
||||
int orig_pos = cio_tell(cio);
|
||||
bool status;
|
||||
opj_bool status;
|
||||
|
||||
/* call the corrector */
|
||||
status = jpwl_correct(j2k);
|
||||
@@ -1873,13 +1922,13 @@ opj_image_t* j2k_decode(opj_j2k_t *j2k, opj_cio_t *cio, opj_codestream_info_t *c
|
||||
return 0;
|
||||
}
|
||||
e = j2k_dec_mstab_lookup(id);
|
||||
// Check if the marker is known
|
||||
/* Check if the marker is known*/
|
||||
if (!(j2k->state & e->states)) {
|
||||
opj_image_destroy(image);
|
||||
opj_event_msg(cinfo, EVT_ERROR, "%.8x: unexpected marker %x\n", cio_tell(cio) - 2, id);
|
||||
return 0;
|
||||
}
|
||||
// Check if the decoding is limited to the main header
|
||||
/* Check if the decoding is limited to the main header*/
|
||||
if (e->id == J2K_MS_SOT && j2k->cp->limit_decoding == LIMIT_TO_MAIN_HEADER) {
|
||||
opj_event_msg(cinfo, EVT_INFO, "Main Header decoded.\n");
|
||||
return image;
|
||||
@@ -1889,7 +1938,10 @@ opj_image_t* j2k_decode(opj_j2k_t *j2k, opj_cio_t *cio, opj_codestream_info_t *c
|
||||
(*e->handler)(j2k);
|
||||
}
|
||||
if (j2k->state & J2K_STATE_ERR)
|
||||
{
|
||||
opj_image_destroy(image);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (j2k->state == J2K_STATE_MT) {
|
||||
break;
|
||||
@@ -1905,7 +1957,6 @@ opj_image_t* j2k_decode(opj_j2k_t *j2k, opj_cio_t *cio, opj_codestream_info_t *c
|
||||
if (j2k->state != J2K_STATE_MT) {
|
||||
opj_event_msg(cinfo, EVT_WARNING, "Incomplete bitstream\n");
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
@@ -1917,9 +1968,10 @@ opj_image_t* j2k_decode_jpt_stream(opj_j2k_t *j2k, opj_cio_t *cio, opj_codestre
|
||||
opj_image_t *image = NULL;
|
||||
opj_jpt_msg_header_t header;
|
||||
int position;
|
||||
|
||||
opj_common_ptr cinfo = j2k->cinfo;
|
||||
|
||||
|
||||
OPJ_ARG_NOT_USED(cstr_info);
|
||||
|
||||
j2k->cio = cio;
|
||||
|
||||
/* create an empty image */
|
||||
@@ -2110,12 +2162,12 @@ void j2k_setup_encoder(opj_j2k_t *j2k, opj_cparameters_t *parameters, opj_image_
|
||||
int i;
|
||||
|
||||
/* set JPWL on */
|
||||
cp->epc_on = true;
|
||||
cp->info_on = false; /* no informative technique */
|
||||
cp->epc_on = OPJ_TRUE;
|
||||
cp->info_on = OPJ_FALSE; /* no informative technique */
|
||||
|
||||
/* set EPB on */
|
||||
if ((parameters->jpwl_hprot_MH > 0) || (parameters->jpwl_hprot_TPH[0] > 0)) {
|
||||
cp->epb_on = true;
|
||||
cp->epb_on = OPJ_TRUE;
|
||||
|
||||
cp->hprot_MH = parameters->jpwl_hprot_MH;
|
||||
for (i = 0; i < JPWL_MAX_NO_TILESPECS; i++) {
|
||||
@@ -2136,7 +2188,7 @@ void j2k_setup_encoder(opj_j2k_t *j2k, opj_cparameters_t *parameters, opj_image_
|
||||
|
||||
/* set ESD writing */
|
||||
if ((parameters->jpwl_sens_size == 1) || (parameters->jpwl_sens_size == 2)) {
|
||||
cp->esd_on = true;
|
||||
cp->esd_on = OPJ_TRUE;
|
||||
|
||||
cp->sens_size = parameters->jpwl_sens_size;
|
||||
cp->sens_addr = parameters->jpwl_sens_addr;
|
||||
@@ -2150,10 +2202,10 @@ void j2k_setup_encoder(opj_j2k_t *j2k, opj_cparameters_t *parameters, opj_image_
|
||||
}
|
||||
|
||||
/* always set RED writing to false: we are at the encoder */
|
||||
cp->red_on = false;
|
||||
cp->red_on = OPJ_FALSE;
|
||||
|
||||
} else {
|
||||
cp->epc_on = false;
|
||||
cp->epc_on = OPJ_FALSE;
|
||||
}
|
||||
#endif /* USE_JPWL */
|
||||
|
||||
@@ -2226,10 +2278,10 @@ void j2k_setup_encoder(opj_j2k_t *j2k, opj_cparameters_t *parameters, opj_image_
|
||||
|
||||
if(parameters->cp_cinema)
|
||||
{
|
||||
//Precinct size for lowest frequency subband=128
|
||||
/*Precinct size for lowest frequency subband=128*/
|
||||
tccp->prcw[0] = 7;
|
||||
tccp->prch[0] = 7;
|
||||
//Precinct size at all other resolutions = 256
|
||||
/*Precinct size at all other resolutions = 256*/
|
||||
for (j = 1; j < tccp->numresolutions; j++) {
|
||||
tccp->prcw[j] = 8;
|
||||
tccp->prch[j] = 8;
|
||||
@@ -2271,7 +2323,7 @@ void j2k_setup_encoder(opj_j2k_t *j2k, opj_cparameters_t *parameters, opj_image_
|
||||
}
|
||||
p++;
|
||||
/*printf("\nsize precinct for level %d : %d,%d\n", j,tccp->prcw[j], tccp->prch[j]); */
|
||||
} //end for
|
||||
} /*end for*/
|
||||
} else {
|
||||
for (j = 0; j < tccp->numresolutions; j++) {
|
||||
tccp->prcw[j] = 15;
|
||||
@@ -2285,7 +2337,7 @@ void j2k_setup_encoder(opj_j2k_t *j2k, opj_cparameters_t *parameters, opj_image_
|
||||
}
|
||||
}
|
||||
|
||||
bool j2k_encode(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info) {
|
||||
opj_bool j2k_encode(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info) {
|
||||
int tileno, compno;
|
||||
opj_cp_t *cp = NULL;
|
||||
|
||||
@@ -2296,8 +2348,6 @@ bool j2k_encode(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image, opj_codestre
|
||||
|
||||
cp = j2k->cp;
|
||||
|
||||
/* j2k_dump_cp(stdout, image, cp); */
|
||||
|
||||
/* INDEX >> */
|
||||
j2k->cstr_info = cstr_info;
|
||||
if (cstr_info) {
|
||||
@@ -2394,6 +2444,9 @@ bool j2k_encode(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image, opj_codestre
|
||||
/* INDEX >> */
|
||||
if(cstr_info) {
|
||||
cstr_info->tile[j2k->curtileno].start_pos = cio_tell(cio) + j2k->pos_correction;
|
||||
cstr_info->tile[j2k->curtileno].maxmarknum = 10;
|
||||
cstr_info->tile[j2k->curtileno].marker = (opj_marker_info_t *) opj_malloc(cstr_info->tile[j2k->curtileno].maxmarknum * sizeof(opj_marker_info_t));
|
||||
cstr_info->tile[j2k->curtileno].marknum = 0;
|
||||
}
|
||||
/* << INDEX */
|
||||
|
||||
@@ -2500,11 +2553,46 @@ bool j2k_encode(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image, opj_codestre
|
||||
}
|
||||
#endif /* USE_JPWL */
|
||||
|
||||
return true;
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
static void j2k_add_mhmarker(opj_codestream_info_t *cstr_info, unsigned short int type, int pos, int len) {
|
||||
|
||||
if (!cstr_info)
|
||||
return;
|
||||
|
||||
/* expand the list? */
|
||||
if ((cstr_info->marknum + 1) > cstr_info->maxmarknum) {
|
||||
cstr_info->maxmarknum = 100 + (int) ((float) cstr_info->maxmarknum * 1.0F);
|
||||
cstr_info->marker = (opj_marker_info_t*)opj_realloc(cstr_info->marker, cstr_info->maxmarknum);
|
||||
}
|
||||
|
||||
/* add the marker */
|
||||
cstr_info->marker[cstr_info->marknum].type = type;
|
||||
cstr_info->marker[cstr_info->marknum].pos = pos;
|
||||
cstr_info->marker[cstr_info->marknum].len = len;
|
||||
cstr_info->marknum++;
|
||||
|
||||
}
|
||||
|
||||
static void j2k_add_tlmarker( int tileno, opj_codestream_info_t *cstr_info, unsigned short int type, int pos, int len) {
|
||||
|
||||
opj_marker_info_t *marker;
|
||||
|
||||
if (!cstr_info)
|
||||
return;
|
||||
|
||||
/* expand the list? */
|
||||
if ((cstr_info->tile[tileno].marknum + 1) > cstr_info->tile[tileno].maxmarknum) {
|
||||
cstr_info->tile[tileno].maxmarknum = 100 + (int) ((float) cstr_info->tile[tileno].maxmarknum * 1.0F);
|
||||
cstr_info->tile[tileno].marker = (opj_marker_info_t*)opj_realloc(cstr_info->tile[tileno].marker, cstr_info->maxmarknum);
|
||||
}
|
||||
|
||||
marker = &(cstr_info->tile[tileno].marker[cstr_info->tile[tileno].marknum]);
|
||||
|
||||
/* add the marker */
|
||||
marker->type = type;
|
||||
marker->pos = pos;
|
||||
marker->len = len;
|
||||
cstr_info->tile[tileno].marknum++;
|
||||
}
|
||||
|
||||
@@ -265,15 +265,15 @@ typedef struct opj_cp {
|
||||
/* UniPG>> */
|
||||
#ifdef USE_JPWL
|
||||
/** enables writing of EPC in MH, thus activating JPWL */
|
||||
bool epc_on;
|
||||
opj_bool epc_on;
|
||||
/** enables writing of EPB, in case of activated JPWL */
|
||||
bool epb_on;
|
||||
opj_bool epb_on;
|
||||
/** enables writing of ESD, in case of activated JPWL */
|
||||
bool esd_on;
|
||||
opj_bool esd_on;
|
||||
/** enables writing of informative techniques of ESD, in case of activated JPWL */
|
||||
bool info_on;
|
||||
opj_bool info_on;
|
||||
/** enables writing of RED, in case of activated JPWL */
|
||||
bool red_on;
|
||||
opj_bool red_on;
|
||||
/** error protection method for MH (0,1,16,32,37-128) */
|
||||
int hprot_MH;
|
||||
/** tile number of header protection specification (>=0) */
|
||||
@@ -299,7 +299,7 @@ typedef struct opj_cp {
|
||||
/** sensitivity methods for TPHs (-1,0-7) */
|
||||
int sens_TPH[JPWL_MAX_NO_TILESPECS];
|
||||
/** enables JPWL correction at the decoder */
|
||||
bool correct;
|
||||
opj_bool correct;
|
||||
/** expected number of components at the decoder */
|
||||
int exp_comps;
|
||||
/** maximum number of tiles at the decoder */
|
||||
@@ -436,10 +436,8 @@ Encode an image into a JPEG-2000 codestream
|
||||
@param cstr_info Codestream information structure if required, NULL otherwise
|
||||
@return Returns true if successful, returns false otherwise
|
||||
*/
|
||||
bool j2k_encode(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info);
|
||||
opj_bool j2k_encode(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info);
|
||||
|
||||
void j2k_dump_image(FILE *fd, opj_image_t * img);
|
||||
void j2k_dump_cp(FILE *fd, opj_image_t * img, opj_cp_t * cp);
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/*@}*/
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, Herv<EFBFBD> Drolon, FreeImage Team
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -24,18 +24,18 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/times.h>
|
||||
#endif /* WIN32 */
|
||||
#endif /* _WIN32 */
|
||||
#include "opj_includes.h"
|
||||
|
||||
double opj_clock(void) {
|
||||
#ifdef WIN32
|
||||
/* WIN32: use QueryPerformance (very accurate) */
|
||||
#ifdef _WIN32
|
||||
/* _WIN32: use QueryPerformance (very accurate) */
|
||||
LARGE_INTEGER freq , t ;
|
||||
/* freq is the clock speed of the CPU */
|
||||
QueryPerformanceFrequency(&freq) ;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, Herv<EFBFBD> Drolon, FreeImage Team
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -46,11 +46,64 @@
|
||||
#define JP2_COLR 0x636f6c72 /**< Colour specification box */
|
||||
#define JP2_JP2C 0x6a703263 /**< Contiguous codestream box */
|
||||
#define JP2_URL 0x75726c20 /**< URL box */
|
||||
#define JP2_DBTL 0x6474626c /**< ??? */
|
||||
#define JP2_DTBL 0x6474626c /**< Data Reference box */
|
||||
#define JP2_BPCC 0x62706363 /**< Bits per component box */
|
||||
#define JP2_JP2 0x6a703220 /**< File type fields */
|
||||
#define JP2_PCLR 0x70636c72 /**< Palette box */
|
||||
#define JP2_CMAP 0x636d6170 /**< Component Mapping box */
|
||||
#define JP2_CDEF 0x63646566 /**< Channel Definition box */
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/**
|
||||
Channel description: channel index, type, assocation
|
||||
*/
|
||||
typedef struct opj_jp2_cdef_info
|
||||
{
|
||||
unsigned short cn, typ, asoc;
|
||||
} opj_jp2_cdef_info_t;
|
||||
|
||||
/**
|
||||
Channel descriptions and number of descriptions
|
||||
*/
|
||||
typedef struct opj_jp2_cdef
|
||||
{
|
||||
opj_jp2_cdef_info_t *info;
|
||||
unsigned short n;
|
||||
} opj_jp2_cdef_t;
|
||||
|
||||
/**
|
||||
Component mappings: channel index, mapping type, palette index
|
||||
*/
|
||||
typedef struct opj_jp2_cmap_comp
|
||||
{
|
||||
unsigned short cmp;
|
||||
unsigned char mtyp, pcol;
|
||||
} opj_jp2_cmap_comp_t;
|
||||
|
||||
/**
|
||||
Palette data: table entries, palette columns
|
||||
*/
|
||||
typedef struct opj_jp2_pclr
|
||||
{
|
||||
unsigned int *entries;
|
||||
unsigned char *channel_sign;
|
||||
unsigned char *channel_size;
|
||||
opj_jp2_cmap_comp_t *cmap;
|
||||
unsigned short nr_entries, nr_channels;
|
||||
} opj_jp2_pclr_t;
|
||||
|
||||
/**
|
||||
Collector for ICC profile, palette, component mapping, channel description
|
||||
*/
|
||||
typedef struct opj_jp2_color
|
||||
{
|
||||
unsigned char *icc_profile_buf;
|
||||
int icc_profile_len;
|
||||
|
||||
opj_jp2_cdef_t *jp2_cdef;
|
||||
opj_jp2_pclr_t *jp2_pclr;
|
||||
unsigned char jp2_has_colr;
|
||||
} opj_jp2_color_t;
|
||||
|
||||
/**
|
||||
JP2 component
|
||||
@@ -87,6 +140,8 @@ typedef struct opj_jp2 {
|
||||
opj_jp2_comps_t *comps;
|
||||
unsigned int j2k_codestream_offset;
|
||||
unsigned int j2k_codestream_length;
|
||||
opj_bool jpip_on;
|
||||
opj_bool ignore_pclr_cmap_cdef;
|
||||
} opj_jp2_t;
|
||||
|
||||
/**
|
||||
@@ -111,9 +166,10 @@ void jp2_write_jp2h(opj_jp2_t *jp2, opj_cio_t *cio);
|
||||
Read the JP2H box - JP2 Header box (used in MJ2)
|
||||
@param jp2 JP2 handle
|
||||
@param cio Input buffer stream
|
||||
@param ext Collector for profile, cdef and pclr data
|
||||
@return Returns true if successful, returns false otherwise
|
||||
*/
|
||||
bool jp2_read_jp2h(opj_jp2_t *jp2, opj_cio_t *cio);
|
||||
opj_bool jp2_read_jp2h(opj_jp2_t *jp2, opj_cio_t *cio, opj_jp2_color_t *color);
|
||||
/**
|
||||
Creates a JP2 decompression structure
|
||||
@param cinfo Codec context info
|
||||
@@ -139,7 +195,7 @@ Decode an image from a JPEG-2000 file stream
|
||||
@param cstr_info Codestream information structure if required, NULL otherwise
|
||||
@return Returns a decoded image if successful, returns NULL otherwise
|
||||
*/
|
||||
opj_image_t* jp2_decode(opj_jp2_t *jp2, opj_cio_t *cio, opj_codestream_info_t *cstr_info);
|
||||
opj_image_t* opj_jp2_decode(opj_jp2_t *jp2, opj_cio_t *cio, opj_codestream_info_t *cstr_info);
|
||||
/**
|
||||
Creates a JP2 compression structure
|
||||
@param cinfo Codec context info
|
||||
@@ -167,7 +223,8 @@ Encode an image into a JPEG-2000 file stream
|
||||
@param cstr_info Codestream information structure if required, NULL otherwise
|
||||
@return Returns true if successful, returns false otherwise
|
||||
*/
|
||||
bool jp2_encode(opj_jp2_t *jp2, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info);
|
||||
opj_bool opj_jp2_encode(opj_jp2_t *jp2, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info);
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/*@}*/
|
||||
|
||||
|
||||
@@ -521,22 +521,21 @@ void mqc_init_dec(opj_mqc_t *mqc, unsigned char *bp, int len) {
|
||||
unsigned int c;
|
||||
unsigned int *ip;
|
||||
unsigned char *end = mqc->end - 1;
|
||||
mqc->buffer = opj_realloc(mqc->buffer, (2 * len + 1) * sizeof(unsigned int));
|
||||
mqc->buffer = opj_realloc(mqc->buffer, (len + 1) * sizeof(unsigned int));
|
||||
ip = (unsigned int *) mqc->buffer;
|
||||
|
||||
while (bp != end) {
|
||||
while (bp < end) {
|
||||
c = *(bp + 1);
|
||||
if (*bp == 0xff) {
|
||||
if (c > 0x8f) {
|
||||
*ip = 0x0000ff18;
|
||||
break;
|
||||
} else {
|
||||
bp++;
|
||||
*ip = 0x00000017 | (c << 9);
|
||||
}
|
||||
} else {
|
||||
bp++;
|
||||
*ip = 0x00000018 | (c << 8);
|
||||
}
|
||||
bp++;
|
||||
ip++;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, Herv<EFBFBD> Drolon, FreeImage Team
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -24,17 +24,22 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif /* WIN32 */
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#include "opj_config.h"
|
||||
#include "opj_includes.h"
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#ifndef OPJ_STATIC
|
||||
BOOL APIENTRY
|
||||
DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
|
||||
|
||||
OPJ_ARG_NOT_USED(lpReserved);
|
||||
OPJ_ARG_NOT_USED(hModule);
|
||||
|
||||
switch (ul_reason_for_call) {
|
||||
case DLL_PROCESS_ATTACH :
|
||||
break;
|
||||
@@ -48,19 +53,19 @@ DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
|
||||
return TRUE;
|
||||
}
|
||||
#endif /* OPJ_STATIC */
|
||||
#endif /* WIN32 */
|
||||
#endif /* _WIN32 */
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
|
||||
const char* OPJ_CALLCONV opj_version(void) {
|
||||
return OPENJPEG_VERSION;
|
||||
return PACKAGE_VERSION;
|
||||
}
|
||||
|
||||
opj_dinfo_t* OPJ_CALLCONV opj_create_decompress(OPJ_CODEC_FORMAT format) {
|
||||
opj_dinfo_t *dinfo = (opj_dinfo_t*)opj_calloc(1, sizeof(opj_dinfo_t));
|
||||
if(!dinfo) return NULL;
|
||||
dinfo->is_decompressor = true;
|
||||
dinfo->is_decompressor = OPJ_TRUE;
|
||||
switch(format) {
|
||||
case CODEC_J2K:
|
||||
case CODEC_JPT:
|
||||
@@ -120,9 +125,10 @@ void OPJ_CALLCONV opj_set_default_decoder_parameters(opj_dparameters_t *paramete
|
||||
|
||||
parameters->decod_format = -1;
|
||||
parameters->cod_format = -1;
|
||||
parameters->flags = 0;
|
||||
/* UniPG>> */
|
||||
#ifdef USE_JPWL
|
||||
parameters->jpwl_correct = false;
|
||||
parameters->jpwl_correct = OPJ_FALSE;
|
||||
parameters->jpwl_exp_comps = JPWL_EXPECTED_COMPONENTS;
|
||||
parameters->jpwl_max_tiles = JPWL_MAXIMUM_TILES;
|
||||
#endif /* USE_JPWL */
|
||||
@@ -159,7 +165,7 @@ opj_image_t* OPJ_CALLCONV opj_decode_with_info(opj_dinfo_t *dinfo, opj_cio_t *ci
|
||||
case CODEC_JPT:
|
||||
return j2k_decode_jpt_stream((opj_j2k_t*)dinfo->j2k_handle, cio, cstr_info);
|
||||
case CODEC_JP2:
|
||||
return jp2_decode((opj_jp2_t*)dinfo->jp2_handle, cio, cstr_info);
|
||||
return opj_jp2_decode((opj_jp2_t*)dinfo->jp2_handle, cio, cstr_info);
|
||||
case CODEC_UNKNOWN:
|
||||
default:
|
||||
break;
|
||||
@@ -171,7 +177,7 @@ opj_image_t* OPJ_CALLCONV opj_decode_with_info(opj_dinfo_t *dinfo, opj_cio_t *ci
|
||||
opj_cinfo_t* OPJ_CALLCONV opj_create_compress(OPJ_CODEC_FORMAT format) {
|
||||
opj_cinfo_t *cinfo = (opj_cinfo_t*)opj_calloc(1, sizeof(opj_cinfo_t));
|
||||
if(!cinfo) return NULL;
|
||||
cinfo->is_decompressor = false;
|
||||
cinfo->is_decompressor = OPJ_FALSE;
|
||||
switch(format) {
|
||||
case CODEC_J2K:
|
||||
/* get a J2K coder handle */
|
||||
@@ -243,10 +249,10 @@ void OPJ_CALLCONV opj_set_default_encoder_parameters(opj_cparameters_t *paramete
|
||||
parameters->cp_disto_alloc = 0;
|
||||
parameters->cp_fixed_alloc = 0;
|
||||
parameters->cp_fixed_quality = 0;
|
||||
|
||||
parameters->jpip_on = OPJ_FALSE;
|
||||
/* UniPG>> */
|
||||
#ifdef USE_JPWL
|
||||
parameters->jpwl_epc_on = false;
|
||||
parameters->jpwl_epc_on = OPJ_FALSE;
|
||||
parameters->jpwl_hprot_MH = -1; /* -1 means unassigned */
|
||||
{
|
||||
int i;
|
||||
@@ -296,7 +302,7 @@ void OPJ_CALLCONV opj_setup_encoder(opj_cinfo_t *cinfo, opj_cparameters_t *param
|
||||
}
|
||||
}
|
||||
|
||||
bool OPJ_CALLCONV opj_encode(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, char *index) {
|
||||
opj_bool OPJ_CALLCONV opj_encode(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, char *index) {
|
||||
if (index != NULL)
|
||||
opj_event_msg((opj_common_ptr)cinfo, EVT_WARNING, "Set index to NULL when calling the opj_encode function.\n"
|
||||
"To extract the index, use the opj_encode_with_info() function.\n"
|
||||
@@ -304,20 +310,20 @@ bool OPJ_CALLCONV opj_encode(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *im
|
||||
return opj_encode_with_info(cinfo, cio, image, NULL);
|
||||
}
|
||||
|
||||
bool OPJ_CALLCONV opj_encode_with_info(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info) {
|
||||
opj_bool OPJ_CALLCONV opj_encode_with_info(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info) {
|
||||
if(cinfo && cio && image) {
|
||||
switch(cinfo->codec_format) {
|
||||
case CODEC_J2K:
|
||||
return j2k_encode((opj_j2k_t*)cinfo->j2k_handle, cio, image, cstr_info);
|
||||
case CODEC_JP2:
|
||||
return jp2_encode((opj_jp2_t*)cinfo->jp2_handle, cio, image, cstr_info);
|
||||
return opj_jp2_encode((opj_jp2_t*)cinfo->jp2_handle, cio, image, cstr_info);
|
||||
case CODEC_JPT:
|
||||
case CODEC_UNKNOWN:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
void OPJ_CALLCONV opj_destroy_cstr_info(opj_codestream_info_t *cstr_info) {
|
||||
@@ -328,6 +334,7 @@ void OPJ_CALLCONV opj_destroy_cstr_info(opj_codestream_info_t *cstr_info) {
|
||||
opj_free(tile_info->thresh);
|
||||
opj_free(tile_info->packet);
|
||||
opj_free(tile_info->tp);
|
||||
opj_free(tile_info->marker);
|
||||
}
|
||||
opj_free(cstr_info->tile);
|
||||
opj_free(cstr_info->marker);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2006-2007, Parvatha Elangovan
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -32,7 +33,6 @@
|
||||
#ifndef OPENJPEG_H
|
||||
#define OPENJPEG_H
|
||||
|
||||
#define OPENJPEG_VERSION "1.4.0.635"
|
||||
|
||||
/*
|
||||
==========================================================
|
||||
@@ -40,7 +40,7 @@
|
||||
==========================================================
|
||||
*/
|
||||
|
||||
#if defined(OPJ_STATIC) || !(defined(WIN32) || defined(__WIN32__))
|
||||
#if defined(OPJ_STATIC) || !defined(_WIN32)
|
||||
#define OPJ_API
|
||||
#define OPJ_CALLCONV
|
||||
#else
|
||||
@@ -53,38 +53,19 @@ that uses this DLL. This way any other project whose source files include this f
|
||||
OPJ_API functions as being imported from a DLL, wheras this DLL sees symbols
|
||||
defined with this macro as being exported.
|
||||
*/
|
||||
#ifdef OPJ_EXPORTS
|
||||
#if defined(OPJ_EXPORTS) || defined(DLL_EXPORT)
|
||||
#define OPJ_API __declspec(dllexport)
|
||||
#else
|
||||
#define OPJ_API __declspec(dllimport)
|
||||
#endif /* OPJ_EXPORTS */
|
||||
#endif /* !OPJ_STATIC || !WIN32 */
|
||||
#endif /* !OPJ_STATIC || !_WIN32 */
|
||||
|
||||
#ifndef __cplusplus
|
||||
#if defined(HAVE_STDBOOL_H)
|
||||
/*
|
||||
The C language implementation does correctly provide the standard header
|
||||
file "stdbool.h".
|
||||
*/
|
||||
#include <stdbool.h>
|
||||
#else
|
||||
/*
|
||||
The C language implementation does not provide the standard header file
|
||||
"stdbool.h" as required by ISO/IEC 9899:1999. Try to compensate for this
|
||||
braindamage below.
|
||||
*/
|
||||
#if !defined(bool)
|
||||
#define bool int
|
||||
#endif
|
||||
#if !defined(true)
|
||||
#define true 1
|
||||
#endif
|
||||
#if !defined(false)
|
||||
#define false 0
|
||||
#endif
|
||||
#endif
|
||||
#endif /* __cplusplus */
|
||||
typedef int opj_bool;
|
||||
#define OPJ_TRUE 1
|
||||
#define OPJ_FALSE 0
|
||||
|
||||
/* Avoid compile-time warning because parameter is not used */
|
||||
#define OPJ_ARG_NOT_USED(x) (void)(x)
|
||||
/*
|
||||
==========================================================
|
||||
Useful constant definitions
|
||||
@@ -154,14 +135,18 @@ typedef enum COLOR_SPACE {
|
||||
CLRSPC_SYCC = 3 /**< YUV */
|
||||
} OPJ_COLOR_SPACE;
|
||||
|
||||
#define ENUMCS_SRGB 16
|
||||
#define ENUMCS_GRAY 17
|
||||
#define ENUMCS_SYCC 18
|
||||
|
||||
/**
|
||||
Supported codec
|
||||
*/
|
||||
typedef enum CODEC_FORMAT {
|
||||
CODEC_UNKNOWN = -1, /**< place-holder */
|
||||
CODEC_J2K = 0, /**< JPEG-2000 codestream : read/write */
|
||||
CODEC_JPT = 1, /**< JPT-stream (JPEG 2000, JPIP) : read only */
|
||||
CODEC_JP2 = 2 /**< JPEG-2000 file format : read/write */
|
||||
CODEC_J2K = 0, /**< JPEG-2000 codestream : read/write */
|
||||
CODEC_JPT = 1, /**< JPT-stream (JPEG 2000, JPIP) : read only */
|
||||
CODEC_JP2 = 2 /**< JPEG-2000 file format : read/write */
|
||||
} OPJ_CODEC_FORMAT;
|
||||
|
||||
/**
|
||||
@@ -244,7 +229,7 @@ Compression parameters
|
||||
*/
|
||||
typedef struct opj_cparameters {
|
||||
/** size of tile: tile_size_on = false (not in argument) or = true (in argument) */
|
||||
bool tile_size_on;
|
||||
opj_bool tile_size_on;
|
||||
/** XTOsiz */
|
||||
int cp_tx0;
|
||||
/** YTOsiz */
|
||||
@@ -326,7 +311,7 @@ typedef struct opj_cparameters {
|
||||
/**@name JPWL encoding parameters */
|
||||
/*@{*/
|
||||
/** enables writing of EPC in MH, thus activating JPWL */
|
||||
bool jpwl_epc_on;
|
||||
opj_bool jpwl_epc_on;
|
||||
/** error protection method for MH (0,1,16,32,37-128) */
|
||||
int jpwl_hprot_MH;
|
||||
/** tile number of header protection specification (>=0) */
|
||||
@@ -366,8 +351,12 @@ typedef struct opj_cparameters {
|
||||
char tp_flag;
|
||||
/** MCT (multiple component transform) */
|
||||
char tcp_mct;
|
||||
/** Enable JPIP indexing*/
|
||||
opj_bool jpip_on;
|
||||
} opj_cparameters_t;
|
||||
|
||||
#define OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG 0x0001
|
||||
|
||||
/**
|
||||
Decompression parameters
|
||||
*/
|
||||
@@ -404,7 +393,7 @@ typedef struct opj_dparameters {
|
||||
/**@name JPWL decoding parameters */
|
||||
/*@{*/
|
||||
/** activates the JPWL correction capabilities */
|
||||
bool jpwl_correct;
|
||||
opj_bool jpwl_correct;
|
||||
/** expected number of components */
|
||||
int jpwl_exp_comps;
|
||||
/** maximum number of tiles */
|
||||
@@ -420,6 +409,7 @@ typedef struct opj_dparameters {
|
||||
*/
|
||||
OPJ_LIMIT_DECODING cp_limit_decoding;
|
||||
|
||||
unsigned int flags;
|
||||
} opj_dparameters_t;
|
||||
|
||||
/** Common fields between JPEG-2000 compression and decompression master structs. */
|
||||
@@ -427,7 +417,7 @@ typedef struct opj_dparameters {
|
||||
#define opj_common_fields \
|
||||
opj_event_mgr_t *event_mgr; /**< pointer to the event manager */\
|
||||
void * client_data; /**< Available for use by application */\
|
||||
bool is_decompressor; /**< So common code can tell which is which */\
|
||||
opj_bool is_decompressor; /**< So common code can tell which is which */\
|
||||
OPJ_CODEC_FORMAT codec_format; /**< selected codec */\
|
||||
void *j2k_handle; /**< pointer to the J2K codec */\
|
||||
void *jp2_handle; /**< pointer to the JP2 codec */\
|
||||
@@ -555,6 +545,10 @@ typedef struct opj_image {
|
||||
OPJ_COLOR_SPACE color_space;
|
||||
/** image components */
|
||||
opj_image_comp_t *comps;
|
||||
/** 'restricted' ICC profile */
|
||||
unsigned char *icc_profile_buf;
|
||||
/** size of ICC profile */
|
||||
int icc_profile_len;
|
||||
} opj_image_t;
|
||||
|
||||
/**
|
||||
@@ -601,6 +595,21 @@ typedef struct opj_packet_info {
|
||||
double disto;
|
||||
} opj_packet_info_t;
|
||||
|
||||
|
||||
/* UniPG>> */
|
||||
/**
|
||||
Marker structure
|
||||
*/
|
||||
typedef struct opj_marker_info_t {
|
||||
/** marker type */
|
||||
unsigned short int type;
|
||||
/** position in codestream */
|
||||
int pos;
|
||||
/** length, marker val included */
|
||||
int len;
|
||||
} opj_marker_info_t;
|
||||
/* <<UniPG */
|
||||
|
||||
/**
|
||||
Index structure : Information concerning tile-parts
|
||||
*/
|
||||
@@ -645,26 +654,18 @@ typedef struct opj_tile_info {
|
||||
int numpix;
|
||||
/** add fixed_quality */
|
||||
double distotile;
|
||||
/** number of markers */
|
||||
int marknum;
|
||||
/** list of markers */
|
||||
opj_marker_info_t *marker;
|
||||
/** actual size of markers array */
|
||||
int maxmarknum;
|
||||
/** number of tile parts */
|
||||
int num_tps;
|
||||
/** information concerning tile parts */
|
||||
opj_tp_info_t *tp;
|
||||
} opj_tile_info_t;
|
||||
|
||||
/* UniPG>> */
|
||||
/**
|
||||
Marker structure
|
||||
*/
|
||||
typedef struct opj_marker_info_t {
|
||||
/** marker type */
|
||||
unsigned short int type;
|
||||
/** position in codestream */
|
||||
int pos;
|
||||
/** length, marker val included */
|
||||
int len;
|
||||
} opj_marker_info_t;
|
||||
/* <<UniPG */
|
||||
|
||||
/**
|
||||
Index structure of the codestream
|
||||
*/
|
||||
@@ -883,13 +884,13 @@ Setup the encoder parameters using the current image and using user parameters.
|
||||
OPJ_API void OPJ_CALLCONV opj_setup_encoder(opj_cinfo_t *cinfo, opj_cparameters_t *parameters, opj_image_t *image);
|
||||
/**
|
||||
Encode an image into a JPEG-2000 codestream
|
||||
@param cinfo compressor handle
|
||||
3@param cinfo compressor handle
|
||||
@param cio Output buffer stream
|
||||
@param image Image to encode
|
||||
@param index Depreacted -> Set to NULL. To extract index, used opj_encode_wci()
|
||||
@return Returns true if successful, returns false otherwise
|
||||
*/
|
||||
OPJ_API bool OPJ_CALLCONV opj_encode(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, char *index);
|
||||
OPJ_API opj_bool OPJ_CALLCONV opj_encode(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, char *index);
|
||||
/**
|
||||
Encode an image into a JPEG-2000 codestream and extract the codestream information
|
||||
@param cinfo compressor handle
|
||||
@@ -898,13 +899,14 @@ Encode an image into a JPEG-2000 codestream and extract the codestream informati
|
||||
@param cstr_info Codestream information structure if needed afterwards, NULL otherwise
|
||||
@return Returns true if successful, returns false otherwise
|
||||
*/
|
||||
OPJ_API bool OPJ_CALLCONV opj_encode_with_info(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info);
|
||||
OPJ_API opj_bool OPJ_CALLCONV opj_encode_with_info(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info);
|
||||
/**
|
||||
Destroy Codestream information after compression or decompression
|
||||
@param cstr_info Codestream information structure
|
||||
*/
|
||||
OPJ_API void OPJ_CALLCONV opj_destroy_cstr_info(opj_codestream_info_t *cstr_info);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
36
indra/libopenjpeg/opj_config.h
Normal file
36
indra/libopenjpeg/opj_config.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/* create config.h for CMake */
|
||||
#define PACKAGE_VERSION "1.5.2"
|
||||
|
||||
#define HAVE_INTTYPES_H
|
||||
#define HAVE_MEMORY_H
|
||||
#define HAVE_STDINT_H
|
||||
#define HAVE_STDLIB_H
|
||||
#define HAVE_STRINGS_H
|
||||
#define HAVE_STRING_H
|
||||
#define HAVE_SYS_STAT_H
|
||||
#define HAVE_SYS_TYPES_H
|
||||
#define HAVE_UNISTD_H
|
||||
/* #define HAVE_LIBPNG */
|
||||
/* #define HAVE_PNG_H */
|
||||
/* #define HAVE_LIBTIFF */
|
||||
/* #define HAVE_TIFF_H */
|
||||
|
||||
/* #undef HAVE_LIBLCMS1 */
|
||||
/* #undef HAVE_LIBLCMS2 */
|
||||
/* #undef HAVE_LCMS1_H */
|
||||
/* #undef HAVE_LCMS2_H */
|
||||
|
||||
/* Byte order. */
|
||||
/* All compilers that support Mac OS X define either __BIG_ENDIAN__ or
|
||||
* __LITTLE_ENDIAN__ to match the endianness of the architecture being
|
||||
* compiled for. This is not necessarily the same as the architecture of the
|
||||
* machine doing the building. In order to support Universal Binaries on
|
||||
* Mac OS X, we prefer those defines to decide the endianness.
|
||||
* On other platforms we use the result of the TRY_RUN. */
|
||||
#if !defined(__APPLE__)
|
||||
/* #undef OPJ_BIG_ENDIAN */
|
||||
#elif defined(__BIG_ENDIAN__)
|
||||
# define OPJ_BIG_ENDIAN
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, Herv<EFBFBD> Drolon, FreeImage Team
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -89,20 +89,25 @@ Most compilers implement their own version of this keyword ...
|
||||
/* MSVC and Borland C do not have lrintf */
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||
static INLINE long lrintf(float f){
|
||||
int i;
|
||||
|
||||
_asm{
|
||||
fld f
|
||||
fistp i
|
||||
};
|
||||
|
||||
return i;
|
||||
#ifdef _M_X64
|
||||
return (long)((f>0.0f) ? (f + 0.5f):(f -0.5f));
|
||||
#else
|
||||
int i;
|
||||
|
||||
_asm{
|
||||
fld f
|
||||
fistp i
|
||||
};
|
||||
|
||||
return i;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "j2k_lib.h"
|
||||
#include "opj_malloc.h"
|
||||
#include "event.h"
|
||||
#include "bio.h"
|
||||
#include "cio.h"
|
||||
|
||||
#include "image.h"
|
||||
@@ -123,9 +128,12 @@ static INLINE long lrintf(float f){
|
||||
#include "int.h"
|
||||
#include "fix.h"
|
||||
|
||||
#include "cidx_manager.h"
|
||||
#include "indexbox_manager.h"
|
||||
|
||||
/* JPWL>> */
|
||||
#ifdef USE_JPWL
|
||||
#include "../jpwl/jpwl.h"
|
||||
#include "./jpwl/jpwl.h"
|
||||
#endif /* USE_JPWL */
|
||||
/* <<JPWL */
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, Herv<EFBFBD> Drolon, FreeImage Team
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2007, Callum Lerwick <seg@haxxed.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -69,7 +69,7 @@ Allocate memory aligned to a 16 byte boundry
|
||||
@return Returns a void pointer to the allocated space, or NULL if there is insufficient memory available
|
||||
*/
|
||||
/* FIXME: These should be set with cmake tests, but we're currently not requiring use of cmake */
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
/* Someone should tell the mingw people that their malloc.h ought to provide _mm_malloc() */
|
||||
#ifdef __GNUC__
|
||||
#include <mm_malloc.h>
|
||||
@@ -80,11 +80,13 @@ Allocate memory aligned to a 16 byte boundry
|
||||
#define HAVE_MM_MALLOC
|
||||
#endif
|
||||
#endif
|
||||
#else /* Not WIN32 */
|
||||
#else /* Not _WIN32 */
|
||||
#if defined(__sun)
|
||||
#define HAVE_MEMALIGN
|
||||
#elif defined(__FreeBSD__)
|
||||
#define HAVE_POSIX_MEMALIGN
|
||||
/* Linux x86_64 and OSX always align allocations to 16 bytes */
|
||||
#elif !defined(__amd64__) && !defined(__APPLE__)
|
||||
#elif !defined(__amd64__) && !defined(__APPLE__) && !defined(_AIX)
|
||||
#define HAVE_MEMALIGN
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
@@ -130,22 +132,22 @@ Allocate memory aligned to a 16 byte boundry
|
||||
|
||||
/**
|
||||
Reallocate memory blocks.
|
||||
@param memblock Pointer to previously allocated memory block
|
||||
@param size New size in bytes
|
||||
@param m Pointer to previously allocated memory block
|
||||
@param s New size in bytes
|
||||
@return Returns a void pointer to the reallocated (and possibly moved) memory block
|
||||
*/
|
||||
#ifdef ALLOC_PERF_OPT
|
||||
void * OPJ_CALLCONV opj_realloc(void * _Memory, size_t NewSize);
|
||||
void * OPJ_CALLCONV opj_realloc(void * m, size_t s);
|
||||
#else
|
||||
#define opj_realloc(m, s) realloc(m, s)
|
||||
#endif
|
||||
|
||||
/**
|
||||
Deallocates or frees a memory block.
|
||||
@param memblock Previously allocated memory block to be freed
|
||||
@param m Previously allocated memory block to be freed
|
||||
*/
|
||||
#ifdef ALLOC_PERF_OPT
|
||||
void OPJ_CALLCONV opj_free(void * _Memory);
|
||||
void OPJ_CALLCONV opj_free(void * m);
|
||||
#else
|
||||
#define opj_free(m) free(m)
|
||||
#endif
|
||||
|
||||
170
indra/libopenjpeg/phix_manager.c
Normal file
170
indra/libopenjpeg/phix_manager.c
Normal file
@@ -0,0 +1,170 @@
|
||||
/*
|
||||
* $Id: phix_manager.c 897 2011-08-28 21:43:57Z Kaori.Hagihara@gmail.com $
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||
* Copyright (c) 2003-2004, Yannick Verschueren
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*! \file
|
||||
* \brief Modification of jpip.c from 2KAN indexer
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "opj_includes.h"
|
||||
|
||||
/*
|
||||
* Write faix box of phix
|
||||
*
|
||||
* @param[in] coff offset of j2k codestream
|
||||
* @param[in] compno component number
|
||||
* @param[in] cstr_info codestream information
|
||||
* @param[in] EPHused true if if EPH option used
|
||||
* @param[in] j2klen length of j2k codestream
|
||||
* @param[in] cio file output handle
|
||||
* @return length of faix box
|
||||
*/
|
||||
int write_phixfaix( int coff, int compno, opj_codestream_info_t cstr_info, opj_bool EPHused, int j2klen, opj_cio_t *cio);
|
||||
|
||||
int write_phix( int coff, opj_codestream_info_t cstr_info, opj_bool EPHused, int j2klen, opj_cio_t *cio)
|
||||
{
|
||||
int len, lenp=0, compno, i;
|
||||
opj_jp2_box_t *box;
|
||||
|
||||
box = (opj_jp2_box_t *)opj_calloc( cstr_info.numcomps, sizeof(opj_jp2_box_t));
|
||||
|
||||
for( i=0;i<2;i++){
|
||||
if (i) cio_seek( cio, lenp);
|
||||
|
||||
lenp = cio_tell( cio);
|
||||
cio_skip( cio, 4); /* L [at the end] */
|
||||
cio_write( cio, JPIP_PHIX, 4); /* PHIX */
|
||||
|
||||
write_manf( i, cstr_info.numcomps, box, cio);
|
||||
|
||||
for( compno=0; compno<cstr_info.numcomps; compno++){
|
||||
box[compno].length = write_phixfaix( coff, compno, cstr_info, EPHused, j2klen, cio);
|
||||
box[compno].type = JPIP_FAIX;
|
||||
}
|
||||
|
||||
len = cio_tell( cio)-lenp;
|
||||
cio_seek( cio, lenp);
|
||||
cio_write( cio, len, 4); /* L */
|
||||
cio_seek( cio, lenp+len);
|
||||
}
|
||||
|
||||
opj_free(box);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
int write_phixfaix( int coff, int compno, opj_codestream_info_t cstr_info, opj_bool EPHused, int j2klen, opj_cio_t *cio)
|
||||
{
|
||||
int len, lenp, tileno, version, i, nmax, size_of_coding; /* 4 or 8 */
|
||||
opj_tile_info_t *tile_Idx;
|
||||
opj_packet_info_t packet;
|
||||
int resno, precno, layno, num_packet;
|
||||
int numOfres, numOfprec, numOflayers;
|
||||
packet.end_ph_pos = packet.start_pos = -1;
|
||||
(void)EPHused; /* unused ? */
|
||||
|
||||
if( j2klen > pow( 2.0, 32)){
|
||||
size_of_coding = 8;
|
||||
version = 1;
|
||||
}
|
||||
else{
|
||||
size_of_coding = 4;
|
||||
version = 0;
|
||||
}
|
||||
|
||||
lenp = cio_tell( cio);
|
||||
cio_skip( cio, 4); /* L [at the end] */
|
||||
cio_write( cio, JPIP_FAIX, 4); /* FAIX */
|
||||
cio_write( cio, version,1); /* Version 0 = 4 bytes */
|
||||
|
||||
nmax = 0;
|
||||
for( i=0; i<=cstr_info.numdecompos[compno]; i++)
|
||||
nmax += cstr_info.tile[0].ph[i] * cstr_info.tile[0].pw[i] * cstr_info.numlayers;
|
||||
|
||||
cio_write( cio, nmax, size_of_coding); /* NMAX */
|
||||
cio_write( cio, cstr_info.tw*cstr_info.th, size_of_coding); /* M */
|
||||
|
||||
for( tileno=0; tileno<cstr_info.tw*cstr_info.th; tileno++){
|
||||
tile_Idx = &cstr_info.tile[ tileno];
|
||||
|
||||
num_packet = 0;
|
||||
numOfres = cstr_info.numdecompos[compno] + 1;
|
||||
|
||||
for( resno=0; resno<numOfres ; resno++){
|
||||
numOfprec = tile_Idx->pw[resno]*tile_Idx->ph[resno];
|
||||
for( precno=0; precno<numOfprec; precno++){
|
||||
numOflayers = cstr_info.numlayers;
|
||||
for( layno=0; layno<numOflayers; layno++){
|
||||
|
||||
switch ( cstr_info.prog){
|
||||
case LRCP:
|
||||
packet = tile_Idx->packet[ ((layno*numOfres+resno)*cstr_info.numcomps+compno)*numOfprec+precno];
|
||||
break;
|
||||
case RLCP:
|
||||
packet = tile_Idx->packet[ ((resno*numOflayers+layno)*cstr_info.numcomps+compno)*numOfprec+precno];
|
||||
break;
|
||||
case RPCL:
|
||||
packet = tile_Idx->packet[ ((resno*numOfprec+precno)*cstr_info.numcomps+compno)*numOflayers+layno];
|
||||
break;
|
||||
case PCRL:
|
||||
packet = tile_Idx->packet[ ((precno*cstr_info.numcomps+compno)*numOfres+resno)*numOflayers + layno];
|
||||
break;
|
||||
case CPRL:
|
||||
packet = tile_Idx->packet[ ((compno*numOfprec+precno)*numOfres+resno)*numOflayers + layno];
|
||||
break;
|
||||
default:
|
||||
fprintf( stderr, "failed to ppix indexing\n");
|
||||
}
|
||||
|
||||
cio_write( cio, packet.start_pos-coff, size_of_coding); /* start position */
|
||||
cio_write( cio, packet.end_ph_pos-packet.start_pos+1, size_of_coding); /* length */
|
||||
|
||||
num_packet++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* PADDING */
|
||||
while( num_packet < nmax){
|
||||
cio_write( cio, 0, size_of_coding); /* start position */
|
||||
cio_write( cio, 0, size_of_coding); /* length */
|
||||
num_packet++;
|
||||
}
|
||||
}
|
||||
|
||||
len = cio_tell( cio)-lenp;
|
||||
cio_seek( cio, lenp);
|
||||
cio_write( cio, len, 4); /* L */
|
||||
cio_seek( cio, lenp+len);
|
||||
|
||||
return len;
|
||||
}
|
||||
@@ -43,31 +43,31 @@ Get next packet in layer-resolution-component-precinct order.
|
||||
@param pi packet iterator to modify
|
||||
@return returns false if pi pointed to the last packet or else returns true
|
||||
*/
|
||||
static bool pi_next_lrcp(opj_pi_iterator_t * pi);
|
||||
static opj_bool pi_next_lrcp(opj_pi_iterator_t * pi);
|
||||
/**
|
||||
Get next packet in resolution-layer-component-precinct order.
|
||||
@param pi packet iterator to modify
|
||||
@return returns false if pi pointed to the last packet or else returns true
|
||||
*/
|
||||
static bool pi_next_rlcp(opj_pi_iterator_t * pi);
|
||||
static opj_bool pi_next_rlcp(opj_pi_iterator_t * pi);
|
||||
/**
|
||||
Get next packet in resolution-precinct-component-layer order.
|
||||
@param pi packet iterator to modify
|
||||
@return returns false if pi pointed to the last packet or else returns true
|
||||
*/
|
||||
static bool pi_next_rpcl(opj_pi_iterator_t * pi);
|
||||
static opj_bool pi_next_rpcl(opj_pi_iterator_t * pi);
|
||||
/**
|
||||
Get next packet in precinct-component-resolution-layer order.
|
||||
@param pi packet iterator to modify
|
||||
@return returns false if pi pointed to the last packet or else returns true
|
||||
*/
|
||||
static bool pi_next_pcrl(opj_pi_iterator_t * pi);
|
||||
static opj_bool pi_next_pcrl(opj_pi_iterator_t * pi);
|
||||
/**
|
||||
Get next packet in component-precinct-resolution-layer order.
|
||||
@param pi packet iterator to modify
|
||||
@return returns false if pi pointed to the last packet or else returns true
|
||||
*/
|
||||
static bool pi_next_cprl(opj_pi_iterator_t * pi);
|
||||
static opj_bool pi_next_cprl(opj_pi_iterator_t * pi);
|
||||
|
||||
/*@}*/
|
||||
|
||||
@@ -79,7 +79,7 @@ static bool pi_next_cprl(opj_pi_iterator_t * pi);
|
||||
==========================================================
|
||||
*/
|
||||
|
||||
static bool pi_next_lrcp(opj_pi_iterator_t * pi) {
|
||||
static opj_bool pi_next_lrcp(opj_pi_iterator_t * pi) {
|
||||
opj_pi_comp_t *comp = NULL;
|
||||
opj_pi_resolution_t *res = NULL;
|
||||
long index = 0;
|
||||
@@ -108,7 +108,7 @@ static bool pi_next_lrcp(opj_pi_iterator_t * pi) {
|
||||
index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p;
|
||||
if (!pi->include[index]) {
|
||||
pi->include[index] = 1;
|
||||
return true;
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
LABEL_SKIP:;
|
||||
}
|
||||
@@ -116,10 +116,10 @@ LABEL_SKIP:;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
static bool pi_next_rlcp(opj_pi_iterator_t * pi) {
|
||||
static opj_bool pi_next_rlcp(opj_pi_iterator_t * pi) {
|
||||
opj_pi_comp_t *comp = NULL;
|
||||
opj_pi_resolution_t *res = NULL;
|
||||
long index = 0;
|
||||
@@ -147,7 +147,7 @@ static bool pi_next_rlcp(opj_pi_iterator_t * pi) {
|
||||
index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p;
|
||||
if (!pi->include[index]) {
|
||||
pi->include[index] = 1;
|
||||
return true;
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
LABEL_SKIP:;
|
||||
}
|
||||
@@ -155,10 +155,10 @@ LABEL_SKIP:;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
static bool pi_next_rpcl(opj_pi_iterator_t * pi) {
|
||||
static opj_bool pi_next_rpcl(opj_pi_iterator_t * pi) {
|
||||
opj_pi_comp_t *comp = NULL;
|
||||
opj_pi_resolution_t *res = NULL;
|
||||
long index = 0;
|
||||
@@ -229,7 +229,7 @@ if (!pi->tp_on){
|
||||
index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p;
|
||||
if (!pi->include[index]) {
|
||||
pi->include[index] = 1;
|
||||
return true;
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
LABEL_SKIP:;
|
||||
}
|
||||
@@ -238,10 +238,10 @@ LABEL_SKIP:;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
static bool pi_next_pcrl(opj_pi_iterator_t * pi) {
|
||||
static opj_bool pi_next_pcrl(opj_pi_iterator_t * pi) {
|
||||
opj_pi_comp_t *comp = NULL;
|
||||
opj_pi_resolution_t *res = NULL;
|
||||
long index = 0;
|
||||
@@ -310,7 +310,7 @@ static bool pi_next_pcrl(opj_pi_iterator_t * pi) {
|
||||
index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p;
|
||||
if (!pi->include[index]) {
|
||||
pi->include[index] = 1;
|
||||
return true;
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
LABEL_SKIP:;
|
||||
}
|
||||
@@ -319,10 +319,10 @@ LABEL_SKIP:;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
static bool pi_next_cprl(opj_pi_iterator_t * pi) {
|
||||
static opj_bool pi_next_cprl(opj_pi_iterator_t * pi) {
|
||||
opj_pi_comp_t *comp = NULL;
|
||||
opj_pi_resolution_t *res = NULL;
|
||||
long index = 0;
|
||||
@@ -389,7 +389,7 @@ static bool pi_next_cprl(opj_pi_iterator_t * pi) {
|
||||
index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p;
|
||||
if (!pi->include[index]) {
|
||||
pi->include[index] = 1;
|
||||
return true;
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
LABEL_SKIP:;
|
||||
}
|
||||
@@ -398,7 +398,7 @@ LABEL_SKIP:;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -707,7 +707,7 @@ void pi_destroy(opj_pi_iterator_t *pi, opj_cp_t *cp, int tileno) {
|
||||
}
|
||||
}
|
||||
|
||||
bool pi_next(opj_pi_iterator_t * pi) {
|
||||
opj_bool pi_next(opj_pi_iterator_t * pi) {
|
||||
switch (pi->poc.prg) {
|
||||
case LRCP:
|
||||
return pi_next_lrcp(pi);
|
||||
@@ -720,13 +720,13 @@ bool pi_next(opj_pi_iterator_t * pi) {
|
||||
case CPRL:
|
||||
return pi_next_cprl(pi);
|
||||
case PROG_UNKNOWN:
|
||||
return false;
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
return false;
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
bool pi_create_encode( opj_pi_iterator_t *pi, opj_cp_t *cp,int tileno, int pino,int tpnum, int tppos, J2K_T2_MODE t2_mode,int cur_totnum_tp){
|
||||
opj_bool pi_create_encode( opj_pi_iterator_t *pi, opj_cp_t *cp,int tileno, int pino,int tpnum, int tppos, J2K_T2_MODE t2_mode,int cur_totnum_tp){
|
||||
char prog[4];
|
||||
int i;
|
||||
int incr_top=1,resetX=0;
|
||||
@@ -748,7 +748,7 @@ bool pi_create_encode( opj_pi_iterator_t *pi, opj_cp_t *cp,int tileno, int pino,
|
||||
case RPCL: strncpy(prog, "RPCL",4);
|
||||
break;
|
||||
case PROG_UNKNOWN:
|
||||
return true;
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
if(!(cp->tp_on && ((!cp->cinema && (t2_mode == FINAL_PASS)) || cp->cinema))){
|
||||
@@ -958,6 +958,6 @@ bool pi_create_encode( opj_pi_iterator_t *pi, opj_cp_t *cp,int tileno, int pino,
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -115,12 +115,14 @@ Modify the packet iterator for enabling tile part generation
|
||||
@param pi Handle to the packet iterator generated in pi_initialise_encode
|
||||
@param cp Coding parameters
|
||||
@param tileno Number that identifies the tile for which to list the packets
|
||||
@param pino Iterator index for pi
|
||||
@param tpnum Tile part number of the current tile
|
||||
@param tppos The position of the tile part flag in the progression order
|
||||
@param t2_mode If == 0 In Threshold calculation ,If == 1 Final pass
|
||||
@param cur_totnum_tp The total number of tile parts in the current tile
|
||||
@return Returns true if an error is detected
|
||||
*/
|
||||
bool pi_create_encode(opj_pi_iterator_t *pi, opj_cp_t *cp,int tileno, int pino,int tpnum, int tppos, J2K_T2_MODE t2_mode,int cur_totnum_tp);
|
||||
opj_bool pi_create_encode(opj_pi_iterator_t *pi, opj_cp_t *cp,int tileno, int pino,int tpnum, int tppos, J2K_T2_MODE t2_mode,int cur_totnum_tp);
|
||||
/**
|
||||
Create a packet iterator for Decoder
|
||||
@param image Raw image for which the packets will be listed
|
||||
@@ -145,7 +147,7 @@ Modify the packet iterator to point to the next packet
|
||||
@param pi Packet iterator to modify
|
||||
@return Returns false if pi pointed to the last packet or else returns true
|
||||
*/
|
||||
bool pi_next(opj_pi_iterator_t * pi);
|
||||
opj_bool pi_next(opj_pi_iterator_t * pi);
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/*@}*/
|
||||
|
||||
|
||||
173
indra/libopenjpeg/ppix_manager.c
Normal file
173
indra/libopenjpeg/ppix_manager.c
Normal file
@@ -0,0 +1,173 @@
|
||||
/*
|
||||
* $Id: ppix_manager.c 897 2011-08-28 21:43:57Z Kaori.Hagihara@gmail.com $
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||
* Copyright (c) 2003-2004, Yannick Verschueren
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*! \file
|
||||
* \brief Modification of jpip.c from 2KAN indexer
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "opj_includes.h"
|
||||
|
||||
/*
|
||||
* Write faix box of ppix
|
||||
*
|
||||
* @param[in] coff offset of j2k codestream
|
||||
* @param[in] compno component number
|
||||
* @param[in] cstr_info codestream information
|
||||
* @param[in] EPHused true if if EPH option used
|
||||
* @param[in] j2klen length of j2k codestream
|
||||
* @param[in] cio file output handle
|
||||
* @return length of faix box
|
||||
*/
|
||||
int write_ppixfaix( int coff, int compno, opj_codestream_info_t cstr_info, opj_bool EPHused, int j2klen, opj_cio_t *cio);
|
||||
|
||||
int write_ppix( int coff, opj_codestream_info_t cstr_info, opj_bool EPHused, int j2klen, opj_cio_t *cio)
|
||||
{
|
||||
int len, lenp, compno, i;
|
||||
opj_jp2_box_t *box;
|
||||
|
||||
/* printf("cstr_info.packno %d\n", cstr_info.packno); //NMAX? */
|
||||
|
||||
lenp = -1;
|
||||
box = (opj_jp2_box_t *)opj_calloc( cstr_info.numcomps, sizeof(opj_jp2_box_t));
|
||||
|
||||
for (i=0;i<2;i++){
|
||||
if (i) cio_seek( cio, lenp);
|
||||
|
||||
lenp = cio_tell( cio);
|
||||
cio_skip( cio, 4); /* L [at the end] */
|
||||
cio_write( cio, JPIP_PPIX, 4); /* PPIX */
|
||||
|
||||
write_manf( i, cstr_info.numcomps, box, cio);
|
||||
|
||||
for (compno=0; compno<cstr_info.numcomps; compno++){
|
||||
box[compno].length = write_ppixfaix( coff, compno, cstr_info, EPHused, j2klen, cio);
|
||||
box[compno].type = JPIP_FAIX;
|
||||
}
|
||||
|
||||
len = cio_tell( cio)-lenp;
|
||||
cio_seek( cio, lenp);
|
||||
cio_write( cio, len, 4); /* L */
|
||||
cio_seek( cio, lenp+len);
|
||||
}
|
||||
|
||||
opj_free(box);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
int write_ppixfaix( int coff, int compno, opj_codestream_info_t cstr_info, opj_bool EPHused, int j2klen, opj_cio_t *cio)
|
||||
{
|
||||
int len, lenp, tileno, version, i, nmax, size_of_coding; /* 4 or 8*/
|
||||
opj_tile_info_t *tile_Idx;
|
||||
opj_packet_info_t packet;
|
||||
int resno, precno, layno, num_packet;
|
||||
int numOfres, numOfprec, numOflayers;
|
||||
packet.end_pos = packet.end_ph_pos = packet.start_pos = -1;
|
||||
(void)EPHused; /* unused ? */
|
||||
|
||||
if( j2klen > pow( 2.0, 32)){
|
||||
size_of_coding = 8;
|
||||
version = 1;
|
||||
}
|
||||
else{
|
||||
size_of_coding = 4;
|
||||
version = 0;
|
||||
}
|
||||
|
||||
lenp = cio_tell( cio);
|
||||
cio_skip( cio, 4); /* L [at the end] */
|
||||
cio_write( cio, JPIP_FAIX, 4); /* FAIX */
|
||||
cio_write( cio, version, 1); /* Version 0 = 4 bytes */
|
||||
|
||||
nmax = 0;
|
||||
for( i=0; i<=cstr_info.numdecompos[compno]; i++)
|
||||
nmax += cstr_info.tile[0].ph[i] * cstr_info.tile[0].pw[i] * cstr_info.numlayers;
|
||||
|
||||
cio_write( cio, nmax, size_of_coding); /* NMAX */
|
||||
cio_write( cio, cstr_info.tw*cstr_info.th, size_of_coding); /* M */
|
||||
|
||||
for( tileno=0; tileno<cstr_info.tw*cstr_info.th; tileno++){
|
||||
tile_Idx = &cstr_info.tile[ tileno];
|
||||
|
||||
num_packet=0;
|
||||
numOfres = cstr_info.numdecompos[compno] + 1;
|
||||
|
||||
for( resno=0; resno<numOfres ; resno++){
|
||||
numOfprec = tile_Idx->pw[resno]*tile_Idx->ph[resno];
|
||||
for( precno=0; precno<numOfprec; precno++){
|
||||
numOflayers = cstr_info.numlayers;
|
||||
for( layno=0; layno<numOflayers; layno++){
|
||||
|
||||
switch ( cstr_info.prog){
|
||||
case LRCP:
|
||||
packet = tile_Idx->packet[ ((layno*numOfres+resno)*cstr_info.numcomps+compno)*numOfprec+precno];
|
||||
break;
|
||||
case RLCP:
|
||||
packet = tile_Idx->packet[ ((resno*numOflayers+layno)*cstr_info.numcomps+compno)*numOfprec+precno];
|
||||
break;
|
||||
case RPCL:
|
||||
packet = tile_Idx->packet[ ((resno*numOfprec+precno)*cstr_info.numcomps+compno)*numOflayers+layno];
|
||||
break;
|
||||
case PCRL:
|
||||
packet = tile_Idx->packet[ ((precno*cstr_info.numcomps+compno)*numOfres+resno)*numOflayers + layno];
|
||||
break;
|
||||
case CPRL:
|
||||
packet = tile_Idx->packet[ ((compno*numOfprec+precno)*numOfres+resno)*numOflayers + layno];
|
||||
break;
|
||||
default:
|
||||
fprintf( stderr, "failed to ppix indexing\n");
|
||||
}
|
||||
|
||||
cio_write( cio, packet.start_pos-coff, size_of_coding); /* start position */
|
||||
cio_write( cio, packet.end_pos-packet.start_pos+1, size_of_coding); /* length */
|
||||
|
||||
num_packet++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while( num_packet < nmax){ /* PADDING */
|
||||
cio_write( cio, 0, size_of_coding); /* start position */
|
||||
cio_write( cio, 0, size_of_coding); /* length */
|
||||
num_packet++;
|
||||
}
|
||||
}
|
||||
|
||||
len = cio_tell( cio)-lenp;
|
||||
cio_seek( cio, lenp);
|
||||
cio_write( cio, len, 4); /* L */
|
||||
cio_seek( cio, lenp+len);
|
||||
|
||||
return len;
|
||||
}
|
||||
@@ -123,20 +123,20 @@ static void t1_enc_refpass_step(
|
||||
/**
|
||||
Decode refinement pass
|
||||
*/
|
||||
static void INLINE t1_dec_refpass_step_raw(
|
||||
static INLINE void t1_dec_refpass_step_raw(
|
||||
opj_t1_t *t1,
|
||||
flag_t *flagsp,
|
||||
int *datap,
|
||||
int poshalf,
|
||||
int neghalf,
|
||||
int vsc);
|
||||
static void INLINE t1_dec_refpass_step_mqc(
|
||||
static INLINE void t1_dec_refpass_step_mqc(
|
||||
opj_t1_t *t1,
|
||||
flag_t *flagsp,
|
||||
int *datap,
|
||||
int poshalf,
|
||||
int neghalf);
|
||||
static void INLINE t1_dec_refpass_step_mqc_vsc(
|
||||
static INLINE void t1_dec_refpass_step_mqc_vsc(
|
||||
opj_t1_t *t1,
|
||||
flag_t *flagsp,
|
||||
int *datap,
|
||||
@@ -240,6 +240,7 @@ Encode 1 code-block
|
||||
@param stepsize
|
||||
@param cblksty Code-block style
|
||||
@param numcomps
|
||||
@param mct
|
||||
@param tile
|
||||
*/
|
||||
static void t1_encode_cblk(
|
||||
@@ -381,9 +382,10 @@ static INLINE void t1_dec_sigpass_step_raw(
|
||||
int vsc)
|
||||
{
|
||||
int v, flag;
|
||||
|
||||
opj_raw_t *raw = t1->raw; /* RAW component */
|
||||
|
||||
OPJ_ARG_NOT_USED(orient);
|
||||
|
||||
flag = vsc ? ((*flagsp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*flagsp);
|
||||
if ((flag & T1_SIG_OTH) && !(flag & (T1_SIG | T1_VISIT))) {
|
||||
if (raw_decode(raw)) {
|
||||
@@ -822,9 +824,10 @@ static void t1_dec_clnpass_step_partial(
|
||||
int oneplushalf)
|
||||
{
|
||||
int v, flag;
|
||||
|
||||
opj_mqc_t *mqc = t1->mqc; /* MQC component */
|
||||
|
||||
OPJ_ARG_NOT_USED(orient);
|
||||
|
||||
flag = *flagsp;
|
||||
mqc_setcurctx(mqc, t1_getctxno_sc(flag));
|
||||
v = mqc_decode(mqc) ^ t1_getspb(flag);
|
||||
@@ -1115,7 +1118,7 @@ static double t1_getwmsedec(
|
||||
return wmsedec;
|
||||
}
|
||||
|
||||
static bool allocate_buffers(
|
||||
static opj_bool allocate_buffers(
|
||||
opj_t1_t *t1,
|
||||
int w,
|
||||
int h)
|
||||
@@ -1127,7 +1130,7 @@ static bool allocate_buffers(
|
||||
opj_aligned_free(t1->data);
|
||||
t1->data = (int*) opj_aligned_malloc(datasize * sizeof(int));
|
||||
if(!t1->data){
|
||||
return false;
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
t1->datasize=datasize;
|
||||
}
|
||||
@@ -1140,7 +1143,7 @@ static bool allocate_buffers(
|
||||
opj_aligned_free(t1->flags);
|
||||
t1->flags = (flag_t*) opj_aligned_malloc(flagssize * sizeof(flag_t));
|
||||
if(!t1->flags){
|
||||
return false;
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
t1->flagssize=flagssize;
|
||||
}
|
||||
@@ -1149,7 +1152,7 @@ static bool allocate_buffers(
|
||||
t1->w=w;
|
||||
t1->h=h;
|
||||
|
||||
return true;
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
/** mod fixed_quality */
|
||||
@@ -1425,6 +1428,7 @@ void t1_encode_cblks(
|
||||
|
||||
for (bandno = 0; bandno < res->numbands; ++bandno) {
|
||||
opj_tcd_band_t* restrict band = &res->bands[bandno];
|
||||
int bandconst = 8192 * 8192 / ((int) floor(band->stepsize * 8192));
|
||||
|
||||
for (precno = 0; precno < res->pw * res->ph; ++precno) {
|
||||
opj_tcd_precinct_t *prc = &band->precincts[precno];
|
||||
@@ -1475,7 +1479,7 @@ void t1_encode_cblks(
|
||||
datap[(j * cblk_w) + i] =
|
||||
fix_mul(
|
||||
tmp,
|
||||
8192 * 8192 / ((int) floor(band->stepsize * 8192))) >> (11 - T1_NMSEDEC_FRACBITS);
|
||||
bandconst) >> (11 - T1_NMSEDEC_FRACBITS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1586,6 +1590,7 @@ void t1_decode_cblks(
|
||||
opj_free(cblk->segs);
|
||||
} /* cblkno */
|
||||
opj_free(precinct->cblks.dec);
|
||||
precinct->cblks.dec = NULL;
|
||||
} /* precno */
|
||||
} /* bandno */
|
||||
} /* resno */
|
||||
|
||||
@@ -135,8 +135,8 @@ void t1_encode_cblks(opj_t1_t *t1, opj_tcd_tile_t *tile, opj_tcp_t *tcp);
|
||||
/**
|
||||
Decode the code-blocks of a tile
|
||||
@param t1 T1 handle
|
||||
@param tile The tile to decode
|
||||
@param tcp Tile coding parameters
|
||||
@param tilec The tile to decode
|
||||
@param tccp Tile coding parameters
|
||||
*/
|
||||
void t1_decode_cblks(opj_t1_t* t1, opj_tcd_tilecomp_t* tilec, opj_tccp_t* tccp);
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
@@ -59,11 +59,12 @@ Encode a packet of a tile to a destination buffer
|
||||
*/
|
||||
static int t2_encode_packet(opj_tcd_tile_t *tile, opj_tcp_t *tcp, opj_pi_iterator_t *pi, unsigned char *dest, int len, opj_codestream_info_t *cstr_info, int tileno);
|
||||
/**
|
||||
@param seg
|
||||
@param cblk
|
||||
@param index
|
||||
@param cblksty
|
||||
@param first
|
||||
*/
|
||||
static void t2_init_seg(opj_tcd_cblk_dec_t* cblk, int index, int cblksty, int first);
|
||||
static opj_bool t2_init_seg(opj_tcd_cblk_dec_t* cblk, int index, int cblksty, int first);
|
||||
/**
|
||||
Decode a packet of a tile from a source buffer
|
||||
@param t2 T2 handle
|
||||
@@ -72,6 +73,7 @@ Decode a packet of a tile from a source buffer
|
||||
@param tile Tile for which to write the packets
|
||||
@param tcp Tile coding parameters
|
||||
@param pi Packet identity
|
||||
@param pack_info Packet information
|
||||
@return
|
||||
*/
|
||||
static int t2_decode_packet(opj_t2_t* t2, unsigned char *src, int len, opj_tcd_tile_t *tile,
|
||||
@@ -147,8 +149,8 @@ static int t2_encode_packet(opj_tcd_tile_t * tile, opj_tcp_t * tcp, opj_pi_itera
|
||||
c[1] = 145;
|
||||
c[2] = 0;
|
||||
c[3] = 4;
|
||||
c[4] = (tile->packno % 65536) / 256;
|
||||
c[5] = (tile->packno % 65536) % 256;
|
||||
c[4] = (unsigned char)((tile->packno % 65536) / 256);
|
||||
c[5] = (unsigned char)((tile->packno % 65536) % 256);
|
||||
c += 6;
|
||||
}
|
||||
/* </SOP> */
|
||||
@@ -253,8 +255,8 @@ static int t2_encode_packet(opj_tcd_tile_t * tile, opj_tcp_t * tcp, opj_pi_itera
|
||||
/* </EPH> */
|
||||
|
||||
/* << INDEX */
|
||||
// End of packet header position. Currently only represents the distance to start of packet
|
||||
// Will be updated later by incrementing with packet start value
|
||||
/* End of packet header position. Currently only represents the distance to start of packet
|
||||
// Will be updated later by incrementing with packet start value */
|
||||
if(cstr_info && cstr_info->index_write) {
|
||||
opj_packet_info_t *info_PK = &cstr_info->tile[tileno].packet[cstr_info->packno];
|
||||
info_PK->end_ph_pos = (int)(c - dest);
|
||||
@@ -294,9 +296,17 @@ static int t2_encode_packet(opj_tcd_tile_t * tile, opj_tcp_t * tcp, opj_pi_itera
|
||||
return (c - dest);
|
||||
}
|
||||
|
||||
static void t2_init_seg(opj_tcd_cblk_dec_t* cblk, int index, int cblksty, int first) {
|
||||
static opj_bool t2_init_seg(opj_tcd_cblk_dec_t* cblk, int index, int cblksty, int first) {
|
||||
opj_tcd_seg_t* seg;
|
||||
cblk->segs = (opj_tcd_seg_t*) opj_realloc(cblk->segs, (index + 1) * sizeof(opj_tcd_seg_t));
|
||||
opj_tcd_seg_t* segs;
|
||||
segs = (opj_tcd_seg_t*) opj_realloc(cblk->segs, (index + 1) * sizeof(opj_tcd_seg_t));
|
||||
|
||||
if (segs == NULL)
|
||||
{
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
cblk->segs = segs;
|
||||
|
||||
seg = &cblk->segs[index];
|
||||
seg->data = NULL;
|
||||
seg->dataindex = 0;
|
||||
@@ -314,6 +324,8 @@ static void t2_init_seg(opj_tcd_cblk_dec_t* cblk, int index, int cblksty, int fi
|
||||
} else {
|
||||
seg->maxpasses = 109;
|
||||
}
|
||||
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
static int t2_decode_packet(opj_t2_t* t2, unsigned char *src, int len, opj_tcd_tile_t *tile,
|
||||
@@ -401,8 +413,8 @@ static int t2_decode_packet(opj_t2_t* t2, unsigned char *src, int len, opj_tcd_t
|
||||
}
|
||||
|
||||
/* << INDEX */
|
||||
// End of packet header position. Currently only represents the distance to start of packet
|
||||
// Will be updated later by incrementing with packet start value
|
||||
/* End of packet header position. Currently only represents the distance to start of packet
|
||||
// Will be updated later by incrementing with packet start value*/
|
||||
if(pack_info) {
|
||||
pack_info->end_ph_pos = (int)(c - src);
|
||||
}
|
||||
@@ -460,12 +472,22 @@ static int t2_decode_packet(opj_t2_t* t2, unsigned char *src, int len, opj_tcd_t
|
||||
cblk->numlenbits += increment;
|
||||
segno = 0;
|
||||
if (!cblk->numsegs) {
|
||||
t2_init_seg(cblk, segno, tcp->tccps[compno].cblksty, 1);
|
||||
if (!t2_init_seg(cblk, segno, tcp->tccps[compno].cblksty, 1))
|
||||
{
|
||||
opj_event_msg(t2->cinfo, EVT_ERROR, "Out of memory\n");
|
||||
bio_destroy(bio);
|
||||
return -999;
|
||||
}
|
||||
} else {
|
||||
segno = cblk->numsegs - 1;
|
||||
if (cblk->segs[segno].numpasses == cblk->segs[segno].maxpasses) {
|
||||
++segno;
|
||||
t2_init_seg(cblk, segno, tcp->tccps[compno].cblksty, 0);
|
||||
if (!t2_init_seg(cblk, segno, tcp->tccps[compno].cblksty, 0))
|
||||
{
|
||||
opj_event_msg(t2->cinfo, EVT_ERROR, "Out of memory\n");
|
||||
bio_destroy(bio);
|
||||
return -999;
|
||||
}
|
||||
}
|
||||
}
|
||||
n = cblk->numnewpasses;
|
||||
@@ -476,7 +498,12 @@ static int t2_decode_packet(opj_t2_t* t2, unsigned char *src, int len, opj_tcd_t
|
||||
n -= cblk->segs[segno].numnewpasses;
|
||||
if (n > 0) {
|
||||
++segno;
|
||||
t2_init_seg(cblk, segno, tcp->tccps[compno].cblksty, 0);
|
||||
if (!t2_init_seg(cblk, segno, tcp->tccps[compno].cblksty, 0))
|
||||
{
|
||||
opj_event_msg(t2->cinfo, EVT_ERROR, "Out of memory\n");
|
||||
bio_destroy(bio);
|
||||
return -999;
|
||||
}
|
||||
}
|
||||
} while (n > 0);
|
||||
}
|
||||
@@ -494,14 +521,15 @@ static int t2_decode_packet(opj_t2_t* t2, unsigned char *src, int len, opj_tcd_t
|
||||
if (tcp->csty & J2K_CP_CSTY_EPH) {
|
||||
if ((*hd) != 0xff || (*(hd + 1) != 0x92)) {
|
||||
opj_event_msg(t2->cinfo, EVT_ERROR, "Expected EPH marker\n");
|
||||
return -999;
|
||||
} else {
|
||||
hd += 2;
|
||||
}
|
||||
}
|
||||
|
||||
/* << INDEX */
|
||||
// End of packet header position. Currently only represents the distance to start of packet
|
||||
// Will be updated later by incrementing with packet start value
|
||||
/* End of packet header position. Currently only represents the distance to start of packet
|
||||
// Will be updated later by incrementing with packet start value*/
|
||||
if(pack_info) {
|
||||
pack_info->end_ph_pos = (int)(hd - src);
|
||||
}
|
||||
@@ -565,7 +593,7 @@ static int t2_decode_packet(opj_t2_t* t2, unsigned char *src, int len, opj_tcd_t
|
||||
|
||||
#endif /* USE_JPWL */
|
||||
|
||||
cblk->data = (unsigned char*) opj_realloc(cblk->data, (cblk->len + seg->newlen) * sizeof(unsigned char*));
|
||||
cblk->data = (unsigned char*) opj_realloc(cblk->data, (cblk->len + seg->newlen) * sizeof(unsigned char));
|
||||
memcpy(cblk->data + cblk->len, c, seg->newlen);
|
||||
if (seg->numpasses == 0) {
|
||||
seg->data = &cblk->data;
|
||||
@@ -659,8 +687,8 @@ int t2_encode_packets(opj_t2_t* t2,int tileno, opj_tcd_tile_t *tile, int maxlaye
|
||||
info_PK->start_pos = ((cp->tp_on | tcp->POC)&& info_PK->start_pos) ? info_PK->start_pos : info_TL->packet[cstr_info->packno - 1].end_pos + 1;
|
||||
}
|
||||
info_PK->end_pos = info_PK->start_pos + e - 1;
|
||||
info_PK->end_ph_pos += info_PK->start_pos - 1; // End of packet header which now only represents the distance
|
||||
// to start of packet is incremented by value of start of packet
|
||||
info_PK->end_ph_pos += info_PK->start_pos - 1; /* End of packet header which now only represents the distance
|
||||
// to start of packet is incremented by value of start of packet*/
|
||||
}
|
||||
|
||||
cstr_info->packno++;
|
||||
@@ -711,7 +739,11 @@ int t2_decode_packets(opj_t2_t *t2, unsigned char *src, int len, int tileno, opj
|
||||
} else {
|
||||
e = 0;
|
||||
}
|
||||
|
||||
if(e == -999)
|
||||
{
|
||||
pi_destroy(pi, cp, tileno);
|
||||
return -999;
|
||||
}
|
||||
/* progression in resolution */
|
||||
image->comps[pi[pino].compno].resno_decoded =
|
||||
(e > 0) ?
|
||||
@@ -725,8 +757,9 @@ int t2_decode_packets(opj_t2_t *t2, unsigned char *src, int len, int tileno, opj
|
||||
opj_packet_info_t *info_PK = &info_TL->packet[cstr_info->packno];
|
||||
if (!cstr_info->packno) {
|
||||
info_PK->start_pos = info_TL->end_header + 1;
|
||||
} else if (info_TL->packet[cstr_info->packno-1].end_pos >= (int)cstr_info->tile[tileno].tp[curtp].tp_end_pos){ // New tile part
|
||||
info_TL->tp[curtp].tp_numpacks = cstr_info->packno - tp_start_packno; // Number of packets in previous tile-part
|
||||
} else if (info_TL->packet[cstr_info->packno-1].end_pos >= (int)cstr_info->tile[tileno].tp[curtp].tp_end_pos){ /* New tile part*/
|
||||
info_TL->tp[curtp].tp_numpacks = cstr_info->packno - tp_start_packno; /* Number of packets in previous tile-part*/
|
||||
info_TL->tp[curtp].tp_start_pack = tp_start_packno;
|
||||
tp_start_packno = cstr_info->packno;
|
||||
curtp++;
|
||||
info_PK->start_pos = cstr_info->tile[tileno].tp[curtp].tp_end_header+1;
|
||||
@@ -734,8 +767,8 @@ int t2_decode_packets(opj_t2_t *t2, unsigned char *src, int len, int tileno, opj
|
||||
info_PK->start_pos = (cp->tp_on && info_PK->start_pos) ? info_PK->start_pos : info_TL->packet[cstr_info->packno - 1].end_pos + 1;
|
||||
}
|
||||
info_PK->end_pos = info_PK->start_pos + e - 1;
|
||||
info_PK->end_ph_pos += info_PK->start_pos - 1; // End of packet header which now only represents the distance
|
||||
// to start of packet is incremented by value of start of packet
|
||||
info_PK->end_ph_pos += info_PK->start_pos - 1; /* End of packet header which now only represents the distance
|
||||
// to start of packet is incremented by value of start of packet*/
|
||||
cstr_info->packno++;
|
||||
}
|
||||
/* << INDEX */
|
||||
@@ -749,7 +782,8 @@ int t2_decode_packets(opj_t2_t *t2, unsigned char *src, int len, int tileno, opj
|
||||
}
|
||||
/* INDEX >> */
|
||||
if(cstr_info) {
|
||||
cstr_info->tile[tileno].tp[curtp].tp_numpacks = cstr_info->packno - tp_start_packno; // Number of packets in last tile-part
|
||||
cstr_info->tile[tileno].tp[curtp].tp_numpacks = cstr_info->packno - tp_start_packno; /* Number of packets in last tile-part*/
|
||||
cstr_info->tile[tileno].tp[curtp].tp_start_pack = tp_start_packno;
|
||||
}
|
||||
/* << INDEX */
|
||||
|
||||
|
||||
@@ -67,6 +67,7 @@ Encode the packets of a tile to a destination buffer
|
||||
@param cstr_info Codestream information structure
|
||||
@param tpnum Tile part number of the current tile
|
||||
@param tppos The position of the tile part flag in the progression order
|
||||
@param pino
|
||||
@param t2_mode If == 0 In Threshold calculation ,If == 1 Final pass
|
||||
@param cur_totnum_tp The total number of tile parts in the current tile
|
||||
*/
|
||||
@@ -78,6 +79,7 @@ Decode the packets of a tile from a source buffer
|
||||
@param len length of the source buffer
|
||||
@param tileno number that identifies the tile for which to decode the packets
|
||||
@param tile tile for which to decode the packets
|
||||
@param cstr_info Codestream information structure
|
||||
*/
|
||||
int t2_decode_packets(opj_t2_t *t2, unsigned char *src, int len, int tileno, opj_tcd_tile_t *tile, opj_codestream_info_t *cstr_info);
|
||||
|
||||
|
||||
@@ -30,10 +30,11 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#define _ISOC99_SOURCE /* lrintf is C99 */
|
||||
#include "opj_includes.h"
|
||||
|
||||
void tcd_dump(FILE *fd, opj_tcd_t *tcd, opj_tcd_image_t * img) {
|
||||
int tileno, compno, resno, bandno, precno;//, cblkno;
|
||||
int tileno, compno, resno, bandno, precno;/*, cblkno;*/
|
||||
|
||||
fprintf(fd, "image {\n");
|
||||
fprintf(fd, " tw=%d, th=%d x0=%d x1=%d y0=%d y1=%d\n",
|
||||
@@ -290,6 +291,7 @@ void tcd_malloc_encode(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp, int c
|
||||
for (i = 0; i < res->pw * res->ph * 3; i++) {
|
||||
band->precincts[i].imsbtree = NULL;
|
||||
band->precincts[i].incltree = NULL;
|
||||
band->precincts[i].cblks.enc = NULL;
|
||||
}
|
||||
|
||||
for (precno = 0; precno < res->pw * res->ph; precno++) {
|
||||
@@ -332,8 +334,10 @@ void tcd_malloc_encode(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp, int c
|
||||
cblk->y0 = int_max(cblkystart, prc->y0);
|
||||
cblk->x1 = int_min(cblkxend, prc->x1);
|
||||
cblk->y1 = int_min(cblkyend, prc->y1);
|
||||
cblk->data = (unsigned char*) opj_calloc(8192+2, sizeof(unsigned char));
|
||||
cblk->data = (unsigned char*) opj_calloc(9728+2, sizeof(unsigned char));
|
||||
/* FIXME: mqc_init_enc and mqc_byteout underrun the buffer if we don't do this. Why? */
|
||||
cblk->data[0] = 0;
|
||||
cblk->data[1] = 0;
|
||||
cblk->data += 2;
|
||||
cblk->layers = (opj_tcd_layer_t*) opj_calloc(100, sizeof(opj_tcd_layer_t));
|
||||
cblk->passes = (opj_tcd_pass_t*) opj_calloc(100, sizeof(opj_tcd_pass_t));
|
||||
@@ -593,6 +597,8 @@ void tcd_init_encode(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp, int cur
|
||||
cblk->y1 = int_min(cblkyend, prc->y1);
|
||||
cblk->data = (unsigned char*) opj_calloc(8192+2, sizeof(unsigned char));
|
||||
/* FIXME: mqc_init_enc and mqc_byteout underrun the buffer if we don't do this. Why? */
|
||||
cblk->data[0] = 0;
|
||||
cblk->data[1] = 0;
|
||||
cblk->data += 2;
|
||||
cblk->layers = (opj_tcd_layer_t*) opj_calloc(100, sizeof(opj_tcd_layer_t));
|
||||
cblk->passes = (opj_tcd_pass_t*) opj_calloc(100, sizeof(opj_tcd_pass_t));
|
||||
@@ -613,7 +619,7 @@ void tcd_malloc_decode(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp) {
|
||||
tcd->image = image;
|
||||
tcd->tcd_image->tw = cp->tw;
|
||||
tcd->tcd_image->th = cp->th;
|
||||
tcd->tcd_image->tiles = (opj_tcd_tile_t *) opj_malloc(cp->tw * cp->th * sizeof(opj_tcd_tile_t));
|
||||
tcd->tcd_image->tiles = (opj_tcd_tile_t *) opj_calloc(cp->tw * cp->th, sizeof(opj_tcd_tile_t));
|
||||
|
||||
/*
|
||||
Allocate place to store the decoded data = final image
|
||||
@@ -656,7 +662,7 @@ void tcd_malloc_decode(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp) {
|
||||
tilec->y1 = int_ceildiv(tile->y1, image->comps[i].dy);
|
||||
|
||||
x0 = j == 0 ? tilec->x0 : int_min(x0, (unsigned int) tilec->x0);
|
||||
y0 = j == 0 ? tilec->y0 : int_min(y0, (unsigned int) tilec->x0);
|
||||
y0 = j == 0 ? tilec->y0 : int_min(y0, (unsigned int) tilec->y0);
|
||||
x1 = j == 0 ? tilec->x1 : int_max(x1, (unsigned int) tilec->x1);
|
||||
y1 = j == 0 ? tilec->y1 : int_max(y1, (unsigned int) tilec->y1);
|
||||
}
|
||||
@@ -676,6 +682,8 @@ void tcd_malloc_decode_tile(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp,
|
||||
opj_tcp_t *tcp;
|
||||
opj_tcd_tile_t *tile;
|
||||
|
||||
OPJ_ARG_NOT_USED(cstr_info);
|
||||
|
||||
tcd->cp = cp;
|
||||
|
||||
tcp = &(cp->tcps[cp->tileno[tileno]]);
|
||||
@@ -687,6 +695,12 @@ void tcd_malloc_decode_tile(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp,
|
||||
opj_tccp_t *tccp = &tcp->tccps[compno];
|
||||
opj_tcd_tilecomp_t *tilec = &tile->comps[compno];
|
||||
|
||||
if (tccp->numresolutions <= 0)
|
||||
{
|
||||
cp->tileno[tileno] = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
/* border of each tile component (global) */
|
||||
tilec->x0 = int_ceildiv(tile->x0, image->comps[compno].dx);
|
||||
tilec->y0 = int_ceildiv(tile->y0, image->comps[compno].dy);
|
||||
@@ -997,7 +1011,7 @@ void tcd_makelayer(opj_tcd_t *tcd, int layno, double thresh, int final) {
|
||||
}
|
||||
}
|
||||
|
||||
bool tcd_rateallocate(opj_tcd_t *tcd, unsigned char *dest, int len, opj_codestream_info_t *cstr_info) {
|
||||
opj_bool tcd_rateallocate(opj_tcd_t *tcd, unsigned char *dest, int len, opj_codestream_info_t *cstr_info) {
|
||||
int compno, resno, bandno, precno, cblkno, passno, layno;
|
||||
double min, max;
|
||||
double cumdisto[100]; /* fixed_quality */
|
||||
@@ -1149,7 +1163,7 @@ bool tcd_rateallocate(opj_tcd_t *tcd, unsigned char *dest, int len, opj_codestre
|
||||
}
|
||||
|
||||
if (!success) {
|
||||
return false;
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
if(cstr_info) { /* Threshold for Marcela Index */
|
||||
@@ -1161,7 +1175,7 @@ bool tcd_rateallocate(opj_tcd_t *tcd, unsigned char *dest, int len, opj_codestre
|
||||
cumdisto[layno] = (layno == 0) ? tcd_tile->distolayer[0] : (cumdisto[layno - 1] + tcd_tile->distolayer[layno]);
|
||||
}
|
||||
|
||||
return true;
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
int tcd_encode_tile(opj_tcd_t *tcd, int tileno, unsigned char *dest, int len, opj_codestream_info_t *cstr_info) {
|
||||
@@ -1313,7 +1327,7 @@ int tcd_encode_tile(opj_tcd_t *tcd, int tileno, unsigned char *dest, int len, op
|
||||
return l;
|
||||
}
|
||||
|
||||
bool tcd_decode_tile(opj_tcd_t *tcd, unsigned char *src, int len, int tileno, opj_codestream_info_t *cstr_info) {
|
||||
opj_bool tcd_decode_tile(opj_tcd_t *tcd, unsigned char *src, int len, int tileno, opj_codestream_info_t *cstr_info) {
|
||||
int l;
|
||||
int compno;
|
||||
int eof = 0;
|
||||
@@ -1349,7 +1363,7 @@ bool tcd_decode_tile(opj_tcd_t *tcd, unsigned char *src, int len, int tileno, op
|
||||
}
|
||||
else {
|
||||
cstr_info->tile[tileno].pdx[resno] = 15;
|
||||
cstr_info->tile[tileno].pdx[resno] = 15;
|
||||
cstr_info->tile[tileno].pdy[resno] = 15;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1373,14 +1387,24 @@ bool tcd_decode_tile(opj_tcd_t *tcd, unsigned char *src, int len, int tileno, op
|
||||
|
||||
t1_time = opj_clock(); /* time needed to decode a tile */
|
||||
t1 = t1_create(tcd->cinfo);
|
||||
if (t1 == NULL)
|
||||
{
|
||||
opj_event_msg(tcd->cinfo, EVT_ERROR, "Out of memory\n");
|
||||
t1_destroy(t1);
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
for (compno = 0; compno < tile->numcomps; ++compno) {
|
||||
opj_tcd_tilecomp_t* tilec = &tile->comps[compno];
|
||||
/* The +3 is headroom required by the vectorized DWT */
|
||||
tilec->data = (int*) opj_aligned_malloc((((tilec->x1 - tilec->x0) * (tilec->y1 - tilec->y0))+3) * sizeof(int));
|
||||
if(tilec->data)
|
||||
t1_decode_cblks(t1, tilec, &tcd->tcp->tccps[compno]);
|
||||
else
|
||||
opj_event_msg(tcd->cinfo, EVT_ERROR, "tcd_decode: tile size invalid\n");
|
||||
if (tilec->data == NULL)
|
||||
{
|
||||
opj_event_msg(tcd->cinfo, EVT_ERROR, "Out of memory\n");
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
t1_decode_cblks(t1, tilec, &tcd->tcp->tccps[compno]);
|
||||
}
|
||||
t1_destroy(t1);
|
||||
t1_time = opj_clock() - t1_time;
|
||||
@@ -1394,18 +1418,20 @@ bool tcd_decode_tile(opj_tcd_t *tcd, unsigned char *src, int len, int tileno, op
|
||||
int numres2decode;
|
||||
|
||||
if (tcd->cp->reduce != 0) {
|
||||
tcd->image->comps[compno].resno_decoded =
|
||||
tile->comps[compno].numresolutions - tcd->cp->reduce - 1;
|
||||
if (tcd->image->comps[compno].resno_decoded < 0) {
|
||||
if ( tile->comps[compno].numresolutions < ( tcd->cp->reduce - 1 ) ) {
|
||||
opj_event_msg(tcd->cinfo, EVT_ERROR, "Error decoding tile. The number of resolutions to remove [%d+1] is higher than the number "
|
||||
" of resolutions in the original codestream [%d]\nModify the cp_reduce parameter.\n", tcd->cp->reduce, tile->comps[compno].numresolutions);
|
||||
return false;
|
||||
" of resolutions in the original codestream [%d]\nModify the cp_reduce parameter.\n", tcd->cp->reduce, tile->comps[compno].numresolutions);
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
else {
|
||||
tcd->image->comps[compno].resno_decoded =
|
||||
tile->comps[compno].numresolutions - tcd->cp->reduce - 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(!tilec->data) {
|
||||
opj_event_msg(tcd->cinfo, EVT_ERROR, "Error decoding tile. null data\n");
|
||||
return false;
|
||||
opj_event_msg(tcd->cinfo, EVT_ERROR, "Error decoding tile. null data\n");
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
numres2decode = tcd->image->comps[compno].resno_decoded + 1;
|
||||
@@ -1424,18 +1450,23 @@ bool tcd_decode_tile(opj_tcd_t *tcd, unsigned char *src, int len, int tileno, op
|
||||
|
||||
if (tcd->tcp->mct) {
|
||||
int n = (tile->comps[0].x1 - tile->comps[0].x0) * (tile->comps[0].y1 - tile->comps[0].y0);
|
||||
if (tcd->tcp->tccps[0].qmfbid == 1) {
|
||||
mct_decode(
|
||||
tile->comps[0].data,
|
||||
tile->comps[1].data,
|
||||
tile->comps[2].data,
|
||||
n);
|
||||
} else {
|
||||
mct_decode_real(
|
||||
(float*)tile->comps[0].data,
|
||||
(float*)tile->comps[1].data,
|
||||
(float*)tile->comps[2].data,
|
||||
n);
|
||||
|
||||
if (tile->numcomps >= 3 ){
|
||||
if (tcd->tcp->tccps[0].qmfbid == 1) {
|
||||
mct_decode(
|
||||
tile->comps[0].data,
|
||||
tile->comps[1].data,
|
||||
tile->comps[2].data,
|
||||
n);
|
||||
} else {
|
||||
mct_decode_real(
|
||||
(float*)tile->comps[0].data,
|
||||
(float*)tile->comps[1].data,
|
||||
(float*)tile->comps[2].data,
|
||||
n);
|
||||
}
|
||||
} else{
|
||||
opj_event_msg(tcd->cinfo, EVT_WARNING,"Number of components (%d) is inconsistent with a MCT. Skip the MCT step.\n",tile->numcomps);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1459,6 +1490,11 @@ bool tcd_decode_tile(opj_tcd_t *tcd, unsigned char *src, int len, int tileno, op
|
||||
if(!imagec->data){
|
||||
imagec->data = (int*) opj_malloc(imagec->w * imagec->h * sizeof(int));
|
||||
}
|
||||
if (!imagec->data)
|
||||
{
|
||||
opj_event_msg(tcd->cinfo, EVT_ERROR, "Out of memory\n");
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
if(tcd->tcp->tccps[compno].qmfbid == 1) {
|
||||
for(j = res->y0; j < res->y1; ++j) {
|
||||
for(i = res->x0; i < res->x1; ++i) {
|
||||
@@ -1484,40 +1520,59 @@ bool tcd_decode_tile(opj_tcd_t *tcd, unsigned char *src, int len, int tileno, op
|
||||
opj_event_msg(tcd->cinfo, EVT_INFO, "- tile decoded in %f s\n", tile_time);
|
||||
|
||||
if (eof) {
|
||||
return false;
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
return true;
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
void tcd_free_decode(opj_tcd_t *tcd) {
|
||||
opj_tcd_image_t *tcd_image = tcd->tcd_image;
|
||||
int i = 0;
|
||||
for (i = 0; i < tcd_image->tw * tcd_image->th; i++)
|
||||
{
|
||||
tcd_free_decode_tile(tcd, i);
|
||||
}
|
||||
|
||||
opj_free(tcd_image->tiles);
|
||||
}
|
||||
|
||||
void tcd_free_decode_tile(opj_tcd_t *tcd, int tileno) {
|
||||
int compno,resno,bandno,precno;
|
||||
int compno,resno,bandno,precno,cblkno;
|
||||
|
||||
opj_tcd_image_t *tcd_image = tcd->tcd_image;
|
||||
|
||||
opj_tcd_tile_t *tile = &tcd_image->tiles[tileno];
|
||||
for (compno = 0; compno < tile->numcomps; compno++) {
|
||||
opj_tcd_tilecomp_t *tilec = &tile->comps[compno];
|
||||
for (resno = 0; resno < tilec->numresolutions; resno++) {
|
||||
opj_tcd_resolution_t *res = &tilec->resolutions[resno];
|
||||
for (bandno = 0; bandno < res->numbands; bandno++) {
|
||||
opj_tcd_band_t *band = &res->bands[bandno];
|
||||
for (precno = 0; precno < res->ph * res->pw; precno++) {
|
||||
opj_tcd_precinct_t *prec = &band->precincts[precno];
|
||||
if (prec->imsbtree != NULL) tgt_destroy(prec->imsbtree);
|
||||
if (prec->incltree != NULL) tgt_destroy(prec->incltree);
|
||||
if (tile->comps != NULL) {
|
||||
for (compno = 0; compno < tile->numcomps; compno++) {
|
||||
opj_tcd_tilecomp_t *tilec = &tile->comps[compno];
|
||||
for (resno = 0; resno < tilec->numresolutions; resno++) {
|
||||
opj_tcd_resolution_t *res = &tilec->resolutions[resno];
|
||||
for (bandno = 0; bandno < res->numbands; bandno++) {
|
||||
opj_tcd_band_t *band = &res->bands[bandno];
|
||||
for (precno = 0; precno < res->ph * res->pw; precno++) {
|
||||
opj_tcd_precinct_t *prec = &band->precincts[precno];
|
||||
if (prec->cblks.dec != NULL) {
|
||||
for (cblkno = 0; cblkno < prec->cw * prec->ch; ++cblkno) {
|
||||
opj_tcd_cblk_dec_t* cblk = &prec->cblks.dec[cblkno];
|
||||
opj_free(cblk->data);
|
||||
opj_free(cblk->segs);
|
||||
}
|
||||
opj_free(prec->cblks.dec);
|
||||
}
|
||||
if (prec->imsbtree != NULL) tgt_destroy(prec->imsbtree);
|
||||
if (prec->incltree != NULL) tgt_destroy(prec->incltree);
|
||||
|
||||
|
||||
}
|
||||
opj_free(band->precincts);
|
||||
}
|
||||
opj_free(band->precincts);
|
||||
}
|
||||
opj_free(tilec->resolutions);
|
||||
}
|
||||
opj_free(tilec->resolutions);
|
||||
opj_free(tile->comps);
|
||||
tile->comps = NULL;
|
||||
}
|
||||
opj_free(tile->comps);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -251,7 +251,7 @@ void tcd_malloc_decode_tile(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp,
|
||||
void tcd_makelayer_fixed(opj_tcd_t *tcd, int layno, int final);
|
||||
void tcd_rateallocate_fixed(opj_tcd_t *tcd);
|
||||
void tcd_makelayer(opj_tcd_t *tcd, int layno, double thresh, int final);
|
||||
bool tcd_rateallocate(opj_tcd_t *tcd, unsigned char *dest, int len, opj_codestream_info_t *cstr_info);
|
||||
opj_bool tcd_rateallocate(opj_tcd_t *tcd, unsigned char *dest, int len, opj_codestream_info_t *cstr_info);
|
||||
/**
|
||||
Encode a tile from the raw image into a buffer
|
||||
@param tcd TCD handle
|
||||
@@ -268,8 +268,9 @@ Decode a tile from a buffer into a raw image
|
||||
@param src Source buffer
|
||||
@param len Length of source buffer
|
||||
@param tileno Number that identifies one of the tiles to be decoded
|
||||
@param cstr_info Codestream information structure
|
||||
*/
|
||||
bool tcd_decode_tile(opj_tcd_t *tcd, unsigned char *src, int len, int tileno, opj_codestream_info_t *cstr_info);
|
||||
opj_bool tcd_decode_tile(opj_tcd_t *tcd, unsigned char *src, int len, int tileno, opj_codestream_info_t *cstr_info);
|
||||
/**
|
||||
Free the memory allocated for decoding
|
||||
@param tcd TCD handle
|
||||
|
||||
120
indra/libopenjpeg/thix_manager.c
Normal file
120
indra/libopenjpeg/thix_manager.c
Normal file
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
* $Id: thix_manager.c 897 2011-08-28 21:43:57Z Kaori.Hagihara@gmail.com $
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||
* Copyright (c) 2003-2004, Yannick Verschueren
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*! \file
|
||||
* \brief Modification of jpip.c from 2KAN indexer
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "opj_includes.h"
|
||||
|
||||
/*
|
||||
* Write tile-part headers mhix box
|
||||
*
|
||||
* @param[in] coff offset of j2k codestream
|
||||
* @param[in] cstr_info codestream information
|
||||
* @param[in] tileno tile number
|
||||
* @param[in] cio file output handle
|
||||
* @return length of mhix box
|
||||
*/
|
||||
int write_tilemhix( int coff, opj_codestream_info_t cstr_info, int tileno, opj_cio_t *cio);
|
||||
|
||||
int write_thix( int coff, opj_codestream_info_t cstr_info, opj_cio_t *cio)
|
||||
{
|
||||
int len, lenp, i;
|
||||
int tileno;
|
||||
opj_jp2_box_t *box;
|
||||
|
||||
lenp = 0;
|
||||
box = (opj_jp2_box_t *)opj_calloc( cstr_info.tw*cstr_info.th, sizeof(opj_jp2_box_t));
|
||||
|
||||
for ( i = 0; i < 2 ; i++ ){
|
||||
if (i)
|
||||
cio_seek( cio, lenp);
|
||||
|
||||
lenp = cio_tell( cio);
|
||||
cio_skip( cio, 4); /* L [at the end] */
|
||||
cio_write( cio, JPIP_THIX, 4); /* THIX */
|
||||
write_manf( i, cstr_info.tw*cstr_info.th, box, cio);
|
||||
|
||||
for (tileno = 0; tileno < cstr_info.tw*cstr_info.th; tileno++){
|
||||
box[tileno].length = write_tilemhix( coff, cstr_info, tileno, cio);
|
||||
box[tileno].type = JPIP_MHIX;
|
||||
}
|
||||
|
||||
len = cio_tell( cio)-lenp;
|
||||
cio_seek( cio, lenp);
|
||||
cio_write( cio, len, 4); /* L */
|
||||
cio_seek( cio, lenp+len);
|
||||
}
|
||||
|
||||
opj_free(box);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
int write_tilemhix( int coff, opj_codestream_info_t cstr_info, int tileno, opj_cio_t *cio)
|
||||
{
|
||||
int i;
|
||||
opj_tile_info_t tile;
|
||||
opj_tp_info_t tp;
|
||||
int len, lenp;
|
||||
opj_marker_info_t *marker;
|
||||
|
||||
lenp = cio_tell( cio);
|
||||
cio_skip( cio, 4); /* L [at the end] */
|
||||
cio_write( cio, JPIP_MHIX, 4); /* MHIX */
|
||||
|
||||
tile = cstr_info.tile[tileno];
|
||||
tp = tile.tp[0];
|
||||
|
||||
cio_write( cio, tp.tp_end_header-tp.tp_start_pos+1, 8); /* TLEN */
|
||||
|
||||
marker = cstr_info.tile[tileno].marker;
|
||||
|
||||
for( i=0; i<cstr_info.tile[tileno].marknum; i++){ /* Marker restricted to 1 apparition */
|
||||
cio_write( cio, marker[i].type, 2);
|
||||
cio_write( cio, 0, 2);
|
||||
cio_write( cio, marker[i].pos-coff, 8);
|
||||
cio_write( cio, marker[i].len, 2);
|
||||
}
|
||||
|
||||
/* free( marker);*/
|
||||
|
||||
len = cio_tell( cio) - lenp;
|
||||
cio_seek( cio, lenp);
|
||||
cio_write( cio, len, 4); /* L */
|
||||
cio_seek( cio, lenp+len);
|
||||
|
||||
return len;
|
||||
}
|
||||
153
indra/libopenjpeg/tpix_manager.c
Normal file
153
indra/libopenjpeg/tpix_manager.c
Normal file
@@ -0,0 +1,153 @@
|
||||
/*
|
||||
* $Id: tpix_manager.c 897 2011-08-28 21:43:57Z Kaori.Hagihara@gmail.com $
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||
* Copyright (c) 2003-2004, Yannick Verschueren
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*! \file
|
||||
* \brief Modification of jpip.c from 2KAN indexer
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include "opj_includes.h"
|
||||
|
||||
#define MAX(a,b) ((a)>(b)?(a):(b))
|
||||
|
||||
|
||||
/*
|
||||
* Write faix box of tpix
|
||||
*
|
||||
* @param[in] coff offset of j2k codestream
|
||||
* @param[in] compno component number
|
||||
* @param[in] cstr_info codestream information
|
||||
* @param[in] j2klen length of j2k codestream
|
||||
* @param[in] cio file output handle
|
||||
* @return length of faix box
|
||||
*/
|
||||
int write_tpixfaix( int coff, int compno, opj_codestream_info_t cstr_info, int j2klen, opj_cio_t *cio);
|
||||
|
||||
|
||||
int write_tpix( int coff, opj_codestream_info_t cstr_info, int j2klen, opj_cio_t *cio)
|
||||
{
|
||||
int len, lenp;
|
||||
lenp = cio_tell( cio);
|
||||
cio_skip( cio, 4); /* L [at the end] */
|
||||
cio_write( cio, JPIP_TPIX, 4); /* TPIX */
|
||||
|
||||
write_tpixfaix( coff, 0, cstr_info, j2klen, cio);
|
||||
|
||||
len = cio_tell( cio)-lenp;
|
||||
cio_seek( cio, lenp);
|
||||
cio_write( cio, len, 4); /* L */
|
||||
cio_seek( cio, lenp+len);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get number of maximum tile parts per tile
|
||||
*
|
||||
* @param[in] cstr_info codestream information
|
||||
* @return number of maximum tile parts per tile
|
||||
*/
|
||||
int get_num_max_tile_parts( opj_codestream_info_t cstr_info);
|
||||
|
||||
int write_tpixfaix( int coff, int compno, opj_codestream_info_t cstr_info, int j2klen, opj_cio_t *cio)
|
||||
{
|
||||
int len, lenp;
|
||||
int i, j;
|
||||
int Aux;
|
||||
int num_max_tile_parts;
|
||||
int size_of_coding; /* 4 or 8 */
|
||||
opj_tp_info_t tp;
|
||||
int version;
|
||||
|
||||
num_max_tile_parts = get_num_max_tile_parts( cstr_info);
|
||||
|
||||
if( j2klen > pow( 2.0, 32)){
|
||||
size_of_coding = 8;
|
||||
version = num_max_tile_parts == 1 ? 1:3;
|
||||
}
|
||||
else{
|
||||
size_of_coding = 4;
|
||||
version = num_max_tile_parts == 1 ? 0:2;
|
||||
}
|
||||
|
||||
lenp = cio_tell( cio);
|
||||
cio_skip( cio, 4); /* L [at the end] */
|
||||
cio_write( cio, JPIP_FAIX, 4); /* FAIX */
|
||||
cio_write( cio, version, 1); /* Version 0 = 4 bytes */
|
||||
|
||||
cio_write( cio, num_max_tile_parts, size_of_coding); /* NMAX */
|
||||
cio_write( cio, cstr_info.tw*cstr_info.th, size_of_coding); /* M */
|
||||
for (i = 0; i < cstr_info.tw*cstr_info.th; i++){
|
||||
for (j = 0; j < cstr_info.tile[i].num_tps; j++){
|
||||
tp = cstr_info.tile[i].tp[j];
|
||||
cio_write( cio, tp.tp_start_pos-coff, size_of_coding); /* start position */
|
||||
cio_write( cio, tp.tp_end_pos-tp.tp_start_pos+1, size_of_coding); /* length */
|
||||
if (version & 0x02){
|
||||
if( cstr_info.tile[i].num_tps == 1 && cstr_info.numdecompos[compno] > 1)
|
||||
Aux = cstr_info.numdecompos[compno] + 1;
|
||||
else
|
||||
Aux = j + 1;
|
||||
|
||||
cio_write( cio, Aux,4);
|
||||
/*cio_write(img.tile[i].tile_parts[j].num_reso_AUX,4);*/ /* Aux_i,j : Auxiliary value */
|
||||
/* fprintf(stderr,"AUX value %d\n",Aux);*/
|
||||
}
|
||||
/*cio_write(0,4);*/
|
||||
}
|
||||
/* PADDING */
|
||||
while (j < num_max_tile_parts){
|
||||
cio_write( cio, 0, size_of_coding); /* start position */
|
||||
cio_write( cio, 0, size_of_coding); /* length */
|
||||
if (version & 0x02)
|
||||
cio_write( cio, 0,4); /* Aux_i,j : Auxiliary value */
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
len = cio_tell( cio)-lenp;
|
||||
cio_seek( cio, lenp);
|
||||
cio_write( cio, len, 4); /* L */
|
||||
cio_seek( cio, lenp+len);
|
||||
|
||||
return len;
|
||||
|
||||
}
|
||||
|
||||
int get_num_max_tile_parts( opj_codestream_info_t cstr_info)
|
||||
{
|
||||
int num_max_tp = 0, i;
|
||||
|
||||
for( i=0; i<cstr_info.tw*cstr_info.th; i++)
|
||||
num_max_tp = MAX( cstr_info.tile[i].num_tps, num_max_tp);
|
||||
|
||||
return num_max_tp;
|
||||
}
|
||||
89
indra/llappearance/CMakeLists.txt
Normal file
89
indra/llappearance/CMakeLists.txt
Normal file
@@ -0,0 +1,89 @@
|
||||
# -*- 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}
|
||||
${LLCOMMON_LIBRARIES}
|
||||
)
|
||||
2020
indra/llappearance/llavatarappearance.cpp
Normal file
2020
indra/llappearance/llavatarappearance.cpp
Normal file
File diff suppressed because it is too large
Load Diff
452
indra/llappearance/llavatarappearance.h
Normal file
452
indra/llappearance/llavatarappearance.h
Normal file
@@ -0,0 +1,452 @@
|
||||
/**
|
||||
* @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();
|
||||
LLPolyMesh* getMesh( LLPolyMeshSharedData *shared_data );
|
||||
|
||||
typedef std::map<S32, std::string> lod_mesh_map_t;
|
||||
typedef std::map<std::string, lod_mesh_map_t> mesh_info_t;
|
||||
static void getMeshInfo(mesh_info_t* mesh_info);
|
||||
|
||||
/** 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; }
|
||||
|
||||
virtual std::string getFullname() const = 0;
|
||||
/** 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;
|
||||
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,51 +1,43 @@
|
||||
/**
|
||||
* @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=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2001-2009, Linden Research, Inc.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
* 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.
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
* 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.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* 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 "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.
|
||||
* If these are changed, they MUST be changed in floater_avatar_textures.xml as well!
|
||||
*/
|
||||
|
||||
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));
|
||||
@@ -73,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,
|
||||
@@ -117,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++)
|
||||
{
|
||||
@@ -167,11 +159,11 @@ void LLVOAvatarDictionary::createAssociations()
|
||||
|
||||
}
|
||||
|
||||
LLVOAvatarDictionary::TextureEntry::TextureEntry(const std::string &name,
|
||||
bool is_local_texture,
|
||||
EBakedTextureIndex baked_texture_index,
|
||||
const std::string &default_image_name,
|
||||
LLWearableType::EType wearable_type) :
|
||||
LLAvatarAppearanceDictionary::TextureEntry::TextureEntry(const std::string &name,
|
||||
bool is_local_texture,
|
||||
EBakedTextureIndex baked_texture_index,
|
||||
const std::string &default_image_name,
|
||||
LLWearableType::EType wearable_type) :
|
||||
LLDictionaryEntry(name),
|
||||
mIsLocalTexture(is_local_texture),
|
||||
mIsBakedTexture(!is_local_texture),
|
||||
@@ -182,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,
|
||||
@@ -223,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
|
||||
@@ -246,23 +238,31 @@ 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,45 +1,40 @@
|
||||
/**
|
||||
* @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=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2001-2009, Linden Research, Inc.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
* 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.
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
* 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.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* 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 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;
|
||||
@@ -47,10 +42,11 @@ extern const S32 SCRATCH_TEX_HEIGHT;
|
||||
extern const S32 IMPOSTOR_PERIOD;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// texture entry assignment
|
||||
// Enums
|
||||
//--------------------------------------------------------------------
|
||||
enum ETextureIndex
|
||||
{
|
||||
TEX_INVALID = -1,
|
||||
TEX_HEAD_BODYPAINT = 0,
|
||||
TEX_UPPER_SHIRT,
|
||||
TEX_LOWER_PANTS,
|
||||
@@ -59,9 +55,9 @@ enum ETextureIndex
|
||||
TEX_UPPER_BODYPAINT,
|
||||
TEX_LOWER_BODYPAINT,
|
||||
TEX_LOWER_SHOES,
|
||||
TEX_HEAD_BAKED, // Pre-composited
|
||||
TEX_UPPER_BAKED, // Pre-composited
|
||||
TEX_LOWER_BAKED, // Pre-composited
|
||||
TEX_HEAD_BAKED, // Pre-composited
|
||||
TEX_UPPER_BAKED, // Pre-composited
|
||||
TEX_LOWER_BAKED, // Pre-composited
|
||||
TEX_EYES_BAKED, // Pre-composited
|
||||
TEX_LOWER_SOCKS,
|
||||
TEX_UPPER_JACKET,
|
||||
@@ -70,7 +66,7 @@ enum ETextureIndex
|
||||
TEX_UPPER_UNDERSHIRT,
|
||||
TEX_LOWER_UNDERPANTS,
|
||||
TEX_SKIRT,
|
||||
TEX_SKIRT_BAKED, // Pre-composited
|
||||
TEX_SKIRT_BAKED, // Pre-composited
|
||||
TEX_HAIR_BAKED, // Pre-composited
|
||||
TEX_LOWER_ALPHA,
|
||||
TEX_UPPER_ALPHA,
|
||||
@@ -81,7 +77,7 @@ enum ETextureIndex
|
||||
TEX_UPPER_TATTOO,
|
||||
TEX_LOWER_TATTOO,
|
||||
TEX_NUM_INDICES
|
||||
};
|
||||
};
|
||||
|
||||
enum EBakedTextureIndex
|
||||
{
|
||||
@@ -117,21 +113,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();
|
||||
|
||||
@@ -141,19 +137,19 @@ private:
|
||||
public:
|
||||
struct TextureEntry : public LLDictionaryEntry
|
||||
{
|
||||
TextureEntry(const std::string &name,
|
||||
bool is_local_texture,
|
||||
EBakedTextureIndex baked_texture_index = BAKED_NUM_INDICES,
|
||||
const std::string &default_image_name = "",
|
||||
TextureEntry(const std::string &name, // this must match the xml name used by LLTexLayerInfo::parseXml
|
||||
bool is_local_texture,
|
||||
EBakedTextureIndex baked_texture_index = BAKED_NUM_INDICES,
|
||||
const std::string& default_image_name = "",
|
||||
LLWearableType::EType wearable_type = LLWearableType::WT_INVALID);
|
||||
const std::string mDefaultImageName;
|
||||
const std::string mDefaultImageName;
|
||||
const LLWearableType::EType mWearableType;
|
||||
// It's either a local texture xor baked
|
||||
BOOL mIsLocalTexture;
|
||||
BOOL mIsBakedTexture;
|
||||
BOOL mIsLocalTexture;
|
||||
BOOL mIsBakedTexture;
|
||||
// If it's a local texture, it may be used by a baked texture
|
||||
BOOL mIsUsedByBakedTexture;
|
||||
EBakedTextureIndex mBakedTextureIndex;
|
||||
BOOL mIsUsedByBakedTexture;
|
||||
EBakedTextureIndex mBakedTextureIndex;
|
||||
};
|
||||
|
||||
struct Textures : public LLDictionary<ETextureIndex, TextureEntry>
|
||||
@@ -170,22 +166,22 @@ public:
|
||||
struct MeshEntry : public LLDictionaryEntry
|
||||
{
|
||||
MeshEntry(EBakedTextureIndex baked_index,
|
||||
const std::string &name,
|
||||
U8 level,
|
||||
LLViewerJoint::PickName pick);
|
||||
const std::string &name, // names of mesh types as they are used in avatar_lad.xml
|
||||
U8 level,
|
||||
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 U8 mLOD;
|
||||
const EBakedTextureIndex mBakedID;
|
||||
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
|
||||
@@ -204,7 +200,7 @@ public:
|
||||
const LLUUID mWearablesHashID;
|
||||
wearables_vec_t mWearables;
|
||||
};
|
||||
|
||||
|
||||
struct BakedTextures: public LLDictionary<EBakedTextureIndex, BakedEntry>
|
||||
{
|
||||
BakedTextures();
|
||||
@@ -221,14 +217,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
|
||||
#endif //LL_AVATARAPPEARANCE_DEFINES_H
|
||||
326
indra/llappearance/llavatarjoint.cpp
Normal file
326
indra/llappearance/llavatarjoint.cpp
Normal file
@@ -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
|
||||
140
indra/llappearance/llavatarjoint.h
Normal file
140
indra/llappearance/llavatarjoint.h
Normal file
@@ -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
|
||||
|
||||
|
||||
375
indra/llappearance/llavatarjointmesh.cpp
Normal file
375
indra/llappearance/llavatarjointmesh.cpp
Normal file
@@ -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
|
||||
142
indra/llappearance/llavatarjointmesh.h
Normal file
142
indra/llappearance/llavatarjointmesh.h
Normal file
@@ -0,0 +1,142 @@
|
||||
/**
|
||||
* @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);
|
||||
|
||||
// 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,49 +176,22 @@ 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;
|
||||
}
|
||||
|
||||
@@ -456,6 +428,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 >= (S32)mDriven.size())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return mDriven[index].mParam;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// setAnimationTarget()
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -511,6 +497,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 +542,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 +610,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,25 +71,39 @@ public:
|
||||
protected:
|
||||
typedef std::deque<LLDrivenEntryInfo> entry_info_list_t;
|
||||
entry_info_list_t mDrivenInfoList;
|
||||
LLDriverParam* mDriverParam; // backpointer
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class LLDriverParam : public LLViewerVisualParam
|
||||
{
|
||||
friend class LLPhysicsMotion; // physics motion needs to access driven params directly.
|
||||
friend class LLPhysicsMotion;
|
||||
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)
|
||||
{
|
||||
return ll_aligned_malloc_16(size);
|
||||
}
|
||||
|
||||
void operator delete(void* ptr)
|
||||
{
|
||||
ll_aligned_free_16(ptr);
|
||||
}
|
||||
|
||||
// Special: These functions are overridden by child classes
|
||||
LLDriverParamInfo* getInfo() const { return (LLDriverParamInfo*)mInfo; }
|
||||
// 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;
|
||||
@@ -111,6 +125,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);
|
||||
@@ -121,7 +138,7 @@ protected:
|
||||
entry_list_t mDriven;
|
||||
LLViewerVisualParam* mCurrentDistortionParam;
|
||||
// Backlink only; don't make this an LLPointer.
|
||||
LLVOAvatar* mAvatarp;
|
||||
LLAvatarAppearance* mAvatarAppearance;
|
||||
LLWearable* mWearablep;
|
||||
};
|
||||
|
||||
49
indra/llappearance/lljointpickname.h
Normal file
49
indra/llappearance/lljointpickname.h
Normal file
@@ -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 "llwearable.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);
|
||||
@@ -125,28 +124,28 @@ void LLPolyMeshSharedData::setupLOD(LLPolyMeshSharedData* reference_data)
|
||||
//-----------------------------------------------------------------------------
|
||||
void LLPolyMeshSharedData::freeMeshData()
|
||||
{
|
||||
if (!mReferenceData)
|
||||
{
|
||||
mNumVertices = 0;
|
||||
if (!mReferenceData)
|
||||
{
|
||||
mNumVertices = 0;
|
||||
|
||||
delete [] mBaseCoords;
|
||||
mBaseCoords = NULL;
|
||||
ll_aligned_free_16(mBaseCoords);
|
||||
mBaseCoords = NULL;
|
||||
|
||||
delete [] mBaseNormals;
|
||||
mBaseNormals = NULL;
|
||||
ll_aligned_free_16(mBaseNormals);
|
||||
mBaseNormals = NULL;
|
||||
|
||||
delete [] mBaseBinormals;
|
||||
mBaseBinormals = NULL;
|
||||
ll_aligned_free_16(mBaseBinormals);
|
||||
mBaseBinormals = NULL;
|
||||
|
||||
delete [] mTexCoords;
|
||||
mTexCoords = NULL;
|
||||
ll_aligned_free_16(mTexCoords);
|
||||
mTexCoords = NULL;
|
||||
|
||||
delete [] mDetailTexCoords;
|
||||
mDetailTexCoords = NULL;
|
||||
ll_aligned_free_16(mDetailTexCoords);
|
||||
mDetailTexCoords = NULL;
|
||||
|
||||
delete [] mWeights;
|
||||
mWeights = NULL;
|
||||
}
|
||||
ll_aligned_free_16(mWeights);
|
||||
mWeights = NULL;
|
||||
}
|
||||
|
||||
mNumFaces = 0;
|
||||
delete [] mFaces;
|
||||
@@ -228,14 +227,14 @@ U32 LLPolyMeshSharedData::getNumKB()
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL LLPolyMeshSharedData::allocateVertexData( U32 numVertices )
|
||||
{
|
||||
U32 i;
|
||||
mBaseCoords = new LLVector4a[ numVertices ];
|
||||
mBaseNormals = new LLVector4a[ numVertices ];
|
||||
mBaseBinormals = new LLVector4a[ numVertices ];
|
||||
mTexCoords = new LLVector2[ numVertices ];
|
||||
mDetailTexCoords = new LLVector2[ numVertices ];
|
||||
mWeights = new F32[ numVertices ];
|
||||
for (i = 0; i < numVertices; i++)
|
||||
U32 i;
|
||||
mBaseCoords = (LLVector4a*) ll_aligned_malloc_16(numVertices*sizeof(LLVector4a));
|
||||
mBaseNormals = (LLVector4a*) ll_aligned_malloc_16(numVertices*sizeof(LLVector4a));
|
||||
mBaseBinormals = (LLVector4a*) ll_aligned_malloc_16(numVertices*sizeof(LLVector4a));
|
||||
mTexCoords = (LLVector2*) ll_aligned_malloc_16(numVertices*sizeof(LLVector2));
|
||||
mDetailTexCoords = (LLVector2*) ll_aligned_malloc_16(numVertices*sizeof(LLVector2));
|
||||
mWeights = (F32*) ll_aligned_malloc_16(numVertices*sizeof(F32));
|
||||
for (i = 0; i < numVertices; i++)
|
||||
{
|
||||
mBaseCoords[i].clear();
|
||||
mBaseNormals[i].clear();
|
||||
@@ -1492,7 +1491,7 @@ BOOL LLPolyMesh::setSharedFromCurrent()
|
||||
std::vector< LLCharacter* >::iterator avatar_it;
|
||||
for(avatar_it = LLCharacter::sInstances.begin(); avatar_it != LLCharacter::sInstances.end(); ++avatar_it)
|
||||
{
|
||||
LLVOAvatar* avatarp = (LLVOAvatar*)*avatar_it;
|
||||
LLAvatarAppearance* avatarp = (LLAvatarAppearance*)*avatar_it;
|
||||
LLPolyMesh* mesh = avatarp->getMesh(mSharedData);
|
||||
if (mesh)
|
||||
{
|
||||
@@ -1770,250 +1769,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.
|
||||
@@ -340,8 +340,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;
|
||||
|
||||
@@ -384,77 +384,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
|
||||
//-----------------------------------------------------------------------------
|
||||
class LLPolySkeletalDistortion : public LLViewerVisualParam
|
||||
{
|
||||
public:
|
||||
LLPolySkeletalDistortion(LLVOAvatar *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:
|
||||
typedef std::map<LLJoint*, LLVector3> joint_vec_map_t;
|
||||
joint_vec_map_t mJointScales;
|
||||
joint_vec_map_t mJointOffsets;
|
||||
LLVector4a mDefaultVec;
|
||||
// Backlink only; don't make this an LLPointer.
|
||||
LLVOAvatar *mAvatar;
|
||||
};
|
||||
|
||||
#endif // LL_LLPOLYMESH_H
|
||||
#endif // LL_LLPOLYMESHINTERFACE_H
|
||||
|
||||
@@ -27,13 +27,15 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Header Files
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
|
||||
#include "llpolymorph.h"
|
||||
#include "llvoavatar.h"
|
||||
#include "llwearable.h"
|
||||
#include "llavatarappearance.h"
|
||||
#include "llavatarjoint.h"
|
||||
//#include "llwearable.h"
|
||||
#include "llxmltree.h"
|
||||
#include "llendianswizzle.h"
|
||||
#include "llpolymesh.h"
|
||||
#include "v2math.h"
|
||||
|
||||
//#include "../tools/imdebug/imdebug.h"
|
||||
|
||||
@@ -74,9 +76,9 @@ LLPolyMorphData::LLPolyMorphData(const LLPolyMorphData &rhs) :
|
||||
{
|
||||
const S32 numVertices = mNumIndices;
|
||||
|
||||
mCoords = new LLVector4a[numVertices];
|
||||
mNormals = new LLVector4a[numVertices];
|
||||
mBinormals = new LLVector4a[numVertices];
|
||||
mCoords = static_cast<LLVector4a*>(ll_aligned_malloc_16(numVertices * sizeof(LLVector4a)));
|
||||
mNormals = static_cast<LLVector4a*>(ll_aligned_malloc_16(numVertices * sizeof(LLVector4a)));
|
||||
mBinormals = static_cast<LLVector4a*>(ll_aligned_malloc_16(numVertices * sizeof(LLVector4a)));
|
||||
mTexCoords = new LLVector2[numVertices];
|
||||
mVertexIndices = new U32[numVertices];
|
||||
|
||||
@@ -90,17 +92,12 @@ LLPolyMorphData::LLPolyMorphData(const LLPolyMorphData &rhs) :
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// ~LLPolyMorphData()
|
||||
//-----------------------------------------------------------------------------
|
||||
LLPolyMorphData::~LLPolyMorphData()
|
||||
{
|
||||
delete [] mVertexIndices;
|
||||
delete [] mCoords;
|
||||
delete [] mNormals;
|
||||
delete [] mBinormals;
|
||||
delete [] mTexCoords;
|
||||
freeData();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -119,12 +116,17 @@ BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// free any existing data
|
||||
//-------------------------------------------------------------------------
|
||||
freeData();
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// allocate vertices
|
||||
//-------------------------------------------------------------------------
|
||||
mCoords = new LLVector4a[numVertices];
|
||||
mNormals = new LLVector4a[numVertices];
|
||||
mBinormals = new LLVector4a[numVertices];
|
||||
mCoords = static_cast<LLVector4a*>(ll_aligned_malloc_16(numVertices * sizeof(LLVector4a)));
|
||||
mNormals = static_cast<LLVector4a*>(ll_aligned_malloc_16(numVertices * sizeof(LLVector4a)));
|
||||
mBinormals = static_cast<LLVector4a*>(ll_aligned_malloc_16(numVertices * sizeof(LLVector4a)));
|
||||
mTexCoords = new LLVector2[numVertices];
|
||||
// Actually, we are allocating more space than we need for the skiplist
|
||||
mVertexIndices = new U32[numVertices];
|
||||
@@ -207,6 +209,42 @@ BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// freeData()
|
||||
//-----------------------------------------------------------------------------
|
||||
void LLPolyMorphData::freeData()
|
||||
{
|
||||
if (mCoords != NULL)
|
||||
{
|
||||
ll_aligned_free_16(mCoords);
|
||||
mCoords = NULL;
|
||||
}
|
||||
|
||||
if (mNormals != NULL)
|
||||
{
|
||||
ll_aligned_free_16(mNormals);
|
||||
mNormals = NULL;
|
||||
}
|
||||
|
||||
if (mBinormals != NULL)
|
||||
{
|
||||
ll_aligned_free_16(mBinormals);
|
||||
mBinormals = NULL;
|
||||
}
|
||||
|
||||
if (mTexCoords != NULL)
|
||||
{
|
||||
delete [] mTexCoords;
|
||||
mTexCoords = NULL;
|
||||
}
|
||||
|
||||
if (mVertexIndices != NULL)
|
||||
{
|
||||
delete [] mVertexIndices;
|
||||
mVertexIndices = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLPolyMesh::saveLLM()
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -354,9 +392,9 @@ BOOL LLPolyMorphData::setMorphFromMesh(LLPolyMesh *morph)
|
||||
if (num_significant == 0)
|
||||
nindices = 1;
|
||||
|
||||
LLVector4a* new_coords = new LLVector4a[nindices];
|
||||
LLVector4a* new_normals = new LLVector4a[nindices];
|
||||
LLVector4a* new_binormals = new LLVector4a[nindices];
|
||||
LLVector4a* new_coords = static_cast<LLVector4a*>(ll_aligned_malloc_16(nindices * sizeof(LLVector4a)));
|
||||
LLVector4a* new_normals = static_cast<LLVector4a*>(ll_aligned_malloc_16(nindices * sizeof(LLVector4a)));
|
||||
LLVector4a* new_binormals = static_cast<LLVector4a*>(ll_aligned_malloc_16(nindices * sizeof(LLVector4a)));
|
||||
LLVector2* new_tex_coords = new LLVector2[nindices];
|
||||
U32* new_vertex_indices = new U32[nindices];
|
||||
|
||||
@@ -426,7 +464,7 @@ BOOL LLPolyMorphData::setMorphFromMesh(LLPolyMesh *morph)
|
||||
std::vector< LLCharacter* >::iterator avatar_it;
|
||||
for(avatar_it = LLCharacter::sInstances.begin(); avatar_it != LLCharacter::sInstances.end(); ++avatar_it)
|
||||
{
|
||||
LLVOAvatar* avatarp = (LLVOAvatar*)*avatar_it;
|
||||
LLAvatarAppearance* avatarp = (LLAvatarAppearance*)*avatar_it;
|
||||
|
||||
LLPolyMorphTarget* param = (LLPolyMorphTarget*) avatarp->getVisualParam(mName.c_str());
|
||||
if (!param)
|
||||
@@ -490,11 +528,7 @@ BOOL LLPolyMorphData::setMorphFromMesh(LLPolyMesh *morph)
|
||||
//-------------------------------------------------------------------------
|
||||
// reallocate vertices
|
||||
//-------------------------------------------------------------------------
|
||||
delete [] mVertexIndices;
|
||||
delete [] mCoords;
|
||||
delete [] mNormals;
|
||||
delete [] mBinormals;
|
||||
delete [] mTexCoords;
|
||||
freeData();
|
||||
|
||||
mVertexIndices = new_vertex_indices;
|
||||
mCoords = new_coords;
|
||||
@@ -601,7 +635,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++)
|
||||
{
|
||||
@@ -2,31 +2,25 @@
|
||||
* @file llpolymorph.h
|
||||
* @brief Implementation of LLPolyMesh class
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2001-2009, Linden Research, Inc.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
* 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.
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
* 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.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* 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$
|
||||
*/
|
||||
|
||||
@@ -38,10 +32,10 @@
|
||||
|
||||
#include "llviewervisualparam.h"
|
||||
|
||||
class LLAvatarJointCollisionVolume;
|
||||
class LLPolyMeshSharedData;
|
||||
class LLVOAvatar;
|
||||
class LLVector2;
|
||||
class LLViewerJointCollisionVolume;
|
||||
class LLAvatarJointCollisionVolume;
|
||||
class LLWearable;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -54,6 +48,16 @@ public:
|
||||
~LLPolyMorphData();
|
||||
LLPolyMorphData(const LLPolyMorphData &rhs);
|
||||
|
||||
void* operator new(size_t size)
|
||||
{
|
||||
return ll_aligned_malloc_16(size);
|
||||
}
|
||||
|
||||
void operator delete(void* ptr)
|
||||
{
|
||||
ll_aligned_free_16(ptr);
|
||||
}
|
||||
|
||||
BOOL loadBinary(LLFILE* fp, LLPolyMeshSharedData *mesh);
|
||||
const std::string& getName() { return mName; }
|
||||
|
||||
@@ -77,6 +81,9 @@ public:
|
||||
F32 mMaxDistortion; // maximum single vertex distortion in a given morph
|
||||
LLVector4a mAvgDistortion; // average vertex distortion, to infer directionality of the morph
|
||||
LLPolyMeshSharedData* mMesh;
|
||||
|
||||
private:
|
||||
void freeData();
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -114,10 +121,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;
|
||||
};
|
||||
293
indra/llappearance/llpolyskeletaldistortion.cpp
Normal file
293
indra/llappearance/llpolyskeletaldistortion.cpp
Normal file
@@ -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
|
||||
130
indra/llappearance/llpolyskeletaldistortion.h
Normal file
130
indra/llappearance/llpolyskeletaldistortion.h
Normal file
@@ -0,0 +1,130 @@
|
||||
/**
|
||||
* @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;
|
||||
};
|
||||
|
||||
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:
|
||||
typedef std::map<LLJoint*, LLVector3> joint_vec_map_t;
|
||||
joint_vec_map_t mJointScales;
|
||||
joint_vec_map_t mJointOffsets;
|
||||
LLVector4a mDefaultVec;
|
||||
// Backlink only; don't make this an LLPointer.
|
||||
LLAvatarAppearance *mAvatar;
|
||||
};
|
||||
|
||||
#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;
|
||||
@@ -50,7 +51,7 @@ class LLViewerVisualParam;
|
||||
// Interface class to generalize functionality shared by LLTexLayer
|
||||
// and LLTexLayerTemplate.
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
class LLTexLayerInterface
|
||||
class LLTexLayerInterface
|
||||
{
|
||||
public:
|
||||
enum ERenderPass
|
||||
@@ -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
|
||||
};
|
||||
@@ -160,10 +167,11 @@ public:
|
||||
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 "llrender2dutils.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,14 @@ 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())
|
||||
if (mAvatarAppearance->isValid() && mAvatarAppearance->isEditingAppearance())
|
||||
{
|
||||
upload_bake = FALSE;
|
||||
}
|
||||
mAvatar->invalidateComposite(mTexLayer->getTexLayerSet(), upload_bake);
|
||||
mAvatarAppearance->invalidateComposite(mTexLayer->getTexLayerSet(), upload_bake);
|
||||
mTexLayer->invalidateMorphMasks();
|
||||
}
|
||||
}
|
||||
@@ -218,11 +221,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 +233,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 +242,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 +253,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 +295,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 +313,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 +338,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 +408,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 +431,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 +476,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;
|
||||
};
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@@ -62,11 +64,21 @@ class LLTexLayerParamAlpha : public LLTexLayerParam
|
||||
{
|
||||
public:
|
||||
LLTexLayerParamAlpha( LLTexLayerInterface* layer );
|
||||
LLTexLayerParamAlpha( LLVOAvatar* avatar );
|
||||
LLTexLayerParamAlpha( LLAvatarAppearance* appearance );
|
||||
/*virtual*/ ~LLTexLayerParamAlpha();
|
||||
|
||||
/*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable = NULL) const;
|
||||
|
||||
void* operator new(size_t size)
|
||||
{
|
||||
return ll_aligned_malloc_16(size);
|
||||
}
|
||||
|
||||
void operator delete(void* ptr)
|
||||
{
|
||||
ll_aligned_free_16(ptr);
|
||||
}
|
||||
|
||||
// LLVisualParam Virtual functions
|
||||
///*virtual*/ BOOL parseData(LLXmlTreeNode* node);
|
||||
/*virtual*/ void apply( ESex avatar_sex ) {}
|
||||
@@ -89,7 +101,7 @@ public:
|
||||
BOOL getMultiplyBlend() const;
|
||||
|
||||
private:
|
||||
LLPointer<LLViewerTexture> mCachedProcessedTexture;
|
||||
LLPointer<LLGLTexture> mCachedProcessedTexture;
|
||||
LLPointer<LLImageTGA> mStaticImageTGA;
|
||||
LLPointer<LLImageRaw> mStaticImageRaw;
|
||||
BOOL mNeedsCreateTexture;
|
||||
@@ -140,9 +152,19 @@ public:
|
||||
};
|
||||
|
||||
LLTexLayerParamColor( LLTexLayerInterface* layer );
|
||||
LLTexLayerParamColor( LLVOAvatar* avatar );
|
||||
LLTexLayerParamColor( LLAvatarAppearance* appearance );
|
||||
/* virtual */ ~LLTexLayerParamColor();
|
||||
|
||||
void* operator new(size_t size)
|
||||
{
|
||||
return ll_aligned_malloc_16(size);
|
||||
}
|
||||
|
||||
void operator delete(void* ptr)
|
||||
{
|
||||
ll_aligned_free_16(ptr);
|
||||
}
|
||||
|
||||
/*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable = NULL) const;
|
||||
|
||||
// LLVisualParam Virtual functions
|
||||
33
indra/llappearance/lltexturemanagerbridge.cpp
Normal file
33
indra/llappearance/lltexturemanagerbridge.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* @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 "linden_common.h"
|
||||
#include "lltexturemanagerbridge.h"
|
||||
|
||||
// Define a null texture manager bridge. Applications must provide their own bridge implementaton.
|
||||
LLTextureManagerBridge* gTextureManagerBridgep = NULL;
|
||||
|
||||
|
||||
47
indra/llappearance/lltexturemanagerbridge.h
Normal file
47
indra/llappearance/lltexturemanagerbridge.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* @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 ~LLTextureManagerBridge(){};
|
||||
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
|
||||
|
||||
@@ -2,42 +2,35 @@
|
||||
* @file llviewervisualparam.cpp
|
||||
* @brief Implementation of LLViewerVisualParam class
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2001-2009, Linden Research, Inc.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
* 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.
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
* 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.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* 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 "llviewerprecompiledheaders.h"
|
||||
#include "linden_common.h"
|
||||
|
||||
#include "llviewervisualparam.h"
|
||||
#include "llxmltree.h"
|
||||
#include "llui.h"
|
||||
#include "llwearable.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
820
indra/llappearance/llwearable.cpp
Normal file
820
indra/llappearance/llwearable.cpp
Normal file
@@ -0,0 +1,820 @@
|
||||
/**
|
||||
* @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);
|
||||
|
||||
LLWearable::LLWearable() :
|
||||
mDefinitionVersion(0),
|
||||
mType(LLWearableType::WT_INVALID)
|
||||
{
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
// reX: new function
|
||||
BOOL LLWearable::FileExportParams( FILE* file ) const
|
||||
{
|
||||
// wearable type
|
||||
S32 type = (S32)mType;
|
||||
fprintf( file, "type %d\n", type );
|
||||
|
||||
// parameters
|
||||
S32 num_parameters = mVisualParamIndexMap.size();
|
||||
fprintf( file, "parameters %d\n", num_parameters );
|
||||
|
||||
for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin();
|
||||
iter != mVisualParamIndexMap.end(); ++iter)
|
||||
{
|
||||
S32 param_id = iter->first;
|
||||
F32 param_weight = iter->second->getWeight();
|
||||
fprintf( file, "%d %s\n", param_id, terse_F32_to_string(param_weight).c_str() );
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// reX: new function
|
||||
BOOL LLWearable::FileExportTextures( FILE* file ) const
|
||||
{
|
||||
// wearable type
|
||||
S32 type = (S32)mType;
|
||||
fprintf( file, "type %d\n", type );
|
||||
|
||||
// texture entries
|
||||
S32 num_textures = mTEMap.size();
|
||||
fprintf( file, "textures %d\n", num_textures );
|
||||
|
||||
for (te_map_t::const_iterator iter = mTEMap.begin();
|
||||
iter != mTEMap.end(); ++iter)
|
||||
{
|
||||
S32 te = iter->first;
|
||||
fprintf( file, "%d %s\n", te, iter->second->getID().asString().c_str() );
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
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.exportStream( output_stream ) )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// sale info
|
||||
if( !mSaleInfo.exportStream( 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[2048]; /* 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 (!input_stream.good())
|
||||
{
|
||||
llwarns << "Failed to read wearable asset input stream." << llendl;
|
||||
return LLWearable::FAILURE;
|
||||
}
|
||||
input_stream.getline(buffer, PARSE_BUFFER_SIZE);
|
||||
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
|
||||
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
|
||||
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
|
||||
if (!input_stream.good())
|
||||
{
|
||||
llwarns << "Bad Wearable asset: early end of input stream "
|
||||
<< "while reading permissions" << llendl;
|
||||
return LLWearable::FAILURE;
|
||||
}
|
||||
input_stream.getline(buffer, PARSE_BUFFER_SIZE);
|
||||
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.importStream( input_stream ) )
|
||||
{
|
||||
return LLWearable::FAILURE;
|
||||
}
|
||||
|
||||
// sale info
|
||||
if (!input_stream.good())
|
||||
{
|
||||
llwarns << "Bad Wearable asset: early end of input stream "
|
||||
<< "while reading sale info" << llendl;
|
||||
return LLWearable::FAILURE;
|
||||
}
|
||||
input_stream.getline(buffer, PARSE_BUFFER_SIZE);
|
||||
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.importStream(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 (!input_stream.good())
|
||||
{
|
||||
llwarns << "Bad Wearable asset: early end of input stream "
|
||||
<< "while reading type" << llendl;
|
||||
return LLWearable::FAILURE;
|
||||
}
|
||||
input_stream.getline(buffer, PARSE_BUFFER_SIZE);
|
||||
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 (!input_stream.good())
|
||||
{
|
||||
llwarns << "Bad Wearable asset: early end of input stream "
|
||||
<< "while reading parameters header" << llendl;
|
||||
return LLWearable::FAILURE;
|
||||
}
|
||||
input_stream.getline(buffer, PARSE_BUFFER_SIZE);
|
||||
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 (!input_stream.good())
|
||||
{
|
||||
llwarns << "Bad Wearable asset: early end of input stream "
|
||||
<< "while reading parameter #" << i << llendl;
|
||||
return LLWearable::FAILURE;
|
||||
}
|
||||
input_stream.getline(buffer, PARSE_BUFFER_SIZE);
|
||||
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 (!input_stream.good())
|
||||
{
|
||||
llwarns << "Bad Wearable asset: early end of input stream "
|
||||
<< "while reading textures header" << i << llendl;
|
||||
return LLWearable::FAILURE;
|
||||
}
|
||||
input_stream.getline(buffer, PARSE_BUFFER_SIZE);
|
||||
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 (!input_stream.good())
|
||||
{
|
||||
llwarns << "Bad Wearable asset: early end of input stream "
|
||||
<< "while reading textures #" << i << llendl;
|
||||
return LLWearable::FAILURE;
|
||||
}
|
||||
input_stream.getline(buffer, PARSE_BUFFER_SIZE);
|
||||
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;
|
||||
}
|
||||
|
||||
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,48 +27,35 @@
|
||||
#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:
|
||||
LLWearable();
|
||||
virtual ~LLWearable();
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Accessors
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
const LLUUID& getItemID() const;
|
||||
const LLAssetID& getAssetID() const { return mAssetID; }
|
||||
const LLTransactionID& getTransactionID() const { return mTransactionID; }
|
||||
|
||||
BOOL FileExportParams(FILE* file);
|
||||
BOOL FileExportTextures(FILE* file);
|
||||
|
||||
|
||||
LLWearableType::EType getType() const { return mType; }
|
||||
void setType( LLWearableType::EType type );
|
||||
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; }
|
||||
@@ -82,39 +69,36 @@ 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);
|
||||
|
||||
BOOL FileExportParams(FILE* file) const;
|
||||
BOOL FileExportTextures(FILE* file) const;
|
||||
|
||||
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 const LLUUID getDefaultTextureImageID(LLAvatarAppearanceDefines::ETextureIndex index) const = 0;
|
||||
|
||||
LLLocalTextureObject* getLocalTextureObject(S32 index);
|
||||
const LLLocalTextureObject* getLocalTextureObject(S32 index) const;
|
||||
std::vector<LLLocalTextureObject*> getLocalTextureListSeq();
|
||||
|
||||
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;
|
||||
@@ -124,27 +108,21 @@ 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);
|
||||
|
||||
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.
|
||||
@@ -152,18 +130,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
|
||||
363
indra/llappearance/llwearabledata.cpp
Normal file
363
indra/llappearance/llwearabledata.cpp
Normal file
@@ -0,0 +1,363 @@
|
||||
/**
|
||||
* @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)
|
||||
{
|
||||
//llassert_always(index == 0);
|
||||
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)
|
||||
{
|
||||
//llassert_always(index == 0);
|
||||
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)
|
||||
{
|
||||
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);
|
||||
// wearableUpdated(wearable);
|
||||
// checkWearableAgainstInventory(wearable);
|
||||
// return mWearableDatas[type].size()-1;
|
||||
// }
|
||||
// [RLVa:KB] - Checked: 2010-06-08 (RLVa-1.2.0g) | Added: RLVa-1.2.0g
|
||||
if ( (type < LLWearableType::WT_COUNT) && (mWearableDatas[type].size() < MAX_CLOTHING_PER_TYPE) )
|
||||
{
|
||||
// Don't add the same wearable twice
|
||||
U32 idxWearable = getWearableIndex(wearable);
|
||||
//RLV_ASSERT(MAX_CLOTHING_PER_TYPE == idxWearable); // pushWearable() on an already added wearable is a bug *somewhere*
|
||||
if (MAX_CLOTHING_PER_TYPE == idxWearable)
|
||||
{
|
||||
mWearableDatas[type].push_back(wearable);
|
||||
idxWearable = mWearableDatas[type].size() - 1;
|
||||
}
|
||||
const BOOL removed = FALSE;
|
||||
wearableUpdated(wearable, removed);
|
||||
return idxWearable;
|
||||
// [/RLVa:KB]
|
||||
}
|
||||
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)
|
||||
{
|
||||
//llassert_always(index == 0);
|
||||
LLWearable *wearable = getWearable(type, index);
|
||||
if (wearable)
|
||||
{
|
||||
mWearableDatas[type].erase(mWearableDatas[type].begin() + index);
|
||||
const BOOL removed = TRUE;
|
||||
wearableUpdated(wearable, removed);
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
//llassert_always(index == 0);
|
||||
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;
|
||||
}
|
||||
106
indra/llappearance/llwearabledata.h
Normal file
106
indra/llappearance/llwearabledata.h
Normal file
@@ -0,0 +1,106 @@
|
||||
/**
|
||||
* @file llwearabledata.h
|
||||
* @brief LLWearableData class header file
|
||||
*
|
||||
* $LicenseInfo:firstyear=20012license=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);
|
||||
virtual void wearableUpdated(LLWearable *wearable, BOOL removed) = 0;
|
||||
void popWearable(LLWearable *wearable);
|
||||
void popWearable(const LLWearableType::EType type, U32 index);
|
||||
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 = 0;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// 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,24 +24,36 @@
|
||||
* $/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),
|
||||
//*TODO:Translate
|
||||
mLabel(/*LLTrans::getString*/(name)),
|
||||
mLabel(/*sTrans->getString*/(name)),
|
||||
mIconName(iconName),
|
||||
mDisableCameraSwitch(disable_camera_switch),
|
||||
mAllowMultiwear(allow_multiwear)
|
||||
@@ -51,7 +63,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;
|
||||
};
|
||||
@@ -71,26 +83,26 @@ protected:
|
||||
|
||||
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
|
||||
@@ -138,7 +150,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,17 @@
|
||||
|
||||
#include "llassettype.h"
|
||||
#include "lldictionary.h"
|
||||
#include "llinventoryicon.h"
|
||||
#include "llinventorytype.h"
|
||||
#include "llsingleton.h"
|
||||
|
||||
class LLTranslationBridge
|
||||
{
|
||||
public:
|
||||
virtual ~LLTranslationBridge(){};
|
||||
virtual std::string getString(const std::string &xml_desc) = 0;
|
||||
};
|
||||
|
||||
|
||||
class LLWearableType
|
||||
{
|
||||
public:
|
||||
@@ -59,12 +67,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);
|
||||
|
||||
@@ -1,31 +1,25 @@
|
||||
/**
|
||||
* @file llaudiodecodemgr.h
|
||||
*
|
||||
* $LicenseInfo:firstyear=2003&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2003-2009, Linden Research, Inc.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
* 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.
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
* 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.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* 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$
|
||||
*/
|
||||
|
||||
|
||||
@@ -3,31 +3,25 @@
|
||||
* @brief implementation of LLAudioEngine class abstracting the Open
|
||||
* AL audio support
|
||||
*
|
||||
* $LicenseInfo:firstyear=2000&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2000-2009, Linden Research, Inc.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
* 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.
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
* 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.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* 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$
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,31 +2,25 @@
|
||||
* @file audioengine.h
|
||||
* @brief Definition of LLAudioEngine base class abstracting the audio support
|
||||
*
|
||||
* $LicenseInfo:firstyear=2000&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2000-2009, Linden Research, Inc.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
* 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.
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
* 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.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* 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$
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,31 +2,25 @@
|
||||
* @file audioengine_fmod.cpp
|
||||
* @brief Implementation of LLAudioEngine class abstracting the audio support as a FMOD 3D implementation
|
||||
*
|
||||
* $LicenseInfo:firstyear=2002&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2002-2009, Linden Research, Inc.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
* 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.
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
* 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.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* 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$
|
||||
*/
|
||||
|
||||
|
||||
@@ -3,31 +3,25 @@
|
||||
* @brief Definition of LLAudioEngine class abstracting the audio
|
||||
* support as a FMOD 3D implementation
|
||||
*
|
||||
* $LicenseInfo:firstyear=2002&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2002-2009, Linden Research, Inc.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
* 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.
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
* 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.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* 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$
|
||||
*/
|
||||
|
||||
@@ -65,7 +59,7 @@ public:
|
||||
#else
|
||||
typedef S16 MIXBUFFERFORMAT;
|
||||
#endif
|
||||
|
||||
|
||||
protected:
|
||||
/*virtual*/ LLAudioBuffer *createBuffer(); // Get a free buffer, or flush an existing one if you have to.
|
||||
/*virtual*/ LLAudioChannel *createChannel(); // Create a new audio channel.
|
||||
|
||||
@@ -2,31 +2,25 @@
|
||||
* @file listener.cpp
|
||||
* @brief Implementation of LISTENER class abstracting the audio support
|
||||
*
|
||||
* $LicenseInfo:firstyear=2000&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2000-2009, Linden Research, Inc.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
* 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.
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
* 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.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* 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$
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,31 +2,25 @@
|
||||
* @file listener.h
|
||||
* @brief Description of LISTENER base class abstracting the audio support.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2000&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2000-2009, Linden Research, Inc.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
* 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.
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
* 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.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* 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$
|
||||
*/
|
||||
|
||||
|
||||
@@ -3,31 +3,25 @@
|
||||
* @brief Description of LISTENER class abstracting the audio support
|
||||
* as a DirectSound 3D implementation (windows only)
|
||||
*
|
||||
* $LicenseInfo:firstyear=2000&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2000-2009, Linden Research, Inc.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
* 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.
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
* 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.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* 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$
|
||||
*/
|
||||
|
||||
|
||||
@@ -3,31 +3,25 @@
|
||||
* @brief implementation of LISTENER class abstracting the audio
|
||||
* support as a FMOD 3D implementation (windows only)
|
||||
*
|
||||
* $LicenseInfo:firstyear=2002&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2002-2009, Linden Research, Inc.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
* 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.
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
* 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.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* 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$
|
||||
*/
|
||||
|
||||
|
||||
@@ -3,31 +3,25 @@
|
||||
* @brief Description of LISTENER class abstracting the audio support
|
||||
* as an FMOD 3D implementation (windows and Linux)
|
||||
*
|
||||
* $LicenseInfo:firstyear=2002&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2002-2009, Linden Research, Inc.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
* 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.
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
* 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.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* 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$
|
||||
*/
|
||||
|
||||
|
||||
@@ -3,31 +3,25 @@
|
||||
* @brief implementation of audio engine using OpenAL
|
||||
* support as a OpenAL 3D implementation
|
||||
*
|
||||
* $LicenseInfo:firstyear=2002&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2002-2009, Linden Research, Inc.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
* 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.
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
* 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.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* 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$
|
||||
*/
|
||||
|
||||
|
||||
@@ -3,31 +3,25 @@
|
||||
* @brief Description of LISTENER class abstracting the audio support
|
||||
* as an OpenAL implementation
|
||||
*
|
||||
* $LicenseInfo:firstyear=2000&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2000-2009, Linden Research, Inc.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
* 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.
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
* 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.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* 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$
|
||||
*/
|
||||
|
||||
|
||||
@@ -3,31 +3,25 @@
|
||||
* @author Tofu Linden
|
||||
* @brief Definition of LLStreamingAudioInterface base class abstracting the streaming audio interface
|
||||
*
|
||||
* $LicenseInfo:firstyear=2009&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2009, Linden Research, Inc.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
* 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.
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
* 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.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* 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$
|
||||
*/
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user