mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 15:29:32 +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();
|
decompressVolumeData();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderablePolyVoxEntityItem::setVoxelSurfaceStyle(PolyVoxSurfaceStyle voxelSurfaceStyle) {
|
void RenderablePolyVoxEntityItem::updateVoxelSurfaceStyle(PolyVoxSurfaceStyle voxelSurfaceStyle) {
|
||||||
if (voxelSurfaceStyle == _voxelSurfaceStyle) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if we are switching to or from "edged" we need to force a resize of _volData.
|
// if we are switching to or from "edged" we need to force a resize of _volData.
|
||||||
if (voxelSurfaceStyle == SURFACE_EDGED_CUBIC ||
|
if (voxelSurfaceStyle == SURFACE_EDGED_CUBIC ||
|
||||||
_voxelSurfaceStyle == SURFACE_EDGED_CUBIC) {
|
_voxelSurfaceStyle == SURFACE_EDGED_CUBIC) {
|
||||||
|
@ -153,10 +149,10 @@ void RenderablePolyVoxEntityItem::setVoxelSurfaceStyle(PolyVoxSurfaceStyle voxel
|
||||||
delete _volData;
|
delete _volData;
|
||||||
}
|
}
|
||||||
_volData = nullptr;
|
_volData = nullptr;
|
||||||
PolyVoxEntityItem::setVoxelSurfaceStyle(voxelSurfaceStyle);
|
_voxelSurfaceStyle = voxelSurfaceStyle;
|
||||||
setVoxelVolumeSize(_voxelVolumeSize);
|
setVoxelVolumeSize(_voxelVolumeSize);
|
||||||
} else {
|
} else {
|
||||||
PolyVoxEntityItem::setVoxelSurfaceStyle(voxelSurfaceStyle);
|
_voxelSurfaceStyle = voxelSurfaceStyle;
|
||||||
}
|
}
|
||||||
_needsModelReload = true;
|
_needsModelReload = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,18 +36,15 @@ public:
|
||||||
|
|
||||||
virtual uint8_t getVoxel(int x, int y, int z);
|
virtual uint8_t getVoxel(int x, int y, int z);
|
||||||
virtual void setVoxel(int x, int y, int z, uint8_t toValue);
|
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 updateOnCount(int x, int y, int z, uint8_t new_value);
|
||||||
|
|
||||||
void render(RenderArgs* args);
|
void render(RenderArgs* args);
|
||||||
virtual bool supportsDetailedRayIntersection() const { return true; }
|
virtual bool supportsDetailedRayIntersection() const { return true; }
|
||||||
virtual bool findDetailedRayIntersection(const glm::vec3& origin, const glm::vec3& direction,
|
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;
|
void** intersectedObject, bool precisionPicking) const;
|
||||||
|
|
||||||
using PolyVoxEntityItem::setVoxelSurfaceStyle;
|
|
||||||
virtual void setVoxelSurfaceStyle(PolyVoxSurfaceStyle voxelSurfaceStyle);
|
|
||||||
|
|
||||||
void getModel();
|
void getModel();
|
||||||
|
|
||||||
virtual void setVoxelData(QByteArray voxelData);
|
virtual void setVoxelData(QByteArray voxelData);
|
||||||
|
@ -75,6 +72,9 @@ public:
|
||||||
|
|
||||||
SIMPLE_RENDERABLE();
|
SIMPLE_RENDERABLE();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void updateVoxelSurfaceStyle(PolyVoxSurfaceStyle voxelSurfaceStyle);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// The PolyVoxEntityItem class has _voxelData which contains dimensions and compressed voxel data. The dimensions
|
// The PolyVoxEntityItem class has _voxelData which contains dimensions and compressed voxel data. The dimensions
|
||||||
// may not match _voxelVolumeSize.
|
// may not match _voxelVolumeSize.
|
||||||
|
@ -83,6 +83,7 @@ private:
|
||||||
void compressVolumeData();
|
void compressVolumeData();
|
||||||
void decompressVolumeData();
|
void decompressVolumeData();
|
||||||
|
|
||||||
|
|
||||||
PolyVox::SimpleVolume<uint8_t>* _volData = nullptr;
|
PolyVox::SimpleVolume<uint8_t>* _volData = nullptr;
|
||||||
model::Geometry _modelGeometry;
|
model::Geometry _modelGeometry;
|
||||||
bool _needsModelReload = true;
|
bool _needsModelReload = true;
|
||||||
|
|
|
@ -61,10 +61,14 @@ class PolyVoxEntityItem : public EntityItem {
|
||||||
SURFACE_EDGED_CUBIC
|
SURFACE_EDGED_CUBIC
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual void setVoxelSurfaceStyle(PolyVoxSurfaceStyle voxelSurfaceStyle) { _voxelSurfaceStyle = voxelSurfaceStyle; }
|
void setVoxelSurfaceStyle(PolyVoxSurfaceStyle voxelSurfaceStyle) {
|
||||||
virtual void setVoxelSurfaceStyle(uint16_t voxelSurfaceStyle) {
|
if (voxelSurfaceStyle == _voxelSurfaceStyle) {
|
||||||
setVoxelSurfaceStyle((PolyVoxSurfaceStyle) 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; }
|
virtual PolyVoxSurfaceStyle getVoxelSurfaceStyle() const { return _voxelSurfaceStyle; }
|
||||||
|
|
||||||
static const glm::vec3 DEFAULT_VOXEL_VOLUME_SIZE;
|
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);
|
static QByteArray makeEmptyVoxelData(quint16 voxelXSize = 16, quint16 voxelYSize = 16, quint16 voxelZSize = 16);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual void updateVoxelSurfaceStyle(PolyVoxSurfaceStyle voxelSurfaceStyle) {
|
||||||
|
_voxelSurfaceStyle = voxelSurfaceStyle;
|
||||||
|
}
|
||||||
|
|
||||||
glm::vec3 _voxelVolumeSize; // this is always 3 bytes
|
glm::vec3 _voxelVolumeSize; // this is always 3 bytes
|
||||||
QByteArray _voxelData;
|
QByteArray _voxelData;
|
||||||
PolyVoxSurfaceStyle _voxelSurfaceStyle;
|
PolyVoxSurfaceStyle _voxelSurfaceStyle;
|
||||||
|
|
Loading…
Reference in a new issue