SH-3347 create demo of back end texture baking service
First link of the back-end service with some LLAppearance code.meow-7.2.2
parent
f1d6052e36
commit
c34329fa4c
|
|
@ -8,8 +8,13 @@ include(CARes)
|
|||
include(OpenSSL)
|
||||
include(UI)
|
||||
include(LLAppearance)
|
||||
include(LLCharacter)
|
||||
include(LLCommon)
|
||||
include(LLImage)
|
||||
include(LLInventory)
|
||||
include(LLMath)
|
||||
include(LLKDU)
|
||||
include(LLRender)
|
||||
include(LLVFS)
|
||||
include(LLXML)
|
||||
include(LLUI)
|
||||
|
|
@ -20,7 +25,12 @@ include_directories(
|
|||
${LLVFS_INCLUDE_DIRS}
|
||||
${LLXML_INCLUDE_DIRS}
|
||||
${LLUI_INCLUDE_DIRS}
|
||||
${LLCHARACTER_INCLUDE_DIRS}
|
||||
${LLKDU_INCLUDE_DIRS}
|
||||
${LLIMAGE_INCLUDE_DIRS}
|
||||
${LLMATH_INCLUDE_DIRS}
|
||||
${LLINVENTORY_INCLUDE_DIRS}
|
||||
${LLRENDER_INCLUDE_DIRS}
|
||||
${CURL_INCLUDE_DIRS}
|
||||
${CARES_INCLUDE_DIRS}
|
||||
${OPENSSL_INCLUDE_DIRS}
|
||||
|
|
@ -28,9 +38,9 @@ include_directories(
|
|||
${LLAPPEARANCE_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
set(appearance_utility_SOURCE_FILES appearance_utility.cpp)
|
||||
set(appearance_utility_SOURCE_FILES appearance_utility.cpp llbakingshadermgr.cpp)
|
||||
|
||||
set(appearance_utility_HEADER_FILES CMakeLists.txt)
|
||||
set(appearance_utility_HEADER_FILES CMakeLists.txt llbakingshadermgr.h)
|
||||
|
||||
set_source_files_properties(${appearance_utility_HEADER_FILES}
|
||||
PROPERTIES HEADER_FILES_ONLY TRUE)
|
||||
|
|
@ -40,17 +50,15 @@ list(APPEND appearance_utility_SOURCE_FILES ${appearance_utility_HEADER_FILES})
|
|||
add_executable(appearance-utility-bin ${appearance_utility_SOURCE_FILES})
|
||||
|
||||
target_link_libraries(appearance-utility-bin
|
||||
${CURL_LIBRARIES}
|
||||
${CARES_LIBRARIES}
|
||||
${OPENSSL_LIBRARIES}
|
||||
${CRYPTO_LIBRARIES}
|
||||
${UI_LIBRARIES}
|
||||
${LLAPPEARANCE_LIBRARIES}
|
||||
${LLINVENTORY_LIBRARIES}
|
||||
${LLXML_LIBRARIES}
|
||||
${LLCHARACTER_LIBRARIES}
|
||||
${LLRENDER_LIBRARIES}
|
||||
${LLUI_LIBRARIES}
|
||||
${LLVFS_LIBRARIES}
|
||||
${UI_LIBRARIES}
|
||||
${LLIMAGE_LIBRARIES}
|
||||
${LLCOMMON_LIBRARIES}
|
||||
${LLKDU_LIBRARIES}
|
||||
${KDU_LIBRARY}
|
||||
)
|
||||
|
||||
add_custom_target(appearance-utility-bin-target ALL
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
#include "llsdserialize.h"
|
||||
#include "llsdutil.h"
|
||||
|
||||
//#include "llwearabledata.h"
|
||||
#include "llwearabledata.h"
|
||||
|
||||
enum EResult
|
||||
{
|
||||
|
|
@ -152,7 +152,7 @@ EResult process_tbd(LLSD& input, std::ostream& output, LLSD& error_llsd)
|
|||
{
|
||||
EResult rv = RV_SUCCESS;
|
||||
|
||||
//LLWearableData wearable_data;
|
||||
LLWearableData wearable_data;
|
||||
|
||||
LLSD result;
|
||||
result["success"] = true;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,226 @@
|
|||
|
||||
/**
|
||||
* @file LLBakingShaderMgr.cpp
|
||||
* @brief Viewer shader manager implementation.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
|
||||
#include "linden_common.h"
|
||||
|
||||
#include "llbakingshadermgr.h"
|
||||
|
||||
#include "lldir.h"
|
||||
#include "llfile.h"
|
||||
#include "llrender.h"
|
||||
#include "llvertexbuffer.h"
|
||||
|
||||
#if LL_DARWIN
|
||||
#include "OpenGL/OpenGL.h"
|
||||
#endif
|
||||
|
||||
#ifdef LL_RELEASE_FOR_DOWNLOAD
|
||||
#define UNIFORM_ERRS LL_WARNS_ONCE("Shader")
|
||||
#else
|
||||
#define UNIFORM_ERRS LL_ERRS("Shader")
|
||||
#endif
|
||||
|
||||
// Lots of STL stuff in here, using namespace std to keep things more readable
|
||||
using std::vector;
|
||||
using std::pair;
|
||||
using std::make_pair;
|
||||
using std::string;
|
||||
|
||||
BOOL LLBakingShaderMgr::sInitialized = FALSE;
|
||||
bool LLBakingShaderMgr::sSkipReload = false;
|
||||
|
||||
//utility shaders
|
||||
LLGLSLShader gAlphaMaskProgram;
|
||||
|
||||
|
||||
LLBakingShaderMgr::LLBakingShaderMgr() :
|
||||
mVertexShaderLevel(SHADER_COUNT, 0),
|
||||
mMaxAvatarShaderLevel(0)
|
||||
{
|
||||
}
|
||||
|
||||
LLBakingShaderMgr::~LLBakingShaderMgr()
|
||||
{
|
||||
mVertexShaderLevel.clear();
|
||||
mShaderList.clear();
|
||||
}
|
||||
|
||||
// static
|
||||
LLBakingShaderMgr * LLBakingShaderMgr::instance()
|
||||
{
|
||||
if(NULL == sInstance)
|
||||
{
|
||||
sInstance = new LLBakingShaderMgr();
|
||||
}
|
||||
|
||||
return static_cast<LLBakingShaderMgr*>(sInstance);
|
||||
}
|
||||
|
||||
void LLBakingShaderMgr::initAttribsAndUniforms(void)
|
||||
{
|
||||
if (mReservedAttribs.empty())
|
||||
{
|
||||
LLShaderMgr::initAttribsAndUniforms();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
// Set Levels
|
||||
|
||||
S32 LLBakingShaderMgr::getVertexShaderLevel(S32 type)
|
||||
{
|
||||
return mVertexShaderLevel[type];
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
// Shader Management
|
||||
|
||||
void LLBakingShaderMgr::setShaders()
|
||||
{
|
||||
//setShaders might be called redundantly by gSavedSettings, so return on reentrance
|
||||
static bool reentrance = false;
|
||||
|
||||
if (!sInitialized || reentrance || sSkipReload)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LLGLSLShader::sIndexedTextureChannels = llmax(gGLManager.mNumTextureImageUnits, 1);
|
||||
|
||||
//NEVER use more than 16 texture channels (work around for prevalent driver bug)
|
||||
LLGLSLShader::sIndexedTextureChannels = llmin(LLGLSLShader::sIndexedTextureChannels, 16);
|
||||
|
||||
if (gGLManager.mGLSLVersionMajor < 1 ||
|
||||
(gGLManager.mGLSLVersionMajor == 1 && gGLManager.mGLSLVersionMinor <= 20))
|
||||
{ //NEVER use indexed texture rendering when GLSL version is 1.20 or earlier
|
||||
LLGLSLShader::sIndexedTextureChannels = 1;
|
||||
}
|
||||
|
||||
reentrance = true;
|
||||
|
||||
//setup preprocessor definitions
|
||||
LLShaderMgr::instance()->mDefinitions["NUM_TEX_UNITS"] = llformat("%d", gGLManager.mNumTextureImageUnits);
|
||||
|
||||
// Make sure the compiled shader map is cleared before we recompile shaders.
|
||||
mShaderObjects.clear();
|
||||
|
||||
initAttribsAndUniforms();
|
||||
|
||||
// Shaders
|
||||
LL_INFOS("ShaderLoading") << "\n~~~~~~~~~~~~~~~~~~\n Loading Shaders:\n~~~~~~~~~~~~~~~~~~" << LL_ENDL;
|
||||
LL_INFOS("ShaderLoading") << llformat("Using GLSL %d.%d", gGLManager.mGLSLVersionMajor, gGLManager.mGLSLVersionMinor) << llendl;
|
||||
|
||||
for (S32 i = 0; i < SHADER_COUNT; i++)
|
||||
{
|
||||
mVertexShaderLevel[i] = 0;
|
||||
}
|
||||
mMaxAvatarShaderLevel = 0;
|
||||
|
||||
LLGLSLShader::sNoFixedFunction = false;
|
||||
LLVertexBuffer::unbind();
|
||||
if (gGLManager.mGLSLVersionMajor > 1 || gGLManager.mGLSLVersionMinor >= 10)
|
||||
{
|
||||
//using shaders, disable fixed function
|
||||
LLGLSLShader::sNoFixedFunction = true;
|
||||
|
||||
//gPipeline.mVertexShadersEnabled = TRUE;
|
||||
//gPipeline.mVertexShadersLoaded = 1;
|
||||
|
||||
loadShadersInterface();
|
||||
}
|
||||
else
|
||||
{
|
||||
LLGLSLShader::sNoFixedFunction = false;
|
||||
//gPipeline.mVertexShadersEnabled = FALSE;
|
||||
//gPipeline.mVertexShadersLoaded = 0;
|
||||
mVertexShaderLevel[SHADER_LIGHTING] = 0;
|
||||
mVertexShaderLevel[SHADER_INTERFACE] = 0;
|
||||
mVertexShaderLevel[SHADER_ENVIRONMENT] = 0;
|
||||
mVertexShaderLevel[SHADER_WATER] = 0;
|
||||
mVertexShaderLevel[SHADER_OBJECT] = 0;
|
||||
mVertexShaderLevel[SHADER_EFFECT] = 0;
|
||||
mVertexShaderLevel[SHADER_WINDLIGHT] = 0;
|
||||
mVertexShaderLevel[SHADER_AVATAR] = 0;
|
||||
}
|
||||
|
||||
//gPipeline.createGLBuffers();
|
||||
|
||||
reentrance = false;
|
||||
}
|
||||
|
||||
void LLBakingShaderMgr::unloadShaders()
|
||||
{
|
||||
gAlphaMaskProgram.unload();
|
||||
|
||||
mVertexShaderLevel[SHADER_INTERFACE] = 0;
|
||||
|
||||
//gPipeline.mVertexShadersLoaded = 0;
|
||||
}
|
||||
|
||||
BOOL LLBakingShaderMgr::loadShadersInterface()
|
||||
{
|
||||
BOOL success = TRUE;
|
||||
|
||||
if (success)
|
||||
{
|
||||
gAlphaMaskProgram.mName = "Alpha Mask Shader";
|
||||
gAlphaMaskProgram.mShaderFiles.clear();
|
||||
gAlphaMaskProgram.mShaderFiles.push_back(make_pair("interface/alphamaskV.glsl", GL_VERTEX_SHADER_ARB));
|
||||
gAlphaMaskProgram.mShaderFiles.push_back(make_pair("interface/alphamaskF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||
gAlphaMaskProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE];
|
||||
success = gAlphaMaskProgram.createShader(NULL, NULL);
|
||||
}
|
||||
|
||||
if( !success )
|
||||
{
|
||||
mVertexShaderLevel[SHADER_INTERFACE] = 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
std::string LLBakingShaderMgr::getShaderDirPrefix(void)
|
||||
{
|
||||
return gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "shaders/class");
|
||||
}
|
||||
|
||||
void LLBakingShaderMgr::updateShaderUniforms(LLGLSLShader * shader)
|
||||
{
|
||||
}
|
||||
|
||||
LLBakingShaderMgr::shader_iter LLBakingShaderMgr::beginShaders() const
|
||||
{
|
||||
return mShaderList.begin();
|
||||
}
|
||||
|
||||
LLBakingShaderMgr::shader_iter LLBakingShaderMgr::endShaders() const
|
||||
{
|
||||
return mShaderList.end();
|
||||
}
|
||||
|
|
@ -0,0 +1,137 @@
|
|||
/**
|
||||
* @file llbakingshadermgr.h
|
||||
* @brief Texture Baking Shader Manager
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#ifndef LL_BAKING_SHADER_MGR_H
|
||||
#define LL_BAKING_SHADER_MGR_H
|
||||
|
||||
#include "llshadermgr.h"
|
||||
|
||||
class LLBakingShaderMgr: public LLShaderMgr
|
||||
{
|
||||
public:
|
||||
static BOOL sInitialized;
|
||||
static bool sSkipReload;
|
||||
|
||||
LLBakingShaderMgr();
|
||||
/* virtual */ ~LLBakingShaderMgr();
|
||||
|
||||
// singleton pattern implementation
|
||||
static LLBakingShaderMgr * instance();
|
||||
|
||||
void initAttribsAndUniforms(void);
|
||||
void setShaders();
|
||||
void unloadShaders();
|
||||
S32 getVertexShaderLevel(S32 type);
|
||||
BOOL loadShadersInterface();
|
||||
|
||||
std::vector<S32> mVertexShaderLevel;
|
||||
S32 mMaxAvatarShaderLevel;
|
||||
|
||||
enum EShaderClass
|
||||
{
|
||||
SHADER_LIGHTING,
|
||||
SHADER_OBJECT,
|
||||
SHADER_AVATAR,
|
||||
SHADER_ENVIRONMENT,
|
||||
SHADER_INTERFACE,
|
||||
SHADER_EFFECT,
|
||||
SHADER_WINDLIGHT,
|
||||
SHADER_WATER,
|
||||
SHADER_DEFERRED,
|
||||
SHADER_TRANSFORM,
|
||||
SHADER_COUNT
|
||||
};
|
||||
|
||||
// simple model of forward iterator
|
||||
// http://www.sgi.com/tech/stl/ForwardIterator.html
|
||||
class shader_iter
|
||||
{
|
||||
private:
|
||||
friend bool operator == (shader_iter const & a, shader_iter const & b);
|
||||
friend bool operator != (shader_iter const & a, shader_iter const & b);
|
||||
|
||||
typedef std::vector<LLGLSLShader *>::const_iterator base_iter_t;
|
||||
public:
|
||||
shader_iter()
|
||||
{
|
||||
}
|
||||
|
||||
shader_iter(base_iter_t iter) : mIter(iter)
|
||||
{
|
||||
}
|
||||
|
||||
LLGLSLShader & operator * () const
|
||||
{
|
||||
return **mIter;
|
||||
}
|
||||
|
||||
LLGLSLShader * operator -> () const
|
||||
{
|
||||
return *mIter;
|
||||
}
|
||||
|
||||
shader_iter & operator++ ()
|
||||
{
|
||||
++mIter;
|
||||
return *this;
|
||||
}
|
||||
|
||||
shader_iter operator++ (int)
|
||||
{
|
||||
return mIter++;
|
||||
}
|
||||
|
||||
private:
|
||||
base_iter_t mIter;
|
||||
};
|
||||
|
||||
shader_iter beginShaders() const;
|
||||
shader_iter endShaders() const;
|
||||
|
||||
/* virtual */ std::string getShaderDirPrefix(void);
|
||||
|
||||
/* virtual */ void updateShaderUniforms(LLGLSLShader * shader);
|
||||
|
||||
private:
|
||||
|
||||
// the list of shaders we need to propagate parameters to.
|
||||
std::vector<LLGLSLShader *> mShaderList;
|
||||
|
||||
}; //LLBakingShaderMgr
|
||||
|
||||
inline bool operator == (LLBakingShaderMgr::shader_iter const & a, LLBakingShaderMgr::shader_iter const & b)
|
||||
{
|
||||
return a.mIter == b.mIter;
|
||||
}
|
||||
|
||||
inline bool operator != (LLBakingShaderMgr::shader_iter const & a, LLBakingShaderMgr::shader_iter const & b)
|
||||
{
|
||||
return a.mIter != b.mIter;
|
||||
}
|
||||
|
||||
extern LLVector4 gShinyOrigin;
|
||||
|
||||
#endif // LL_BAKING_SHADER_MGR_H
|
||||
|
|
@ -1833,5 +1833,18 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMorphNodes(LLXmlTreeNode* root
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
//virtual
|
||||
LLAvatarAppearance::LLMaskedMorph::LLMaskedMorph(LLVisualParam *morph_target, BOOL invert, std::string layer) :
|
||||
mMorphTarget(morph_target),
|
||||
mInvert(invert),
|
||||
mLayer(layer)
|
||||
{
|
||||
LLPolyMorphTarget *target = dynamic_cast<LLPolyMorphTarget*>(morph_target);
|
||||
if (target)
|
||||
{
|
||||
target->addPendingMorphMask();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ set(vfs_BOOST_LIBRARIES
|
|||
|
||||
target_link_libraries(llvfs
|
||||
${vfs_BOOST_LIBRARIES}
|
||||
${LLCOMMON_LIBRARIES}
|
||||
)
|
||||
|
||||
if (DARWIN)
|
||||
|
|
|
|||
|
|
@ -7333,17 +7333,5 @@ BOOL LLVOAvatar::isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
//virtual
|
||||
LLAvatarAppearance::LLMaskedMorph::LLMaskedMorph(LLVisualParam *morph_target, BOOL invert, std::string layer) :
|
||||
mMorphTarget(morph_target),
|
||||
mInvert(invert),
|
||||
mLayer(layer)
|
||||
{
|
||||
LLPolyMorphTarget *target = dynamic_cast<LLPolyMorphTarget*>(morph_target);
|
||||
if (target)
|
||||
{
|
||||
target->addPendingMorphMask();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue