Show green box when model entity has bad url

This commit is contained in:
Atlante45 2017-03-23 17:49:55 -07:00
parent e1a0984fed
commit 4f8d9b190b
2 changed files with 109 additions and 104 deletions

View file

@ -371,7 +371,18 @@ void RenderableModelEntityItem::render(RenderArgs* args) {
_model->updateRenderItems();
}
if (hasModel()) {
if (!hasModel() || (_model && _model->didVisualGeometryRequestFail())) {
static glm::vec4 greenColor(0.0f, 1.0f, 0.0f, 1.0f);
gpu::Batch& batch = *args->_batch;
bool success;
auto shapeTransform = getTransformToCenter(success);
if (success) {
batch.setModelTransform(shapeTransform); // we want to include the scale as well
DependencyManager::get<GeometryCache>()->renderWireCubeInstance(batch, greenColor);
}
return;
}
// Prepare the current frame
{
if (!_model || _needsModelReload) {
@ -473,16 +484,6 @@ void RenderableModelEntityItem::render(RenderArgs* args) {
getModel(_myRenderer);
}
}
} else {
static glm::vec4 greenColor(0.0f, 1.0f, 0.0f, 1.0f);
gpu::Batch& batch = *args->_batch;
bool success;
auto shapeTransform = getTransformToCenter(success);
if (success) {
batch.setModelTransform(shapeTransform); // we want to include the scale as well
DependencyManager::get<GeometryCache>()->renderWireCubeInstance(batch, greenColor);
}
}
}
ModelPointer RenderableModelEntityItem::getModelNotSafe() {
@ -587,6 +588,10 @@ EntityItemProperties RenderableModelEntityItem::getProperties(EntityPropertyFlag
return properties;
}
bool RenderableModelEntityItem::supportsDetailedRayIntersection() const {
return _model && _model->isLoaded();
}
bool RenderableModelEntityItem::findDetailedRayIntersection(const glm::vec3& origin, const glm::vec3& direction,
bool& keepSearching, OctreeElementPointer& element, float& distance, BoxFace& face,
glm::vec3& surfaceNormal, void** intersectedObject, bool precisionPicking) const {

View file

@ -46,7 +46,7 @@ public:
void updateModelBounds();
virtual void render(RenderArgs* args) override;
virtual bool supportsDetailedRayIntersection() const override { return true; }
virtual bool supportsDetailedRayIntersection() const override;
virtual bool findDetailedRayIntersection(const glm::vec3& origin, const glm::vec3& direction,
bool& keepSearching, OctreeElementPointer& element, float& distance,
BoxFace& face, glm::vec3& surfaceNormal,