overte-HifiExperiments/libraries/entities-renderer/src/RenderableLightEntityItem.h
2017-06-15 18:58:56 -07:00

59 lines
2.1 KiB
C++

//
// RenderableLightEntityItem.h
// interface/src/entities
//
// Created by Brad Hefta-Gaub on 8/6/14.
// Copyright 2014 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_RenderableLightEntityItem_h
#define hifi_RenderableLightEntityItem_h
#include <LightEntityItem.h>
#include <LightPayload.h>
#include "RenderableEntityItem.h"
class RenderableLightEntityItem : public LightEntityItem, public RenderableEntityInterface {
public:
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
RenderableLightEntityItem(const EntityItemID& entityItemID);
RenderableEntityInterface* getRenderableInterface() override { return this; }
virtual bool supportsDetailedRayIntersection() const override { return true; }
virtual bool 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 override;
void updateLightFromEntity(render::Transaction& transaction);
virtual bool addToScene(const EntityItemPointer& self, const render::ScenePointer& scene, render::Transaction& transaction) override;
virtual void somethingChangedNotification() override;
virtual void removeFromScene(const EntityItemPointer& self, const render::ScenePointer& scene, render::Transaction& transaction) override;
virtual void locationChanged(bool tellPhysics = true) override;
virtual void dimensionsChanged() override;
void checkFading();
void notifyChanged();
private:
bool _prevIsTransparent { isTransparent() };
render::ItemID _myItem { render::Item::INVALID_ITEM_ID };
// Dirty flag turn true when either setSubClassProperties or readEntitySubclassDataFromBuffer is changing a value
void updateRenderItemFromEntity(LightPayload& lightPayload);
};
#endif // hifi_RenderableLightEntityItem_h