more voxelEctomy

This commit is contained in:
ZappoMan 2014-12-30 19:58:04 -08:00
parent f1de9cabe9
commit 27d8ccb51e
18 changed files with 80 additions and 85 deletions

View file

@ -6,7 +6,7 @@ include_glm()
# link in the shared libraries
link_hifi_libraries(
audio avatars octree voxels gpu model fbx entities metavoxels
audio avatars octree environment gpu model fbx entities metavoxels
networking animation shared script-engine embedded-webserver
physics
)

View file

@ -430,7 +430,7 @@ int OctreeSendThread::packetDistributor(OctreeQueryNode* nodeData, bool viewFrus
bool wantOcclusionCulling = nodeData->getWantOcclusionCulling();
CoverageMap* coverageMap = wantOcclusionCulling ? &nodeData->map : IGNORE_COVERAGE_MAP;
float voxelSizeScale = nodeData->getOctreeSizeScale();
float octreeSizeScale = nodeData->getOctreeSizeScale();
int boundaryLevelAdjustClient = nodeData->getBoundaryLevelAdjust();
int boundaryLevelAdjust = boundaryLevelAdjustClient + (viewFrustumChanged && nodeData->getWantLowResMoving()
@ -438,7 +438,7 @@ int OctreeSendThread::packetDistributor(OctreeQueryNode* nodeData, bool viewFrus
EncodeBitstreamParams params(INT_MAX, &nodeData->getCurrentViewFrustum(), wantColor,
WANT_EXISTS_BITS, DONT_CHOP, wantDelta, lastViewFrustum,
wantOcclusionCulling, coverageMap, boundaryLevelAdjust, voxelSizeScale,
wantOcclusionCulling, coverageMap, boundaryLevelAdjust, octreeSizeScale,
nodeData->getLastTimeBagEmpty(),
isFullScene, &nodeData->stats, _myServer->getJurisdiction(),
&nodeData->extraEncodeData);

View file

@ -561,7 +561,7 @@ void DomainServer::populateDefaultStaticAssignmentsExcludingTypes(const QSet<Ass
}
const NodeSet STATICALLY_ASSIGNED_NODES = NodeSet() << NodeType::AudioMixer
<< NodeType::AvatarMixer << NodeType::VoxelServer << NodeType::EntityServer
<< NodeType::AvatarMixer << NodeType::EntityServer
<< NodeType::MetavoxelServer;
void DomainServer::handleConnectRequest(const QByteArray& packet, const HifiSockAddr& senderSockAddr) {

View file

@ -107,7 +107,7 @@ endif()
add_executable(${TARGET_NAME} MACOSX_BUNDLE ${INTERFACE_SRCS} ${QM})
# link required hifi libraries
link_hifi_libraries(shared octree voxels gpu model fbx metavoxels networking entities avatars audio animation script-engine physics
link_hifi_libraries(shared octree environment gpu model fbx metavoxels networking entities avatars audio animation script-engine physics
render-utils entities-renderer)
# find any optional and required libraries

View file

@ -776,7 +776,7 @@ void Application::controlledBroadcastToNodes(const QByteArray& packet, const Nod
channel = BandwidthMeter::AVATARS;
break;
case NodeType::EntityServer:
channel = BandwidthMeter::VOXELS;
channel = BandwidthMeter::OCTREE;
break;
default:
continue;
@ -1602,10 +1602,6 @@ FaceTracker* Application::getActiveFaceTracker() {
(visage->isActive() ? static_cast<FaceTracker*>(visage.data()) : NULL)));
}
struct SendVoxelsOperationArgs {
const unsigned char* newBaseOctCode;
};
bool Application::exportEntities(const QString& filename, float x, float y, float z, float scale) {
QVector<EntityItem*> entities;
_entities.getTree()->findEntities(AACube(glm::vec3(x / (float)TREE_SCALE,
@ -2183,8 +2179,7 @@ int Application::sendNackPackets() {
nodeList->eachNode([&](const SharedNodePointer& node){
if (node->getActiveSocket()
&& (node->getType() == NodeType::VoxelServer || node->getType() == NodeType::EntityServer)) {
if (node->getActiveSocket() && node->getType() == NodeType::EntityServer) {
QUuid nodeUUID = node->getUUID();
@ -2424,7 +2419,7 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node
nodeList->writeUnverifiedDatagram(reinterpret_cast<const char*>(queryPacket), packetLength, node);
// Feed number of bytes to corresponding channel of the bandwidth meter
_bandwidthMeter.outputStream(BandwidthMeter::VOXELS).updateValue(packetLength);
_bandwidthMeter.outputStream(BandwidthMeter::OCTREE).updateValue(packetLength);
}
});
}
@ -3569,7 +3564,7 @@ int Application::parseOctreeStats(const QByteArray& packet, const SharedNodePoin
}
void Application::packetSent(quint64 length) {
_bandwidthMeter.outputStream(BandwidthMeter::VOXELS).updateValue(length);
_bandwidthMeter.outputStream(BandwidthMeter::OCTREE).updateValue(length);
}
void Application::loadScripts() {

View file

@ -48,7 +48,7 @@ namespace { // .cpp-local
BandwidthMeter::ChannelInfo BandwidthMeter::_CHANNELS[] = {
{ "Audio" , "Kbps", 8000.0 / 1024.0, 0x33cc99ff },
{ "Avatars" , "Kbps", 8000.0 / 1024.0, 0xffef40c0 },
{ "Voxels" , "Kbps", 8000.0 / 1024.0, 0xd0d0d0a0 },
{ "Octree" , "Kbps", 8000.0 / 1024.0, 0xd0d0d0a0 },
{ "Metavoxels", "Kbps", 8000.0 / 1024.0, 0xd0d0d0a0 }
};

View file

@ -34,7 +34,7 @@ public:
static size_t const N_STREAMS = N_CHANNELS * 2;
// Channel usage.
enum ChannelIndex { AUDIO, AVATARS, VOXELS, METAVOXELS };
enum ChannelIndex { AUDIO, AVATARS, OCTREE, METAVOXELS };
// Meta information held for a communication channel (bidirectional).
struct ChannelInfo {

View file

@ -28,10 +28,10 @@ OctreeStatsDialog::OctreeStatsDialog(QWidget* parent, NodeToOctreeSceneStats* mo
_model(model) {
_statCount = 0;
_voxelServerLabelsCount = 0;
_octreeServerLabelsCount = 0;
for (int i = 0; i < MAX_VOXEL_SERVERS; i++) {
_voxelServerLables[i] = 0;
_octreeServerLables[i] = 0;
_extraServerDetails[i] = LESS;
}
@ -46,9 +46,9 @@ OctreeStatsDialog::OctreeStatsDialog(QWidget* parent, NodeToOctreeSceneStats* mo
this->QDialog::setLayout(_form);
// Setup stat items
_serverVoxels = AddStatItem("Elements on Servers");
_localVoxels = AddStatItem("Local Elements");
_localVoxelsMemory = AddStatItem("Elements Memory");
_serverElements = AddStatItem("Elements on Servers");
_localElements = AddStatItem("Local Elements");
_localElementsMemory = AddStatItem("Elements Memory");
_sendingMode = AddStatItem("Sending Mode");
layout()->setSizeConstraint(QLayout::SetFixedSize);
@ -127,13 +127,13 @@ void OctreeStatsDialog::paintEvent(QPaintEvent* event) {
statsValue.precision(4);
// Octree Elements Memory Usage
label = _labels[_localVoxelsMemory];
label = _labels[_localElementsMemory];
statsValue.str("");
statsValue << "Elements RAM: " << OctreeElement::getTotalMemoryUsage() / 1000000.0f << "MB ";
label->setText(statsValue.str().c_str());
// Local Voxels
label = _labels[_localVoxels];
// Local Elements
label = _labels[_localElements];
unsigned long localTotal = OctreeElement::getNodeCount();
unsigned long localInternal = OctreeElement::getInternalNodeCount();
unsigned long localLeaves = OctreeElement::getLeafNodeCount();
@ -191,11 +191,11 @@ void OctreeStatsDialog::paintEvent(QPaintEvent* event) {
label = _labels[_sendingMode];
label->setText(sendingMode.str().c_str());
// Server Voxels
// Server Elements
QString serversTotalString = locale.toString((uint)totalNodes); // consider adding: .rightJustified(10, ' ');
QString serversInternalString = locale.toString((uint)totalInternal);
QString serversLeavesString = locale.toString((uint)totalLeaves);
label = _labels[_serverVoxels];
label = _labels[_serverElements];
statsValue.str("");
statsValue <<
"Total: " << qPrintable(serversTotalString) << " / " <<
@ -213,13 +213,13 @@ void OctreeStatsDialog::showAllOctreeServers() {
showOctreeServersOfType(serverCount, NodeType::EntityServer, "Entity",
Application::getInstance()->getEntityServerJurisdictions());
if (_voxelServerLabelsCount > serverCount) {
for (int i = serverCount; i < _voxelServerLabelsCount; i++) {
int serverLabel = _voxelServerLables[i];
if (_octreeServerLabelsCount > serverCount) {
for (int i = serverCount; i < _octreeServerLabelsCount; i++) {
int serverLabel = _octreeServerLables[i];
RemoveStatItem(serverLabel);
_voxelServerLables[i] = 0;
_octreeServerLables[i] = 0;
}
_voxelServerLabelsCount = serverCount;
_octreeServerLabelsCount = serverCount;
}
}
@ -235,14 +235,14 @@ void OctreeStatsDialog::showOctreeServersOfType(int& serverCount, NodeType_t ser
if (node->getType() == serverType) {
serverCount++;
if (serverCount > _voxelServerLabelsCount) {
if (serverCount > _octreeServerLabelsCount) {
char label[128] = { 0 };
sprintf(label, "%s Server %d", serverTypeName, serverCount);
int thisServerRow = _voxelServerLables[serverCount-1] = AddStatItem(label);
int thisServerRow = _octreeServerLables[serverCount-1] = AddStatItem(label);
_labels[thisServerRow]->setTextFormat(Qt::RichText);
_labels[thisServerRow]->setTextInteractionFlags(Qt::TextBrowserInteraction);
connect(_labels[thisServerRow], SIGNAL(linkActivated(const QString&)), this, SLOT(moreless(const QString&)));
_voxelServerLabelsCount++;
_octreeServerLabelsCount++;
}
std::stringstream serverDetails("");
@ -335,7 +335,7 @@ void OctreeStatsDialog::showOctreeServersOfType(int& serverCount, NodeType_t ser
serverDetails << "<br/>" << "Node UUID: " << qPrintable(nodeUUID.toString()) << " ";
serverDetails << "<br/>" << "Voxels: " <<
serverDetails << "<br/>" << "Elements: " <<
qPrintable(totalString) << " total " <<
qPrintable(internalString) << " internal " <<
qPrintable(leavesString) << " leaves ";
@ -399,7 +399,7 @@ void OctreeStatsDialog::showOctreeServersOfType(int& serverCount, NodeType_t ser
linkDetails << " " << " [<a href='most-" << serverCount << "'>most...</a>]";
}
serverDetails << linkDetails.str();
_labels[_voxelServerLables[serverCount - 1]]->setText(serverDetails.str().c_str());
_labels[_octreeServerLables[serverCount - 1]]->setText(serverDetails.str().c_str());
} // is VOXEL_SERVER
});
}

View file

@ -60,11 +60,11 @@ private:
int _statCount;
int _sendingMode;
int _serverVoxels;
int _localVoxels;
int _localVoxelsMemory;
int _voxelServerLables[MAX_VOXEL_SERVERS];
int _voxelServerLabelsCount;
int _serverElements;
int _localElements;
int _localElementsMemory;
int _octreeServerLables[MAX_VOXEL_SERVERS];
int _octreeServerLabelsCount;
details _extraServerDetails[MAX_VOXEL_SERVERS];
};

View file

@ -33,7 +33,7 @@ const int STATS_PELS_PER_LINE = 20;
const int STATS_GENERAL_MIN_WIDTH = 165;
const int STATS_PING_MIN_WIDTH = 190;
const int STATS_GEO_MIN_WIDTH = 240;
const int STATS_VOXEL_MIN_WIDTH = 410;
const int STATS_OCTREE_MIN_WIDTH = 410;
Stats* Stats::getInstance() {
static Stats stats;
@ -47,7 +47,7 @@ Stats::Stats():
_generalStatsWidth(STATS_GENERAL_MIN_WIDTH),
_pingStatsWidth(STATS_PING_MIN_WIDTH),
_geoStatsWidth(STATS_GEO_MIN_WIDTH),
_voxelStatsWidth(STATS_VOXEL_MIN_WIDTH),
_octreeStatsWidth(STATS_OCTREE_MIN_WIDTH),
_lastHorizontalOffset(0),
_metavoxelInternal(0),
_metavoxelLeaves(0),
@ -127,7 +127,7 @@ void Stats::resetWidth(int width, int horizontalOffset) {
- STATS_GENERAL_MIN_WIDTH
- (Menu::getInstance()->isOptionChecked(MenuOption::TestPing) ? STATS_PING_MIN_WIDTH -1 : 0)
- STATS_GEO_MIN_WIDTH
- STATS_VOXEL_MIN_WIDTH;
- STATS_OCTREE_MIN_WIDTH;
int panels = 4;
@ -139,7 +139,7 @@ void Stats::resetWidth(int width, int horizontalOffset) {
panels = 3;
}
_geoStatsWidth = STATS_GEO_MIN_WIDTH;
_voxelStatsWidth = STATS_VOXEL_MIN_WIDTH;
_octreeStatsWidth = STATS_OCTREE_MIN_WIDTH;
if (extraSpace > panels) {
_generalStatsWidth += (int) extraSpace / panels;
@ -147,7 +147,7 @@ void Stats::resetWidth(int width, int horizontalOffset) {
_pingStatsWidth += (int) extraSpace / panels;
}
_geoStatsWidth += (int) extraSpace / panels;
_voxelStatsWidth += glCanvas->width() - (_generalStatsWidth + _pingStatsWidth + _geoStatsWidth + 3);
_octreeStatsWidth += glCanvas->width() - (_generalStatsWidth + _pingStatsWidth + _geoStatsWidth + 3);
}
}
@ -204,7 +204,7 @@ void Stats::display(
int font = 2;
QLocale locale(QLocale::English);
std::stringstream voxelStats;
std::stringstream octreeStats;
if (_lastHorizontalOffset != horizontalOffset) {
resetWidth(glCanvas->width(), horizontalOffset);
@ -479,33 +479,33 @@ void Stats::display(
// Model/Entity render details
EntityTreeRenderer* entities = Application::getInstance()->getEntities();
voxelStats.str("");
voxelStats << "Entity Items rendered: " << entities->getItemsRendered()
octreeStats.str("");
octreeStats << "Entity Items rendered: " << entities->getItemsRendered()
<< " / Out of view:" << entities->getItemsOutOfView()
<< " / Too small:" << entities->getItemsTooSmall();
verticalOffset += STATS_PELS_PER_LINE;
drawText(horizontalOffset, verticalOffset, scale, rotation, font, (char*)voxelStats.str().c_str(), color);
drawText(horizontalOffset, verticalOffset, scale, rotation, font, (char*)octreeStats.str().c_str(), color);
if (_expanded) {
voxelStats.str("");
voxelStats << " Meshes rendered: " << entities->getMeshesRendered()
octreeStats.str("");
octreeStats << " Meshes rendered: " << entities->getMeshesRendered()
<< " / Out of view:" << entities->getMeshesOutOfView()
<< " / Too small:" << entities->getMeshesTooSmall();
verticalOffset += STATS_PELS_PER_LINE;
drawText(horizontalOffset, verticalOffset, scale, rotation, font, (char*)voxelStats.str().c_str(), color);
drawText(horizontalOffset, verticalOffset, scale, rotation, font, (char*)octreeStats.str().c_str(), color);
voxelStats.str("");
voxelStats << " Triangles: " << entities->getTrianglesRendered()
octreeStats.str("");
octreeStats << " Triangles: " << entities->getTrianglesRendered()
<< " / Quads:" << entities->getQuadsRendered()
<< " / Material Switches:" << entities->getMaterialSwitches();
verticalOffset += STATS_PELS_PER_LINE;
drawText(horizontalOffset, verticalOffset, scale, rotation, font, (char*)voxelStats.str().c_str(), color);
drawText(horizontalOffset, verticalOffset, scale, rotation, font, (char*)octreeStats.str().c_str(), color);
voxelStats.str("");
voxelStats << " Mesh Parts Rendered Opaque: " << entities->getOpaqueMeshPartsRendered()
octreeStats.str("");
octreeStats << " Mesh Parts Rendered Opaque: " << entities->getOpaqueMeshPartsRendered()
<< " / Translucent:" << entities->getTranslucentMeshPartsRendered();
verticalOffset += STATS_PELS_PER_LINE;
drawText(horizontalOffset, verticalOffset, scale, rotation, font, (char*)voxelStats.str().c_str(), color);
drawText(horizontalOffset, verticalOffset, scale, rotation, font, (char*)octreeStats.str().c_str(), color);
}
// iterate all the current voxel stats, and list their sending modes, and total voxel counts
@ -556,13 +556,13 @@ void Stats::display(
// Incoming packets
if (_expanded) {
voxelStats.str("");
octreeStats.str("");
QString packetsString = locale.toString((int)voxelPacketsToProcess);
QString maxString = locale.toString((int)_recentMaxPackets);
voxelStats << "Voxel Packets to Process: " << qPrintable(packetsString)
octreeStats << "Octree Packets to Process: " << qPrintable(packetsString)
<< " [Recent Max: " << qPrintable(maxString) << "]";
verticalOffset += STATS_PELS_PER_LINE;
drawText(horizontalOffset, verticalOffset, scale, rotation, font, (char*)voxelStats.str().c_str(), color);
drawText(horizontalOffset, verticalOffset, scale, rotation, font, (char*)octreeStats.str().c_str(), color);
}
if (_resetRecentMaxPacketsSoon && voxelPacketsToProcess > 0) {
@ -583,28 +583,28 @@ void Stats::display(
// Server Octree Elements
if (!_expanded) {
voxelStats.str("");
voxelStats << "Octree Elements Server: " << qPrintable(serversTotalString)
octreeStats.str("");
octreeStats << "Octree Elements Server: " << qPrintable(serversTotalString)
<< " Local:" << qPrintable(localTotalString);
verticalOffset += STATS_PELS_PER_LINE;
drawText(horizontalOffset, verticalOffset, scale, rotation, font, (char*)voxelStats.str().c_str(), color);
drawText(horizontalOffset, verticalOffset, scale, rotation, font, (char*)octreeStats.str().c_str(), color);
}
if (_expanded) {
voxelStats.str("");
voxelStats << "Octree Elements -";
octreeStats.str("");
octreeStats << "Octree Elements -";
verticalOffset += STATS_PELS_PER_LINE;
drawText(horizontalOffset, verticalOffset, scale, rotation, font, (char*)voxelStats.str().c_str(), color);
drawText(horizontalOffset, verticalOffset, scale, rotation, font, (char*)octreeStats.str().c_str(), color);
QString serversInternalString = locale.toString((uint)totalInternal);
QString serversLeavesString = locale.toString((uint)totalLeaves);
voxelStats.str("");
voxelStats << " Server: " << qPrintable(serversTotalString) <<
octreeStats.str("");
octreeStats << " Server: " << qPrintable(serversTotalString) <<
" Internal: " << qPrintable(serversInternalString) <<
" Leaves: " << qPrintable(serversLeavesString);
verticalOffset += STATS_PELS_PER_LINE;
drawText(horizontalOffset, verticalOffset, scale, rotation, font, (char*)voxelStats.str().c_str(), color);
drawText(horizontalOffset, verticalOffset, scale, rotation, font, (char*)octreeStats.str().c_str(), color);
// Local Voxels
unsigned long localInternal = OctreeElement::getInternalNodeCount();
@ -612,21 +612,21 @@ void Stats::display(
QString localInternalString = locale.toString((uint)localInternal);
QString localLeavesString = locale.toString((uint)localLeaves);
voxelStats.str("");
voxelStats << " Local: " << qPrintable(serversTotalString) <<
octreeStats.str("");
octreeStats << " Local: " << qPrintable(serversTotalString) <<
" Internal: " << qPrintable(localInternalString) <<
" Leaves: " << qPrintable(localLeavesString) << "";
verticalOffset += STATS_PELS_PER_LINE;
drawText(horizontalOffset, verticalOffset, scale, rotation, font, (char*)voxelStats.str().c_str(), color);
drawText(horizontalOffset, verticalOffset, scale, rotation, font, (char*)octreeStats.str().c_str(), color);
}
// LOD Details
if (_expanded) {
voxelStats.str("");
octreeStats.str("");
QString displayLODDetails = Menu::getInstance()->getLODFeedbackText();
voxelStats << "LOD: You can see " << qPrintable(displayLODDetails.trimmed());
octreeStats << "LOD: You can see " << qPrintable(displayLODDetails.trimmed());
verticalOffset += STATS_PELS_PER_LINE;
drawText(horizontalOffset, verticalOffset, scale, rotation, font, (char*)voxelStats.str().c_str(), color);
drawText(horizontalOffset, verticalOffset, scale, rotation, font, (char*)octreeStats.str().c_str(), color);
}
}

View file

@ -46,7 +46,7 @@ private:
int _generalStatsWidth;
int _pingStatsWidth;
int _geoStatsWidth;
int _voxelStatsWidth;
int _octreeStatsWidth;
int _lastHorizontalOffset;

View file

@ -5,7 +5,7 @@ setup_hifi_library(Network Script)
include_glm()
link_hifi_libraries(audio shared octree voxels networking physics gpu model fbx)
link_hifi_libraries(audio shared octree networking physics gpu model fbx)
# call macro to include our dependency includes and bubble them up via a property on our target
include_dependency_includes()

View file

@ -1,11 +1,11 @@
set(TARGET_NAME voxels)
set(TARGET_NAME environment)
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library(Widgets Script)
setup_hifi_library()
include_glm()
link_hifi_libraries(shared octree networking)
link_hifi_libraries(shared networking)
# find ZLIB
find_package(ZLIB REQUIRED)

View file

@ -5,7 +5,7 @@ setup_hifi_library()
include_glm()
link_hifi_libraries(shared gpu model networking octree voxels)
link_hifi_libraries(shared gpu model networking octree)
find_package(ZLIB REQUIRED)
include_directories(SYSTEM "${ZLIB_INCLUDE_DIRS}")

View file

@ -5,7 +5,7 @@ setup_hifi_library(Gui Network Script Widgets)
include_glm()
link_hifi_libraries(shared octree voxels gpu model fbx entities animation audio physics metavoxels)
link_hifi_libraries(shared octree gpu model fbx entities animation audio physics metavoxels)
# call macro to include our dependency includes and bubble them up via a property on our target
include_dependency_includes()

View file

@ -5,6 +5,6 @@ setup_hifi_project(Script Network)
include_glm()
# link in the shared libraries
link_hifi_libraries(shared octree voxels gpu model fbx metavoxels networking entities avatars audio animation script-engine physics)
link_hifi_libraries(shared octree gpu model fbx metavoxels networking entities avatars audio animation script-engine physics)
include_dependency_includes()