1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
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);
}
}
|