summaryrefslogtreecommitdiff
path: root/indra/llprimitive
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llprimitive')
-rw-r--r--indra/llprimitive/CMakeLists.txt6
-rw-r--r--indra/llprimitive/lldaeloader.cpp48
-rw-r--r--indra/llprimitive/lldaeloader.h2
-rw-r--r--indra/llprimitive/llgltfmaterial.h1
-rw-r--r--indra/llprimitive/llmodel.cpp16
-rw-r--r--indra/llprimitive/llmodel.h6
-rw-r--r--indra/llprimitive/llmodelloader.cpp27
-rw-r--r--indra/llprimitive/llmodelloader.h41
-rw-r--r--indra/llprimitive/llphysicsextensions/CMakeLists.txt101
-rw-r--r--indra/llprimitive/llphysicsextensions/LLConvexDecompositionStubImpl.cpp143
-rw-r--r--indra/llprimitive/llphysicsextensions/LLConvexDecompositionStubImpl.h92
-rw-r--r--indra/llprimitive/llphysicsextensions/LLPathingLibStubImpl.cpp107
-rw-r--r--indra/llprimitive/llphysicsextensions/LLPathingLibStubImpl.h78
-rw-r--r--indra/llprimitive/llphysicsextensions/LLPhysicsExtensionsStubImpl.cpp49
-rw-r--r--indra/llprimitive/llphysicsextensions/LLPhysicsExtensionsStubImpl.h46
-rw-r--r--indra/llprimitive/llphysicsextensions/llconvexdecomposition.cpp102
-rw-r--r--indra/llprimitive/llphysicsextensions/llconvexdecomposition.h231
-rw-r--r--indra/llprimitive/llphysicsextensions/llpathinglib.cpp110
-rw-r--r--indra/llprimitive/llphysicsextensions/llpathinglib.h187
-rw-r--r--indra/llprimitive/llphysicsextensions/llphysicsextensions.cpp103
-rw-r--r--indra/llprimitive/llphysicsextensions/llphysicsextensions.h59
-rw-r--r--indra/llprimitive/llprimitive.cpp4
-rw-r--r--indra/llprimitive/llprimtexturelist.cpp11
-rw-r--r--indra/llprimitive/llprimtexturelist.h2
24 files changed, 1485 insertions, 87 deletions
diff --git a/indra/llprimitive/CMakeLists.txt b/indra/llprimitive/CMakeLists.txt
index 972f502aa9..dea85f8f4f 100644
--- a/indra/llprimitive/CMakeLists.txt
+++ b/indra/llprimitive/CMakeLists.txt
@@ -74,6 +74,12 @@ target_link_libraries(llprimitive
ll::glh_linear
)
+if (USESYSTEMLIBS)
+ add_subdirectory(llphysicsextensions)
+endif ()
+
+include(LibraryInstall)
+
#add unit tests
if (LL_TESTS)
INCLUDE(LLAddBuildTest)
diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp
index 1480322935..a099a07cbd 100644
--- a/indra/llprimitive/lldaeloader.cpp
+++ b/indra/llprimitive/lldaeloader.cpp
@@ -941,12 +941,20 @@ bool LLDAELoader::OpenFile(const std::string& filename)
domCOLLADA* dom;
if (mPreprocessDAE)
{
+#ifdef LL_USESYSTEMLIBS
+ dom = static_cast<domCOLLADA *>(dae.openFromMemory(uri_filename, preprocessDAE(filename).c_str()));
+#else
dom = dae.openFromMemory(uri_filename, preprocessDAE(filename).c_str());
+#endif
}
else
{
LL_INFOS() << "Skipping dae preprocessing" << LL_ENDL;
+#ifdef LL_USESYSTEMLIBS
+ dom = static_cast<domCOLLADA *>(dae.open(uri_filename));
+#else
dom = dae.open(uri_filename);
+#endif
}
if (!dom)
@@ -1120,19 +1128,17 @@ bool LLDAELoader::OpenFile(const std::string& filename)
if (skin)
{
- domGeometry* geom = daeSafeCast<domGeometry>(skin->getSource().getElement());
-
- if (geom)
+ if (domGeometry* geom = daeSafeCast<domGeometry>(skin->getSource().getElement()))
{
- domMesh* mesh = geom->getMesh();
- if (mesh)
+ if (domMesh* mesh = geom->getMesh())
{
- std::vector< LLPointer< LLModel > >::iterator i = mModelsMap[mesh].begin();
- while (i != mModelsMap[mesh].end())
+ dae_model_map::const_iterator it = mModelsMap.find(mesh);
+ if (it != mModelsMap.end())
{
- LLPointer<LLModel> mdl = *i;
- LLDAELoader::processDomModel(mdl, &dae, root, mesh, skin);
- i++;
+ for (const LLPointer<LLModel>& model : it->second)
+ {
+ LLDAELoader::processDomModel(model, &dae, root, mesh, skin);
+ }
}
}
}
@@ -1302,6 +1308,7 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do
}
}
else
+ {
//Has one or more skeletons
for (std::vector<domInstance_controller::domSkeleton*>::iterator skel_it = skeletons.begin();
skel_it != skeletons.end(); ++skel_it)
@@ -1386,6 +1393,7 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do
}
}//got skeleton?
}
+ }
domSkin::domJoints* joints = skin->getJoints();
@@ -1686,7 +1694,7 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do
materials[model->mMaterialList[i]] = LLImportMaterial();
}
mScene[transformation].push_back(LLModelInstance(model, model->mLabel, transformation, materials));
- stretch_extents(model, transformation, mExtents[0], mExtents[1], mFirstTransform);
+ stretch_extents(model, transformation);
}
}
@@ -2079,21 +2087,14 @@ void LLDAELoader::processElement( daeElement* element, bool& badElement, DAE* da
mTransform.condition();
}
- domInstance_geometry* instance_geo = daeSafeCast<domInstance_geometry>(element);
- if (instance_geo)
+ if (domInstance_geometry* instance_geo = daeSafeCast<domInstance_geometry>(element))
{
- domGeometry* geo = daeSafeCast<domGeometry>(instance_geo->getUrl().getElement());
- if (geo)
+ if (domGeometry* geo = daeSafeCast<domGeometry>(instance_geo->getUrl().getElement()))
{
- domMesh* mesh = daeSafeCast<domMesh>(geo->getDescendant(daeElement::matchType(domMesh::ID())));
- if (mesh)
+ if (domMesh* mesh = daeSafeCast<domMesh>(geo->getDescendant(daeElement::matchType(domMesh::ID()))))
{
-
- std::vector< LLPointer< LLModel > >::iterator i = mModelsMap[mesh].begin();
- while (i != mModelsMap[mesh].end())
+ for (LLModel* model : mModelsMap.find(mesh)->second)
{
- LLModel* model = *i;
-
LLMatrix4 transformation = mTransform;
if (mTransform.determinant() < 0)
@@ -2164,8 +2165,7 @@ void LLDAELoader::processElement( daeElement* element, bool& badElement, DAE* da
}
mScene[transformation].push_back(LLModelInstance(model, label, transformation, materials));
- stretch_extents(model, transformation, mExtents[0], mExtents[1], mFirstTransform);
- i++;
+ stretch_extents(model, transformation);
}
}
}
diff --git a/indra/llprimitive/lldaeloader.h b/indra/llprimitive/lldaeloader.h
index 4531e03474..c6e5ea42fc 100644
--- a/indra/llprimitive/lldaeloader.h
+++ b/indra/llprimitive/lldaeloader.h
@@ -29,6 +29,7 @@
#include "llmodelloader.h"
+#ifndef LL_USESYSTEMLIBS
class DAE;
class daeElement;
class domProfile_COMMON;
@@ -38,6 +39,7 @@ class domTranslate;
class domController;
class domSkin;
class domMesh;
+#endif
class LLDAELoader : public LLModelLoader
{
diff --git a/indra/llprimitive/llgltfmaterial.h b/indra/llprimitive/llgltfmaterial.h
index 10df4c8ee1..b89853c9fd 100644
--- a/indra/llprimitive/llgltfmaterial.h
+++ b/indra/llprimitive/llgltfmaterial.h
@@ -36,6 +36,7 @@
#include <array>
#include <string>
+#include <array>
#include <map>
namespace tinygltf
diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp
index e7152a2291..4a185f8ba9 100644
--- a/indra/llprimitive/llmodel.cpp
+++ b/indra/llprimitive/llmodel.cpp
@@ -91,19 +91,15 @@ std::string LLModel::getStatusString(U32 status)
}
-void LLModel::offsetMesh( const LLVector3& pivotPoint )
+void LLModel::offsetMesh(const LLVector3& pivotPoint)
{
- LLVector4a pivot( pivotPoint[VX], pivotPoint[VY], pivotPoint[VZ] );
+ LLVector4a pivot(pivotPoint[VX], pivotPoint[VY], pivotPoint[VZ]);
- for (std::vector<LLVolumeFace>::iterator faceIt = mVolumeFaces.begin(); faceIt != mVolumeFaces.end(); )
+ for (LLVolumeFace& face : mVolumeFaces)
{
- std::vector<LLVolumeFace>:: iterator currentFaceIt = faceIt++;
- LLVolumeFace& face = *currentFaceIt;
- LLVector4a *pos = (LLVector4a*) face.mPositions;
-
- for (S32 i=0; i<face.mNumVertices; ++i )
+ for (U32 i = 0; i < face.mNumVertices; ++i)
{
- pos[i].add( pivot );
+ face.mPositions[i].add(pivot);
}
}
}
@@ -338,7 +334,7 @@ void LLModel::normalizeVolumeFaces()
}
}
-void LLModel::getNormalizedScaleTranslation(LLVector3& scale_out, LLVector3& translation_out)
+void LLModel::getNormalizedScaleTranslation(LLVector3& scale_out, LLVector3& translation_out) const
{
scale_out = mNormalizedScale;
translation_out = mNormalizedTranslation;
diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h
index b0cba2d655..b9c6c9aa24 100644
--- a/indra/llprimitive/llmodel.h
+++ b/indra/llprimitive/llmodel.h
@@ -35,8 +35,10 @@
#include <boost/align/aligned_allocator.hpp>
+#ifndef LL_USESYSTEMLIBS
class daeElement;
class domMesh;
+#endif
#define MAX_MODEL_FACES 8
@@ -202,8 +204,8 @@ public:
void trimVolumeFacesToSize(U32 new_count = LL_SCULPT_MESH_MAX_FACES, LLVolume::face_list_t* remainder = NULL);
void remapVolumeFaces();
void optimizeVolumeFaces();
- void offsetMesh( const LLVector3& pivotPoint );
- void getNormalizedScaleTranslation(LLVector3& scale_out, LLVector3& translation_out);
+ void offsetMesh(const LLVector3& pivotPoint);
+ void getNormalizedScaleTranslation(LLVector3& scale_out, LLVector3& translation_out) const;
LLVector3 getTransformedCenter(const LLMatrix4& mat);
//reorder face list based on mMaterialList in this and reference so
diff --git a/indra/llprimitive/llmodelloader.cpp b/indra/llprimitive/llmodelloader.cpp
index 9a194567d2..1a64e6227f 100644
--- a/indra/llprimitive/llmodelloader.cpp
+++ b/indra/llprimitive/llmodelloader.cpp
@@ -37,7 +37,7 @@
std::list<LLModelLoader*> LLModelLoader::sActiveLoaderList;
-void stretch_extents(LLModel* model, LLMatrix4a& mat, LLVector4a& min, LLVector4a& max, bool& first_transform)
+static void stretch_extents(const LLModel* model, const LLMatrix4a& mat, LLVector4a& min, LLVector4a& max, bool& first_transform)
{
LLVector4a box[] =
{
@@ -59,7 +59,7 @@ void stretch_extents(LLModel* model, LLMatrix4a& mat, LLVector4a& min, LLVector4
center.setAdd(face.mExtents[0], face.mExtents[1]);
center.mul(0.5f);
LLVector4a size;
- size.setSub(face.mExtents[1],face.mExtents[0]);
+ size.setSub(face.mExtents[1], face.mExtents[0]);
size.mul(0.5f);
for (U32 i = 0; i < 8; i++)
@@ -85,19 +85,19 @@ void stretch_extents(LLModel* model, LLMatrix4a& mat, LLVector4a& min, LLVector4
}
}
-void stretch_extents(LLModel* model, LLMatrix4& mat, LLVector3& min, LLVector3& max, bool& first_transform)
+void LLModelLoader::stretch_extents(const LLModel* model, const LLMatrix4& mat)
{
LLVector4a mina, maxa;
LLMatrix4a mata;
mata.loadu(mat);
- mina.load3(min.mV);
- maxa.load3(max.mV);
+ mina.load3(mExtents[0].mV);
+ maxa.load3(mExtents[1].mV);
- stretch_extents(model, mata, mina, maxa, first_transform);
+ ::stretch_extents(model, mata, mina, maxa, mFirstTransform);
- min.set(mina.getF32ptr());
- max.set(maxa.getF32ptr());
+ mExtents[0].set(mina.getF32ptr());
+ mExtents[1].set(maxa.getF32ptr());
}
//-----------------------------------------------------------------------------
@@ -292,14 +292,7 @@ bool LLModelLoader::loadFromSLM(const std::string& filename)
{
if (idx >= model[lod].size())
{
- if (model[lod].size())
- {
- instance_list[i].mLOD[lod] = model[lod][0];
- }
- else
- {
- instance_list[i].mLOD[lod] = NULL;
- }
+ instance_list[i].mLOD[lod] = model[lod].front();
continue;
}
@@ -342,7 +335,7 @@ bool LLModelLoader::loadFromSLM(const std::string& filename)
{
LLModelInstance& cur_instance = instance_list[i];
mScene[cur_instance.mTransform].push_back(cur_instance);
- stretch_extents(cur_instance.mModel, cur_instance.mTransform, mExtents[0], mExtents[1], mFirstTransform);
+ stretch_extents(cur_instance.mModel, cur_instance.mTransform);
}
setLoadState( DONE );
diff --git a/indra/llprimitive/llmodelloader.h b/indra/llprimitive/llmodelloader.h
index 83bd2f5bbd..637dabe08a 100644
--- a/indra/llprimitive/llmodelloader.h
+++ b/indra/llprimitive/llmodelloader.h
@@ -34,13 +34,13 @@
class LLJoint;
-typedef std::map<std::string, LLMatrix4> JointTransformMap;
-typedef std::map<std::string, LLMatrix4>::iterator JointTransformMapIt;
-typedef std::map<std::string, std::string> JointMap;
-typedef std::deque<std::string> JointNameSet;
+typedef std::map<std::string, LLMatrix4> JointTransformMap;
+typedef std::map<std::string, LLMatrix4>::iterator JointTransformMapIt;
+typedef std::map<std::string, std::string> JointMap;
+typedef std::deque<std::string> JointNameSet;
const S32 SLM_SUPPORTED_VERSION = 3;
-const S32 NUM_LOD = 4;
+const S32 NUM_LOD = 4;
const U32 LEGACY_RIG_OK = 0;
const U32 LEGACY_RIG_FLAG_TOO_MANY_JOINTS = 1;
@@ -50,32 +50,32 @@ class LLModelLoader : public LLThread
{
public:
- typedef std::map<std::string, LLImportMaterial> material_map;
- typedef std::vector<LLPointer<LLModel > > model_list;
- typedef std::vector<LLModelInstance> model_instance_list;
- typedef std::map<LLMatrix4, model_instance_list > scene;
+ typedef std::map<std::string, LLImportMaterial> material_map;
+ typedef std::vector<LLPointer<LLModel>> model_list;
+ typedef std::vector<LLModelInstance> model_instance_list;
+ typedef std::map<LLMatrix4, model_instance_list> scene;
// Callback with loaded model data and loaded LoD
//
- typedef boost::function<void (scene&,model_list&,S32,void*) > load_callback_t;
+ typedef boost::function<void (scene&, model_list&, S32, void*)> load_callback_t;
// Function to provide joint lookup by name
// (within preview avi skeleton, for example)
//
- typedef boost::function<LLJoint* (const std::string&,void*) > joint_lookup_func_t;
+ typedef boost::function<LLJoint* (const std::string&, void*)> joint_lookup_func_t;
// Func to load and associate material with all it's textures,
// returned value is the number of textures loaded
// intentionally non-const so func can modify material to
// store platform-specific data
//
- typedef boost::function<U32 (LLImportMaterial&,void*) > texture_load_func_t;
+ typedef boost::function<U32 (LLImportMaterial&, void*)> texture_load_func_t;
// Callback to inform client of state changes
// during loading process (errors will be reported
// as state changes here as well)
//
- typedef boost::function<void (U32,void*) > state_callback_t;
+ typedef boost::function<void (U32, void*)> state_callback_t;
typedef enum
{
@@ -136,7 +136,7 @@ public:
JointNameSet& jointsFromNodes,
JointMap& legalJointNamesMap,
U32 maxJointsPerMesh);
- virtual ~LLModelLoader() ;
+ virtual ~LLModelLoader();
virtual void setNoNormalize() { mNoNormalize = true; }
virtual void setNoOptimize() { mNoOptimize = true; }
@@ -156,13 +156,13 @@ public:
bool loadFromSLM(const std::string& filename);
void loadModelCallback();
- void loadTextures() ; //called in the main thread.
+ void loadTextures(); // called in the main thread.
void setLoadState(U32 state);
+ void stretch_extents(const LLModel* model, const LLMatrix4& mat);
-
- S32 mNumOfFetchingTextures ; //updated in the main thread
- bool areTexturesReady() { return !mNumOfFetchingTextures; } //called in the main thread.
+ S32 mNumOfFetchingTextures; // updated in the main thread
+ bool areTexturesReady() { return !mNumOfFetchingTextures; } // called in the main thread.
bool verifyCount( int expected, int result );
@@ -212,10 +212,7 @@ protected:
LLSD mWarningsArray; // preview floater will pull logs from here
static std::list<LLModelLoader*> sActiveLoaderList;
- static bool isAlive(LLModelLoader* loader) ;
+ static bool isAlive(LLModelLoader* loader);
};
-class LLMatrix4a;
-void stretch_extents(LLModel* model, LLMatrix4a& mat, LLVector4a& min, LLVector4a& max, bool& first_transform);
-void stretch_extents(LLModel* model, LLMatrix4& mat, LLVector3& min, LLVector3& max, bool& first_transform);
#endif // LL_LLMODELLOADER_H
diff --git a/indra/llprimitive/llphysicsextensions/CMakeLists.txt b/indra/llprimitive/llphysicsextensions/CMakeLists.txt
new file mode 100644
index 0000000000..258cea5dd7
--- /dev/null
+++ b/indra/llprimitive/llphysicsextensions/CMakeLists.txt
@@ -0,0 +1,101 @@
+# -*- cmake -*-
+
+project(llphysicsextensions)
+
+include(00-Common)
+include(Variables)
+include(LLCommon)
+include(LLMath)
+
+set(LLPHYSICSEXTENSIONS_LIB_NAME llphysicsextensions)
+
+if (WINDOWS)
+ set(LLPHYSICSEXTENSIONS_LIBRARIES ${LLPHYSICSEXTENSIONS_LIB_NAME}.lib)
+else (WINDOWS)
+ set(LLPHYSICSEXTENSIONS_LIBRARIES ${LLPHYSICSEXTENSIONS_LIB_NAME}.a)
+endif (WINDOWS)
+
+set(LLPHYSICSEXTENSIONS_INCLUDE_DIR
+ ${CMAKE_CURRENT_SOURCE_DIR})
+
+set(LLPHYSICSEXTENSIONS_DEBUG_LIBRARY_PATH ${LIBS_PREBUILT_DIR}/lib/debug)
+set(LLPHYSICSEXTENSIONS_RELEASE_LIBRARY_PATH ${LIBS_PREBUILT_DIR}/lib/release)
+
+#set(LLPHYSICSEXTENSIONS_LIBRARIES_LIBRARIES
+# debug ${LLPHYSICSEXTENSIONS_DEBUG_LIB}
+# optimized ${LLPHYSICSEXTENTIONS_RELEASE_LIB}
+#)
+
+if (LINUX)
+ list(INSERT LLPHYSICSEXTENSIONS_LIBRARIES 0 -Wl,--start-group)
+ list(APPEND LLPHYSICSEXTENSIONS_LIBRARIES -Wl,--end-group)
+endif (LINUX)
+
+#include_directories(
+# ${CMAKE_SOURCE_DIR}/llphysicsextensions
+# ${LLPHYSICSEXTENSIONS_INCLUDE_DIR}
+# ${LLCOMMON_INCLUDE_DIRS}
+# ${LLMATH_INCLUDE_DIRS}
+# )
+
+set(llphysicsextensions_SOURCE_FILES
+ llpathinglib.cpp
+ LLPathingLibStubImpl.cpp
+ llconvexdecomposition.cpp
+ LLConvexDecompositionStubImpl.cpp
+ llphysicsextensions.cpp
+ LLPhysicsExtensionsStubImpl.cpp
+ )
+
+set(llphysicsextensions_HEADER_FILES
+
+ ${LLPHYSICSEXTENSIONS_INCLUDE_DIR}/llpathinglib.h
+ ${LLPHYSICSEXTENSIONS_INCLUDE_DIR}/llconvexdecomposition.h
+ ${LLPHYSICSEXTENSIONS_INCLUDE_DIR}/llphysicsextensions.h
+ LLPathingLibStubImpl.h
+ LLConvexDecompositionStubImpl.h
+ LLPhysicsExtensionsStubImpl.h
+ )
+
+if (WINDOWS)
+ list(APPEND llphysicsextensions_HEADER_FILES
+ ${LLPHYSICSEXTENSIONS_INCLUDE_DIR}/windowsincludes.h)
+endif (WINDOWS)
+
+set_source_files_properties(${llphysicsextensions_HEADER_FILES}
+ PROPERTIES HEADER_FILE_ONLY TRUE)
+
+# some of the include files contain compile-time switches based on these
+set_source_files_properties(${llphysicsextensions_SOURCE_FILES}
+ PROPERTIES COMPILE_DEFINITIONS "LL_PATHING_LIB_STUB;LL_CONVEX_DECOMP_STUB;LL_PHYSICS_EXTENSIONS_STUB")
+
+list(APPEND llphysicsextensionsstub_SOURCE_FILES ${llphysicsextensions_HEADER_FILES})
+
+add_library(${PROJECT_NAME}stub ${${PROJECT_NAME}_SOURCE_FILES})
+target_include_directories(${PROJECT_NAME}stub INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
+target_link_libraries(${PROJECT_NAME}stub llmath llcommon)
+list(REMOVE_ITEM ${PROJECT_NAME}_HEADER_FILES
+ LLPathingLibStubImpl.h
+ LLConvexDecompositionStubImpl.h
+ LLPhysicsExtensionsStubImpl.h)
+#install(FILES ${${PROJECT_NAME}_HEADER_FILES} DESTINATION include/${PROJECT_NAME})
+if (BUILD_SHARED_LIBS)
+ if (EXISTS ${CMAKE_SYSROOT}/usr/lib/${ARCH}-linux-gnu)
+ set(_LIB lib/${ARCH}-linux-gnu)
+ elseif (EXISTS /lib64)
+ set(_LIB lib64)
+ else ()
+ set(_LIB lib)
+ endif ()
+ install(TARGETS ${PROJECT_NAME}stub DESTINATION ${_LIB})
+endif ()
+
+if (LINUX)
+ IF(CMAKE_BUILD_TYPE MATCHES Release)
+ SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/release)
+ ENDIF(CMAKE_BUILD_TYPE MATCHES Release)
+ IF(CMAKE_BUILD_TYPE MATCHES Debug)
+ SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/debug)
+ ENDIF(CMAKE_BUILD_TYPE MATCHES Debug)
+
+endif (LINUX)
diff --git a/indra/llprimitive/llphysicsextensions/LLConvexDecompositionStubImpl.cpp b/indra/llprimitive/llphysicsextensions/LLConvexDecompositionStubImpl.cpp
new file mode 100644
index 0000000000..b1214a7f31
--- /dev/null
+++ b/indra/llprimitive/llphysicsextensions/LLConvexDecompositionStubImpl.cpp
@@ -0,0 +1,143 @@
+/**
+* @file LLConvexDecompositionStubImpl.cpp
+* @author falcon@lindenlab.com
+* @brief A stub implementation of LLConvexDecomposition
+*
+* $LicenseInfo:firstyear=2011&license=viewerlgpl$
+* Second Life Viewer Source Code
+* Copyright (C) 20112010, 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 <string.h>
+#include <memory>
+#include "LLConvexDecompositionStubImpl.h"
+
+LLConvexDecomposition* LLConvexDecompositionImpl::getInstance()
+{
+ return NULL;
+}
+
+LLCDResult LLConvexDecompositionImpl::initSystem()
+{
+ return LLCD_NOT_IMPLEMENTED;
+}
+
+LLCDResult LLConvexDecompositionImpl::initThread()
+{
+ return LLCD_NOT_IMPLEMENTED;
+}
+
+LLCDResult LLConvexDecompositionImpl::quitThread()
+{
+ return LLCD_NOT_IMPLEMENTED;
+}
+
+LLCDResult LLConvexDecompositionImpl::quitSystem()
+{
+ return LLCD_NOT_IMPLEMENTED;
+}
+
+void LLConvexDecompositionImpl::genDecomposition(int& decomp)
+{
+ decomp = -1;
+}
+
+void LLConvexDecompositionImpl::deleteDecomposition(int decomp)
+{
+
+}
+
+void LLConvexDecompositionImpl::bindDecomposition(int decomp)
+{
+
+}
+
+LLCDResult LLConvexDecompositionImpl::setParam(const char* name, float val)
+{
+ return LLCD_NOT_IMPLEMENTED;
+}
+
+LLCDResult LLConvexDecompositionImpl::setParam(const char* name, bool val)
+{
+ return LLCD_NOT_IMPLEMENTED;
+}
+
+LLCDResult LLConvexDecompositionImpl::setParam(const char* name, int val)
+{
+ return LLCD_NOT_IMPLEMENTED;
+}
+
+LLCDResult LLConvexDecompositionImpl::setMeshData( const LLCDMeshData* data, bool vertex_based )
+{
+ return LLCD_NOT_IMPLEMENTED;
+}
+
+LLCDResult LLConvexDecompositionImpl::registerCallback(int stage, llcdCallbackFunc callback )
+{
+ return LLCD_NOT_IMPLEMENTED;
+}
+
+LLCDResult LLConvexDecompositionImpl::executeStage(int stage)
+{
+ return LLCD_NOT_IMPLEMENTED;
+}
+
+int LLConvexDecompositionImpl::getNumHullsFromStage(int stage)
+{
+ return 0;
+}
+
+LLCDResult LLConvexDecompositionImpl::getSingleHull( LLCDHull* hullOut )
+{
+ memset( hullOut, 0, sizeof(LLCDHull) );
+ return LLCD_NOT_IMPLEMENTED;
+}
+
+LLCDResult LLConvexDecompositionImpl::getHullFromStage( int stage, int hull, LLCDHull* hullOut )
+{
+ memset( hullOut, 0, sizeof(LLCDHull) );
+ return LLCD_NOT_IMPLEMENTED;
+}
+
+LLCDResult LLConvexDecompositionImpl::getMeshFromStage( int stage, int hull, LLCDMeshData* meshDataOut )
+{
+ memset( meshDataOut, 0, sizeof(LLCDMeshData) );
+ return LLCD_NOT_IMPLEMENTED;
+}
+
+LLCDResult LLConvexDecompositionImpl::getMeshFromHull( LLCDHull* hullIn, LLCDMeshData* meshOut )
+{
+ memset( meshOut, 0, sizeof(LLCDMeshData) );
+ return LLCD_NOT_IMPLEMENTED;
+}
+
+LLCDResult LLConvexDecompositionImpl::generateSingleHullMeshFromMesh(LLCDMeshData* meshIn, LLCDMeshData* meshOut)
+{
+ memset( meshOut, 0, sizeof(LLCDMeshData) );
+ return LLCD_NOT_IMPLEMENTED;
+}
+
+void LLConvexDecompositionImpl::loadMeshData(const char* fileIn, LLCDMeshData** meshDataOut)
+{
+ static LLCDMeshData meshData;
+ memset( &meshData, 0, sizeof(LLCDMeshData) );
+ *meshDataOut = &meshData;
+}
+
diff --git a/indra/llprimitive/llphysicsextensions/LLConvexDecompositionStubImpl.h b/indra/llprimitive/llphysicsextensions/LLConvexDecompositionStubImpl.h
new file mode 100644
index 0000000000..9ae879efb4
--- /dev/null
+++ b/indra/llprimitive/llphysicsextensions/LLConvexDecompositionStubImpl.h
@@ -0,0 +1,92 @@
+/**
+* @file LLConvexDecompositionStubImpl.h
+* @author falcon@lindenlab.com
+* @brief A stub implementation of LLConvexDecomposition
+*
+* $LicenseInfo:firstyear=2011&license=viewerlgpl$
+* Second Life Viewer Source Code
+* Copyright (C) 20112010, 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_CONVEX_DECOMP_UTIL_H
+#define LL_CONVEX_DECOMP_UTIL_H
+
+#include "llconvexdecomposition.h"
+
+class LLConvexDecompositionImpl : public LLConvexDecomposition
+{
+ public:
+
+ virtual ~LLConvexDecompositionImpl() {}
+
+ static LLConvexDecomposition* getInstance();
+ static LLCDResult initSystem();
+ static LLCDResult initThread();
+ static LLCDResult quitThread();
+ static LLCDResult quitSystem();
+
+ void genDecomposition(int& decomp);
+ void deleteDecomposition(int decomp);
+ void bindDecomposition(int decomp);
+
+ // Sets *paramsOut to the address of the LLCDParam array and returns
+ // the length of the array
+ int getParameters(const LLCDParam** paramsOut)
+ {
+ *paramsOut = NULL;
+ return 0;
+ }
+
+ int getStages(const LLCDStageData** stagesOut)
+ {
+ *stagesOut = NULL;
+ return 0;
+ }
+
+ // Set a parameter by name. Returns false if out of bounds or unsupported parameter
+ LLCDResult setParam(const char* name, float val);
+ LLCDResult setParam(const char* name, int val);
+ LLCDResult setParam(const char* name, bool val);
+ LLCDResult setMeshData( const LLCDMeshData* data, bool vertex_based );
+ LLCDResult registerCallback(int stage, llcdCallbackFunc callback );
+
+ LLCDResult executeStage(int stage);
+
+ int getNumHullsFromStage(int stage);
+
+ LLCDResult getHullFromStage( int stage, int hull, LLCDHull* hullOut );
+ LLCDResult getSingleHull( LLCDHull* hullOut ) ;
+
+ // TODO: Implement lock of some kind to disallow this call if data not yet ready
+ LLCDResult getMeshFromStage( int stage, int hull, LLCDMeshData* meshDataOut);
+ LLCDResult getMeshFromHull( LLCDHull* hullIn, LLCDMeshData* meshOut );
+
+ // For visualizing convex hull shapes in the viewer physics shape display
+ LLCDResult generateSingleHullMeshFromMesh( LLCDMeshData* meshIn, LLCDMeshData* meshOut);
+
+ /// Debug
+ void loadMeshData(const char* fileIn, LLCDMeshData** meshDataOut);
+
+ private:
+ LLConvexDecompositionImpl() {}
+};
+
+#endif //LL_CONVEX_DECOMP_UTIL_H
+
diff --git a/indra/llprimitive/llphysicsextensions/LLPathingLibStubImpl.cpp b/indra/llprimitive/llphysicsextensions/LLPathingLibStubImpl.cpp
new file mode 100644
index 0000000000..8ad13532f2
--- /dev/null
+++ b/indra/llprimitive/llphysicsextensions/LLPathingLibStubImpl.cpp
@@ -0,0 +1,107 @@
+/**
+* @file LLPathingLibStubImpl.cpp
+* @author prep@lindenlab.com
+* @brief A stubbed implementation of LLPathingLib
+*
+* $LicenseInfo:firstyear=2012&license=viewerlgpl$
+* Second Life Viewer Source Code
+* Copyright (C) 20112010, 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 "llpathinglib.h"
+#include "LLPathingLibStubImpl.h"
+
+#include "llsd.h"
+
+//=============================================================================
+LLPathingLibImpl::LLPathingLibImpl()
+{
+}
+
+LLPathingLibImpl::~LLPathingLibImpl()
+{
+
+}
+
+LLPathingLib* LLPathingLibImpl::getInstance()
+{
+ return NULL;
+}
+
+
+LLPathingLib::LLPLResult LLPathingLibImpl::initSystem()
+{
+ return LLPL_NOT_IMPLEMENTED;
+}
+
+LLPathingLib::LLPLResult LLPathingLibImpl::quitSystem()
+{
+ return LLPL_NOT_IMPLEMENTED;
+}
+
+LLPathingLib::LLPLResult LLPathingLibImpl::extractNavMeshSrcFromLLSD( const LLSD::Binary& dataBlock, int dir )
+{
+ return LLPL_NOT_IMPLEMENTED;
+}
+
+void LLPathingLibImpl::processNavMeshData()
+{
+}
+
+LLPathingLibImpl::LLPLResult LLPathingLibImpl::generatePath( const PathingPacket& pathingPacket )
+{
+ return LLPL_NOT_IMPLEMENTED;
+}
+
+void LLPathingLibImpl::setNavMeshMaterialType( LLPLCharacterType materialType )
+{
+}
+
+void LLPathingLibImpl::setNavMeshColors( const NavMeshColors& color )
+{
+}
+
+void LLPathingLibImpl::renderNavMesh()
+{
+}
+
+void LLPathingLibImpl::renderNavMeshEdges()
+{
+}
+
+void LLPathingLibImpl::renderNavMeshShapesVBO( U32 shapeRenderFlags )
+{
+}
+
+void LLPathingLibImpl::renderPath()
+{
+}
+
+void LLPathingLibImpl::renderPathBookend( LLRender& gl, LLPathingLib::LLPLPathBookEnd type )
+{
+}
+
+void LLPathingLibImpl::cleanupVBOManager()
+{
+}
+
+void LLPathingLibImpl::cleanupResidual()
+{
+}
diff --git a/indra/llprimitive/llphysicsextensions/LLPathingLibStubImpl.h b/indra/llprimitive/llphysicsextensions/LLPathingLibStubImpl.h
new file mode 100644
index 0000000000..75fdb3fa0f
--- /dev/null
+++ b/indra/llprimitive/llphysicsextensions/LLPathingLibStubImpl.h
@@ -0,0 +1,78 @@
+/**
+* @file LLPathingLibSubImpl.h
+* @author prep@lindenlab.com
+* @brief A stubbed implementation of LLPathingLib
+*
+* $LicenseInfo:firstyear=2012&license=viewerlgpl$
+* Second Life Viewer Source Code
+* Copyright (C) 2012, 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_PATHING_LIB_H
+#define LL_PATHING_LIB_H
+
+#include "llpathinglib.h"
+
+class LLSD;
+
+//=============================================================================
+class LLPathingLibImpl : public LLPathingLib
+{
+public:
+ LLPathingLibImpl();
+ virtual ~LLPathingLibImpl();
+
+ // Obtain a pointer to the actual implementation
+ static LLPathingLib* getInstance();
+ static LLPathingLib::LLPLResult initSystem();
+ static LLPathingLib::LLPLResult quitSystem();
+
+ //Extract and store navmesh data from the llsd datablock sent down by the server
+ virtual LLPLResult extractNavMeshSrcFromLLSD( const LLSD::Binary& dataBlock, int dir );
+ //Stitch any stored navmeshes together
+ virtual void processNavMeshData();
+
+ //Method used to generate and visualize a path on the viewers navmesh
+ virtual LLPLResult generatePath( const PathingPacket& pathingPacket );
+
+ //Set the material type for the heatmap type
+ virtual void setNavMeshMaterialType( LLPLCharacterType materialType );
+ //Set the various navmesh colors
+ virtual void setNavMeshColors( const NavMeshColors& color );
+
+ //The entry method to rendering the client side navmesh
+ virtual void renderNavMesh();
+ //The entry method to rendering the client side navmesh edges
+ virtual void renderNavMeshEdges();
+ //The entry method to render the client navmesh shapes VBO
+ virtual void renderNavMeshShapesVBO( U32 shapeRenderFlags );
+ //The entry method to render the clients designated path
+ virtual void renderPath();
+ //The entry method to render the capsule bookends for the clients designated path
+ virtual void renderPathBookend( LLRender& gl, LLPathingLib::LLPLPathBookEnd type );
+
+ //Method to delete any vbo's that are currently being managed by the pathing library
+ virtual void cleanupVBOManager();
+ //Method to cleanup any allocations within the implementation
+ virtual void cleanupResidual();
+};
+
+#endif //LL_PATHING_LIB_H
+
diff --git a/indra/llprimitive/llphysicsextensions/LLPhysicsExtensionsStubImpl.cpp b/indra/llprimitive/llphysicsextensions/LLPhysicsExtensionsStubImpl.cpp
new file mode 100644
index 0000000000..2c432f94e3
--- /dev/null
+++ b/indra/llprimitive/llphysicsextensions/LLPhysicsExtensionsStubImpl.cpp
@@ -0,0 +1,49 @@
+/**
+* @file LLPhysicsExtensionsStubImpl.cpp
+* @author prep@lindenlab.com
+* @brief A stubbed implementation of LLPhysicsExtensions
+*
+* $LicenseInfo:firstyear=2012&license=viewerlgpl$
+* Second Life Viewer Source Code
+* Copyright (C) 2012, 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 "llphysicsextensions.h"
+#include "LLPhysicsExtensionsStubImpl.h"
+
+//=============================================================================
+LLPhysicsExtensionsImpl::LLPhysicsExtensionsImpl()
+{
+}
+
+LLPhysicsExtensionsImpl::~LLPhysicsExtensionsImpl()
+{
+}
+
+bool LLPhysicsExtensionsImpl::initSystem()
+{
+ return false;
+}
+
+bool LLPhysicsExtensionsImpl::quitSystem()
+{
+ return false;
+}
+
diff --git a/indra/llprimitive/llphysicsextensions/LLPhysicsExtensionsStubImpl.h b/indra/llprimitive/llphysicsextensions/LLPhysicsExtensionsStubImpl.h
new file mode 100644
index 0000000000..ac14da1ac3
--- /dev/null
+++ b/indra/llprimitive/llphysicsextensions/LLPhysicsExtensionsStubImpl.h
@@ -0,0 +1,46 @@
+/**
+* @file LLPhysicsExtensionsSubImpl.h
+* @author prep@lindenlab.com
+* @brief A stubbed implementation of LLPhysicsExtensions
+*
+* $LicenseInfo:firstyear=2012&license=viewerlgpl$
+* Second Life Viewer Source Code
+* Copyright (C) 2012, 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_PHYSICS_EXTENSIONS_STUB_IMPL_H
+#define LL_PHYSICS_EXTENSIONS_STUB_IMPL_H
+
+#include "llphysicsextensions.h"
+
+//=============================================================================
+class LLPhysicsExtensionsImpl : public LLPhysicsExtensions
+{
+ public:
+
+ LLPhysicsExtensionsImpl();
+ virtual ~LLPhysicsExtensionsImpl();
+
+ static bool initSystem();
+ static bool quitSystem();
+};
+
+#endif //LL_PHYSICS_EXTENSIONS_STUB_IMPL_H
+
diff --git a/indra/llprimitive/llphysicsextensions/llconvexdecomposition.cpp b/indra/llprimitive/llphysicsextensions/llconvexdecomposition.cpp
new file mode 100644
index 0000000000..f7caf7f676
--- /dev/null
+++ b/indra/llprimitive/llphysicsextensions/llconvexdecomposition.cpp
@@ -0,0 +1,102 @@
+/**
+* @file llconvexdecomposition.cpp
+* @author falcon@lindenlab.com
+* @brief A Havok implementation of LLConvexDecomposition interface
+*
+* $LicenseInfo:firstyear=2011&license=lgpl$
+* Second Life Viewer Source Code
+* Copyright (C) 2011, 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$
+*/
+
+#if defined(_WINDOWS)
+# include "windowsincludes.h"
+#endif
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+#if !defined(LL_CONVEX_DECOMP_STUB)
+# include "LLConvexDecompositionImpl.h"
+#else
+# include "LLConvexDecompositionStubImpl.h"
+#endif
+
+#include "llconvexdecomposition.h"
+
+
+/*static */bool LLConvexDecomposition::s_isInitialized = false;
+
+/*static*/bool LLConvexDecomposition::isFunctional()
+{
+#if !defined(LL_CONVEX_DECOMP_STUB)
+ return true;
+#else
+ return false;
+#endif
+}
+
+#if !defined(LL_CONVEX_DECOMP_STUB) && defined(HK_COMPILER_CLANG)
+ //have to specialize before use so that generalized one not auto gen-d
+HK_SINGLETON_SPECIALIZATION_DECL(LLConvexDecompositionImpl);
+#endif
+
+/*static*/LLConvexDecomposition* LLConvexDecomposition::getInstance()
+{
+ if ( !s_isInitialized )
+ {
+ return NULL;
+ }
+ else
+ {
+#if !defined(LL_CONVEX_DECOMP_STUB)
+ return &hkSingleton<LLConvexDecompositionImpl>::getInstance();
+#else
+ return LLConvexDecompositionImpl::getInstance();
+#endif
+ }
+}
+
+/*static */LLCDResult LLConvexDecomposition::initSystem()
+{
+ LLCDResult result = LLConvexDecompositionImpl::initSystem();
+ if ( result == LLCD_OK )
+ {
+ s_isInitialized = true;
+ }
+ return result;
+}
+
+/*static */LLCDResult LLConvexDecomposition::initThread()
+{
+ return LLConvexDecompositionImpl::initThread();
+}
+
+/*static */LLCDResult LLConvexDecomposition::quitThread()
+{
+ return LLConvexDecompositionImpl::quitThread();
+}
+
+/*static */LLCDResult LLConvexDecomposition::quitSystem()
+{
+ return LLConvexDecompositionImpl::quitSystem();
+}
+
+
diff --git a/indra/llprimitive/llphysicsextensions/llconvexdecomposition.h b/indra/llprimitive/llphysicsextensions/llconvexdecomposition.h
new file mode 100644
index 0000000000..10c6d55315
--- /dev/null
+++ b/indra/llprimitive/llphysicsextensions/llconvexdecomposition.h
@@ -0,0 +1,231 @@
+/**
+ * @file llconvexdecomposition.cpp
+ * @brief LLConvexDecomposition interface definition
+ *
+ * $LicenseInfo:firstyear=2011&license=lgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, 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_CONVEX_DECOMPOSITION
+#define LL_CONVEX_DECOMPOSITION
+
+typedef int bool32;
+
+#if defined(_WIN32) || defined(_WIN64)
+#define LLCD_CALL __cdecl
+#else
+#define LLCD_CALL
+#endif
+
+struct LLCDParam
+{
+ enum LLCDParamType
+ {
+ LLCD_INVALID = 0,
+ LLCD_INTEGER,
+ LLCD_FLOAT,
+ LLCD_BOOLEAN,
+ LLCD_ENUM
+ };
+
+ struct LLCDEnumItem
+ {
+ const char* mName;
+ int mValue;
+ };
+
+ union LLCDValue
+ {
+ float mFloat;
+ int mIntOrEnumValue;
+ bool32 mBool;
+ };
+
+ union LLCDParamDetails
+ {
+ struct {
+ LLCDValue mLow;
+ LLCDValue mHigh;
+ LLCDValue mDelta;
+ } mRange;
+
+ struct {
+ int mNumEnums;
+ LLCDEnumItem* mEnumsArray;
+ } mEnumValues;
+ };
+
+ const char* mName;
+ const char* mDescription;
+ LLCDParamType mType;
+ LLCDParamDetails mDetails;
+ LLCDValue mDefault;
+ int mStage;
+
+ // WARNING: Only the LLConvexDecomposition implementation
+ // should change this value
+ int mReserved;
+};
+
+struct LLCDStageData
+{
+ const char* mName;
+ const char* mDescription;
+ bool32 mSupportsCallback;
+};
+
+struct LLCDMeshData
+{
+ enum IndexType
+ {
+ INT_16,
+ INT_32
+ };
+
+ const float* mVertexBase;
+ int mVertexStrideBytes;
+ int mNumVertices;
+ const void* mIndexBase;
+ IndexType mIndexType;
+ int mIndexStrideBytes;
+ int mNumTriangles;
+};
+
+struct LLCDHull
+{
+ const float* mVertexBase;
+ int mVertexStrideBytes;
+ int mNumVertices;
+};
+
+enum LLCDResult
+{
+ LLCD_OK = 0,
+ LLCD_UNKOWN_ERROR,
+ LLCD_NULL_PTR,
+ LLCD_INVALID_STAGE,
+ LLCD_UNKNOWN_PARAM,
+ LLCD_BAD_VALUE,
+ LLCD_REQUEST_OUT_OF_RANGE,
+ LLCD_INVALID_MESH_DATA,
+ LLCD_INVALID_HULL_DATA,
+ LLCD_STAGE_NOT_READY,
+ LLCD_INVALID_THREAD,
+ LLCD_NOT_IMPLEMENTED
+};
+
+// This callback will receive a string describing the current subtask being performed
+// as well as a pair of numbers indicating progress. (The values should not be interpreted
+// as a completion percentage as 'current' may be greater than 'final'.)
+// If the callback returns zero, the decomposition will be terminated
+typedef int (LLCD_CALL *llcdCallbackFunc)(const char* description, int current, int final);
+
+class LLConvexDecomposition
+{
+public:
+ // Obtain a pointer to the actual implementation
+ static LLConvexDecomposition* getInstance();
+
+ /// @returns false if this is the stub
+ static bool isFunctional();
+
+ static LLCDResult initSystem();
+ static LLCDResult initThread();
+ static LLCDResult quitThread();
+ static LLCDResult quitSystem();
+
+ // Generate a decomposition object handle
+ virtual void genDecomposition(int& decomp) = 0;
+ // Delete decomposition object handle
+ virtual void deleteDecomposition(int decomp) = 0;
+ // Bind given decomposition handle
+ // Commands operate on currently bound decomposition
+ virtual void bindDecomposition(int decomp) = 0;
+
+ // Sets *paramsOut to the address of the LLCDParam array and returns
+ // the number of parameters
+ virtual int getParameters(const LLCDParam** paramsOut) = 0;
+
+
+ // Sets *stagesOut to the address of the LLCDStageData array and returns
+ // the number of stages
+ virtual int getStages(const LLCDStageData** stagesOut) = 0;
+
+
+ // Set a parameter by name. Pass enum values as integers.
+ virtual LLCDResult setParam(const char* name, float val) = 0;
+ virtual LLCDResult setParam(const char* name, int val) = 0;
+ virtual LLCDResult setParam(const char* name, bool val) = 0;
+
+
+ // Set incoming mesh data. Data is copied to local buffers and will
+ // persist until the next setMeshData call
+ virtual LLCDResult setMeshData( const LLCDMeshData* data, bool vertex_based ) = 0;
+
+
+ // Register a callback to be called periodically during the specified stage
+ // See the typedef above for more information
+ virtual LLCDResult registerCallback( int stage, llcdCallbackFunc callback ) = 0;
+
+
+ // Execute the specified decomposition stage
+ virtual LLCDResult executeStage(int stage) = 0;
+ virtual LLCDResult buildSingleHull() = 0 ;
+
+
+ // Gets the number of hulls generated by the specified decompositions stage
+ virtual int getNumHullsFromStage(int stage) = 0;
+
+
+ // Populates hullOut to reference the internal copy of the requested hull
+ // The data will persist only until the next executeStage call for that stage.
+ virtual LLCDResult getHullFromStage( int stage, int hull, LLCDHull* hullOut ) = 0;
+
+ virtual LLCDResult getSingleHull( LLCDHull* hullOut ) = 0 ;
+
+
+ // TODO: Implement lock of some kind to disallow this call if data not yet ready
+ // Populates the meshDataOut to reference the utility's copy of the mesh geometry
+ // for the hull and stage specified.
+ // You must copy this data if you want to continue using it after the next executeStage
+ // call
+ virtual LLCDResult getMeshFromStage( int stage, int hull, LLCDMeshData* meshDataOut) = 0;
+
+
+ // Creates a mesh from hullIn and temporarily stores it internally in the utility.
+ // The mesh data persists only until the next call to getMeshFromHull
+ virtual LLCDResult getMeshFromHull( LLCDHull* hullIn, LLCDMeshData* meshOut ) = 0;
+
+ // Takes meshIn, generates a single convex hull from it, converts that to a mesh
+ // stored internally, and populates meshOut to reference the internally stored data.
+ // The data is persistent only until the next call to generateSingleHullMeshFromMesh
+ virtual LLCDResult generateSingleHullMeshFromMesh( LLCDMeshData* meshIn, LLCDMeshData* meshOut) = 0;
+
+ //
+ /// Debug
+ virtual void loadMeshData(const char* fileIn, LLCDMeshData** meshDataOut) = 0;
+
+private:
+ static bool s_isInitialized;
+};
+
+#endif //LL_CONVEX_DECOMPOSITION
+
diff --git a/indra/llprimitive/llphysicsextensions/llpathinglib.cpp b/indra/llprimitive/llphysicsextensions/llpathinglib.cpp
new file mode 100644
index 0000000000..1a6017c4b8
--- /dev/null
+++ b/indra/llprimitive/llphysicsextensions/llpathinglib.cpp
@@ -0,0 +1,110 @@
+/**
+* @file llpathinglib.cpp
+* @author prep@lindenlab.com
+* @brief LLPathingLib core creation methods
+*
+* $LicenseInfo:firstyear=2012&license=lgpl$
+* Second Life Viewer Source Code
+* Copyright (C) 2011, 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$
+*/
+
+#if defined(_WINDOWS)
+# include "windowsincludes.h"
+#endif
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+
+#if !defined(LL_PATHING_LIB_STUB)
+# include "LLPathingLibImpl.h"
+#else
+# include "LLPathingLibStubImpl.h"
+#endif
+
+#include "llpathinglib.h"
+
+//disable the undefined symbol optimization
+//#pragma warning (disable : 4221)
+
+//=============================================================================
+
+/*static */bool LLPathingLib::s_isInitialized = false;
+
+//=============================================================================
+
+
+/*static*/bool LLPathingLib::isFunctional()
+{
+#if !defined(LL_PATHING_LIB_STUB)
+ return true;
+#else
+ return false;
+#endif
+}
+
+#if !defined(LL_PATHING_LIB_STUB) && defined(HK_COMPILER_CLANG)
+ //have to specialize before use so that generalized one not auto gen-d
+HK_SINGLETON_SPECIALIZATION_DECL(LLPathingLibImpl);
+#endif
+
+/*static*/LLPathingLib* LLPathingLib::getInstance()
+{
+ if ( !s_isInitialized )
+ {
+ return NULL;
+ }
+ else
+ {
+#if !defined(LL_PATHING_LIB_STUB)
+ return &hkSingleton<LLPathingLibImpl>::getInstance();
+#else
+ return LLPathingLibImpl::getInstance();
+#endif
+ }
+}
+
+//=============================================================================
+
+/*static */LLPathingLib::LLPLResult LLPathingLib::initSystem()
+{
+ if ( LLPathingLibImpl::initSystem() == LLPL_OK )
+ {
+ s_isInitialized = true;
+ return LLPL_OK;
+ }
+ return LLPL_UNKOWN_ERROR;
+}
+//=============================================================================
+/*static */LLPathingLib::LLPLResult LLPathingLib::quitSystem()
+{
+ LLPLResult quitResult = LLPL_UNKOWN_ERROR;
+
+ if (s_isInitialized)
+ {
+ quitResult = LLPathingLibImpl::quitSystem();
+ s_isInitialized = false;
+ }
+
+ return quitResult;
+}
+//=============================================================================
+
diff --git a/indra/llprimitive/llphysicsextensions/llpathinglib.h b/indra/llprimitive/llphysicsextensions/llpathinglib.h
new file mode 100644
index 0000000000..c8c7410797
--- /dev/null
+++ b/indra/llprimitive/llphysicsextensions/llpathinglib.h
@@ -0,0 +1,187 @@
+/**
+ * @file llpathinglib.cpp
+ * @author prep@lindenlab.com
+ * @brief LLPathingLib interface definition
+ *
+ * $LicenseInfo:firstyear=2012&license=lgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, 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_PATHING_LIBRARY
+#define LL_PATHING_LIBRARY
+
+#include "llpreprocessor.h"
+#include "llsd.h"
+#include "v3dmath.h"
+#include "v4math.h"
+
+#include "v4color.h"
+#include "v4coloru.h"
+#include "llphysicsextensions.h"
+
+typedef int bool32;
+
+#if defined(_WIN32) || defined(_WIN64)
+#define LLCD_CALL __cdecl
+#else
+#define LLCD_CALL
+#endif
+
+class LLRender;
+
+//=============================================================================
+class LLPathingLib
+{
+
+public:
+ enum LLShapeType
+ {
+ LLST_WalkableObjects = 0,
+ LLST_ObstacleObjects,
+ LLST_MaterialPhantoms,
+ LLST_ExclusionPhantoms,
+ LLST_MaxShapeTypes = LLST_ExclusionPhantoms+1,
+ LLST_None = LLST_MaxShapeTypes+2,
+ LLST_SimpleBox = LLST_None+1,
+ LLST_SimpleCapsule = LLST_SimpleBox+1,
+ };
+
+ enum LLShapeTypeFlag
+ {
+ LLSTB_WalkableObjects = 0x1 << 1,
+ LLSTB_ObstacleObjects = 0x1 << 2,
+ LLSTB_MaterialPhantoms = 0x1 << 3,
+ LLSTB_ExclusionPhantoms = 0x1 << 4,
+ LLSTB_None = 0x1 << 5
+ };
+
+ enum LLPLPathBookEnd
+ {
+ LLPL_START = 0,
+ LLPL_END,
+ };
+
+ enum LLPLResult
+ {
+ LLPL_OK = 0,
+ LLPL_NOTSET,
+ LLPL_ERROR,
+ LLPL_NO_NAVMESH,
+ LLPL_UNKOWN_ERROR,
+ LLPL_NO_PATH,
+ LLPL_PATH_GENERATED_OK,
+ LLPL_NOT_IMPLEMENTED,
+ };
+
+ enum LLPLCharacterType
+ {
+ LLPL_CHARACTER_TYPE_A = 4,
+ LLPL_CHARACTER_TYPE_B = 3,
+ LLPL_CHARACTER_TYPE_C = 2,
+ LLPL_CHARACTER_TYPE_D = 1,
+ LLPL_CHARACTER_TYPE_NONE = 0
+ };
+
+ struct PathingPacket
+ {
+ PathingPacket() : mHasPointA(false), mHasPointB(false), mCharacterWidth(0.0f), mCharacterType(LLPL_CHARACTER_TYPE_NONE) {}
+ bool mHasPointA;
+ LLVector3 mStartPointA;
+ LLVector3 mEndPointA;
+ bool mHasPointB;
+ LLVector3 mStartPointB;
+ LLVector3 mEndPointB;
+ F32 mCharacterWidth;
+ LLPLCharacterType mCharacterType;
+ };
+
+ struct NavMeshColors
+ {
+ LLColor4U mWalkable;
+ LLColor4U mObstacle;
+ LLColor4U mMaterial;
+ LLColor4U mExclusion;
+ LLColor4U mConnectedEdge;
+ LLColor4U mBoundaryEdge;
+ LLColor4 mHeatColorBase;
+ LLColor4 mHeatColorMax;
+ LLColor4U mFaceColor;
+ LLColor4U mStarValid;
+ LLColor4U mStarInvalid;
+ LLColor4U mTestPath;
+ LLColor4U mWaterColor;
+ };
+
+public:
+ //Ctor
+ LLPathingLib() {}
+ virtual ~LLPathingLib() {}
+
+ /// @returns false if this is the stub
+ static bool isFunctional();
+
+ // Obtain a pointer to the actual implementation
+ static LLPathingLib* getInstance();
+ static LLPathingLib::LLPLResult initSystem();
+ static LLPathingLib::LLPLResult quitSystem();
+
+ //Extract and store navmesh data from the llsd datablock sent down by the server
+ virtual LLPLResult extractNavMeshSrcFromLLSD( const LLSD::Binary& dataBlock, int dir ) = 0;
+ //Stitch any stored navmeshes together
+ virtual void processNavMeshData( ) = 0;
+
+ //Method used to generate and visualize a path on the viewers navmesh
+ virtual LLPLResult generatePath( const PathingPacket& pathingPacket ) = 0;
+
+ //Set the material type for the heatmap type
+ virtual void setNavMeshMaterialType( LLPLCharacterType materialType ) = 0;
+ //Set the various navmesh colors
+ virtual void setNavMeshColors( const NavMeshColors& color ) = 0;
+
+ //The entry method to rendering the client side navmesh
+ virtual void renderNavMesh() = 0;
+ //The entry method to rendering the client side navmesh edges
+ virtual void renderNavMeshEdges() = 0;
+ //The entry method to render the client navmesh shapes VBO
+ virtual void renderNavMeshShapesVBO( U32 shapeRenderFlags ) = 0;
+ //The entry method to render the clients designated path
+ virtual void renderPath() = 0;
+ //The entry method to render the capsule bookends for the clients designated path
+ virtual void renderPathBookend( LLRender& gl, LLPathingLib::LLPLPathBookEnd type ) = 0;
+ //Renders all of the generated simple shapes (using their default transforms)
+ virtual void renderSimpleShapes( LLRender& gl, F32 regionsWaterHeight ) = 0;
+
+ //Method called from second life to create a capsule from properties of a character
+ virtual void createPhysicsCapsuleRep( F32 length, F32 radius, BOOL horizontal, const LLUUID& id ) = 0;
+ //Removes any cached physics capsule using a list of cached uuids
+ virtual void cleanupPhysicsCapsuleRepResiduals() = 0;
+ //Renders a selected uuids physics rep
+ virtual void renderSimpleShapeCapsuleID( LLRender& gl, const LLUUID& id, const LLVector3& pos, const LLQuaternion& rot ) = 0;
+
+ //Method to delete any vbo's that are currently being managed by the pathing library
+ virtual void cleanupVBOManager( ) = 0;
+ //Method to cleanup any allocations within the implementation
+ virtual void cleanupResidual( ) = 0;
+private:
+ static bool s_isInitialized;
+};
+
+#endif //LL_PATHING_LIBRARY
diff --git a/indra/llprimitive/llphysicsextensions/llphysicsextensions.cpp b/indra/llprimitive/llphysicsextensions/llphysicsextensions.cpp
new file mode 100644
index 0000000000..9bb4522a23
--- /dev/null
+++ b/indra/llprimitive/llphysicsextensions/llphysicsextensions.cpp
@@ -0,0 +1,103 @@
+/**
+* @file llphysicsextensions.cpp
+* @author nyx@lindenlab.com
+* @brief LLPhysicsExtensions core initialization methods
+*
+* $LicenseInfo:firstyear=2012&license=lgpl$
+* Second Life Viewer Source Code
+* Copyright (C) 2011, 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$
+*/
+
+#if defined(_WINDOWS)
+# include "windowsincludes.h"
+#endif
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+
+#include "llphysicsextensions.h"
+
+#if !defined(LL_PHYSICS_EXTENSIONS_STUB)
+# include "LLPhysicsExtensionsImpl.h"
+#else
+# include "LLPhysicsExtensionsStubImpl.h"
+#endif
+
+
+//disable the undefined symbol optimization
+//#pragma warning (disable : 4221)
+
+//=============================================================================
+
+/*static */bool LLPhysicsExtensions::s_isInitialized = false;
+
+
+/*static*/bool LLPhysicsExtensions::isFunctional()
+{
+#if !defined(LL_PHYSICS_EXTENSIONS_STUB)
+ return true;
+#else
+ return false;
+#endif
+}
+
+//=============================================================================
+
+#if !defined(LL_PHYSICS_EXTENSIONS_STUB) && defined(HK_COMPILER_CLANG)
+ //have to specialize before use so that generalized one not auto gen-d
+HK_SINGLETON_SPECIALIZATION_DECL(LLPhysicsExtensionsImpl);
+#endif
+
+/*static*/LLPhysicsExtensions* LLPhysicsExtensions::getInstance()
+{
+ if ( !s_isInitialized )
+ {
+ return NULL;
+ }
+ else
+ {
+#if !defined(LL_PHYSICS_EXTENSIONS_STUB)
+ return &hkSingleton<LLPhysicsExtensionsImpl>::getInstance();
+#else
+ return LLPhysicsExtensionsImpl::getInstance();
+#endif
+ }
+}
+
+//=============================================================================
+
+/*static */bool LLPhysicsExtensions::initSystem()
+{
+ bool result = LLPhysicsExtensionsImpl::initSystem();
+ if ( result )
+ {
+ s_isInitialized = true;
+ }
+ return result;
+}
+//=============================================================================
+/*static */bool LLPhysicsExtensions::quitSystem()
+{
+ return LLPhysicsExtensionsImpl::quitSystem();
+}
+//=============================================================================
+
diff --git a/indra/llprimitive/llphysicsextensions/llphysicsextensions.h b/indra/llprimitive/llphysicsextensions/llphysicsextensions.h
new file mode 100644
index 0000000000..be479f5d8a
--- /dev/null
+++ b/indra/llprimitive/llphysicsextensions/llphysicsextensions.h
@@ -0,0 +1,59 @@
+/**
+* @file llphysicsextensions.h
+* @author nyx@lindenlab.com
+* @brief LLPhysicsExtensions core shared initialization
+* routines
+*
+* $LicenseInfo:firstyear=2012&license=lgpl$
+* Second Life Viewer Source Code
+* Copyright (C) 2011, 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_PHYSICS_EXTENSIONS
+#define LL_PHYSICS_EXTENSIONS
+
+#include "llpreprocessor.h"
+#include "llsd.h"
+#include "v3dmath.h"
+
+#define LLPHYSICSEXTENSIONS_VERSION "1.0"
+
+typedef int bool32;
+
+class LLPhysicsExtensions
+{
+
+public:
+ // Obtain a pointer to the actual implementation
+ static LLPhysicsExtensions* getInstance();
+
+ /// @returns false if this is the stub
+ static bool isFunctional();
+
+ static bool initSystem();
+ static bool quitSystem();
+
+private:
+ static bool s_isInitialized;
+};
+
+#endif //LL_PATHING_LIBRARY
+
+
diff --git a/indra/llprimitive/llprimitive.cpp b/indra/llprimitive/llprimitive.cpp
index 644476460c..f6246e283f 100644
--- a/indra/llprimitive/llprimitive.cpp
+++ b/indra/llprimitive/llprimitive.cpp
@@ -274,7 +274,7 @@ void LLPrimitive::setAllTETextures(const LLUUID &tex_id)
//===============================================================
void LLPrimitive::setTE(const U8 index, const LLTextureEntry& te)
{
- if(mTextureList.copyTexture(index, te) != TEM_CHANGE_NONE && te.getBumpmap() > 0)
+ if(mTextureList.copyTexture(index, &te) != TEM_CHANGE_NONE && te.getBumpmap() > 0)
{
mNumBumpmapTEs++;
}
@@ -753,7 +753,7 @@ void LLPrimitive::copyTEs(const LLPrimitive *primitivep)
}
for (i = 0; i < num_tes; i++)
{
- mTextureList.copyTexture(i, *(primitivep->getTE(i)));
+ mTextureList.copyTexture(i, primitivep->getTE(i));
}
}
diff --git a/indra/llprimitive/llprimtexturelist.cpp b/indra/llprimitive/llprimtexturelist.cpp
index 68f3f5ffac..7f60d8025a 100644
--- a/indra/llprimitive/llprimtexturelist.cpp
+++ b/indra/llprimitive/llprimtexturelist.cpp
@@ -125,7 +125,7 @@ void LLPrimTextureList::take(LLPrimTextureList& other_list)
// virtual
// copies LLTextureEntry 'te'
// returns TEM_CHANGE_TEXTURE if successful, otherwise TEM_CHANGE_NONE
-S32 LLPrimTextureList::copyTexture(const U8 index, const LLTextureEntry& te)
+S32 LLPrimTextureList::copyTexture(const U8 index, const LLTextureEntry* te)
{
if (size_t(index) >= mEntryList.size())
{
@@ -137,14 +137,7 @@ S32 LLPrimTextureList::copyTexture(const U8 index, const LLTextureEntry& te)
// we're changing an existing entry
llassert(mEntryList[index]);
delete (mEntryList[index]);
- if (&te)
- {
- mEntryList[index] = te.newCopy();
- }
- else
- {
- mEntryList[index] = LLPrimTextureList::newTextureEntry();
- }
+ mEntryList[index] = te->newCopy();
return TEM_CHANGE_TEXTURE;
}
diff --git a/indra/llprimitive/llprimtexturelist.h b/indra/llprimitive/llprimtexturelist.h
index 79744e9f08..b8bdad60b3 100644
--- a/indra/llprimitive/llprimtexturelist.h
+++ b/indra/llprimitive/llprimtexturelist.h
@@ -71,7 +71,7 @@ public:
// copies LLTextureEntry 'te'
// returns TEM_CHANGE_TEXTURE if successful, otherwise TEM_CHANGE_NONE
- S32 copyTexture(const U8 index, const LLTextureEntry& te);
+ S32 copyTexture(const U8 index, const LLTextureEntry* te);
// takes ownership of LLTextureEntry* 'te'
// returns TEM_CHANGE_TEXTURE if successful, otherwise TEM_CHANGE_NONE