mirror of
https://github.com/lubosz/overte.git
synced 2025-04-18 15:18:13 +02:00
handle models with no materials
This commit is contained in:
parent
d4a41770d7
commit
a31b09b204
2 changed files with 6 additions and 6 deletions
|
@ -462,6 +462,9 @@ public:
|
|||
void setTexturesLoading(bool value) { _texturesLoading = value; }
|
||||
bool areTexturesLoading() const { return _texturesLoading; }
|
||||
|
||||
bool isInitialized() const { return _initialized; }
|
||||
void setInitialized() { _initialized = true; }
|
||||
|
||||
int getTextureCount() const { calculateMaterialInfo(); return _textureCount; }
|
||||
size_t getTextureSize() const { calculateMaterialInfo(); return _textureSize; }
|
||||
bool hasTextureInfo() const { return _hasCalculatedTextureInfo; }
|
||||
|
@ -471,6 +474,7 @@ private:
|
|||
gpu::TextureTablePointer _textureTable { std::make_shared<gpu::TextureTable>() };
|
||||
bool _needsUpdate { false };
|
||||
bool _texturesLoading { false };
|
||||
bool _initialized { false };
|
||||
|
||||
mutable size_t _textureSize { 0 };
|
||||
mutable int _textureCount { 0 };
|
||||
|
|
|
@ -382,11 +382,6 @@ void RenderPipelines::bindMaterial(graphics::MaterialPointer& material, gpu::Bat
|
|||
void RenderPipelines::updateMultiMaterial(graphics::MultiMaterial& multiMaterial) {
|
||||
auto& schemaBuffer = multiMaterial.getSchemaBuffer();
|
||||
|
||||
if (multiMaterial.size() == 0) {
|
||||
schemaBuffer.edit<graphics::MultiMaterial::Schema>() = graphics::MultiMaterial::Schema();
|
||||
return;
|
||||
}
|
||||
|
||||
auto& drawMaterialTextures = multiMaterial.getTextureTable();
|
||||
multiMaterial.setTexturesLoading(false);
|
||||
|
||||
|
@ -732,6 +727,7 @@ void RenderPipelines::updateMultiMaterial(graphics::MultiMaterial& multiMaterial
|
|||
schema._key = (uint32_t)schemaKey._flags.to_ulong();
|
||||
schemaBuffer.edit<graphics::MultiMaterial::Schema>() = schema;
|
||||
multiMaterial.setNeedsUpdate(false);
|
||||
multiMaterial.setInitialized();
|
||||
}
|
||||
|
||||
void RenderPipelines::bindMaterials(graphics::MultiMaterial& multiMaterial, gpu::Batch& batch, bool enableTextures) {
|
||||
|
@ -739,7 +735,7 @@ void RenderPipelines::bindMaterials(graphics::MultiMaterial& multiMaterial, gpu:
|
|||
return;
|
||||
}
|
||||
|
||||
if (multiMaterial.needsUpdate() || multiMaterial.areTexturesLoading()) {
|
||||
if (!multiMaterial.isInitialized() || multiMaterial.needsUpdate() || multiMaterial.areTexturesLoading()) {
|
||||
updateMultiMaterial(multiMaterial);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue