mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 04:57:58 +02:00
back out previous experiment
This commit is contained in:
parent
1e81edbaea
commit
7a31a99e3c
2 changed files with 28 additions and 41 deletions
|
@ -40,7 +40,6 @@
|
||||||
#include <PolyVoxCore/SurfaceMesh.h>
|
#include <PolyVoxCore/SurfaceMesh.h>
|
||||||
#include <PolyVoxCore/SimpleVolume.h>
|
#include <PolyVoxCore/SimpleVolume.h>
|
||||||
#include <PolyVoxCore/Material.h>
|
#include <PolyVoxCore/Material.h>
|
||||||
#include <PolyVoxCore/VolumeResampler.h>
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
|
@ -1129,48 +1128,36 @@ void RenderablePolyVoxEntityItem::getMesh() {
|
||||||
// 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;
|
||||||
|
|
||||||
PolyVox::SimpleVolume<uint8_t>* volData = nullptr;
|
|
||||||
|
|
||||||
entity->withReadLock([&] {
|
entity->withReadLock([&] {
|
||||||
PolyVox::SimpleVolume<uint8_t>* entityVolData = entity->getVolData();
|
PolyVox::SimpleVolume<uint8_t>* volData = entity->getVolData();
|
||||||
PolyVox::Region region = entityVolData->getEnclosingRegion();
|
switch (voxelSurfaceStyle) {
|
||||||
volData = new PolyVox::SimpleVolume<uint8_t>(region);
|
case PolyVoxEntityItem::SURFACE_EDGED_MARCHING_CUBES: {
|
||||||
volData->setBorderValue(255);
|
PolyVox::MarchingCubesSurfaceExtractor<PolyVox::SimpleVolume<uint8_t>> surfaceExtractor
|
||||||
PolyVox::VolumeResampler<PolyVox::SimpleVolume<uint8_t>,
|
(volData, volData->getEnclosingRegion(), &polyVoxMesh);
|
||||||
PolyVox::SimpleVolume<uint8_t>> copier =
|
surfaceExtractor.execute();
|
||||||
PolyVox::VolumeResampler<PolyVox::SimpleVolume<uint8_t>,
|
break;
|
||||||
PolyVox::SimpleVolume<uint8_t>>(entityVolData, region, volData, region);
|
}
|
||||||
copier.execute();
|
case PolyVoxEntityItem::SURFACE_MARCHING_CUBES: {
|
||||||
|
PolyVox::MarchingCubesSurfaceExtractor<PolyVox::SimpleVolume<uint8_t>> surfaceExtractor
|
||||||
|
(volData, volData->getEnclosingRegion(), &polyVoxMesh);
|
||||||
|
surfaceExtractor.execute();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PolyVoxEntityItem::SURFACE_EDGED_CUBIC: {
|
||||||
|
PolyVox::CubicSurfaceExtractorWithNormals<PolyVox::SimpleVolume<uint8_t>> surfaceExtractor
|
||||||
|
(volData, volData->getEnclosingRegion(), &polyVoxMesh);
|
||||||
|
surfaceExtractor.execute();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PolyVoxEntityItem::SURFACE_CUBIC: {
|
||||||
|
PolyVox::CubicSurfaceExtractorWithNormals<PolyVox::SimpleVolume<uint8_t>> surfaceExtractor
|
||||||
|
(volData, volData->getEnclosingRegion(), &polyVoxMesh);
|
||||||
|
surfaceExtractor.execute();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
switch (voxelSurfaceStyle) {
|
|
||||||
case PolyVoxEntityItem::SURFACE_EDGED_MARCHING_CUBES: {
|
|
||||||
PolyVox::MarchingCubesSurfaceExtractor<PolyVox::SimpleVolume<uint8_t>> surfaceExtractor
|
|
||||||
(volData, volData->getEnclosingRegion(), &polyVoxMesh);
|
|
||||||
surfaceExtractor.execute();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PolyVoxEntityItem::SURFACE_MARCHING_CUBES: {
|
|
||||||
PolyVox::MarchingCubesSurfaceExtractor<PolyVox::SimpleVolume<uint8_t>> surfaceExtractor
|
|
||||||
(volData, volData->getEnclosingRegion(), &polyVoxMesh);
|
|
||||||
surfaceExtractor.execute();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PolyVoxEntityItem::SURFACE_EDGED_CUBIC: {
|
|
||||||
PolyVox::CubicSurfaceExtractorWithNormals<PolyVox::SimpleVolume<uint8_t>> surfaceExtractor
|
|
||||||
(volData, volData->getEnclosingRegion(), &polyVoxMesh);
|
|
||||||
surfaceExtractor.execute();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PolyVoxEntityItem::SURFACE_CUBIC: {
|
|
||||||
PolyVox::CubicSurfaceExtractorWithNormals<PolyVox::SimpleVolume<uint8_t>> surfaceExtractor
|
|
||||||
(volData, volData->getEnclosingRegion(), &polyVoxMesh);
|
|
||||||
surfaceExtractor.execute();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
delete volData;
|
|
||||||
|
|
||||||
// convert PolyVox mesh to a Sam mesh
|
// convert PolyVox mesh to a Sam mesh
|
||||||
const std::vector<uint32_t>& vecIndices = polyVoxMesh.getIndices();
|
const std::vector<uint32_t>& vecIndices = polyVoxMesh.getIndices();
|
||||||
auto indexBuffer = std::make_shared<gpu::Buffer>(vecIndices.size() * sizeof(uint32_t),
|
auto indexBuffer = std::make_shared<gpu::Buffer>(vecIndices.size() * sizeof(uint32_t),
|
||||||
|
|
|
@ -545,7 +545,7 @@ bool OpenVrDisplayPlugin::beginFrameRender(uint32_t frameIndex) {
|
||||||
// HACK: when interface is launched and steam vr is NOT running, openvr will return bad HMD poses for a few frames
|
// HACK: when interface is launched and steam vr is NOT running, openvr will return bad HMD poses for a few frames
|
||||||
// To workaround this, filter out any hmd poses that are obviously bad, i.e. beneath the floor.
|
// To workaround this, filter out any hmd poses that are obviously bad, i.e. beneath the floor.
|
||||||
if (isBadPose(&nextSimPoseData.vrPoses[vr::k_unTrackedDeviceIndex_Hmd].mDeviceToAbsoluteTracking)) {
|
if (isBadPose(&nextSimPoseData.vrPoses[vr::k_unTrackedDeviceIndex_Hmd].mDeviceToAbsoluteTracking)) {
|
||||||
qDebug() << "WARNING: ignoring bad hmd pose from openvr";
|
// qDebug() << "WARNING: ignoring bad hmd pose from openvr";
|
||||||
|
|
||||||
// use the last known good HMD pose
|
// use the last known good HMD pose
|
||||||
nextSimPoseData.vrPoses[vr::k_unTrackedDeviceIndex_Hmd].mDeviceToAbsoluteTracking = _lastGoodHMDPose;
|
nextSimPoseData.vrPoses[vr::k_unTrackedDeviceIndex_Hmd].mDeviceToAbsoluteTracking = _lastGoodHMDPose;
|
||||||
|
|
Loading…
Reference in a new issue