当前位置: 首页>>代码示例>>C#>>正文


C# RenderTexture.GetNativeTextureID方法代码示例

本文整理汇总了C#中RenderTexture.GetNativeTextureID方法的典型用法代码示例。如果您正苦于以下问题:C# RenderTexture.GetNativeTextureID方法的具体用法?C# RenderTexture.GetNativeTextureID怎么用?C# RenderTexture.GetNativeTextureID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RenderTexture的用法示例。


在下文中一共展示了RenderTexture.GetNativeTextureID方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: cacheTextureValues

    private bool syphonServerTextureValuesCached = false; // Do the server knows our camera size and id?

    #endregion Fields

    #region Methods

    //
    // Cache the current texture data to server
    public void cacheTextureValues( RenderTexture rt )
    {
        if (rt.GetNativeTextureID() != 0 && rt.width != 0 && rt.height != 0) {
            Syphon.CacheServerTextureValues(rt.GetNativeTextureID(), rt.width, rt.height, syphonServerTextureInstance);
            cachedTexID = rt.GetNativeTextureID();
            cachedWidth = rt.width;
            cachedHeight = rt.height;
            syphonServerTextureValuesCached = true;
        }
    }
开发者ID:rmnzr,项目名称:syphon-implementations,代码行数:18,代码来源:SyphonServerTexture.cs

示例2: SetStereoScreen

  public override void SetStereoScreen(RenderTexture stereoScreen) {
#if UNITY_5 || !UNITY_IOS
    SetTextureId(stereoScreen != null ? (int)stereoScreen.GetNativeTexturePtr() : 0);
#else
    // Using old API for Unity 4.x and iOS because Metal crashes on GetNativeTexturePtr()
    SetTextureId(stereoScreen != null ? stereoScreen.GetNativeTextureID() : 0);
#endif
  }
开发者ID:CaptainStouf,项目名称:TheKinectAwakens,代码行数:8,代码来源:BaseCardboardDevice.cs

示例3: OnRenderImage

    //////////////////////////////////////////////////////////////
    //
    // GAME LOOP CALLBACKS -- In order they are called
    //
    //
    // OnRenderImage() is called after all rendering is complete to render image, but the GUI is not rendered yet
    // http://docs.unity3d.com/Documentation/ScriptReference/Camera.OnRenderImage.html
    public void OnRenderImage(RenderTexture src, RenderTexture dst)
    {
        // Update texture data on Syphon server
        if (!syphonServerTextureValuesCached || cachedTexID != src.GetNativeTextureID() || src.width != cachedWidth || src.height != cachedHeight)
            cacheTextureValues( src );

        // WITHOUT GUI: just blit to the screen and publish to syphon.
        if (!renderGUI) {
            // Copy src to dst
            Syphon.SafeMaterial.SetPass(0);
            Graphics.Blit(src, dst);
            // Publish texture to Syphon Server
            if (syphonServerTextureInstance != 0)
                GL.IssuePluginEvent((int)syphonServerTextureInstance);
        }
        // WITH GUI: save reference to render textures
        else {
            srcTex = src;
            dstTex = dst;
        }
    }
开发者ID:rmnzr,项目名称:syphon-implementations,代码行数:28,代码来源:SyphonServerTexture.cs

示例4: SetStereoScreen

 public override void SetStereoScreen(RenderTexture stereoScreen) {
   SetTextureId(stereoScreen != null ? stereoScreen.GetNativeTextureID() : 0);
 }
开发者ID:xinfushe,项目名称:unity_lightInstall_v1,代码行数:3,代码来源:BaseCardboardDevice.cs

示例5: SetStereoScreen

 public override void SetStereoScreen(RenderTexture stereoScreen)
 {
     if (androidActivity != null) {
       InitFromUnity(stereoScreen != null ? stereoScreen.GetNativeTextureID() : 0);
     }
 }
开发者ID:Clorama,项目名称:My-MA-Final-Project-VR-Game,代码行数:6,代码来源:LegacyCardboardAndroidDevice.cs

示例6: Awake

  void Awake() {
      if (sdk == null) {
          sdk = this;
      } else {
          Debug.LogWarning("Cardboard SDK object should be a singleton.");
          enabled = false;
      }

      config.initialize();

#if ANDROID_DEVICE
      try {
          AndroidJavaClass player = new AndroidJavaClass(cardboardClass);
          cardboardActivity = player.CallStatic<AndroidJavaObject>("getActivity");
          player.Dispose();
          cardboardActivity.Call("initFromUnity", gameObject.name);
          config.canAccessActivity = true;
      } catch (AndroidJavaException e) {
          Debug.LogError("Cannot access UnityCardboardActivity. "
                  + "Verify that the jar is in Assets/Plugins/Android. " + e);
      }
      // Force side-effectful initialization using serialized values.
      EnableAlignmentMarker = enableAlignmentMarker;
      EnableSettingsButton = enableSettingsButton;
      TapIsTrigger = tapIsTrigger;
#endif

      if (config.canApplyDistortionCorrection()) {
          Debug.Log("Creating new cardboard screen texture");
          StereoScreen = new RenderTexture(Screen.width, Screen.height, 16,
                                           RenderTextureFormat.RGB565);
          StereoScreen.Create();
          InitFromUnity(StereoScreen.GetNativeTextureID());
      } else {
          if (!Application.isEditor) {
            Debug.LogWarning("Lens distortion-correction disabled. Causes: ["
                             + config.getDistortionCorrectionDiagnostic() + "]");
          }
      }

      InCardboard = newInCardboard = false;
#if UNITY_EDITOR
      if (VRModeEnabled && Application.isPlaying) {
          SetInCardboard(true);
      }
#endif
      StartCoroutine("EndOfFrame");
  }
开发者ID:conrad,项目名称:Google-Cardboard,代码行数:48,代码来源:Cardboard.cs

示例7: OnRenderImage

    public void OnRenderImage(RenderTexture src, RenderTexture dst)
    {
        //if you don't want to render the gui, just blit to the screen, cache the texture values and pass the screen texture to syphon.
        if(!renderGUI)
        {
        Graphics.Blit(src, dst);
             if(!syphonServerTextureInstanceInitialized || src.width != storedWidth || src.height != storedHeight || storedTexID != src.GetNativeTextureID()){
                storedWidth = src.width;
                storedHeight = src.height;
                storedTexID = src.GetNativeTextureID();
                cacheTextureValues();
            }

            GL.IssuePluginEvent((int)syphonServerTextureInstance);
        }
        else{
             if(tex == null || (!syphonServerTextureInstanceInitialized || src.width != storedWidth || src.height != storedHeight ||
             storedTexID != src.GetNativeTextureID() )){
                storedWidth = src.width;
                storedHeight = src.height;
                storedTexID = src.GetNativeTextureID();
                tex = src;
                cacheTextureValues();
            }
        }
    }
开发者ID:yopla,项目名称:unity-max,代码行数:26,代码来源:SyphonServerTexture.cs


注:本文中的RenderTexture.GetNativeTextureID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。