From dd439aeed1587ac5e38ec48f6fc00b477a7f46ac Mon Sep 17 00:00:00 2001 From: ousnius Date: Thu, 25 Jun 2015 00:22:17 +0200 Subject: [PATCH] Loading textures from BSAs for Outfit Studio --- GLSurface.cpp | 10 ++++------ GLSurface.h | 4 ++-- OutfitProject.cpp | 10 ++-------- OutfitStudio.cpp | 2 +- 4 files changed, 9 insertions(+), 17 deletions(-) diff --git a/GLSurface.cpp b/GLSurface.cpp index b5fbe87d..afd0f9e4 100644 --- a/GLSurface.cpp +++ b/GLSurface.cpp @@ -403,14 +403,14 @@ void GLSurface::initMaterial(Vector3 diffusecolor) { glMaterialfv(GL_FRONT, GL_SHININESS, shiny); } -int GLSurface::Initialize(wxGLCanvas* can, wxGLContext* ctx, bool bUseDefaultShaders) { +int GLSurface::Initialize(wxGLCanvas* can, wxGLContext* ctx) { canvas = can; context = ctx; canvas->SetCurrent(*context); InitGLExtensions(); - return InitGLSettings(bUseDefaultShaders); + return InitGLSettings(); } void GLSurface::InitGLExtensions() { @@ -422,7 +422,7 @@ void GLSurface::InitGLExtensions() { glDisableVertexAttribArray = (PFNGLDISABLEVERTEXATTRIBARRAYPROC)wglGetProcAddress("glDisableVertexAttribArray"); } -int GLSurface::InitGLSettings(bool bUseDefaultShaders) { +int GLSurface::InitGLSettings() { if (multiSampleEnabled) glEnable(GL_MULTISAMPLE_ARB); @@ -449,9 +449,7 @@ int GLSurface::InitGLSettings(bool bUseDefaultShaders) { initLighting(); initMaterial(Vector3(0.8f, 0.8f, 0.8f)); - if (bUseDefaultShaders) { //NoImg.png - noImage = resLoader.AddMaterial("res\\NoImg.png", "res\\defvshader.vs", "res\\defshader.fs"); - } + noImage = resLoader.AddMaterial("res\\NoImg.png", "res\\defvshader.vs", "res\\defshader.fs"); return 0; } diff --git a/GLSurface.h b/GLSurface.h index 38e94933..9536cef0 100644 --- a/GLSurface.h +++ b/GLSurface.h @@ -61,7 +61,7 @@ class GLSurface { void initLighting(); void initMaterial(Vector3 diffusecolor); void InitGLExtensions(); - int InitGLSettings(bool bUseDefaultShaders); + int InitGLSettings(); static int QueryMultisample(wxWindow* parent); static int FindBestNumSamples(HDC hDC); @@ -208,7 +208,7 @@ class GLSurface { static bool IsWGLExtensionSupported(char* szTargetExtension); static bool IsExtensionSupported(char* szTargetExtension); - int Initialize(wxGLCanvas* canvas, wxGLContext* context, bool bUseDefaultShaders = true); + int Initialize(wxGLCanvas* canvas, wxGLContext* context); void Begin(); void Cleanup(); diff --git a/OutfitProject.cpp b/OutfitProject.cpp index dbeb1832..55c02a50 100644 --- a/OutfitProject.cpp +++ b/OutfitProject.cpp @@ -737,10 +737,7 @@ void OutfitProject::SetOutfitTexture(const string& shapeName, const string& text } wxString combinedTexFile = texturesDir + nifTexFile; - if (GetFileAttributes(combinedTexFile.wc_str()) == INVALID_FILE_ATTRIBUTES) - outfitTextures[shapeName] = defaultTexFile; - else - outfitTextures[shapeName] = combinedTexFile.ToStdString(); + outfitTextures[shapeName] = combinedTexFile.ToStdString(); } else outfitTextures[shapeName] = textureFile; @@ -765,10 +762,7 @@ void OutfitProject::SetRefTexture(const string& shapeName, const string& texture } wxString combinedTexFile = texturesDir + nifTexFile; - if (GetFileAttributes(combinedTexFile.wc_str()) == INVALID_FILE_ATTRIBUTES) - baseTextures[shapeName] = defaultTexFile; - else - baseTextures[shapeName] = combinedTexFile.ToStdString(); + baseTextures[shapeName] = combinedTexFile.ToStdString(); } else baseTextures[shapeName] = textureFile; diff --git a/OutfitStudio.cpp b/OutfitStudio.cpp index 2ef609a3..3cfda6ea 100644 --- a/OutfitStudio.cpp +++ b/OutfitStudio.cpp @@ -3658,7 +3658,7 @@ wxGLPanel::~wxGLPanel() { } void wxGLPanel::OnShown() { - gls.Initialize(this, context, false); + gls.Initialize(this, context); auto size = GetSize(); gls.SetStartingView(Vector3(0.0f, -5.0f, -15.0f), Vector3(15.0f, 0.0f, 0.0f), size.GetWidth(), size.GetHeight()); gls.ToggleMask();