Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions cmake/macros/TargetPolyvox.cmake

This file was deleted.

1 change: 0 additions & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ def requirements(self):
self.requires("openvr/2.2.3@overte/stable")
self.requires("openxr/1.1.46@overte/stable")
self.requires("opus/1.4")
self.requires("polyvox/2025.09.19@overte/experimental#76ce908c1078988dceae5ad32ead2909")
self.requires("quazip/1.4")
self.requires("scribe/2019.02@overte/stable")
self.requires("sdl/2.32.8")
Expand Down
3 changes: 0 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@

artery-font-format = pkgs.callPackage ./nix/artery-font-format.nix { };

polyvox = pkgs.callPackage ./nix/polyvox.nix { };

gif_creator = pkgs.callPackage ./nix/gif_creator.nix { };

scribe = pkgs.callPackage ./nix/scribe.nix { };
Expand All @@ -42,7 +40,6 @@
glad
scribe
gif_creator
polyvox
artery-font-format
cgltf
etc2comp
Expand Down
1 change: 0 additions & 1 deletion libraries/entities-renderer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ include_hifi_library_headers(graphics-scripting) # for Forward.h
include_hifi_library_headers(entities)

target_bullet()
target_polyvox()

if (WIN32)
add_compile_definitions(_USE_MATH_DEFINES)
Expand Down
1,243 changes: 899 additions & 344 deletions libraries/entities-renderer/src/RenderablePolyVoxEntityItem.cpp

Large diffs are not rendered by default.

105 changes: 61 additions & 44 deletions libraries/entities-renderer/src/RenderablePolyVoxEntityItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@

#include <QSemaphore>

#include <PolyVoxCore/SimpleVolume.h>
#include <PolyVoxCore/Raycast.h>

#include <gpu/Forward.h>
#include <gpu/Context.h>
#include <graphics/Forward.h>
Expand All @@ -30,10 +27,12 @@

namespace render { namespace entities {
class PolyVoxEntityRenderer;
} }
}} // namespace render::entities

class VoxelVolume;

enum class PolyVoxState {
enum class PolyVoxState
{
Ready,
Uncompressing,
UncompressingFinished,
Expand All @@ -49,7 +48,6 @@ enum class PolyVoxState {

QDebug operator<<(QDebug debug, PolyVoxState state);


class RenderablePolyVoxEntityItem : public PolyVoxEntityItem, public scriptable::ModelProvider {
friend class render::entities::PolyVoxEntityRenderer;

Expand All @@ -70,14 +68,25 @@ class RenderablePolyVoxEntityItem : public PolyVoxEntityItem, public scriptable:
int getOnCount() const override { return _onCount; }

virtual bool supportsDetailedIntersection() const override { return true; }
virtual bool findDetailedRayIntersection(const glm::vec3& origin, const glm::vec3& direction,
const glm::vec3& viewFrustumPos, OctreeElementPointer& element, float& distance,
BoxFace& face, glm::vec3& surfaceNormal,
QVariantMap& extraInfo, bool precisionPicking) const override;
virtual bool findDetailedParabolaIntersection(const glm::vec3& origin, const glm::vec3& velocity, const vec3& accleration,
const glm::vec3& viewFrustumPos, OctreeElementPointer& element,
float& parabolicDistance, BoxFace& face, glm::vec3& surfaceNormal,
QVariantMap& extraInfo, bool precisionPicking) const override;
virtual bool findDetailedRayIntersection(const glm::vec3& origin,
const glm::vec3& direction,
const glm::vec3& viewFrustumPos,
OctreeElementPointer& element,
float& distance,
BoxFace& face,
glm::vec3& surfaceNormal,
QVariantMap& extraInfo,
bool precisionPicking) const override;
virtual bool findDetailedParabolaIntersection(const glm::vec3& origin,
const glm::vec3& velocity,
const vec3& accleration,
const glm::vec3& viewFrustumPos,
OctreeElementPointer& element,
float& parabolicDistance,
BoxFace& face,
glm::vec3& surfaceNormal,
QVariantMap& extraInfo,
bool precisionPicking) const override;

virtual void setVoxelData(const QByteArray& voxelData) override;
virtual void setVoxelVolumeSize(const glm::vec3& voxelVolumeSize) override;
Expand All @@ -93,8 +102,10 @@ class RenderablePolyVoxEntityItem : public PolyVoxEntityItem, public scriptable:

// coords are in world-space
virtual bool setSphere(const vec3& center, float radius, uint8_t toValue) override;
virtual bool setCapsule(const vec3& startWorldCoords, const vec3& endWorldCoords,
float radiusWorldCoords, uint8_t toValue) override;
virtual bool setCapsule(const vec3& startWorldCoords,
const vec3& endWorldCoords,
float radiusWorldCoords,
uint8_t toValue) override;
virtual bool setAll(uint8_t toValue) override;
virtual bool setCuboid(const vec3& lowPosition, const vec3& cuboidSize, int toValue) override;

Expand All @@ -121,26 +132,33 @@ class RenderablePolyVoxEntityItem : public PolyVoxEntityItem, public scriptable:

void setMesh(graphics::MeshPointer mesh);
void setCollisionPoints(ShapeInfo::PointCollection points, AABox box);
PolyVox::SimpleVolume<uint8_t>* getVolData() { return _volData.get(); }

uint8_t getVoxelInternal(const ivec3& v) const;
bool setVoxelInternal(const ivec3& v, uint8_t toValue);
void setVoxelMarkNeighbors(int x, int y, int z, uint8_t toValue);

void compressVolumeDataFinished(const QByteArray& voxelData);
void neighborXEdgeChanged() { withWriteLock([&] { _updateFromNeighborXEdge = true; }); startUpdates(); }
void neighborYEdgeChanged() { withWriteLock([&] { _updateFromNeighborYEdge = true; }); startUpdates(); }
void neighborZEdgeChanged() { withWriteLock([&] { _updateFromNeighborZEdge = true; }); startUpdates(); }

bool getMeshes(MeshProxyList& result) override; // deprecated
void neighborXEdgeChanged() {
withWriteLock([&] { _updateFromNeighborXEdge = true; });
startUpdates();
}
void neighborYEdgeChanged() {
withWriteLock([&] { _updateFromNeighborYEdge = true; });
startUpdates();
}
void neighborZEdgeChanged() {
withWriteLock([&] { _updateFromNeighborZEdge = true; });
startUpdates();
}

bool getMeshes(MeshProxyList& result) override; // deprecated
virtual scriptable::ScriptableModelBase getScriptableModel() override;

virtual void update(const quint64& now) override;
bool needsToCallUpdate() const override { return _updateNeeded; }

private:
bool updateOnCount(const ivec3& v, uint8_t toValue);
PolyVox::RaycastResult doRayCast(glm::vec4 originInVoxel, glm::vec4 farInVoxel, glm::vec4& result) const;

void changeUpdates(bool value);
void startUpdates();
Expand All @@ -159,33 +177,33 @@ class RenderablePolyVoxEntityItem : public PolyVoxEntityItem, public scriptable:

// The PolyVoxEntityItem class has _voxelData which contains dimensions and compressed voxel data. The dimensions
// may not match _voxelVolumeSize.
bool _meshReady { false }; // do we have something to give scripts that ask for the mesh?
bool _voxelDataDirty { false }; // do we need to uncompress data and expand it into _volData?
bool _volDataDirty { false }; // does recomputeMesh need to be called?
bool _shapeReady { false }; // are we ready to tell bullet our shape?
PolyVoxState _state { PolyVoxState::Ready };
bool _updateNeeded { true };
bool _meshReady{ false }; // do we have something to give scripts that ask for the mesh?
bool _voxelDataDirty{ false }; // do we need to uncompress data and expand it into _volData?
bool _volDataDirty{ false }; // does recomputeMesh need to be called?
bool _shapeReady{ false }; // are we ready to tell bullet our shape?
PolyVoxState _state{ PolyVoxState::Ready };
bool _updateNeeded{ true };

graphics::MeshPointer _mesh;

ShapeInfo _shapeInfo;

std::shared_ptr<PolyVox::SimpleVolume<uint8_t>> _volData;
int _onCount; // how many non-zero voxels are in _volData
std::shared_ptr<VoxelVolume> _volData;
int _onCount; // how many non-zero voxels are in _volData

bool _neighborXNeedsUpdate { false };
bool _neighborYNeedsUpdate { false };
bool _neighborZNeedsUpdate { false };
bool _neighborXNeedsUpdate{ false };
bool _neighborYNeedsUpdate{ false };
bool _neighborZNeedsUpdate{ false };

bool _updateFromNeighborXEdge { false };
bool _updateFromNeighborYEdge { false };
bool _updateFromNeighborZEdge { false };
bool _updateFromNeighborXEdge{ false };
bool _updateFromNeighborYEdge{ false };
bool _updateFromNeighborZEdge{ false };

// these are cached lookups of _xNNeighborID, _yNNeighborID, _zNNeighborID, _xPNeighborID, _yPNeighborID, _zPNeighborID
EntityItemWeakPointer _xNNeighbor; // neighbor found by going along negative X axis
EntityItemWeakPointer _xNNeighbor; // neighbor found by going along negative X axis
EntityItemWeakPointer _yNNeighbor;
EntityItemWeakPointer _zNNeighbor;
EntityItemWeakPointer _xPNeighbor; // neighbor found by going along positive X axis
EntityItemWeakPointer _xPNeighbor; // neighbor found by going along positive X axis
EntityItemWeakPointer _yPNeighbor;
EntityItemWeakPointer _zPNeighbor;
};
Expand Down Expand Up @@ -218,13 +236,12 @@ class PolyVoxEntityRenderer : public TypedEntityRenderer<RenderablePolyVoxEntity
glm::mat4 _lastVoxelToLocalMatrix;
glm::vec3 _position;
glm::quat _orientation;
PolyVoxEntityItem::PolyVoxSurfaceStyle _lastSurfaceStyle { PolyVoxEntityItem::SURFACE_MARCHING_CUBES };
PolyVoxEntityItem::PolyVoxSurfaceStyle _lastSurfaceStyle{ PolyVoxEntityItem::SURFACE_MARCHING_CUBES };
std::array<QString, 3> _xyzTextureUrls;

gpu::BufferPointer _colorBuffer { std::make_shared<gpu::Buffer>(gpu::Buffer::VertexBuffer) };
gpu::BufferPointer _colorBuffer{ std::make_shared<gpu::Buffer>(gpu::Buffer::VertexBuffer) };
};

} }

}} // namespace render::entities

#endif // hifi_RenderablePolyVoxEntityItem_h
#endif // hifi_RenderablePolyVoxEntityItem_h
2 changes: 0 additions & 2 deletions nix/overte.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
# dependencies
glad,
gif_creator,
polyvox,
artery-font-format,
cgltf,
etc2comp,
Expand Down Expand Up @@ -80,7 +79,6 @@ stdenv.mkDerivation {
glad
etc2comp
cgltf
polyvox
gif_creator
artery-font-format
openssl
Expand Down
20 changes: 0 additions & 20 deletions nix/polyvox.nix

This file was deleted.

Loading