Fix polyline rendering using default texture

This commit is contained in:
Brad Davis 2017-09-14 10:48:14 -07:00
parent 501eee8b10
commit aef85eb69d
2 changed files with 9 additions and 6 deletions

View file

@ -121,15 +121,19 @@ bool PolyLineEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityP
} }
void PolyLineEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) { void PolyLineEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) {
static const QUrl DEFAULT_POLYLINE_TEXTURE = QUrl(PathUtils::resourcesPath() + "images/paintStroke.png");
QUrl entityTextures = DEFAULT_POLYLINE_TEXTURE;
if (entity->texturesChanged()) { if (entity->texturesChanged()) {
entity->resetTexturesChanged(); entity->resetTexturesChanged();
auto textures = entity->getTextures(); auto textures = entity->getTextures();
QString path = textures.isEmpty() ? PathUtils::resourcesPath() + "images/paintStroke.png" : textures; if (!textures.isEmpty()) {
if (!_texture || _lastTextures != path) { entityTextures = QUrl(textures);
_lastTextures = path;
_texture = DependencyManager::get<TextureCache>()->getTexture(QUrl(path));
} }
} }
if (!_texture || _texture->getURL() != entityTextures) {
_texture = DependencyManager::get<TextureCache>()->getTexture(entityTextures);
}
} }
void PolyLineEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) { void PolyLineEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) {
@ -228,7 +232,7 @@ void PolyLineEntityRenderer::doRender(RenderArgs* args) {
if (_texture && _texture->isLoaded()) { if (_texture && _texture->isLoaded()) {
batch.setResourceTexture(PAINTSTROKE_TEXTURE_SLOT, _texture->getGPUTexture()); batch.setResourceTexture(PAINTSTROKE_TEXTURE_SLOT, _texture->getGPUTexture());
} else { } else {
batch.setResourceTexture(PAINTSTROKE_TEXTURE_SLOT, nullptr); batch.setResourceTexture(PAINTSTROKE_TEXTURE_SLOT, DependencyManager::get<TextureCache>()->getWhiteTexture());
} }
batch.setInputFormat(polylineFormat); batch.setInputFormat(polylineFormat);

View file

@ -55,7 +55,6 @@ protected:
gpu::BufferView _uniformBuffer; gpu::BufferView _uniformBuffer;
uint32_t _numVertices { 0 }; uint32_t _numVertices { 0 };
bool _empty{ true }; bool _empty{ true };
QString _lastTextures;
NetworkTexturePointer _texture; NetworkTexturePointer _texture;
}; };