diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index 07cf346b7..ac1316b1d 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -873,6 +873,7 @@ void LLStringUtilBase::addCRLF(std::basic_string& string) } string.assign(t, size); + delete[] t; } } diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h index 0dc98e005..3f306e78a 100644 --- a/indra/llcommon/llversionviewer.h +++ b/indra/llcommon/llversionviewer.h @@ -36,7 +36,7 @@ const S32 LL_VERSION_MAJOR = 1; const S32 LL_VERSION_MINOR = 4; const S32 LL_VERSION_PATCH = 2; -const S32 LL_VERSION_BUILD = 5; +const S32 LL_VERSION_BUILD = 6; const char * const LL_CHANNEL = "Ascent Viewer Release"; diff --git a/indra/llimage/llimagepng.cpp b/indra/llimage/llimagepng.cpp index b5de104e6..387e2fdfe 100644 --- a/indra/llimage/llimagepng.cpp +++ b/indra/llimage/llimagepng.cpp @@ -135,6 +135,7 @@ BOOL LLImagePNG::encode(const LLImageRaw* raw_image, F32 encode_time) if (! pngWrapper.writePng(raw_image, mTmpWriteBuffer)) { setLastError(pngWrapper.getErrorMessage()); + delete[] mTmpWriteBuffer; return FALSE; } diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp index a6041b413..56d5c2399 100644 --- a/indra/llmessage/llhttpclient.cpp +++ b/indra/llmessage/llhttpclient.cpp @@ -161,10 +161,9 @@ namespace fstream.seekg(0, std::ios::end); U32 fileSize = fstream.tellg(); fstream.seekg(0, std::ios::beg); - char* fileBuffer; - fileBuffer = new char [fileSize]; - fstream.read(fileBuffer, fileSize); - ostream.write(fileBuffer, fileSize); + std::vector fileBuffer(fileSize); //Mem leak fix'd + fstream.read(&fileBuffer[0], fileSize); + ostream.write(&fileBuffer[0], fileSize); fstream.close(); eos = true; return STATUS_DONE; @@ -191,10 +190,9 @@ namespace LLVFile vfile(gVFS, mUUID, mAssetType, LLVFile::READ); S32 fileSize = vfile.getSize(); - U8* fileBuffer; - fileBuffer = new U8 [fileSize]; - vfile.read(fileBuffer, fileSize); - ostream.write((char*)fileBuffer, fileSize); + std::vector fileBuffer(fileSize); + vfile.read(&fileBuffer[0], fileSize); + ostream.write((char*)&fileBuffer[0], fileSize); eos = true; return STATUS_DONE; } @@ -341,6 +339,20 @@ void LLHTTPClient::get(const std::string& url, const LLSD& query, ResponderPtr r get(uri.asString(), responder, headers, timeout); } +class LLHTTPFileBuffer +{ +public: + llofstream * stream; + LLHTTPFileBuffer(llofstream * fstream):stream(fstream){} + static size_t curl_write( void *ptr, size_t size, size_t nmemb, void *user_data) + { + LLHTTPFileBuffer* self = (LLHTTPFileBuffer*)user_data; + size_t bytes = (size * nmemb); + self->stream->write((char*)ptr,bytes); + return nmemb; + } +}; + // A simple class for managing data returned from a curl http request. class LLHTTPBuffer { diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 162555487..568af1747 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -255,7 +255,7 @@ PFNGLGETACTIVEATTRIBARBPROC glGetActiveAttribARB = NULL; PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB = NULL; #if LL_WINDOWS -PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = NULL; +PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = NULL; #endif #if LL_LINUX_NV_GL_HEADERS @@ -748,11 +748,13 @@ void LLGLManager::initExtensions() LL_INFOS("RenderInit") << "Disabling mip-map generation for Intel GPUs" << LL_ENDL; mHasMipMapGeneration = FALSE; } + //Don't do this! This has since been fixed. I've benchmarked it. Hardware generation considerably faster. -Shyotl + /* if (mIsATI && mHasMipMapGeneration) { LL_INFOS("RenderInit") << "Disabling mip-map generation for ATI GPUs (performance opt)" << LL_ENDL; mHasMipMapGeneration = FALSE; - } + }*/ // Misc glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, (GLint*) &mGLMaxVertexRange); diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 461edbeec..11cacd3e8 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -62,6 +62,7 @@ BOOL LLVertexBuffer::sVBOActive = FALSE; BOOL LLVertexBuffer::sIBOActive = FALSE; U32 LLVertexBuffer::sAllocatedBytes = 0; BOOL LLVertexBuffer::sMapped = FALSE; +BOOL LLVertexBuffer::sUseStreamDraw = TRUE; std::vector LLVertexBuffer::sDeleteList; @@ -348,6 +349,11 @@ LLVertexBuffer::LLVertexBuffer(U32 typemask, S32 usage) : mUsage = 0 ; } + if (mUsage == GL_STREAM_DRAW_ARB && !sUseStreamDraw) + { + mUsage = 0; + } + S32 stride = calcStride(typemask, mOffsets); mTypeMask = typemask; @@ -771,7 +777,7 @@ BOOL LLVertexBuffer::useVBOs() const return FALSE; } #endif - return sEnableVBOs; + return TRUE; } //---------------------------------------------------------------------------- @@ -1078,7 +1084,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask) { if (mGLBuffer) { - if (sEnableVBOs && sVBOActive) + if (sVBOActive) { glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); sBindCount++; @@ -1090,7 +1096,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask) setup = TRUE; // ... or a client memory pointer changed } } - if (sEnableVBOs && mGLIndices && sIBOActive) + if (mGLIndices && sIBOActive) { /*if (sMapped) { diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h index aad948e17..2456f2907 100644 --- a/indra/llrender/llvertexbuffer.h +++ b/indra/llrender/llvertexbuffer.h @@ -85,6 +85,8 @@ public: static LLVBOPool sStreamIBOPool; static LLVBOPool sDynamicIBOPool; + static BOOL sUseStreamDraw; + static void initClass(bool use_vbo); static void cleanupClass(); static void setupClientArrays(U32 data_mask); diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index e2554fc71..2932af85f 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -2,10 +2,21 @@ + ShyotlRenderUseStreamVBO + + Comment + Use VBO's for stream buffers + Persist + 1 + Type + Boolean + Value + 1 + AscentShowLookAt Comment - Avatar position modifier (X) + Show Others' Lookat points Persist 1 Type diff --git a/indra/newview/llao.cpp b/indra/newview/llao.cpp index 8119befef..01fb78e38 100644 --- a/indra/newview/llao.cpp +++ b/indra/newview/llao.cpp @@ -476,6 +476,63 @@ void LLFloaterAO::onClickAnimAdd(void* user_data) } onCommitAnim(NULL,user_data); } + +BOOL LLFloaterAO::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg) +{ + BOOL handled = TRUE; + switch(cargo_type) + { + case DAD_ANIMATION: + { + LLInventoryItem* item = (LLInventoryItem*)cargo_data; + if (item + && gInventory.getItem(item->getUUID())) + { + if (drop) + { + if (cargo_type == DAD_ANIMATION) + { + std::string anim_name = item->getName(); + if (anim_name == "") + return true; + LLUUID id(LLAO::getAssetIDByName(anim_name)); +#ifdef AO_DEBUG + llinfos << "Actually adding animation, this should be refreshed. Count:" << LLAO::mAnimationOverrides[mCurrentAnimType].size() << llendl; +#endif + LLAO::mAnimationOverrides[mCurrentAnimType].append(anim_name); +#ifdef AO_DEBUG + llinfos << "Added animation. Count:" << LLAO::mAnimationOverrides[mCurrentAnimType].size() << llendl; +#endif + LLAO::mTimer->reset(); + onCommitAnim(NULL,this); + } + refresh(); + } + *accept = ACCEPT_YES_COPY_MULTI; + } + else + { + // Not in user's inventory means it was in object inventory + *accept = ACCEPT_NO; + } + break; + } + default: + *accept = ACCEPT_NO; + if (tooltip_msg.empty()) + { + tooltip_msg.assign("Only animations can be added to the AO."); + } + break; + } + return handled; +} + + //static void LLFloaterAO::onClickSave(void* user_data) { diff --git a/indra/newview/llao.h b/indra/newview/llao.h index d24179904..a54d71543 100644 --- a/indra/newview/llao.h +++ b/indra/newview/llao.h @@ -70,7 +70,11 @@ public: static void onClickAnimAdd(void* user_data); static void onClickSave(void* user_data); static void onClickLoad(void* user_data); - + virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg); private: LLComboBox* mAnimListCombo; LLComboBox* mAnimTypeCombo; diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index dab1dacfd..3d93dd4d2 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -801,6 +801,72 @@ LLVector2 LLFace::surfaceToTexture(LLVector2 surface_coord, LLVector3 position, return tc; } +// Returns scale compared to default texgen, and face orientation as calculated +// by planarProjection(). This is needed to match planar texgen parameters. +void LLFace::getPlanarProjectedParams(LLQuaternion* face_rot, LLVector3* face_pos, F32* scale) const +{ + const LLVolumeFace& vf = getViewerObject()->getVolume()->getVolumeFace(mTEOffset); + LLVector3 normal = vf.mVertices[0].mNormal; + LLVector3 binormal = vf.mVertices[0].mBinormal; + LLVector2 projected_binormal; + planarProjection(projected_binormal, normal, vf.mCenter, binormal); + projected_binormal -= LLVector2(0.5f, 0.5f); // this normally happens in xform() + *scale = projected_binormal.length(); + // rotate binormal to match what planarProjection() thinks it is, + // then find face's rotation from normal and rotated binormal: + projected_binormal.normalize(); + F32 ang = acos(projected_binormal.mV[VY]); + ang = (projected_binormal.mV[VX] < 0.f) ? -ang : ang; + binormal.rotVec(ang, normal); + LLQuaternion local_rot( binormal % normal, binormal, normal ); + *face_rot = local_rot * mXform->getWorldRotation(); + *face_pos = mXform->getWorldPosition(); +} + +// Returns the necessary texture transform to align this face's TE to align_to's TE +bool LLFace::calcAlignedPlanarTE(const LLFace* align_to, LLVector2* res_st_offset, + LLVector2* res_st_scale, F32* res_st_rot) const +{ + if (!align_to) + { + return false; + } + const LLTextureEntry *orig_tep = align_to->getTextureEntry(); + if ((orig_tep->getTexGen() != LLTextureEntry::TEX_GEN_PLANAR) || + (getTextureEntry()->getTexGen() != LLTextureEntry::TEX_GEN_PLANAR)) + { + return false; + } + + LLVector3 orig_pos, this_pos; + LLQuaternion orig_face_rot, this_face_rot; + F32 orig_proj_scale, this_proj_scale; + align_to->getPlanarProjectedParams(&orig_face_rot, &orig_pos, &orig_proj_scale); + getPlanarProjectedParams(&this_face_rot, &this_pos, &this_proj_scale); + + // The rotation of "this face's" texture: + LLQuaternion orig_st_rot = LLQuaternion(orig_tep->getRotation(), LLVector3::z_axis) * orig_face_rot; + LLQuaternion this_st_rot = orig_st_rot * ~this_face_rot; + F32 x_ang, y_ang, z_ang; + this_st_rot.getEulerAngles(&x_ang, &y_ang, &z_ang); + *res_st_rot = z_ang; + + // Offset and scale of "this face's" texture: + LLVector3 centers_dist = (this_pos - orig_pos) * ~orig_st_rot; + LLVector3 st_scale(orig_tep->mScaleS, orig_tep->mScaleT, 1.f); + st_scale *= orig_proj_scale; + centers_dist.scaleVec(st_scale); + LLVector2 orig_st_offset(orig_tep->mOffsetS, orig_tep->mOffsetT); + + *res_st_offset = orig_st_offset + (LLVector2)centers_dist; + res_st_offset->mV[VX] -= (S32)res_st_offset->mV[VX]; + res_st_offset->mV[VY] -= (S32)res_st_offset->mV[VY]; + + st_scale /= this_proj_scale; + *res_st_scale = (LLVector2)st_scale; + return true; +} + void LLFace::updateRebuildFlags() { if (!mDrawablep->isState(LLDrawable::REBUILD_VOLUME)) @@ -1212,7 +1278,9 @@ F32 LLFace::getTextureVirtualSize() { //apply texel area to face area to get accurate ratio //face_area /= llclamp(texel_area, 1.f/64.f, 16.f); - face_area = mPixelArea / llclamp(texel_area, 0.015625f, 1024.f); + + //face_area = mPixelArea / llclamp(texel_area, 0.015625f, 1024.f); + face_area = mPixelArea / llclamp(texel_area, 0.015625f, 128.f); // see SNOW-207 } if(face_area > LLViewerImage::sMaxSmallImageSize) diff --git a/indra/newview/llface.h b/indra/newview/llface.h index 5e422b47a..4893e825d 100644 --- a/indra/newview/llface.h +++ b/indra/newview/llface.h @@ -93,6 +93,9 @@ public: BOOL hasGeometry() const { return mGeomCount > 0; } LLVector3 getPositionAgent() const; LLVector2 surfaceToTexture(LLVector2 surface_coord, LLVector3 position, LLVector3 normal); + void getPlanarProjectedParams(LLQuaternion* face_rot, LLVector3* face_pos, F32* scale) const; + bool calcAlignedPlanarTE(const LLFace* align_to, LLVector2* st_offset, + LLVector2* st_scale, F32* st_rot) const; U32 getState() const { return mState; } void setState(U32 state) { mState |= state; } diff --git a/indra/newview/llfloaterhardwaresettings.cpp b/indra/newview/llfloaterhardwaresettings.cpp index 7886e394a..46e1a5806 100644 --- a/indra/newview/llfloaterhardwaresettings.cpp +++ b/indra/newview/llfloaterhardwaresettings.cpp @@ -99,7 +99,17 @@ void LLFloaterHardwareSettings::refreshEnabledState() !gGLManager.mHasVertexBufferObject) { childSetEnabled("vbo", FALSE); + //Streaming VBOs -Shyotl + childSetEnabled("vbo_stream", FALSE); } + else +#if LL_DARWIN + childSetEnabled("vbo_stream", FALSE); //Hardcoded disable on mac + childSetValue("vbo_stream", (LLSD::Boolean) FALSE); //Hardcoded disable on mac +#else + childSetEnabled("vbo_stream", LLVertexBuffer::sEnableVBOs); +#endif + // if no windlight shaders, turn off nighttime brightness, gamma, and fog distance childSetEnabled("gamma", !gPipeline.canUseWindLightShaders()); diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index b870c1800..00c5a0940 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -36,6 +36,7 @@ #include "llpanelface.h" // library includes +#include "llcalc.h" #include "llerror.h" #include "llfocusmgr.h" #include "llrect.h" @@ -43,11 +44,13 @@ #include "llfontgl.h" // project includes +#include "llagent.h" #include "llbutton.h" #include "llcheckboxctrl.h" #include "llcolorswatch.h" #include "llcombobox.h" #include "lldrawpoolbump.h" +#include "llface.h" #include "lllineeditor.h" #include "llresmgr.h" #include "llselectmgr.h" @@ -60,6 +63,7 @@ #include "llviewercontrol.h" #include "llviewermedia.h" #include "llviewerobject.h" +#include "llviewerregion.h" #include "llviewerstats.h" #include "lluictrlfactory.h" #include "llpluginclassmedia.h" @@ -169,6 +173,7 @@ BOOL LLPanelFace::postBuild() childSetCommitCallback("combobox shininess",&LLPanelFace::onCommitShiny,this); childSetCommitCallback("combobox bumpiness",&LLPanelFace::onCommitBump,this); + childSetCommitCallback("checkbox planar align",&LLPanelFace::onCommitPlanarAlign, this); childSetCommitCallback("TexScaleU",&LLPanelFace::onCommitTextureInfo, this); childSetCommitCallback("checkbox flip s",&LLPanelFace::onCommitTextureInfo, this); childSetCommitCallback("TexScaleV",&LLPanelFace::onCommitTextureInfo, this); @@ -178,6 +183,8 @@ BOOL LLPanelFace::postBuild() childSetCommitCallback("TexOffsetU",LLPanelFace::onCommitTextureInfo, this); childSetCommitCallback("TexOffsetV",LLPanelFace::onCommitTextureInfo, this); childSetAction("button align",onClickAutoFix,this); + childSetAction("copytextures",onClickCopy,this); + childSetAction("pastetextures",onClickPaste,this); clearCtrls(); @@ -359,6 +366,93 @@ private: LLPanelFace* mPanel; }; +// Functor that aligns a face to mCenterFace +struct LLPanelFaceSetAlignedTEFunctor : public LLSelectedTEFunctor +{ + LLPanelFaceSetAlignedTEFunctor(LLPanelFace* panel, LLFace* center_face) : + mPanel(panel), + mCenterFace(center_face) {} + + virtual bool apply(LLViewerObject* object, S32 te) + { + LLFace* facep = object->mDrawable->getFace(te); + if (!facep) + { + return true; + } + + bool set_aligned = true; + if (facep == mCenterFace) + { + set_aligned = false; + } + if (set_aligned) + { + LLVector2 uv_offset, uv_scale; + F32 uv_rot; + set_aligned = facep->calcAlignedPlanarTE(mCenterFace, &uv_offset, &uv_scale, &uv_rot); + if (set_aligned) + { + object->setTEOffset(te, uv_offset.mV[VX], uv_offset.mV[VY]); + object->setTEScale(te, uv_scale.mV[VX], uv_scale.mV[VY]); + object->setTERotation(te, uv_rot); + } + } + if (!set_aligned) + { + LLPanelFaceSetTEFunctor setfunc(mPanel); + setfunc.apply(object, te); + } + return true; + } +private: + LLPanelFace* mPanel; + LLFace* mCenterFace; +}; + +// Functor that tests if a face is aligned to mCenterFace +struct LLPanelFaceGetIsAlignedTEFunctor : public LLSelectedTEFunctor +{ + LLPanelFaceGetIsAlignedTEFunctor(LLFace* center_face) : + mCenterFace(center_face) {} + + virtual bool apply(LLViewerObject* object, S32 te) + { + LLFace* facep = object->mDrawable->getFace(te); + if (!facep) + { + return false; + } + if (facep == mCenterFace) + { + return true; + } + + LLVector2 aligned_st_offset, aligned_st_scale; + F32 aligned_st_rot; + if ( facep->calcAlignedPlanarTE(mCenterFace, &aligned_st_offset, &aligned_st_scale, &aligned_st_rot) ) + { + const LLTextureEntry* tep = facep->getTextureEntry(); + LLVector2 st_offset, st_scale; + tep->getOffset(&st_offset.mV[VX], &st_offset.mV[VY]); + tep->getScale(&st_scale.mV[VX], &st_scale.mV[VY]); + F32 st_rot = tep->getRotation(); + // needs a fuzzy comparison, because of fp errors + if (is_approx_equal_fraction(st_offset.mV[VX], aligned_st_offset.mV[VX], 16) && + is_approx_equal_fraction(st_offset.mV[VY], aligned_st_offset.mV[VY], 16) && + is_approx_equal_fraction(st_scale.mV[VX], aligned_st_scale.mV[VX], 16) && + is_approx_equal_fraction(st_scale.mV[VY], aligned_st_scale.mV[VY], 16) && + is_approx_equal_fraction(st_rot, aligned_st_rot, 14)) + { + return true; + } + } + return false; + } +private: + LLFace* mCenterFace; +}; + struct LLPanelFaceSendFunctor : public LLSelectedObjectFunctor { virtual bool apply(LLViewerObject* object) @@ -370,8 +464,26 @@ struct LLPanelFaceSendFunctor : public LLSelectedObjectFunctor void LLPanelFace::sendTextureInfo() { - LLPanelFaceSetTEFunctor setfunc(this); - LLSelectMgr::getInstance()->getSelection()->applyToTEs(&setfunc); + if ((bool)childGetValue("checkbox planar align").asBoolean()) + { + struct f1 : public LLSelectedTEGetFunctor + { + LLFace* get(LLViewerObject* object, S32 te) + { + return (object->mDrawable) ? object->mDrawable->getFace(te): NULL; + } + } get_last_face_func; + LLFace* last_face; + LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&get_last_face_func, last_face); + + LLPanelFaceSetAlignedTEFunctor setfunc(this, last_face); + LLSelectMgr::getInstance()->getSelection()->applyToTEs(&setfunc); + } + else + { + LLPanelFaceSetTEFunctor setfunc(this); + LLSelectMgr::getInstance()->getSelection()->applyToTEs(&setfunc); + } LLPanelFaceSendFunctor sendfunc; LLSelectMgr::getInstance()->getSelection()->applyToObjects(&sendfunc); @@ -380,7 +492,7 @@ void LLPanelFace::sendTextureInfo() void LLPanelFace::getState() { LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getFirstObject(); - + LLCalc* calcp = LLCalc::getInstance(); if( objectp && objectp->getPCode() == LL_PCODE_VOLUME && objectp->permModify()) @@ -402,6 +514,13 @@ void LLPanelFace::getState() // // //mBtnAutoFix->setEnabled ( editable ); // } + S32 selected_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); + BOOL single_volume = (LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME )) + && (selected_count == 1); + + childSetEnabled("copytextures", single_volume && editable); + childSetEnabled("pastetextures", single_volume && editable); + childSetEnabled("textbox params", single_volume && editable); childSetEnabled("button apply",editable); bool identical; @@ -481,6 +600,43 @@ void LLPanelFace::getState() } } + // planar align + bool align_planar = false; + bool identical_planar_aligned = false; + { + LLCheckBoxCtrl* cb_planar_align = getChild("checkbox planar align"); + align_planar = (cb_planar_align && cb_planar_align->get()); + struct f1 : public LLSelectedTEGetFunctor + { + bool get(LLViewerObject* object, S32 face) + { + return (object->getTE(face)->getTexGen() == LLTextureEntry::TEX_GEN_PLANAR); + } + } func; + + bool is_planar; + bool texgens_identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, is_planar ); + bool enabled = (editable && texgens_identical && is_planar); + childSetValue("checkbox planar align", align_planar && enabled); + childSetEnabled("checkbox planar align", enabled); + + if (align_planar && enabled) + { + struct f2 : public LLSelectedTEGetFunctor + { + LLFace* get(LLViewerObject* object, S32 te) + { + return (object->mDrawable) ? object->mDrawable->getFace(te): NULL; + } + } get_te_face_func; + LLFace* last_face; + LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&get_te_face_func, last_face); + LLPanelFaceGetIsAlignedTEFunctor get_is_aligend_func(last_face); + // this will determine if the texture param controls are tentative: + identical_planar_aligned = LLSelectMgr::getInstance()->getSelection()->applyToTEs(&get_is_aligend_func); + } + } + // Texture scale { childSetEnabled("tex scale",editable); @@ -494,6 +650,7 @@ void LLPanelFace::getState() } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, scale_s ); + identical = align_planar ? identical_planar_aligned : identical; childSetValue("TexScaleU",editable ? llabs(scale_s) : 0); childSetTentative("TexScaleU",LLSD((BOOL)(!identical))); childSetEnabled("TexScaleU",editable); @@ -512,6 +669,7 @@ void LLPanelFace::getState() } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, scale_t ); + identical = align_planar ? identical_planar_aligned : identical; childSetValue("TexScaleV",llabs(editable ? llabs(scale_t) : 0)); childSetTentative("TexScaleV",LLSD((BOOL)(!identical))); @@ -533,6 +691,7 @@ void LLPanelFace::getState() } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, offset_s ); + identical = align_planar ? identical_planar_aligned : identical; childSetValue("TexOffsetU", editable ? offset_s : 0); childSetTentative("TexOffsetU",!identical); childSetEnabled("TexOffsetU",editable); @@ -548,6 +707,7 @@ void LLPanelFace::getState() } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, offset_t ); + identical = align_planar ? identical_planar_aligned : identical; childSetValue("TexOffsetV", editable ? offset_t : 0); childSetTentative("TexOffsetV",!identical); childSetEnabled("TexOffsetV",editable); @@ -565,6 +725,7 @@ void LLPanelFace::getState() } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, rotation ); + identical = align_planar ? identical_planar_aligned : identical; childSetValue("TexRot", editable ? rotation * RAD_TO_DEG : 0); childSetTentative("TexRot",!identical); childSetEnabled("TexRot",editable); @@ -757,6 +918,15 @@ void LLPanelFace::getState() childSetEnabled("button apply",enabled); } } + + // Set variable values for numeric expressions + calcp->setVar(LLCalc::TEX_U_SCALE, childGetValue("TexScaleU").asReal()); + calcp->setVar(LLCalc::TEX_V_SCALE, childGetValue("TexScaleV").asReal()); + calcp->setVar(LLCalc::TEX_U_OFFSET, childGetValue("TexOffsetU").asReal()); + calcp->setVar(LLCalc::TEX_V_OFFSET, childGetValue("TexOffsetV").asReal()); + calcp->setVar(LLCalc::TEX_ROTATION, childGetValue("TexRot").asReal()); + calcp->setVar(LLCalc::TEX_TRANSPARENCY, childGetValue("ColorTrans").asReal()); + calcp->setVar(LLCalc::TEX_GLOW, childGetValue("glow").asReal()); } else { @@ -792,6 +962,16 @@ void LLPanelFace::getState() childSetEnabled("button align",FALSE); childSetEnabled("button apply",FALSE); + + + // Set variable values for numeric expressions + calcp->clearVar(LLCalc::TEX_U_SCALE); + calcp->clearVar(LLCalc::TEX_V_SCALE); + calcp->clearVar(LLCalc::TEX_U_OFFSET); + calcp->clearVar(LLCalc::TEX_V_OFFSET); + calcp->clearVar(LLCalc::TEX_ROTATION); + calcp->clearVar(LLCalc::TEX_TRANSPARENCY); + calcp->clearVar(LLCalc::TEX_GLOW); } } @@ -978,3 +1158,69 @@ void LLPanelFace::onClickAutoFix(void* userdata) LLPanelFaceSendFunctor sendfunc; LLSelectMgr::getInstance()->getSelection()->applyToObjects(&sendfunc); } +// static +void LLPanelFace::onCommitPlanarAlign(LLUICtrl* ctrl, void* userdata) +{ + LLPanelFace* self = (LLPanelFace*) userdata; + self->getState(); + self->sendTextureInfo(); +} + +static LLSD textures; + +void LLPanelFace::onClickCopy(void* userdata) +{ + LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(); + if(!objectp) + { + objectp = LLSelectMgr::getInstance()->getSelection()->getFirstObject(); + if (!objectp) + { + return; + } + } + S32 te_count = objectp->getNumFaces(); + textures.clear(); + for (S32 i = 0; i < te_count; i++) + { + llinfos << "Copying params on face " << i << "." << llendl; + textures.append(objectp->getTE(i)->asLLSD()); + } +} + +void LLPanelFace::onClickPaste(void* userdata) +{ + LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(); + if(!objectp) + { + objectp = LLSelectMgr::getInstance()->getSelection()->getFirstObject(); + if (!objectp) + { + return; + } + } + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_ObjectImage); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + + msg->nextBlockFast(_PREHASH_ObjectData); + msg->addU32Fast(_PREHASH_ObjectLocalID, objectp->getLocalID()); + msg->addStringFast(_PREHASH_MediaURL, NULL); + + LLPrimitive obj; + obj.setNumTEs(U8(textures.size())); + + for (int i = 0; i < textures.size(); i++) + { + llinfos << "Pasting params on face " << i << "." << llendl; + LLTextureEntry tex; + tex.fromLLSD(textures[i]); + obj.setTE(U8(i), tex); + } + + obj.packTEMessage(gMessageSystem); + + msg->sendReliable(gAgent.getRegion()->getHost()); +} diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index a2ead0c8a..9363f076a 100644 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -86,9 +86,12 @@ protected: static void onCommitShiny( LLUICtrl* ctrl, void* userdata); static void onCommitFullbright( LLUICtrl* ctrl, void* userdata); static void onCommitGlow( LLUICtrl* ctrl, void *userdata); + static void onCommitPlanarAlign( LLUICtrl* ctrl, void* userdata); static void onClickApply(void*); static void onClickAutoFix(void*); + static void onClickCopy(void*); + static void onClickPaste(void*); static F32 valueGlow(LLViewerObject* object, S32 face); }; diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index af8e5388f..338be40d9 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -526,6 +526,8 @@ void settings_setup_listeners() gSavedSettings.getControl("RenderFastAlpha")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _1)); gSavedSettings.getControl("RenderObjectBump")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _1)); gSavedSettings.getControl("RenderMaxVBOSize")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _1)); + //See LL jira VWR-3258 comment section. Implemented by LL in 2.1 -Shyotl + gSavedSettings.getControl("ShyotlRenderUseStreamVBO")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _1)); gSavedSettings.getControl("RenderUseFBO")->getSignal()->connect(boost::bind(&handleRenderUseFBOChanged, _1)); gSavedSettings.getControl("RenderDeferredNoise")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _1)); gSavedSettings.getControl("RenderUseImpostors")->getSignal()->connect(boost::bind(&handleRenderUseImpostorsChanged, _1)); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index b1913b3dc..776c62762 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -747,20 +747,13 @@ void init_menus() LLMenuGL*menu; menu = new LLMenuGL("Ascent"); - menu->append(new LLMenuItemCallGL( "Object Area Search", &handle_area_search, NULL)); + menu->append(new LLMenuItemCallGL( "Close All Dialogs", + &handle_close_all_notifications, NULL, NULL, 'D', MASK_CONTROL | MASK_ALT | MASK_SHIFT)); + menu->appendSeparator(); menu->append(new LLMenuItemCallGL( "Fake Away Status", &handle_fake_away_status, NULL)); menu->append(new LLMenuItemCallGL( "Force Ground Sit", &handle_force_ground_sit, NULL)); menu->append(new LLMenuItemCallGL( "Phantom Avatar", &handle_phantom_avatar, NULL)); - menu->append(new LLMenuItemCallGL( "Toggle IM Typing Notification", &handle_hide_typing_notification, NULL)); - menu->append(new LLMenuItemCallGL( "Close All Dialogs", - &handle_close_all_notifications, NULL, NULL, 'D', MASK_CONTROL | MASK_ALT | MASK_SHIFT)); - menu->append(new LLMenuItemCallGL( "Message Log", &handle_open_message_log, NULL)); - - menu->append(new LLMenuItemCallGL( "Sound Explorer", - &handle_sounds_explorer, NULL)); - menu->append(new LLMenuItemCallGL( "Asset Blacklist", - &handle_blacklist, NULL)); - + menu->appendSeparator(); menu->append(new LLMenuItemCheckGL( "Enable AO", &menu_toggle_control, NULL, @@ -778,6 +771,17 @@ void init_menus() NULL, &menu_check_control, (void*)"ReSit")); + menu->appendSeparator(); + menu->append(new LLMenuItemCallGL( "Object Area Search", &handle_area_search, NULL)); + menu->append(new LLMenuItemCallGL( "Message Log", &handle_open_message_log, NULL)); + + menu->append(new LLMenuItemCallGL( "Sound Explorer", + &handle_sounds_explorer, NULL)); + menu->append(new LLMenuItemCallGL( "Asset Blacklist", + &handle_blacklist, NULL)); + + + // // Add in the pose stand ------------------------------------------- LLMenuGL* sub = new LLMenuGL("Pose Stand"); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index cf0bb3f0b..298166ea9 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -102,6 +102,10 @@ #include "llspatialpartition.h" #include "llmutelist.h" +#if !LL_DARWIN +#include "llfloaterhardwaresettings.h" +#endif + #ifdef _DEBUG // Debug indices is disabled for now for debug performance - djs 4/24/02 //#define DEBUG_INDICES @@ -321,6 +325,7 @@ void LLPipeline::init() sDynamicLOD = gSavedSettings.getBOOL("RenderDynamicLOD"); sRenderBump = gSavedSettings.getBOOL("RenderObjectBump"); + LLVertexBuffer::sUseStreamDraw = gSavedSettings.getBOOL("ShyotlRenderUseStreamVBO"); sRenderAttachedLights = gSavedSettings.getBOOL("RenderAttachedLights"); sRenderAttachedParticles = gSavedSettings.getBOOL("RenderAttachedParticles"); @@ -4911,6 +4916,10 @@ void LLPipeline::setUseVBO(BOOL use_vbo) resetVertexBuffers(); LLVertexBuffer::initClass(use_vbo); +#if !LL_DARWIN + if(LLFloaterHardwareSettings::isOpen()) + LLFloaterHardwareSettings::instance()->refreshEnabledState(); +#endif } } diff --git a/indra/newview/skins/default/xui/en-us/floater_hardware_settings.xml b/indra/newview/skins/default/xui/en-us/floater_hardware_settings.xml index 57731429b..aab647014 100644 --- a/indra/newview/skins/default/xui/en-us/floater_hardware_settings.xml +++ b/indra/newview/skins/default/xui/en-us/floater_hardware_settings.xml @@ -63,7 +63,12 @@ mouse_opaque="true" name="vbo" radio_style="false" tool_tip="Enabling this on modern hardware gives a performance gain. However, older hardware often has poor implementations of VBOs and you may get crashes when this is enabled." width="315" /> - + + -