Пример #1
0
 public WebCamImpl(Camera[] arCameras, int renderTextureLayer, string webcamDeviceName, bool flipHorizontally)
 {
     if (VuforiaRuntimeUtilities.IsPlayMode())
     {
         this.mRenderTextureLayer     = renderTextureLayer;
         this.mARCameras              = arCameras;
         this.mOriginalCameraCullMask = new int[this.mARCameras.Length];
         for (int i = 0; i < this.mARCameras.Length; i++)
         {
             this.mOriginalCameraCullMask[i] = this.mARCameras[i].cullingMask;
             Camera expr_60 = this.mARCameras[i];
             expr_60.cullingMask = expr_60.cullingMask & ~(1 << this.mRenderTextureLayer);
         }
         WebCamProfile webCamProfile = new WebCamProfile();
         if (VuforiaRuntimeUtilities.IsVuforiaEnabled() && WebCamTexture.devices.Length != 0)
         {
             bool           flag    = false;
             WebCamDevice[] devices = WebCamTexture.devices;
             for (int j = 0; j < devices.Length; j++)
             {
                 WebCamDevice webCamDevice = devices[j];
                 if (webCamDevice.name.Equals(webcamDeviceName))
                 {
                     flag = true;
                 }
             }
             if (!flag)
             {
                 webcamDeviceName = WebCamTexture.devices[0].name;
             }
             this.mWebCamProfile = webCamProfile.GetProfile(webcamDeviceName);
             this.mWebCamTexture = new WebCamTexAdaptorImpl(webcamDeviceName, this.mWebCamProfile.RequestedFPS, this.mWebCamProfile.RequestedTextureSize);
         }
         else
         {
             this.mWebCamProfile = webCamProfile.Default;
             this.mWebCamTexture = new NullWebCamTexAdaptor(this.mWebCamProfile.RequestedFPS, this.mWebCamProfile.RequestedTextureSize);
         }
         this.mFlipHorizontally = flipHorizontally;
     }
 }
Пример #2
0
        private void ComputeResampledTextureSize()
        {
            float num  = (float)this.mWebCamTexture.Texture.height / (float)this.mWebCamTexture.Texture.width;
            float num2 = (float)this.mWebCamProfile.ResampledTextureSize.x * num;
            int   v    = (int)num2;

            if (Math.Abs(480f - num2) <= 1f)
            {
                v = 480;
            }
            if (Math.Abs(360f - num2) <= 1f)
            {
                v = 360;
            }
            WebCamProfile.ProfileData profileData = new WebCamProfile.ProfileData
            {
                RequestedTextureSize = this.mWebCamProfile.RequestedTextureSize,
                ResampledTextureSize = new VuforiaRenderer.Vec2I(this.mWebCamProfile.ResampledTextureSize.x, v),
                RequestedFPS         = this.mWebCamProfile.RequestedFPS
            };
            this.mWebCamProfile = profileData;
        }
Пример #3
0
 public ProfileCollection(WebCamProfile.ProfileData defaultProfile, Dictionary <string, WebCamProfile.ProfileData> profiles)
 {
     this.DefaultProfile = defaultProfile;
     this.Profiles       = profiles;
 }