SL-14403 Removed glod

master
Andrey Kleshchev 2021-11-10 17:48:55 +02:00
parent fd5e1f0b97
commit 33f52ee51d
13 changed files with 26 additions and 689 deletions

View File

@ -1047,100 +1047,6 @@
<key>version</key>
<string>0.0.0</string>
</map>
<key>glod</key>
<map>
<key>copyright</key>
<string>Copyright 2003 Jonathan Cohen, Nat Duca, David Luebke, Brenden Schubert - Johns Hopkins University and University of Virginia</string>
<key>license</key>
<string>GLOD Open-Source License Version 1.0</string>
<key>license_file</key>
<string>LICENSES/GLOD.txt</string>
<key>name</key>
<string>glod</string>
<key>platforms</key>
<map>
<key>darwin</key>
<map>
<key>archive</key>
<map>
<key>hash</key>
<string>71e678d70e276fc42a56926fc28a7abd</string>
<key>hash_algorithm</key>
<string>md5</string>
<key>url</key>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/glod_3p-update-glod/rev/296895/arch/Darwin/installer/glod-1.0pre4.296895-darwin-296895.tar.bz2</string>
</map>
<key>name</key>
<string>darwin</string>
</map>
<key>darwin64</key>
<map>
<key>archive</key>
<map>
<key>hash</key>
<string>a9eaa005ff9d387f946283fbcb69b3c8</string>
<key>url</key>
<string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/76353/727324/glod-1.0pre3.555522-darwin64-555522.tar.bz2</string>
</map>
<key>name</key>
<string>darwin64</string>
</map>
<key>linux</key>
<map>
<key>archive</key>
<map>
<key>hash</key>
<string>58113bcbbacbaeb2d278f745867ae6f0</string>
<key>hash_algorithm</key>
<string>md5</string>
<key>url</key>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/p64_3p-glod/rev/314201/arch/Linux/installer/glod-1.0pre4.314201-linux-314201.tar.bz2</string>
</map>
<key>name</key>
<string>linux</string>
</map>
<key>linux64</key>
<map>
<key>archive</key>
<map>
<key>hash</key>
<string>9aef5cd576ace19568da01d9bc3db29c</string>
<key>url</key>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/1625/3628/glod-1.0pre3.501614-linux64-501614.tar.bz2</string>
</map>
<key>name</key>
<string>linux64</string>
</map>
<key>windows</key>
<map>
<key>archive</key>
<map>
<key>hash</key>
<string>e36c95b0d0fbaa3ff3392facaf5de447</string>
<key>hash_algorithm</key>
<string>md5</string>
<key>url</key>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/55008/511893/glod-1.0pre3.538980-windows-538980.tar.bz2</string>
</map>
<key>name</key>
<string>windows</string>
</map>
<key>windows64</key>
<map>
<key>archive</key>
<map>
<key>hash</key>
<string>6302ee1903ab419e76565d9eb6acd274</string>
<key>url</key>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/55004/511885/glod-1.0pre3.538980-windows64-538980.tar.bz2</string>
</map>
<key>name</key>
<string>windows64</string>
</map>
</map>
<key>version</key>
<string>1.0pre3.555522</string>
</map>
<key>googlemock</key>
<map>
<key>copyright</key>

1
debian/copyright vendored
View File

@ -10,7 +10,6 @@ DBus/dbus-glib Copyright (C) 2002, 2003 CodeFactory AB / Copyright (C) 2003, 20
expat Copyright (C) 1998, 1999, 2000 Thai Open Source Software Center Ltd.
FreeType Copyright (C) 1996-2002, 2006 David Turner, Robert Wilhelm, and Werner Lemberg.
GL Copyright (C) 1999-2004 Brian Paul.
GLOD Copyright (C) 2003-04 Jonathan Cohen, Nat Duca, Chris Niski, Johns Hopkins University and David Luebke, Brenden Schubert, University of Virginia.
google-perftools Copyright (c) 2005, Google Inc.
Havok.com(TM) Copyright (C) 1999-2001, Telekinesys Research Limited.
jpeg2000 Copyright (C) 2001, David Taubman, The University of New South Wales (UNSW)

View File

@ -40,7 +40,6 @@ set(cmake_SOURCE_FILES
FreeType.cmake
GLEXT.cmake
GLH.cmake
GLOD.cmake
## GStreamer010Plugin.cmake
GoogleMock.cmake
Havok.cmake

View File

@ -57,7 +57,6 @@ if(WINDOWS)
libaprutil-1.dll
libapriconv-1.dll
nghttp2.dll
glod.dll
libhunspell.dll
uriparser.dll
)
@ -166,7 +165,6 @@ elseif(DARWIN)
libaprutil-1.0.dylib
libaprutil-1.dylib
${EXPAT_COPY}
libGLOD.dylib
libhunspell-1.3.0.dylib
libndofdev.dylib
libnghttp2.dylib
@ -215,7 +213,6 @@ elseif(LINUX)
${EXPAT_COPY}
libfreetype.so.6.6.2
libfreetype.so.6
libGLOD.so
libgmodule-2.0.so
libgobject-2.0.so
libhunspell-1.3.so.0.0.0

View File

@ -1,9 +0,0 @@
# -*- cmake -*-
include(Prebuilt)
if (NOT USESYSTEMLIBS)
use_prebuilt_binary(glod)
endif (NOT USESYSTEMLIBS)
set(GLOD_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include)
set(GLOD_LIBRARIES GLOD)

View File

@ -16,7 +16,6 @@ include(DBusGlib)
include(DragDrop)
include(EXPAT)
include(FMODSTUDIO)
include(GLOD)
include(Hunspell)
include(JsonCpp)
include(LLAppearance)
@ -68,7 +67,6 @@ endif(FMODSTUDIO)
include_directories(
${DBUSGLIB_INCLUDE_DIRS}
${JSONCPP_INCLUDE_DIR}
${GLOD_INCLUDE_DIR}
${LLAUDIO_INCLUDE_DIRS}
${LLCHARACTER_INCLUDE_DIRS}
${LLCOMMON_INCLUDE_DIRS}
@ -1815,9 +1813,6 @@ if (WINDOWS)
${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libapr-1.dll
${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libaprutil-1.dll
${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libapriconv-1.dll
${SHARED_LIB_STAGING_DIR}/Release/glod.dll
${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/glod.dll
${SHARED_LIB_STAGING_DIR}/Debug/glod.dll
${SHARED_LIB_STAGING_DIR}/Release/libcollada14dom22.dll
${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/libcollada14dom22.dll
${SHARED_LIB_STAGING_DIR}/Debug/libcollada14dom22-d.dll
@ -2053,7 +2048,6 @@ target_link_libraries(${VIEWER_BINARY_NAME}
${DBUSGLIB_LIBRARIES}
${OPENGL_LIBRARIES}
${FMODWRAPPER_LIBRARY} # must come after LLAudio
${GLOD_LIBRARIES}
${OPENGL_LIBRARIES}
${JSONCPP_LIBRARIES}
${SDL_LIBRARY}

View File

@ -770,74 +770,6 @@ 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.
=============
GLOD license
=============
The GLOD Open-Source License Version 1.0 June 16, 2004
Copyright (C) 2003-04 Jonathan Cohen, Nat Duca, Chris Niski, Johns
Hopkins University and David Luebke, Brenden Schubert, University of
Virginia. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, is 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 and
request.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer and
request in the documentation and/or other materials provided with
the distribution.
3. The name "GLOD" must not be used to endorse or promote products
derived from this software without prior written permission.
4. Redistributions of any modified version of this source, whether in
source or binary form , must include a form of the following
acknowledgment: "This product is derived from the GLOD library,
which is available from http://www.cs.jhu.edu/~graphics/GLOD."
5. Redistributions of any modified version of this source in binary
form must provide, free of charge, access to the modified version
of the code.
6. This license shall be governed by and construed and enforced in
accordance with the laws of the State of Maryland, without
reference to its conflicts of law provisions. The exclusive
jurisdiction and venue for all legal actions relating to this
license shall be in courts of competent subject matter jurisdiction
located in the State of Maryland.
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, GLOD IS PROVIDED
UNDER THIS LICENSE ON AN AS IS BASIS, WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
THAT GLOD IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR
PURPOSE OR NON-INFRINGING. ALL WARRANTIES ARE DISCLAIMED AND THE
ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE CODE IS WITH
YOU. SHOULD ANY CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE
COPYRIGHT HOLDER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY
NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY
CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY CODE IS
AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR ANY OTHER CONTRIBUTOR BE LIABLE FOR ANY
SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES FOR LOSS OF
PROFITS, REVENUE, OR FOR LOSS OF INFORMATION OR ANY OTHER LOSS.
YOU EXPRESSLY AGREE TO FOREVER INDEMNIFY, DEFEND AND HOLD HARMLESS THE
COPYRIGHT HOLDERS AND CONTRIBUTORS OF GLOD AGAINST ALL CLAIMS,
DEMANDS, SUITS OR OTHER ACTIONS ARISING DIRECTLY OR INDIRECTLY FROM
YOUR ACCEPTANCE AND USE OF GLOD.
Although NOT REQUIRED, we would appreciate it if active users of GLOD
put a link on their web site to the GLOD web site when possible.
=============
meshoptimizer
=============

View File

@ -726,9 +726,6 @@ void LLFloaterModelPreview::onLODParamCommit(S32 lod, bool enforce_tri_limit)
S32 mode = lod_source_combo->getCurrentIndex();
switch (mode)
{
case LLModelPreview::GENERATE:
mModelPreview->onLODGenerateParamCommit(lod, enforce_tri_limit);
break;
case LLModelPreview::MESH_OPTIMIZER_AUTO:
case LLModelPreview::MESH_OPTIMIZER:
case LLModelPreview::MESH_OPTIMIZER_SLOPPY:
@ -1738,8 +1735,7 @@ void LLFloaterModelPreview::onLoDSourceCommit(S32 lod)
LLComboBox* lod_source_combo = getChild<LLComboBox>("lod_source_" + lod_name[lod]);
S32 index = lod_source_combo->getCurrentIndex();
if (index == LLModelPreview::GENERATE
|| index == LLModelPreview::MESH_OPTIMIZER_AUTO
if (index == LLModelPreview::MESH_OPTIMIZER_AUTO
|| index == LLModelPreview::MESH_OPTIMIZER
|| index == LLModelPreview::MESH_OPTIMIZER_SLOPPY
|| index == LLModelPreview::MESH_OPTIMIZER_COMBINE)

View File

@ -67,7 +67,6 @@
#include "lltabcontainer.h"
#include "lltextbox.h"
#include "glod/glod.h"
#include <boost/algorithm/string.hpp>
bool LLModelPreview::sIgnoreLoadedCallback = false;
@ -90,19 +89,6 @@ static const F32 PREVIEW_ZOOM_LIMIT(10.f);
const F32 SKIN_WEIGHT_CAMERA_DISTANCE = 16.f;
BOOL stop_gloderror()
{
GLuint error = glodGetError();
if (error != GLOD_NO_ERROR)
{
LL_WARNS() << "GLOD error detected, cannot generate LOD: " << std::hex << error << LL_ENDL;
return TRUE;
}
return FALSE;
}
LLViewerFetchedTexture* bindMaterialDiffuseTexture(const LLImportMaterial& material)
{
LLViewerFetchedTexture *texture = LLViewerTextureManager::getFetchedTexture(material.getDiffuseMap(), FTT_DEFAULT, TRUE, LLGLTexture::BOOST_PREVIEW);
@ -202,10 +188,6 @@ LLModelPreview::LLModelPreview(S32 width, S32 height, LLFloater* fmp)
mLoadState = LLModelLoader::STARTING;
mGroup = 0;
mLODFrozen = false;
mBuildShareTolerance = 0.f;
mBuildQueueMode = GLOD_QUEUE_GREEDY;
mBuildBorderMode = GLOD_BORDER_UNLOCK;
mBuildOperator = GLOD_OPERATOR_EDGE_COLLAPSE;
for (U32 i = 0; i < LLModel::NUM_LODS; ++i)
{
@ -213,10 +195,6 @@ LLModelPreview::LLModelPreview(S32 width, S32 height, LLFloater* fmp)
mRequestedCreaseAngle[i] = -1.f;
mRequestedLoDMode[i] = 0;
mRequestedErrorThreshold[i] = 0.f;
mRequestedBuildOperator[i] = 0;
mRequestedQueueMode[i] = 0;
mRequestedBorderMode[i] = 0;
mRequestedShareTolerance[i] = 0.f;
}
mViewOption["show_textures"] = false;
@ -226,23 +204,11 @@ LLModelPreview::LLModelPreview(S32 width, S32 height, LLFloater* fmp)
mHasPivot = false;
mModelPivot = LLVector3(0.0f, 0.0f, 0.0f);
glodInit();
createPreviewAvatar();
}
LLModelPreview::~LLModelPreview()
{
// glod apparently has internal mem alignment issues that are angering
// the heap-check code in windows, these should be hunted down in that
// TP code, if possible
//
// kernel32.dll!HeapFree() + 0x14 bytes
// msvcr100.dll!free(void * pBlock) Line 51 C
// glod.dll!glodGetGroupParameteriv() + 0x119 bytes
// glod.dll!glodShutdown() + 0x77 bytes
//
//glodShutdown();
if (mModelLoader)
{
mModelLoader->shutdown();
@ -828,11 +794,6 @@ void LLModelPreview::loadModel(std::string filename, S32 lod, bool force_disable
mLODFile[lod] = filename;
if (lod == LLModel::LOD_HIGH)
{
clearGLODGroup();
}
std::map<std::string, std::string> joint_alias_map;
getJointAliases(joint_alias_map);
@ -933,7 +894,6 @@ void LLModelPreview::clearIncompatible(S32 lod)
if (i == LLModel::LOD_HIGH)
{
mBaseModel = mModel[lod];
clearGLODGroup();
mBaseScene = mScene[lod];
mVertexBuffer[5].clear();
}
@ -942,23 +902,6 @@ void LLModelPreview::clearIncompatible(S32 lod)
}
}
void LLModelPreview::clearGLODGroup()
{
if (mGroup)
{
for (std::map<LLPointer<LLModel>, U32>::iterator iter = mObject.begin(); iter != mObject.end(); ++iter)
{
glodDeleteObject(iter->second);
stop_gloderror();
}
mObject.clear();
glodDeleteGroup(mGroup);
stop_gloderror();
mGroup = 0;
}
}
void LLModelPreview::loadModelCallback(S32 loaded_lod)
{
assert_main_thread();
@ -1110,7 +1053,6 @@ void LLModelPreview::loadModelCallback(S32 loaded_lod)
}
mBaseModel = mModel[loaded_lod];
clearGLODGroup();
mBaseScene = mScene[loaded_lod];
mVertexBuffer[5].clear();
@ -1341,373 +1283,6 @@ void LLModelPreview::restoreNormals()
updateStatusMessages();
}
void LLModelPreview::genGlodLODs(S32 which_lod, U32 decimation, bool enforce_tri_limit)
{
LL_INFOS() << "Generating lod " << which_lod << " using glod" << LL_ENDL;
// Allow LoD from -1 to LLModel::LOD_PHYSICS
if (which_lod < -1 || which_lod > LLModel::NUM_LODS - 1)
{
std::ostringstream out;
out << "Invalid level of detail: " << which_lod;
LL_WARNS() << out.str() << LL_ENDL;
LLFloaterModelPreview::addStringToLog(out, false);
assert(which_lod >= -1 && which_lod < LLModel::NUM_LODS);
return;
}
if (mBaseModel.empty())
{
return;
}
LLVertexBuffer::unbind();
bool no_ff = LLGLSLShader::sNoFixedFunction;
LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
LLGLSLShader::sNoFixedFunction = false;
if (shader)
{
shader->unbind();
}
stop_gloderror();
static U32 cur_name = 1;
S32 limit = -1;
U32 triangle_count = 0;
U32 instanced_triangle_count = 0;
//get the triangle count for the whole scene
for (LLModelLoader::scene::iterator iter = mBaseScene.begin(), endIter = mBaseScene.end(); iter != endIter; ++iter)
{
for (LLModelLoader::model_instance_list::iterator instance = iter->second.begin(), end_instance = iter->second.end(); instance != end_instance; ++instance)
{
LLModel* mdl = instance->mModel;
if (mdl)
{
instanced_triangle_count += mdl->getNumTriangles();
}
}
}
//get the triangle count for the non-instanced set of models
for (U32 i = 0; i < mBaseModel.size(); ++i)
{
triangle_count += mBaseModel[i]->getNumTriangles();
}
//get ratio of uninstanced triangles to instanced triangles
F32 triangle_ratio = (F32)triangle_count / (F32)instanced_triangle_count;
U32 base_triangle_count = triangle_count;
U32 type_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD0;
U32 lod_mode = LIMIT_TRIANGLES;
F32 lod_error_threshold = 0;
// The LoD should be in range from Lowest to High
if (which_lod > -1 && which_lod < NUM_LOD)
{
LLCtrlSelectionInterface* iface = mFMP->childGetSelectionInterface("lod_mode_" + lod_name[which_lod]);
if (iface)
{
lod_mode = iface->getFirstSelectedIndex();
}
lod_error_threshold = mFMP->childGetValue("lod_error_threshold_" + lod_name[which_lod]).asReal();
}
if (which_lod != -1)
{
mRequestedLoDMode[which_lod] = lod_mode;
}
if (lod_mode == LIMIT_TRIANGLES)
{
lod_mode = GLOD_TRIANGLE_BUDGET;
// The LoD should be in range from Lowest to High
if (which_lod > -1 && which_lod < NUM_LOD)
{
limit = mFMP->childGetValue("lod_triangle_limit_" + lod_name[which_lod]).asInteger();
//convert from "scene wide" to "non-instanced" triangle limit
limit = (S32)((F32)limit*triangle_ratio);
}
}
else
{
lod_mode = GLOD_ERROR_THRESHOLD;
}
bool object_dirty = false;
if (mGroup == 0)
{
object_dirty = true;
mGroup = cur_name++;
glodNewGroup(mGroup);
}
if (object_dirty)
{
for (LLModelLoader::model_list::iterator iter = mBaseModel.begin(); iter != mBaseModel.end(); ++iter)
{ //build GLOD objects for each model in base model list
LLModel* mdl = *iter;
if (mObject[mdl] != 0)
{
glodDeleteObject(mObject[mdl]);
}
mObject[mdl] = cur_name++;
glodNewObject(mObject[mdl], mGroup, GLOD_DISCRETE);
stop_gloderror();
if (iter == mBaseModel.begin() && !mdl->mSkinWeights.empty())
{ //regenerate vertex buffer for skinned models to prevent animation feedback during LOD generation
mVertexBuffer[5].clear();
}
if (mVertexBuffer[5].empty())
{
genBuffers(5, false);
}
U32 tri_count = 0;
for (U32 i = 0; i < mVertexBuffer[5][mdl].size(); ++i)
{
LLVertexBuffer* buff = mVertexBuffer[5][mdl][i];
buff->setBuffer(type_mask & buff->getTypeMask());
U32 num_indices = mVertexBuffer[5][mdl][i]->getNumIndices();
if (num_indices > 2)
{
glodInsertElements(mObject[mdl], i, GL_TRIANGLES, num_indices, GL_UNSIGNED_SHORT, (U8*)mVertexBuffer[5][mdl][i]->getIndicesPointer(), 0, 0.f);
}
tri_count += num_indices / 3;
stop_gloderror();
}
glodBuildObject(mObject[mdl]);
stop_gloderror();
}
}
S32 start = LLModel::LOD_HIGH;
S32 end = 0;
if (which_lod != -1)
{
start = end = which_lod;
}
mMaxTriangleLimit = base_triangle_count;
mMinTriangleLimit = mBaseModel.size();
for (S32 lod = start; lod >= end; --lod)
{
if (which_lod == -1)
{
if (lod < start)
{
triangle_count /= decimation;
}
}
else
{
if (enforce_tri_limit)
{
triangle_count = limit;
}
else
{
for (S32 j = LLModel::LOD_HIGH; j>which_lod; --j)
{
triangle_count /= decimation;
}
}
}
mModel[lod].clear();
mModel[lod].resize(mBaseModel.size());
mVertexBuffer[lod].clear();
U32 actual_tris = 0;
U32 actual_verts = 0;
U32 submeshes = 0;
mRequestedTriangleCount[lod] = llmax(mMinTriangleLimit, (S32)((F32)triangle_count / triangle_ratio));
mRequestedErrorThreshold[lod] = lod_error_threshold;
glodGroupParameteri(mGroup, GLOD_ADAPT_MODE, lod_mode);
stop_gloderror();
glodGroupParameteri(mGroup, GLOD_ERROR_MODE, GLOD_OBJECT_SPACE_ERROR);
stop_gloderror();
glodGroupParameterf(mGroup, GLOD_OBJECT_SPACE_ERROR_THRESHOLD, lod_error_threshold);
stop_gloderror();
if (lod_mode != GLOD_TRIANGLE_BUDGET)
{
glodGroupParameteri(mGroup, GLOD_MAX_TRIANGLES, 0);
}
else
{
//SH-632: always add 1 to desired amount to avoid decimating below desired amount
glodGroupParameteri(mGroup, GLOD_MAX_TRIANGLES, triangle_count + 1);
}
stop_gloderror();
glodAdaptGroup(mGroup);
stop_gloderror();
for (U32 mdl_idx = 0; mdl_idx < mBaseModel.size(); ++mdl_idx)
{
LLModel* base = mBaseModel[mdl_idx];
GLint patch_count = 0;
glodGetObjectParameteriv(mObject[base], GLOD_NUM_PATCHES, &patch_count);
stop_gloderror();
LLVolumeParams volume_params;
volume_params.setType(LL_PCODE_PROFILE_SQUARE, LL_PCODE_PATH_LINE);
mModel[lod][mdl_idx] = new LLModel(volume_params, 0.f);
std::string name = base->mLabel + getLodSuffix(lod);
mModel[lod][mdl_idx]->mLabel = name;
mModel[lod][mdl_idx]->mSubmodelID = base->mSubmodelID;
GLint* sizes = new GLint[patch_count * 2];
glodGetObjectParameteriv(mObject[base], GLOD_PATCH_SIZES, sizes);
stop_gloderror();
GLint* names = new GLint[patch_count];
glodGetObjectParameteriv(mObject[base], GLOD_PATCH_NAMES, names);
stop_gloderror();
mModel[lod][mdl_idx]->setNumVolumeFaces(patch_count);
LLModel* target_model = mModel[lod][mdl_idx];
for (GLint i = 0; i < patch_count; ++i)
{
type_mask = mVertexBuffer[5][base][i]->getTypeMask();
LLPointer<LLVertexBuffer> buff = new LLVertexBuffer(type_mask, 0);
if (sizes[i * 2 + 1] > 0 && sizes[i * 2] > 0)
{
if (!buff->allocateBuffer(sizes[i * 2 + 1], sizes[i * 2], true))
{
// Todo: find a way to stop preview in this case instead of crashing
LL_ERRS() << "Failed buffer allocation during preview LOD generation."
<< " Vertices: " << sizes[i * 2 + 1]
<< " Indices: " << sizes[i * 2] << LL_ENDL;
}
buff->setBuffer(type_mask);
glodFillElements(mObject[base], names[i], GL_UNSIGNED_SHORT, (U8*)buff->getIndicesPointer());
stop_gloderror();
}
else
{
// This face was eliminated or we failed to allocate buffer,
// attempt to create a dummy triangle (one vertex, 3 indices, all 0)
buff->allocateBuffer(1, 3, true);
memset((U8*)buff->getMappedData(), 0, buff->getSize());
memset((U8*)buff->getIndicesPointer(), 0, buff->getIndicesSize());
}
buff->validateRange(0, buff->getNumVerts() - 1, buff->getNumIndices(), 0);
LLStrider<LLVector3> pos;
LLStrider<LLVector3> norm;
LLStrider<LLVector2> tc;
LLStrider<U16> index;
buff->getVertexStrider(pos);
if (type_mask & LLVertexBuffer::MAP_NORMAL)
{
buff->getNormalStrider(norm);
}
if (type_mask & LLVertexBuffer::MAP_TEXCOORD0)
{
buff->getTexCoord0Strider(tc);
}
buff->getIndexStrider(index);
target_model->setVolumeFaceData(names[i], pos, norm, tc, index, buff->getNumVerts(), buff->getNumIndices());
actual_tris += buff->getNumIndices() / 3;
actual_verts += buff->getNumVerts();
++submeshes;
if (!validate_face(target_model->getVolumeFace(names[i])))
{
LL_ERRS() << "Invalid face generated during LOD generation." << LL_ENDL;
}
}
//blind copy skin weights and just take closest skin weight to point on
//decimated mesh for now (auto-generating LODs with skin weights is still a bit
//of an open problem).
target_model->mPosition = base->mPosition;
target_model->mSkinWeights = base->mSkinWeights;
target_model->mSkinInfo = base->mSkinInfo;
//copy material list
target_model->mMaterialList = base->mMaterialList;
if (!validate_model(target_model))
{
LL_ERRS() << "Invalid model generated when creating LODs" << LL_ENDL;
}
delete[] sizes;
delete[] names;
}
//rebuild scene based on mBaseScene
mScene[lod].clear();
mScene[lod] = mBaseScene;
for (U32 i = 0; i < mBaseModel.size(); ++i)
{
LLModel* mdl = mBaseModel[i];
LLModel* target = mModel[lod][i];
if (target)
{
for (LLModelLoader::scene::iterator iter = mScene[lod].begin(); iter != mScene[lod].end(); ++iter)
{
for (U32 j = 0; j < iter->second.size(); ++j)
{
if (iter->second[j].mModel == mdl)
{
iter->second[j].mModel = target;
}
}
}
}
}
}
mResourceCost = calcResourceCost();
LLVertexBuffer::unbind();
LLGLSLShader::sNoFixedFunction = no_ff;
if (shader)
{
shader->bind();
}
}
// Runs per object, but likely it is a better way to run per model+submodels
// returns a ratio of base model indices to resulting indices
// returns -1 in case of failure
@ -2104,9 +1679,6 @@ void LLModelPreview::genMeshOptimizerLODs(S32 which_lod, S32 meshopt_mode, U32 d
mMaxTriangleLimit = base_triangle_count;
mMinTriangleLimit = mBaseModel.size();
// TODO: Glod regenerates vertex buffer at this stage
// check why, it might be needed to regenerate buffer as well
// Build models
S32 start = LLModel::LOD_HIGH;
@ -3573,7 +3145,6 @@ BOOL LLModelPreview::render()
{
genBuffers(-1, skin_weight);
//genBuffers(3);
//genGlodLODs();
}
if (!mModel[mPreviewLOD].empty())
@ -4175,15 +3746,6 @@ bool LLModelPreview::lodQueryCallback()
return true;
}
void LLModelPreview::onLODGenerateParamCommit(S32 lod, bool enforce_tri_limit)
{
if (!mLODFrozen)
{
genGlodLODs(lod, 3, enforce_tri_limit);
refresh();
}
}
void LLModelPreview::onLODMeshOptimizerParamCommit(S32 requested_lod, bool enforce_tri_limit, S32 mode)
{
if (!mLODFrozen)

View File

@ -124,7 +124,6 @@ public:
typedef enum
{
LOD_FROM_FILE = 0,
GENERATE,
MESH_OPTIMIZER_AUTO, // automatically selects method based on model or face
MESH_OPTIMIZER_COMBINE,
MESH_OPTIMIZER,
@ -165,7 +164,6 @@ public:
void loadModelCallback(S32 lod);
bool lodsReady() { return !mGenLOD && mLodsQuery.empty(); }
void queryLODs() { mGenLOD = true; };
void genGlodLODs(S32 which_lod = -1, U32 decimation = 3, bool enforce_tri_limit = false);
void genMeshOptimizerLODs(S32 which_lod, S32 meshopt_mode, U32 decimation = 3, bool enforce_tri_limit = false);
void generateNormals();
void restoreNormals();
@ -176,8 +174,6 @@ public:
void clearIncompatible(S32 lod);
void updateStatusMessages();
void updateLodControls(S32 lod);
void clearGLODGroup();
void onLODGenerateParamCommit(S32 lod, bool enforce_tri_limit);
void onLODMeshOptimizerParamCommit(S32 lod, bool enforce_tri_limit, S32 mode);
void addEmptyFace(LLModel* pTarget);
@ -265,19 +261,11 @@ protected:
std::map<std::string, bool> mViewOption;
//GLOD object parameters (must rebuild object if these change)
// Model generation parameters (must rebuild object if these change)
bool mLODFrozen;
F32 mBuildShareTolerance;
U32 mBuildQueueMode;
U32 mBuildOperator;
U32 mBuildBorderMode;
U32 mRequestedLoDMode[LLModel::NUM_LODS];
S32 mRequestedTriangleCount[LLModel::NUM_LODS];
F32 mRequestedErrorThreshold[LLModel::NUM_LODS];
U32 mRequestedBuildOperator[LLModel::NUM_LODS];
U32 mRequestedQueueMode[LLModel::NUM_LODS];
U32 mRequestedBorderMode[LLModel::NUM_LODS];
F32 mRequestedShareTolerance[LLModel::NUM_LODS];
F32 mRequestedCreaseAngle[LLModel::NUM_LODS];
LLModelLoader* mModelLoader;

View File

@ -101,7 +101,6 @@ Dummy Name replaced at run time
expat Copyright (C) 1998, 1999, 2000 Thai Open Source Software Center Ltd.
FreeType Copyright (C) 1996-2002, 2006 David Turner, Robert Wilhelm, and Werner Lemberg.
GL Copyright (C) 1999-2004 Brian Paul.
GLOD Copyright (C) 2003-04 Jonathan Cohen, Nat Duca, Chris Niski, Johns Hopkins University and David Luebke, Brenden Schubert, University of Virginia.
google-perftools Copyright (c) 2005, Google Inc.
Havok.com(TM) Copyright (C) 1999-2001, Telekinesys Research Limited.
jpeg2000 Copyright (C) 2001, David Taubman, The University of New South Wales (UNSW)

View File

@ -187,24 +187,20 @@
label="Load from file"
value="Load from file" />
<item
name="Generate"
label="Generate"
value="Generate" />
<item
name="MeshOpt"
label="Simplify (auto)"
value="MeshOpt" />
name="MeshOpt Auto"
label="Generate Auto"
value="MeshOpt Auto" />
<item
name="MeshOptCombine"
label="Simplify per object"
label="Generate Precise"
value="MeshOptCombine" />
<item
name="MeshOpt"
label="Simplify per face"
label="Generate per face"
value="MeshOpt" />
<item
name="MeshOptSloppy"
label="Simplify sloppy"
label="Generate Sloppy"
value="MeshOptSloppy" />
</combo_box>
<line_editor
@ -332,24 +328,20 @@
label="Load from file"
value="Load from file" />
<item
name="Generate"
label="Generate"
value="Generate" />
<item
name="MeshOpt"
label="Simplify (auto)"
value="MeshOpt" />
name="MeshOpt Auto"
label="Generate Auto"
value="MeshOpt Auto" />
<item
name="MeshOptCombine"
label="Simplify per object"
label="Generate Precise"
value="MeshOptCombine" />
<item
name="MeshOpt"
label="Simplify per face"
label="Generate per face"
value="MeshOpt" />
<item
name="MeshOptSloppy"
label="Simplify sloppy"
label="Generate Sloppy"
value="MeshOptSloppy" />
<item
name="Use LoD above"
@ -481,24 +473,20 @@
label="Load from file"
value="Load from file" />
<item
name="Generate"
label="Generate"
value="Generate" />
<item
name="MeshOpt"
label="Simplify (auto)"
value="MeshOpt" />
name="MeshOpt Auto"
label="Generate Auto"
value="MeshOpt Auto" />
<item
name="MeshOptCombine"
label="Simplify per object"
label="Generate Precise"
value="MeshOptCombine" />
<item
name="MeshOpt"
label="Simplify per face"
label="Generate per face"
value="MeshOpt" />
<item
name="MeshOptSloppy"
label="Simplify sloppy"
label="Generate Sloppy"
value="MeshOptSloppy" />
<item
name="Use LoD above"
@ -630,24 +618,20 @@
label="Load from file"
value="Load from file" />
<item
name="Generate"
label="Generate"
value="Generate" />
<item
name="MeshOpt"
label="Simplify (auto)"
value="MeshOpt" />
name="MeshOpt Auto"
label="Generate Auto"
value="MeshOpt Auto" />
<item
name="MeshOptCombine"
label="Simplify per object"
label="Generate Precise"
value="MeshOptCombine" />
<item
name="MeshOpt"
label="Simplify per face"
label="Generate per face"
value="MeshOpt" />
<item
name="MeshOptSloppy"
label="Simplify sloppy"
label="Generate Sloppy"
value="MeshOptSloppy" />
<item
name="Use LoD above"

View File

@ -510,14 +510,6 @@ class WindowsManifest(ViewerManifest):
# Get shared libs from the shared libs staging directory
with self.prefix(src=os.path.join(self.args['build'], os.pardir,
'sharedlibs', self.args['configuration'])):
# Mesh 3rd party libs needed for auto LOD and collada reading
try:
self.path("glod.dll")
except RuntimeError as err:
print err.message
print "Skipping GLOD library (assumming linked statically)"
# Get fmodstudio dll if needed
if self.args['fmodstudio'] == 'ON':
if(self.args['configuration'].lower() == 'debug'):
@ -1029,7 +1021,6 @@ class DarwinManifest(ViewerManifest):
"libapr-1.0.dylib",
"libaprutil-1.0.dylib",
"libexpat.1.dylib",
"libGLOD.dylib",
# libnghttp2.dylib is a symlink to
# libnghttp2.major.dylib, which is a symlink to
# libnghttp2.version.dylib. Get all of them.
@ -1473,7 +1464,6 @@ class Linux_i686_Manifest(LinuxManifest):
self.path("libaprutil-1.so.0.4.1")
self.path("libdb*.so")
self.path("libexpat.so.*")
self.path("libGLOD.so")
self.path("libuuid.so*")
self.path("libSDL-1.2.so.*")
self.path("libdirectfb-1.*.so.*")