mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-10 08:12:08 +02:00
CR
This commit is contained in:
parent
324eefc914
commit
2d754edf74
35 changed files with 350 additions and 303 deletions
|
@ -1593,7 +1593,38 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
}
|
||||
});
|
||||
|
||||
EntityTree::setAddMaterialToAvatarOperator([](const QUuid& avatarID, graphics::MaterialPointer material, const QString& parentMaterialName) {
|
||||
EntityTree::setAddMaterialToEntityOperator([&](const QUuid& entityID, graphics::MaterialLayer material, const std::string& parentMaterialName) {
|
||||
// try to find the renderable
|
||||
auto renderable = getEntities()->renderableForEntityId(entityID);
|
||||
if (renderable) {
|
||||
renderable->addMaterial(material, parentMaterialName);
|
||||
}
|
||||
|
||||
// even if we don't find it, try to find the entity
|
||||
auto entity = getEntities()->getEntity(entityID);
|
||||
if (entity) {
|
||||
entity->addMaterial(material, parentMaterialName);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
EntityTree::setRemoveMaterialFromEntityOperator([&](const QUuid& entityID, graphics::MaterialPointer material, const std::string& parentMaterialName) {
|
||||
// try to find the renderable
|
||||
auto renderable = getEntities()->renderableForEntityId(entityID);
|
||||
if (renderable) {
|
||||
renderable->removeMaterial(material, parentMaterialName);
|
||||
}
|
||||
|
||||
// even if we don't find it, try to find the entity
|
||||
auto entity = getEntities()->getEntity(entityID);
|
||||
if (entity) {
|
||||
entity->removeMaterial(material, parentMaterialName);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
EntityTree::setAddMaterialToAvatarOperator([](const QUuid& avatarID, graphics::MaterialLayer material, const std::string& parentMaterialName) {
|
||||
auto avatarManager = DependencyManager::get<AvatarManager>();
|
||||
auto avatar = avatarManager->getAvatarBySessionID(avatarID);
|
||||
if (avatar) {
|
||||
|
@ -1602,7 +1633,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
}
|
||||
return false;
|
||||
});
|
||||
EntityTree::setRemoveMaterialFromAvatarOperator([](const QUuid& avatarID, graphics::MaterialPointer material, const QString& parentMaterialName) {
|
||||
EntityTree::setRemoveMaterialFromAvatarOperator([](const QUuid& avatarID, graphics::MaterialPointer material, const std::string& parentMaterialName) {
|
||||
auto avatarManager = DependencyManager::get<AvatarManager>();
|
||||
auto avatar = avatarManager->getAvatarBySessionID(avatarID);
|
||||
if (avatar) {
|
||||
|
@ -1612,7 +1643,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
return false;
|
||||
});
|
||||
|
||||
EntityTree::setAddMaterialToOverlayOperator([&](const QUuid& overlayID, graphics::MaterialPointer material, const QString& parentMaterialName) {
|
||||
EntityTree::setAddMaterialToOverlayOperator([&](const QUuid& overlayID, graphics::MaterialLayer material, const std::string& parentMaterialName) {
|
||||
auto overlay = _overlays.getOverlay(overlayID);
|
||||
if (overlay) {
|
||||
overlay->addMaterial(material, parentMaterialName);
|
||||
|
@ -1620,7 +1651,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
}
|
||||
return false;
|
||||
});
|
||||
EntityTree::setRemoveMaterialFromOverlayOperator([&](const QUuid& overlayID, graphics::MaterialPointer material, const QString& parentMaterialName) {
|
||||
EntityTree::setRemoveMaterialFromOverlayOperator([&](const QUuid& overlayID, graphics::MaterialPointer material, const std::string& parentMaterialName) {
|
||||
auto overlay = _overlays.getOverlay(overlayID);
|
||||
if (overlay) {
|
||||
overlay->removeMaterial(material, parentMaterialName);
|
||||
|
|
|
@ -635,14 +635,14 @@ uint32_t ModelOverlay::fetchMetaSubItems(render::ItemIDs& subItems) const {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void ModelOverlay::addMaterial(graphics::MaterialPointer material, const QString& parentMaterialName) {
|
||||
void ModelOverlay::addMaterial(graphics::MaterialLayer material, const std::string& parentMaterialName) {
|
||||
Overlay::addMaterial(material, parentMaterialName);
|
||||
if (_model && _model->fetchRenderItemIDs().size() > 0) {
|
||||
_model->addMaterial(material, parentMaterialName);
|
||||
}
|
||||
}
|
||||
|
||||
void ModelOverlay::removeMaterial(graphics::MaterialPointer material, const QString& parentMaterialName) {
|
||||
void ModelOverlay::removeMaterial(graphics::MaterialPointer material, const std::string& parentMaterialName) {
|
||||
Overlay::removeMaterial(material, parentMaterialName);
|
||||
if (_model && _model->fetchRenderItemIDs().size() > 0) {
|
||||
_model->removeMaterial(material, parentMaterialName);
|
||||
|
|
|
@ -59,8 +59,8 @@ public:
|
|||
void setDrawInFront(bool drawInFront) override;
|
||||
void setDrawHUDLayer(bool drawHUDLayer) override;
|
||||
|
||||
void addMaterial(graphics::MaterialPointer material, const QString& parentMaterialName) override;
|
||||
void removeMaterial(graphics::MaterialPointer material, const QString& parentMaterialName) override;
|
||||
void addMaterial(graphics::MaterialLayer material, const std::string& parentMaterialName) override;
|
||||
void removeMaterial(graphics::MaterialPointer material, const std::string& parentMaterialName) override;
|
||||
|
||||
protected:
|
||||
Transform evalRenderTransform() override;
|
||||
|
|
|
@ -236,12 +236,12 @@ QVector<OverlayID> qVectorOverlayIDFromScriptValue(const QScriptValue& array) {
|
|||
return newVector;
|
||||
}
|
||||
|
||||
void Overlay::addMaterial(graphics::MaterialPointer material, const QString& parentMaterialName) {
|
||||
void Overlay::addMaterial(graphics::MaterialLayer material, const std::string& parentMaterialName) {
|
||||
std::lock_guard<std::mutex> lock(_materialsLock);
|
||||
_materials[parentMaterialName].push(material);
|
||||
}
|
||||
|
||||
void Overlay::removeMaterial(graphics::MaterialPointer material, const QString& parentMaterialName) {
|
||||
void Overlay::removeMaterial(graphics::MaterialPointer material, const std::string& parentMaterialName) {
|
||||
std::lock_guard<std::mutex> lock(_materialsLock);
|
||||
_materials[parentMaterialName].remove(material);
|
||||
}
|
|
@ -91,8 +91,8 @@ public:
|
|||
unsigned int getStackOrder() const { return _stackOrder; }
|
||||
void setStackOrder(unsigned int stackOrder) { _stackOrder = stackOrder; }
|
||||
|
||||
virtual void addMaterial(graphics::MaterialPointer material, const QString& parentMaterialName);
|
||||
virtual void removeMaterial(graphics::MaterialPointer material, const QString& parentMaterialName);
|
||||
virtual void addMaterial(graphics::MaterialLayer material, const std::string& parentMaterialName);
|
||||
virtual void removeMaterial(graphics::MaterialPointer material, const std::string& parentMaterialName);
|
||||
|
||||
protected:
|
||||
float updatePulse();
|
||||
|
@ -120,7 +120,7 @@ protected:
|
|||
static const xColor DEFAULT_OVERLAY_COLOR;
|
||||
static const float DEFAULT_ALPHA;
|
||||
|
||||
std::unordered_map<QString, graphics::MultiMaterial> _materials;
|
||||
std::unordered_map<std::string, graphics::MultiMaterial> _materials;
|
||||
std::mutex _materialsLock;
|
||||
|
||||
private:
|
||||
|
|
|
@ -1763,7 +1763,7 @@ float Avatar::getUnscaledEyeHeightFromSkeleton() const {
|
|||
}
|
||||
}
|
||||
|
||||
void Avatar::addMaterial(graphics::MaterialPointer material, const QString& parentMaterialName) {
|
||||
void Avatar::addMaterial(graphics::MaterialLayer material, const std::string& parentMaterialName) {
|
||||
std::lock_guard<std::mutex> lock(_materialsLock);
|
||||
_materials[parentMaterialName].push(material);
|
||||
if (_skeletonModel && _skeletonModel->fetchRenderItemIDs().size() > 0) {
|
||||
|
@ -1771,7 +1771,7 @@ void Avatar::addMaterial(graphics::MaterialPointer material, const QString& pare
|
|||
}
|
||||
}
|
||||
|
||||
void Avatar::removeMaterial(graphics::MaterialPointer material, const QString& parentMaterialName) {
|
||||
void Avatar::removeMaterial(graphics::MaterialPointer material, const std::string& parentMaterialName) {
|
||||
std::lock_guard<std::mutex> lock(_materialsLock);
|
||||
_materials[parentMaterialName].remove(material);
|
||||
if (_skeletonModel && _skeletonModel->fetchRenderItemIDs().size() > 0) {
|
||||
|
|
|
@ -272,8 +272,8 @@ public:
|
|||
|
||||
virtual void setAvatarEntityDataChanged(bool value) override;
|
||||
|
||||
void addMaterial(graphics::MaterialPointer material, const QString& parentMaterialName) override;
|
||||
void removeMaterial(graphics::MaterialPointer material, const QString& parentMaterialName) override;
|
||||
void addMaterial(graphics::MaterialLayer material, const std::string& parentMaterialName) override;
|
||||
void removeMaterial(graphics::MaterialPointer material, const std::string& parentMaterialName) override;
|
||||
|
||||
public slots:
|
||||
|
||||
|
@ -401,7 +401,7 @@ protected:
|
|||
|
||||
ThreadSafeValueCache<float> _unscaledEyeHeightCache { DEFAULT_AVATAR_EYE_HEIGHT };
|
||||
|
||||
std::unordered_map<QString, graphics::MultiMaterial> _materials;
|
||||
std::unordered_map<std::string, graphics::MultiMaterial> _materials;
|
||||
std::mutex _materialsLock;
|
||||
|
||||
void processMaterials();
|
||||
|
|
|
@ -696,8 +696,8 @@ public:
|
|||
|
||||
bool getIsReplicated() const { return _isReplicated; }
|
||||
|
||||
virtual void addMaterial(graphics::MaterialPointer material, const QString& parentMaterialName) {}
|
||||
virtual void removeMaterial(graphics::MaterialPointer material, const QString& parentMaterialName) {}
|
||||
virtual void addMaterial(graphics::MaterialLayer material, const std::string& parentMaterialName) {}
|
||||
virtual void removeMaterial(graphics::MaterialPointer material, const std::string& parentMaterialName) {}
|
||||
|
||||
signals:
|
||||
void displayNameChanged();
|
||||
|
|
|
@ -147,8 +147,6 @@ EntityRenderer::EntityRenderer(const EntityItemPointer& entity) : _entity(entity
|
|||
emit requestRenderUpdate();
|
||||
});
|
||||
_materials = entity->getMaterials();
|
||||
connect(entity.get(), &EntityItem::addMaterialToRenderItem, this, &EntityRenderer::addMaterial);
|
||||
connect(entity.get(), &EntityItem::removeMaterialFromRenderItem, this, &EntityRenderer::removeMaterial);
|
||||
}
|
||||
|
||||
EntityRenderer::~EntityRenderer() { }
|
||||
|
@ -404,12 +402,12 @@ void EntityRenderer::onRemoveFromScene(const EntityItemPointer& entity) {
|
|||
QObject::disconnect(this, &EntityRenderer::requestRenderUpdate, this, nullptr);
|
||||
}
|
||||
|
||||
void EntityRenderer::addMaterial(graphics::MaterialPointer material, const QString& parentMaterialName) {
|
||||
void EntityRenderer::addMaterial(graphics::MaterialLayer material, const std::string& parentMaterialName) {
|
||||
std::lock_guard<std::mutex> lock(_materialsLock);
|
||||
_materials[parentMaterialName].push(material);
|
||||
}
|
||||
|
||||
void EntityRenderer::removeMaterial(graphics::MaterialPointer material, const QString& parentMaterialName) {
|
||||
void EntityRenderer::removeMaterial(graphics::MaterialPointer material, const std::string& parentMaterialName) {
|
||||
std::lock_guard<std::mutex> lock(_materialsLock);
|
||||
_materials[parentMaterialName].remove(material);
|
||||
}
|
|
@ -54,6 +54,9 @@ public:
|
|||
|
||||
const uint64_t& getUpdateTime() const { return _updateTime; }
|
||||
|
||||
virtual void addMaterial(graphics::MaterialLayer material, const std::string& parentMaterialName);
|
||||
virtual void removeMaterial(graphics::MaterialPointer material, const std::string& parentMaterialName);
|
||||
|
||||
protected:
|
||||
virtual bool needsRenderUpdateFromEntity() const final { return needsRenderUpdateFromEntity(_entity); }
|
||||
virtual void onAddToScene(const EntityItemPointer& entity);
|
||||
|
@ -101,10 +104,6 @@ protected:
|
|||
return result;
|
||||
}
|
||||
|
||||
public slots:
|
||||
virtual void addMaterial(graphics::MaterialPointer material, const QString& parentMaterialName);
|
||||
virtual void removeMaterial(graphics::MaterialPointer material, const QString& parentMaterialName);
|
||||
|
||||
signals:
|
||||
void requestRenderUpdate();
|
||||
|
||||
|
@ -133,7 +132,7 @@ protected:
|
|||
// Only touched on the rendering thread
|
||||
bool _renderUpdateQueued{ false };
|
||||
|
||||
std::unordered_map<QString, graphics::MultiMaterial> _materials;
|
||||
std::unordered_map<std::string, graphics::MultiMaterial> _materials;
|
||||
std::mutex _materialsLock;
|
||||
|
||||
private:
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
|
||||
#include "RenderableMaterialEntityItem.h"
|
||||
|
||||
#include "RenderPipelines.h"
|
||||
|
||||
using namespace render;
|
||||
using namespace render::entities;
|
||||
|
||||
|
@ -250,7 +252,7 @@ void MaterialEntityRenderer::doRender(RenderArgs* args) {
|
|||
drawMaterial->setTextureTransforms(textureTransform);
|
||||
|
||||
// bind the material
|
||||
args->_shapePipeline->bindMaterial(drawMaterial, batch, args->_enableTexturing);
|
||||
RenderPipelines::bindMaterial(drawMaterial, batch, args->_enableTexturing);
|
||||
args->_details._materialSwitches++;
|
||||
|
||||
// Draw!
|
||||
|
|
|
@ -1467,14 +1467,14 @@ void ModelEntityRenderer::mapJoints(const TypedEntityPointer& entity, const QStr
|
|||
}
|
||||
}
|
||||
|
||||
void ModelEntityRenderer::addMaterial(graphics::MaterialPointer material, const QString& parentMaterialName) {
|
||||
void ModelEntityRenderer::addMaterial(graphics::MaterialLayer material, const std::string& parentMaterialName) {
|
||||
Parent::addMaterial(material, parentMaterialName);
|
||||
if (_model && _model->fetchRenderItemIDs().size() > 0) {
|
||||
_model->addMaterial(material, parentMaterialName);
|
||||
}
|
||||
}
|
||||
|
||||
void ModelEntityRenderer::removeMaterial(graphics::MaterialPointer material, const QString& parentMaterialName) {
|
||||
void ModelEntityRenderer::removeMaterial(graphics::MaterialPointer material, const std::string& parentMaterialName) {
|
||||
Parent::removeMaterial(material, parentMaterialName);
|
||||
if (_model && _model->fetchRenderItemIDs().size() > 0) {
|
||||
_model->removeMaterial(material, parentMaterialName);
|
||||
|
|
|
@ -143,9 +143,8 @@ class ModelEntityRenderer : public TypedEntityRenderer<RenderableModelEntityItem
|
|||
public:
|
||||
ModelEntityRenderer(const EntityItemPointer& entity);
|
||||
|
||||
public slots:
|
||||
void addMaterial(graphics::MaterialPointer material, const QString& parentMaterialName) override;
|
||||
void removeMaterial(graphics::MaterialPointer material, const QString& parentMaterialName) override;
|
||||
void addMaterial(graphics::MaterialLayer material, const std::string& parentMaterialName) override;
|
||||
void removeMaterial(graphics::MaterialPointer material, const std::string& parentMaterialName) override;
|
||||
|
||||
protected:
|
||||
virtual void removeFromScene(const ScenePointer& scene, Transaction& transaction) override;
|
||||
|
|
|
@ -79,7 +79,7 @@ void ShapeEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce
|
|||
|
||||
removeMaterial(_material, "0");
|
||||
_material = entity->getMaterial();
|
||||
addMaterial(_material, "0");
|
||||
addMaterial(graphics::MaterialLayer(_material, 0), "0");
|
||||
|
||||
_shape = entity->getShape();
|
||||
_position = entity->getWorldPosition();
|
||||
|
@ -127,7 +127,7 @@ void ShapeEntityRenderer::doRender(RenderArgs* args) {
|
|||
withReadLock([&] {
|
||||
geometryShape = geometryCache->getShapeForEntityShape(_shape);
|
||||
batch.setModelTransform(_renderTransform); // use a transform with scale, rotation, registration point and translation
|
||||
mat = _materials["0"].top();
|
||||
mat = _materials["0"].top().material;
|
||||
if (mat) {
|
||||
outColor = glm::vec4(mat->getAlbedo(), mat->getOpacity());
|
||||
if (_procedural.isReady()) {
|
||||
|
|
|
@ -2940,20 +2940,18 @@ void EntityItem::preDelete() {
|
|||
}
|
||||
}
|
||||
|
||||
void EntityItem::addMaterial(graphics::MaterialPointer material, const QString& parentMaterialName) {
|
||||
void EntityItem::addMaterial(graphics::MaterialLayer material, const std::string& parentMaterialName) {
|
||||
std::lock_guard<std::mutex> lock(_materialsLock);
|
||||
_materials[parentMaterialName].push(material);
|
||||
emit addMaterialToRenderItem(material, parentMaterialName);
|
||||
}
|
||||
|
||||
void EntityItem::removeMaterial(graphics::MaterialPointer material, const QString& parentMaterialName) {
|
||||
void EntityItem::removeMaterial(graphics::MaterialPointer material, const std::string& parentMaterialName) {
|
||||
std::lock_guard<std::mutex> lock(_materialsLock);
|
||||
_materials[parentMaterialName].remove(material);
|
||||
emit removeMaterialFromRenderItem(material, parentMaterialName);
|
||||
}
|
||||
|
||||
std::unordered_map<QString, graphics::MultiMaterial> EntityItem::getMaterials() {
|
||||
std::unordered_map<QString, graphics::MultiMaterial> toReturn;
|
||||
std::unordered_map<std::string, graphics::MultiMaterial> EntityItem::getMaterials() {
|
||||
std::unordered_map<std::string, graphics::MultiMaterial> toReturn;
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(_materialsLock);
|
||||
toReturn = _materials;
|
||||
|
|
|
@ -478,18 +478,15 @@ public:
|
|||
void setCauterized(bool value) { _cauterized = value; }
|
||||
bool getCauterized() const { return _cauterized; }
|
||||
|
||||
virtual void postAdd() {}
|
||||
virtual void preDelete();
|
||||
virtual void postParentFixup() {}
|
||||
|
||||
void addMaterial(graphics::MaterialPointer material, const QString& parentMaterialName);
|
||||
void removeMaterial(graphics::MaterialPointer material, const QString& parentMaterialName);
|
||||
std::unordered_map<QString, graphics::MultiMaterial> getMaterials();
|
||||
void addMaterial(graphics::MaterialLayer material, const std::string& parentMaterialName);
|
||||
void removeMaterial(graphics::MaterialPointer material, const std::string& parentMaterialName);
|
||||
std::unordered_map<std::string, graphics::MultiMaterial> getMaterials();
|
||||
|
||||
signals:
|
||||
void requestRenderUpdate();
|
||||
void addMaterialToRenderItem(graphics::MaterialPointer material, const QString& parentMaterialName);
|
||||
void removeMaterialFromRenderItem(graphics::MaterialPointer material, const QString& parentMaterialName);
|
||||
|
||||
protected:
|
||||
QHash<ChangeHandlerId, ChangeHandlerCallback> _changeHandlers;
|
||||
|
@ -644,7 +641,7 @@ protected:
|
|||
bool _cauterized { false }; // if true, don't draw because it would obscure 1st-person camera
|
||||
|
||||
private:
|
||||
std::unordered_map<QString, graphics::MultiMaterial> _materials;
|
||||
std::unordered_map<std::string, graphics::MultiMaterial> _materials;
|
||||
std::mutex _materialsLock;
|
||||
|
||||
};
|
||||
|
|
|
@ -2386,33 +2386,49 @@ QStringList EntityTree::getJointNames(const QUuid& entityID) const {
|
|||
return entity->getJointNames();
|
||||
}
|
||||
|
||||
std::function<bool(const QUuid&, graphics::MaterialPointer, const QString&)> EntityTree::_addMaterialToAvatarOperator = nullptr;
|
||||
std::function<bool(const QUuid&, graphics::MaterialPointer, const QString&)> EntityTree::_removeMaterialFromAvatarOperator = nullptr;
|
||||
std::function<bool(const QUuid&, graphics::MaterialPointer, const QString&)> EntityTree::_addMaterialToOverlayOperator = nullptr;
|
||||
std::function<bool(const QUuid&, graphics::MaterialPointer, const QString&)> EntityTree::_removeMaterialFromOverlayOperator = nullptr;
|
||||
std::function<bool(const QUuid&, graphics::MaterialLayer, const std::string&)> EntityTree::_addMaterialToEntityOperator = nullptr;
|
||||
std::function<bool(const QUuid&, graphics::MaterialPointer, const std::string&)> EntityTree::_removeMaterialFromEntityOperator = nullptr;
|
||||
std::function<bool(const QUuid&, graphics::MaterialLayer, const std::string&)> EntityTree::_addMaterialToAvatarOperator = nullptr;
|
||||
std::function<bool(const QUuid&, graphics::MaterialPointer, const std::string&)> EntityTree::_removeMaterialFromAvatarOperator = nullptr;
|
||||
std::function<bool(const QUuid&, graphics::MaterialLayer, const std::string&)> EntityTree::_addMaterialToOverlayOperator = nullptr;
|
||||
std::function<bool(const QUuid&, graphics::MaterialPointer, const std::string&)> EntityTree::_removeMaterialFromOverlayOperator = nullptr;
|
||||
|
||||
bool EntityTree::addMaterialToAvatar(const QUuid& avatarID, graphics::MaterialPointer material, const QString& parentMaterialName) {
|
||||
bool EntityTree::addMaterialToEntity(const QUuid& entityID, graphics::MaterialLayer material, const std::string& parentMaterialName) {
|
||||
if (_addMaterialToEntityOperator) {
|
||||
return _addMaterialToEntityOperator(entityID, material, parentMaterialName);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool EntityTree::removeMaterialFromEntity(const QUuid& entityID, graphics::MaterialPointer material, const std::string& parentMaterialName) {
|
||||
if (_removeMaterialFromEntityOperator) {
|
||||
return _removeMaterialFromEntityOperator(entityID, material, parentMaterialName);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool EntityTree::addMaterialToAvatar(const QUuid& avatarID, graphics::MaterialLayer material, const std::string& parentMaterialName) {
|
||||
if (_addMaterialToAvatarOperator) {
|
||||
return _addMaterialToAvatarOperator(avatarID, material, parentMaterialName);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool EntityTree::removeMaterialFromAvatar(const QUuid& avatarID, graphics::MaterialPointer material, const QString& parentMaterialName) {
|
||||
bool EntityTree::removeMaterialFromAvatar(const QUuid& avatarID, graphics::MaterialPointer material, const std::string& parentMaterialName) {
|
||||
if (_removeMaterialFromAvatarOperator) {
|
||||
return _removeMaterialFromAvatarOperator(avatarID, material, parentMaterialName);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool EntityTree::addMaterialToOverlay(const QUuid& overlayID, graphics::MaterialPointer material, const QString& parentMaterialName) {
|
||||
bool EntityTree::addMaterialToOverlay(const QUuid& overlayID, graphics::MaterialLayer material, const std::string& parentMaterialName) {
|
||||
if (_addMaterialToOverlayOperator) {
|
||||
return _addMaterialToOverlayOperator(overlayID, material, parentMaterialName);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool EntityTree::removeMaterialFromOverlay(const QUuid& overlayID, graphics::MaterialPointer material, const QString& parentMaterialName) {
|
||||
bool EntityTree::removeMaterialFromOverlay(const QUuid& overlayID, graphics::MaterialPointer material, const std::string& parentMaterialName) {
|
||||
if (_removeMaterialFromOverlayOperator) {
|
||||
return _removeMaterialFromOverlayOperator(overlayID, material, parentMaterialName);
|
||||
}
|
||||
|
|
|
@ -280,15 +280,20 @@ public:
|
|||
|
||||
void setMyAvatar(std::shared_ptr<AvatarData> myAvatar) { _myAvatar = myAvatar; }
|
||||
|
||||
static void setAddMaterialToAvatarOperator(std::function<bool(const QUuid&, graphics::MaterialPointer, const QString&)> addMaterialToAvatarOperator) { _addMaterialToAvatarOperator = addMaterialToAvatarOperator; }
|
||||
static void setRemoveMaterialFromAvatarOperator(std::function<bool(const QUuid&, graphics::MaterialPointer, const QString&)> removeMaterialFromAvatarOperator) { _removeMaterialFromAvatarOperator = removeMaterialFromAvatarOperator; }
|
||||
static bool addMaterialToAvatar(const QUuid& avatarID, graphics::MaterialPointer material, const QString& parentMaterialName);
|
||||
static bool removeMaterialFromAvatar(const QUuid& avatarID, graphics::MaterialPointer material, const QString& parentMaterialName);
|
||||
static void setAddMaterialToEntityOperator(std::function<bool(const QUuid&, graphics::MaterialLayer, const std::string&)> addMaterialToEntityOperator) { _addMaterialToEntityOperator = addMaterialToEntityOperator; }
|
||||
static void setRemoveMaterialFromEntityOperator(std::function<bool(const QUuid&, graphics::MaterialPointer, const std::string&)> removeMaterialFromEntityOperator) { _removeMaterialFromEntityOperator = removeMaterialFromEntityOperator; }
|
||||
static bool addMaterialToEntity(const QUuid& entityID, graphics::MaterialLayer material, const std::string& parentMaterialName);
|
||||
static bool removeMaterialFromEntity(const QUuid& entityID, graphics::MaterialPointer material, const std::string& parentMaterialName);
|
||||
|
||||
static void setAddMaterialToOverlayOperator(std::function<bool(const QUuid&, graphics::MaterialPointer, const QString&)> addMaterialToOverlayOperator) { _addMaterialToOverlayOperator = addMaterialToOverlayOperator; }
|
||||
static void setRemoveMaterialFromOverlayOperator(std::function<bool(const QUuid&, graphics::MaterialPointer, const QString&)> removeMaterialFromOverlayOperator) { _removeMaterialFromOverlayOperator = removeMaterialFromOverlayOperator; }
|
||||
static bool addMaterialToOverlay(const QUuid& overlayID, graphics::MaterialPointer material, const QString& parentMaterialName);
|
||||
static bool removeMaterialFromOverlay(const QUuid& overlayID, graphics::MaterialPointer material, const QString& parentMaterialName);
|
||||
static void setAddMaterialToAvatarOperator(std::function<bool(const QUuid&, graphics::MaterialLayer, const std::string&)> addMaterialToAvatarOperator) { _addMaterialToAvatarOperator = addMaterialToAvatarOperator; }
|
||||
static void setRemoveMaterialFromAvatarOperator(std::function<bool(const QUuid&, graphics::MaterialPointer, const std::string&)> removeMaterialFromAvatarOperator) { _removeMaterialFromAvatarOperator = removeMaterialFromAvatarOperator; }
|
||||
static bool addMaterialToAvatar(const QUuid& avatarID, graphics::MaterialLayer material, const std::string& parentMaterialName);
|
||||
static bool removeMaterialFromAvatar(const QUuid& avatarID, graphics::MaterialPointer material, const std::string& parentMaterialName);
|
||||
|
||||
static void setAddMaterialToOverlayOperator(std::function<bool(const QUuid&, graphics::MaterialLayer, const std::string&)> addMaterialToOverlayOperator) { _addMaterialToOverlayOperator = addMaterialToOverlayOperator; }
|
||||
static void setRemoveMaterialFromOverlayOperator(std::function<bool(const QUuid&, graphics::MaterialPointer, const std::string&)> removeMaterialFromOverlayOperator) { _removeMaterialFromOverlayOperator = removeMaterialFromOverlayOperator; }
|
||||
static bool addMaterialToOverlay(const QUuid& overlayID, graphics::MaterialLayer material, const std::string& parentMaterialName);
|
||||
static bool removeMaterialFromOverlay(const QUuid& overlayID, graphics::MaterialPointer material, const std::string& parentMaterialName);
|
||||
|
||||
signals:
|
||||
void deletingEntity(const EntityItemID& entityID);
|
||||
|
@ -398,10 +403,12 @@ private:
|
|||
|
||||
std::shared_ptr<AvatarData> _myAvatar{ nullptr };
|
||||
|
||||
static std::function<bool(const QUuid&, graphics::MaterialPointer, const QString&)> _addMaterialToAvatarOperator;
|
||||
static std::function<bool(const QUuid&, graphics::MaterialPointer, const QString&)> _removeMaterialFromAvatarOperator;
|
||||
static std::function<bool(const QUuid&, graphics::MaterialPointer, const QString&)> _addMaterialToOverlayOperator;
|
||||
static std::function<bool(const QUuid&, graphics::MaterialPointer, const QString&)> _removeMaterialFromOverlayOperator;
|
||||
static std::function<bool(const QUuid&, graphics::MaterialLayer, const std::string&)> _addMaterialToEntityOperator;
|
||||
static std::function<bool(const QUuid&, graphics::MaterialPointer, const std::string&)> _removeMaterialFromEntityOperator;
|
||||
static std::function<bool(const QUuid&, graphics::MaterialLayer, const std::string&)> _addMaterialToAvatarOperator;
|
||||
static std::function<bool(const QUuid&, graphics::MaterialPointer, const std::string&)> _removeMaterialFromAvatarOperator;
|
||||
static std::function<bool(const QUuid&, graphics::MaterialLayer, const std::string&)> _addMaterialToOverlayOperator;
|
||||
static std::function<bool(const QUuid&, graphics::MaterialPointer, const std::string&)> _removeMaterialFromOverlayOperator;
|
||||
};
|
||||
|
||||
#endif // hifi_EntityTree_h
|
||||
|
|
|
@ -940,7 +940,6 @@ void EntityTreeElement::addEntityItem(EntityItemPointer entity) {
|
|||
});
|
||||
bumpChangedContent();
|
||||
entity->_element = getThisPointer();
|
||||
entity->postAdd();
|
||||
}
|
||||
|
||||
// will average a "common reduced LOD view" from the the child elements...
|
||||
|
|
|
@ -27,6 +27,10 @@ MaterialEntityItem::MaterialEntityItem(const EntityItemID& entityItemID) : Entit
|
|||
_type = EntityTypes::Material;
|
||||
}
|
||||
|
||||
MaterialEntityItem::~MaterialEntityItem() {
|
||||
removeMaterial();
|
||||
}
|
||||
|
||||
EntityItemProperties MaterialEntityItem::getProperties(EntityPropertyFlags desiredProperties) const {
|
||||
EntityItemProperties properties = EntityItem::getProperties(desiredProperties); // get the properties from our base class
|
||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(materialURL, getMaterialURL);
|
||||
|
@ -119,7 +123,7 @@ void MaterialEntityItem::debugDump() const {
|
|||
qCDebug(entities) << " MATERIAL EntityItem id:" << getEntityItemID() << "---------------------------------------------";
|
||||
qCDebug(entities) << " name:" << _name;
|
||||
qCDebug(entities) << " material url:" << _materialURL;
|
||||
qCDebug(entities) << " current material name:" << _currentMaterialName;
|
||||
qCDebug(entities) << " current material name:" << _currentMaterialName.c_str();
|
||||
qCDebug(entities) << " material mapping mode:" << _materialMappingMode;
|
||||
qCDebug(entities) << " priority:" << _priority;
|
||||
qCDebug(entities) << " parent material name:" << _parentMaterialName;
|
||||
|
@ -139,7 +143,7 @@ void MaterialEntityItem::setUnscaledDimensions(const glm::vec3& value) {
|
|||
std::shared_ptr<NetworkMaterial> MaterialEntityItem::getMaterial() const {
|
||||
auto material = _parsedMaterials.networkMaterials.find(_currentMaterialName);
|
||||
if (material != _parsedMaterials.networkMaterials.end()) {
|
||||
return material.value();
|
||||
return material->second;
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -153,7 +157,7 @@ void MaterialEntityItem::setMaterialURL(const QString& materialURLString, bool u
|
|||
|
||||
if (materialURLString.contains("?")) {
|
||||
auto split = materialURLString.split("?");
|
||||
_currentMaterialName = split.last();
|
||||
_currentMaterialName = split.last().toStdString();
|
||||
}
|
||||
|
||||
if (usingUserData) {
|
||||
|
@ -183,9 +187,8 @@ void MaterialEntityItem::setMaterialURL(const QString& materialURLString, bool u
|
|||
}
|
||||
}
|
||||
|
||||
void MaterialEntityItem::setCurrentMaterialName(const QString& currentMaterialName) {
|
||||
auto material = _parsedMaterials.networkMaterials.find(currentMaterialName);
|
||||
if (material != _parsedMaterials.networkMaterials.end()) {
|
||||
void MaterialEntityItem::setCurrentMaterialName(const std::string& currentMaterialName) {
|
||||
if (_parsedMaterials.networkMaterials.find(currentMaterialName) != _parsedMaterials.networkMaterials.end()) {
|
||||
_currentMaterialName = currentMaterialName;
|
||||
} else if (_parsedMaterials.names.size() > 0) {
|
||||
_currentMaterialName = _parsedMaterials.names[0];
|
||||
|
@ -274,20 +277,15 @@ void MaterialEntityItem::removeMaterial() {
|
|||
}
|
||||
|
||||
// Our parent could be an entity, an avatar, or an overlay
|
||||
EntityTreePointer tree = getTree();
|
||||
if (tree) {
|
||||
EntityItemPointer entity = tree->findEntityByEntityItemID(parentID);
|
||||
if (entity) {
|
||||
entity->removeMaterial(material, getParentMaterialName());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (EntityTree::removeMaterialFromAvatar(parentID, material, getParentMaterialName())) {
|
||||
if (EntityTree::removeMaterialFromEntity(parentID, material, getParentMaterialName().toStdString())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (EntityTree::removeMaterialFromOverlay(parentID, material, getParentMaterialName())) {
|
||||
if (EntityTree::removeMaterialFromAvatar(parentID, material, getParentMaterialName().toStdString())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (EntityTree::removeMaterialFromOverlay(parentID, material, getParentMaterialName().toStdString())) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -306,23 +304,19 @@ void MaterialEntityItem::applyMaterial() {
|
|||
textureTransform.setRotation(glm::vec3(0, 0, glm::radians(_materialMappingRot)));
|
||||
textureTransform.setScale(glm::vec3(_materialMappingScale, 1));
|
||||
material->setTextureTransforms(textureTransform);
|
||||
material->setPriority(getPriority());
|
||||
|
||||
graphics::MaterialLayer materialLayer = graphics::MaterialLayer(material, getPriority());
|
||||
|
||||
// Our parent could be an entity, an avatar, or an overlay
|
||||
EntityTreePointer tree = getTree();
|
||||
if (tree) {
|
||||
EntityItemPointer entity = tree->findEntityByEntityItemID(parentID);
|
||||
if (entity) {
|
||||
entity->addMaterial(material, getParentMaterialName());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (EntityTree::addMaterialToAvatar(parentID, material, getParentMaterialName())) {
|
||||
if (EntityTree::addMaterialToEntity(parentID, materialLayer, getParentMaterialName().toStdString())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (EntityTree::addMaterialToOverlay(parentID, material, getParentMaterialName())) {
|
||||
if (EntityTree::addMaterialToAvatar(parentID, materialLayer, getParentMaterialName().toStdString())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (EntityTree::addMaterialToOverlay(parentID, materialLayer, getParentMaterialName().toStdString())) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -330,20 +324,6 @@ void MaterialEntityItem::applyMaterial() {
|
|||
_retryApply = true;
|
||||
}
|
||||
|
||||
void MaterialEntityItem::postAdd() {
|
||||
// postAdd is called every time we are added to a new octree cell, but we only need to update the material the first time
|
||||
if (!_hasBeenAddedToOctree) {
|
||||
removeMaterial();
|
||||
applyMaterial();
|
||||
_hasBeenAddedToOctree = true;
|
||||
}
|
||||
}
|
||||
|
||||
void MaterialEntityItem::preDelete() {
|
||||
EntityItem::preDelete();
|
||||
removeMaterial();
|
||||
}
|
||||
|
||||
void MaterialEntityItem::postParentFixup() {
|
||||
removeMaterial();
|
||||
applyMaterial();
|
||||
|
|
|
@ -21,6 +21,7 @@ public:
|
|||
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
|
||||
|
||||
MaterialEntityItem(const EntityItemID& entityItemID);
|
||||
~MaterialEntityItem();
|
||||
|
||||
ALLOW_INSTANTIATION // This class can be instantiated
|
||||
|
||||
|
@ -55,8 +56,7 @@ public:
|
|||
QString getMaterialURL() const { return _materialURL; }
|
||||
void setMaterialURL(const QString& materialURLString, bool userDataChanged = false);
|
||||
|
||||
QString getCurrentMaterialName() const { return _currentMaterialName; }
|
||||
void setCurrentMaterialName(const QString& currentMaterialName);
|
||||
void setCurrentMaterialName(const std::string& currentMaterialName);
|
||||
|
||||
MaterialMappingMode getMaterialMappingMode() const { return _materialMappingMode; }
|
||||
void setMaterialMappingMode(MaterialMappingMode mode) { _materialMappingMode = mode; }
|
||||
|
@ -84,8 +84,6 @@ public:
|
|||
void applyMaterial();
|
||||
void removeMaterial();
|
||||
|
||||
void postAdd() override;
|
||||
void preDelete() override;
|
||||
void postParentFixup() override;
|
||||
|
||||
private:
|
||||
|
@ -122,10 +120,9 @@ private:
|
|||
|
||||
NetworkMaterialResourcePointer _networkMaterial;
|
||||
NetworkMaterialResource::ParsedMaterials _parsedMaterials;
|
||||
QString _currentMaterialName;
|
||||
std::string _currentMaterialName;
|
||||
|
||||
bool _retryApply { false };
|
||||
bool _hasBeenAddedToOctree { false };
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
using namespace graphics;
|
||||
using namespace gpu;
|
||||
|
||||
int materialPointerMetaID = qRegisterMetaType<MaterialPointer>("graphics::MaterialPointer");
|
||||
|
||||
Material::Material() :
|
||||
_key(0),
|
||||
_schemaBuffer(),
|
||||
|
|
|
@ -354,17 +354,14 @@ public:
|
|||
size_t getTextureSize() const { calculateMaterialInfo(); return _textureSize; }
|
||||
bool hasTextureInfo() const { return _hasCalculatedTextureInfo; }
|
||||
|
||||
void setPriority(quint16 priority) { _priority = priority; }
|
||||
quint16 getPriority() { return _priority; }
|
||||
|
||||
void setTextureTransforms(const Transform& transform);
|
||||
|
||||
const QString& getName() { return _name; }
|
||||
const std::string& getName() { return _name; }
|
||||
|
||||
void setModel(const QString& model) { _model = model; }
|
||||
void setModel(const std::string& model) { _model = model; }
|
||||
|
||||
protected:
|
||||
QString _name { "" };
|
||||
std::string _name { "" };
|
||||
|
||||
private:
|
||||
mutable MaterialKey _key;
|
||||
|
@ -379,24 +376,36 @@ private:
|
|||
mutable bool _hasCalculatedTextureInfo { false };
|
||||
bool calculateMaterialInfo() const;
|
||||
|
||||
quint16 _priority { 0 };
|
||||
|
||||
QString _model { "hifi_pbr" };
|
||||
std::string _model { "hifi_pbr" };
|
||||
|
||||
};
|
||||
typedef std::shared_ptr< Material > MaterialPointer;
|
||||
|
||||
class MaterialCompare {
|
||||
class MaterialLayer {
|
||||
public:
|
||||
bool operator() (MaterialPointer left, MaterialPointer right) {
|
||||
return left->getPriority() < right->getPriority();
|
||||
MaterialLayer(MaterialPointer material, quint16 priority) : material(material), priority(priority) {}
|
||||
|
||||
MaterialPointer material { nullptr };
|
||||
quint16 priority { 0 };
|
||||
};
|
||||
|
||||
class MaterialLayerCompare {
|
||||
public:
|
||||
bool operator() (MaterialLayer left, MaterialLayer right) {
|
||||
return left.priority < right.priority;
|
||||
}
|
||||
};
|
||||
|
||||
class MultiMaterial : public std::priority_queue<MaterialPointer, std::vector<MaterialPointer>, MaterialCompare> {
|
||||
class MultiMaterial : public std::priority_queue<MaterialLayer, std::vector<MaterialLayer>, MaterialLayerCompare> {
|
||||
public:
|
||||
bool remove(const MaterialPointer& value) {
|
||||
auto it = std::find(c.begin(), c.end(), value);
|
||||
auto it = c.begin();
|
||||
while (it != c.end()) {
|
||||
if (it->material == value) {
|
||||
break;
|
||||
}
|
||||
it++;
|
||||
}
|
||||
if (it != c.end()) {
|
||||
c.erase(it);
|
||||
std::make_heap(c.begin(), c.end(), comp);
|
||||
|
@ -409,6 +418,4 @@ public:
|
|||
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(graphics::MaterialPointer)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -73,22 +73,22 @@ NetworkMaterialResource::ParsedMaterials NetworkMaterialResource::parseJSONMater
|
|||
}
|
||||
}
|
||||
|
||||
return toReturn;;
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
std::pair<QString, std::shared_ptr<NetworkMaterial>> NetworkMaterialResource::parseJSONMaterial(const QJsonObject& materialJSON) {
|
||||
QString name = "";
|
||||
std::pair<std::string, std::shared_ptr<NetworkMaterial>> NetworkMaterialResource::parseJSONMaterial(const QJsonObject& materialJSON) {
|
||||
std::string name = "";
|
||||
std::shared_ptr<NetworkMaterial> material = std::make_shared<NetworkMaterial>();
|
||||
for (auto& key : materialJSON.keys()) {
|
||||
if (key == "name") {
|
||||
auto nameJSON = materialJSON.value(key);
|
||||
if (nameJSON.isString()) {
|
||||
name = nameJSON.toString();
|
||||
name = nameJSON.toString().toStdString();
|
||||
}
|
||||
} else if (key == "model") {
|
||||
auto modelJSON = materialJSON.value(key);
|
||||
if (modelJSON.isString()) {
|
||||
material->setModel(modelJSON.toString());
|
||||
material->setModel(modelJSON.toString().toStdString());
|
||||
}
|
||||
} else if (key == "emissive") {
|
||||
glm::vec3 color;
|
||||
|
@ -191,7 +191,7 @@ std::pair<QString, std::shared_ptr<NetworkMaterial>> NetworkMaterialResource::pa
|
|||
}
|
||||
}
|
||||
}
|
||||
return std::pair<QString, std::shared_ptr<NetworkMaterial>>(name, material);
|
||||
return std::pair<std::string, std::shared_ptr<NetworkMaterial>>(name, material);
|
||||
}
|
||||
|
||||
MaterialCache& MaterialCache::instance() {
|
||||
|
|
|
@ -24,8 +24,8 @@ public:
|
|||
|
||||
typedef struct ParsedMaterials {
|
||||
uint version { 1 };
|
||||
std::vector<QString> names;
|
||||
QHash<QString, std::shared_ptr<NetworkMaterial>> networkMaterials;
|
||||
std::vector<std::string> names;
|
||||
std::unordered_map<std::string, std::shared_ptr<NetworkMaterial>> networkMaterials;
|
||||
|
||||
void reset() {
|
||||
version = 1;
|
||||
|
@ -38,7 +38,7 @@ public:
|
|||
ParsedMaterials parsedMaterials;
|
||||
|
||||
static ParsedMaterials parseJSONMaterials(const QJsonDocument& materialJSON);
|
||||
static std::pair<QString, std::shared_ptr<NetworkMaterial>> parseJSONMaterial(const QJsonObject& materialJSON);
|
||||
static std::pair<std::string, std::shared_ptr<NetworkMaterial>> parseJSONMaterial(const QJsonObject& materialJSON);
|
||||
|
||||
private:
|
||||
static bool parseJSONColor(const QJsonValue& array, glm::vec3& color, bool& isSRGB);
|
||||
|
|
|
@ -619,7 +619,7 @@ NetworkMaterial::NetworkMaterial(const FBXMaterial& material, const QUrl& textur
|
|||
graphics::Material(*material._material),
|
||||
_textures(MapChannel::NUM_MAP_CHANNELS)
|
||||
{
|
||||
_name = material.name;
|
||||
_name = material.name.toStdString();
|
||||
if (!material.albedoTexture.filename.isEmpty()) {
|
||||
auto map = fetchTextureMap(textureBaseUrl, material.albedoTexture, image::TextureUsage::ALBEDO_TEXTURE, MapChannel::ALBEDO_MAP);
|
||||
_albedoTransform = material.albedoTexture.transform;
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
#include "DeferredLightingEffect.h"
|
||||
|
||||
#include "RenderPipelines.h"
|
||||
|
||||
using namespace render;
|
||||
|
||||
namespace render {
|
||||
|
@ -47,7 +49,7 @@ template <> void payloadRender(const MeshPartPayload::Pointer& payload, RenderAr
|
|||
|
||||
MeshPartPayload::MeshPartPayload(const std::shared_ptr<const graphics::Mesh>& mesh, int partIndex, graphics::MaterialPointer material) {
|
||||
updateMeshPart(mesh, partIndex);
|
||||
addMaterial(material);
|
||||
addMaterial(graphics::MaterialLayer(material, 0));
|
||||
}
|
||||
|
||||
void MeshPartPayload::updateMeshPart(const std::shared_ptr<const graphics::Mesh>& drawMesh, int partIndex) {
|
||||
|
@ -67,7 +69,7 @@ void MeshPartPayload::updateTransform(const Transform& transform, const Transfor
|
|||
_worldBound.transform(_drawTransform);
|
||||
}
|
||||
|
||||
void MeshPartPayload::addMaterial(graphics::MaterialPointer material) {
|
||||
void MeshPartPayload::addMaterial(graphics::MaterialLayer material) {
|
||||
_drawMaterials.push(material);
|
||||
}
|
||||
|
||||
|
@ -89,8 +91,8 @@ void MeshPartPayload::updateKey(bool isVisible, bool isLayered, uint8_t tagBits)
|
|||
builder.withLayered();
|
||||
}
|
||||
|
||||
if (_drawMaterials.top()) {
|
||||
auto matKey = _drawMaterials.top()->getKey();
|
||||
if (_drawMaterials.top().material) {
|
||||
auto matKey = _drawMaterials.top().material->getKey();
|
||||
if (matKey.isTranslucent()) {
|
||||
builder.withTransparent();
|
||||
}
|
||||
|
@ -109,8 +111,8 @@ Item::Bound MeshPartPayload::getBound() const {
|
|||
|
||||
ShapeKey MeshPartPayload::getShapeKey() const {
|
||||
graphics::MaterialKey drawMaterialKey;
|
||||
if (_drawMaterials.top()) {
|
||||
drawMaterialKey = _drawMaterials.top()->getKey();
|
||||
if (_drawMaterials.top().material) {
|
||||
drawMaterialKey = _drawMaterials.top().material->getKey();
|
||||
}
|
||||
|
||||
ShapeKey::Builder builder;
|
||||
|
@ -164,7 +166,7 @@ void MeshPartPayload::render(RenderArgs* args) {
|
|||
bindMesh(batch);
|
||||
|
||||
// apply material properties
|
||||
args->_shapePipeline->bindMaterial(_drawMaterials.top(), batch, args->_enableTexturing);
|
||||
RenderPipelines::bindMaterial(_drawMaterials.top().material, batch, args->_enableTexturing);
|
||||
args->_details._materialSwitches++;
|
||||
|
||||
// Draw!
|
||||
|
@ -256,7 +258,7 @@ void ModelMeshPartPayload::initCache(const ModelPointer& model) {
|
|||
|
||||
auto networkMaterial = model->getGeometry()->getShapeMaterial(_shapeID);
|
||||
if (networkMaterial) {
|
||||
addMaterial(networkMaterial);
|
||||
addMaterial(graphics::MaterialLayer(networkMaterial, 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -302,8 +304,8 @@ void ModelMeshPartPayload::updateKey(bool isVisible, bool isLayered, uint8_t tag
|
|||
builder.withDeformed();
|
||||
}
|
||||
|
||||
if (_drawMaterials.top()) {
|
||||
auto matKey = _drawMaterials.top()->getKey();
|
||||
if (_drawMaterials.top().material) {
|
||||
auto matKey = _drawMaterials.top().material->getKey();
|
||||
if (matKey.isTranslucent()) {
|
||||
builder.withTransparent();
|
||||
}
|
||||
|
@ -333,8 +335,8 @@ void ModelMeshPartPayload::setShapeKey(bool invalidateShapeKey, bool isWireframe
|
|||
}
|
||||
|
||||
graphics::MaterialKey drawMaterialKey;
|
||||
if (_drawMaterials.top()) {
|
||||
drawMaterialKey = _drawMaterials.top()->getKey();
|
||||
if (_drawMaterials.top().material) {
|
||||
drawMaterialKey = _drawMaterials.top().material->getKey();
|
||||
}
|
||||
|
||||
bool isTranslucent = drawMaterialKey.isTranslucent();
|
||||
|
@ -415,7 +417,7 @@ void ModelMeshPartPayload::render(RenderArgs* args) {
|
|||
bindMesh(batch);
|
||||
|
||||
// apply material properties
|
||||
args->_shapePipeline->bindMaterial(_drawMaterials.top(), batch, args->_enableTexturing);
|
||||
RenderPipelines::bindMaterial(_drawMaterials.top().material, batch, args->_enableTexturing);
|
||||
args->_details._materialSwitches++;
|
||||
|
||||
// Draw!
|
||||
|
|
|
@ -65,11 +65,11 @@ public:
|
|||
graphics::Mesh::Part _drawPart;
|
||||
|
||||
size_t getVerticesCount() const { return _drawMesh ? _drawMesh->getNumVertices() : 0; }
|
||||
size_t getMaterialTextureSize() { return _drawMaterials.top() ? _drawMaterials.top()->getTextureSize() : 0; }
|
||||
int getMaterialTextureCount() { return _drawMaterials.top() ? _drawMaterials.top()->getTextureCount() : 0; }
|
||||
bool hasTextureInfo() const { return _drawMaterials.top() ? _drawMaterials.top()->hasTextureInfo() : false; }
|
||||
size_t getMaterialTextureSize() { return _drawMaterials.top().material ? _drawMaterials.top().material->getTextureSize() : 0; }
|
||||
int getMaterialTextureCount() { return _drawMaterials.top().material ? _drawMaterials.top().material->getTextureCount() : 0; }
|
||||
bool hasTextureInfo() const { return _drawMaterials.top().material ? _drawMaterials.top().material->hasTextureInfo() : false; }
|
||||
|
||||
void addMaterial(graphics::MaterialPointer material);
|
||||
void addMaterial(graphics::MaterialLayer material);
|
||||
void removeMaterial(graphics::MaterialPointer material);
|
||||
|
||||
protected:
|
||||
|
|
|
@ -1535,7 +1535,7 @@ std::vector<unsigned int> Model::getMeshIDsFromMaterialID(QString parentMaterial
|
|||
if (parentMaterialName.startsWith(MATERIAL_NAME_PREFIX)) {
|
||||
parentMaterialName.replace(0, MATERIAL_NAME_PREFIX.size(), QString(""));
|
||||
for (unsigned int i = 0; i < (unsigned int)_modelMeshMaterialNames.size(); i++) {
|
||||
if (_modelMeshMaterialNames[i] == parentMaterialName) {
|
||||
if (_modelMeshMaterialNames[i] == parentMaterialName.toStdString()) {
|
||||
toReturn.push_back(i);
|
||||
}
|
||||
}
|
||||
|
@ -1548,8 +1548,8 @@ std::vector<unsigned int> Model::getMeshIDsFromMaterialID(QString parentMaterial
|
|||
return toReturn;
|
||||
}
|
||||
|
||||
void Model::addMaterial(graphics::MaterialPointer material, const QString& parentMaterialName) {
|
||||
std::vector<unsigned int> shapeIDs = getMeshIDsFromMaterialID(parentMaterialName);
|
||||
void Model::addMaterial(graphics::MaterialLayer material, const std::string& parentMaterialName) {
|
||||
std::vector<unsigned int> shapeIDs = getMeshIDsFromMaterialID(QString(parentMaterialName.c_str()));
|
||||
render::Transaction transaction;
|
||||
for (auto shapeID : shapeIDs) {
|
||||
if (shapeID < _modelMeshRenderItemIDs.size()) {
|
||||
|
@ -1573,8 +1573,8 @@ void Model::addMaterial(graphics::MaterialPointer material, const QString& paren
|
|||
AbstractViewStateInterface::instance()->getMain3DScene()->enqueueTransaction(transaction);
|
||||
}
|
||||
|
||||
void Model::removeMaterial(graphics::MaterialPointer material, const QString& parentMaterialName) {
|
||||
std::vector<unsigned int> shapeIDs = getMeshIDsFromMaterialID(parentMaterialName);
|
||||
void Model::removeMaterial(graphics::MaterialPointer material, const std::string& parentMaterialName) {
|
||||
std::vector<unsigned int> shapeIDs = getMeshIDsFromMaterialID(QString(parentMaterialName.c_str()));
|
||||
render::Transaction transaction;
|
||||
for (auto shapeID : shapeIDs) {
|
||||
if (shapeID < _modelMeshRenderItemIDs.size()) {
|
||||
|
|
|
@ -318,8 +318,8 @@ public:
|
|||
|
||||
void scaleToFit();
|
||||
|
||||
void addMaterial(graphics::MaterialPointer material, const QString& parentMaterialName);
|
||||
void removeMaterial(graphics::MaterialPointer material, const QString& parentMaterialName);
|
||||
void addMaterial(graphics::MaterialLayer material, const std::string& parentMaterialName);
|
||||
void removeMaterial(graphics::MaterialPointer material, const std::string& parentMaterialName);
|
||||
|
||||
public slots:
|
||||
void loadURLFinished(bool success);
|
||||
|
@ -438,7 +438,7 @@ protected:
|
|||
render::ItemIDs _modelMeshRenderItemIDs;
|
||||
using ShapeInfo = struct { int meshIndex; };
|
||||
std::vector<ShapeInfo> _modelMeshRenderItemShapes;
|
||||
std::vector<QString> _modelMeshMaterialNames;
|
||||
std::vector<std::string> _modelMeshMaterialNames;
|
||||
|
||||
bool _addedToScene { false }; // has been added to scene
|
||||
bool _needsFixupInScene { true }; // needs to be removed/re-added to scene
|
||||
|
|
|
@ -618,3 +618,125 @@ void initZPassPipelines(ShapePlumber& shapePlumber, gpu::StatePointer state) {
|
|||
ShapeKey::Filter::Builder().withSkinned().withFade(),
|
||||
skinFadeProgram, state);
|
||||
}
|
||||
|
||||
#include "RenderPipelines.h"
|
||||
#include <model-networking/TextureCache.h>
|
||||
|
||||
void RenderPipelines::bindMaterial(graphics::MaterialPointer material, gpu::Batch& batch, bool enableTextures) {
|
||||
if (!material) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto textureCache = DependencyManager::get<TextureCache>();
|
||||
|
||||
batch.setUniformBuffer(ShapePipeline::Slot::BUFFER::MATERIAL, material->getSchemaBuffer());
|
||||
batch.setUniformBuffer(ShapePipeline::Slot::BUFFER::TEXMAPARRAY, material->getTexMapArrayBuffer());
|
||||
|
||||
const auto& materialKey = material->getKey();
|
||||
const auto& textureMaps = material->getTextureMaps();
|
||||
|
||||
int numUnlit = 0;
|
||||
if (materialKey.isUnlit()) {
|
||||
numUnlit++;
|
||||
}
|
||||
|
||||
if (!enableTextures) {
|
||||
batch.setResourceTexture(ShapePipeline::Slot::ALBEDO, textureCache->getWhiteTexture());
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::ROUGHNESS, textureCache->getWhiteTexture());
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::NORMAL, textureCache->getBlueTexture());
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::METALLIC, textureCache->getBlackTexture());
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::OCCLUSION, textureCache->getWhiteTexture());
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::SCATTERING, textureCache->getWhiteTexture());
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::EMISSIVE_LIGHTMAP, textureCache->getBlackTexture());
|
||||
return;
|
||||
}
|
||||
|
||||
// Albedo
|
||||
if (materialKey.isAlbedoMap()) {
|
||||
auto itr = textureMaps.find(graphics::MaterialKey::ALBEDO_MAP);
|
||||
if (itr != textureMaps.end() && itr->second->isDefined()) {
|
||||
batch.setResourceTexture(ShapePipeline::Slot::ALBEDO, itr->second->getTextureView());
|
||||
} else {
|
||||
batch.setResourceTexture(ShapePipeline::Slot::ALBEDO, textureCache->getGrayTexture());
|
||||
}
|
||||
}
|
||||
|
||||
// Roughness map
|
||||
if (materialKey.isRoughnessMap()) {
|
||||
auto itr = textureMaps.find(graphics::MaterialKey::ROUGHNESS_MAP);
|
||||
if (itr != textureMaps.end() && itr->second->isDefined()) {
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::ROUGHNESS, itr->second->getTextureView());
|
||||
|
||||
// texcoord are assumed to be the same has albedo
|
||||
} else {
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::ROUGHNESS, textureCache->getWhiteTexture());
|
||||
}
|
||||
}
|
||||
|
||||
// Normal map
|
||||
if (materialKey.isNormalMap()) {
|
||||
auto itr = textureMaps.find(graphics::MaterialKey::NORMAL_MAP);
|
||||
if (itr != textureMaps.end() && itr->second->isDefined()) {
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::NORMAL, itr->second->getTextureView());
|
||||
|
||||
// texcoord are assumed to be the same has albedo
|
||||
} else {
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::NORMAL, textureCache->getBlueTexture());
|
||||
}
|
||||
}
|
||||
|
||||
// Metallic map
|
||||
if (materialKey.isMetallicMap()) {
|
||||
auto itr = textureMaps.find(graphics::MaterialKey::METALLIC_MAP);
|
||||
if (itr != textureMaps.end() && itr->second->isDefined()) {
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::METALLIC, itr->second->getTextureView());
|
||||
|
||||
// texcoord are assumed to be the same has albedo
|
||||
} else {
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::METALLIC, textureCache->getBlackTexture());
|
||||
}
|
||||
}
|
||||
|
||||
// Occlusion map
|
||||
if (materialKey.isOcclusionMap()) {
|
||||
auto itr = textureMaps.find(graphics::MaterialKey::OCCLUSION_MAP);
|
||||
if (itr != textureMaps.end() && itr->second->isDefined()) {
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::OCCLUSION, itr->second->getTextureView());
|
||||
|
||||
// texcoord are assumed to be the same has albedo
|
||||
} else {
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::OCCLUSION, textureCache->getWhiteTexture());
|
||||
}
|
||||
}
|
||||
|
||||
// Scattering map
|
||||
if (materialKey.isScatteringMap()) {
|
||||
auto itr = textureMaps.find(graphics::MaterialKey::SCATTERING_MAP);
|
||||
if (itr != textureMaps.end() && itr->second->isDefined()) {
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::SCATTERING, itr->second->getTextureView());
|
||||
|
||||
// texcoord are assumed to be the same has albedo
|
||||
} else {
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::SCATTERING, textureCache->getWhiteTexture());
|
||||
}
|
||||
}
|
||||
|
||||
// Emissive / Lightmap
|
||||
if (materialKey.isLightmapMap()) {
|
||||
auto itr = textureMaps.find(graphics::MaterialKey::LIGHTMAP_MAP);
|
||||
|
||||
if (itr != textureMaps.end() && itr->second->isDefined()) {
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::EMISSIVE_LIGHTMAP, itr->second->getTextureView());
|
||||
} else {
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::EMISSIVE_LIGHTMAP, textureCache->getGrayTexture());
|
||||
}
|
||||
} else if (materialKey.isEmissiveMap()) {
|
||||
auto itr = textureMaps.find(graphics::MaterialKey::EMISSIVE_MAP);
|
||||
|
||||
if (itr != textureMaps.end() && itr->second->isDefined()) {
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::EMISSIVE_LIGHTMAP, itr->second->getTextureView());
|
||||
} else {
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::EMISSIVE_LIGHTMAP, textureCache->getBlackTexture());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
22
libraries/render-utils/src/RenderPipelines.h
Normal file
22
libraries/render-utils/src/RenderPipelines.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
//
|
||||
// RenderPipelines.h
|
||||
// render-utils/src/
|
||||
//
|
||||
// Created by Sam Gondelman on 2/15/18
|
||||
// Copyright 2018 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
#ifndef hifi_RenderPipelines_h
|
||||
#define hifi_RenderPipelines_h
|
||||
|
||||
#include <graphics/Material.h>
|
||||
|
||||
class RenderPipelines {
|
||||
public:
|
||||
static void bindMaterial(graphics::MaterialPointer material, gpu::Batch& batch, bool enableTextures);
|
||||
};
|
||||
|
||||
|
||||
#endif // hifi_RenderPipelines_h
|
|
@ -2,9 +2,7 @@ set(TARGET_NAME render)
|
|||
AUTOSCRIBE_SHADER_LIB(gpu graphics)
|
||||
setup_hifi_library()
|
||||
|
||||
# render needs octree only for getAccuracyAngle(float, int), and model-networking for TextureCache
|
||||
link_hifi_libraries(shared task ktx gpu graphics octree model-networking)
|
||||
include_hifi_library_headers(networking)
|
||||
include_hifi_library_headers(image)
|
||||
# render needs octree only for getAccuracyAngle(float, int)
|
||||
link_hifi_libraries(shared task ktx gpu graphics octree)
|
||||
|
||||
target_nsight()
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
|
||||
#include <PerfStat.h>
|
||||
|
||||
#include <model-networking/TextureCache.h>
|
||||
|
||||
using namespace render;
|
||||
|
||||
ShapePipeline::CustomFactoryMap ShapePipeline::_globalCustomFactoryMap;
|
||||
|
@ -181,123 +179,4 @@ const ShapePipelinePointer ShapePlumber::pickPipeline(RenderArgs* args, const Ke
|
|||
}
|
||||
|
||||
return shapePipeline;
|
||||
}
|
||||
|
||||
void ShapePipeline::bindMaterial(graphics::MaterialPointer material, gpu::Batch& batch, bool enableTextures) const {
|
||||
if (!material) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto textureCache = DependencyManager::get<TextureCache>();
|
||||
|
||||
batch.setUniformBuffer(ShapePipeline::Slot::BUFFER::MATERIAL, material->getSchemaBuffer());
|
||||
batch.setUniformBuffer(ShapePipeline::Slot::BUFFER::TEXMAPARRAY, material->getTexMapArrayBuffer());
|
||||
|
||||
const auto& materialKey = material->getKey();
|
||||
const auto& textureMaps = material->getTextureMaps();
|
||||
|
||||
int numUnlit = 0;
|
||||
if (materialKey.isUnlit()) {
|
||||
numUnlit++;
|
||||
}
|
||||
|
||||
if (!enableTextures) {
|
||||
batch.setResourceTexture(ShapePipeline::Slot::ALBEDO, textureCache->getWhiteTexture());
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::ROUGHNESS, textureCache->getWhiteTexture());
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::NORMAL, textureCache->getBlueTexture());
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::METALLIC, textureCache->getBlackTexture());
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::OCCLUSION, textureCache->getWhiteTexture());
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::SCATTERING, textureCache->getWhiteTexture());
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::EMISSIVE_LIGHTMAP, textureCache->getBlackTexture());
|
||||
return;
|
||||
}
|
||||
|
||||
// Albedo
|
||||
if (materialKey.isAlbedoMap()) {
|
||||
auto itr = textureMaps.find(graphics::MaterialKey::ALBEDO_MAP);
|
||||
if (itr != textureMaps.end() && itr->second->isDefined()) {
|
||||
batch.setResourceTexture(ShapePipeline::Slot::ALBEDO, itr->second->getTextureView());
|
||||
} else {
|
||||
batch.setResourceTexture(ShapePipeline::Slot::ALBEDO, textureCache->getGrayTexture());
|
||||
}
|
||||
}
|
||||
|
||||
// Roughness map
|
||||
if (materialKey.isRoughnessMap()) {
|
||||
auto itr = textureMaps.find(graphics::MaterialKey::ROUGHNESS_MAP);
|
||||
if (itr != textureMaps.end() && itr->second->isDefined()) {
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::ROUGHNESS, itr->second->getTextureView());
|
||||
|
||||
// texcoord are assumed to be the same has albedo
|
||||
} else {
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::ROUGHNESS, textureCache->getWhiteTexture());
|
||||
}
|
||||
}
|
||||
|
||||
// Normal map
|
||||
if (materialKey.isNormalMap()) {
|
||||
auto itr = textureMaps.find(graphics::MaterialKey::NORMAL_MAP);
|
||||
if (itr != textureMaps.end() && itr->second->isDefined()) {
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::NORMAL, itr->second->getTextureView());
|
||||
|
||||
// texcoord are assumed to be the same has albedo
|
||||
} else {
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::NORMAL, textureCache->getBlueTexture());
|
||||
}
|
||||
}
|
||||
|
||||
// Metallic map
|
||||
if (materialKey.isMetallicMap()) {
|
||||
auto itr = textureMaps.find(graphics::MaterialKey::METALLIC_MAP);
|
||||
if (itr != textureMaps.end() && itr->second->isDefined()) {
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::METALLIC, itr->second->getTextureView());
|
||||
|
||||
// texcoord are assumed to be the same has albedo
|
||||
} else {
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::METALLIC, textureCache->getBlackTexture());
|
||||
}
|
||||
}
|
||||
|
||||
// Occlusion map
|
||||
if (materialKey.isOcclusionMap()) {
|
||||
auto itr = textureMaps.find(graphics::MaterialKey::OCCLUSION_MAP);
|
||||
if (itr != textureMaps.end() && itr->second->isDefined()) {
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::OCCLUSION, itr->second->getTextureView());
|
||||
|
||||
// texcoord are assumed to be the same has albedo
|
||||
} else {
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::OCCLUSION, textureCache->getWhiteTexture());
|
||||
}
|
||||
}
|
||||
|
||||
// Scattering map
|
||||
if (materialKey.isScatteringMap()) {
|
||||
auto itr = textureMaps.find(graphics::MaterialKey::SCATTERING_MAP);
|
||||
if (itr != textureMaps.end() && itr->second->isDefined()) {
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::SCATTERING, itr->second->getTextureView());
|
||||
|
||||
// texcoord are assumed to be the same has albedo
|
||||
} else {
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::SCATTERING, textureCache->getWhiteTexture());
|
||||
}
|
||||
}
|
||||
|
||||
// Emissive / Lightmap
|
||||
if (materialKey.isLightmapMap()) {
|
||||
auto itr = textureMaps.find(graphics::MaterialKey::LIGHTMAP_MAP);
|
||||
|
||||
if (itr != textureMaps.end() && itr->second->isDefined()) {
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::EMISSIVE_LIGHTMAP, itr->second->getTextureView());
|
||||
} else {
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::EMISSIVE_LIGHTMAP, textureCache->getGrayTexture());
|
||||
}
|
||||
} else if (materialKey.isEmissiveMap()) {
|
||||
auto itr = textureMaps.find(graphics::MaterialKey::EMISSIVE_MAP);
|
||||
|
||||
if (itr != textureMaps.end() && itr->second->isDefined()) {
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::EMISSIVE_LIGHTMAP, itr->second->getTextureView());
|
||||
} else {
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::EMISSIVE_LIGHTMAP, textureCache->getBlackTexture());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,8 +18,6 @@
|
|||
|
||||
#include "Args.h"
|
||||
|
||||
#include <graphics/Material.h>
|
||||
|
||||
namespace render {
|
||||
class Item;
|
||||
class ShapePlumber;
|
||||
|
@ -305,8 +303,6 @@ public:
|
|||
|
||||
void prepareShapeItem(Args* args, const ShapeKey& key, const Item& shape);
|
||||
|
||||
void bindMaterial(graphics::MaterialPointer material, gpu::Batch& batch, bool enableTextures) const;
|
||||
|
||||
protected:
|
||||
friend class ShapePlumber;
|
||||
|
||||
|
|
Loading…
Reference in a new issue