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


C# RenderTexture.GetNativeTexturePtr方法代码示例

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


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

示例1: cacheTextureValues

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

示例2: OnRenderImage

    private void OnRenderImage(RenderTexture source, RenderTexture destination)
    {
        if (output == null || output.width != Screen.width || output.height != Screen.height)
        {
            if (output != null)
            {
                output.Release();
                DestroyImmediate(output);
            }

            output = new RenderTexture(source.width, source.height, 0, RenderTextureFormat.ARGB32);

            output.Create(); // Must call create or ptr will be null.
            SetOutputData(output.GetNativeTexturePtr());
        }

        if (depth == null || depth.width != Screen.width || depth.height != Screen.height)
        {
            if (depth != null)
            {
                depth.Release();
                DestroyImmediate(depth);
            }

            depth = new RenderTexture(source.width, source.height, 24, RenderTextureFormat.Depth);
            depth.Create(); // Must call create or ptr will be null.
            SetDepthTexture(depth.GetNativeTexturePtr());
        }

        // Fetch depth
        Graphics.SetRenderTarget(output.colorBuffer, depth.depthBuffer);
        Graphics.Blit(source, fetchDepthMaterial);

        SetAoParameters(radius, bias, powerExponent, enableBlur, (int)blurRadiusMode, blurSharpness, 0);

        Matrix4x4 unityProjMatrix = GL.GetGPUProjectionMatrix(GetComponent<Camera>().projectionMatrix, false);
        float[] projMatrix = new float[16];
        for (int i = 0; i < 16; i++) projMatrix[i] = unityProjMatrix[i];

        SetInputData(1.0f, projMatrix, (float)Screen.height, (float)Screen.width, 0, 0, 0.0f, 1.0f);

        Graphics.SetRenderTarget(null);

        // Call our render method from the AO plugin.
        GL.IssuePluginEvent(GetEventID());

        renderAoMaterial.SetTexture("_AoResult", output);
        renderAoMaterial.SetTexture("_MainTex", source);
        Graphics.Blit(null, destination, renderAoMaterial);
    }
开发者ID:NoStudioDude,项目名称:PokemonMOBA_v0.0.1,代码行数:50,代码来源:HBAOPlus.cs

示例3: AddLayer

 void AddLayer(RenderTexture rt, int ch, string name)
 {
     FrameCapturer.fcExrAddLayer(m_exr, rt.GetNativeTexturePtr(), rt.format, ch, name);
 }
开发者ID:noa99kee,项目名称:FrameCapturer,代码行数:4,代码来源:ExrCapturer.cs

示例4: GetFrameData

 public override void GetFrameData(RenderTexture rt, int frame)
 {
     FrameCapturer.fcGifGetFrameData(m_gif, rt.GetNativeTexturePtr(), frame);
 }
开发者ID:neight0903,项目名称:Unity5Effects,代码行数:4,代码来源:GifOffscreenCapturer.cs

示例5: 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

示例6: 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 virtual void OnRenderImage(RenderTexture src, RenderTexture dst){
		// Update texture data on Syphon server
		if (!syphonServerTextureValuesCached || cachedTexID != src.GetNativeTexturePtr() || src.width != cachedWidth || src.height != cachedHeight)
			cacheTextureValues( src );

			// Copy src to dst
			Syphon.SafeMaterial.SetPass(0);
			Graphics.Blit(src, dst);
			// Publish texture to Syphon Server
			if (syphonServerTextureInstance != IntPtr.Zero && cachedTexID != IntPtr.Zero)
			GL.IssuePluginEvent(Syphon.SyphonGetRenderEventFunc(), (int)syphonServerTextureInstance);

	}
开发者ID:MartinHN,项目名称:Unity3D,代码行数:21,代码来源:SyphonServerTexture.cs

示例7: SetRenderTexture

            //set the render texture that this camera will render into
            //pass the native hardware pointer to the UnityRenderingPlugin for use in RenderManager
            public void SetRenderTexture(RenderTexture rt)
            {
                RenderToTexture = rt;
                Camera.targetTexture = RenderToTexture;
                RenderTexture.active = RenderToTexture;

                //Set the native texture pointer so we can access this texture from the plugin
                Eye.Viewer.DisplayController.RenderManager.SetEyeColorBuffer(RenderToTexture.GetNativeTexturePtr(), (int)Eye.EyeIndex);
            }
开发者ID:RedIronLabs,项目名称:OSVR-Unity,代码行数:11,代码来源:VRSurface.cs

示例8: PostRender

 public override void PostRender(RenderTexture stereoScreen) {
   SetTextureId((int)stereoScreen.GetNativeTexturePtr());
   GL.IssuePluginEvent(kCardboardRenderEvent);
 }
开发者ID:Rhiojin,项目名称:TheMinoMaze,代码行数:4,代码来源:BaseCardboardDevice.cs

示例9: Start

    // Use this for initialization
    IEnumerator Start()
    {
        // Set up 6 cameras for cubemap
        Camera thisCam = GetComponent<Camera>();
        GameObject cubemap = new GameObject("Cubemap");
        cubemap.transform.parent = transform;

        // Move the cubemap to the origin of the parent cam
        cubemap.transform.localPosition = Vector3.zero;

        System.IntPtr[] texturePtrs = new System.IntPtr[faceCount];

        for (int i = 0; i < faceCount; i++)
        {
            GameObject go = new GameObject(cubemapFaceNames[i]);
            Camera cam = go.AddComponent<Camera>();

            // Set render texture
            RenderTexture tex = new RenderTexture(resolution, resolution, 1, RenderTextureFormat.ARGB32);
            tex.Create();
            cam.targetTexture = tex;
            cam.aspect = 1;

            // Set orientation
            cam.fieldOfView = 90;
            go.transform.eulerAngles = cubemapFaceRotations[i];
            go.transform.parent = cubemap.transform;

            // Move the cubemap to the origin of the parent cam
            cam.transform.localPosition = Vector3.zero;

            texturePtrs[i] = tex.GetNativeTexturePtr();
        }

        // Tell native plugin that rendering has started
        StartFromUnity(texturePtrs, faceCount, resolution);

        yield return StartCoroutine("CallPluginAtEndOfFrames");
    }
开发者ID:dannisliang,项目名称:AlloUnity,代码行数:40,代码来源:RenderCubemap.cs

示例10: UpdateDataTexture

 public void UpdateDataTexture(RenderTexture rt)
 {
     MPAPI.mpUpdateDataTexture(GetContext(), rt.GetNativeTexturePtr());
 }
开发者ID:neight0903,项目名称:Unity5Effects,代码行数:4,代码来源:MPWorld.cs

示例11: ApplyRenderTexture

 public void ApplyRenderTexture(RenderTexture rtt)
 {
     #if !(UNITY_3_5)
     if (SystemInfo.graphicsDeviceVersion[0] == 'D')
     {
     #if UNITY_WP8
     sf_applyRenderTexture (MovieID, (long)rtt.GetNativeTexturePtr());
     #else
     SF_ApplyRenderTexture (MovieID, (long)rtt.GetNativeTexturePtr());
     #endif
     }
     #endif
 }
开发者ID:NGonGames,项目名称:GlobalGamJam2014,代码行数:13,代码来源:SFMovie.cs

示例12: GetFrameData

 public override void GetFrameData(RenderTexture rt, int frame)
 {
     fcAPI.fcMP4GetFrameData(m_ctx, rt.GetNativeTexturePtr(), frame);
 }
开发者ID:tasogare66,项目名称:FrameCapturer,代码行数:4,代码来源:MP4Capturer.cs

示例13: CopyDataToTexture

 public void CopyDataToTexture(RenderTexture tex)
 {
     peCopyDataToTexture(m_ctx, tex.GetNativeTexturePtr(), tex.width, tex.height);
 }
开发者ID:MrJoy,项目名称:SIMDExample,代码行数:4,代码来源:PEParticles.cs

示例14: AddLayer

 void AddLayer(RenderTexture rt, int ch, string name)
 {
     fcAPI.fcExrAddLayerTexture(m_exr, rt.GetNativeTexturePtr(), rt.format, ch, name, false);
 }
开发者ID:tasogare66,项目名称:FrameCapturer,代码行数:4,代码来源:ExrOffscreenCapturer.cs

示例15: CreateTextureAndPassToPlugin

    private void CreateTextureAndPassToPlugin()
    {
        // Create a texture
        RenderTexture tex = new RenderTexture(256,256,0,RenderTextureFormat.ARGB32,RenderTextureReadWrite.Default);
        // Set point filtering just so we can see the pixels clearly
        tex.filterMode = FilterMode.Point;
        // Call Apply() so it's actually uploaded to the GPU
        tex.Create();

        // Set texture onto our material
        GetComponent<Renderer>().material.mainTexture = tex;

        // Pass texture pointer to the plugin
        SetTextureFromUnity (tex.GetNativeTexturePtr());
    }
开发者ID:bwrsandman,项目名称:Unity-DX11-Native-Plugin-Texture-Clear,代码行数:15,代码来源:UseRenderingPlugin.cs


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