mirror of
https://github.com/lubosz/overte.git
synced 2025-04-07 10:42:12 +02:00
more voxel-ectomy cleaning up some remaining references to voxels
This commit is contained in:
parent
a88346467b
commit
b940dcfdb3
17 changed files with 15 additions and 244 deletions
|
@ -279,7 +279,7 @@ int OctreeSendThread::handlePacketSend(OctreeQueryNode* nodeData, int& trueBytes
|
|||
return packetsSent;
|
||||
}
|
||||
|
||||
/// Version of voxel distributor that sends the deepest LOD level at once
|
||||
/// Version of octree element distributor that sends the deepest LOD level at once
|
||||
int OctreeSendThread::packetDistributor(OctreeQueryNode* nodeData, bool viewFrustumChanged) {
|
||||
|
||||
OctreeServer::didPacketDistributor(this);
|
||||
|
@ -595,7 +595,7 @@ int OctreeSendThread::packetDistributor(OctreeQueryNode* nodeData, bool viewFrus
|
|||
//int elapsedCompressTimeMsecs = endCompressTimeMsecs - startCompressTimeMsecs;
|
||||
|
||||
// if after sending packets we've emptied our bag, then we want to remember that we've sent all
|
||||
// the voxels from the current view frustum
|
||||
// the octree elements from the current view frustum
|
||||
if (nodeData->elementBag.isEmpty()) {
|
||||
nodeData->updateLastKnownViewFrustum();
|
||||
nodeData->setViewSent(true);
|
||||
|
|
|
@ -88,7 +88,6 @@ MyAvatar::MyAvatar() :
|
|||
_shouldRender(true),
|
||||
_billboardValid(false),
|
||||
_physicsSimulation(),
|
||||
_voxelShapeManager(),
|
||||
_feetTouchFloor(true),
|
||||
_isLookingAtLeftEye(true)
|
||||
{
|
||||
|
@ -97,7 +96,6 @@ MyAvatar::MyAvatar() :
|
|||
_driveKeys[i] = 0.0f;
|
||||
}
|
||||
_physicsSimulation.setEntity(&_skeletonModel);
|
||||
_physicsSimulation.addEntity(&_voxelShapeManager);
|
||||
|
||||
_skeletonModel.setEnableShapes(true);
|
||||
_skeletonModel.buildRagdoll();
|
||||
|
@ -1928,9 +1926,6 @@ void MyAvatar::updateMotionBehavior() {
|
|||
} else {
|
||||
_motionBehaviors &= ~AVATAR_MOTION_STAND_ON_NEARBY_FLOORS;
|
||||
}
|
||||
if (!(_collisionGroups | COLLISION_GROUP_VOXELS)) {
|
||||
_voxelShapeManager.clearShapes();
|
||||
}
|
||||
if (menu->isOptionChecked(MenuOption::KeyboardMotorControl)) {
|
||||
_motionBehaviors |= AVATAR_MOTION_KEYBOARD_MOTOR_ENABLED;
|
||||
} else {
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include <PhysicsSimulation.h>
|
||||
|
||||
#include "Avatar.h"
|
||||
#include "VoxelShapeManager.h"
|
||||
|
||||
class ModelItemID;
|
||||
|
||||
|
@ -219,7 +218,6 @@ private:
|
|||
|
||||
QList<AnimationHandlePointer> _animationHandles;
|
||||
PhysicsSimulation _physicsSimulation;
|
||||
VoxelShapeManager _voxelShapeManager;
|
||||
|
||||
bool _feetTouchFloor;
|
||||
bool _isLookingAtLeftEye;
|
||||
|
|
|
@ -1,101 +0,0 @@
|
|||
//
|
||||
// VoxelShapeManager.cpp
|
||||
// interface/src/avatar
|
||||
//
|
||||
// Created by Andrew Meadows on 2014.09.02
|
||||
// Copyright 2012 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include <glm/gtx/norm.hpp>
|
||||
|
||||
#include <AACubeShape.h>
|
||||
#include <PhysicsSimulation.h>
|
||||
#include <SharedUtil.h>
|
||||
|
||||
#include "VoxelShapeManager.h"
|
||||
|
||||
VoxelShapeManager::VoxelShapeManager() : PhysicsEntity(), _updateExpiry(0), _lastSimulationTranslation(0.0f) {
|
||||
}
|
||||
|
||||
VoxelShapeManager::~VoxelShapeManager() {
|
||||
clearShapes();
|
||||
}
|
||||
|
||||
void VoxelShapeManager::stepForward(float deltaTime) {
|
||||
PhysicsSimulation* simulation = getSimulation();
|
||||
if (simulation) {
|
||||
glm::vec3 simulationOrigin = simulation->getTranslation();
|
||||
if (glm::distance2(_lastSimulationTranslation, simulationOrigin) > EPSILON) {
|
||||
VoxelPool::const_iterator voxelItr = _voxels.constBegin();
|
||||
while (voxelItr != _voxels.constEnd()) {
|
||||
// the shape's position is stored in the simulation-frame
|
||||
const VoxelInfo& voxel = voxelItr.value();
|
||||
voxel._shape->setTranslation(voxel._cube.calcCenter() - simulationOrigin);
|
||||
++voxelItr;
|
||||
}
|
||||
_lastSimulationTranslation = simulationOrigin;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VoxelShapeManager::buildShapes() {
|
||||
// the shapes are owned by the elements of _voxels,
|
||||
// so _shapes is constructed by harvesting them from _voxels
|
||||
_shapes.clear();
|
||||
VoxelPool::const_iterator voxelItr = _voxels.constBegin();
|
||||
while (voxelItr != _voxels.constEnd()) {
|
||||
_shapes.push_back(voxelItr.value()._shape);
|
||||
++voxelItr;
|
||||
}
|
||||
}
|
||||
|
||||
void VoxelShapeManager::clearShapes() {
|
||||
PhysicsEntity::clearShapes();
|
||||
_voxels.clear();
|
||||
}
|
||||
|
||||
void VoxelShapeManager::updateVoxels(const quint64& now, CubeList& cubes) {
|
||||
const quint64 VOXEL_UPDATE_PERIOD = 100000; // usec
|
||||
_updateExpiry = now + VOXEL_UPDATE_PERIOD;
|
||||
PhysicsSimulation* simulation = getSimulation();
|
||||
if (!simulation) {
|
||||
return;
|
||||
}
|
||||
|
||||
int numChanges = 0;
|
||||
VoxelPool::iterator voxelItr = _voxels.begin();
|
||||
while (voxelItr != _voxels.end()) {
|
||||
// look for this voxel in cubes
|
||||
CubeList::iterator cubeItr = cubes.find(voxelItr.key());
|
||||
if (cubeItr == cubes.end()) {
|
||||
// did not find it --> remove the voxel
|
||||
simulation->removeShape(voxelItr.value()._shape);
|
||||
voxelItr = _voxels.erase(voxelItr);
|
||||
++numChanges;
|
||||
} else {
|
||||
// found it --> remove the cube
|
||||
cubes.erase(cubeItr);
|
||||
voxelItr++;
|
||||
}
|
||||
}
|
||||
|
||||
// add remaining cubes to _voxels
|
||||
glm::vec3 simulationOrigin = simulation->getTranslation();
|
||||
CubeList::const_iterator cubeItr = cubes.constBegin();
|
||||
while (cubeItr != cubes.constEnd()) {
|
||||
AACube cube = cubeItr.value();
|
||||
AACubeShape* shape = new AACubeShape(cube.getScale(), cube.calcCenter() - simulationOrigin);
|
||||
shape->setEntity(this);
|
||||
VoxelInfo voxel = {cube, shape };
|
||||
_voxels.insert(cubeItr.key(), voxel);
|
||||
++numChanges;
|
||||
++cubeItr;
|
||||
}
|
||||
|
||||
if (numChanges > 0) {
|
||||
buildShapes();
|
||||
}
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
//
|
||||
// VoxelShapeManager.h
|
||||
// interface/src/avatar
|
||||
//
|
||||
// Created by Andrew Meadows on 2014.09.02
|
||||
// Copyright 2012 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#ifndef hifi_VoxelShapeManager_h
|
||||
#define hifi_VoxelShapeManager_h
|
||||
|
||||
#include <QHash>
|
||||
|
||||
#include <AACube.h>
|
||||
#include <PhysicsEntity.h>
|
||||
#include <Octree.h>
|
||||
|
||||
#include "VoxelShapeManager.h"
|
||||
|
||||
class AACubeShape;
|
||||
|
||||
class VoxelInfo{
|
||||
public:
|
||||
AACube _cube;
|
||||
AACubeShape* _shape;
|
||||
};
|
||||
|
||||
typedef QHash<uint, VoxelInfo> VoxelPool;
|
||||
|
||||
class VoxelShapeManager : public PhysicsEntity {
|
||||
public:
|
||||
VoxelShapeManager();
|
||||
~VoxelShapeManager();
|
||||
|
||||
void stepForward(float deltaTime);
|
||||
void buildShapes();
|
||||
void clearShapes();
|
||||
|
||||
bool needsUpdate(const quint64& now) const { return _updateExpiry < now; }
|
||||
|
||||
/// \param cubes list of AACubes representing all of the voxels that should be in this VoxelShapeManager
|
||||
void updateVoxels(const quint64& now, CubeList& cubes);
|
||||
|
||||
|
||||
private:
|
||||
quint64 _updateExpiry;
|
||||
glm::vec3 _lastSimulationTranslation;
|
||||
VoxelPool _voxels;
|
||||
};
|
||||
|
||||
#endif // hifi_VoxelShapeManager_h
|
|
@ -1,6 +1,6 @@
|
|||
//
|
||||
// OctreeFade.cpp
|
||||
// interface/src/voxels
|
||||
// interface/src/octree
|
||||
//
|
||||
// Created by Brad Hefta-Gaub on 8/6/13.
|
||||
// Copyright 2013 High Fidelity, Inc.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//
|
||||
// OctreeFade.h
|
||||
// interface/src/voxels
|
||||
// interface/src/octree
|
||||
//
|
||||
// Created by Brad Hefta-Gaub on 8/6/13.
|
||||
// Copyright 2013 High Fidelity, Inc.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//
|
||||
// OctreePacketProcessor.cpp
|
||||
// interface/src/voxels
|
||||
// interface/src/octree
|
||||
//
|
||||
// Created by Brad Hefta-Gaub on 8/12/13.
|
||||
// Copyright 2013 High Fidelity, Inc.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//
|
||||
// OctreePacketProcessor.h
|
||||
// interface/src/voxels
|
||||
// interface/src/octree
|
||||
//
|
||||
// Created by Brad Hefta-Gaub on 8/12/13.
|
||||
// Copyright 2013 High Fidelity, Inc.
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "ClipboardScriptingInterface.h"
|
||||
|
||||
ClipboardScriptingInterface::ClipboardScriptingInterface() {
|
||||
connect(this, SIGNAL(readyToImport()), Application::getInstance(), SLOT(importVoxels()));
|
||||
}
|
||||
|
||||
bool ClipboardScriptingInterface::exportEntities(const QString& filename, float x, float y, float z, float s) {
|
||||
|
|
|
@ -148,7 +148,7 @@ void OctreeStatsDialog::paintEvent(QPaintEvent* event) {
|
|||
"Leaves: " << qPrintable(localLeavesString) << "";
|
||||
label->setText(statsValue.str().c_str());
|
||||
|
||||
// iterate all the current voxel stats, and list their sending modes, total their voxels, etc...
|
||||
// iterate all the current octree stats, and list their sending modes, total their octree elements, etc...
|
||||
std::stringstream sendingMode("");
|
||||
|
||||
int serverCount = 0;
|
||||
|
|
|
@ -144,7 +144,7 @@ void PreferencesDialog::loadPreferences() {
|
|||
|
||||
ui.avatarScaleSpin->setValue(myAvatar->getScale());
|
||||
|
||||
ui.maxVoxelsPPSSpin->setValue(menuInstance->getMaxOctreePacketsPerSecond());
|
||||
ui.maxOctreePPSSpin->setValue(menuInstance->getMaxOctreePacketsPerSecond());
|
||||
|
||||
ui.oculusUIAngularSizeSpin->setValue(menuInstance->getOculusUIAngularSize());
|
||||
|
||||
|
@ -225,7 +225,7 @@ void PreferencesDialog::savePreferences() {
|
|||
|
||||
Menu::getInstance()->setFaceshiftHostname(ui.faceshiftHostnameEdit->text());
|
||||
|
||||
Menu::getInstance()->setMaxOctreePacketsPerSecond(ui.maxVoxelsPPSSpin->value());
|
||||
Menu::getInstance()->setMaxOctreePacketsPerSecond(ui.maxOctreePPSSpin->value());
|
||||
|
||||
Menu::getInstance()->setOculusUIAngularSize(ui.oculusUIAngularSizeSpin->value());
|
||||
|
||||
|
|
|
@ -1837,65 +1837,6 @@
|
|||
<property name="bottomMargin">
|
||||
<number>7</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Maximum voxels</string>
|
||||
</property>
|
||||
<property name="indent">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>maxVoxelsSpin</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_8">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="maxVoxelsSpin">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>5000000</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>50000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||
<property name="spacing">
|
||||
|
@ -1924,7 +1865,7 @@
|
|||
<number>0</number>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>maxVoxelsPPSSpin</cstring>
|
||||
<cstring>maxOctreePPSSpin</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -1947,7 +1888,7 @@
|
|||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="maxVoxelsPPSSpin">
|
||||
<widget class="QSpinBox" name="maxOctreePPSSpin">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
|
@ -2032,9 +1973,6 @@
|
|||
<property name="indent">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>maxVoxelsSpin</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -2174,9 +2112,6 @@
|
|||
<property name="indent">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>maxVoxelsSpin</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
|
|
@ -32,8 +32,7 @@ EntityTreeElement::~EntityTreeElement() {
|
|||
|
||||
// This will be called primarily on addChildAt(), which means we're adding a child of our
|
||||
// own type to our own tree. This means we should initialize that child with any tree and type
|
||||
// specific settings that our children must have. One example is out VoxelSystem, which
|
||||
// we know must match ours.
|
||||
// specific settings that our children must have.
|
||||
OctreeElement* EntityTreeElement::createNewElement(unsigned char* octalCode) {
|
||||
EntityTreeElement* newChild = new EntityTreeElement(octalCode);
|
||||
newChild->setTree(_myTree);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//
|
||||
// EnvironmentData.cpp
|
||||
// libraries/voxels/src
|
||||
// libraries/environment/src
|
||||
//
|
||||
// Created by Andrzej Kapolka on 5/6/13.
|
||||
// Copyright 2013 High Fidelity, Inc.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//
|
||||
// EnvironmentData.h
|
||||
// libraries/voxels/src
|
||||
// libraries/environment/src
|
||||
//
|
||||
// Created by Andrzej Kapolka on 5/6/13.
|
||||
// Copyright 2013 High Fidelity, Inc.
|
||||
|
|
|
@ -126,6 +126,6 @@ const PacketVersion VERSION_ENTITIES_HAS_FILE_BREAKS = VERSION_ENTITIES_SUPPORT_
|
|||
const PacketVersion VERSION_ENTITIES_SUPPORT_DIMENSIONS = 4;
|
||||
const PacketVersion VERSION_ENTITIES_MODELS_HAVE_ANIMATION_SETTINGS = 5;
|
||||
const PacketVersion VERSION_ENTITIES_HAVE_USER_DATA = 6;
|
||||
const PacketVersion VERSION_VOXELS_HAS_FILE_BREAKS = 1;
|
||||
const PacketVersion VERSION_OCTREE_HAS_FILE_BREAKS = 1;
|
||||
|
||||
#endif // hifi_PacketHeaders_h
|
||||
|
|
Loading…
Reference in a new issue