diff options
author | Oz Linden <oz@lindenlab.com> | 2011-10-28 16:48:04 -0400 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2011-10-28 16:48:04 -0400 |
commit | 74d5fa086ceff89a43c9450e7db46708db8ee8f8 (patch) | |
tree | d24e710ffa68d5aa4e526a1129dd9d15a2eb49bc /indra/newview | |
parent | f49f6c8ef27bb73179f12d82401026ec2bb49155 (diff) | |
parent | 850bd75c46eb3b8416e8c9e02040171e8adad963 (diff) |
merge changes for storm-1622
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llglsandbox.cpp | 8 | ||||
-rw-r--r-- | indra/newview/llviewermenu.cpp | 8 | ||||
-rw-r--r-- | indra/newview/llwind.cpp | 115 | ||||
-rw-r--r-- | indra/newview/llwind.h | 7 | ||||
-rw-r--r-- | indra/newview/pipeline.cpp | 5 | ||||
-rw-r--r-- | indra/newview/pipeline.h | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_viewer.xml | 10 |
7 files changed, 42 insertions, 113 deletions
diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index fa3f546157..2b9c113a72 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -240,7 +240,7 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask) gViewerWindow->setup3DRender(); } -const F32 WIND_ALTITUDE = 180.f; +const F32 WIND_RELATIVE_ALTITUDE = 25.f; void LLWind::renderVectors() { @@ -254,13 +254,13 @@ void LLWind::renderVectors() gGL.pushMatrix(); LLVector3 origin_agent; origin_agent = gAgent.getPosAgentFromGlobal(mOriginGlobal); - gGL.translatef(origin_agent.mV[VX], origin_agent.mV[VY], WIND_ALTITUDE); + gGL.translatef(origin_agent.mV[VX], origin_agent.mV[VY], gAgent.getPositionAgent().mV[VZ] + WIND_RELATIVE_ALTITUDE); for (j = 0; j < mSize; j++) { for (i = 0; i < mSize; i++) { - x = mCloudVelX[i + j*mSize] * WIND_SCALE_HACK; - y = mCloudVelY[i + j*mSize] * WIND_SCALE_HACK; + x = mVelX[i + j*mSize] * WIND_SCALE_HACK; + y = mVelY[i + j*mSize] * WIND_SCALE_HACK; gGL.pushMatrix(); gGL.translatef((F32)i * region_width_meters/mSize, (F32)j * region_width_meters/mSize, 0.0); gGL.color3f(0,1,0); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 2345fbfd6a..0909714951 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -968,6 +968,10 @@ U32 info_display_from_string(std::string info_display) { return LLPipeline::RENDER_DEBUG_SCULPTED; } + else if ("wind vectors" == info_display) + { + return LLPipeline::RENDER_DEBUG_WIND_VECTORS; + } else { return 0; @@ -980,6 +984,8 @@ class LLAdvancedToggleInfoDisplay : public view_listener_t { U32 info_display = info_display_from_string( userdata.asString() ); + LL_INFOS("ViewerMenu") << "toggle " << userdata.asString() << LL_ENDL; + if ( info_display != 0 ) { LLPipeline::toggleRenderDebug( (void*)info_display ); @@ -997,6 +1003,8 @@ class LLAdvancedCheckInfoDisplay : public view_listener_t U32 info_display = info_display_from_string( userdata.asString() ); bool new_value = false; + LL_INFOS("ViewerMenu") << "check " << userdata.asString() << LL_ENDL; + if ( info_display != 0 ) { new_value = LLPipeline::toggleRenderDebugControl( (void*)info_display ); diff --git a/indra/newview/llwind.cpp b/indra/newview/llwind.cpp index 69d3090442..4c39fb5b74 100644 --- a/indra/newview/llwind.cpp +++ b/indra/newview/llwind.cpp @@ -46,16 +46,12 @@ #include "llworld.h" -const F32 CLOUD_DIVERGENCE_COEF = 0.5f; - - ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// LLWind::LLWind() -: mSize(16), - mCloudDensityp(NULL) +: mSize(16) { init(); } @@ -65,8 +61,6 @@ LLWind::~LLWind() { delete [] mVelX; delete [] mVelY; - delete [] mCloudVelX; - delete [] mCloudVelY; } @@ -77,31 +71,23 @@ LLWind::~LLWind() void LLWind::init() { + LL_DEBUGS("Wind") << "initializing wind size: "<< mSize << LL_ENDL; + // Initialize vector data mVelX = new F32[mSize*mSize]; mVelY = new F32[mSize*mSize]; - mCloudVelX = new F32[mSize*mSize]; - mCloudVelY = new F32[mSize*mSize]; - S32 i; for (i = 0; i < mSize*mSize; i++) { mVelX[i] = 0.5f; mVelY[i] = 0.5f; - mCloudVelX[i] = 0.0f; - mCloudVelY[i] = 0.0f; } } void LLWind::decompress(LLBitPack &bitpack, LLGroupHeader *group_headerp) { - if (!mCloudDensityp) - { - return; - } - LLPatchHeader patch_header; S32 buffer[16*16]; @@ -122,22 +108,15 @@ void LLWind::decompress(LLBitPack &bitpack, LLGroupHeader *group_headerp) decode_patch(bitpack, buffer); decompress_patch(mVelY, buffer, &patch_header); - - S32 i, j, k; - // HACK -- mCloudVelXY is the same as mVelXY, except we add a divergence - // that is proportional to the gradient of the cloud density - // ==> this helps to clump clouds together - // NOTE ASSUMPTION: cloud density has the same dimensions as the wind field - // This needs to be fixed... causes discrepency at region boundaries for (j=1; j<mSize-1; j++) { for (i=1; i<mSize-1; i++) { k = i + j * mSize; - *(mCloudVelX + k) = *(mVelX + k) + CLOUD_DIVERGENCE_COEF * (*(mCloudDensityp + k + 1) - *(mCloudDensityp + k - 1)); - *(mCloudVelY + k) = *(mVelY + k) + CLOUD_DIVERGENCE_COEF * (*(mCloudDensityp + k + mSize) - *(mCloudDensityp + k - mSize)); + *(mVelX + k) = *(mVelX + k); + *(mVelY + k) = *(mVelY + k); } } @@ -145,29 +124,29 @@ void LLWind::decompress(LLBitPack &bitpack, LLGroupHeader *group_headerp) for (j=1; j<mSize-1; j++) { k = i + j * mSize; - *(mCloudVelX + k) = *(mVelX + k) + CLOUD_DIVERGENCE_COEF * (*(mCloudDensityp + k) - *(mCloudDensityp + k - 2)); - *(mCloudVelY + k) = *(mVelY + k) + CLOUD_DIVERGENCE_COEF * (*(mCloudDensityp + k + mSize) - *(mCloudDensityp + k - mSize)); + *(mVelX + k) = *(mVelX + k); + *(mVelY + k) = *(mVelY + k); } i = 0; for (j=1; j<mSize-1; j++) { k = i + j * mSize; - *(mCloudVelX + k) = *(mVelX + k) + CLOUD_DIVERGENCE_COEF * (*(mCloudDensityp + k + 2) - *(mCloudDensityp + k)); - *(mCloudVelY + k) = *(mVelY + k) + CLOUD_DIVERGENCE_COEF * (*(mCloudDensityp + k + mSize) - *(mCloudDensityp + k + mSize)); + *(mVelX + k) = *(mVelX + k); + *(mVelY + k) = *(mVelY + k); } j = mSize - 1; for (i=1; i<mSize-1; i++) { k = i + j * mSize; - *(mCloudVelX + k) = *(mVelX + k) + CLOUD_DIVERGENCE_COEF * (*(mCloudDensityp + k + 1) - *(mCloudDensityp + k - 1)); - *(mCloudVelY + k) = *(mVelY + k) + CLOUD_DIVERGENCE_COEF * (*(mCloudDensityp + k) - *(mCloudDensityp + k - 2*mSize)); + *(mVelX + k) = *(mVelX + k); + *(mVelY + k) = *(mVelY + k); } j = 0; for (i=1; i<mSize-1; i++) { k = i + j * mSize; - *(mCloudVelX + k) = *(mVelX + k) + CLOUD_DIVERGENCE_COEF * (*(mCloudDensityp + k + 1) - *(mCloudDensityp + k -1)); - *(mCloudVelY + k) = *(mVelY + k) + CLOUD_DIVERGENCE_COEF * (*(mCloudDensityp + k + 2*mSize) - *(mCloudDensityp + k)); + *(mVelX + k) = *(mVelX + k); + *(mVelY + k) = *(mVelY + k); } } @@ -280,74 +259,6 @@ LLVector3 LLWind::getVelocity(const LLVector3 &pos_region) return r_val * WIND_SCALE_HACK; } - -LLVector3 LLWind::getCloudVelocity(const LLVector3 &pos_region) -{ - llassert(mSize == 16); - // Resolves value of wind at a location relative to SW corner of region - // - // Returns wind magnitude in X,Y components of vector3 - LLVector3 r_val; - F32 dx,dy; - S32 k; - - LLVector3 pos_clamped_region(pos_region); - - F32 region_width_meters = LLWorld::getInstance()->getRegionWidthInMeters(); - - if (pos_clamped_region.mV[VX] < 0.f) - { - pos_clamped_region.mV[VX] = 0.f; - } - else if (pos_clamped_region.mV[VX] >= region_width_meters) - { - pos_clamped_region.mV[VX] = (F32) fmod(pos_clamped_region.mV[VX], region_width_meters); - } - - if (pos_clamped_region.mV[VY] < 0.f) - { - pos_clamped_region.mV[VY] = 0.f; - } - else if (pos_clamped_region.mV[VY] >= region_width_meters) - { - pos_clamped_region.mV[VY] = (F32) fmod(pos_clamped_region.mV[VY], region_width_meters); - } - - - S32 i = llfloor(pos_clamped_region.mV[VX] * mSize / region_width_meters); - S32 j = llfloor(pos_clamped_region.mV[VY] * mSize / region_width_meters); - k = i + j*mSize; - dx = ((pos_clamped_region.mV[VX] * mSize / region_width_meters) - (F32) i); - dy = ((pos_clamped_region.mV[VY] * mSize / region_width_meters) - (F32) j); - - if ((i < mSize-1) && (j < mSize-1)) - { - // Interior points, no edges - r_val.mV[VX] = mCloudVelX[k]*(1.0f - dx)*(1.0f - dy) + - mCloudVelX[k + 1]*dx*(1.0f - dy) + - mCloudVelX[k + mSize]*dy*(1.0f - dx) + - mCloudVelX[k + mSize + 1]*dx*dy; - r_val.mV[VY] = mCloudVelY[k]*(1.0f - dx)*(1.0f - dy) + - mCloudVelY[k + 1]*dx*(1.0f - dy) + - mCloudVelY[k + mSize]*dy*(1.0f - dx) + - mCloudVelY[k + mSize + 1]*dx*dy; - } - else - { - r_val.mV[VX] = mCloudVelX[k]; - r_val.mV[VY] = mCloudVelY[k]; - } - - r_val.mV[VZ] = 0.f; - return r_val * WIND_SCALE_HACK; -} - - -void LLWind::setCloudDensityPointer(F32 *densityp) -{ - mCloudDensityp = densityp; -} - void LLWind::setOriginGlobal(const LLVector3d &origin_global) { mOriginGlobal = origin_global; diff --git a/indra/newview/llwind.h b/indra/newview/llwind.h index 925cb6d642..3b57f07124 100644 --- a/indra/newview/llwind.h +++ b/indra/newview/llwind.h @@ -27,7 +27,6 @@ #ifndef LL_LLWIND_H #define LL_LLWIND_H -//#include "vmath.h" #include "llmath.h" #include "v3math.h" #include "v3dmath.h" @@ -44,25 +43,21 @@ public: ~LLWind(); void renderVectors(); LLVector3 getVelocity(const LLVector3 &location); // "location" is region-local - LLVector3 getCloudVelocity(const LLVector3 &location); // "location" is region-local LLVector3 getVelocityNoisy(const LLVector3 &location, const F32 dim); // "location" is region-local void decompress(LLBitPack &bitpack, LLGroupHeader *group_headerp); LLVector3 getAverage(); - void setCloudDensityPointer(F32 *densityp); void setOriginGlobal(const LLVector3d &origin_global); private: S32 mSize; F32 * mVelX; F32 * mVelY; - F32 * mCloudVelX; - F32 * mCloudVelY; - F32 * mCloudDensityp; LLVector3d mOriginGlobal; void init(); + LOG_CLASS(LLWind); }; #endif diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index a50f66f282..93354e6579 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -4383,6 +4383,11 @@ void LLPipeline::renderDebug() } } + if (mRenderDebugMask & RENDER_DEBUG_WIND_VECTORS) + { + gAgent.getRegion()->mWind.renderVectors(); + } + if (mRenderDebugMask & RENDER_DEBUG_COMPOSITION) { // Debug composition layers diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 27ee2745b5..0661de8cec 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -438,7 +438,7 @@ public: RENDER_DEBUG_VERIFY = 0x0000002, RENDER_DEBUG_BBOXES = 0x0000004, RENDER_DEBUG_OCTREE = 0x0000008, - RENDER_DEBUG_PICKING = 0x0000010, + RENDER_DEBUG_WIND_VECTORS = 0x0000010, RENDER_DEBUG_OCCLUSION = 0x0000020, RENDER_DEBUG_POINTS = 0x0000040, RENDER_DEBUG_TEXTURE_PRIORITY = 0x0000080, diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 63e50b0b9f..01f9c23afd 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -2437,6 +2437,16 @@ parameter="raycast" /> </menu_item_check> <menu_item_check + label="Wind Vectors" + name="Wind Vectors"> + <menu_item_check.on_check + function="Advanced.CheckInfoDisplay" + parameter="wind vectors" /> + <menu_item_check.on_click + function="Advanced.ToggleInfoDisplay" + parameter="wind vectors" /> + </menu_item_check> + <menu_item_check label="Render Complexity" name="rendercomplexity"> <menu_item_check.on_check |