krita/ui
kis_3d_object_model.h
Go to the documentation of this file.00001 /* This file is part of the KDE project 00002 * Copyright (C) Lukáš Tvrdý, lukast.dev@gmail.com (c) 2009 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Library General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2 of the License, or (at your option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Library General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Library General Public License 00015 * along with this library; see the file COPYING.LIB. If not, write to 00016 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 * Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef KIS_3D_OBJECT_MODEL_H 00021 #define KIS_3D_OBJECT_MODEL_H 00022 00023 #include "kis_vec.h" 00024 00025 #include "krita_export.h" 00026 00027 #include <QString> 00028 #include <QVector> 00029 #include <QHash> 00030 00031 #include <config-opengl.h> 00032 00033 #ifdef HAVE_OPENGL 00034 #if defined(_WIN32) || defined(_WIN64) 00035 # include <windows.h> 00036 #endif 00037 #include <GL/gl.h> 00038 #endif 00039 00040 struct Material { 00041 KisVector3D Ka; // ambient 00042 KisVector3D Kd; // diffuse 00043 KisVector3D Ks; // specularity 00044 qreal Ns; // hardness ??? [from Blender import script] 00045 qreal Ni; // index of refraction 00046 qreal d; // alpha 00047 }; 00048 00049 class KRITAUI_EXPORT Kis3DObjectModel 00050 { 00051 public: 00052 00053 Kis3DObjectModel() {} 00054 Kis3DObjectModel(const QString &model, const QString &material); 00055 //void parseModel(); 00056 void parseMaterial(const QString &fileName); 00057 00058 00059 GLuint displayList(); 00060 00061 private: 00062 QString m_fileName; 00063 QVector<KisVector3D> m_vertex; 00064 QVector<KisVector3D> m_normal; 00065 QVector<int> m_vertexIndex; 00066 QVector<int> m_normalIndex; 00067 QHash<QString, QVector<int> > m_vertexHash; 00068 QHash<QString, QVector<int> > m_normalHash; 00069 QHash<QString, Material> m_material; 00070 00071 void debug(Material m); 00072 00073 bool m_cached; 00074 GLuint m_displayList; 00075 }; 00076 00077 #endif // KIS_3D_OBJECT_MODEL_H
