mirror of
https://github.com/lubosz/overte.git
synced 2025-04-23 19:34:02 +02:00
Fix polyline rendering using default texture
This commit is contained in:
parent
501eee8b10
commit
aef85eb69d
2 changed files with 9 additions and 6 deletions
|
@ -121,15 +121,19 @@ bool PolyLineEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityP
|
|||
}
|
||||
|
||||
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()) {
|
||||
entity->resetTexturesChanged();
|
||||
auto textures = entity->getTextures();
|
||||
QString path = textures.isEmpty() ? PathUtils::resourcesPath() + "images/paintStroke.png" : textures;
|
||||
if (!_texture || _lastTextures != path) {
|
||||
_lastTextures = path;
|
||||
_texture = DependencyManager::get<TextureCache>()->getTexture(QUrl(path));
|
||||
if (!textures.isEmpty()) {
|
||||
entityTextures = QUrl(textures);
|
||||
}
|
||||
}
|
||||
|
||||
if (!_texture || _texture->getURL() != entityTextures) {
|
||||
_texture = DependencyManager::get<TextureCache>()->getTexture(entityTextures);
|
||||
}
|
||||
}
|
||||
|
||||
void PolyLineEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) {
|
||||
|
@ -228,7 +232,7 @@ void PolyLineEntityRenderer::doRender(RenderArgs* args) {
|
|||
if (_texture && _texture->isLoaded()) {
|
||||
batch.setResourceTexture(PAINTSTROKE_TEXTURE_SLOT, _texture->getGPUTexture());
|
||||
} else {
|
||||
batch.setResourceTexture(PAINTSTROKE_TEXTURE_SLOT, nullptr);
|
||||
batch.setResourceTexture(PAINTSTROKE_TEXTURE_SLOT, DependencyManager::get<TextureCache>()->getWhiteTexture());
|
||||
}
|
||||
|
||||
batch.setInputFormat(polylineFormat);
|
||||
|
|
|
@ -55,7 +55,6 @@ protected:
|
|||
gpu::BufferView _uniformBuffer;
|
||||
uint32_t _numVertices { 0 };
|
||||
bool _empty{ true };
|
||||
QString _lastTextures;
|
||||
NetworkTexturePointer _texture;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue