Skip to content

Commit

Permalink
Loading textures from BSAs for Outfit Studio
Browse files Browse the repository at this point in the history
  • Loading branch information
ousnius committed Jun 24, 2015
1 parent 4e29372 commit dd439ae
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
10 changes: 4 additions & 6 deletions GLSurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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);

Expand All @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions GLSurface.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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();

Expand Down
10 changes: 2 additions & 8 deletions OutfitProject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion OutfitStudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit dd439ae

Please sign in to comment.