Updates for bazel on windows.
This commit is contained in:
@@ -17,11 +17,22 @@
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
// clang-format off
|
||||
#include "myglTexture.h"
|
||||
using namespace OpenArena;
|
||||
#include <string>
|
||||
#include "Logger.h"
|
||||
|
||||
// clang-format on
|
||||
|
||||
namespace OpenArena {
|
||||
namespace {
|
||||
using std::string;
|
||||
using std::to_string;
|
||||
} // End namespace
|
||||
|
||||
Texture::Texture() {
|
||||
Logger::LogDebug("OpenArena::Texture::Texture() Making a new unloaded texture.");
|
||||
id = 0xFFFFFFFF;
|
||||
filename = "";
|
||||
minFilter = GL_LINEAR;
|
||||
@@ -32,39 +43,55 @@ Texture::~Texture() {
|
||||
Free();
|
||||
}
|
||||
|
||||
string Texture::Filename() {
|
||||
string Texture::Filename() const {
|
||||
return filename;
|
||||
}
|
||||
|
||||
GLuint Texture::ID() {
|
||||
GLuint Texture::ID() const {
|
||||
return id;
|
||||
}
|
||||
|
||||
bool Texture::Loaded() {
|
||||
bool Texture::Loaded() const {
|
||||
return filename != "";
|
||||
}
|
||||
|
||||
bool Texture::Load(string fn) {
|
||||
if (Loaded()) Free();
|
||||
const string method_name = "OpenArena::Texture::Load ";
|
||||
Logger::LogDebug(method_name + "Loading texture from " + fn);
|
||||
if (Loaded()) {
|
||||
Logger::LogDebug(method_name + "Freeing old texture " + filename);
|
||||
Free();
|
||||
}
|
||||
|
||||
if (LoadGLTexture(fn.c_str(), id, minFilter, magFilter)) {
|
||||
Logger::LogDebug(method_name + "Texture load successful");
|
||||
filename = fn;
|
||||
return true;
|
||||
} else {
|
||||
Logger::LogError(method_name + "error while loading texture from " + fn
|
||||
+ ", with min_filter = " + to_string(minFilter) + ", and mag_filter = " + to_string(magFilter));
|
||||
id = 0xFFFFFFFF;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool Texture::Load(string fn, GLuint min, GLuint mag) {
|
||||
if (Loaded()) Free();
|
||||
string method_name = "OpenArena::Texture::Load(string, GLuint, GLuint) ";
|
||||
Logger::LogDebug(method_name + "Loading texture from " + fn);
|
||||
if (Loaded()) {
|
||||
Logger::LogDebug(method_name + "Freeing old texture " + fn);
|
||||
Free();
|
||||
}
|
||||
|
||||
if (LoadGLTexture(fn.c_str(), id, min, mag)) {
|
||||
Logger::LogDebug(method_name + "Texture load successful");
|
||||
filename = fn;
|
||||
minFilter = min;
|
||||
magFilter = mag;
|
||||
return true;
|
||||
} else {
|
||||
Logger::LogError(method_name + "error while loading texture from " + fn + ", with min_filter = " + to_string(min)
|
||||
+ ", and mag_filter = " + to_string(mag));
|
||||
id = 0xFFFFFFFF;
|
||||
return false;
|
||||
}
|
||||
@@ -72,9 +99,7 @@ bool Texture::Load(string fn, GLuint min, GLuint mag) {
|
||||
|
||||
void Texture::Free() {
|
||||
if (Loaded()) {
|
||||
// This is only temporarily removed for mac os x
|
||||
// TODO make this work on all operating systems
|
||||
// FreeGLTexture(id);
|
||||
FreeGLTexture(id);
|
||||
minFilter = GL_LINEAR;
|
||||
magFilter = GL_LINEAR;
|
||||
filename = "";
|
||||
@@ -82,27 +107,30 @@ void Texture::Free() {
|
||||
}
|
||||
}
|
||||
|
||||
bool Texture::operator<(const Texture& rtOp) {
|
||||
bool Texture::operator<(const Texture& rtOp) const {
|
||||
return id < rtOp.id;
|
||||
}
|
||||
|
||||
bool Texture::operator<=(const Texture& rtOp) {
|
||||
bool Texture::operator<=(const Texture& rtOp) const {
|
||||
return id <= rtOp.id;
|
||||
}
|
||||
|
||||
bool Texture::operator==(const Texture& rtOp) {
|
||||
bool Texture::operator==(const Texture& rtOp) const {
|
||||
return id == rtOp.id;
|
||||
}
|
||||
|
||||
bool Texture::operator!=(const Texture& rtOp) {
|
||||
bool Texture::operator!=(const Texture& rtOp) const {
|
||||
return id != rtOp.id;
|
||||
}
|
||||
|
||||
bool Texture::operator>=(const Texture& rtOp) {
|
||||
bool Texture::operator>=(const Texture& rtOp) const {
|
||||
return id >= rtOp.id;
|
||||
}
|
||||
|
||||
bool Texture::operator>(const Texture& rtOp) {
|
||||
bool Texture::operator>(const Texture& rtOp) const {
|
||||
return id > rtOp.id;
|
||||
}
|
||||
|
||||
Texture kUnknownTexture = Texture();
|
||||
|
||||
} // End namespace OpenArena
|
||||
|
||||
Reference in New Issue
Block a user