diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2010-12-13 17:51:14 -0500 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2010-12-13 17:51:14 -0500 |
commit | 27f11d9868bc72e7096ae6266af1c6c9318c545e (patch) | |
tree | 12190521b6870891072e312c8b3e8864721aa075 /indra/newview/llfloatermodelwizard.cpp | |
parent | fbab245e487650d6420c9fe33cf07123af12f422 (diff) | |
parent | dd06d42c09e5e1f4b28559059ec8393e53f767a7 (diff) |
merge
Diffstat (limited to 'indra/newview/llfloatermodelwizard.cpp')
-rw-r--r-- | indra/newview/llfloatermodelwizard.cpp | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/indra/newview/llfloatermodelwizard.cpp b/indra/newview/llfloatermodelwizard.cpp new file mode 100644 index 0000000000..79c29ef017 --- /dev/null +++ b/indra/newview/llfloatermodelwizard.cpp @@ -0,0 +1,111 @@ +/** + * @file llfloatermodelwizard.cpp + * @author Leyla Farazha + * @brief Implementation of the LLFloaterModelWizard class. + * + * $LicenseInfo:firstyear=2002&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 "llviewerprecompiledheaders.h" + +#include "lldrawable.h" +#include "llfloater.h" +#include "llfloatermodelwizard.h" +#include "llfloatermodelpreview.h" +#include "llfloaterreg.h" + + + +LLFloaterModelWizard::LLFloaterModelWizard(const LLSD& key) + : LLFloater(key) +{ +} + +void LLFloaterModelWizard::loadModel() +{ + mModelPreview->mLoading = TRUE; + + (new LLMeshFilePicker(mModelPreview, 3))->getFile(); +} + + +BOOL LLFloaterModelWizard::postBuild() +{ + LLView* preview_panel = getChild<LLView>("preview_panel"); + + childSetValue("import_scale", (F32) 0.67335826); + + getChild<LLUICtrl>("browse")->setCommitCallback(boost::bind(&LLFloaterModelWizard::loadModel, this)); + + mPreviewRect = preview_panel->getRect(); + + mModelPreview = new LLModelPreview(512, 512, this); + mModelPreview->setPreviewTarget(16.f); + + center(); + + return TRUE; +} + +void LLFloaterModelWizard::draw() +{ + LLFloater::draw(); + LLRect r = getRect(); + + mModelPreview->update(); + + if (mModelPreview && mModelPreview->mModelLoader) + { + gGL.color3f(1.f, 1.f, 1.f); + + gGL.getTexUnit(0)->bind(mModelPreview); + + + LLView* preview_panel = getChild<LLView>("preview_panel"); + + LLRect rect = preview_panel->getRect(); + if (rect != mPreviewRect) + { + mModelPreview->refresh(); + mPreviewRect = preview_panel->getRect(); + } + + LLRect item_rect; + preview_panel->localRectToOtherView(preview_panel->getLocalRect(), &item_rect, this); + + gGL.begin( LLRender::QUADS ); + { + gGL.texCoord2f(0.f, 1.f); + gGL.vertex2i(item_rect.mLeft, item_rect.mTop); + gGL.texCoord2f(0.f, 0.f); + gGL.vertex2i(item_rect.mLeft, item_rect.mBottom); + gGL.texCoord2f(1.f, 0.f); + gGL.vertex2i(item_rect.mRight, item_rect.mBottom); + gGL.texCoord2f(1.f, 1.f); + gGL.vertex2i(item_rect.mRight, item_rect.mTop); + } + gGL.end(); + + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + } +} |