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
121121 return id;
122122 }
123123
124−QSharedPointer<NetworkTexture> TextureCache::getTexture(const QUrl& url, bool dilatable) {
124+QSharedPointer<NetworkTexture> TextureCache::getTexture(const QUrl& url, bool normalMap, bool dilatable) {
125125 QSharedPointer<NetworkTexture> texture;
126126 if (dilatable) {
127127 texture = _dilatableNetworkTextures.value(url);
128128 if (texture.isNull()) {
129− texture = QSharedPointer<NetworkTexture>(new DilatableNetworkTexture(url));
129+ texture = QSharedPointer<NetworkTexture>(new DilatableNetworkTexture(url, normalMap));
130130 _dilatableNetworkTextures.insert(url, texture);
131131 }
132132 } else {
133133 texture = _networkTextures.value(url);
134134 if (texture.isNull()) {
135− texture = QSharedPointer<NetworkTexture>(new NetworkTexture(url));
135+ texture = QSharedPointer<NetworkTexture>(new NetworkTexture(url, normalMap));
136136 _networkTextures.insert(url, texture);
137137 }
138138 }
@@ -219,7 +219,7 @@ Texture::~Texture() { · 80 unmodified lines
219219 glDeleteTextures(1, &_id);
220220 }
221221
222−NetworkTexture::NetworkTexture(const QUrl& url) : _reply(NULL), _averageColor(1.0f, 1.0f, 1.0f, 1.0f) {
222+NetworkTexture::NetworkTexture(const QUrl& url, bool normalMap) : _reply(NULL), _averageColor(1.0f, 1.0f, 1.0f, 1.0f) {
223223 if (!url.isValid()) {
224224 return;
225225 }
@@ -230,9 +230,9 @@ NetworkTexture::NetworkTexture(const QUrl& url) : _reply(NULL), _averageColor(1. · 4 unmodified lines
230230 connect(_reply, SIGNAL(downloadProgress(qint64,qint64)), SLOT(handleDownloadProgress(qint64,qint64)));
231231 connect(_reply, SIGNAL(error(QNetworkReply::NetworkError)), SLOT(handleReplyError()));
232232
233− // default to white
233+ // default to white/blue
234234 glBindTexture(GL_TEXTURE_2D, getID());
235− loadSingleColorTexture(OPAQUE_WHITE);
235+ loadSingleColorTexture(normalMap ? OPAQUE_BLUE : OPAQUE_WHITE);
236236 glBindTexture(GL_TEXTURE_2D, 0);
237237 }
238238
@@ -288,8 +288,8 @@ void NetworkTexture::handleReplyError() { · 49 unmodified lines
288288 _reply = NULL;
289289 }
290290
291−DilatableNetworkTexture::DilatableNetworkTexture(const QUrl& url) :
292− NetworkTexture(url),
291+DilatableNetworkTexture::DilatableNetworkTexture(const QUrl& url, bool normalMap) :
292+ NetworkTexture(url, normalMap),
293293 _innerRadius(0),
294294 _outerRadius(0)
295295 {

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