diff options
author | Treeki <treeki@gmail.com> | 2012-08-03 05:16:52 +0200 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2012-08-03 05:16:52 +0200 |
commit | 7a183cfa367db01413c001306741d06e1826d077 (patch) | |
tree | e50e2e222ddf924e4d868e79ed87a0ced85d01e1 /layoutgl/texturemanager.cpp | |
parent | ebcc95da4c26369511caa90d89c5ed06e1e4853a (diff) | |
download | LayoutStudio-7a183cfa367db01413c001306741d06e1826d077.tar.gz LayoutStudio-7a183cfa367db01413c001306741d06e1826d077.zip |
might as well push all this. a massive amount of changes
Diffstat (limited to '')
-rw-r--r-- | layoutgl/texturemanager.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/layoutgl/texturemanager.cpp b/layoutgl/texturemanager.cpp new file mode 100644 index 0000000..80a8186 --- /dev/null +++ b/layoutgl/texturemanager.cpp @@ -0,0 +1,31 @@ +#include "texturemanager.h" + +LGLTextureManager::LGLTextureManager() { +} + +void LGLTextureManager::setup(QGLWidget *gl, const LYTLayout *layout) { + // TODO: code to cleanup previous stuff + + //m_gl = gl; + m_layout = layout; + m_package = &layout->package(); + + QStringList textures = layout->generateTextureRefs(); + + foreach (const QString &texName, textures) { + qDebug() << texName; + + QByteArray tplData = m_package->getTexture(texName); + + QDataStream tplStream(tplData); + WiiTexPalette tpl(tplStream); + + const QImage &image = tpl.textures.first().image; + image.save(QString("tpl/%2__%1.png").arg(texName).arg((int)tpl.textures.first().format)); + // dirty, dirty hack, TODO: FIXME + GLuint tex = gl->bindTexture(image, GL_TEXTURE_2D); + + m_textures.insert(texName, tex); + m_images.insert(texName, image); + } +} |