mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 18:44:01 +02:00
repairs to ShaderCache for Resource changes
This commit is contained in:
parent
25aeda2e18
commit
9878143661
4 changed files with 11 additions and 10 deletions
|
@ -93,7 +93,7 @@ bool RenderableProceduralItem::ProceduralInfo::ready() {
|
|||
|
||||
void RenderableProceduralItem::ProceduralInfo::prepare(gpu::Batch& batch) {
|
||||
if (_shaderUrl.isLocalFile()) {
|
||||
auto lastModified = QFileInfo(_shaderPath).lastModified().toMSecsSinceEpoch();
|
||||
auto lastModified = (quint64) QFileInfo(_shaderPath).lastModified().toMSecsSinceEpoch();
|
||||
if (lastModified > _shaderModified) {
|
||||
QFile file(_shaderPath);
|
||||
file.open(QIODevice::ReadOnly);
|
||||
|
|
|
@ -173,6 +173,7 @@ public:
|
|||
Q_INVOKABLE void allReferencesCleared();
|
||||
|
||||
const QUrl& getURL() const { return _url; }
|
||||
const QByteArray& getData() const { return _data; }
|
||||
|
||||
signals:
|
||||
/// Fired when the resource has been loaded.
|
||||
|
@ -190,7 +191,7 @@ protected slots:
|
|||
protected:
|
||||
virtual void init();
|
||||
|
||||
/// Called when the download has finished. The recipient should delete the reply when done with it.
|
||||
/// Called when the download has finished
|
||||
virtual void downloadFinished(const QByteArray& data);
|
||||
|
||||
/// Should be called by subclasses when all the loading that will be done has been done.
|
||||
|
|
|
@ -8,13 +8,13 @@
|
|||
#include "ShaderCache.h"
|
||||
|
||||
NetworkShader::NetworkShader(const QUrl& url, bool delayLoad)
|
||||
: Resource(url, delayLoad) {};
|
||||
: Resource(url, delayLoad)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void NetworkShader::downloadFinished(QNetworkReply* reply) {
|
||||
if (reply) {
|
||||
_source = reply->readAll();
|
||||
reply->deleteLater();
|
||||
}
|
||||
void NetworkShader::downloadFinished(const QByteArray& data) {
|
||||
_source = QString::fromUtf8(data);
|
||||
}
|
||||
|
||||
ShaderCache& ShaderCache::instance() {
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
class NetworkShader : public Resource {
|
||||
public:
|
||||
NetworkShader(const QUrl& url, bool delayLoad);
|
||||
virtual void downloadFinished(QNetworkReply* reply) override;
|
||||
virtual void downloadFinished(const QByteArray& data) override;
|
||||
|
||||
QByteArray _source;
|
||||
QString _source;
|
||||
};
|
||||
|
||||
using NetworkShaderPointer = QSharedPointer<NetworkShader>;
|
||||
|
|
Loading…
Reference in a new issue