Exemplo n.º 1
0
void OSystem_SDL::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {

#ifdef DATA_PATH
	// Add the global DATA_PATH to the directory search list
	// FIXME: We use depth = 4 for now, to match the old code. May want to change that
	Common::FSNode dataNode(DATA_PATH);
	if (dataNode.exists() && dataNode.isDirectory()) {
		s.add(DATA_PATH, new Common::FSDirectory(dataNode, 4), priority);
	}
#endif

#ifdef MACOSX
	// Get URL of the Resource directory of the .app bundle
	CFURLRef fileUrl = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());
	if (fileUrl) {
		// Try to convert the URL to an absolute path
		UInt8 buf[MAXPATHLEN];
		if (CFURLGetFileSystemRepresentation(fileUrl, true, buf, sizeof(buf))) {
			// Success: Add it to the search path
			Common::String bundlePath((const char *)buf);
			s.add("__OSX_BUNDLE__", new Common::FSDirectory(bundlePath), priority);
		}
		CFRelease(fileUrl);
	}

#endif

}
Exemplo n.º 2
0
void OSystem_SDL::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {

#ifdef DATA_PATH
	// Add the global DATA_PATH to the directory search list
	// FIXME: We use depth = 4 for now, to match the old code. May want to change that
	Common::FSNode dataNode(DATA_PATH);
	if (dataNode.exists() && dataNode.isDirectory()) {
		s.add(DATA_PATH, new Common::FSDirectory(dataNode, 4), priority);
	}
#endif

}
Exemplo n.º 3
0
void HandsModel::updateskeletonTree()
{
	m_rightHandExist = false;
	m_leftHandExist = false;

	// Iterate over hands
	int numOfHands = m_handData->QueryNumberOfHands();
	for (int index = 0; index < numOfHands; ++index)
	{
		// Get hand by access order of entering time
		PXCHandData::IHand* handOutput = NULL;
		if (m_handData->QueryHandData(PXCHandData::ACCESS_ORDER_BY_TIME, index, handOutput) == PXC_STATUS_NO_ERROR)
		{
			// Get hand body side (left, right, unknown)
			int side = 0;
			if (handOutput->QueryBodySide() == PXCHandData::BodySideType::BODY_SIDE_RIGHT)
			{
				m_rightHandExist = true;
				side = 0;
			}
			else if (handOutput->QueryBodySide() == PXCHandData::BodySideType::BODY_SIDE_LEFT)
			{
				m_leftHandExist = true;
				side = 1;
			}

			PXCHandData::JointData jointData;
			handOutput->QueryTrackedJoint(PXCHandData::JointType::JOINT_WRIST, jointData);
			Node<PXCHandData::JointData> rootDataNode(jointData);

			// Iterate over hand joints
			for (int i = 2; i < MAX_NUMBER_OF_JOINTS - 3; i += 4)
			{
				handOutput->QueryTrackedJoint((PXCHandData::JointType)(i + 3), jointData);
				Node<PXCHandData::JointData> dataNode(jointData);
				handOutput->QueryTrackedJoint((PXCHandData::JointType)(i + 2), jointData);
				Node<PXCHandData::JointData> dataNode1(jointData);
				handOutput->QueryTrackedJoint((PXCHandData::JointType)(i + 1), jointData);
				Node<PXCHandData::JointData> dataNode2(jointData);
				handOutput->QueryTrackedJoint((PXCHandData::JointType)(i), jointData);
				Node<PXCHandData::JointData> dataNode3(jointData);

				dataNode1.add(dataNode);
				dataNode2.add(dataNode1);
				dataNode3.add(dataNode2);
				rootDataNode.add(dataNode3);
			}

			m_skeletonTree[side].setRoot(rootDataNode);

		}
	}
}
Exemplo n.º 4
0
void OSystem_POSIX::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
#ifdef DATA_PATH
	const char *snap = getenv("SNAP");
	if (snap) {
		Common::String dataPath = Common::String(snap) + DATA_PATH;
		Common::FSNode dataNode(dataPath);
		if (dataNode.exists() && dataNode.isDirectory()) {
			// This is the same priority which is used for the data path (below),
			// but we insert this one first, so it will be searched first.
			s.add(dataPath, new Common::FSDirectory(dataNode, 4), priority);
		}
	}
#endif

	// For now, we always add the data path, just in case SNAP doesn't make sense.
	OSystem_SDL::addSysArchivesToSearchSet(s, priority);
}
Exemplo n.º 5
0
    virtual Cell::PooledStack read(
            const arbiter::Endpoint& endpoint,
            PointPool& pool,
            const Id& id) const override
    {
        auto data(io::ensureGet(endpoint, m_metadata.basename(id)));
        const Tail tail(*data, m_tailFields);
        const char* pos(data->data());

        const Schema& schema(pool.schema());
        const std::size_t pointSize(schema.pointSize());
        const std::size_t numPoints(data->size() / pointSize);
        const std::size_t numBytes(data->size() + tail.size());
        BinaryPointTable table(schema);
        pdal::PointRef pointRef(table, 0);

        if (pointSize * numPoints != data->size())
        {
            throw std::runtime_error("Invalid binary chunk size");
        }
        if (tail.numPoints() && tail.numPoints() != numPoints)
        {
            throw std::runtime_error("Invalid binary chunk numPoints");
        }
        if (tail.numBytes() && tail.numBytes() != numBytes)
        {
            throw std::runtime_error("Invalid binary chunk numBytes");
        }

        Data::PooledStack dataStack(pool.dataPool().acquire(numPoints));
        Cell::PooledStack cellStack(pool.cellPool().acquire(numPoints));

        for (Cell& cell : cellStack)
        {
            table.setPoint(pos);
            Data::PooledNode dataNode(dataStack.popOne());
            std::copy(pos, pos + pointSize, *dataNode);

            cell.set(pointRef, std::move(dataNode));
            pos += pointSize;
        }

        assert(dataStack.empty());
        return cellStack;
    }
Exemplo n.º 6
0
Cell::PooledStack LazPerfStorage::read(
        const arbiter::Endpoint& endpoint,
        PointPool& pool,
        const Id& id) const
{
    auto compressed(io::ensureGet(endpoint, m_metadata.basename(id)));
    const Tail tail(*compressed, m_tailFields);

    const Schema& schema(pool.schema());
    const std::size_t pointSize(schema.pointSize());
    const std::size_t numPoints(tail.numPoints());
    const std::size_t numBytes(compressed->size() + tail.size());
    BinaryPointTable table(schema);
    pdal::PointRef pointRef(table, 0);

    if (id >= m_metadata.structure().coldIndexBegin() && !numPoints)
    {
        throw std::runtime_error("Invalid lazperf chunk - no numPoints");
    }
    if (tail.numBytes() && tail.numBytes() != numBytes)
    {
        std::cout << tail.numBytes() << " != " << numBytes << std::endl;
        throw std::runtime_error("Invalid lazperf chunk numBytes");
    }

    Data::PooledStack dataStack(pool.dataPool().acquire(numPoints));
    Cell::PooledStack cellStack(pool.cellPool().acquire(numPoints));

    DecompressionStream stream(*compressed);
    pdal::LazPerfDecompressor<DecompressionStream> decompressor(
            stream,
            schema.pdalLayout().dimTypes());

    for (Cell& cell : cellStack)
    {
        Data::PooledNode dataNode(dataStack.popOne());
        table.setPoint(*dataNode);
        decompressor.decompress(*dataNode, pointSize);

        cell.set(pointRef, std::move(dataNode));
    }

    assert(dataStack.empty());
    return cellStack;
}
Exemplo n.º 7
0
void HandsModel::initSkeletonTree(Tree<PXCHandData::JointData>* tree)
{
	PXCHandData::JointData jointData;
	memset(&jointData, 0, sizeof(PXCHandData::JointData));
	Node<PXCHandData::JointData> rootDataNode(jointData);

	for (int i = 2; i < MAX_NUMBER_OF_JOINTS - 3; i += 4)
	{
		Node<PXCHandData::JointData> dataNode(jointData);
		Node<PXCHandData::JointData> dataNode1(jointData);
		Node<PXCHandData::JointData> dataNode2(jointData);
		Node<PXCHandData::JointData> dataNode3(jointData);

		dataNode1.add(dataNode);
		dataNode2.add(dataNode1);
		dataNode3.add(dataNode2);
		rootDataNode.add(dataNode3);
	}

	tree->setRoot(rootDataNode);
}