Retrieve a native (underlying graphics API) pointer to the texture resource.
static public int GetNativeTexturePtr(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.Texture self = (UnityEngine.Texture)checkSelf(l); var ret = self.GetNativeTexturePtr(); pushValue(l, true); pushValue(l, ret); return(2); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
static public int GetNativeTexturePtr(IntPtr l) { try { UnityEngine.Texture self=(UnityEngine.Texture)checkSelf(l); var ret=self.GetNativeTexturePtr(); pushValue(l,ret); return 1; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } }
static public int GetNativeTexturePtr(IntPtr l) { try { UnityEngine.Texture self = (UnityEngine.Texture)checkSelf(l); var ret = self.GetNativeTexturePtr(); pushValue(l, ret); return(1); } catch (Exception e) { return(error(l, e)); } }
static int QPYX_GetNativeTexturePtr_YXQP(IntPtr L_YXQP) { try { ToLua.CheckArgsCount(L_YXQP, 1); UnityEngine.Texture QPYX_obj_YXQP = (UnityEngine.Texture)ToLua.CheckObject <UnityEngine.Texture>(L_YXQP, 1); System.IntPtr QPYX_o_YXQP = QPYX_obj_YXQP.GetNativeTexturePtr(); LuaDLL.lua_pushlightuserdata(L_YXQP, QPYX_o_YXQP); return(1); } catch (Exception e_YXQP) { return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP)); } }
static int GetNativeTexturePtr(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); UnityEngine.Texture obj = (UnityEngine.Texture)ToLua.CheckObject <UnityEngine.Texture>(L, 1); System.IntPtr o = obj.GetNativeTexturePtr(); LuaDLL.lua_pushlightuserdata(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int GetNativeTexturePtr(IntPtr L) { #if UNITY_EDITOR ToluaProfiler.AddCallRecord("UnityEngine.Texture.GetNativeTexturePtr"); #endif try { ToLua.CheckArgsCount(L, 1); UnityEngine.Texture obj = (UnityEngine.Texture)ToLua.CheckObject <UnityEngine.Texture>(L, 1); System.IntPtr o = obj.GetNativeTexturePtr(); LuaDLL.lua_pushlightuserdata(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public void SetRemoteDisplayTexture(Texture texture) { IntPtr texturePointer = texture.GetNativeTexturePtr(); if (texturePointer == IntPtr.Zero) { Debug.LogError("Couldn't obtain native pointer for the remote display texture."); return; } CastRemoteDisplayiOSUnityBridge.SetRemoteDisplayTexture(texturePointer); }
public bool UpdateSender(string sharingName, Texture tex) { if(enabled == false || gameObject.activeInHierarchy == false || _isInit == false)return false; //Debug.Log("Spout.UpdateSender:"+sharingName+"::"+tex.GetNativeTexturePtr().ToInt32()); return updateSenderNative(sharingName, tex.GetNativeTexturePtr()); }
public bool CreateSender(string sharingName, Texture tex, int texFormat = 1) { if(!enabled)return false; if(!_isInit)return false; #if UNITY_EDITOR if(!Application.isPlaying && !_isEnabledInEditor ) return false; #endif //Debug.Log("Spout.CreateSender"); //Debug.Log("Spout.CreateSender:"+sharingName+"::"+tex.GetNativeTexturePtr().ToInt32()); bool result = createSenderNative(sharingName, tex.GetNativeTexturePtr(), texFormat); if (!result) Debug.LogWarning (String.Format("Spout sender creation with name {0} failed !",sharingName)); if(result) { //Debug.Log (String.Format("Spout sender creation with name {0} success !",sharingName)); localSenderNames.Add(sharingName); } return result; }
public bool ReplaceTexture(long movieId, String textureName, Texture texture) { int texId; int rt_with = texture.width; int rt_height = texture.height; #if (UNITY_4_0) || (UNITY_4_1) #if UNITY_IPHONE texId = texture.GetNativeTextureID(); #else IntPtr texPtr = texture.GetNativeTexturePtr(); texId = (int)(texPtr); #endif #else texId = texture.GetNativeTextureID(); #endif return SF_ReplaceTexture(movieId, textureName, texId, rt_with, rt_height); }
public void SetRemoteDisplayTexture(Texture texture) { IntPtr texturePointer = texture.GetNativeTexturePtr(); if (texturePointer == IntPtr.Zero) { Debug.LogError("Couldn't obtain native pointer for the remote display texture."); return; } if (bridge != null) { Debug.Log("Setting texture with ID: " + texturePointer.ToInt64()); bridge.CallStatic(NATIVE_SET_REMOTE_DISPLAY_TEXTURE, texturePointer.ToInt64()); } }
private void StoreTextureInfo(string uri, UnityEngine.Texture texture) { UnityEngine.Texture2D texture2D = texture as UnityEngine.Texture2D; Noesis_TextureProviderStoreTextureInfo(swigCPtr.Handle, uri, texture.width, texture.height, texture2D != null ? texture2D.mipmapCount : 1, texture.GetNativeTexturePtr()); Noesis.Error.Check(); }
void OnRenderObject() { // The overlay must be specified every eye frame, because it is positioned relative to the // current head location. If frames are dropped, it will be time warped appropriately, // just like the eye buffers. if (Camera.current != Camera.main || Camera.current.cameraType != CameraType.Game || layerIndex == -1 || currentOverlayType == OverlayType.None) return; #if !UNITY_ANDROID || UNITY_EDITOR if (currentOverlayShape == OverlayShape.Cubemap || currentOverlayShape == OverlayShape.Cylinder) { Debug.LogWarning("Overlay shape " + currentOverlayShape + " is not supported on current platform"); } #endif if (texture != cachedTexture) { cachedTexture = texture; if (cachedTexture) texNativePtr = cachedTexture.GetNativeTexturePtr(); } if (cachedTexture == null || texNativePtr == IntPtr.Zero) return; if (currentOverlayShape == OverlayShape.Cubemap) { if (texture.GetType() != typeof(Cubemap)) { Debug.LogError("Need Cubemap texture for cube map overlay"); return; } } bool overlay = (currentOverlayType == OverlayType.Overlay); bool headLocked = false; for (var t = transform; t != null && !headLocked; t = t.parent) headLocked |= (t == Camera.current.transform); OVRPose pose = (headLocked) ? transform.ToHeadSpacePose() : transform.ToTrackingSpacePose(); Vector3 scale = transform.lossyScale; for (int i = 0; i < 3; ++i) scale[i] /= Camera.current.transform.lossyScale[i]; // Cylinder overlay sanity checking if (currentOverlayShape == OverlayShape.Cylinder) { float arcAngle = scale.x / scale.z / (float)Math.PI * 180.0f; if (arcAngle > 180.0f) { Debug.LogError("Cylinder overlay's arc angle has to be below 180 degree, current arc angle is " + arcAngle + " degree." ); return ; } } bool isOverlayVisible = OVRPlugin.SetOverlayQuad(overlay, headLocked, texNativePtr, IntPtr.Zero, pose.flipZ().ToPosef(), scale.ToVector3f(), layerIndex, currentOverlayShape); if (rend) rend.enabled = !isOverlayVisible; }
void Awake() { Debug.Log("Overlay Awake"); rend = GetComponent<Renderer>(); if (texture) { cachedTexture = texture; texNativePtr = texture.GetNativeTexturePtr(); } else if (rend) // Backward compitability { texture = rend.material.mainTexture; cachedTexture = texture; texNativePtr = texture.GetNativeTexturePtr(); } }
public static bool UpdateSender(string sharingName, Texture tex) { return updateSenderNative(sharingName, tex.GetNativeTexturePtr()); }
public static bool CreateSender(string sharingName, Texture tex) { if(!isInit) Init(); Debug.Log ("Tex Native Pointer :"+tex.GetNativeTexturePtr()); return createSenderNative(sharingName, tex.GetNativeTexturePtr()); }