mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-24 09:24:15 +02:00
use enum for polyvox surface style
This commit is contained in:
parent
1749ec83db
commit
3af916e27e
4 changed files with 30 additions and 16 deletions
|
@ -126,14 +126,19 @@ void RenderablePolyVoxEntityItem::getModel() {
|
||||||
// A mesh object to hold the result of surface extraction
|
// A mesh object to hold the result of surface extraction
|
||||||
PolyVox::SurfaceMesh<PolyVox::PositionMaterialNormal> polyVoxMesh;
|
PolyVox::SurfaceMesh<PolyVox::PositionMaterialNormal> polyVoxMesh;
|
||||||
|
|
||||||
if (_voxelSurfaceStyle == 0) {
|
switch (_voxelSurfaceStyle) {
|
||||||
PolyVox::MarchingCubesSurfaceExtractor<PolyVox::SimpleVolume<uint8_t>> surfaceExtractor
|
case PolyVoxEntityItem::SURFACE_MARCHING_CUBES: {
|
||||||
(_volData, _volData->getEnclosingRegion(), &polyVoxMesh);
|
PolyVox::MarchingCubesSurfaceExtractor<PolyVox::SimpleVolume<uint8_t>> surfaceExtractor
|
||||||
surfaceExtractor.execute();
|
(_volData, _volData->getEnclosingRegion(), &polyVoxMesh);
|
||||||
} else {
|
surfaceExtractor.execute();
|
||||||
PolyVox::CubicSurfaceExtractorWithNormals<PolyVox::SimpleVolume<uint8_t>> surfaceExtractor
|
break;
|
||||||
(_volData, _volData->getEnclosingRegion(), &polyVoxMesh);
|
}
|
||||||
surfaceExtractor.execute();
|
case PolyVoxEntityItem::SURFACE_CUBIC: {
|
||||||
|
PolyVox::CubicSurfaceExtractorWithNormals<PolyVox::SimpleVolume<uint8_t>> surfaceExtractor
|
||||||
|
(_volData, _volData->getEnclosingRegion(), &polyVoxMesh);
|
||||||
|
surfaceExtractor.execute();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert PolyVox mesh to a Sam mesh
|
// convert PolyVox mesh to a Sam mesh
|
||||||
|
|
|
@ -661,12 +661,12 @@ void EntityItem::adjustEditPacketForClockSkew(unsigned char* editPacketBuffer, s
|
||||||
assert(lastEditedInLocalTime > 0);
|
assert(lastEditedInLocalTime > 0);
|
||||||
quint64 lastEditedInServerTime = lastEditedInLocalTime + clockSkew;
|
quint64 lastEditedInServerTime = lastEditedInLocalTime + clockSkew;
|
||||||
memcpy(dataAt, &lastEditedInServerTime, sizeof(lastEditedInServerTime));
|
memcpy(dataAt, &lastEditedInServerTime, sizeof(lastEditedInServerTime));
|
||||||
//#ifdef WANT_DEBUG
|
#ifdef WANT_DEBUG
|
||||||
qCDebug(entities, "EntityItem::adjustEditPacketForClockSkew()...");
|
qCDebug(entities, "EntityItem::adjustEditPacketForClockSkew()...");
|
||||||
qCDebug(entities) << " lastEditedInLocalTime: " << lastEditedInLocalTime;
|
qCDebug(entities) << " lastEditedInLocalTime: " << lastEditedInLocalTime;
|
||||||
qCDebug(entities) << " clockSkew: " << clockSkew;
|
qCDebug(entities) << " clockSkew: " << clockSkew;
|
||||||
qCDebug(entities) << " lastEditedInServerTime: " << lastEditedInServerTime;
|
qCDebug(entities) << " lastEditedInServerTime: " << lastEditedInServerTime;
|
||||||
//#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
float EntityItem::computeMass() const {
|
float EntityItem::computeMass() const {
|
||||||
|
|
|
@ -23,7 +23,8 @@
|
||||||
|
|
||||||
const glm::vec3 PolyVoxEntityItem::DEFAULT_VOXEL_VOLUME_SIZE = glm::vec3(32, 32, 32);
|
const glm::vec3 PolyVoxEntityItem::DEFAULT_VOXEL_VOLUME_SIZE = glm::vec3(32, 32, 32);
|
||||||
const QByteArray PolyVoxEntityItem::DEFAULT_VOXEL_DATA(qCompress(QByteArray(0), 9));
|
const QByteArray PolyVoxEntityItem::DEFAULT_VOXEL_DATA(qCompress(QByteArray(0), 9));
|
||||||
const int PolyVoxEntityItem::DEFAULT_VOXEL_SURFACE_STYLE = 0;
|
const PolyVoxEntityItem::PolyVoxSurfaceStyle PolyVoxEntityItem::DEFAULT_VOXEL_SURFACE_STYLE =
|
||||||
|
PolyVoxEntityItem::SURFACE_MARCHING_CUBES;
|
||||||
|
|
||||||
EntityItemPointer PolyVoxEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
EntityItemPointer PolyVoxEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
||||||
return EntityItemPointer(new PolyVoxEntityItem(entityID, properties));
|
return EntityItemPointer(new PolyVoxEntityItem(entityID, properties));
|
||||||
|
@ -116,7 +117,7 @@ void PolyVoxEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeB
|
||||||
APPEND_ENTITY_PROPERTY(PROP_COLOR, getColor());
|
APPEND_ENTITY_PROPERTY(PROP_COLOR, getColor());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_VOXEL_VOLUME_SIZE, getVoxelVolumeSize());
|
APPEND_ENTITY_PROPERTY(PROP_VOXEL_VOLUME_SIZE, getVoxelVolumeSize());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_VOXEL_DATA, getVoxelData());
|
APPEND_ENTITY_PROPERTY(PROP_VOXEL_DATA, getVoxelData());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_VOXEL_SURFACE_STYLE, getVoxelSurfaceStyle());
|
APPEND_ENTITY_PROPERTY(PROP_VOXEL_SURFACE_STYLE, (uint16_t) getVoxelSurfaceStyle());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PolyVoxEntityItem::debugDump() const {
|
void PolyVoxEntityItem::debugDump() const {
|
||||||
|
|
|
@ -67,12 +67,20 @@ class PolyVoxEntityItem : public EntityItem {
|
||||||
virtual void setVoxelData(QByteArray voxelData) { _voxelData = voxelData; }
|
virtual void setVoxelData(QByteArray voxelData) { _voxelData = voxelData; }
|
||||||
virtual const QByteArray& getVoxelData() const { return _voxelData; }
|
virtual const QByteArray& getVoxelData() const { return _voxelData; }
|
||||||
|
|
||||||
virtual void setVoxelSurfaceStyle(uint16_t voxelSurfaceStyle) { _voxelSurfaceStyle = voxelSurfaceStyle; }
|
enum PolyVoxSurfaceStyle {
|
||||||
virtual uint16_t getVoxelSurfaceStyle() const { return _voxelSurfaceStyle; }
|
SURFACE_MARCHING_CUBES,
|
||||||
|
SURFACE_CUBIC
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void setVoxelSurfaceStyle(PolyVoxSurfaceStyle voxelSurfaceStyle) { _voxelSurfaceStyle = voxelSurfaceStyle; }
|
||||||
|
virtual void setVoxelSurfaceStyle(uint16_t voxelSurfaceStyle) {
|
||||||
|
_voxelSurfaceStyle = (PolyVoxSurfaceStyle) voxelSurfaceStyle;
|
||||||
|
}
|
||||||
|
virtual PolyVoxSurfaceStyle getVoxelSurfaceStyle() const { return _voxelSurfaceStyle; }
|
||||||
|
|
||||||
static const glm::vec3 DEFAULT_VOXEL_VOLUME_SIZE;
|
static const glm::vec3 DEFAULT_VOXEL_VOLUME_SIZE;
|
||||||
static const QByteArray DEFAULT_VOXEL_DATA;
|
static const QByteArray DEFAULT_VOXEL_DATA;
|
||||||
static const int DEFAULT_VOXEL_SURFACE_STYLE;
|
static const PolyVoxSurfaceStyle DEFAULT_VOXEL_SURFACE_STYLE;
|
||||||
|
|
||||||
// coords are in voxel-volume space
|
// coords are in voxel-volume space
|
||||||
virtual void setSphereInVolume(glm::vec3 center, float radius, uint8_t toValue) {}
|
virtual void setSphereInVolume(glm::vec3 center, float radius, uint8_t toValue) {}
|
||||||
|
@ -84,7 +92,7 @@ class PolyVoxEntityItem : public EntityItem {
|
||||||
rgbColor _color;
|
rgbColor _color;
|
||||||
glm::vec3 _voxelVolumeSize; // this is always 3 bytes
|
glm::vec3 _voxelVolumeSize; // this is always 3 bytes
|
||||||
QByteArray _voxelData;
|
QByteArray _voxelData;
|
||||||
uint16_t _voxelSurfaceStyle;
|
PolyVoxSurfaceStyle _voxelSurfaceStyle;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_PolyVoxEntityItem_h
|
#endif // hifi_PolyVoxEntityItem_h
|
||||||
|
|
Loading…
Reference in a new issue