Пример #1
0
 public bool GetParamPixelsWidthHeight(string Param, out int Width, out int Height)
 {
     //	gr: to remove warning
     Width  = 0;
     Height = 0;
     return(PopUnity.GetJobParam_PixelsWidthHeight(ref mInterface, Param, ref Width, ref Height));
 }
Пример #2
0
    void Start()
    {
        //	need to CREATE a texture. overwriting an existing one doesn't work...
        if (mTexture == null)
        {
            mTexture = new Texture2D(1280, 1024, TextureFormat.BGRA32, false);

            //	need a material...
            if (MaterialForTexture != null)
            {
                MaterialForTexture.mainTexture = mTexture;
            }
        }

        PopUnity.AssignJobHandler("re:getframe", ((Job) => this.OnGetFrameReply(Job)));
        PopUnity.AssignJobHandler("newframe", ((Job) => this.OnGetFrameReply(Job)));
        PopUnity.AssignJobHandler("newdepth", ((Job) => this.OnGetFrameReply(Job)));
    }
Пример #3
0
    public bool GetParamArray(string Param, string ElementTypeName, ref List <TFeatureMatch> Array, int MaxSize)
    {
        TFeatureMatch[] Buffer = new TFeatureMatch[MaxSize];
        //	test for reading format
        Buffer [0].mCoord_x = 1;
        Buffer [0].mCoord_y = 2;
        Buffer [0].mScore   = 3.0f;
        Buffer [1].mCoord_x = 4;
        Buffer [1].mCoord_y = 5;
        Buffer [1].mScore   = 6.0f;

        IntPtr ptr     = Marshal.AllocHGlobal(Marshal.SizeOf(Buffer[0]) * Buffer.Length);
        long   LongPtr = ptr.ToInt64();       // Must work both on x86 and x64

        for (int I = 0; I < Buffer.Length; I++)
        {
            IntPtr RectPtr = new IntPtr(LongPtr);
            Marshal.StructureToPtr(Buffer[I], RectPtr, false);             // You do not need to erase struct in this case
            LongPtr += Marshal.SizeOf(Buffer[I]);
        }

        int ElementsRead = PopUnity.GetJobParam_Array(ref mInterface, Param, ElementTypeName, ptr, Buffer.Length);

        if (ElementsRead < 0)
        {
            Array.Clear();
            return(false);
        }

        Array.Clear();

        //	copy back
        LongPtr = ptr.ToInt64();         // Must work both on x86 and x64
        for (int i = 0; i < Math.Min(Buffer.Length, ElementsRead); i++)
        {
            IntPtr pElement = new IntPtr(LongPtr);
            LongPtr  += Marshal.SizeOf(Buffer [i]);
            Buffer[i] = (TFeatureMatch)Marshal.PtrToStructure(pElement, typeof(TFeatureMatch));
            Array.Add(Buffer [i]);
        }

        return(true);
    }
Пример #4
0
    public bool GetParam(string Param, Texture2D texture, SoyPixelsFormat Format = SoyPixelsFormat.Invalid, bool Stretch = false)
    {
        int FormatInt = Convert.ToInt32(Format);

        return(PopUnity.GetJobParam_texture(ref mInterface, Param, texture.GetNativeTextureID(), FormatInt, Stretch));
    }
Пример #5
0
 public string GetParam(string Param, string DefaultValue)
 {
     System.IntPtr stringPtr = PopUnity.GetJobParam_string(ref mInterface, Param, DefaultValue);
     return(Marshal.PtrToStringAuto(stringPtr));
 }
Пример #6
0
 public float GetParam(string Param, float DefaultValue)
 {
     return(PopUnity.GetJobParam_float(ref mInterface, Param, DefaultValue));
 }
Пример #7
0
 public int GetParam(string Param, int DefaultValue)
 {
     return(PopUnity.GetJobParam_int(ref mInterface, Param, DefaultValue));
 }
Пример #8
0
 public bool SendJob(string Command)
 {
     return(PopUnity.SendJob(mChannel, Command));
 }
Пример #9
0
 public PopUnityChannel(string Channel)
 {
     mChannel = PopUnity.CreateChannel(Channel);
 }
Пример #10
0
 void Update()
 {
     PopUnity.Update();
 }