History

Use blue default texture when we fail to load a normal map.

Andrzej Kapolka committed 13 years ago

Commit 55de8ce1 parent 070e7554 files · +14 −14Browse files

Showing the changes to interface/src/renderer/TextureCache.cpp (1 of 4 files). Show all

Unified · Split

interface/src/renderer/TextureCache.cpp+8−8
@@ -121,18 +121,18 @@ GLuint TextureCache::getFileTextureID(const QString& filename) { · 120 unmodified lines
121 return id;121 return id;
122}122}
123 123
124QSharedPointer<NetworkTexture> TextureCache::getTexture(const QUrl& url, bool dilatable) {124QSharedPointer<NetworkTexture> TextureCache::getTexture(const QUrl& url, bool normalMap, bool dilatable) {
125 QSharedPointer<NetworkTexture> texture;125 QSharedPointer<NetworkTexture> texture;
126 if (dilatable) {126 if (dilatable) {
127 texture = _dilatableNetworkTextures.value(url);127 texture = _dilatableNetworkTextures.value(url);
128 if (texture.isNull()) {128 if (texture.isNull()) {
129 texture = QSharedPointer<NetworkTexture>(new DilatableNetworkTexture(url));129 texture = QSharedPointer<NetworkTexture>(new DilatableNetworkTexture(url, normalMap));
130 _dilatableNetworkTextures.insert(url, texture);130 _dilatableNetworkTextures.insert(url, texture);
131 }131 }
132 } else {132 } else {
133 texture = _networkTextures.value(url);133 texture = _networkTextures.value(url);
134 if (texture.isNull()) {134 if (texture.isNull()) {
135 texture = QSharedPointer<NetworkTexture>(new NetworkTexture(url));135 texture = QSharedPointer<NetworkTexture>(new NetworkTexture(url, normalMap));
136 _networkTextures.insert(url, texture);136 _networkTextures.insert(url, texture);
137 }137 }
138 }138 }
@@ -219,7 +219,7 @@ Texture::~Texture() { · 80 unmodified lines
219 glDeleteTextures(1, &_id);219 glDeleteTextures(1, &_id);
220}220}
221 221
222NetworkTexture::NetworkTexture(const QUrl& url) : _reply(NULL), _averageColor(1.0f, 1.0f, 1.0f, 1.0f) {222NetworkTexture::NetworkTexture(const QUrl& url, bool normalMap) : _reply(NULL), _averageColor(1.0f, 1.0f, 1.0f, 1.0f) {
223 if (!url.isValid()) {223 if (!url.isValid()) {
224 return;224 return;
225 }225 }
@@ -230,9 +230,9 @@ NetworkTexture::NetworkTexture(const QUrl& url) : _reply(NULL), _averageColor(1. · 4 unmodified lines
230 connect(_reply, SIGNAL(downloadProgress(qint64,qint64)), SLOT(handleDownloadProgress(qint64,qint64)));230 connect(_reply, SIGNAL(downloadProgress(qint64,qint64)), SLOT(handleDownloadProgress(qint64,qint64)));
231 connect(_reply, SIGNAL(error(QNetworkReply::NetworkError)), SLOT(handleReplyError()));231 connect(_reply, SIGNAL(error(QNetworkReply::NetworkError)), SLOT(handleReplyError()));
232 232
233 // default to white233 // default to white/blue
234 glBindTexture(GL_TEXTURE_2D, getID());234 glBindTexture(GL_TEXTURE_2D, getID());
235 loadSingleColorTexture(OPAQUE_WHITE);235 loadSingleColorTexture(normalMap ? OPAQUE_BLUE : OPAQUE_WHITE);
236 glBindTexture(GL_TEXTURE_2D, 0);236 glBindTexture(GL_TEXTURE_2D, 0);
237}237}
238 238
@@ -288,8 +288,8 @@ void NetworkTexture::handleReplyError() { · 49 unmodified lines
288 _reply = NULL;288 _reply = NULL;
289}289}
290 290
291DilatableNetworkTexture::DilatableNetworkTexture(const QUrl& url) :291DilatableNetworkTexture::DilatableNetworkTexture(const QUrl& url, bool normalMap) :
292 NetworkTexture(url),292 NetworkTexture(url, normalMap),
293 _innerRadius(0),293 _innerRadius(0),
294 _outerRadius(0)294 _outerRadius(0)
295{295{

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t