mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-11 05:43:04 +02:00
Merge pull request #10437 from Atlante45/feat/faster-startup
Use baked default skybox
This commit is contained in:
commit
1658ced671
6 changed files with 44 additions and 8 deletions
Binary file not shown.
Before Width: | Height: | Size: 6.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 394 KiB |
BIN
interface/resources/images/Default-Sky-9-cubemap.ktx
Normal file
BIN
interface/resources/images/Default-Sky-9-cubemap.ktx
Normal file
Binary file not shown.
|
@ -1438,15 +1438,17 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
connect(_window, SIGNAL(windowMinimizedChanged(bool)), this, SLOT(windowMinimizedChanged(bool)));
|
||||
qCDebug(interfaceapp, "Startup time: %4.2f seconds.", (double)startupTimer.elapsed() / 1000.0);
|
||||
|
||||
auto textureCache = DependencyManager::get<TextureCache>();
|
||||
{
|
||||
PROFILE_RANGE(render, "Process Default Skybox");
|
||||
auto textureCache = DependencyManager::get<TextureCache>();
|
||||
|
||||
QString skyboxUrl { PathUtils::resourcesPath() + "images/Default-Sky-9-cubemap.jpg" };
|
||||
QString skyboxAmbientUrl { PathUtils::resourcesPath() + "images/Default-Sky-9-ambient.jpg" };
|
||||
auto skyboxUrl = PathUtils::resourcesPath().toStdString() + "images/Default-Sky-9-cubemap.ktx";
|
||||
|
||||
_defaultSkyboxTexture = textureCache->getImageTexture(skyboxUrl, image::TextureUsage::CUBE_TEXTURE, { { "generateIrradiance", false } });
|
||||
_defaultSkyboxAmbientTexture = textureCache->getImageTexture(skyboxAmbientUrl, image::TextureUsage::CUBE_TEXTURE, { { "generateIrradiance", true } });
|
||||
_defaultSkyboxTexture = gpu::Texture::unserialize(skyboxUrl);
|
||||
_defaultSkyboxAmbientTexture = _defaultSkyboxTexture;
|
||||
|
||||
_defaultSkybox->setCubemap(_defaultSkyboxTexture);
|
||||
_defaultSkybox->setCubemap(_defaultSkyboxTexture);
|
||||
}
|
||||
|
||||
EntityItem::setEntitiesShouldFadeFunction([this]() {
|
||||
SharedNodePointer entityServerNode = DependencyManager::get<NodeList>()->soloNodeOfType(NodeType::EntityServer);
|
||||
|
|
|
@ -68,7 +68,7 @@ StoragePointer FileStorage::create(const QString& filename, size_t size, const u
|
|||
}
|
||||
|
||||
FileStorage::FileStorage(const QString& filename) : _file(filename) {
|
||||
if (_file.open(QFile::ReadWrite)) {
|
||||
if (_file.open(QFile::ReadOnly)) {
|
||||
_mapped = _file.map(0, _file.size());
|
||||
if (_mapped) {
|
||||
_valid = true;
|
||||
|
@ -90,3 +90,34 @@ FileStorage::~FileStorage() {
|
|||
_file.close();
|
||||
}
|
||||
}
|
||||
|
||||
void FileStorage::ensureWriteAccess() {
|
||||
if (_hasWriteAccess) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (_mapped) {
|
||||
if (!_file.unmap(_mapped)) {
|
||||
throw std::runtime_error("Unable to unmap file");
|
||||
}
|
||||
}
|
||||
if (_file.isOpen()) {
|
||||
_file.close();
|
||||
}
|
||||
_valid = false;
|
||||
_mapped = nullptr;
|
||||
|
||||
if (_file.open(QFile::ReadWrite)) {
|
||||
_mapped = _file.map(0, _file.size());
|
||||
if (_mapped) {
|
||||
_valid = true;
|
||||
_hasWriteAccess = true;
|
||||
} else {
|
||||
qCWarning(storagelogging) << "Failed to map file " << _file.fileName();
|
||||
throw std::runtime_error("Failed to map file");
|
||||
}
|
||||
} else {
|
||||
qCWarning(storagelogging) << "Failed to open file " << _file.fileName();
|
||||
throw std::runtime_error("Failed to open file");
|
||||
}
|
||||
}
|
|
@ -60,11 +60,14 @@ namespace storage {
|
|||
FileStorage& operator=(const FileStorage& other) = delete;
|
||||
|
||||
const uint8_t* data() const override { return _mapped; }
|
||||
uint8_t* mutableData() override { return _mapped; }
|
||||
uint8_t* mutableData() override { ensureWriteAccess(); return _mapped; }
|
||||
size_t size() const override { return _file.size(); }
|
||||
operator bool() const override { return _valid; }
|
||||
private:
|
||||
void ensureWriteAccess();
|
||||
|
||||
bool _valid { false };
|
||||
bool _hasWriteAccess { false };
|
||||
QFile _file;
|
||||
uint8_t* _mapped { nullptr };
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue