mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
71 lines
3.1 KiB
C++
71 lines
3.1 KiB
C++
//
|
|
// PolyVoxEntityItem.h
|
|
// libraries/entities/src
|
|
//
|
|
// Created by Seth Alves on 5/11/15.
|
|
// Copyright 2015 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_PolyVoxEntityItem_h
|
|
#define hifi_PolyVoxEntityItem_h
|
|
|
|
#include "EntityItem.h"
|
|
|
|
class PolyVoxEntityItem : public EntityItem {
|
|
public:
|
|
static EntityItem* factory(const EntityItemID& entityID, const EntityItemProperties& properties);
|
|
|
|
PolyVoxEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties);
|
|
|
|
ALLOW_INSTANTIATION // This class can be instantiated
|
|
|
|
// methods for getting/setting all properties of an entity
|
|
virtual EntityItemProperties getProperties() const;
|
|
virtual bool setProperties(const EntityItemProperties& properties);
|
|
|
|
// TODO: eventually only include properties changed since the params.lastViewFrustumSent time
|
|
virtual EntityPropertyFlags getEntityProperties(EncodeBitstreamParams& params) const;
|
|
|
|
virtual void appendSubclassData(OctreePacketData* packetData, EncodeBitstreamParams& params,
|
|
EntityTreeElementExtraEncodeData* modelTreeElementExtraEncodeData,
|
|
EntityPropertyFlags& requestedProperties,
|
|
EntityPropertyFlags& propertyFlags,
|
|
EntityPropertyFlags& propertiesDidntFit,
|
|
int& propertyCount,
|
|
OctreeElement::AppendState& appendState) const;
|
|
|
|
virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
|
|
ReadBitstreamToTreeParams& args,
|
|
EntityPropertyFlags& propertyFlags, bool overwriteLocalData);
|
|
|
|
const rgbColor& getColor() const { return _color; }
|
|
xColor getXColor() const { xColor color = { _color[RED_INDEX], _color[GREEN_INDEX], _color[BLUE_INDEX] }; return color; }
|
|
|
|
void setColor(const rgbColor& value) { memcpy(_color, value, sizeof(_color)); }
|
|
void setColor(const xColor& value) {
|
|
_color[RED_INDEX] = value.red;
|
|
_color[GREEN_INDEX] = value.green;
|
|
_color[BLUE_INDEX] = value.blue;
|
|
}
|
|
|
|
virtual ShapeType getShapeType() const { return SHAPE_TYPE_POLYVOX; }
|
|
|
|
// never have a ray intersection pick a PolyVoxEntityItem.
|
|
virtual bool supportsDetailedRayIntersection() const { return true; }
|
|
virtual bool findDetailedRayIntersection(const glm::vec3& origin, const glm::vec3& direction,
|
|
bool& keepSearching, OctreeElement*& element, float& distance, BoxFace& face,
|
|
void** intersectedObject, bool precisionPicking) const { return false; }
|
|
|
|
virtual void debugDump() const;
|
|
|
|
virtual void setVoxelVolumeSize(glm::vec3 voxelVolumeSize) { _voxelVolumeSize = voxelVolumeSize; }
|
|
|
|
protected:
|
|
rgbColor _color;
|
|
glm::vec3 _voxelVolumeSize = glm::vec3(64, 64, 64);
|
|
};
|
|
|
|
#endif // hifi_PolyVoxEntityItem_h
|