diff --git a/libraries/entities-renderer/src/RenderableEntityItem.cpp b/libraries/entities-renderer/src/RenderableEntityItem.cpp index 92387dafa6..6c979f8afe 100644 --- a/libraries/entities-renderer/src/RenderableEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableEntityItem.cpp @@ -26,7 +26,6 @@ #include "RenderableZoneEntityItem.h" #include "RenderableMaterialEntityItem.h" #include "RenderableImageEntityItem.h" -#include "RenderableGridEntityItem.h" using namespace render; @@ -257,10 +256,6 @@ EntityRenderer::Pointer EntityRenderer::addToScene(EntityTreeRenderer& renderer, result = make_renderer(entity); break; - case Type::Grid: - result = make_renderer(entity); - break; - case Type::Light: result = make_renderer(entity); break; diff --git a/libraries/entities-renderer/src/RenderableGridEntityItem.cpp b/libraries/entities-renderer/src/RenderableGridEntityItem.cpp deleted file mode 100644 index bd42a722fb..0000000000 --- a/libraries/entities-renderer/src/RenderableGridEntityItem.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// -// Created by Sam Gondelman on 11/29/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 -// - -#include "RenderableGridEntityItem.h" - -using namespace render; -using namespace render::entities; - -GridEntityRenderer::GridEntityRenderer(const EntityItemPointer& entity) : Parent(entity) { -} - -bool GridEntityRenderer::needsRenderUpdate() const { - return Parent::needsRenderUpdate(); -} - -bool GridEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const { - return false; -} - -void GridEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) { - -} - -ItemKey GridEntityRenderer::getKey() { - ItemKey::Builder builder; - builder.withTypeShape().withTypeMeta().withTagBits(getTagMask()); - - withReadLock([&] { - if (isTransparent()) { - builder.withTransparent(); - } else if (_canCastShadow) { - builder.withShadowCaster(); - } - }); - - return builder.build(); -} - -ShapeKey GridEntityRenderer::getShapeKey() { - ShapeKey::Builder builder; - return builder.build(); -} - -void GridEntityRenderer::doRender(RenderArgs* args) { - -} \ No newline at end of file diff --git a/libraries/entities-renderer/src/RenderableGridEntityItem.h b/libraries/entities-renderer/src/RenderableGridEntityItem.h deleted file mode 100644 index 09c0de1d0d..0000000000 --- a/libraries/entities-renderer/src/RenderableGridEntityItem.h +++ /dev/null @@ -1,36 +0,0 @@ -// -// Created by Sam Gondelman on 11/29/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_RenderableGridEntityItem_h -#define hifi_RenderableGridEntityItem_h - -#include "RenderableEntityItem.h" - -#include - -namespace render { namespace entities { - -class GridEntityRenderer : public TypedEntityRenderer { - using Parent = TypedEntityRenderer; - using Pointer = std::shared_ptr; -public: - GridEntityRenderer(const EntityItemPointer& entity); - -protected: - ItemKey getKey() override; - ShapeKey getShapeKey() override; - -private: - virtual bool needsRenderUpdate() const override; - virtual bool needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const override; - virtual void doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) override; - virtual void doRender(RenderArgs* args) override; -}; - -} } -#endif // hifi_RenderableGridEntityItem_h diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index f24b14d3b7..6f451f937a 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -684,7 +684,6 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const { * @see {@link Entities.EntityProperties-Line|EntityProperties-Line} * @see {@link Entities.EntityProperties-PolyLine|EntityProperties-PolyLine} * @see {@link Entities.EntityProperties-PolyVox|EntityProperties-PolyVox} - * @see {@link Entities.EntityProperties-Grid|EntityProperties-Grid} * @see {@link Entities.EntityProperties-Light|EntityProperties-Light} * @see {@link Entities.EntityProperties-Zone|EntityProperties-Zone} * @see {@link Entities.EntityProperties-Material|EntityProperties-Material} diff --git a/libraries/entities/src/EntityItemProperties.h b/libraries/entities/src/EntityItemProperties.h index a34af703fb..8a9e22f28c 100644 --- a/libraries/entities/src/EntityItemProperties.h +++ b/libraries/entities/src/EntityItemProperties.h @@ -80,7 +80,6 @@ class EntityItemProperties { friend class LineEntityItem; friend class PolyLineEntityItem; friend class PolyVoxEntityItem; - friend class GridEntityItem; friend class LightEntityItem; friend class ZoneEntityItem; friend class MaterialEntityItem; diff --git a/libraries/entities/src/EntityTypes.cpp b/libraries/entities/src/EntityTypes.cpp index e511af83b0..30f9d9b541 100644 --- a/libraries/entities/src/EntityTypes.cpp +++ b/libraries/entities/src/EntityTypes.cpp @@ -29,7 +29,6 @@ #include "LineEntityItem.h" #include "PolyLineEntityItem.h" #include "PolyVoxEntityItem.h" -#include "GridEntityItem.h" #include "LightEntityItem.h" #include "ZoneEntityItem.h" #include "MaterialEntityItem.h" @@ -53,7 +52,6 @@ REGISTER_ENTITY_TYPE(ParticleEffect) REGISTER_ENTITY_TYPE(Line) REGISTER_ENTITY_TYPE(PolyLine) REGISTER_ENTITY_TYPE(PolyVox) -REGISTER_ENTITY_TYPE(Grid) REGISTER_ENTITY_TYPE(Light) REGISTER_ENTITY_TYPE(Zone) REGISTER_ENTITY_TYPE(Material) diff --git a/libraries/entities/src/EntityTypes.h b/libraries/entities/src/EntityTypes.h index 604f2fe905..c85cb5b2dd 100644 --- a/libraries/entities/src/EntityTypes.h +++ b/libraries/entities/src/EntityTypes.h @@ -76,8 +76,6 @@ public: * {@link Entities.EntityProperties-PolyLine|EntityProperties-PolyLine} * "PolyVox"A set of textured voxels. * {@link Entities.EntityProperties-PolyVox|EntityProperties-PolyVox} - * "Grid"A grid. - * {@link Entities.EntityProperties-Grid|EntityProperties-Grid} * "Light"A local lighting effect. * {@link Entities.EntityProperties-Light|EntityProperties-Light} * "Zone"A volume of lighting effects and avatar permissions. @@ -102,7 +100,6 @@ public: Line, PolyLine, PolyVox, - Grid, Light, Zone, Material, diff --git a/libraries/entities/src/GridEntityItem.cpp b/libraries/entities/src/GridEntityItem.cpp deleted file mode 100644 index cc59135e8d..0000000000 --- a/libraries/entities/src/GridEntityItem.cpp +++ /dev/null @@ -1,154 +0,0 @@ -// -// Created by Sam Gondelman on 11/29/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 -// - -#include "GridEntityItem.h" - -#include "EntityItemProperties.h" - -EntityItemPointer GridEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) { - Pointer entity(new GridEntityItem(entityID), [](EntityItem* ptr) { ptr->deleteLater(); }); - entity->setProperties(properties); - return entity; -} - -// our non-pure virtual subclass for now... -GridEntityItem::GridEntityItem(const EntityItemID& entityItemID) : EntityItem(entityItemID) { - _type = EntityTypes::Grid; -} - -EntityItemProperties GridEntityItem::getProperties(const EntityPropertyFlags& desiredProperties, bool allowEmptyDesiredProperties) const { - EntityItemProperties properties = EntityItem::getProperties(desiredProperties, allowEmptyDesiredProperties); // get the properties from our base class - - //COPY_ENTITY_PROPERTY_TO_PROPERTIES(imageURL, getGridURL); - //COPY_ENTITY_PROPERTY_TO_PROPERTIES(emissive, getEmissive); - //COPY_ENTITY_PROPERTY_TO_PROPERTIES(keepAspectRatio, getKeepAspectRatio); - //COPY_ENTITY_PROPERTY_TO_PROPERTIES(faceCamera, getFaceCamera); - //COPY_ENTITY_PROPERTY_TO_PROPERTIES(subGrid, getSubGrid); - - return properties; -} - -bool GridEntityItem::setProperties(const EntityItemProperties& properties) { - bool somethingChanged = EntityItem::setProperties(properties); // set the properties in our base class - - //SET_ENTITY_PROPERTY_FROM_PROPERTIES(imageURL, setGridURL); - //SET_ENTITY_PROPERTY_FROM_PROPERTIES(emissive, setEmissive); - //SET_ENTITY_PROPERTY_FROM_PROPERTIES(keepAspectRatio, setKeepAspectRatio); - //SET_ENTITY_PROPERTY_FROM_PROPERTIES(faceCamera, setFaceCamera); - //SET_ENTITY_PROPERTY_FROM_PROPERTIES(subGrid, setSubGrid); - - if (somethingChanged) { - bool wantDebug = false; - if (wantDebug) { - uint64_t now = usecTimestampNow(); - int elapsed = now - getLastEdited(); - qCDebug(entities) << "GridEntityItem::setProperties() AFTER update... edited AGO=" << elapsed << - "now=" << now << " getLastEdited()=" << getLastEdited(); - } - setLastEdited(properties.getLastEdited()); - } - return somethingChanged; -} - -int GridEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, - ReadBitstreamToTreeParams& args, - EntityPropertyFlags& propertyFlags, bool overwriteLocalData, - bool& somethingChanged) { - - int bytesRead = 0; - const unsigned char* dataAt = data; - - //READ_ENTITY_PROPERTY(PROP_IMAGE_URL, QString, setGridURL); - //READ_ENTITY_PROPERTY(PROP_EMISSIVE, bool, setEmissive); - //READ_ENTITY_PROPERTY(PROP_KEEP_ASPECT_RATIO, bool, setKeepAspectRatio); - //READ_ENTITY_PROPERTY(PROP_FACE_CAMERA, bool, setFaceCamera); - //READ_ENTITY_PROPERTY(PROP_SUB_IMAGE, QRect, setSubGrid); - - return bytesRead; -} - -EntityPropertyFlags GridEntityItem::getEntityProperties(EncodeBitstreamParams& params) const { - EntityPropertyFlags requestedProperties = EntityItem::getEntityProperties(params); - - //requestedProperties += PROP_IMAGE_URL; - //requestedProperties += PROP_EMISSIVE; - //requestedProperties += PROP_KEEP_ASPECT_RATIO; - //requestedProperties += PROP_FACE_CAMERA; - //requestedProperties += PROP_SUB_IMAGE; - - return requestedProperties; -} - -void GridEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBitstreamParams& params, - EntityTreeElementExtraEncodeDataPointer modelTreeElementExtraEncodeData, - EntityPropertyFlags& requestedProperties, - EntityPropertyFlags& propertyFlags, - EntityPropertyFlags& propertiesDidntFit, - int& propertyCount, - OctreeElement::AppendState& appendState) const { - - bool successPropertyFits = true; - - //APPEND_ENTITY_PROPERTY(PROP_IMAGE_URL, getGridURL()); - //APPEND_ENTITY_PROPERTY(PROP_EMISSIVE, getEmissive()); - //APPEND_ENTITY_PROPERTY(PROP_KEEP_ASPECT_RATIO, getKeepAspectRatio()); - //APPEND_ENTITY_PROPERTY(PROP_FACE_CAMERA, getFaceCamera()); - //APPEND_ENTITY_PROPERTY(PROP_SUB_IMAGE, getSubGrid()); -} - -bool GridEntityItem::findDetailedRayIntersection(const glm::vec3& origin, const glm::vec3& direction, - OctreeElementPointer& element, - float& distance, BoxFace& face, glm::vec3& surfaceNormal, - QVariantMap& extraInfo, bool precisionPicking) const { - glm::vec3 dimensions = getScaledDimensions(); - glm::vec2 xyDimensions(dimensions.x, dimensions.y); - glm::quat rotation = getWorldOrientation(); - glm::vec3 position = getWorldPosition() + rotation * (dimensions * (ENTITY_ITEM_DEFAULT_REGISTRATION_POINT - getRegistrationPoint())); - - if (findRayRectangleIntersection(origin, direction, rotation, position, xyDimensions, distance)) { - glm::vec3 forward = rotation * Vectors::FRONT; - if (glm::dot(forward, direction) > 0.0f) { - face = MAX_Z_FACE; - surfaceNormal = -forward; - } else { - face = MIN_Z_FACE; - surfaceNormal = forward; - } - return true; - } - return false; -} - -bool GridEntityItem::findDetailedParabolaIntersection(const glm::vec3& origin, const glm::vec3& velocity, const glm::vec3& acceleration, - OctreeElementPointer& element, float& parabolicDistance, - BoxFace& face, glm::vec3& surfaceNormal, - QVariantMap& extraInfo, bool precisionPicking) const { - glm::vec3 dimensions = getScaledDimensions(); - glm::vec2 xyDimensions(dimensions.x, dimensions.y); - glm::quat rotation = getWorldOrientation(); - glm::vec3 position = getWorldPosition() + rotation * (dimensions * (ENTITY_ITEM_DEFAULT_REGISTRATION_POINT - getRegistrationPoint())); - - glm::quat inverseRot = glm::inverse(rotation); - glm::vec3 localOrigin = inverseRot * (origin - position); - glm::vec3 localVelocity = inverseRot * velocity; - glm::vec3 localAcceleration = inverseRot * acceleration; - - if (findParabolaRectangleIntersection(localOrigin, localVelocity, localAcceleration, xyDimensions, parabolicDistance)) { - float localIntersectionVelocityZ = localVelocity.z + localAcceleration.z * parabolicDistance; - glm::vec3 forward = rotation * Vectors::FRONT; - if (localIntersectionVelocityZ > 0.0f) { - face = MIN_Z_FACE; - surfaceNormal = forward; - } else { - face = MAX_Z_FACE; - surfaceNormal = -forward; - } - return true; - } - return false; -} \ No newline at end of file diff --git a/libraries/entities/src/GridEntityItem.h b/libraries/entities/src/GridEntityItem.h deleted file mode 100644 index 4704d96f3d..0000000000 --- a/libraries/entities/src/GridEntityItem.h +++ /dev/null @@ -1,56 +0,0 @@ -// -// Created by Sam Gondelman on 11/29/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_GridEntityItem_h -#define hifi_GridEntityItem_h - -#include "EntityItem.h" - -class GridEntityItem : public EntityItem { - using Pointer = std::shared_ptr; -public: - static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties); - - GridEntityItem(const EntityItemID& entityItemID); - - ALLOW_INSTANTIATION // This class can be instantiated - - // methods for getting/setting all properties of an entity - EntityItemProperties getProperties(const EntityPropertyFlags& desiredProperties, bool allowEmptyDesiredProperties) const override; - bool setProperties(const EntityItemProperties& properties) override; - - EntityPropertyFlags getEntityProperties(EncodeBitstreamParams& params) const override; - - void appendSubclassData(OctreePacketData* packetData, EncodeBitstreamParams& params, - EntityTreeElementExtraEncodeDataPointer modelTreeElementExtraEncodeData, - EntityPropertyFlags& requestedProperties, - EntityPropertyFlags& propertyFlags, - EntityPropertyFlags& propertiesDidntFit, - int& propertyCount, - OctreeElement::AppendState& appendState) const override; - - int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, - ReadBitstreamToTreeParams& args, - EntityPropertyFlags& propertyFlags, bool overwriteLocalData, - bool& somethingChanged) override; - - virtual bool supportsDetailedIntersection() const override { return true; } - virtual bool findDetailedRayIntersection(const glm::vec3& origin, const glm::vec3& direction, - OctreeElementPointer& element, float& distance, - BoxFace& face, glm::vec3& surfaceNormal, - QVariantMap& extraInfo, bool precisionPicking) const override; - virtual bool findDetailedParabolaIntersection(const glm::vec3& origin, const glm::vec3& velocity, - const glm::vec3& acceleration, OctreeElementPointer& element, float& parabolicDistance, - BoxFace& face, glm::vec3& surfaceNormal, - QVariantMap& extraInfo, bool precisionPicking) const override; - -protected: - -}; - -#endif // hifi_GridEntityItem_h