mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-15 15:26:25 +02:00
More work on voxelizing.
This commit is contained in:
parent
4375fe85f1
commit
407a6ecc70
3 changed files with 28 additions and 10 deletions
|
@ -69,13 +69,13 @@ SharedObjectPointer MetavoxelSystem::findFirstRaySpannerIntersection(
|
|||
return closestSpanner;
|
||||
}
|
||||
|
||||
void MetavoxelSystem::applyEdit(const MetavoxelEditMessage& edit) {
|
||||
void MetavoxelSystem::applyEdit(const MetavoxelEditMessage& edit, bool reliable) {
|
||||
foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) {
|
||||
if (node->getType() == NodeType::MetavoxelServer) {
|
||||
QMutexLocker locker(&node->getMutex());
|
||||
MetavoxelClient* client = static_cast<MetavoxelClient*>(node->getLinkedData());
|
||||
if (client) {
|
||||
client->applyEdit(edit);
|
||||
client->applyEdit(edit, reliable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -267,12 +267,17 @@ void MetavoxelClient::guide(MetavoxelVisitor& visitor) {
|
|||
_data.guide(visitor);
|
||||
}
|
||||
|
||||
void MetavoxelClient::applyEdit(const MetavoxelEditMessage& edit) {
|
||||
// apply immediately to local tree
|
||||
edit.apply(_data, _sequencer.getWeakSharedObjectHash());
|
||||
void MetavoxelClient::applyEdit(const MetavoxelEditMessage& edit, bool reliable) {
|
||||
if (reliable) {
|
||||
_sequencer.getReliableOutputChannel()->sendMessage(QVariant::fromValue(edit));
|
||||
|
||||
} else {
|
||||
// apply immediately to local tree
|
||||
edit.apply(_data, _sequencer.getWeakSharedObjectHash());
|
||||
|
||||
// start sending it out
|
||||
_sequencer.sendHighPriorityMessage(QVariant::fromValue(edit));
|
||||
// start sending it out
|
||||
_sequencer.sendHighPriorityMessage(QVariant::fromValue(edit));
|
||||
}
|
||||
}
|
||||
|
||||
void MetavoxelClient::simulate(float deltaTime) {
|
||||
|
|
|
@ -38,7 +38,7 @@ public:
|
|||
SharedObjectPointer findFirstRaySpannerIntersection(const glm::vec3& origin, const glm::vec3& direction,
|
||||
const AttributePointer& attribute, float& distance);
|
||||
|
||||
void applyEdit(const MetavoxelEditMessage& edit);
|
||||
Q_INVOKABLE void applyEdit(const MetavoxelEditMessage& edit, bool reliable = false);
|
||||
|
||||
void simulate(float deltaTime);
|
||||
void render();
|
||||
|
@ -98,7 +98,7 @@ public:
|
|||
|
||||
void guide(MetavoxelVisitor& visitor);
|
||||
|
||||
void applyEdit(const MetavoxelEditMessage& edit);
|
||||
void applyEdit(const MetavoxelEditMessage& edit, bool reliable = false);
|
||||
|
||||
void simulate(float deltaTime);
|
||||
|
||||
|
|
|
@ -675,6 +675,8 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
void voxelize(const glm::vec3& minimum);
|
||||
|
||||
float _size;
|
||||
Box _bounds;
|
||||
QVector<DirectionImages> _directionImages;
|
||||
|
@ -687,7 +689,18 @@ Voxelizer::Voxelizer(float size, const Box& bounds, const QVector<DirectionImage
|
|||
}
|
||||
|
||||
void Voxelizer::run() {
|
||||
|
||||
// voxelize separately each cell within the bounds
|
||||
float halfSize = _size * 0.5f;
|
||||
for (float x = _bounds.minimum.x + halfSize; x < _bounds.maximum.x; x += _size) {
|
||||
for (float y = _bounds.minimum.y + halfSize; y < _bounds.maximum.y; y += _size) {
|
||||
for (float z = _bounds.minimum.z + halfSize; z < _bounds.maximum.z; z += _size) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Voxelizer::voxelize(const glm::vec3& minimum) {
|
||||
}
|
||||
|
||||
void SetSpannerTool::applyEdit(const AttributePointer& attribute, const SharedObjectPointer& spanner) {
|
||||
|
|
Loading…
Reference in a new issue