From aa54a386f3aa55f487e9554a75560a517c4825e5 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Mon, 13 Aug 2012 02:55:47 -0500 Subject: [PATCH 01/11] Fix regression introduced in pathfinding (avelocity bugs) --- indra/newview/llviewerobject.cpp | 18 ++++++++++++++---- indra/newview/llviewerobject.h | 1 + 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 73392750a..595ddb536 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -242,6 +242,7 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe mNumFaces(0), mTimeDilation(1.f), mRotTime(0.f), + mAngularVelocityRot(), mJointInfo(NULL), mState(0), mMedia(NULL), @@ -272,6 +273,7 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe { mPositionAgent = mRegionp->getOriginAgent(); } + resetRot(); LLViewerObject::sNumObjects++; } @@ -2131,14 +2133,14 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, if (new_rot != getRotation() || new_angv != old_angv) { - if (new_rot != getRotation()) + if (new_angv != old_angv) { - setRotation(new_rot); + resetRot(); } + // Set the rotation of the object followed by adjusting for the accumulated angular velocity (llSetTargetOmega) + setRotation(new_rot * mAngularVelocityRot); setChanged(ROTATED | SILHOUETTE); - - resetRot(); } @@ -5599,8 +5601,13 @@ void LLViewerObject::applyAngularVelocity(F32 dt) ang_vel *= 1.f/omega; + // calculate the delta increment based on the object's angular velocity dQ.setQuat(angle, ang_vel); + + // accumulate the angular velocity rotations to re-apply in the case of an object update + mAngularVelocityRot *= dQ; + // Just apply the delta increment to the current rotation setRotation(getRotation()*dQ); setChanged(MOVED | SILHOUETTE); } @@ -5609,6 +5616,9 @@ void LLViewerObject::applyAngularVelocity(F32 dt) void LLViewerObject::resetRot() { mRotTime = 0.0f; + + // Reset the accumulated angular velocity rotation + mAngularVelocityRot.loadIdentity(); } U32 LLViewerObject::getPartitionType() const diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index ac3b6ba28..20bfd7e69 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -751,6 +751,7 @@ protected: F32 mTimeDilation; // Time dilation sent with the object. F32 mRotTime; // Amount (in seconds) that object has rotated according to angular velocity (llSetTargetOmega) + LLQuaternion mAngularVelocityRot; // accumulated rotation from the angular velocity computations LLVOJointInfo* mJointInfo; U8 mState; // legacy From f2bcfa52754a4b0321d5686a49e8b750b2d3e754 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Mon, 13 Aug 2012 18:51:37 -0500 Subject: [PATCH 02/11] Use cachedcontrol in LLViewerObjectList::update. --- indra/newview/llviewerobjectlist.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index b1810eeed..800f7afe4 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -873,11 +873,14 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world) LLMemType mt(LLMemType::MTYPE_OBJECT); // Update globals - LLViewerObject::setVelocityInterpolate( gSavedSettings.getBOOL("VelocityInterpolate") ); - LLViewerObject::setPingInterpolate( gSavedSettings.getBOOL("PingInterpolate") ); + static const LLCachedControl VelocityInterpolate("VelocityInterpolate"); + static const LLCachedControl PingInterpolate("PingInterpolate"); + LLViewerObject::setVelocityInterpolate( VelocityInterpolate ); + LLViewerObject::setPingInterpolate( PingInterpolate ); - F32 interp_time = gSavedSettings.getF32("InterpolationTime"); - F32 phase_out_time = gSavedSettings.getF32("InterpolationPhaseOut"); + static LLCachedControl interp_time("InterpolationTime"); + static LLCachedControl phase_out_time("InterpolationPhaseOut"); + if (interp_time < 0.0 || phase_out_time < 0.0 || phase_out_time > interp_time) @@ -889,7 +892,8 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world) LLViewerObject::setPhaseOutUpdateInterpolationTime( interp_time ); LLViewerObject::setMaxUpdateInterpolationTime( phase_out_time ); - gAnimateTextures = gSavedSettings.getBOOL("AnimateTextures"); + static const LLCachedControl AnimateTextures("AnimateTextures"); + gAnimateTextures = AnimateTextures; // update global timer F32 last_time = gFrameTimeSeconds; From ff81d9461a74594049f3aea738a4ebcba32a7928 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Wed, 19 Sep 2012 15:33:58 -0500 Subject: [PATCH 03/11] Added motionblur postprocess shader. Conflicts: indra/newview/skins/default/xui/en-us/floater_post_process.xml --- indra/llrender/llpostprocess.cpp | 50 +++ indra/llrender/llpostprocess.h | 3 + indra/llrender/llrender.cpp | 1 + indra/llrender/llrender.h | 1 + .../windlight/postprocesseffects.xml | 4 + indra/newview/llviewerdisplay.cpp | 1 + .../xui/en-us/floater_post_process.xml | 373 +++++++++--------- 7 files changed, 256 insertions(+), 177 deletions(-) diff --git a/indra/llrender/llpostprocess.cpp b/indra/llrender/llpostprocess.cpp index 2cedee327..d1cb1b3c5 100644 --- a/indra/llrender/llpostprocess.cpp +++ b/indra/llrender/llpostprocess.cpp @@ -48,6 +48,7 @@ extern LLGLSLShader gPostColorFilterProgram; extern LLGLSLShader gPostNightVisionProgram; extern LLGLSLShader gPostGaussianBlurProgram; extern LLGLSLShader gPostPosterizeProgram; +extern LLGLSLShader gPostMotionBlurProgram; static const unsigned int NOISE_SIZE = 512; @@ -259,6 +260,53 @@ public: } }; +class LLMotionShader : public LLPostProcessShader +{ +private: + LLShaderSetting mEnabled; + LLShaderSetting mStrength; +public: + LLMotionShader() : + mEnabled("enable_motionblur",false), + mStrength("blur_strength",false) + { + mSettings.push_back(&mEnabled); + mSettings.push_back(&mStrength); + } + bool isEnabled() { return mEnabled && gPostMotionBlurProgram.mProgramObject; } + S32 getColorChannel() { return 0; } + S32 getDepthChannel() { return 1; } + QuadType bind() + { + if(!isEnabled()) + { + return QUAD_NONE; + } + + glh::matrix4f inv_proj(gGLModelView); + inv_proj.mult_left(gGLProjection); + inv_proj = inv_proj.inverse(); + glh::matrix4f prev_proj(gGLPreviousModelView); + prev_proj.mult_left(gGLProjection); + + LLVector2 screen_rect = LLPostProcess::getInstance()->getDimensions(); + + gPostMotionBlurProgram.bind(); + gPostMotionBlurProgram.uniformMatrix4fv("prev_proj", 1, GL_FALSE, prev_proj.m); + gPostMotionBlurProgram.uniformMatrix4fv("inv_proj", 1, GL_FALSE, inv_proj.m); + gPostMotionBlurProgram.uniform2fv("screen_res", 1, screen_rect.mV); + gPostMotionBlurProgram.uniform1i("blur_strength", mStrength); + } + bool draw(U32 pass) + { + return pass == 1; + } + void unbind() + { + gPostMotionBlurProgram.unbind(); + } +}; + LLPostProcess::LLPostProcess(void) : mVBO(NULL), mDepthTexture(0), @@ -269,11 +317,13 @@ LLPostProcess::LLPostProcess(void) : mSelectedEffectInfo(LLSD::emptyMap()), mAllEffectInfo(LLSD::emptyMap()) { + mShaders.push_back(new LLMotionShader()); mShaders.push_back(new LLColorFilterShader()); mShaders.push_back(new LLNightVisionShader()); mShaders.push_back(new LLGaussBlurShader()); mShaders.push_back(new LLPosterizeShader()); + /* Do nothing. Needs to be updated to use our current shader system, and to work with the move into llrender.*/ std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", XML_FILENAME)); LL_DEBUGS2("AppInit", "Shaders") << "Loading PostProcess Effects settings from " << pathName << LL_ENDL; diff --git a/indra/llrender/llpostprocess.h b/indra/llrender/llpostprocess.h index ec076842d..9ecd9e293 100644 --- a/indra/llrender/llpostprocess.h +++ b/indra/llrender/llpostprocess.h @@ -142,6 +142,9 @@ private: void drawOrthoQuad(QuadType type); //Finally draws fullscreen quad with the shader currently bound. public: + LLVector2 getDimensions() { return LLVector2(mScreenWidth,mScreenHeight); } + + // UI interaction // Getters inline LLSD const & getAllEffectInfo(void) const { return mAllEffectInfo; } diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index feedabad5..366f506a7 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -42,6 +42,7 @@ LLRender gGL; //Would be best to migrate these to LLMatrix4a and LLVector4a, but that's too divergent right now. LL_ALIGN_16(F32 gGLModelView[16]); LL_ALIGN_16(F32 gGLLastModelView[16]); +LL_ALIGN_16(F32 gGLPreviousModelView[16]); LL_ALIGN_16(F32 gGLLastProjection[16]); LL_ALIGN_16(F32 gGLProjection[16]); LL_ALIGN_16(S32 gGLViewport[4]); diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index 0d9c5326f..d8f01a75a 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -474,6 +474,7 @@ private: extern F32 gGLModelView[16]; extern F32 gGLLastModelView[16]; extern F32 gGLLastProjection[16]; +extern F32 gGLPreviousModelView[16]; extern F32 gGLProjection[16]; extern S32 gGLViewport[4]; diff --git a/indra/newview/app_settings/windlight/postprocesseffects.xml b/indra/newview/app_settings/windlight/postprocesseffects.xml index 0914b275a..b5b173b40 100644 --- a/indra/newview/app_settings/windlight/postprocesseffects.xml +++ b/indra/newview/app_settings/windlight/postprocesseffects.xml @@ -175,6 +175,8 @@ enable_gauss_blur 0 enable_posterize + 0 + enable_motionblur 0 gauss_blur_passes 2 @@ -190,6 +192,8 @@ 1 posterize_layers 10 + blur_strength + 10 \ No newline at end of file diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index c33a668f5..8c932285b 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -1025,6 +1025,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot, boo //when rendering next frame's occlusion queries for (U32 i = 0; i < 16; i++) { + gGLPreviousModelView[i] = gGLLastModelView[i]; gGLLastModelView[i] = gGLModelView[i]; gGLLastProjection[i] = gGLProjection[i]; } diff --git a/indra/newview/skins/default/xui/en-us/floater_post_process.xml b/indra/newview/skins/default/xui/en-us/floater_post_process.xml index 12e3d8ad6..2cea1fbb7 100644 --- a/indra/newview/skins/default/xui/en-us/floater_post_process.xml +++ b/indra/newview/skins/default/xui/en-us/floater_post_process.xml @@ -1,230 +1,249 @@ - - - + can_resize="false" height="400" left="50" min_height="400" + min_width="300" mouse_opaque="true" name="Post-Process Floater" + title="Post-Process Settings" width="400"> + + + + + Gamma + + - Gamma - - - + bottom_delta="-20" drop_shadow_visible="true" follows="left|top|right" + font="SansSerif" h_pad="0" halign="left" height="16" + left="10" mouse_opaque="true" name="ColorFilterBrightnessText" v_pad="0" + width="355"> Brightness + height="18" increment="0.01" initial_val="1.0" label="" left="14" + max_val="4" min_val="0" mouse_opaque="true" name="brightness" + show_text="true" value="1.0" width="200" /> + bottom_delta="-20" drop_shadow_visible="true" follows="left|top|right" + font="SansSerif" h_pad="0" halign="left" height="16" + left="10" mouse_opaque="true" name="ColorFilterSaturationText" v_pad="0" + width="355"> Saturation + height="18" increment="0.01" initial_val="1.0" label="" left="14" + max_val="2" min_val="-1" mouse_opaque="true" + name="saturation" show_text="true" value="1.0" width="200" /> + bottom_delta="-20" drop_shadow_visible="true" follows="left|top|right" + font="SansSerif" h_pad="0" halign="left" height="16" + left="10" mouse_opaque="true" name="ColorFilterContrastText" v_pad="0" + width="355"> Contrast + decimal_digits="2" follows="left" height="18" increment="0.01" + initial_val="1.0" label="" left="14" max_val="4" min_val="0" + mouse_opaque="true" name="contrast" show_text="true" + value="1.0" width="200" /> - Contrast Base Colors + bottom_delta="-20" drop_shadow_visible="true" follows="left|top|right" + font="SansSerif" h_pad="0" halign="left" height="16" + left="10" mouse_opaque="true" name="ColorFilterBaseText" v_pad="0" + width="355"> + Contrast Base Colora + decimal_digits="3" follows="left" height="18" increment="0.01" + initial_val="1.0" label="R" left="14" max_val="1" min_val="0" + mouse_opaque="true" name="contrast_base[0]" show_text="true" value="1.0" + width="200" /> + decimal_digits="3" follows="left" height="18" increment="0.01" + initial_val="1.0" label="G" left="14" max_val="1" min_val="0" + mouse_opaque="true" name="contrast_base[1]" show_text="true" value="1.0" + width="200" /> + decimal_digits="3" follows="left" height="18" increment="0.01" + initial_val="1.0" label="B" left="14" max_val="1" min_val="0" + mouse_opaque="true" name="contrast_base[2]" show_text="true" value="1.0" + width="200" /> + decimal_digits="3" follows="left" height="18" increment="0.01" + initial_val="0.5" label="I" left="14" max_val="1" min_val="0" + mouse_opaque="true" name="contrast_base[3]" show_text="true" value="1.0" + width="200" /> - - + + + bottom_delta="-21" drop_shadow_visible="true" follows="left|top|right" + font="SansSerif" h_pad="0" halign="left" height="16" + left="10" mouse_opaque="true" name="GaussBlurPassesText" v_pad="0" + width="355"> Passes to apply + decimal_digits="0" follows="left" + height="18" increment="1" initial_val="9" label="" left="14" + max_val="25" min_val="1" mouse_opaque="true" + name="gauss_blur_passes" show_text="true" value="0.7" width="200" /> - - + + + bottom_delta="-21" drop_shadow_visible="true" follows="left|top|right" + font="SansSerif" h_pad="0" halign="left" height="16" + left="10" mouse_opaque="true" name="NightVisionBrightMultText" v_pad="0" + width="355"> Light Amplification Multiple - + + bottom_delta="-20" drop_shadow_visible="true" follows="left|top|right" + font="SansSerif" h_pad="0" halign="left" height="16" + left="10" mouse_opaque="true" name="NightVisionNoiseSizeText" v_pad="0" + width="355"> Noise Size - + + bottom_delta="-20" drop_shadow_visible="true" follows="left|top|right" + font="SansSerif" h_pad="0" halign="left" height="16" + left="10" mouse_opaque="true" name="NightVisionNoiseStrengthText" + v_pad="0" width="355"> Noise Strength - - - - - - Layer Count - - + + + + + Layer Count + + + + + + + Motionblur Strength + + + + decimal_digits="3" follows="left" height="18" increment="0.01" + initial_val="1.2" label="" left="14" max_val="10" min_val="0" + mouse_opaque="true" name="BloomStrength" show_text="true" value="1.0" + width="200" /> + --> - - -