本文整理汇总了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;
}
}
示例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);
}
示例3: AddLayer
void AddLayer(RenderTexture rt, int ch, string name)
{
FrameCapturer.fcExrAddLayer(m_exr, rt.GetNativeTexturePtr(), rt.format, ch, name);
}
示例4: GetFrameData
public override void GetFrameData(RenderTexture rt, int frame)
{
FrameCapturer.fcGifGetFrameData(m_gif, rt.GetNativeTexturePtr(), frame);
}
示例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
}
示例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);
}
示例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);
}
示例8: PostRender
public override void PostRender(RenderTexture stereoScreen) {
SetTextureId((int)stereoScreen.GetNativeTexturePtr());
GL.IssuePluginEvent(kCardboardRenderEvent);
}
示例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");
}
示例10: UpdateDataTexture
public void UpdateDataTexture(RenderTexture rt)
{
MPAPI.mpUpdateDataTexture(GetContext(), rt.GetNativeTexturePtr());
}
示例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
}
示例12: GetFrameData
public override void GetFrameData(RenderTexture rt, int frame)
{
fcAPI.fcMP4GetFrameData(m_ctx, rt.GetNativeTexturePtr(), frame);
}
示例13: CopyDataToTexture
public void CopyDataToTexture(RenderTexture tex)
{
peCopyDataToTexture(m_ctx, tex.GetNativeTexturePtr(), tex.width, tex.height);
}
示例14: AddLayer
void AddLayer(RenderTexture rt, int ch, string name)
{
fcAPI.fcExrAddLayerTexture(m_exr, rt.GetNativeTexturePtr(), rt.format, ch, name, false);
}
示例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());
}