mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 08:04:01 +02:00
work around hiding of virtual functions in PolyVox entity classses
This commit is contained in:
parent
59389ce506
commit
22ac61e476
3 changed files with 20 additions and 15 deletions
|
@ -141,11 +141,7 @@ void RenderablePolyVoxEntityItem::setVoxelVolumeSize(glm::vec3 voxelVolumeSize)
|
|||
decompressVolumeData();
|
||||
}
|
||||
|
||||
void RenderablePolyVoxEntityItem::setVoxelSurfaceStyle(PolyVoxSurfaceStyle voxelSurfaceStyle) {
|
||||
if (voxelSurfaceStyle == _voxelSurfaceStyle) {
|
||||
return;
|
||||
}
|
||||
|
||||
void RenderablePolyVoxEntityItem::updateVoxelSurfaceStyle(PolyVoxSurfaceStyle voxelSurfaceStyle) {
|
||||
// if we are switching to or from "edged" we need to force a resize of _volData.
|
||||
if (voxelSurfaceStyle == SURFACE_EDGED_CUBIC ||
|
||||
_voxelSurfaceStyle == SURFACE_EDGED_CUBIC) {
|
||||
|
@ -153,10 +149,10 @@ void RenderablePolyVoxEntityItem::setVoxelSurfaceStyle(PolyVoxSurfaceStyle voxel
|
|||
delete _volData;
|
||||
}
|
||||
_volData = nullptr;
|
||||
PolyVoxEntityItem::setVoxelSurfaceStyle(voxelSurfaceStyle);
|
||||
_voxelSurfaceStyle = voxelSurfaceStyle;
|
||||
setVoxelVolumeSize(_voxelVolumeSize);
|
||||
} else {
|
||||
PolyVoxEntityItem::setVoxelSurfaceStyle(voxelSurfaceStyle);
|
||||
_voxelSurfaceStyle = voxelSurfaceStyle;
|
||||
}
|
||||
_needsModelReload = true;
|
||||
}
|
||||
|
|
|
@ -36,18 +36,15 @@ public:
|
|||
|
||||
virtual uint8_t getVoxel(int x, int y, int z);
|
||||
virtual void setVoxel(int x, int y, int z, uint8_t toValue);
|
||||
|
||||
|
||||
void updateOnCount(int x, int y, int z, uint8_t new_value);
|
||||
|
||||
void render(RenderArgs* args);
|
||||
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,
|
||||
bool& keepSearching, OctreeElement*& element, float& distance, BoxFace& face,
|
||||
void** intersectedObject, bool precisionPicking) const;
|
||||
|
||||
using PolyVoxEntityItem::setVoxelSurfaceStyle;
|
||||
virtual void setVoxelSurfaceStyle(PolyVoxSurfaceStyle voxelSurfaceStyle);
|
||||
|
||||
void getModel();
|
||||
|
||||
virtual void setVoxelData(QByteArray voxelData);
|
||||
|
@ -75,6 +72,9 @@ public:
|
|||
|
||||
SIMPLE_RENDERABLE();
|
||||
|
||||
protected:
|
||||
virtual void updateVoxelSurfaceStyle(PolyVoxSurfaceStyle voxelSurfaceStyle);
|
||||
|
||||
private:
|
||||
// The PolyVoxEntityItem class has _voxelData which contains dimensions and compressed voxel data. The dimensions
|
||||
// may not match _voxelVolumeSize.
|
||||
|
@ -83,6 +83,7 @@ private:
|
|||
void compressVolumeData();
|
||||
void decompressVolumeData();
|
||||
|
||||
|
||||
PolyVox::SimpleVolume<uint8_t>* _volData = nullptr;
|
||||
model::Geometry _modelGeometry;
|
||||
bool _needsModelReload = true;
|
||||
|
|
|
@ -61,10 +61,14 @@ class PolyVoxEntityItem : public EntityItem {
|
|||
SURFACE_EDGED_CUBIC
|
||||
};
|
||||
|
||||
virtual void setVoxelSurfaceStyle(PolyVoxSurfaceStyle voxelSurfaceStyle) { _voxelSurfaceStyle = voxelSurfaceStyle; }
|
||||
virtual void setVoxelSurfaceStyle(uint16_t voxelSurfaceStyle) {
|
||||
setVoxelSurfaceStyle((PolyVoxSurfaceStyle) voxelSurfaceStyle);
|
||||
void setVoxelSurfaceStyle(PolyVoxSurfaceStyle voxelSurfaceStyle) {
|
||||
if (voxelSurfaceStyle == _voxelSurfaceStyle) {
|
||||
return;
|
||||
}
|
||||
updateVoxelSurfaceStyle(voxelSurfaceStyle);
|
||||
}
|
||||
// this other version of setVoxelSurfaceStyle is needed for SET_ENTITY_PROPERTY_FROM_PROPERTIES
|
||||
void setVoxelSurfaceStyle(uint16_t voxelSurfaceStyle) { setVoxelSurfaceStyle((PolyVoxSurfaceStyle) voxelSurfaceStyle); }
|
||||
virtual PolyVoxSurfaceStyle getVoxelSurfaceStyle() const { return _voxelSurfaceStyle; }
|
||||
|
||||
static const glm::vec3 DEFAULT_VOXEL_VOLUME_SIZE;
|
||||
|
@ -89,6 +93,10 @@ class PolyVoxEntityItem : public EntityItem {
|
|||
static QByteArray makeEmptyVoxelData(quint16 voxelXSize = 16, quint16 voxelYSize = 16, quint16 voxelZSize = 16);
|
||||
|
||||
protected:
|
||||
virtual void updateVoxelSurfaceStyle(PolyVoxSurfaceStyle voxelSurfaceStyle) {
|
||||
_voxelSurfaceStyle = voxelSurfaceStyle;
|
||||
}
|
||||
|
||||
glm::vec3 _voxelVolumeSize; // this is always 3 bytes
|
||||
QByteArray _voxelData;
|
||||
PolyVoxSurfaceStyle _voxelSurfaceStyle;
|
||||
|
|
Loading…
Reference in a new issue