Updates for non-allocating llsd changes (via Rye)
parent
4eeb96a935
commit
a38e971f8d
|
|
@ -2403,7 +2403,27 @@ bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size)
|
|||
LL_DEBUGS("MeshStreaming") << "Failed to unzip LLSD blob for LoD with code " << uzip_result << " , will probably fetch from sim again." << LL_ENDL;
|
||||
return false;
|
||||
}
|
||||
|
||||
// <FS:Beq pp Rye> Add non-allocating variants of of unpackVolumeFaces
|
||||
return unpackVolumeFacesInternal(mdl);
|
||||
}
|
||||
|
||||
bool LLVolume::unpackVolumeFaces(U8* in_data, S32 size)
|
||||
{
|
||||
//input stream is now pointing at a zlib compressed block of LLSD
|
||||
//decompress block
|
||||
LLSD mdl;
|
||||
U32 uzip_result = LLUZipHelper::unzip_llsd(mdl, in_data, size);
|
||||
if (uzip_result != LLUZipHelper::ZR_OK)
|
||||
{
|
||||
LL_DEBUGS("MeshStreaming") << "Failed to unzip LLSD blob for LoD with code " << uzip_result << " , will probably fetch from sim again." << LL_ENDL;
|
||||
return false;
|
||||
}
|
||||
return unpackVolumeFacesInternal(mdl);
|
||||
}
|
||||
|
||||
bool LLVolume::unpackVolumeFacesInternal(const LLSD& mdl)
|
||||
{
|
||||
// </FS:Beq pp Rye>
|
||||
{
|
||||
U32 face_count = mdl.size();
|
||||
|
||||
|
|
|
|||
|
|
@ -1099,7 +1099,13 @@ protected:
|
|||
void createVolumeFaces();
|
||||
public:
|
||||
virtual bool unpackVolumeFaces(std::istream& is, S32 size);
|
||||
// <FS:Beq pp Rye> Add non-allocating variants of of unpackVolumeFaces
|
||||
bool unpackVolumeFaces(U8* in_data, S32 size);
|
||||
private:
|
||||
bool unpackVolumeFacesInternal(const LLSD& mdl);
|
||||
|
||||
public:
|
||||
// </FS:Beq pp Rye>
|
||||
virtual void setMeshAssetLoaded(BOOL loaded);
|
||||
virtual BOOL isMeshAssetLoaded();
|
||||
|
||||
|
|
|
|||
|
|
@ -918,9 +918,15 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update)
|
|||
// MAINT-7926 Handle volumes in an animated object as a special case
|
||||
// SL-937: add dynamic box handling for rigged mesh on regular avatars.
|
||||
//if (volume->getAvatar() && volume->getAvatar()->isControlAvatar())
|
||||
if (volume->getAvatar())
|
||||
// <FS:Beq pp Rye> reduce recursive calls.
|
||||
// if (volume->getAvatar())
|
||||
// {
|
||||
// const LLVector3* av_box = volume->getAvatar()->getLastAnimExtents();
|
||||
LLVOAvatar* avatarp = volume->getAvatar();
|
||||
if (avatarp)
|
||||
{
|
||||
const LLVector3* av_box = volume->getAvatar()->getLastAnimExtents();
|
||||
const LLVector3* av_box = avatarp->getLastAnimExtents();
|
||||
// </FS:Beq pp Rye>
|
||||
LLVector3 cam_pos_from_agent = LLViewerCamera::getInstance()->getOrigin();
|
||||
LLVector3 cam_to_box_offset = point_to_box_offset(cam_pos_from_agent, av_box);
|
||||
mDistanceWRTCamera = llmax(0.01f, ll_round(cam_to_box_offset.magVec(), 0.01f));
|
||||
|
|
|
|||
|
|
@ -477,7 +477,10 @@ void LLMaterialMgr::onGetAllResponse(bool success, const LLSD& content, const LL
|
|||
std::istringstream content_stream(content_string);
|
||||
|
||||
LLSD response_data;
|
||||
U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_stream, content_binary.size());
|
||||
// <FS:Beq pp Rye> Use new variant unzip_llsd
|
||||
// U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_stream, content_binary.size());
|
||||
U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_binary.data(), content_binary.size());
|
||||
// </FS:Beq pp Rye>
|
||||
if (uzip_result != LLUZipHelper::ZR_OK)
|
||||
{
|
||||
LL_WARNS("Materials") << "Cannot unzip LLSD binary content: " << uzip_result << LL_ENDL;
|
||||
|
|
|
|||
|
|
@ -78,6 +78,10 @@
|
|||
#include "llfloaterreg.h"
|
||||
|
||||
#include "boost/lexical_cast.hpp"
|
||||
// <FS:Beq pp Rye> Reduce temporaries and copes in decoding mesh headers
|
||||
#include <boost/iostreams/device/array.hpp>
|
||||
#include <boost/iostreams/stream.hpp>
|
||||
// </FS:Beq pp Rye>
|
||||
|
||||
#ifndef LL_WINDOWS
|
||||
#include "netdb.h"
|
||||
|
|
@ -1901,27 +1905,35 @@ EMeshProcessingResult LLMeshRepoThread::headerReceived(const LLVolumeParams& mes
|
|||
U32 header_size = 0;
|
||||
if (data_size > 0)
|
||||
{
|
||||
std::istringstream stream;
|
||||
try
|
||||
{
|
||||
std::string res_str((char*)data, data_size);
|
||||
// <FS:Beq pp Rye> Reduce temporaries and copes in decoding mesh headers
|
||||
// std::istringstream stream;
|
||||
// try
|
||||
// {
|
||||
// std::string res_str((char*)data, data_size);
|
||||
|
||||
std::string deprecated_header("<? LLSD/Binary ?>");
|
||||
// std::string deprecated_header("<? LLSD/Binary ?>");
|
||||
|
||||
if (res_str.substr(0, deprecated_header.size()) == deprecated_header)
|
||||
{
|
||||
res_str = res_str.substr(deprecated_header.size() + 1, data_size);
|
||||
header_size = deprecated_header.size() + 1;
|
||||
}
|
||||
data_size = res_str.size();
|
||||
// if (res_str.substr(0, deprecated_header.size()) == deprecated_header)
|
||||
// {
|
||||
// res_str = res_str.substr(deprecated_header.size() + 1, data_size);
|
||||
// header_size = deprecated_header.size() + 1;
|
||||
// }
|
||||
// data_size = res_str.size();
|
||||
|
||||
stream.str(res_str);
|
||||
}
|
||||
catch (std::bad_alloc&)
|
||||
{
|
||||
// out of memory, we won't be able to process this mesh
|
||||
return MESH_OUT_OF_MEMORY;
|
||||
}
|
||||
// stream.str(res_str);
|
||||
// }
|
||||
// catch (std::bad_alloc&)
|
||||
// {
|
||||
// // out of memory, we won't be able to process this mesh
|
||||
// return MESH_OUT_OF_MEMORY;
|
||||
// }
|
||||
U32 dsize = data_size;
|
||||
char* result_ptr = strip_deprecated_header((char*)data, dsize, &header_size);
|
||||
|
||||
data_size = dsize;
|
||||
|
||||
boost::iostreams::stream<boost::iostreams::array_source> stream(result_ptr, data_size);
|
||||
// </FS:Beq pp Rye>
|
||||
|
||||
if (!LLSDSerialize::fromBinary(header, stream, data_size))
|
||||
{
|
||||
|
|
@ -1990,19 +2002,22 @@ EMeshProcessingResult LLMeshRepoThread::lodReceived(const LLVolumeParams& mesh_p
|
|||
}
|
||||
|
||||
LLPointer<LLVolume> volume = new LLVolume(mesh_params, LLVolumeLODGroup::getVolumeScaleFromDetail(lod));
|
||||
std::istringstream stream;
|
||||
try
|
||||
{
|
||||
std::string mesh_string((char*)data, data_size);
|
||||
stream.str(mesh_string);
|
||||
}
|
||||
catch (std::bad_alloc&)
|
||||
{
|
||||
// out of memory, we won't be able to process this mesh
|
||||
return MESH_OUT_OF_MEMORY;
|
||||
}
|
||||
// <FS:Beq pp Rye> Reduce temporaries and copes in decoding mesh headers
|
||||
// std::istringstream stream;
|
||||
// try
|
||||
// {
|
||||
// std::string mesh_string((char*)data, data_size);
|
||||
// stream.str(mesh_string);
|
||||
// }
|
||||
// catch (std::bad_alloc&)
|
||||
// {
|
||||
// // out of memory, we won't be able to process this mesh
|
||||
// return MESH_OUT_OF_MEMORY;
|
||||
// }
|
||||
|
||||
if (volume->unpackVolumeFaces(stream, data_size))
|
||||
// if (volume->unpackVolumeFaces(stream, data_size))
|
||||
if (volume->unpackVolumeFaces(data, data_size))
|
||||
// </FS:Beq pp Rye>
|
||||
{
|
||||
if (volume->getNumFaces() > 0)
|
||||
{
|
||||
|
|
@ -2032,10 +2047,13 @@ bool LLMeshRepoThread::skinInfoReceived(const LLUUID& mesh_id, U8* data, S32 dat
|
|||
{
|
||||
try
|
||||
{
|
||||
std::string res_str((char*)data, data_size);
|
||||
std::istringstream stream(res_str);
|
||||
// <FS:Beq pp Rye> Reduce temporaries and copes in decoding mesh headers
|
||||
// std::string res_str((char*)data, data_size);
|
||||
// std::istringstream stream(res_str);
|
||||
|
||||
U32 uzip_result = LLUZipHelper::unzip_llsd(skin, stream, data_size);
|
||||
// U32 uzip_result = LLUZipHelper::unzip_llsd(skin, stream, data_size);
|
||||
U32 uzip_result = LLUZipHelper::unzip_llsd(skin, data, data_size);
|
||||
// </FS:Beq pp Rye>
|
||||
if (uzip_result != LLUZipHelper::ZR_OK)
|
||||
{
|
||||
LL_WARNS(LOG_MESH) << "Mesh skin info parse error. Not a valid mesh asset! ID: " << mesh_id
|
||||
|
|
@ -2073,10 +2091,13 @@ bool LLMeshRepoThread::decompositionReceived(const LLUUID& mesh_id, U8* data, S3
|
|||
{
|
||||
try
|
||||
{
|
||||
std::string res_str((char*)data, data_size);
|
||||
std::istringstream stream(res_str);
|
||||
// <FS:Beq pp Rye> Reduce temporaries and copes in decoding mesh headers
|
||||
// std::string res_str((char*)data, data_size);
|
||||
// std::istringstream stream(res_str);
|
||||
|
||||
U32 uzip_result = LLUZipHelper::unzip_llsd(decomp, stream, data_size);
|
||||
// U32 uzip_result = LLUZipHelper::unzip_llsd(decomp, stream, data_size);
|
||||
U32 uzip_result = LLUZipHelper::unzip_llsd(decomp, data, data_size);
|
||||
// <FS:Beq pp Rye>
|
||||
if (uzip_result != LLUZipHelper::ZR_OK)
|
||||
{
|
||||
LL_WARNS(LOG_MESH) << "Mesh decomposition parse error. Not a valid mesh asset! ID: " << mesh_id
|
||||
|
|
@ -2085,7 +2106,7 @@ bool LLMeshRepoThread::decompositionReceived(const LLUUID& mesh_id, U8* data, S3
|
|||
return false;
|
||||
}
|
||||
}
|
||||
catch (std::bad_alloc&)
|
||||
catch (const std::bad_alloc&) // <FS:Beq pp Rye/> const cos const!
|
||||
{
|
||||
LL_WARNS(LOG_MESH) << "Out of memory for mesh ID " << mesh_id << " of size: " << data_size << LL_ENDL;
|
||||
return false;
|
||||
|
|
@ -2122,20 +2143,22 @@ EMeshProcessingResult LLMeshRepoThread::physicsShapeReceived(const LLUUID& mesh_
|
|||
volume_params.setSculptID(mesh_id, LL_SCULPT_TYPE_MESH);
|
||||
LLPointer<LLVolume> volume = new LLVolume(volume_params,0);
|
||||
|
||||
std::istringstream stream;
|
||||
try
|
||||
{
|
||||
std::string mesh_string((char*)data, data_size);
|
||||
stream.str(mesh_string);
|
||||
}
|
||||
catch (std::bad_alloc&)
|
||||
{
|
||||
// out of memory, we won't be able to process this mesh
|
||||
delete d;
|
||||
return MESH_OUT_OF_MEMORY;
|
||||
}
|
||||
// <FS:Beq pp Rye> Reduce temporaries and copes in decoding mesh headers
|
||||
// std::istringstream stream;
|
||||
// try
|
||||
// {
|
||||
// std::string mesh_string((char*)data, data_size);
|
||||
// stream.str(mesh_string);
|
||||
// }
|
||||
// catch (std::bad_alloc&)
|
||||
// {
|
||||
// // out of memory, we won't be able to process this mesh
|
||||
// delete d;
|
||||
// return MESH_OUT_OF_MEMORY;
|
||||
// }
|
||||
|
||||
if (volume->unpackVolumeFaces(stream, data_size))
|
||||
// if (volume->unpackVolumeFaces(stream, data_size))
|
||||
if (volume->unpackVolumeFaces(data, data_size))
|
||||
{
|
||||
//load volume faces into decomposition buffer
|
||||
S32 vertex_count = 0;
|
||||
|
|
|
|||
|
|
@ -140,12 +140,17 @@ void LLPathfindingNavMesh::handleNavMeshResult(const LLSD &pContent, U32 pNavMes
|
|||
if ( pContent.has(NAVMESH_DATA_FIELD) )
|
||||
{
|
||||
const LLSD::Binary &value = pContent.get(NAVMESH_DATA_FIELD).asBinary();
|
||||
unsigned int binSize = value.size();
|
||||
std::string newStr(reinterpret_cast<const char *>(&value[0]), binSize);
|
||||
std::istringstream streamdecomp( newStr );
|
||||
// <FS:Beq pp Rye> Use new variants of unzip_llsd calls
|
||||
// unsigned int binSize = value.size();
|
||||
// std::string newStr(reinterpret_cast<const char *>(&value[0]), binSize);
|
||||
// std::istringstream streamdecomp( newStr );
|
||||
// </FS:Beq pp Rye>
|
||||
unsigned int decompBinSize = 0;
|
||||
bool valid = false;
|
||||
U8* pUncompressedNavMeshContainer = unzip_llsdNavMesh( valid, decompBinSize, streamdecomp, binSize ) ;
|
||||
// <FS:Beq pp Rye> Use new variants of unzip_llsd calls
|
||||
// U8* pUncompressedNavMeshContainer = unzip_llsdNavMesh( valid, decompBinSize, streamdecomp, binSize ) ;
|
||||
U8* pUncompressedNavMeshContainer = unzip_llsdNavMesh( valid, decompBinSize, value.data(), value.size() ) ;
|
||||
// </FS:Beq pp Rye>
|
||||
if ( !valid )
|
||||
{
|
||||
LL_WARNS() << "Unable to decompress the navmesh llsd." << LL_ENDL;
|
||||
|
|
|
|||
Loading…
Reference in New Issue