void DebugHmdDisplayPlugin::updatePresentPose() { float yaw = sinf(secTimestampNow()) * 0.25f; float pitch = cosf(secTimestampNow()) * 0.25f; // Simulates head pose latency correction _currentPresentFrameInfo.presentPose = glm::mat4_cast(glm::angleAxis(yaw, Vectors::UP)) * glm::mat4_cast(glm::angleAxis(pitch, Vectors::RIGHT)); }
void MacQml::update() { auto rootItem =_surface->getRootItem(); float now = sinf(secTimestampNow()); rootItem->setProperty("level", fabs(now)); rootItem->setProperty("muted", now > 0.0f); rootItem->setProperty("statsValue", rand()); // Fetch any new textures TextureAndFence newTextureAndFence; if (_surface->fetchTexture(newTextureAndFence)) { if (_texture != 0) { auto readFence = _glf.glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); glFlush(); _discardLamdba(_texture, readFence); } _texture = newTextureAndFence.first; _glf.glWaitSync((GLsync)newTextureAndFence.second, 0, GL_TIMEOUT_IGNORED); } }
bool DebugHmdDisplayPlugin::beginFrameRender(uint32_t frameIndex) { _currentRenderFrameInfo = FrameInfo(); _currentRenderFrameInfo.sensorSampleTime = secTimestampNow(); _currentRenderFrameInfo.predictedDisplayTime = _currentRenderFrameInfo.sensorSampleTime; // FIXME simulate head movement //_currentRenderFrameInfo.renderPose = ; //_currentRenderFrameInfo.presentPose = _currentRenderFrameInfo.renderPose; withNonPresentThreadLock([&] { _uiModelTransform = DependencyManager::get<CompositorHelper>()->getModelTransform(); _frameInfos[frameIndex] = _currentRenderFrameInfo; _handPoses[0] = glm::translate(mat4(), vec3(-0.3f, 0.0f, 0.0f)); _handLasers[0].color = vec4(1, 0, 0, 1); _handLasers[0].mode = HandLaserMode::Overlay; _handPoses[1] = glm::translate(mat4(), vec3(0.3f, 0.0f, 0.0f)); _handLasers[1].color = vec4(0, 1, 1, 1); _handLasers[1].mode = HandLaserMode::Overlay; }); return Parent::beginFrameRender(frameIndex); }