diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/CMakeLists.txt | 3 | ||||
-rw-r--r-- | indra/newview/llfloatermodelpreview.cpp | 96 | ||||
-rw-r--r-- | indra/newview/llspatialpartition.cpp | 126 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_model_preview.xml | 3 |
4 files changed, 152 insertions, 76 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 304ef4bd59..73f752b218 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1469,6 +1469,9 @@ if (WINDOWS) ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libapr-1.dll ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libaprutil-1.dll ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libapriconv-1.dll + ${SHARED_LIB_STAGING_DIR}/Release/glod.dll + ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/glod.dll + ${SHARED_LIB_STAGING_DIR}/Debug/glod.dll ${SHARED_LIB_STAGING_DIR}/Release/openjpeg.dll ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/openjpeg.dll ${SHARED_LIB_STAGING_DIR}/Debug/openjpegd.dll diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index b0cde6962b..a78d0075c2 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -269,8 +269,6 @@ BOOL LLFloaterModelPreview::postBuild() childSetCommitCallback("show edges", onShowEdgesCommit, this); childSetCommitCallback("auto fill", onAutoFillCommit, this); - childSetCommitCallback("explode", onExplodeCommit, this); - childSetTextArg("status", "[STATUS]", getString("status_idle")); for (S32 lod = 0; lod < LLModel::NUM_LODS; ++lod) @@ -535,7 +533,7 @@ void LLFloaterModelPreview::onShowEdgesCommit(LLUICtrl* ctrl, void* userdata) //static void LLFloaterModelPreview::onExplodeCommit(LLUICtrl* ctrl, void* userdata) { - LLFloaterModelPreview* fp = (LLFloaterModelPreview*) userdata; + LLFloaterModelPreview* fp = LLFloaterModelPreview::sInstance; fp->mModelPreview->refresh(); } @@ -778,7 +776,7 @@ void LLFloaterModelPreview::showDecompFloater() mDecompFloater = new LLPhysicsDecompFloater(key); S32 left = 20; - S32 right = 270; + S32 right = 320; S32 cur_y = 30; @@ -839,15 +837,19 @@ void LLFloaterModelPreview::showDecompFloater() continue; } + std::string name(param[i].mName ? param[i].mName : ""); + std::string description(param[i].mDescription ? param[i].mDescription : ""); + if (param[i].mType == LLCDParam::LLCD_FLOAT) { LLSliderCtrl::Params p; - p.name(param[i].mName); - p.label(param[i].mName); + p.name(name); + p.label(name); p.rect(LLRect(left, cur_y, right, cur_y-20)); p.min_value(param[i].mDetails.mRange.mLow.mFloat); p.max_value(param[i].mDetails.mRange.mHigh.mFloat); p.increment(param[i].mDetails.mRange.mDelta.mFloat); + p.tool_tip(description); p.decimal_digits(3); p.initial_value(param[i].mDefault.mFloat); LLSliderCtrl* slider = LLUICtrlFactory::create<LLSliderCtrl>(p); @@ -858,12 +860,13 @@ void LLFloaterModelPreview::showDecompFloater() else if (param[i].mType == LLCDParam::LLCD_INTEGER) { LLSliderCtrl::Params p; - p.name(param[i].mName); - p.label(param[i].mName); + p.name(name); + p.label(name); p.rect(LLRect(left, cur_y, right, cur_y-20)); p.min_value(param[i].mDetails.mRange.mLow.mIntOrEnumValue); p.max_value(param[i].mDetails.mRange.mHigh.mIntOrEnumValue); p.increment(param[i].mDetails.mRange.mDelta.mIntOrEnumValue); + p.tool_tip(description); p.initial_value(param[i].mDefault.mIntOrEnumValue); LLSliderCtrl* slider = LLUICtrlFactory::create<LLSliderCtrl>(p); slider->setCommitCallback(onPhysicsParamCommit, (void*) ¶m[i]); @@ -874,9 +877,10 @@ void LLFloaterModelPreview::showDecompFloater() { LLCheckBoxCtrl::Params p; p.rect(LLRect(left, cur_y, right, cur_y-20)); - p.name(param[i].mName); - p.label(param[i].mName); + p.name(name); + p.label(name); p.initial_value(param[i].mDefault.mBool); + p.tool_tip(description); LLCheckBoxCtrl* check_box = LLUICtrlFactory::create<LLCheckBoxCtrl>(p); check_box->setCommitCallback(onPhysicsParamCommit, (void*) ¶m[i]); mDecompFloater->addChild(check_box); @@ -884,24 +888,61 @@ void LLFloaterModelPreview::showDecompFloater() } else if (param[i].mType == LLCDParam::LLCD_ENUM) { - LLComboBox::Params p; - p.rect(LLRect(left, cur_y, right/3, cur_y-20)); - p.name(param[i].mName); - p.label(param[i].mName); - LLComboBox* combo_box = LLUICtrlFactory::create<LLComboBox>(p); - for (S32 k = 0; k < param[i].mDetails.mEnumValues.mNumEnums; ++k) - { - combo_box->add(param[i].mDetails.mEnumValues.mEnumsArray[k].mName, - LLSD::Integer(param[i].mDetails.mEnumValues.mEnumsArray[k].mValue)); + S32 cur_x = left; + + { //add label + LLTextBox::Params p; + const LLFontGL* font = (LLFontGL*) p.font(); + + p.rect(LLRect(left, cur_y, left+font->getWidth(name), cur_y-20)); + p.name(name); + p.label(name); + p.initial_value(name); + LLTextBox* text_box = LLUICtrlFactory::create<LLTextBox>(p); + mDecompFloater->addChild(text_box); + cur_x += text_box->getRect().getWidth(); + } + + { //add combo_box + LLComboBox::Params p; + p.rect(LLRect(cur_x, cur_y, right-right/4, cur_y-20)); + p.name(name); + p.label(name); + p.tool_tip(description); + + LLComboBox* combo_box = LLUICtrlFactory::create<LLComboBox>(p); + for (S32 k = 0; k < param[i].mDetails.mEnumValues.mNumEnums; ++k) + { + combo_box->add(param[i].mDetails.mEnumValues.mEnumsArray[k].mName, + LLSD::Integer(param[i].mDetails.mEnumValues.mEnumsArray[k].mValue)); + } + combo_box->setValue(param[i].mDefault.mIntOrEnumValue); + combo_box->setCommitCallback(onPhysicsParamCommit, (void*) ¶m[i]); + mDecompFloater->addChild(combo_box); + cur_y += 30; } - combo_box->setValue(param[i].mDefault.mIntOrEnumValue); - combo_box->setCommitCallback(onPhysicsParamCommit, (void*) ¶m[i]); - mDecompFloater->addChild(combo_box); - cur_y += 30; } } } + cur_y += 30; + //explode slider + { + LLSliderCtrl::Params p; + p.initial_value(0); + p.min_value(0); + p.max_value(1); + p.decimal_digits(2); + p.increment(0.05f); + p.label("Explode"); + p.name("explode"); + p.rect(LLRect(left, cur_y, right, cur_y-20)); + LLSliderCtrl* slider = LLUICtrlFactory::create<LLSliderCtrl>(p); + + mDecompFloater->addChild(slider); + cur_y += 30; + } + //mesh render checkbox { LLCheckBoxCtrl::Params p; @@ -928,15 +969,16 @@ void LLFloaterModelPreview::showDecompFloater() LLTextBox::Params p; p.label("Model"); p.name("model label"); - p.rect(LLRect(right/3, cur_y, right/2, cur_y-20)); + p.rect(LLRect(right/2, cur_y, right-right/3, cur_y-20)); LLTextBox* text_box = LLUICtrlFactory::create<LLTextBox>(p); text_box->setValue("Model"); mDecompFloater->addChild(text_box); } + { //add submesh combo box LLComboBox::Params p; - p.rect(LLRect(right/2, cur_y, right, cur_y-20)); + p.rect(LLRect(right-right/2+p.font()->getWidth("Model"), cur_y, right, cur_y-20)); p.name("model"); LLComboBox* combo_box = LLUICtrlFactory::create<LLComboBox>(p); for (S32 i = 0; i < mModelPreview->mBaseModel.size(); ++i) @@ -956,6 +998,8 @@ void LLFloaterModelPreview::showDecompFloater() mDecompFloater->setRect(LLRect(10, cur_y+20, right+20, 10)); } + mDecompFloater->childSetCommitCallback("explode", LLFloaterModelPreview::onExplodeCommit, this); + mDecompFloater->openFloater(); } @@ -2922,7 +2966,7 @@ BOOL LLModelPreview::render() mFMP->childSetEnabled("consolidate", !avatar_preview); - F32 explode = mFMP->childGetValue("explode").asReal(); + F32 explode = mFMP->mDecompFloater ? mFMP->mDecompFloater->childGetValue("explode").asReal() : 0.f; glMatrixMode(GL_PROJECTION); gGL.popMatrix(); diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 291cc76c29..425fa42339 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -3050,33 +3050,55 @@ public: center.set(vl->mBounds[0].getF32ptr()); size.set(vl->mBounds[1].getF32ptr()); - drawBoxOutline(center, size); + for (U32 i = 0; i < 2; i++) + { + LLGLDepthTest depth(GL_TRUE, GL_FALSE, i == 1 ? GL_LEQUAL : GL_GREATER); + + if (i == 1) + { + gGL.color4f(0,1,1,0.5f); + } + else + { + gGL.color4f(0,0.5f,0.5f, 0.25f); + } + + drawBoxOutline(center, size); + + gGL.begin(LLRender::TRIANGLES); + for (LLOctreeNode<LLVolumeTriangle>::const_element_iter iter = branch->getData().begin(); + iter != branch->getData().end(); + ++iter) + { + const LLVolumeTriangle* tri = *iter; + + gGL.vertex3fv(tri->mV[0]->getF32ptr()); + gGL.vertex3fv(tri->mV[1]->getF32ptr()); + gGL.vertex3fv(tri->mV[2]->getF32ptr()); + } + gGL.end(); + } } }; void renderRaycast(LLDrawable* drawablep) { - if (drawablep->getVObj() != gDebugRaycastObject) - { - return; - } - if (drawablep->getNumFaces()) { LLGLEnable blend(GL_BLEND); gGL.color4f(0,1,1,0.5f); - if (drawablep->getVOVolume() && gDebugRaycastFaceHit != -1) + if (drawablep->getVOVolume()) { - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - pushVerts(drawablep->getFace(gDebugRaycastFaceHit), LLVertexBuffer::MAP_VERTEX); - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + //glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + //pushVerts(drawablep->getFace(gDebugRaycastFaceHit), LLVertexBuffer::MAP_VERTEX); + //glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); LLVOVolume* vobj = drawablep->getVOVolume(); LLVolume* volume = vobj->getVolume(); - if (volume && volume->getNumVolumeFaces() > gDebugRaycastFaceHit) + for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i) { - const LLVolumeFace& face = volume->getVolumeFace(gDebugRaycastFaceHit); + const LLVolumeFace& face = volume->getVolumeFace(i); if (!face.mOctree) { ((LLVolumeFace*) &face)->createOctree(); @@ -3089,50 +3111,58 @@ void renderRaycast(LLDrawable* drawablep) end = vobj->agentPositionToVolume(gDebugRaycastEnd); LLRenderOctreeRaycast render(start, end); + gGL.flush(); + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); render.traverse(face.mOctree); gGL.popMatrix(); + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); } } else if (drawablep->isAvatar()) { - LLGLDepthTest depth(GL_FALSE); - LLVOAvatar* av = (LLVOAvatar*) drawablep->getVObj().get(); - av->renderCollisionVolumes(); - } - - // draw intersection point - glPushMatrix(); - glLoadMatrixd(gGLModelView); - LLVector3 translate = gDebugRaycastIntersection; - glTranslatef(translate.mV[0], translate.mV[1], translate.mV[2]); - LLCoordFrame orient; - orient.lookDir(gDebugRaycastNormal, gDebugRaycastBinormal); - LLMatrix4 rotation; - orient.getRotMatrixToParent(rotation); - glMultMatrixf((float*)rotation.mMatrix); - - gGL.color4f(1,0,0,0.5f); - drawBox(LLVector3(0, 0, 0), LLVector3(0.1f, 0.022f, 0.022f)); - gGL.color4f(0,1,0,0.5f); - drawBox(LLVector3(0, 0, 0), LLVector3(0.021f, 0.1f, 0.021f)); - gGL.color4f(0,0,1,0.5f); - drawBox(LLVector3(0, 0, 0), LLVector3(0.02f, 0.02f, 0.1f)); - glPopMatrix(); - - // draw bounding box of prim - const LLVector4a* ext = drawablep->getSpatialExtents(); - - LLVector4a pos; - pos.setAdd(ext[0], ext[1]); - pos.mul(0.5f); - LLVector4a size; - size.setSub(ext[1], ext[0]); - size.mul(0.5f); + if (drawablep->getVObj() == gDebugRaycastObject) + { + LLGLDepthTest depth(GL_FALSE); + LLVOAvatar* av = (LLVOAvatar*) drawablep->getVObj().get(); + av->renderCollisionVolumes(); + } + } - LLGLDepthTest depth(GL_FALSE, GL_TRUE); - gGL.color4f(0,0.5f,0.5f,1); - drawBoxOutline(pos, size); + if (drawablep->getVObj() == gDebugRaycastObject) + { + // draw intersection point + glPushMatrix(); + glLoadMatrixd(gGLModelView); + LLVector3 translate = gDebugRaycastIntersection; + glTranslatef(translate.mV[0], translate.mV[1], translate.mV[2]); + LLCoordFrame orient; + orient.lookDir(gDebugRaycastNormal, gDebugRaycastBinormal); + LLMatrix4 rotation; + orient.getRotMatrixToParent(rotation); + glMultMatrixf((float*)rotation.mMatrix); + + gGL.color4f(1,0,0,0.5f); + drawBox(LLVector3(0, 0, 0), LLVector3(0.1f, 0.022f, 0.022f)); + gGL.color4f(0,1,0,0.5f); + drawBox(LLVector3(0, 0, 0), LLVector3(0.021f, 0.1f, 0.021f)); + gGL.color4f(0,0,1,0.5f); + drawBox(LLVector3(0, 0, 0), LLVector3(0.02f, 0.02f, 0.1f)); + glPopMatrix(); + + // draw bounding box of prim + const LLVector4a* ext = drawablep->getSpatialExtents(); + + LLVector4a pos; + pos.setAdd(ext[0], ext[1]); + pos.mul(0.5f); + LLVector4a size; + size.setSub(ext[1], ext[0]); + size.mul(0.5f); + LLGLDepthTest depth(GL_FALSE, GL_TRUE); + gGL.color4f(0,0.5f,0.5f,1); + drawBoxOutline(pos, size); + } } } diff --git a/indra/newview/skins/default/xui/en/floater_model_preview.xml b/indra/newview/skins/default/xui/en/floater_model_preview.xml index 6508d2d68b..de9f3ee87e 100644 --- a/indra/newview/skins/default/xui/en/floater_model_preview.xml +++ b/indra/newview/skins/default/xui/en/floater_model_preview.xml @@ -44,8 +44,7 @@ <spinner bottom_delta="0" left="140" width="120" height="16" initial_value="75" label_width="60" name="edge threshold" decimal_digits="0" min_val="0" max_val="180" increment="5" label="Hard Angle" tool_tip="Maximum angle that will be smoothed between triangles when using Generate Normals"/> <check_box bottom_delta="0" left="450" label="Show Edges" name="show edges" width="120" height="16" tool_tip="Render wireframe in preview window"/> - <slider bottom_delta="30" left="340" width="240" label="Explode" name="explode" height="16" initial_value="0" min_val="0" max_val="1" decimal_digits="2" increment="0.05"/> - <text bottom_delta="0" follows="top|left" height="15" left="10" name="high_lod_label"> + <text bottom_delta="30" follows="top|left" height="15" left="10" name="high_lod_label"> High LOD: </text> <combo_box bottom_delta="0" left="97" follows="left|top" height="18" |