コード例 #1
0
void OpenVRUpdateSlaveCallback::updateSlave(osg::View& view, osg::View::Slave& slave)
{
	if (m_cameraType == LEFT_CAMERA)
	{
		m_device->updatePose();
	}

	osg::Vec3 position = m_device->position();
	osg::Quat orientation = m_device->orientation();

	osg::Matrix viewOffset = (m_cameraType == LEFT_CAMERA) ? m_device->viewMatrixLeft() : m_device->viewMatrixRight();

	viewOffset.preMultRotate(orientation);
   viewOffset.setTrans(position);

	slave._viewOffset = viewOffset;

	slave.updateSlaveImplementation(view);
}
コード例 #2
0
    virtual void updateSlave(osg::View& view, osg::View::Slave& slave)
	{
		if (m_cameraType==LEFT_CAMERA)
		{
			m_device->updatePose(m_swapCallback->frameIndex());

		}

		osg::Vec3 position = m_device->position();
		osg::Quat orientation = m_device->orientation();

		osg::Matrix viewOffset = (m_cameraType==LEFT_CAMERA) ? m_device->viewMatrixLeft() : m_device->viewMatrixRight();

		viewOffset.preMultRotate(orientation);
		viewOffset.preMultTranslate(position);

		slave._viewOffset = viewOffset;

		slave.updateSlaveImplementation(view);

		if (m_warning.valid()) {
			m_warning.get()->updatePosition(view.getCamera()->getInverseViewMatrix(), position, orientation);
		}
	}