- kicked the Irrlicht idea (this is not going to work like I thought)
authorAkiko <akiko@linux-addicted.net>
Thu, 10 Oct 2013 05:06:25 +0000 (07:06 +0200)
committerAkiko <akiko@linux-addicted.net>
Thu, 10 Oct 2013 05:06:25 +0000 (07:06 +0200)
- removed Irrlicht and ZLIB requirements from the makefiles (both handled by Qt5)
- updated all missing language tags (English/German)
- added DatWindow skeleton (will be a dat file viewer and later an editor)
- added ObjectWindow skeleton (will be a 3d object viewer/editor for meshes, BSP and highfields)
- added a small tool for BSP file viewing (just a "can I do it?" study)
- added engine subpart, here all the mesh, highfield and BSP stuff will go
- fixed some minor bugs (wrong connections, etc)
- some code cleanups

21 files changed:
CMakeLists.txt
cmake_distclean.sh
cmake_modules/FindIrrlicht.cmake [deleted file]
editor/CMakeLists.txt
editor/DatWindow.cxx [new file with mode: 0644]
editor/DatWindow.hxx [new file with mode: 0644]
editor/DatWindow.ui [new file with mode: 0644]
editor/MainWindow.cxx
editor/MainWindow.hxx
editor/MainWindow.ui
editor/ObjectWindow.cxx [new file with mode: 0644]
editor/ObjectWindow.hxx [new file with mode: 0644]
editor/ObjectWindow.ui [new file with mode: 0644]
editor/i18n_english.ts
editor/i18n_french.ts
editor/i18n_german.ts
engine/CMakeLists.txt [new file with mode: 0644]
engine/GLWidget.cxx [new file with mode: 0644]
engine/GLWidget.hxx [new file with mode: 0644]
tools/CMakeLists.txt
tools/bsp_viewer.cxx [new file with mode: 0644]

index 772944d..56e198e 100644 (file)
@@ -1,14 +1,12 @@
 cmake_minimum_required (VERSION 2.8.8)
 project                (QTinns)
-set                    (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake_modules/")
 
 # needed packages
-find_package           (Qt5Core)
-find_package           (Qt5Widgets)
-find_package           (Qt5Network)
-find_package           (Qt5LinguistTools)
-find_package           (ZLIB REQUIRED)
-find_package           (Irrlicht REQUIRED)
+find_package           (Qt5Core REQUIRED)
+find_package           (Qt5Widgets REQUIRED)
+find_package           (Qt5Network REQUIRED)
+find_package           (Qt5OpenGL REQUIRED)
+find_package           (Qt5LinguistTools REQUIRED)
 
 # includes and outputs
 set                    (CMAKE_INCLUDE_CURRENT_DIR on)
@@ -23,8 +21,8 @@ set                    (CMAKE_C_FLAGS "-std=c++11 -W -Wall -Wextra -Os")
 
 #add_subdirectory       (analyzer)
 add_subdirectory       (editor)
+add_subdirectory       (engine)
 add_subdirectory       (filesystem)
-#add_subdirectory       (renderer)
 #add_subdirectory       (server)
 add_subdirectory       (tests)
 add_subdirectory       (tools)
index e67620c..94d3d59 100755 (executable)
@@ -21,6 +21,13 @@ rm -rf editor/cmake_install.cmake
 rm -rf editor/*.qrc.depends
 rm -rf editor/moc_*.*
 
+rm -rf engine/CMakeCache.txt
+rm -rf engine/CMakeFiles/
+rm -rf engine/Makefile
+rm -rf engine/cmake_install.cmake
+rm -rf engine/*.qrc.depends
+rm -rf engine/moc_*.*
+
 rm -rf filesystem/CMakeCache.txt
 rm -rf filesystem/CMakeFiles/
 rm -rf filesystem/Makefile
@@ -28,13 +35,6 @@ rm -rf filesystem/cmake_install.cmake
 rm -rf filesystem/*.qrc.depends
 rm -rf filesystem/moc_*.*
 
-rm -rf renderer/CMakeCache.txt
-rm -rf renderer/CMakeFiles/
-rm -rf renderer/Makefile
-rm -rf renderer/cmake_install.cmake
-rm -rf renderer/*.qrc.depends
-rm -rf renderer/moc_*.*
-
 rm -rf server/CMakeCache.txt
 rm -rf server/CMakeFiles/
 rm -rf server/Makefile
diff --git a/cmake_modules/FindIrrlicht.cmake b/cmake_modules/FindIrrlicht.cmake
deleted file mode 100644 (file)
index d1cafb8..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-set (IRRLICHT_FOUND TRUE)
-
-find_path (
-    IRRLICHT_INCLUDE_DIRS
-    NAMES
-        irrlicht.h
-    HINTS
-        ENV
-        IRRLICHT_ROOT
-    PATHS
-        /usr
-        /usr/local
-    PATH_SUFFIXES
-        include
-        irrlicht
-)
-
-find_library (
-    IRRLICHT_LIBRARY
-        Irrlicht
-    HINTS
-        ENV
-        IRRLICHT_ROOT
-    PATHS
-        /usr/lib
-        /usr/local/lib
-)
-
-if (IRRLICHT_INCLUDE_DIRS AND EXISTS "${IRRLICHT_INCLUDE_DIRS}/IrrCompileConfig.h")
-    file (STRINGS "${IRRLICHT_INCLUDE_DIRS}/IrrCompileConfig.h"
-          verstr REGEX "^#define[ \t]+IRRLICHT_SDK_VERSION[ \t]+\".+\""
-    )
-    string (REGEX REPLACE "^#define[ \t]+IRRLICHT_SDK_VERSION[ \t]+\"([^\"]+)\".*" "\\1"
-            IRRLICHT_VERSION_STRING "${verstr}"
-    )
-    unset (verstr)
-endif ()
-
-include (FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS (Irrlicht REQUIRED_VARS IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIRS VERSION_VAR IRRLICHT_VERSION_STRING)
-
-mark_as_advanced (IRRLICHT_INCLUDE_DIRS IRRLICHT_LIBRARIES)
index fe3ac52..080a8c6 100644 (file)
@@ -1,17 +1,19 @@
 # Qt sources
-set                   (E_SOURCES Main.cxx MainWindow.cxx ImageWindow.cxx TextWindow.cxx)
-set                   (E_HEADERS MainWindow.hxx ImageWindow.hxx TextWindow.hxx)
-set                   (E_UI_FILES MainWindow.ui ImageWindow.ui TextWindow.ui)
-set                   (E_RES_FILES Resources.qrc)
-set                   (E_TS_FILES i18n_english.ts i18n_french.ts i18n_german.ts)
+set                   (ED_SOURCES Main.cxx MainWindow.cxx ImageWindow.cxx TextWindow.cxx DatWindow.cxx
+                                  ObjectWindow.cxx)
+set                   (ED_HEADERS MainWindow.hxx ImageWindow.hxx TextWindow.hxx DatWindow.hxx ObjectWindow.hxx)
+set                   (ED_UI_FILES MainWindow.ui ImageWindow.ui TextWindow.ui DatWindow.ui ObjectWindow.ui)
+set                   (ED_RES_FILES Resources.qrc)
+set                   (ED_TS_FILES i18n_english.ts i18n_french.ts i18n_german.ts)
 
 # wrappers
-QT5_ADD_TRANSLATION   (E_TS_SOURCES ${E_TS_FILES})
-QT5_WRAP_CPP          (E_MOC_SOURCES ${E_HEADERS})
-QT5_WRAP_UI           (E_UI_SOURCES ${E_UI_FILES})
-QT5_ADD_RESOURCES     (E_RES_SOURCES ${E_RES_FILES})
+QT5_ADD_TRANSLATION   (ED_TS_SOURCES ${ED_TS_FILES})
+QT5_WRAP_CPP          (ED_MOC_SOURCES ${ED_HEADERS})
+QT5_WRAP_UI           (ED_UI_SOURCES ${ED_UI_FILES})
+QT5_ADD_RESOURCES     (ED_RES_SOURCES ${ED_RES_FILES})
 
 # apps
-add_executable        (QTinNS_Editor ${E_SOURCES} ${E_MOC_SOURCES} ${E_UI_SOURCES} ${E_RES_SOURCES} ${E_TS_SOURCES})
+add_executable        (QTinNS_Editor ${ED_SOURCES} ${ED_MOC_SOURCES} ${ED_UI_SOURCES} ${ED_RES_SOURCES}
+                                     ${ED_TS_SOURCES})
 qt5_use_modules       (QTinNS_Editor Core Widgets)
-target_link_libraries (QTinNS_Editor Filesystem)
+target_link_libraries (QTinNS_Editor Filesystem Engine)
diff --git a/editor/DatWindow.cxx b/editor/DatWindow.cxx
new file mode 100644 (file)
index 0000000..624c9f8
--- /dev/null
@@ -0,0 +1,64 @@
+#include "DatWindow.hxx"
+#include "ui_DatWindow.h"
+
+// --- constructors and deconstructors ---
+
+DatWindow::DatWindow(QWidget *parent)
+: QMainWindow(parent), _ui(new Ui::DatWindow), _num(0)
+{
+    _ui->setupUi(this);
+
+    setupActions();
+    setMode(Mode::Fresh);
+}
+
+DatWindow::~DatWindow()
+{
+    delete _ui;
+}
+
+// --- public slots ---
+
+void DatWindow::slotDatSave()
+{
+}
+
+void DatWindow::slotDatDiscard()
+{
+}
+
+void DatWindow::slotDatView(NCFile& entry, quint32 row)
+{
+}
+
+// --- protected methods ---
+
+void DatWindow::changeEvent(QEvent *event)
+{
+    if (event->type() == QEvent::LanguageChange)
+        _ui->retranslateUi(this);
+    else
+        QMainWindow::changeEvent(event);
+}
+
+void DatWindow::setMode(const Mode mode)
+{
+    switch (mode)
+    {
+        case Mode::Edited:
+            _ui->act_dat_save->setEnabled(true);
+
+            break;
+        case Mode::Fresh:
+        default:
+            _ui->act_dat_save->setEnabled(false);
+    }
+}
+
+void DatWindow::setupActions()
+{
+    connect(_ui->act_dat_save, SIGNAL(triggered()),
+            this, SLOT(slotDatSave()));
+    connect(_ui->act_dat_cancel, SIGNAL(triggered()),
+            this, SLOT(slotDatDiscard()));
+}
diff --git a/editor/DatWindow.hxx b/editor/DatWindow.hxx
new file mode 100644 (file)
index 0000000..7a245dc
--- /dev/null
@@ -0,0 +1,41 @@
+#pragma once
+
+#include <QMainWindow>
+#include "filesystem/NCFile.hxx"
+
+namespace Ui
+{
+    class DatWindow;
+}
+
+class DatWindow : public QMainWindow {
+    Q_OBJECT
+signals:
+    void sigDatUpdate(NCFile& entry, quint32 row) const;
+    void sigDatIgnored() const;
+
+public:
+    enum class Mode : quint8 {
+        Fresh,
+        Edited
+    };
+
+    explicit DatWindow(QWidget *parent = 0);
+    virtual ~DatWindow();
+
+public slots:
+    void slotDatSave();
+    void slotDatDiscard();
+
+    void slotDatView(NCFile& entry, quint32 row);
+
+protected:
+    virtual void changeEvent(QEvent *event);
+    void setMode(const Mode mode = Mode::Fresh);
+    void setupActions();
+
+private:
+    Ui::DatWindow *_ui;
+    NCFile _entry;
+    quint32 _num;
+};
diff --git a/editor/DatWindow.ui b/editor/DatWindow.ui
new file mode 100644 (file)
index 0000000..075d988
--- /dev/null
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DatWindow</class>
+ <widget class="QMainWindow" name="DatWindow">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>800</width>
+    <height>600</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>FRM-DAT</string>
+  </property>
+  <property name="locale">
+   <locale language="English" country="UnitedStates"/>
+  </property>
+  <widget class="QWidget" name="wid_central"/>
+  <widget class="QMenuBar" name="menubar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>800</width>
+     <height>22</height>
+    </rect>
+   </property>
+   <widget class="QMenu" name="mm_dat">
+    <property name="title">
+     <string>MM-DAT</string>
+    </property>
+    <addaction name="act_dat_save"/>
+    <addaction name="separator"/>
+    <addaction name="act_dat_cancel"/>
+   </widget>
+   <addaction name="mm_dat"/>
+  </widget>
+  <action name="act_dat_save">
+   <property name="text">
+    <string>ME-DAT-SAVE</string>
+   </property>
+  </action>
+  <action name="act_dat_cancel">
+   <property name="text">
+    <string>ME-DAT-CANCEL</string>
+   </property>
+  </action>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
index df5aa50..a50fc06 100644 (file)
@@ -13,6 +13,8 @@
 #include "filesystem/NCFilesystem.hxx"
 #include "ImageWindow.hxx"
 #include "TextWindow.hxx"
+#include "DatWindow.hxx"
+#include "ObjectWindow.hxx"
 
 // --- internal typedefs ---
 
@@ -33,8 +35,8 @@ const QString TableHeader("header size;position;compressed size;original size;na
 
 MainWindow::MainWindow(QWidget *parent)
 : QMainWindow(parent), _ui(new Ui::MainWindow), _translator(new QTranslator(this)),
-  _settings(new QSettings("LinuxAddicted", "QTinNS Editor", this)), _vfs(new NCFilesystem),
-  _img(new ImageWindow(this)), _txt(new TextWindow(this)), _def_status(new QLabel)
+  _settings(new QSettings("LinuxAddicted", "QTinNS Editor", this)), _vfs(new NCFilesystem), _img(new ImageWindow(this)),
+  _txt(new TextWindow(this)), _dat(new DatWindow(this)), _obj(new ObjectWindow(this)), _def_status(new QLabel)
 {
     _ui->setupUi(this);
     _ui->wid_table->setColumnCount(7);
@@ -43,6 +45,8 @@ MainWindow::MainWindow(QWidget *parent)
 
     _ui->wid_stack->addWidget(_img);
     _ui->wid_stack->addWidget(_txt);
+    _ui->wid_stack->addWidget(_dat);
+    _ui->wid_stack->addWidget(_obj);
     _ui->wid_stack->setCurrentIndex(0);
 
     statusBar()->insertWidget(0, _def_status);
@@ -77,15 +81,23 @@ MainWindow::~MainWindow()
         _settings->sync();
     }
 
-    _img->setVisible(false);
-    _ui->wid_stack->removeWidget(_img);
+    statusBar()->removeWidget(_def_status);
+
+    _obj->setVisible(false);
+    _ui->wid_stack->removeWidget(_obj);
+
+    _dat->setVisible(false);
+    _ui->wid_stack->removeWidget(_dat);
 
     _txt->setVisible(false);
     _ui->wid_stack->removeWidget(_txt);
 
-    statusBar()->removeWidget(_def_status);
+    _img->setVisible(false);
+    _ui->wid_stack->removeWidget(_img);
 
     delete _def_status;
+    delete _obj;
+    delete _dat;
     delete _txt;
     delete _img;
     delete _vfs;
@@ -231,6 +243,26 @@ void MainWindow::slotFileText()
     setMode(Mode::Blocked);
 }
 
+void MainWindow::slotFileDat()
+{
+    QTW *table = _ui->wid_table;
+    NCFile entry = _vfs->fileGet(table->currentRow());
+
+    _dat->slotDatView(entry, table->currentRow());
+    _ui->wid_stack->setCurrentWidget(_dat);
+    setMode(Mode::Blocked);
+}
+
+void MainWindow::slotFileObject()
+{
+    QTW *table = _ui->wid_table;
+    NCFile entry = _vfs->fileGet(table->currentRow());
+
+    _obj->slotObjectView(entry, table->currentRow());
+    _ui->wid_stack->setCurrentWidget(_obj);
+    setMode(Mode::Blocked);
+}
+
 void MainWindow::slotLangEnglish()
 {
     setLanguage(Language::English);
@@ -313,6 +345,16 @@ void MainWindow::slotTableSelected()
         _ui->act_file_text->setEnabled(true);
     else
         _ui->act_file_image->setEnabled(false);
+
+    if (text.contains(".dat", Qt::CaseInsensitive))
+        _ui->act_file_dat->setEnabled(true);
+    else
+        _ui->act_file_dat->setEnabled(false);
+
+    if (text.contains(".bsp", Qt::CaseInsensitive))
+        _ui->act_file_object->setEnabled(true);
+    else
+        _ui->act_file_object->setEnabled(false);
 }
 
 void MainWindow::slotTableChange(qint32 row)
@@ -708,6 +750,8 @@ void MainWindow::setMode(const Mode mode)
     _ui->act_file_conv_lin->setEnabled(false);
     _ui->act_file_image->setEnabled(false);
     _ui->act_file_text->setEnabled(false);
+    _ui->act_file_dat->setEnabled(false);
+    _ui->act_file_object->setEnabled(false);
 
     switch (mode)
     {
@@ -799,6 +843,10 @@ void MainWindow::setupActions()
             this, SLOT(slotFileImage()));
     connect(_ui->act_file_text, SIGNAL(triggered()),
             this, SLOT(slotFileText()));
+    connect(_ui->act_file_dat, SIGNAL(triggered()),
+            this, SLOT(slotFileDat()));
+    connect(_ui->act_file_object, SIGNAL(triggered()),
+        this, SLOT(slotFileObject()));
 
     connect(_ui->act_lang_english, SIGNAL(triggered()),
             this, SLOT(slotLangEnglish()));
@@ -844,10 +892,22 @@ void MainWindow::setupActions()
 
     // text viewer connections
     connect(_txt, SIGNAL(sigTextUpdate(NCFile&, quint32)),
-            this, SLOT(slotTableIgnored()));
+            this, SLOT(slotTableReplace(NCFile&, quint32)));
     connect(_txt, SIGNAL(sigTextIgnored()),
             this, SLOT(slotTableIgnored()));
 
+    // dat viewer connections
+    connect(_dat, SIGNAL(sigDatUpdate(NCFile&, quint32)),
+            this, SLOT(slotTableReplace(NCFile&, quint32)));
+    connect(_dat, SIGNAL(sigDatIgnored()),
+            this, SLOT(slotTableIgnored()));
+
+    // object viewer connections
+    connect(_obj, SIGNAL(sigObjectUpdate(NCFile&, quint32)),
+            this, SLOT(slotTableReplace(NCFile&, quint32)));
+    connect(_obj, SIGNAL(sigObjectIgnored()),
+            this, SLOT(slotTableIgnored()));
+
     // context menus for the QTableWidget
     ctx_sep1->setSeparator(true);
     ctx_sep2->setSeparator(true);
@@ -868,4 +928,6 @@ void MainWindow::setupActions()
     table->addAction(ctx_sep4);
     table->addAction(_ui->act_file_image);
     table->addAction(_ui->act_file_text);
+    table->addAction(_ui->act_file_dat);
+    table->addAction(_ui->act_file_object);
 }
index fae4d86..87ac81d 100644 (file)
@@ -14,6 +14,8 @@ class NCFile;
 class NCFilesystem;
 class ImageWindow;
 class TextWindow;
+class DatWindow;
+class ObjectWindow;
 
 class MainWindow : public QMainWindow {
     Q_OBJECT
@@ -56,6 +58,8 @@ public slots:
     void slotFileConvLin();
     void slotFileImage();
     void slotFileText();
+    void slotFileDat();
+    void slotFileObject();
 
     void slotLangEnglish();
     void slotLangFrench();
@@ -93,6 +97,8 @@ private:
     NCFilesystem *_vfs;
     ImageWindow *_img;
     TextWindow *_txt;
+    DatWindow *_dat;
+    ObjectWindow *_obj;
     QLabel *_def_status;
     QString _filename;
 };
index 4c86a90..2bd1d13 100644 (file)
     <addaction name="separator"/>
     <addaction name="act_file_image"/>
     <addaction name="act_file_text"/>
+    <addaction name="act_file_dat"/>
+    <addaction name="act_file_object"/>
    </widget>
    <addaction name="mm_app"/>
    <addaction name="mm_file"/>
     <string>ME-FILE-TEXT</string>
    </property>
   </action>
+  <action name="act_file_dat">
+   <property name="text">
+    <string>ME-FILE-DAT</string>
+   </property>
+  </action>
+  <action name="act_file_object">
+   <property name="text">
+    <string>ME-FILE-OBJECT</string>
+   </property>
+  </action>
  </widget>
  <resources>
   <include location="Resources.qrc"/>
diff --git a/editor/ObjectWindow.cxx b/editor/ObjectWindow.cxx
new file mode 100644 (file)
index 0000000..7beec33
--- /dev/null
@@ -0,0 +1,71 @@
+#include "ObjectWindow.hxx"
+#include "ui_ObjectWindow.h"
+
+// --- constructors and deconstructors ---
+
+ObjectWindow::ObjectWindow(QWidget *parent)
+: QMainWindow(parent), _ui(new Ui::ObjectWindow), _num(0)
+{
+    _ui->setupUi(this);
+
+    setupActions();
+    setMode(Mode::Fresh);
+}
+
+ObjectWindow::~ObjectWindow()
+{
+    delete _ui;
+}
+
+// --- public slots ---
+
+void ObjectWindow::slotObjectSave()
+{
+}
+
+void ObjectWindow::slotObjectDiscard()
+{
+    _entry = NCFile();
+    _num = 0;
+
+    emit sigObjectIgnored();
+}
+
+void ObjectWindow::slotObjectView(NCFile& entry, quint32 row)
+{
+    _entry = entry;
+    _num = row;
+}
+
+// --- protected methods ---
+
+void ObjectWindow::changeEvent(QEvent *event)
+{
+    if (event->type() == QEvent::LanguageChange)
+        _ui->retranslateUi(this);
+    else
+        QMainWindow::changeEvent(event);
+}
+
+void ObjectWindow::setMode(const Mode mode)
+{
+    switch (mode)
+    {
+        case Mode::Edited:
+            _ui->act_object_save->setEnabled(true);
+
+            break;
+
+        case Mode::Fresh:
+        default:
+            _ui->act_object_save->setEnabled(false);
+    }
+}
+
+void ObjectWindow::setupActions()
+{
+    connect(_ui->act_object_save, SIGNAL(triggered()),
+            this, SLOT(slotObjectSave()));
+    connect(_ui->act_object_cancel, SIGNAL(triggered()),
+            this, SLOT(slotObjectDiscard()));
+}
diff --git a/editor/ObjectWindow.hxx b/editor/ObjectWindow.hxx
new file mode 100644 (file)
index 0000000..aff7a7b
--- /dev/null
@@ -0,0 +1,41 @@
+#pragma once
+
+#include <QMainWindow>
+#include "filesystem/NCFile.hxx"
+
+namespace Ui
+{
+    class ObjectWindow;
+}
+
+class ObjectWindow : public QMainWindow {
+    Q_OBJECT
+signals:
+    void sigObjectUpdate(NCFile& entry, quint32 row) const;
+    void sigObjectIgnored();
+
+public:
+    enum class Mode : quint8 {
+        Fresh,
+        Edited
+    };
+
+    explicit ObjectWindow(QWidget *parent = 0);
+    virtual ~ObjectWindow();
+
+public slots:
+    void slotObjectSave();
+    void slotObjectDiscard();
+
+    void slotObjectView(NCFile& entry, quint32 row);
+
+protected:
+    virtual void changeEvent(QEvent *event);
+    void setMode(const Mode mode = Mode::Fresh);
+    void setupActions();
+
+private:
+    Ui::ObjectWindow *_ui;
+    NCFile _entry;
+    quint32 _num;
+};
diff --git a/editor/ObjectWindow.ui b/editor/ObjectWindow.ui
new file mode 100644 (file)
index 0000000..2a5bba1
--- /dev/null
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ObjectWindow</class>
+ <widget class="QMainWindow" name="ObjectWindow">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>800</width>
+    <height>600</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>FRM-OBJECT</string>
+  </property>
+  <property name="locale">
+   <locale language="English" country="UnitedStates"/>
+  </property>
+  <widget class="QWidget" name="wid_central">
+   <layout class="QHBoxLayout" name="horizontalLayout">
+    <item>
+     <widget class="QTextEdit" name="ed_text">
+      <property name="readOnly">
+       <bool>true</bool>
+      </property>
+      <property name="html">
+       <string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="GLWidget" name="wid_gl" native="true">
+      <property name="sizePolicy">
+       <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+        <horstretch>0</horstretch>
+        <verstretch>0</verstretch>
+       </sizepolicy>
+      </property>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+  <widget class="QMenuBar" name="menubar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>800</width>
+     <height>22</height>
+    </rect>
+   </property>
+   <widget class="QMenu" name="mm_object">
+    <property name="title">
+     <string>MM-OBJECT</string>
+    </property>
+    <addaction name="act_object_save"/>
+    <addaction name="separator"/>
+    <addaction name="act_object_cancel"/>
+   </widget>
+   <addaction name="mm_object"/>
+  </widget>
+  <action name="act_object_save">
+   <property name="text">
+    <string>ME-OBJECT-SAVE</string>
+   </property>
+  </action>
+  <action name="act_object_cancel">
+   <property name="text">
+    <string>ME-OBJECT-CANCEL</string>
+   </property>
+  </action>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>GLWidget</class>
+   <extends>QWidget</extends>
+   <header>engine/GLWidget.hxx</header>
+   <container>1</container>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
index 9cb1f64..a22b50c 100644 (file)
@@ -1,12 +1,35 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE TS>
 <TS version="2.0" language="en_US">
+<context>
+    <name>DatWindow</name>
+    <message>
+        <location filename="DatWindow.ui" line="14"/>
+        <source>FRM-DAT</source>
+        <translation>QTinNS Editor - Dat Viewer</translation>
+    </message>
+    <message>
+        <location filename="DatWindow.ui" line="31"/>
+        <source>MM-DAT</source>
+        <translation>Dat</translation>
+    </message>
+    <message>
+        <location filename="DatWindow.ui" line="41"/>
+        <source>ME-DAT-SAVE</source>
+        <translation>Save dat changes</translation>
+    </message>
+    <message>
+        <location filename="DatWindow.ui" line="46"/>
+        <source>ME-DAT-CANCEL</source>
+        <translation>Discard dat changes</translation>
+    </message>
+</context>
 <context>
     <name>ImageWindow</name>
     <message>
         <location filename="ImageWindow.ui" line="14"/>
         <source>FRM-IMAGE</source>
-        <translation>QTinNS Editor Image Viewer</translation>
+        <translation>QTinNS Editor Image Viewer</translation>
     </message>
     <message>
         <location filename="ImageWindow.ui" line="83"/>
         <translation>File</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="130"/>
+        <location filename="MainWindow.ui" line="132"/>
         <source>ME-APP-QUIT</source>
         <translation>Quit</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="135"/>
+        <location filename="MainWindow.ui" line="137"/>
         <source>ME-APP-NEW</source>
         <translation>New virtual filesystem</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="140"/>
+        <location filename="MainWindow.ui" line="142"/>
         <source>ME-APP-OPEN</source>
         <translation>Open virtual filesystem ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="145"/>
+        <location filename="MainWindow.ui" line="147"/>
         <source>ME-APP-SAVE</source>
         <translation>Save virtual filesystem</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="150"/>
+        <location filename="MainWindow.ui" line="152"/>
         <source>ME-APP-SAVEAS</source>
         <translation>Save virtual filesystem as ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="155"/>
+        <location filename="MainWindow.ui" line="157"/>
         <source>ME-ABOUT-APP</source>
         <translation>About QTinNS Editor ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="160"/>
+        <location filename="MainWindow.ui" line="162"/>
         <source>ME-ABOUT-QT</source>
         <translation>About Qt framework ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="165"/>
+        <location filename="MainWindow.ui" line="167"/>
         <source>ME-LANG-ENGLISH</source>
         <translation>English</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="170"/>
+        <location filename="MainWindow.ui" line="172"/>
         <source>ME-LANG-FRENCH</source>
         <translation>French</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="175"/>
+        <location filename="MainWindow.ui" line="177"/>
         <source>ME-LANG-GERMAN</source>
         <translation>German</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="180"/>
+        <location filename="MainWindow.ui" line="182"/>
         <source>ME-STYLE-DEFAULT</source>
         <translation>System Default</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="185"/>
+        <location filename="MainWindow.ui" line="187"/>
         <source>ME-STYLE-WINDOWS</source>
         <oldsource>ME-STYLE-CDE</oldsource>
         <translation>Windows</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="190"/>
+        <location filename="MainWindow.ui" line="192"/>
         <source>ME-STYLE-GTK</source>
         <oldsource>ME-STYLE-CLEANLOOKS</oldsource>
         <translation>GTK+</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="195"/>
+        <location filename="MainWindow.ui" line="197"/>
         <source>ME-STYLE-FUSION</source>
         <oldsource>ME-STYLE-PLASTIQUE</oldsource>
         <translation>Fusion</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="200"/>
+        <location filename="MainWindow.ui" line="202"/>
         <source>ME-FILE-ADD</source>
         <translation>Add file(s) ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="205"/>
+        <location filename="MainWindow.ui" line="207"/>
         <source>ME-FILE-REPLACE</source>
         <translation>Replace file ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="210"/>
+        <location filename="MainWindow.ui" line="212"/>
         <source>ME-FILE-REMOVE</source>
         <translation>Remove file ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="215"/>
+        <location filename="MainWindow.ui" line="217"/>
         <source>ME-FILE-SAVE-PLAIN</source>
         <translation>Save plain file as ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="220"/>
+        <location filename="MainWindow.ui" line="222"/>
         <source>ME-FILE-SAVE-PAK</source>
         <translation>Save PAK file as ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="225"/>
+        <location filename="MainWindow.ui" line="227"/>
         <source>ME-FILE-SAVE-ZLIB</source>
         <translation>Save ZLIB file as ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="230"/>
+        <location filename="MainWindow.ui" line="232"/>
         <source>ME-FILE-CONV-WIN</source>
         <translation>Convert UNIX path to Windows path</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="235"/>
+        <location filename="MainWindow.ui" line="237"/>
         <source>ME-FILE-CONV-LIN</source>
         <translation>Convert Windows path to UNIX path</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="240"/>
+        <location filename="MainWindow.ui" line="242"/>
         <source>ME-FILE-IMAGE</source>
         <translation>View image ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="245"/>
+        <location filename="MainWindow.ui" line="247"/>
         <source>ME-FILE-TEXT</source>
         <translation>View text ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="143"/>
-        <location filename="MainWindow.cxx" line="154"/>
+        <location filename="MainWindow.ui" line="252"/>
+        <source>ME-FILE-DAT</source>
+        <translation>View dat ...</translation>
+    </message>
+    <message>
+        <location filename="MainWindow.ui" line="257"/>
+        <source>ME-FILE-OBJECT</source>
+        <translation>View 3D object ...</translation>
+    </message>
+    <message>
+        <location filename="MainWindow.cxx" line="155"/>
+        <location filename="MainWindow.cxx" line="166"/>
         <source>DIA-OPEN-FILE</source>
         <translation>Open files ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="107"/>
-        <location filename="MainWindow.cxx" line="127"/>
+        <location filename="MainWindow.cxx" line="119"/>
+        <location filename="MainWindow.cxx" line="139"/>
         <source>FLT-FILE-VFS</source>
         <oldsource>DIA-SAVE-FILE</oldsource>
         <translation>Neocron VFS file (*.vfs *.pak)</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="107"/>
+        <location filename="MainWindow.cxx" line="119"/>
         <source>DIA-OPEN-VFS</source>
         <translation>Open virtual filesystem ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="127"/>
+        <location filename="MainWindow.cxx" line="139"/>
         <source>DIA-SAVE-VFS</source>
         <translation>Save virtual filesystem ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="143"/>
-        <location filename="MainWindow.cxx" line="154"/>
+        <location filename="MainWindow.cxx" line="155"/>
+        <location filename="MainWindow.cxx" line="166"/>
         <source>FLT-FILE-ANY</source>
         <translation>File (*.*)</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="172"/>
+        <location filename="MainWindow.cxx" line="184"/>
         <source>DIA-SAVE-PLAIN</source>
         <translation>Save file ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="172"/>
+        <location filename="MainWindow.cxx" line="184"/>
         <source>FLT-FILE-PLAIN</source>
         <translation>File (*.*)</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="180"/>
+        <location filename="MainWindow.cxx" line="192"/>
         <source>DIA-SAVE-PAK</source>
         <translation>Save PAK file ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="180"/>
+        <location filename="MainWindow.cxx" line="192"/>
         <source>FLT-FILE-PAK</source>
         <translation>Neocron PAK file (*.pak)</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="188"/>
+        <location filename="MainWindow.cxx" line="200"/>
         <source>DIA-SAVE-ZLIB</source>
         <translation>Save ZLIB file ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="188"/>
+        <location filename="MainWindow.cxx" line="200"/>
         <source>FLT-FILE-ZLIB</source>
         <translation>ZLIB file (*.z)</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="280"/>
+        <location filename="MainWindow.cxx" line="312"/>
         <source>MSG-UPD-FILE</source>
         <translation>Virtual filesystem</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="280"/>
+        <location filename="MainWindow.cxx" line="312"/>
         <source>MSG-UPD-WITH</source>
         <translation>with</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="281"/>
+        <location filename="MainWindow.cxx" line="313"/>
         <source>MSG-UPD-ENTRIES</source>
         <translation>entries</translation>
     </message>
 </context>
 <context>
-    <name>PictureWindow</name>
+    <name>ObjectWindow</name>
     <message>
-        <source>FRM-IMAGE</source>
-        <translation type="obsolete">QTinNS Editor Viewer</translation>
+        <location filename="ObjectWindow.ui" line="14"/>
+        <source>FRM-OBJECT</source>
+        <translation>QTinNS Editor - 3D Object Viewer</translation>
     </message>
     <message>
-        <source>MM-IMAGE</source>
-        <translation type="obsolete">Picture</translation>
+        <location filename="ObjectWindow.ui" line="58"/>
+        <source>MM-OBJECT</source>
+        <translation>3D Object</translation>
     </message>
     <message>
-        <source>ME-IMAGE-SAVE</source>
-        <translation type="obsolete">Save changes</translation>
+        <location filename="ObjectWindow.ui" line="68"/>
+        <source>ME-OBJECT-SAVE</source>
+        <translation>Save 3D object changes</translation>
     </message>
     <message>
-        <source>ME-IMAGE-CANCEL</source>
-        <translation type="obsolete">Discard changes</translation>
+        <location filename="ObjectWindow.ui" line="73"/>
+        <source>ME-OBJECT-CANCEL</source>
+        <translation>Discard 3D object changes</translation>
     </message>
 </context>
 <context>
     <message>
         <location filename="TextWindow.ui" line="14"/>
         <source>FRM-TEXT</source>
-        <translation>QTinNS Editor Text Viewer</translation>
+        <translation>QTinNS Editor Text Viewer</translation>
     </message>
     <message>
         <location filename="TextWindow.ui" line="75"/>
index 487db01..cab46ff 100644 (file)
@@ -1,6 +1,29 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE TS>
 <TS version="2.0" language="fr_FR">
+<context>
+    <name>DatWindow</name>
+    <message>
+        <location filename="DatWindow.ui" line="14"/>
+        <source>FRM-DAT</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="DatWindow.ui" line="31"/>
+        <source>MM-DAT</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="DatWindow.ui" line="41"/>
+        <source>ME-DAT-SAVE</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="DatWindow.ui" line="46"/>
+        <source>ME-DAT-CANCEL</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
 <context>
     <name>ImageWindow</name>
     <message>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="130"/>
+        <location filename="MainWindow.ui" line="132"/>
         <source>ME-APP-QUIT</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="135"/>
+        <location filename="MainWindow.ui" line="137"/>
         <source>ME-APP-NEW</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="140"/>
+        <location filename="MainWindow.ui" line="142"/>
         <source>ME-APP-OPEN</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="145"/>
+        <location filename="MainWindow.ui" line="147"/>
         <source>ME-APP-SAVE</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="150"/>
+        <location filename="MainWindow.ui" line="152"/>
         <source>ME-APP-SAVEAS</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="155"/>
+        <location filename="MainWindow.ui" line="157"/>
         <source>ME-ABOUT-APP</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="160"/>
+        <location filename="MainWindow.ui" line="162"/>
         <source>ME-ABOUT-QT</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="165"/>
+        <location filename="MainWindow.ui" line="167"/>
         <source>ME-LANG-ENGLISH</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="170"/>
+        <location filename="MainWindow.ui" line="172"/>
         <source>ME-LANG-FRENCH</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="175"/>
+        <location filename="MainWindow.ui" line="177"/>
         <source>ME-LANG-GERMAN</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="180"/>
+        <location filename="MainWindow.ui" line="182"/>
         <source>ME-STYLE-DEFAULT</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="185"/>
+        <location filename="MainWindow.ui" line="187"/>
         <source>ME-STYLE-WINDOWS</source>
         <oldsource>ME-STYLE-CDE</oldsource>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="190"/>
+        <location filename="MainWindow.ui" line="192"/>
         <source>ME-STYLE-GTK</source>
         <oldsource>ME-STYLE-CLEANLOOKS</oldsource>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="195"/>
+        <location filename="MainWindow.ui" line="197"/>
         <source>ME-STYLE-FUSION</source>
         <oldsource>ME-STYLE-PLASTIQUE</oldsource>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="200"/>
+        <location filename="MainWindow.ui" line="202"/>
         <source>ME-FILE-ADD</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="205"/>
+        <location filename="MainWindow.ui" line="207"/>
         <source>ME-FILE-REPLACE</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="210"/>
+        <location filename="MainWindow.ui" line="212"/>
         <source>ME-FILE-REMOVE</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="215"/>
+        <location filename="MainWindow.ui" line="217"/>
         <source>ME-FILE-SAVE-PLAIN</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="220"/>
+        <location filename="MainWindow.ui" line="222"/>
         <source>ME-FILE-SAVE-PAK</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="225"/>
+        <location filename="MainWindow.ui" line="227"/>
         <source>ME-FILE-SAVE-ZLIB</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="230"/>
+        <location filename="MainWindow.ui" line="232"/>
         <source>ME-FILE-CONV-WIN</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="235"/>
+        <location filename="MainWindow.ui" line="237"/>
         <source>ME-FILE-CONV-LIN</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="240"/>
+        <location filename="MainWindow.ui" line="242"/>
         <source>ME-FILE-IMAGE</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="245"/>
+        <location filename="MainWindow.ui" line="247"/>
         <source>ME-FILE-TEXT</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="143"/>
-        <location filename="MainWindow.cxx" line="154"/>
+        <location filename="MainWindow.ui" line="252"/>
+        <source>ME-FILE-DAT</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="MainWindow.ui" line="257"/>
+        <source>ME-FILE-OBJECT</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="MainWindow.cxx" line="155"/>
+        <location filename="MainWindow.cxx" line="166"/>
         <source>DIA-OPEN-FILE</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="107"/>
-        <location filename="MainWindow.cxx" line="127"/>
+        <location filename="MainWindow.cxx" line="119"/>
+        <location filename="MainWindow.cxx" line="139"/>
         <source>FLT-FILE-VFS</source>
         <oldsource>DIA-SAVE-FILE</oldsource>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="107"/>
+        <location filename="MainWindow.cxx" line="119"/>
         <source>DIA-OPEN-VFS</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="127"/>
+        <location filename="MainWindow.cxx" line="139"/>
         <source>DIA-SAVE-VFS</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="143"/>
-        <location filename="MainWindow.cxx" line="154"/>
+        <location filename="MainWindow.cxx" line="155"/>
+        <location filename="MainWindow.cxx" line="166"/>
         <source>FLT-FILE-ANY</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="172"/>
+        <location filename="MainWindow.cxx" line="184"/>
         <source>DIA-SAVE-PLAIN</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="172"/>
+        <location filename="MainWindow.cxx" line="184"/>
         <source>FLT-FILE-PLAIN</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="180"/>
+        <location filename="MainWindow.cxx" line="192"/>
         <source>DIA-SAVE-PAK</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="180"/>
+        <location filename="MainWindow.cxx" line="192"/>
         <source>FLT-FILE-PAK</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="188"/>
+        <location filename="MainWindow.cxx" line="200"/>
         <source>DIA-SAVE-ZLIB</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="188"/>
+        <location filename="MainWindow.cxx" line="200"/>
         <source>FLT-FILE-ZLIB</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="280"/>
+        <location filename="MainWindow.cxx" line="312"/>
         <source>MSG-UPD-FILE</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="280"/>
+        <location filename="MainWindow.cxx" line="312"/>
         <source>MSG-UPD-WITH</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="281"/>
+        <location filename="MainWindow.cxx" line="313"/>
         <source>MSG-UPD-ENTRIES</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
+<context>
+    <name>ObjectWindow</name>
+    <message>
+        <location filename="ObjectWindow.ui" line="14"/>
+        <source>FRM-OBJECT</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="ObjectWindow.ui" line="58"/>
+        <source>MM-OBJECT</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="ObjectWindow.ui" line="68"/>
+        <source>ME-OBJECT-SAVE</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="ObjectWindow.ui" line="73"/>
+        <source>ME-OBJECT-CANCEL</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
 <context>
     <name>TextWindow</name>
     <message>
index 33b8481..a1fddc6 100644 (file)
@@ -1,12 +1,35 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE TS>
 <TS version="2.0" language="de_DE">
+<context>
+    <name>DatWindow</name>
+    <message>
+        <location filename="DatWindow.ui" line="14"/>
+        <source>FRM-DAT</source>
+        <translation>QTinNS Editor - Dat Viewer</translation>
+    </message>
+    <message>
+        <location filename="DatWindow.ui" line="31"/>
+        <source>MM-DAT</source>
+        <translation>Dat</translation>
+    </message>
+    <message>
+        <location filename="DatWindow.ui" line="41"/>
+        <source>ME-DAT-SAVE</source>
+        <translation>Speichere Dat Änderungen</translation>
+    </message>
+    <message>
+        <location filename="DatWindow.ui" line="46"/>
+        <source>ME-DAT-CANCEL</source>
+        <translation>Verwerfe Dat Änderungen</translation>
+    </message>
+</context>
 <context>
     <name>ImageWindow</name>
     <message>
         <location filename="ImageWindow.ui" line="14"/>
         <source>FRM-IMAGE</source>
-        <translation>QTinNS Editor Image Viewer</translation>
+        <translation>QTinNS Editor Image Viewer</translation>
     </message>
     <message>
         <location filename="ImageWindow.ui" line="83"/>
         <translation>Datei</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="130"/>
+        <location filename="MainWindow.ui" line="132"/>
         <source>ME-APP-QUIT</source>
         <translation>Beenden</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="135"/>
+        <location filename="MainWindow.ui" line="137"/>
         <source>ME-APP-NEW</source>
         <translation>Neues virtuelles Dateisystem</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="140"/>
+        <location filename="MainWindow.ui" line="142"/>
         <source>ME-APP-OPEN</source>
         <translation>Virtuelles Dateisystem öffnen ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="145"/>
+        <location filename="MainWindow.ui" line="147"/>
         <source>ME-APP-SAVE</source>
         <translation>Virtuelles Dateisystem speichern</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="150"/>
+        <location filename="MainWindow.ui" line="152"/>
         <source>ME-APP-SAVEAS</source>
         <translation>Virtuelles Dateisystem speichern als ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="155"/>
+        <location filename="MainWindow.ui" line="157"/>
         <source>ME-ABOUT-APP</source>
         <translation>Über QTinNS Editor ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="160"/>
+        <location filename="MainWindow.ui" line="162"/>
         <source>ME-ABOUT-QT</source>
         <translation>Über Qt Framework ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="165"/>
+        <location filename="MainWindow.ui" line="167"/>
         <source>ME-LANG-ENGLISH</source>
         <translation>Englisch</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="170"/>
+        <location filename="MainWindow.ui" line="172"/>
         <source>ME-LANG-FRENCH</source>
         <translation>Französisch</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="175"/>
+        <location filename="MainWindow.ui" line="177"/>
         <source>ME-LANG-GERMAN</source>
         <translation>Deutsch</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="180"/>
+        <location filename="MainWindow.ui" line="182"/>
         <source>ME-STYLE-DEFAULT</source>
         <translation>System Standard</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="185"/>
+        <location filename="MainWindow.ui" line="187"/>
         <source>ME-STYLE-WINDOWS</source>
         <oldsource>ME-STYLE-CDE</oldsource>
         <translation>Windows</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="190"/>
+        <location filename="MainWindow.ui" line="192"/>
         <source>ME-STYLE-GTK</source>
         <oldsource>ME-STYLE-CLEANLOOKS</oldsource>
         <translation>GTK+</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="195"/>
+        <location filename="MainWindow.ui" line="197"/>
         <source>ME-STYLE-FUSION</source>
         <oldsource>ME-STYLE-PLASTIQUE</oldsource>
         <translation>Fusion</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="200"/>
+        <location filename="MainWindow.ui" line="202"/>
         <source>ME-FILE-ADD</source>
         <translation>Füge Datei(en) hinzu ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="205"/>
+        <location filename="MainWindow.ui" line="207"/>
         <source>ME-FILE-REPLACE</source>
         <translation>Ersetze Datei ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="210"/>
+        <location filename="MainWindow.ui" line="212"/>
         <source>ME-FILE-REMOVE</source>
         <translation>Entferne Datei ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="215"/>
+        <location filename="MainWindow.ui" line="217"/>
         <source>ME-FILE-SAVE-PLAIN</source>
         <translation>Speichere normale Datei als ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="220"/>
+        <location filename="MainWindow.ui" line="222"/>
         <source>ME-FILE-SAVE-PAK</source>
         <translation>Speichere PAK Datei als ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="225"/>
+        <location filename="MainWindow.ui" line="227"/>
         <source>ME-FILE-SAVE-ZLIB</source>
         <translation>Speichere ZLIB Datei als ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="230"/>
+        <location filename="MainWindow.ui" line="232"/>
         <source>ME-FILE-CONV-WIN</source>
         <translation>Konvertiere UNIX Pfad nach Windows</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="235"/>
+        <location filename="MainWindow.ui" line="237"/>
         <source>ME-FILE-CONV-LIN</source>
         <translation>Konvertiere Windows Pfad nach UNIX</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="240"/>
+        <location filename="MainWindow.ui" line="242"/>
         <source>ME-FILE-IMAGE</source>
         <translation>Bild anzeigen ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.ui" line="245"/>
+        <location filename="MainWindow.ui" line="247"/>
         <source>ME-FILE-TEXT</source>
         <translation>Text anzeigen ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="143"/>
-        <location filename="MainWindow.cxx" line="154"/>
+        <location filename="MainWindow.ui" line="252"/>
+        <source>ME-FILE-DAT</source>
+        <translation>Dat anzeigen ...</translation>
+    </message>
+    <message>
+        <location filename="MainWindow.ui" line="257"/>
+        <source>ME-FILE-OBJECT</source>
+        <translation>3D Objekt anzeigen ...</translation>
+    </message>
+    <message>
+        <location filename="MainWindow.cxx" line="155"/>
+        <location filename="MainWindow.cxx" line="166"/>
         <source>DIA-OPEN-FILE</source>
         <translation>Datei öffnen ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="107"/>
-        <location filename="MainWindow.cxx" line="127"/>
+        <location filename="MainWindow.cxx" line="119"/>
+        <location filename="MainWindow.cxx" line="139"/>
         <source>FLT-FILE-VFS</source>
         <oldsource>DIA-SAVE-FILE</oldsource>
         <translation>Neocron VFS Datei (*.vfs *.pak)</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="107"/>
+        <location filename="MainWindow.cxx" line="119"/>
         <source>DIA-OPEN-VFS</source>
         <translation>Virtuelles Dateisystem öffnen ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="127"/>
+        <location filename="MainWindow.cxx" line="139"/>
         <source>DIA-SAVE-VFS</source>
         <translation>Virtuelles Dateisystem speichern ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="143"/>
-        <location filename="MainWindow.cxx" line="154"/>
+        <location filename="MainWindow.cxx" line="155"/>
+        <location filename="MainWindow.cxx" line="166"/>
         <source>FLT-FILE-ANY</source>
         <translation>Datei (*.*)</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="172"/>
+        <location filename="MainWindow.cxx" line="184"/>
         <source>DIA-SAVE-PLAIN</source>
         <translation>Datei speichern ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="172"/>
+        <location filename="MainWindow.cxx" line="184"/>
         <source>FLT-FILE-PLAIN</source>
         <translation>Datei (*.*)</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="180"/>
+        <location filename="MainWindow.cxx" line="192"/>
         <source>DIA-SAVE-PAK</source>
         <translation>PAK Datei speichern ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="180"/>
+        <location filename="MainWindow.cxx" line="192"/>
         <source>FLT-FILE-PAK</source>
         <translation>Neocron PAK Datei (*.pak)</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="188"/>
+        <location filename="MainWindow.cxx" line="200"/>
         <source>DIA-SAVE-ZLIB</source>
         <translation>ZLIB Datei speichern ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="188"/>
+        <location filename="MainWindow.cxx" line="200"/>
         <source>FLT-FILE-ZLIB</source>
         <translation>ZLIB Datei (*.z)</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="280"/>
+        <location filename="MainWindow.cxx" line="312"/>
         <source>MSG-UPD-FILE</source>
         <translation>Virtuelles Dateisystem</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="280"/>
+        <location filename="MainWindow.cxx" line="312"/>
         <source>MSG-UPD-WITH</source>
         <translation>mit</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="281"/>
+        <location filename="MainWindow.cxx" line="313"/>
         <source>MSG-UPD-ENTRIES</source>
         <translation>Einträgen</translation>
     </message>
 </context>
 <context>
-    <name>PictureWindow</name>
+    <name>ObjectWindow</name>
     <message>
-        <source>FRM-IMAGE</source>
-        <translation type="obsolete">QTinNS Editor Viewer</translation>
+        <location filename="ObjectWindow.ui" line="14"/>
+        <source>FRM-OBJECT</source>
+        <translation>QTinNS Editor - 3D Object Viewer</translation>
     </message>
     <message>
-        <source>MM-IMAGE</source>
-        <translation type="obsolete">Bild</translation>
+        <location filename="ObjectWindow.ui" line="58"/>
+        <source>MM-OBJECT</source>
+        <translation>3D Objekt</translation>
     </message>
     <message>
-        <source>ME-IMAGE-SAVE</source>
-        <translation type="obsolete">Speichere Änderungen</translation>
+        <location filename="ObjectWindow.ui" line="68"/>
+        <source>ME-OBJECT-SAVE</source>
+        <translation>Speichere 3D Objekt Änderungen</translation>
     </message>
     <message>
-        <source>ME-IMAGE-CANCEL</source>
-        <translation type="obsolete">Verwerfe Änderungen</translation>
+        <location filename="ObjectWindow.ui" line="73"/>
+        <source>ME-OBJECT-CANCEL</source>
+        <translation>Verwerfe 3D Objekt Änderungen</translation>
     </message>
 </context>
 <context>
     <message>
         <location filename="TextWindow.ui" line="14"/>
         <source>FRM-TEXT</source>
-        <translation>QTinNS Editor Text Viewer</translation>
+        <translation>QTinNS Editor Text Viewer</translation>
     </message>
     <message>
         <location filename="TextWindow.ui" line="75"/>
diff --git a/engine/CMakeLists.txt b/engine/CMakeLists.txt
new file mode 100644 (file)
index 0000000..8832147
--- /dev/null
@@ -0,0 +1,17 @@
+# Qt sources
+set                   (EN_SOURCES GLWidget.cxx)
+set                   (EN_HEADERS GLWidget.hxx)
+set                   (EN_UI_FILES )
+set                   (EN_RES_FILES )
+set                   (EN_TS_FILES )
+
+# wrappers
+QT5_ADD_TRANSLATION   (EN_TS_SOURCES ${EN_TS_FILES})
+QT5_WRAP_CPP          (EN_MOC_SOURCES ${EN_HEADERS})
+QT5_WRAP_UI           (EN_UI_SOURCES ${EN_UI_FILES})
+QT5_ADD_RESOURCES     (EN_RES_SOURCES ${EN_RES_FILES})
+
+# apps
+add_library            (Engine ${EN_SOURCES} ${EN_MOC_SOURCES} ${EN_UI_SOURCES} ${EN_RES_SOURCES} ${EN_TS_SOURCES})
+qt5_use_modules        (Engine Core OpenGL)
+target_link_libraries  (Engine GL)
diff --git a/engine/GLWidget.cxx b/engine/GLWidget.cxx
new file mode 100644 (file)
index 0000000..0e1bb94
--- /dev/null
@@ -0,0 +1,87 @@
+#include <QMouseEvent>
+#include <QVector3D>
+#include "GLWidget.hxx"
+
+// --- constructors and deconstructors ---
+
+GLWidget::GLWidget(QWidget *parent, QGLWidget *shared)
+: QGLWidget(parent, shared), _last_pos(0, 0), _rot_x(0.0), _rot_y(0.0), _rot_z(0.0)
+{
+}
+
+GLWidget::~GLWidget()
+{
+}
+
+// --- public slots ---
+
+void GLWidget::slotRotateDelta(qreal angle_x, qreal angle_y, qreal angle_z)
+{
+    _rot_x += angle_x;
+    _rot_y += angle_y;
+    _rot_z += angle_z;
+    updateGL();
+}
+
+// --- protected methods ---
+
+void GLWidget::initializeGL()
+{
+    glEnable(GL_DEPTH_TEST);
+    glEnable(GL_CULL_FACE);;
+}
+
+void GLWidget::paintGL()
+{
+    qglClearColor(Qt::black);
+    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+    glLoadIdentity();
+    glTranslatef(0.0, 0.0, -10.0);
+    glRotatef(_rot_x / 16.0, 1.0, 0.0, 0.0);
+    glRotatef(_rot_y / 16.0, 0.0, 1.0, 0.0);
+    glRotatef(_rot_z / 16.0, 0.0, 0.0, 1.0);
+
+    if (_vertices.count())
+    {
+        glVertexPointer(3, GL_FLOAT, 0, _vertices.constData());
+        glEnableClientState(GL_VERTEX_ARRAY);
+
+        for (quint32 i = 0; i < _vertices.count(); ++i)
+            glDrawArrays(GL_TRIANGLE_FAN, i * 4, 4);
+    }
+}
+
+void GLWidget::resizeGL(qint32 width, qint32 height)
+{
+    const qint32 side = qMin(width, height);
+
+    glViewport((width - side) / 2, (height - side) / 2, side, side);
+    glMatrixMode(GL_PROJECTION);
+    glLoadIdentity();
+    glOrtho(-0.5, 0.5, 0.5, -0.5, 4.0, 15.0);
+    glMatrixMode(GL_MODELVIEW);
+}
+
+void GLWidget::mousePressEvent(QMouseEvent *event)
+{
+    _last_pos = event->pos();
+}
+
+void GLWidget::mouseMoveEvent(QMouseEvent *event)
+{
+    qint32 dx = event->x() - _last_pos.x();
+    qint32 dy = event->y() - _last_pos.y();
+
+    if (event->buttons() & Qt::LeftButton)
+        slotRotateDelta(8 * dy, 8 * dx, 0);
+    else if (event->buttons() & Qt::RightButton)
+        slotRotateDelta(8 * dy, 0, 8 * dx);
+    else
+        _last_pos = event->pos();
+}
+
+void GLWidget::mouseReleaseEvent(QMouseEvent *event)
+{
+    emit sigClicked();
+}
diff --git a/engine/GLWidget.hxx b/engine/GLWidget.hxx
new file mode 100644 (file)
index 0000000..0ea0b8b
--- /dev/null
@@ -0,0 +1,32 @@
+#pragma once
+
+#include <QGLWidget>
+
+class GLWidget : public QGLWidget {
+    Q_OBJECT
+signals:
+    void sigClicked() const;
+
+public:
+    explicit GLWidget(QWidget *parent = 0, QGLWidget *shared = 0);
+    virtual ~GLWidget();
+
+public slots:
+    void slotRotateDelta(qreal angle_x, qreal angle_y, qreal angle_z);
+
+protected:
+    virtual void initializeGL() override;
+    virtual void paintGL() override;
+    virtual void resizeGL(qint32 width, qint32 height) override;
+
+    virtual void mousePressEvent(QMouseEvent *event) override;
+    virtual void mouseMoveEvent(QMouseEvent *event) override;
+    virtual void mouseReleaseEvent(QMouseEvent *event) override;
+
+private:
+    QPoint _last_pos;
+    qreal _rot_x;
+    qreal _rot_y;
+    qreal _rot_z;
+    QVector<QVector3D> _vertices;
+};
index e9d8be9..3b4821e 100644 (file)
@@ -1,13 +1,16 @@
 # apps
-add_executable        (vfs_tool vfs_tool.cxx)
-qt5_use_modules       (vfs_tool Core)
-target_link_libraries (vfs_tool Filesystem)
+add_executable        (tool_bsp_viewer bsp_viewer.cxx)
+target_link_libraries (tool_bsp_viewer GL glut GLU GLEW)
 
-add_executable        (dat_viewer dat_viewer.cxx)
-qt5_use_modules       (dat_viewer Core)
+add_executable        (tool_dat_viewer dat_viewer.cxx)
+qt5_use_modules       (tool_dat_viewer Core)
 
-add_executable        (zcompress zcompress.cxx)
-qt5_use_modules       (zcompress Core)
+add_executable        (tool_vfs vfs_tool.cxx)
+qt5_use_modules       (tool_vfs Core)
+target_link_libraries (tool_vfs Filesystem)
 
-add_executable        (zdecompress zdecompress.cxx)
-qt5_use_modules       (zdecompress Core)
+add_executable        (tool_zcompress zcompress.cxx)
+qt5_use_modules       (tool_zcompress Core)
+
+add_executable        (tool_zdecompress zdecompress.cxx)
+qt5_use_modules       (tool_zdecompress Core)
diff --git a/tools/bsp_viewer.cxx b/tools/bsp_viewer.cxx
new file mode 100644 (file)
index 0000000..4eeb168
--- /dev/null
@@ -0,0 +1,231 @@
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <vector>
+#include <GL/glew.h>
+#include <GL/freeglut.h>
+
+namespace Data
+{
+       enum Type {
+               BSPHeader = 0,
+               Faces = 11,
+               VertexIndexes = 13,
+               Vertices = 14,
+               RGBVertices = 15,
+               TextureInfo = 17,
+               Textures = 18,
+               TextureData = 19,
+               Palettes = 23,
+               PaletteEntries = 256
+       };
+}
+
+struct BSPHeader {
+       uint32_t magic;
+       uint32_t unknown;
+       uint32_t version;
+       uint16_t systime[8];
+};
+
+struct Chunk {
+       uint32_t type;
+       uint32_t size;
+       uint32_t count;
+};
+
+struct Vertex {
+       float x, y, z;
+};
+
+struct Face {
+       uint32_t first;
+       uint32_t vertex_count;
+       uint32_t plane_count;
+       uint32_t plane_side;
+       uint32_t tex_info;
+       uint32_t lightmap_info;
+       uint32_t lightmap_width;
+       uint32_t lightmap_height;
+       uint8_t lightmap_types;
+};
+
+std::vector<Face> faces;
+std::vector<Vertex> vertices;
+std::vector<Vertex> rgb_vertices;
+std::vector<uint32_t> indexes;
+
+void display()
+{
+       glClearColor(0.1, 0.1, 0.1, 0.0);
+       glClear(GL_COLOR_BUFFER_BIT);
+       glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+       glLoadIdentity();
+
+       glTranslatef(0.0, 0.0, -200.0);
+       for (Face& face : faces)
+       {
+               glBegin(GL_TRIANGLE_FAN);
+               for (size_t j = 0; j < face.vertex_count; ++j)
+               {
+                       Vertex& vert = vertices[indexes[face.first + j]];
+
+                       glVertex3f(vert.x / 30.0, vert.y / 30.0, vert.z / 30.0);
+               }
+               glEnd();
+       }
+       /*for (Vertex& vert : vertices)
+       {
+               glBegin(GL_POINTS);
+                       glColor3f(1.0, 1.0, 1.0);
+                       glVertex3f(vert.x / 10.0, vert.y / 10.0, vert.z / 10.0);
+               glEnd();
+       }*/
+       /*glBegin(GL_POINTS);
+               glColor3f(1.0, 1.0, 1.0);
+               glVertex3f(-496.0, -512.0, -233.0);
+               glVertex3f(-496.0, -512.0, -322.0);
+               glVertex3f(-496.0, -512.0, -452.0);
+               glVertex3f(-304.0, -512.0, -452.0);
+               glVertex3f(-304.0, -512.0, -357.0);
+               glVertex3f(-304.0, -512.0, -304.0);
+               glVertex3f(-304.0, -512.0, -233.0);
+       glEnd();*/
+
+       glutSwapBuffers();
+}
+
+void reshape(GLint w, GLint h)
+{
+       glViewport(0, 0, static_cast<GLsizei>(w), static_cast<GLsizei>(h));
+       glMatrixMode(GL_PROJECTION);
+       glLoadIdentity();
+       gluPerspective(90, static_cast<GLfloat>(w) / static_cast<GLfloat>(h), 1.0, 1000.0);
+       glMatrixMode(GL_MODELVIEW);
+}
+
+int main(int argc, char **argv)
+{
+       std::string filename = "test.bsp";
+       std::ifstream file;
+       struct BSPHeader header;
+
+       if (argc == 2)
+               filename = argv[1];
+
+       if (!std::ifstream(filename))
+       {
+               std::cerr << "ERROR: file not accessable" << std::endl;
+               return 1;
+       }
+
+       file.open(filename);
+       if (file.is_open() && file.good())
+       {
+               Chunk chunk;
+               size_t size = file.seekg(0, std::ios_base::end).tellg();
+
+               file.seekg(0, std::ios_base::beg);
+
+               while (file.read(reinterpret_cast<char *>(&chunk), sizeof (chunk)) && (chunk.type != 0xffff))
+               {
+                       switch (chunk.type)
+                       {
+                               case Data::BSPHeader:
+                               {
+                                       file.seekg(chunk.size * chunk.count, std::ios_base::cur);
+
+                                       break;
+                               }
+                               case Data::Faces:
+                               {
+                                       Face fac;
+
+                                       for (size_t i = 0; i < chunk.count; ++i)
+                                       {
+                                               file.read(reinterpret_cast<char *>(&fac), chunk.size);
+                                               faces.push_back(fac);
+                                       }
+
+                                       std::cout << "read " << chunk.count << " faces" << std::endl;
+
+                                       break;
+                               }
+                               case Data::VertexIndexes:
+                               {
+                                       uint32_t ind = 0;
+
+                                       for (size_t i = 0; i < chunk.count; ++i)
+                                       {
+                                               file.read(reinterpret_cast<char *>(&ind), chunk.size);
+                                               indexes.push_back(ind);
+                                       }
+
+                                       std::cout << "read " << chunk.count << " vertex indicies" << std::endl;
+
+                                       break;
+                               }
+                               case Data::Vertices:
+                               {
+                                       Vertex vert;
+
+                                       for (size_t i = 0; i < chunk.count; ++i)
+                                       {
+                                               file.read(reinterpret_cast<char *>(&vert), chunk.size);
+                                               vertices.push_back(vert);
+                                       }
+
+                                       std::cout << "read " << chunk.count << " vertices" << std::endl;
+
+                                       break;
+                               }
+                               default:
+                               {
+                                       std::cout << "dropped type " << chunk.type << " with size " << chunk.size * chunk.count << std::endl;
+                                       file.seekg(chunk.size * chunk.count, std::ios_base::cur);
+
+                                       break;
+                               }
+                       }
+               }
+
+               file.close();
+       }
+
+       //for (Vertex& vert : vertices)
+       //      std::cout << "vertex " << vert.x << " " << vert.y << " " << vert.z << std::endl;
+
+       //for (uint32_t& ind : indexes)
+       //      std::cout << "index " << ind << std::endl;
+
+       /*for (Face& face : faces)
+       {
+               std::cout << "Face: " << face.vertex_count << " (" << face.first << ") ->";
+               for (size_t i = 0; i < face.vertex_count; ++i)
+               {
+                       std::cout << " " << indexes[i + face.first];
+               }
+               std::cout << std::endl;
+               std::cout << "  ";
+               for (size_t i = 0; i < face.vertex_count; ++i)
+               {
+                       Vertex& vert = vertices[indexes[i + face.first]];
+                       std::cout << " (" << vert.x << ", " << vert.y << ", " << vert.z << ")";
+               }
+               std::cout << std::endl << std::endl;
+       }*/
+
+       glutInit(&argc, argv);
+       glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA);
+       glutInitWindowSize(800, 600);
+       glutInitWindowPosition(40, 40);
+       glutCreateWindow("NC BSP Test");
+
+       glutDisplayFunc(display);
+       glutReshapeFunc(reshape);
+       glutIdleFunc(display);
+
+       glutMainLoop();
+
+       return 0;
+}