Linux multi-monitor fullscreen support
[ryzomcore.git] / nel / tools / 3d / object_viewer / auto_lod_dlg.cpp
blobbaeba1afd761c88c568425ba650c29d7c39f362c
1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
18 // auto_lod_dlg.cpp : implementation file
21 #include "std_afx.h"
22 #include "object_viewer.h"
23 #include "auto_lod_dlg.h"
24 #include "editable_range.h"
25 #include "popup_notify.h"
28 /////////////////////////////////////////////////////////////////////////////
29 // CAutoLODDlg dialog
32 CAutoLODDlg::CAutoLODDlg(CParticleWorkspace::CNode *ownerNode, NL3D::CParticleSystem *ps, IPopupNotify *pn, CWnd* pParent /* = NULL*/)
33 : _Node(ownerNode),
34 _PS(ps),
35 _PN(pn),
36 CDialog(CAutoLODDlg::IDD, pParent)
38 nlassert(ps);
39 //{{AFX_DATA_INIT(CAutoLODDlg)
40 // NOTE: the ClassWizard will add member initialization here
41 //}}AFX_DATA_INIT
45 void CAutoLODDlg::init(CWnd *pParent)
47 Create(IDD_AUTO_LOD, pParent);
48 ShowWindow(SW_SHOW);
51 void CAutoLODDlg::DoDataExchange(CDataExchange* pDX)
53 CDialog::DoDataExchange(pDX);
54 //{{AFX_DATA_MAP(CAutoLODDlg)
55 // NOTE: the ClassWizard will add DDX and DDV calls here
56 //}}AFX_DATA_MAP
60 BEGIN_MESSAGE_MAP(CAutoLODDlg, CDialog)
61 //{{AFX_MSG_MAP(CAutoLODDlg)
62 ON_WM_CLOSE()
63 ON_CBN_SELCHANGE(IDC_DEGRADATION_EXPONENT, OnSelchangeDegradationExponent)
64 ON_BN_CLICKED(IDC_SKIP_PARTICLES, OnSkipParticles)
65 //}}AFX_MSG_MAP
66 END_MESSAGE_MAP()
68 /////////////////////////////////////////////////////////////////////////////
69 // CAutoLODDlg message handlers
71 void CAutoLODDlg::OnClose()
73 CDialog::OnClose();
74 if (_PN)
75 _PN->childPopupClosed(this);
78 BOOL CAutoLODDlg::OnInitDialog()
80 CDialog::OnInitDialog();
82 _DistRatioWrapper.PS = _PS;
83 _MaxDistLODBiasWrapper.PS = _PS;
85 RECT r;
87 // Edit the distance at which LOD starts
88 CEditableRangeFloat *erf = new CEditableRangeFloat("AUTO_LOD_DIST_RATIO", _Node, 0.f, 0.99f);
89 erf->enableUpperBound(1.f, true);
90 erf->enableLowerBound(0.f, false);
91 erf->setWrapper(&_DistRatioWrapper);
92 GetDlgItem(IDC_START_PERCENT_DIST)->GetWindowRect(&r);
93 ScreenToClient(&r);
94 erf->init(r.left, r.top, this);
95 pushWnd(erf);
97 // For non-shared systems only : Set the LOD bias at the max distance, so that some particles are still displayed
98 erf = new CEditableRangeFloat("MAX_DIST_LOD_BIAS", _Node, 0.f, 1.0f);
99 erf->enableUpperBound(1.f, false);
100 erf->enableLowerBound(0.f, false);
101 erf->setWrapper(&_MaxDistLODBiasWrapper);
102 GetDlgItem(IDC_MAX_DIST_LOD_BIAS)->GetWindowRect(&r);
103 ScreenToClient(&r);
104 erf->init(r.left, r.top, this);
105 pushWnd(erf);
107 if (_PS->isSharingEnabled())
109 erf->EnableWindow(FALSE);
110 GetDlgItem(IDC_MAX_DIST_BIAS_TEXT)->EnableWindow(FALSE);
112 else
114 GetDlgItem(IDC_SKIP_PARTICLES)->ShowWindow(FALSE);
119 ((CComboBox *) GetDlgItem(IDC_DEGRADATION_EXPONENT))->SetCurSel(std::min(4, (sint) _PS->getAutoLODDegradationExponent()) - 1);
120 ((CButton *) GetDlgItem(IDC_SKIP_PARTICLES))->SetCheck(_PS->getAutoLODMode() ? 1 : 0);
122 return TRUE; // return TRUE unless you set the focus to a control
123 // EXCEPTION: OCX Property Pages should return FALSE
126 void CAutoLODDlg::OnSelchangeDegradationExponent()
128 _PS->setupAutoLOD(_PS->getAutoLODStartDistPercent(),
129 ((CComboBox *) GetDlgItem(IDC_DEGRADATION_EXPONENT))->GetCurSel() + 1);
132 void CAutoLODDlg::OnSkipParticles()
134 _PS->setAutoLODMode(((CButton *) GetDlgItem(IDC_SKIP_PARTICLES))->GetCheck() != 0);