Skip to content

Commit cce4e0c

Browse files
committed
Added additional FlowViewer
1 parent 475c3ca commit cce4e0c

8 files changed

+311
-9
lines changed

GuiApplication.vcxproj

+2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\src\KoRE_GUI\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
4747
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\src\KoRE_GUI\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB "-I." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets" "-I.\src\KoRE_GUI\GeneratedFiles\$(ConfigurationName)\." "-I.\src\KoRE_GUI\GeneratedFiles" "-I.\src\KoRE_GUI"</Command>
4848
</CustomBuild>
49+
<ClInclude Include="src\KoRE_GUI\FlowItem.h" />
4950
<ClInclude Include="src\KoRE_GUI\FrameBufferStageItem.h" />
5051
<CustomBuild Include="src\KoRE_GUI\ResourceViewer.h">
5152
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
@@ -143,6 +144,7 @@
143144
<ItemGroup>
144145
<ClCompile Include="src\KoRE_GUI\BindPathItem.cpp" />
145146
<ClCompile Include="src\KoRE_GUI\ComponentItem.cpp" />
147+
<ClCompile Include="src\KoRE_GUI\FlowItem.cpp" />
146148
<ClCompile Include="src\KoRE_GUI\FrameBufferEditor.cpp" />
147149
<ClCompile Include="src\KoRE_GUI\FrameBufferStageItem.cpp" />
148150
<ClCompile Include="src\KoRE_GUI\GeneratedFiles\Debug\moc_FrameBufferEditor.cpp">

GuiApplication.vcxproj.filters

+16
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@
6767
<Filter>GeneratedFiles</Filter>
6868
</ClCompile>
6969
<ClCompile Include="src\KoRE_GUI\TextureEditor.cpp" />
70+
<ClCompile Include="src\KoRE_GUI\FlowItem.cpp">
71+
<Filter>Source Dateien</Filter>
72+
</ClCompile>
7073
</ItemGroup>
7174
<ItemGroup>
7275
<ClInclude Include="src\KoRE_GUI\ComponentItem.h" />
@@ -87,6 +90,9 @@
8790
<ClInclude Include="src\KoRE_GUI\GeneratedFiles\ui_TextureEditor.h">
8891
<Filter>GeneratedFiles</Filter>
8992
</ClInclude>
93+
<ClInclude Include="src\KoRE_GUI\FlowItem.h">
94+
<Filter>Header Dateien</Filter>
95+
</ClInclude>
9096
</ItemGroup>
9197
<ItemGroup>
9298
<CustomBuild Include="src\KoRE_GUI\FrameBufferEditor.h" />
@@ -109,5 +115,15 @@
109115
<Filter Include="GeneratedFiles">
110116
<UniqueIdentifier>{c25fc98e-e0ef-430f-81aa-b7932db20124}</UniqueIdentifier>
111117
</Filter>
118+
<Filter Include="Header Dateien">
119+
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
120+
<Extensions>h</Extensions>
121+
<ParseFiles>true</ParseFiles>
122+
</Filter>
123+
<Filter Include="Source Dateien">
124+
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
125+
<Extensions>cpp;cxx;c;def</Extensions>
126+
<ParseFiles>true</ParseFiles>
127+
</Filter>
112128
</ItemGroup>
113129
</Project>

src/KoRE_GUI/FlowItem.cpp

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
Copyright (c) 2012 The KoRE Project
3+
4+
This file is part of KoRE.
5+
6+
KoRE is free software: you can redistribute it and/or modify
7+
it under the terms of the GNU General Public License as published by
8+
the Free Software Foundation, either version 3 of the License, or
9+
(at your option) any later version.
10+
11+
KoRE is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with KoRE. If not, see <http://www.gnu.org/licenses/>.
18+
*/
19+
20+
/************************************************************************/
21+
/* \author Dominik Ospelt */
22+
/************************************************************************/
23+
24+
#include "KoRE_GUI/FlowItem.h"
25+
26+
#include <QPainter>
27+
28+
koregui::FlowItem::FlowItem(EFlowType flowType, QGraphicsItem* parent) {
29+
30+
}
31+
32+
koregui::FlowItem::~FlowItem(void) {
33+
34+
}
35+
36+
void koregui::FlowItem::refresh(void) {
37+
38+
}
39+
40+
QRectF koregui::FlowItem::boundingRect() const {
41+
return QRectF(0,0,10,10);
42+
}
43+
44+
void koregui::FlowItem::paint(QPainter* painter,
45+
const QStyleOptionGraphicsItem* option,
46+
QWidget* widget ) {
47+
painter->drawRect(0,0,10,10);
48+
}

src/KoRE_GUI/FlowItem.h

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
Copyright (c) 2012 The KoRE Project
3+
4+
This file is part of KoRE.
5+
6+
KoRE is free software: you can redistribute it and/or modify
7+
it under the terms of the GNU General Public License as published by
8+
the Free Software Foundation, either version 3 of the License, or
9+
(at your option) any later version.
10+
11+
KoRE is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with KoRE. If not, see <http://www.gnu.org/licenses/>.
18+
*/
19+
20+
/************************************************************************/
21+
/* \author Dominik Ospelt */
22+
/************************************************************************/
23+
24+
#ifndef SRC_KOREGUI_FLOWITEM_H_
25+
#define SRC_KOREGUI_FLOWITEM_H_
26+
27+
#include <QGraphicsItem>
28+
29+
#include "KoRE/Passes/FrameBufferStage.h"
30+
#include "KoRE/Passes/ShaderProgramPass.h"
31+
#include "KoRE/Passes/NodePass.h"
32+
33+
namespace koregui {
34+
enum EFlowType {
35+
FLOW_FRAMEBUFFERSTAGE,
36+
FLOW_PROGRAMPASS,
37+
FLOW_NODEPASS,
38+
FLOW_OPERATION
39+
};
40+
class FlowItem : public QGraphicsItem {
41+
public:
42+
FlowItem(EFlowType flowType, QGraphicsItem* parent = 0);
43+
~FlowItem(void);
44+
45+
void refresh(void);
46+
inline int getHeight(void) {return _itemheight;}
47+
inline int getWidth(void) {return _itemwidth;}
48+
inline EFlowType getType(void) {return _type;}
49+
50+
protected:
51+
QRectF boundingRect() const;
52+
void paint(QPainter* painter,
53+
const QStyleOptionGraphicsItem* option,
54+
QWidget* widget);
55+
56+
private:
57+
EFlowType _type;
58+
kore::FrameBufferStage* _stage;
59+
kore::ShaderProgramPass* _programpass;
60+
kore::NodePass* _nodepass;
61+
kore::Operation* _op;
62+
int _itemheight, _itemwidth;
63+
};
64+
}
65+
#endif // SRC_KOREGUI_FLOWITEM_H_
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
/****************************************************************************
2+
** Meta object code from reading C++ file 'TextureEditor.h'
3+
**
4+
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.0.1)
5+
**
6+
** WARNING! All changes made in this file will be lost!
7+
*****************************************************************************/
8+
9+
#include "../../TextureEditor.h"
10+
#include <QtCore/qbytearray.h>
11+
#include <QtCore/qmetatype.h>
12+
#if !defined(Q_MOC_OUTPUT_REVISION)
13+
#error "The header file 'TextureEditor.h' doesn't include <QObject>."
14+
#elif Q_MOC_OUTPUT_REVISION != 67
15+
#error "This file was generated using the moc from 5.0.1. It"
16+
#error "cannot be used with the include files from this version of Qt."
17+
#error "(The moc has changed too much.)"
18+
#endif
19+
20+
QT_BEGIN_MOC_NAMESPACE
21+
struct qt_meta_stringdata_koregui__TextureEditor_t {
22+
QByteArrayData data[3];
23+
char stringdata[33];
24+
};
25+
#define QT_MOC_LITERAL(idx, ofs, len) \
26+
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
27+
offsetof(qt_meta_stringdata_koregui__TextureEditor_t, stringdata) + ofs \
28+
- idx * sizeof(QByteArrayData) \
29+
)
30+
static const qt_meta_stringdata_koregui__TextureEditor_t qt_meta_stringdata_koregui__TextureEditor = {
31+
{
32+
QT_MOC_LITERAL(0, 0, 22),
33+
QT_MOC_LITERAL(1, 23, 7),
34+
QT_MOC_LITERAL(2, 31, 0)
35+
},
36+
"koregui::TextureEditor\0refresh\0\0"
37+
};
38+
#undef QT_MOC_LITERAL
39+
40+
static const uint qt_meta_data_koregui__TextureEditor[] = {
41+
42+
// content:
43+
7, // revision
44+
0, // classname
45+
0, 0, // classinfo
46+
1, 14, // methods
47+
0, 0, // properties
48+
0, 0, // enums/sets
49+
0, 0, // constructors
50+
0, // flags
51+
0, // signalCount
52+
53+
// slots: name, argc, parameters, tag, flags
54+
1, 0, 19, 2, 0x0a,
55+
56+
// slots: parameters
57+
QMetaType::Void,
58+
59+
0 // eod
60+
};
61+
62+
void koregui::TextureEditor::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
63+
{
64+
if (_c == QMetaObject::InvokeMetaMethod) {
65+
TextureEditor *_t = static_cast<TextureEditor *>(_o);
66+
switch (_id) {
67+
case 0: _t->refresh(); break;
68+
default: ;
69+
}
70+
}
71+
Q_UNUSED(_a);
72+
}
73+
74+
const QMetaObject koregui::TextureEditor::staticMetaObject = {
75+
{ &QWidget::staticMetaObject, qt_meta_stringdata_koregui__TextureEditor.data,
76+
qt_meta_data_koregui__TextureEditor, qt_static_metacall, 0, 0}
77+
};
78+
79+
80+
const QMetaObject *koregui::TextureEditor::metaObject() const
81+
{
82+
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
83+
}
84+
85+
void *koregui::TextureEditor::qt_metacast(const char *_clname)
86+
{
87+
if (!_clname) return 0;
88+
if (!strcmp(_clname, qt_meta_stringdata_koregui__TextureEditor.stringdata))
89+
return static_cast<void*>(const_cast< TextureEditor*>(this));
90+
return QWidget::qt_metacast(_clname);
91+
}
92+
93+
int koregui::TextureEditor::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
94+
{
95+
_id = QWidget::qt_metacall(_c, _id, _a);
96+
if (_id < 0)
97+
return _id;
98+
if (_c == QMetaObject::InvokeMetaMethod) {
99+
if (_id < 1)
100+
qt_static_metacall(this, _c, _id, _a);
101+
_id -= 1;
102+
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
103+
if (_id < 1)
104+
*reinterpret_cast<int*>(_a[0]) = -1;
105+
_id -= 1;
106+
}
107+
return _id;
108+
}
109+
QT_END_MOC_NAMESPACE
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/********************************************************************************
2+
** Form generated from reading UI file 'TextureEditor.ui'
3+
**
4+
** Created by: Qt User Interface Compiler version 5.0.1
5+
**
6+
** WARNING! All changes made in this file will be lost when recompiling UI file!
7+
********************************************************************************/
8+
9+
#ifndef UI_TEXTUREEDITOR_H
10+
#define UI_TEXTUREEDITOR_H
11+
12+
#include <QtCore/QVariant>
13+
#include <QtWidgets/QAction>
14+
#include <QtWidgets/QApplication>
15+
#include <QtWidgets/QButtonGroup>
16+
#include <QtWidgets/QHeaderView>
17+
#include <QtWidgets/QWidget>
18+
19+
QT_BEGIN_NAMESPACE
20+
21+
class Ui_TextureEditor
22+
{
23+
public:
24+
25+
void setupUi(QWidget *TextureEditor)
26+
{
27+
if (TextureEditor->objectName().isEmpty())
28+
TextureEditor->setObjectName(QStringLiteral("TextureEditor"));
29+
TextureEditor->resize(400, 300);
30+
31+
retranslateUi(TextureEditor);
32+
33+
QMetaObject::connectSlotsByName(TextureEditor);
34+
} // setupUi
35+
36+
void retranslateUi(QWidget *TextureEditor)
37+
{
38+
TextureEditor->setWindowTitle(QApplication::translate("TextureEditor", "TextureEditor", 0));
39+
} // retranslateUi
40+
41+
};
42+
43+
namespace Ui {
44+
class TextureEditor: public Ui_TextureEditor {};
45+
} // namespace Ui
46+
47+
QT_END_NAMESPACE
48+
49+
#endif // UI_TEXTUREEDITOR_H

src/KoRE_GUI/ShaderEditor.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,9 @@ void koregui::ShaderEditor::applyChanges(void) {
197197
QLineEdit* lineedit;
198198
QComboBox* stype;
199199
for (int i = 0; i < ui.shaderTable->rowCount(); i++) {
200-
lineedit = static_cast<QLineEdit*>(ui.shaderTable->cellWidget(i, 1));
200+
lineedit = static_cast<QLineEdit*>(ui.shaderTable
201+
->cellWidget(i, 1)
202+
->childAt(1,1));
201203
stype = static_cast<QComboBox*>(ui.shaderTable->cellWidget(i, 0));
202204
std::string path = lineedit->text().toStdString();
203205
GLenum typ = stype->itemData(stype->currentIndex()).toUInt();
@@ -217,7 +219,9 @@ void koregui::ShaderEditor::pathButtonPressed(int row) {
217219
"./assets/",
218220
tr("Shader (*.vp *.vert *.fp *.frag *.gp *.geom *.shader)"));
219221
QString s = QDir::currentPath();
220-
QLineEdit* led = static_cast<QLineEdit*>(ui.shaderTable->cellWidget(row,1));
222+
fileName.remove(s);
223+
fileName.prepend(".");
224+
QLineEdit* led = static_cast<QLineEdit*>(ui.shaderTable->cellWidget(row,1)->childAt(1,1));
221225
if (fileName != "") led->setText(fileName);
222226
}
223227

src/KoRE_GUI/main.cpp

+16-7
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,24 @@ int main(int argc, char *argv[]) {
8484
rview->show();
8585

8686
// demo startup loading
87-
kore::ResourceManager::getInstance()->loadScene("./assets/meshes/cube.dae");
88-
std::vector<kore::SceneNode*> cube;
89-
kore::SceneManager::getInstance()->getSceneNodesByName("Cube", cube);
87+
kore::ResourceManager::getInstance()->loadScene("./assets/meshes/TestEnv.dae");
88+
std::vector<kore::SceneNode*> finder;
89+
kore::SceneManager::getInstance()->getSceneNodesByName("Cube", finder);
90+
kore::SceneNode* cube = (finder.size() > 0) ? finder[0] : NULL;
91+
finder.clear();
92+
kore::SceneManager::getInstance()->getSceneNodesByName("Flat", finder);
93+
kore::SceneNode* flat = (finder.size() > 0) ? finder[0] : NULL;
9094
kore::Texture* tex = kore::ResourceManager::getInstance()->loadTexture("./assets/textures/checkerboard.png");
91-
kore::Texture* tex2 = kore::ResourceManager::getInstance()->loadTexture("./assets/textures/stonewall.png");
95+
kore::Texture* tex1 = kore::ResourceManager::getInstance()->loadTexture("./assets/textures/stonewall.png");
96+
kore::Texture* tex2 = kore::ResourceManager::getInstance()->loadTexture("./assets/textures/stonewall_NM_height.png");
9297
kore::TexturesComponent* pTexComponent = new kore::TexturesComponent;
93-
pTexComponent->addTexture(tex);
94-
pTexComponent->addTexture(tex2);
95-
cube[0]->addComponent(pTexComponent);
98+
if (tex1) pTexComponent->addTexture(tex1);
99+
if (tex2) pTexComponent->addTexture(tex2);
100+
if (cube) cube->addComponent(pTexComponent);
101+
kore::TexturesComponent* pTexComponent1 = new kore::TexturesComponent;
102+
if (tex1) pTexComponent1->addTexture(tex1);
103+
if (tex2) pTexComponent1->addTexture(tex2);
104+
if (flat) flat->addComponent(pTexComponent1);
96105
kore::SceneManager::getInstance()->update();
97106
sview->showScene(kore::SceneManager::getInstance()->getRootNode());
98107

0 commit comments

Comments
 (0)