Skip to content

Commit 26e4d34

Browse files
committed
fix llappearanceutility to be compatiable with viewer again
1 parent 50431f2 commit 26e4d34

15 files changed

+87
-88
lines changed

indra/cmake/LLAppearanceUtility.cmake

Lines changed: 0 additions & 12 deletions
This file was deleted.

indra/llappearanceutility/CMakeLists.txt

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,13 @@ project(appearance_utility)
55
include(00-Common)
66
include(Boost)
77
include(LLAppearance)
8-
include(LLCharacter)
98
include(LLCommon)
109
include(LLImage)
11-
include(LLInventory)
1210
include(LLMath)
13-
include(LLRender)
14-
include(LLVFS)
1511
include(LLWindow)
16-
include(LLXML)
1712
include(Linking)
1813
#include(GooglePerfTools)
1914

20-
include_directories(
21-
${LLCOMMON_INCLUDE_DIRS}
22-
${LLVFS_INCLUDE_DIRS}
23-
${LLWINDOW_INCLUDE_DIRS}
24-
${LLXML_INCLUDE_DIRS}
25-
${LLCHARACTER_INCLUDE_DIRS}
26-
${LLIMAGE_INCLUDE_DIRS}
27-
${LLMATH_INCLUDE_DIRS}
28-
${LLINVENTORY_INCLUDE_DIRS}
29-
${LLRENDER_INCLUDE_DIRS}
30-
${LLAPPEARANCE_INCLUDE_DIRS}
31-
)
3215

3316
set(appearance_utility_SOURCE_FILES
3417
appearance_utility.cpp
@@ -74,12 +57,12 @@ list(APPEND appearance_utility_SOURCE_FILES ${appearance_utility_HEADER_FILES})
7457
add_executable(appearance-utility-bin ${appearance_utility_SOURCE_FILES})
7558

7659
target_link_libraries(appearance-utility-bin
77-
${LLAPPEARANCE_LIBRARIES}
78-
${LLWINDOW_LIBRARIES}
79-
${BOOST_COROUTINE_LIBRARY}
80-
${BOOST_CONTEXT_LIBRARY}
81-
${BOOST_SYSTEM_LIBRARY}
82-
${TCMALLOC_LIBRARIES}
60+
llcharacter
61+
llinventory
62+
llappearance
63+
llwindow
64+
llrender
65+
llxml
8366
)
8467

8568
add_custom_target(appearance-utility-bin-target ALL

indra/llappearanceutility/llappappearanceutility.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ void LLAppAppearanceUtility::initializeIO()
398398
{
399399
// Make sure we can open the input file.
400400
std::ifstream* input_file = new std::ifstream();
401-
input_file->open( mInputFilename.c_str(), std::fstream::in );
401+
input_file->open( mInputFilename.c_str(), std::fstream::in | std::fstream::binary );
402402
if ( input_file->fail())
403403
{
404404
std::cerr << "Couldn't open input file '" << mInputFilename << "'." << std::endl;
@@ -454,7 +454,7 @@ bool LLAppAppearanceUtility::init()
454454
parseArguments();
455455

456456
bool log_to_stderr = true;
457-
LLError::initForApplication("", log_to_stderr);
457+
LLError::initForApplication(".", ".", true);
458458
if (mDebugMode)
459459
{
460460
mRecording.start();
@@ -475,8 +475,9 @@ bool LLAppAppearanceUtility::init()
475475
const S32 TEXTURE_REVERSE_BYTE_RANGE=50;
476476
LLImage::initClass(USE_TEXTURE_NEW_BYTE_RANGE, TEXTURE_REVERSE_BYTE_RANGE);
477477
const BOOL SKIP_ANALYZE_ALPHA=TRUE;
478-
LLImageGL::initClass(LLGLTexture::MAX_GL_IMAGE_CATEGORY, SKIP_ANALYZE_ALPHA);
479-
LLWearableType::initClass(new LLPassthroughTranslationBridge());
478+
479+
LLTranslationBridge::ptr_t trans = std::make_shared<LLPassthroughTranslationBridge>();
480+
LLWearableType::initParamSingleton(trans);
480481

481482
// *TODO: Create a texture bridge?
482483
LLAvatarAppearance::initClass();
@@ -648,7 +649,6 @@ bool LLAppAppearanceUtility::cleanup()
648649
}
649650

650651
LLAvatarAppearance::cleanupClass();
651-
LLWearableType::cleanupClass();
652652
LLImageGL::cleanupClass();
653653
LLImage::cleanupClass();
654654

indra/llappearanceutility/llbakingavatar.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ void LLBakingAvatar::bakedTextureDatasAsLLSD(LLSD& sd) const
8383
LLBakingTexLayerSet* layer_set = dynamic_cast<LLBakingTexLayerSet*>(baked_iter->mTexLayerSet);
8484
LLSD layer_sd;
8585
layer_set->asLLSD(layer_sd);
86-
sd[LLAvatarAppearanceDictionary::getInstance()->getTexture(baked_iter->mTextureIndex)->mName] = layer_sd;
86+
sd[LLAvatarAppearance::getDictionary()->getTexture(baked_iter->mTextureIndex)->mName] = layer_sd;
8787
}
8888
}
8989

indra/llappearanceutility/llbakingshadermgr.cpp

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,6 @@ void LLBakingShaderMgr::setShaders()
124124

125125
reentrance = true;
126126

127-
//setup preprocessor definitions
128-
LLShaderMgr::instance()->mDefinitions["NUM_TEX_UNITS"] = llformat("%d", gGLManager.mNumTextureImageUnits);
129-
130-
// Make sure the compiled shader map is cleared before we recompile shaders.
131-
mShaderObjects.clear();
132-
133127
initAttribsAndUniforms();
134128

135129
// Shaders
@@ -142,14 +136,10 @@ void LLBakingShaderMgr::setShaders()
142136
}
143137
mMaxAvatarShaderLevel = 0;
144138

145-
LLGLSLShader::sNoFixedFunction = false;
146139
LLVertexBuffer::unbind();
147140
BOOL loaded = FALSE;
148141
if (gGLManager.mGLSLVersionMajor > 1 || gGLManager.mGLSLVersionMinor >= 10)
149142
{
150-
//using shaders, disable fixed function
151-
LLGLSLShader::sNoFixedFunction = true;
152-
153143
S32 light_class = 2;
154144
mVertexShaderLevel[SHADER_INTERFACE] = light_class;
155145

@@ -160,12 +150,30 @@ void LLBakingShaderMgr::setShaders()
160150
shaders.push_back( make_pair( "objects/indexedTextureV.glsl", 1 ) );
161151
}
162152
shaders.push_back( make_pair( "objects/nonindexedTextureV.glsl", 1 ) );
153+
shaders.push_back( make_pair( "deferred/textureUtilV.glsl", 1 ) );
163154
loaded = TRUE;
164155
for (U32 i = 0; i < shaders.size(); i++)
165156
{
166157
// Note usage of GL_VERTEX_SHADER_ARB
167158
if (loadShaderFile(shaders[i].first, shaders[i].second, GL_VERTEX_SHADER_ARB) == 0)
168159
{
160+
LL_WARNS("Shader") << "Failed to load vertex shader " << shaders[i].first << LL_ENDL;
161+
loaded = FALSE;
162+
break;
163+
}
164+
}
165+
166+
shaders.clear();
167+
168+
// fragment shaders
169+
shaders.push_back( make_pair( "deferred/globalF.glsl", 1 ) );
170+
171+
for (U32 i = 0; i < shaders.size(); i++)
172+
{
173+
// Note usage of GL_FRAGMENT_SHADER
174+
if (loadShaderFile(shaders[i].first, shaders[i].second, GL_FRAGMENT_SHADER_ARB) == 0)
175+
{
176+
LL_WARNS("Shader") << "Failed to load fragment shader " << shaders[i].first << LL_ENDL;
169177
loaded = FALSE;
170178
break;
171179
}
@@ -179,7 +187,6 @@ void LLBakingShaderMgr::setShaders()
179187

180188
if (!loaded)
181189
{
182-
LLGLSLShader::sNoFixedFunction = false;
183190
//gPipeline.mVertexShadersEnabled = FALSE;
184191
//gPipeline.mVertexShadersLoaded = 0;
185192
mVertexShaderLevel[SHADER_LIGHTING] = 0;

indra/llappearanceutility/llbakingtexlayer.cpp

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ BOOL LLBakingTexLayerSetBuffer::render()
6060
BOOL result = FALSE;
6161

6262
preRenderTexLayerSet();
63-
result = renderTexLayerSet();
63+
result = renderTexLayerSet(nullptr);
6464
postRenderTexLayerSet(result);
6565

6666
return result;
@@ -101,7 +101,7 @@ void LLBakingTexLayerSetBuffer::midRenderTexLayerSet(BOOL success)
101101
LL_DEBUGS() << "Gathering Morph Mask Alpha..." << LL_ENDL;
102102
mTexLayerSet->gatherMorphMaskAlpha(baked_mask_data,
103103
getCompositeOriginX(), getCompositeOriginY(),
104-
getCompositeWidth(), getCompositeHeight());
104+
getCompositeWidth(), getCompositeHeight(), nullptr);
105105

106106
// Create the baked image from our color and mask information
107107
const S32 baked_image_components = 5; // red green blue [bump] clothing
@@ -127,8 +127,9 @@ void LLBakingTexLayerSetBuffer::midRenderTexLayerSet(BOOL success)
127127
LL_RECORD_BLOCK_TIME(FTM_CREATE_J2C);
128128
LL_DEBUGS() << "Creating J2C..." << LL_ENDL;
129129
mCompressedImage = new LLImageJ2C;
130+
mCompressedImage->setReversible(TRUE);
130131
const char* comment_text = LINDEN_J2C_COMMENT_PREFIX "RGBHM"; // writes into baked_color_data. 5 channels (rgb, heightfield/alpha, mask)
131-
if (!mCompressedImage->encode(baked_image, comment_text))
132+
if (!mCompressedImage->encode(baked_image, comment_text, 0.0f))
132133
{
133134
throw LLAppException(RV_UNABLE_TO_ENCODE);
134135
}
@@ -169,11 +170,11 @@ void LLBakingTexLayerSet::createComposite()
169170
LLSD LLBakingTexLayerSet::computeTextureIDs() const
170171
{
171172
const LLAvatarAppearanceDictionary::BakedEntry *baked_dict =
172-
LLAvatarAppearanceDictionary::getInstance()->getBakedTexture(getBakedTexIndex());
173+
LLAvatarAppearance::getDictionary()->getBakedTexture(getBakedTexIndex());
173174
#ifdef DEBUG_TEXTURE_IDS
174-
const std::string& slot_name = LLAvatarAppearanceDictionary::getInstance()->getTexture(
175-
LLAvatarAppearanceDictionary::bakedToLocalTextureIndex(slot_name()))->mDefaultImageName;
176-
const LLAvatarAppearanceDictionary::TextureEntry* entry = LLAvatarAppearanceDictionary::getInstance()->getTexture(baked_dict->mTextureIndex);
175+
const std::string& slot_name = LLAvatarAppearance::getDictionary()->getTexture(
176+
LLAvatarAppearance::getDictionary()->bakedToLocalTextureIndex(getBakedTexIndex()) )->mDefaultImageName;
177+
const LLAvatarAppearanceDictionary::TextureEntry* entry = LLAvatarAppearance::getDictionary()->getTexture(baked_dict->mTextureIndex);
177178
LL_DEBUGS() << "-----------------------------------------------------------------" << LL_ENDL;
178179
LL_DEBUGS() << "BakedTexIndex = " << (S32) getBakedTexIndex() << " (" << slot_name << ") "
179180
<< "BakedEntry::mTextureIndex = " << (S32) baked_dict->mTextureIndex
@@ -186,9 +187,9 @@ LLSD LLBakingTexLayerSet::computeTextureIDs() const
186187
std::ostringstream idx_str;
187188
for (; idx_iter != idx_end; ++idx_iter)
188189
{
189-
entry = LLAvatarAppearanceDictionary::getInstance()->getTexture((*idx_iter));
190+
entry = LLAvatarAppearance::getDictionary()->getTexture((*idx_iter));
190191
idx_str << (*idx_iter) << " (" << entry->mDefaultImageName
191-
<< ";" << LLWearableType::getTypeName( entry->mWearableType )
192+
<< ";" << LLWearableType::getInstance()->getTypeName( entry->mWearableType )
192193
<< "), ";
193194
}
194195
LL_DEBUGS() << "BakedEntry::mLocalTextures: " << idx_str.str() << LL_ENDL;
@@ -198,7 +199,7 @@ LLSD LLBakingTexLayerSet::computeTextureIDs() const
198199
for (; type_iter != type_end; ++type_iter)
199200
{
200201
type_str << (S32) (*type_iter) << " ("
201-
<< LLWearableType::getTypeName( (*type_iter) )
202+
<< LLWearableType::getInstance()->getTypeName( (*type_iter) )
202203
<< "), ";
203204
}
204205
LL_DEBUGS() << "BakedEntry::mWearables: " << type_str.str() << LL_ENDL;
@@ -278,21 +279,21 @@ bool LLBakingTexLayerSet::computeLayerListTextureIDs(LLMD5& hash,
278279
ETextureIndex te = layer_template->getLocalTextureIndex();
279280
U32 num_wearables = getAvatarAppearance()->getWearableData()->getWearableCount(wearable_type);
280281
#ifdef DEBUG_TEXTURE_IDS
281-
const LLAvatarAppearanceDictionary::TextureEntry* entry = LLAvatarAppearanceDictionary::getInstance()->getTexture(te);
282+
const LLAvatarAppearanceDictionary::TextureEntry* entry = LLAvatarAppearance::getDictionary()->getTexture(te);
282283
if (entry)
283284
{
284285
LL_DEBUGS() << "LLTexLayerInterface(" << layer_template->getName() << ") type = "
285286
<< (S32) wearable_type << " ("
286-
<< LLWearableType::getTypeName( wearable_type ) << ") te = "
287+
<< LLWearableType::getInstance()->getTypeName( wearable_type ) << ") te = "
287288
<< (S32) te << " ("<< entry->mDefaultImageName
288-
<< ";" << LLWearableType::getTypeName( entry->mWearableType )
289+
<< ";" << LLWearableType::getInstance()->getTypeName( entry->mWearableType )
289290
<< ") wearable_count = " << num_wearables << LL_ENDL;
290291
}
291292
else
292293
{
293294
LL_DEBUGS() << "LLTexLayerInterface(" << layer_template->getName() << ") type = "
294295
<< (S32) wearable_type << " ("
295-
<< LLWearableType::getTypeName( wearable_type )
296+
<< LLWearableType::getInstance()->getTypeName( wearable_type )
296297
<< ") wearable_count = " << num_wearables << LL_ENDL;
297298
}
298299
#endif

indra/llappearanceutility/llbakingtexlayer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class LLBakingTexLayerSetBuffer : public LLTexLayerSetBuffer, public LLBakingTex
4343

4444
LLImageJ2C* getCompressedImage() { return mCompressedImage; }
4545

46-
BOOL render();
46+
BOOL render();
4747
/*virtual*/ bool bindDebugImage(const S32 stage = 0) { return false; }
4848
/*virtual*/ bool isActiveFetching() { return false; };
4949

indra/llappearanceutility/llbakingwearable.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@
2727

2828
#include "linden_common.h"
2929

30+
#include "llavatarappearance.h"
3031
#include "llavatarappearancedefines.h"
3132
#include "llbakingwearable.h"
33+
#include "llmd5.h"
3234
#include "indra_constants.h"
3335

3436
using namespace LLAvatarAppearanceDefines;
@@ -55,7 +57,7 @@ void LLBakingWearable::addToBakedTextureHash(LLMD5& hash) const
5557
// virtual
5658
LLUUID LLBakingWearable::getDefaultTextureImageID(ETextureIndex index) const
5759
{
58-
const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture(index);
60+
const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearance::getDictionary()->getTexture(index);
5961
const std::string &default_image_name = texture_dict->mDefaultImageName;
6062
if (default_image_name == "")
6163
{

indra/llappearanceutility/llbakingwearable.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#define LL_LLBAKINGWEARABLE_H
2929

3030
#include "llwearable.h"
31+
#include "llmd5.h"
3132

3233
class LLBakingWearable : public LLWearable
3334
{

indra/llappearanceutility/llbakingwearablesdata.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ void LLBakingWearablesData::setWearableOutfit(LLSD& sd)
7272
mWearables.push_back(wearable);
7373

7474
const LLWearableType::EType type = wearable->getType();
75-
if (LLWearableType::getAssetType(type) == LLAssetType::AT_BODYPART)
75+
if (wearable->getAssetType() == LLAssetType::AT_BODYPART)
7676
{
7777
// exactly one wearable per body part
7878
setWearable(type,0,wearable);
@@ -123,7 +123,7 @@ void LLBakingWearablesData::asLLSD(LLSD& sd) const
123123
wearable->asLLSD(wearable_sd);
124124
wearable_type_sd.append(wearable_sd);
125125
}
126-
sd[LLWearableType::getTypeName(wearable_type)] = wearable_type_sd;
126+
sd[LLWearableType::getInstance()->getTypeName(wearable_type)] = wearable_type_sd;
127127
}
128128
}
129129

0 commit comments

Comments
 (0)