Sun, 24 Mar 2013 21:41:24 +0200
Considerably improved sub-file inlining. Use a matrix class instead of double[9], educated myself on what matrix multiplication actually is and fixed the algorithm up. Aside from I/O problems, 32551.dat is correctly rendered now.
30
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
1 | /* |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
2 | * LDForge: LDraw parts authoring CAD |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
3 | * Copyright (C) 2013 Santeri `arezey` Piippo |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
4 | * |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
5 | * This program is free software: you can redistribute it and/or modify |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
7 | * the Free Software Foundation, either version 3 of the License, or |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
8 | * (at your option) any later version. |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
9 | * |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
13 | * GNU General Public License for more details. |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
14 | * |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
17 | */ |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
18 | |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
19 | #include "common.h" |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
20 | #include "zz_configDialog.h" |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
21 | #include "file.h" |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
22 | #include <qgridlayout.h> |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | #include <qfiledialog.h> |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
24 | #include <qcolordialog.h> |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
25 | |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
26 | ConfigDialog* g_ConfigDialog = nullptr; |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
27 | |
54
60f328f352c9
Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
53
diff
changeset
|
28 | #define INIT_CHECKBOX(BOX, CFG) \ |
60f328f352c9
Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
53
diff
changeset
|
29 | BOX->setCheckState (CFG ? Qt::Checked : Qt::Unchecked); |
60f328f352c9
Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
53
diff
changeset
|
30 | |
60f328f352c9
Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
53
diff
changeset
|
31 | #define APPLY_CHECKBOX(BTN, CFG) \ |
60f328f352c9
Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
53
diff
changeset
|
32 | CFG = BTN->checkState() == Qt::Checked; |
60f328f352c9
Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
53
diff
changeset
|
33 | |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
34 | // ============================================================================= |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
35 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
36 | // ============================================================================= |
30
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
37 | ConfigDialog::ConfigDialog (ForgeWindow* parent) : QDialog (parent) { |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
38 | g_ConfigDialog = this; |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
39 | |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
40 | qLDrawPath = new QLineEdit; |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
41 | qLDrawPath->setText (io_ldpath.value.chars()); |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
42 | |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
43 | qLDrawPathLabel = new QLabel ("LDraw path:"); |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
44 | |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
45 | qLDrawPathFindButton = new QPushButton; |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
46 | qLDrawPathFindButton->setIcon (QIcon ("icons/folder.png")); |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
47 | connect (qLDrawPathFindButton, SIGNAL (clicked ()), |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
48 | this, SLOT (slot_findLDrawPath ())); |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
49 | |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
50 | qGLBackgroundLabel = new QLabel ("Background color:"); |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
51 | qGLBackgroundButton = new QPushButton; |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
52 | setButtonBackground (qGLBackgroundButton, gl_bgcolor.value); |
34
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
53 | connect (qGLBackgroundButton, SIGNAL (clicked ()), |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
54 | this, SLOT (slot_setGLBackground ())); |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
55 | |
34
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
56 | qGLForegroundLabel = new QLabel ("Foreground color:"); |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
57 | qGLForegroundButton = new QPushButton; |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
58 | setButtonBackground (qGLForegroundButton, gl_maincolor.value); |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
59 | connect (qGLForegroundButton, SIGNAL (clicked ()), |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
60 | this, SLOT (slot_setGLForeground ())); |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
61 | |
53
170cdffe1056
Make line thickness user-configurable, draw conditional lines dashed, use the bounding box to offset the model so that it is centered properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
52
diff
changeset
|
62 | qGLLineThicknessLabel = new QLabel ("Line thickness:"); |
170cdffe1056
Make line thickness user-configurable, draw conditional lines dashed, use the bounding box to offset the model so that it is centered properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
52
diff
changeset
|
63 | qGLLineThickness = new QSlider (Qt::Horizontal); |
170cdffe1056
Make line thickness user-configurable, draw conditional lines dashed, use the bounding box to offset the model so that it is centered properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
52
diff
changeset
|
64 | qGLLineThickness->setRange (1, 8); |
170cdffe1056
Make line thickness user-configurable, draw conditional lines dashed, use the bounding box to offset the model so that it is centered properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
52
diff
changeset
|
65 | qGLLineThickness->setSliderPosition (gl_linethickness); |
170cdffe1056
Make line thickness user-configurable, draw conditional lines dashed, use the bounding box to offset the model so that it is centered properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
52
diff
changeset
|
66 | qGLLineThickness->setTickPosition (QSlider::TicksBothSides); |
170cdffe1056
Make line thickness user-configurable, draw conditional lines dashed, use the bounding box to offset the model so that it is centered properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
52
diff
changeset
|
67 | qGLLineThickness->setTickInterval (1); |
170cdffe1056
Make line thickness user-configurable, draw conditional lines dashed, use the bounding box to offset the model so that it is centered properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
52
diff
changeset
|
68 | |
52
d71226763607
Colorized polygons now appear colorized in the list view (unless disabled). GL rendered now draws transparent polygons properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
47
diff
changeset
|
69 | qLVColorize = new QCheckBox ("Colorize polygons in list view"); |
54
60f328f352c9
Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
53
diff
changeset
|
70 | INIT_CHECKBOX (qLVColorize, lv_colorize) |
60f328f352c9
Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
53
diff
changeset
|
71 | |
60f328f352c9
Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
53
diff
changeset
|
72 | qGLColorBFC = new QCheckBox ("Red/green BFC view"); |
60f328f352c9
Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
53
diff
changeset
|
73 | INIT_CHECKBOX (qGLColorBFC, gl_colorbfc) |
52
d71226763607
Colorized polygons now appear colorized in the list view (unless disabled). GL rendered now draws transparent polygons properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
47
diff
changeset
|
74 | |
39
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
34
diff
changeset
|
75 | IMPLEMENT_DIALOG_BUTTONS |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
76 | |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
77 | QGridLayout* layout = new QGridLayout; |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
78 | layout->addWidget (qLDrawPathLabel, 0, 0); |
34
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
79 | layout->addWidget (qLDrawPath, 0, 1, 1, 2); |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
80 | layout->addWidget (qLDrawPathFindButton, 0, 3); |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
81 | |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
82 | layout->addWidget (qGLBackgroundLabel, 1, 0); |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
83 | layout->addWidget (qGLBackgroundButton, 1, 1); |
34
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
84 | layout->addWidget (qGLForegroundLabel, 1, 2); |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
85 | layout->addWidget (qGLForegroundButton, 1, 3); |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
86 | |
53
170cdffe1056
Make line thickness user-configurable, draw conditional lines dashed, use the bounding box to offset the model so that it is centered properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
52
diff
changeset
|
87 | layout->addWidget (qGLLineThicknessLabel, 2, 0); |
170cdffe1056
Make line thickness user-configurable, draw conditional lines dashed, use the bounding box to offset the model so that it is centered properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
52
diff
changeset
|
88 | layout->addWidget (qGLLineThickness, 2, 1); |
52
d71226763607
Colorized polygons now appear colorized in the list view (unless disabled). GL rendered now draws transparent polygons properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
47
diff
changeset
|
89 | |
53
170cdffe1056
Make line thickness user-configurable, draw conditional lines dashed, use the bounding box to offset the model so that it is centered properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
52
diff
changeset
|
90 | layout->addWidget (qLVColorize, 3, 0, 1, 2); |
54
60f328f352c9
Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
53
diff
changeset
|
91 | layout->addWidget (qGLColorBFC, 3, 2, 1, 2); |
53
170cdffe1056
Make line thickness user-configurable, draw conditional lines dashed, use the bounding box to offset the model so that it is centered properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
52
diff
changeset
|
92 | |
170cdffe1056
Make line thickness user-configurable, draw conditional lines dashed, use the bounding box to offset the model so that it is centered properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
52
diff
changeset
|
93 | layout->addWidget (qButtons, 4, 2, 1, 2); |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
94 | setLayout (layout); |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
95 | |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
96 | setWindowTitle (APPNAME_DISPLAY " - editing settings"); |
30
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
97 | setWindowIcon (QIcon ("icons/settings.png")); |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
98 | } |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
99 | |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
100 | // ============================================================================= |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
101 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
102 | // ============================================================================= |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
103 | ConfigDialog::~ConfigDialog() { |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
104 | g_ConfigDialog = nullptr; |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
105 | } |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
106 | |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
107 | // ============================================================================= |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
108 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
109 | // ============================================================================= |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
110 | void ConfigDialog::slot_findLDrawPath () { |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
111 | str zDir = QFileDialog::getExistingDirectory (this, "Choose LDraw directory", |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
112 | qLDrawPath->text()); |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
113 | |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
114 | if (~zDir) |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
115 | qLDrawPath->setText (zDir.chars()); |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
116 | } |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
117 | |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
118 | // ============================================================================= |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
119 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
120 | // ============================================================================= |
34
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
121 | void ConfigDialog::pickColor (strconfig& cfg, QPushButton* qButton) { |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
122 | QColorDialog dlg (QColor (cfg.value.chars())); |
33
3e0cca764fd6
Added color selection icon
Santeri Piippo <crimsondusk64@gmail.com>
parents:
32
diff
changeset
|
123 | dlg.setWindowIcon (QIcon ("icons/colorselect.png")); |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
124 | |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
125 | if (dlg.exec ()) { |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
126 | uchar r = dlg.currentColor ().red (), |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
127 | g = dlg.currentColor ().green (), |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
128 | b = dlg.currentColor ().blue (); |
34
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
129 | cfg.value.format ("#%.2X%.2X%.2X", r, g, b); |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
130 | setButtonBackground (qButton, cfg.value); |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
131 | } |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
132 | } |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
133 | |
34
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
134 | void ConfigDialog::slot_setGLBackground () { |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
135 | pickColor (gl_bgcolor, qGLBackgroundButton); |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
136 | } |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
137 | |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
138 | void ConfigDialog::slot_setGLForeground () { |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
139 | pickColor (gl_maincolor, qGLForegroundButton); |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
140 | } |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
141 | |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
142 | // ============================================================================= |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
143 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
144 | // ============================================================================= |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
145 | void ConfigDialog::setButtonBackground (QPushButton* qButton, str zValue) { |
34
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
146 | qButton->setIcon (QIcon ("icons/colorselect.png")); |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
147 | qButton->setAutoFillBackground (true); |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
148 | qButton->setStyleSheet ( |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
149 | str::mkfmt ("background-color: %s", zValue.chars()).chars() |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
150 | ); |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
151 | } |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
152 | |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
153 | // ============================================================================= |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
154 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
155 | // ============================================================================= |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
156 | void ConfigDialog::staticDialog (ForgeWindow* window) { |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
157 | ConfigDialog dlg (window); |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
158 | |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
159 | if (dlg.exec ()) { |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
160 | io_ldpath = dlg.qLDrawPath->text(); |
54
60f328f352c9
Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
53
diff
changeset
|
161 | |
60f328f352c9
Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
53
diff
changeset
|
162 | APPLY_CHECKBOX (dlg.qLVColorize, lv_colorize) |
60f328f352c9
Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
53
diff
changeset
|
163 | APPLY_CHECKBOX (dlg.qGLColorBFC, gl_colorbfc) |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
164 | |
53
170cdffe1056
Make line thickness user-configurable, draw conditional lines dashed, use the bounding box to offset the model so that it is centered properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
52
diff
changeset
|
165 | gl_linethickness = dlg.qGLLineThickness->value (); |
170cdffe1056
Make line thickness user-configurable, draw conditional lines dashed, use the bounding box to offset the model so that it is centered properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
52
diff
changeset
|
166 | |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
167 | // Save the config |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
168 | config::save (); |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
169 | |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
170 | // Reload all subfiles |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
171 | reloadAllSubfiles (); |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
172 | |
47
9dd536c1ce39
Made the GL renderer actually use the main color configuration
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
173 | window->R->setColor (gl_bgcolor, glClearColor); |
52
d71226763607
Colorized polygons now appear colorized in the list view (unless disabled). GL rendered now draws transparent polygons properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
47
diff
changeset
|
174 | window->refresh (); |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
175 | } |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
176 | } |