Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  PuppetSession.cpp

  Sprache: C
 

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */


#include "PuppetSession.h"

#include "nsString.h"
#include "VRPuppetCommandBuffer.h"
#include "mozilla/StaticPrefs_dom.h"

#if defined(XP_WIN)
#  include <d3d11.h>
#  include "mozilla/gfx/DeviceManagerDx.h"
#elif defined(XP_MACOSX)
#  include "mozilla/gfx/MacIOSurface.h"
#endif

using namespace mozilla::gfx;

namespace mozilla::gfx {

PuppetSession::PuppetSession() = default;

PuppetSession::~PuppetSession() { Shutdown(); }

bool PuppetSession::Initialize(mozilla::gfx::VRSystemState& aSystemState,
                               bool aDetectRuntimesOnly) {
  if (!StaticPrefs::dom_vr_enabled() || !StaticPrefs::dom_vr_puppet_enabled()) {
    return false;
  }
  if (!VRPuppetCommandBuffer::IsCreated()) {
    // We only want to initialize VRPuppetCommandBuffer on the main thread.
    // We can assume if it is not initialized, that the puppet display
    // would not be enumerated.
    return false;
  }
  if (aDetectRuntimesOnly) {
    aSystemState.displayState.capabilityFlags |=
        VRDisplayCapabilityFlags::Cap_ImmersiveVR;
    return false;
  }
  VRPuppetCommandBuffer::Get().Run(aSystemState);
  if (!aSystemState.displayState.isConnected) {
    return false;
  }
#if defined(XP_WIN)
  if (!CreateD3DObjects()) {
    Shutdown();
    return false;
  }
#endif

  // Succeeded
  return true;
}

#if defined(XP_WIN)
bool PuppetSession::CreateD3DObjects() {
  RefPtr<ID3D11Device> device = gfx::DeviceManagerDx::Get()->GetVRDevice();
  if (!device) {
    return false;
  }
  if (!CreateD3DContext(device)) {
    return false;
  }
  return true;
}
#endif

void PuppetSession::Shutdown() {}

void PuppetSession::StartFrame(mozilla::gfx::VRSystemState& aSystemState) {
  VRPuppetCommandBuffer::Get().Run(aSystemState);
}

void PuppetSession::ProcessEvents(mozilla::gfx::VRSystemState& aSystemState) {
  VRPuppetCommandBuffer& puppet = VRPuppetCommandBuffer::Get();
  puppet.Run(aSystemState);
  if (!aSystemState.displayState.isConnected) {
    mShouldQuit = true;
  }
}

#if defined(XP_WIN)
bool PuppetSession::SubmitFrame(
    const mozilla::gfx::VRLayer_Stereo_Immersive& aLayer,
    ID3D11Texture2D* aTexture) {
  return VRPuppetCommandBuffer::Get().SubmitFrame();
}
#elif defined(XP_MACOSX)
bool PuppetSession::SubmitFrame(
    const mozilla::gfx::VRLayer_Stereo_Immersive& aLayer,
    const VRLayerTextureHandle& aTexture) {
  return VRPuppetCommandBuffer::Get().SubmitFrame();
}
#endif

void PuppetSession::StopPresentation() {
  VRPuppetCommandBuffer::Get().StopPresentation();
}

bool PuppetSession::StartPresentation() {
  VRPuppetCommandBuffer::Get().StartPresentation();
  return true;
}

void PuppetSession::VibrateHaptic(uint32_t aControllerIdx,
                                  uint32_t aHapticIndex, float aIntensity,
                                  float aDuration) {
  VRPuppetCommandBuffer::Get().VibrateHaptic(aControllerIdx, aHapticIndex,
                                             aIntensity, aDuration);
}

void PuppetSession::StopVibrateHaptic(uint32_t aControllerIdx) {
  VRPuppetCommandBuffer::Get().StopVibrateHaptic(aControllerIdx);
}

void PuppetSession::StopAllHaptics() {
  VRPuppetCommandBuffer::Get().StopAllHaptics();
}

}  // namespace mozilla::gfx

Messung V0.5 in Prozent
C=94 H=100 G=96

¤ Dauer der Verarbeitung: 0.21 Sekunden  (vorverarbeitet am  2026-06-05) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik