Ejemplo n.º 1
0
    /// <summary>
    /// Initialises the ARToolKit.
    /// </summary>
    /// <param name="pattSize"></param>
    /// <param name="pattCountMax"></param>
    /// <returns>true if successful, false if an error occurred.</returns>
    /// <remarks>For any square template (pattern) markers, the number of rows and columns in the template defaults to AR_PATT_SIZE1 and the maximum number of markers that may be loaded for a single matching pass defaults to AR_PATT_NUM_MAX.</remarks>
    /// <seealso cref="arwShutdownAR"/>
    public bool arwInitialiseAR()
    {
        string dllDir = "";

        dllDir = Environment.GetEnvironmentVariable("ARTOOLKIT5_ROOT64");
        if (string.IsNullOrEmpty(dllDir))
        {
            dllDir = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
        }
        if (dllDir.Equals(""))
        {
            throw new System.Exception("ARToolKitCSharpIntegration.ARToolKitFunctions.arwInitialiseAR(): ARTOOLKIT5_ROOT64 not set. Please set ARTOOLKIT5_ROOT64 in your environment variables to the path where you installed ARToolKit to.");
        }
        else
        {
            SetDllDirectory(dllDir + "\\");
        }

        bool ok;

        ok = ARNativePlugin.arwInitialiseAR();
        if (ok)
        {
            inited = true;
        }
        return(ok);
    }
Ejemplo n.º 2
0
    public static bool arwGetVideoParamsStereo(out int widthL, out int heightL, out int pixelSizeL, out String pixelFormatL, out int widthR, out int heightR, out int pixelSizeR, out String pixelFormatR)
    {
        StringBuilder sbL = new StringBuilder(128);
        StringBuilder sbR = new StringBuilder(128);
        bool          ok;

        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            ok = ARNativePluginStatic.arwGetVideoParamsStereo(out widthL, out heightL, out pixelSizeL, sbL, sbL.Capacity, out widthR, out heightR, out pixelSizeR, sbR, sbR.Capacity);
        }
        else
        {
            ok = ARNativePlugin.arwGetVideoParamsStereo(out widthL, out heightL, out pixelSizeL, sbL, sbL.Capacity, out widthR, out heightR, out pixelSizeR, sbR, sbR.Capacity);
        }
        if (!ok)
        {
            pixelFormatL = "";
            pixelFormatR = "";
        }
        else
        {
            pixelFormatL = sbL.ToString();
            pixelFormatR = sbR.ToString();
        }
        return(ok);
    }
    public bool arwGetMarkerPatternImage(int markerID, int patternID, [In, Out] Color[] colors)
    {
        bool ok;

        ok = ARNativePlugin.arwGetMarkerPatternImage(markerID, patternID, colors);
        return(ok);
    }
Ejemplo n.º 4
0
    public bool arwUpdateARToolKit(byte[] imageBytes, bool doDatums)
    {
        bool     ok      = false;
        GCHandle handle  = GCHandle.Alloc(imageBytes, GCHandleType.Pinned);
        IntPtr   address = handle.AddrOfPinnedObject();

        ok = ARNativePlugin.arwUpdateARToolKit(address, doDatums);
        handle.Free();
        return(ok);
    }
Ejemplo n.º 5
0
    // Uses 4 calibration factors
    public float arwCalibChessboardCornersSimple(int numImages, string file_name, out float[] projectErrorResults)
    {
        projectErrorResults = new float[numImages];
        GCHandle handle  = GCHandle.Alloc(projectErrorResults, GCHandleType.Pinned);
        IntPtr   address = handle.AddrOfPinnedObject();
        float    averageProjectionError = ARNativePlugin.arwCalibChessboardCornersSimple(file_name, address);

        handle.Free();
        return(averageProjectionError);
    }
Ejemplo n.º 6
0
    public bool arwQueryTrackableMapperTransformation(int gMapUID, int trackableUID, double[] matrix)
    {
        GCHandle handle1  = GCHandle.Alloc(matrix, GCHandleType.Pinned);
        IntPtr   address1 = handle1.AddrOfPinnedObject();

        bool ret = ARNativePlugin.arwQueryTrackableMapperTransformation(gMapUID, trackableUID, address1);

        handle1.Free();
        return(ret);
    }
    public bool arwUpdateTexture32([In, Out] Color32[] colors32)
    {
        bool     ok;
        GCHandle handle  = GCHandle.Alloc(colors32, GCHandleType.Pinned);
        IntPtr   address = handle.AddrOfPinnedObject();

        ok = ARNativePlugin.arwUpdateTexture32(address);
        handle.Free();
        return(ok);
    }
Ejemplo n.º 8
0
 public static bool arwQueryMarkerVisibility(int markerID)
 {
     if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         return(ARNativePluginStatic.arwQueryMarkerVisibility(markerID));
     }
     else
     {
         return(ARNativePlugin.arwQueryMarkerVisibility(markerID));
     }
 }
Ejemplo n.º 9
0
 public static bool arwQueryMarkerTransformationStereo(int markerID, float[] matrixL, float[] matrixR)
 {
     if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         return(ARNativePluginStatic.arwQueryMarkerTransformationStereo(markerID, matrixL, matrixR));
     }
     else
     {
         return(ARNativePlugin.arwQueryMarkerTransformationStereo(markerID, matrixL, matrixR));
     }
 }
Ejemplo n.º 10
0
 public static bool arwRemoveMarker(int markerID)
 {
     if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         return(ARNativePluginStatic.arwRemoveMarker(markerID));
     }
     else
     {
         return(ARNativePlugin.arwRemoveMarker(markerID));
     }
 }
Ejemplo n.º 11
0
 public static int arwRemoveAllMarkers()
 {
     if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         return(ARNativePluginStatic.arwRemoveAllMarkers());
     }
     else
     {
         return(ARNativePlugin.arwRemoveAllMarkers());
     }
 }
Ejemplo n.º 12
0
 public static void arwSetTrackerOptionFloat(int option, float value)
 {
     if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         ARNativePluginStatic.arwSetTrackerOptionFloat(option, value);
     }
     else
     {
         ARNativePlugin.arwSetTrackerOptionFloat(option, value);
     }
 }
Ejemplo n.º 13
0
 public static int arwAddMarker(string cfg)
 {
     if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         return(ARNativePluginStatic.arwAddMarker(cfg));
     }
     else
     {
         return(ARNativePlugin.arwAddMarker(cfg));
     }
 }
Ejemplo n.º 14
0
 public static void arwSetNFTMultiMode(bool on)
 {
     if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         ARNativePluginStatic.arwSetNFTMultiMode(on);
     }
     else
     {
         ARNativePlugin.arwSetNFTMultiMode(on);
     }
 }
Ejemplo n.º 15
0
 public static bool arwGetProjectionMatrixStereo(float[] matrixL, float[] matrixR)
 {
     if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         return(ARNativePluginStatic.arwGetProjectionMatrixStereo(matrixL, matrixR));
     }
     else
     {
         return(ARNativePlugin.arwGetProjectionMatrixStereo(matrixL, matrixR));
     }
 }
Ejemplo n.º 16
0
 public static bool arwGetTrackableAppearanceConfig(int markerID, int patternID, float[] matrix, out float width, out float height, out int imageSizeX, out int imageSizeY)
 {
     if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         return(ARNativePluginStatic.arwGetTrackableAppearanceConfig(markerID, patternID, matrix, out width, out height, out imageSizeX, out imageSizeY));
     }
     else
     {
         return(ARNativePlugin.arwGetTrackableAppearanceConfig(markerID, patternID, matrix, out width, out height, out imageSizeX, out imageSizeY));
     }
 }
Ejemplo n.º 17
0
 public static bool arwGetNFTMultiMode()
 {
     if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         return(ARNativePluginStatic.arwGetNFTMultiMode());
     }
     else
     {
         return(ARNativePlugin.arwGetNFTMultiMode());
     }
 }
Ejemplo n.º 18
0
 public static int arwGetTrackableAppearanceCount(int markerID)
 {
     if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         return(ARNativePluginStatic.arwGetTrackableAppearanceCount(markerID));
     }
     else
     {
         return(ARNativePlugin.arwGetTrackableAppearanceCount(markerID));
     }
 }
Ejemplo n.º 19
0
 public static bool arwUpdateAR()
 {
     if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         return(ARNativePluginStatic.arwUpdateAR());
     }
     else
     {
         return(ARNativePlugin.arwUpdateAR());
     }
 }
Ejemplo n.º 20
0
 public static bool arwLoadOpticalParams(string optical_param_name, byte[] optical_param_buff, int optical_param_buffLen, out float fovy_p, out float aspect_p, float[] m, float[] p)
 {
     if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         return(ARNativePluginStatic.arwLoadOpticalParams(optical_param_name, optical_param_buff, optical_param_buffLen, out fovy_p, out aspect_p, m, p));
     }
     else
     {
         return(ARNativePlugin.arwLoadOpticalParams(optical_param_name, optical_param_buff, optical_param_buffLen, out fovy_p, out aspect_p, m, p));
     }
 }
Ejemplo n.º 21
0
 public static void arwSetLogLevel(int logLevel)
 {
     if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         ARNativePluginStatic.arwSetLogLevel(logLevel);
     }
     else
     {
         ARNativePlugin.arwSetLogLevel(logLevel);
     }
 }
Ejemplo n.º 22
0
 public static bool arwStartRunningB(string vconf, byte[] cparaBuff, int cparaBuffLen, float nearPlane, float farPlane)
 {
     if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         return(ARNativePluginStatic.arwStartRunningB(vconf, cparaBuff, cparaBuffLen, nearPlane, farPlane));
     }
     else
     {
         return(ARNativePlugin.arwStartRunningB(vconf, cparaBuff, cparaBuffLen, nearPlane, farPlane));
     }
 }
Ejemplo n.º 23
0
 public static void arwSetImageProcMode(int mode)
 {
     if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         ARNativePluginStatic.arwSetImageProcMode(mode);
     }
     else
     {
         ARNativePlugin.arwSetImageProcMode(mode);
     }
 }
Ejemplo n.º 24
0
 public static bool arwStartRunningStereoB(string vconfL, byte[] cparaBuffL, int cparaBuffLenL, string vconfR, byte[] cparaBuffR, int cparaBuffLenR, byte[] transL2RBuff, int transL2RBuffLen, float nearPlane, float farPlane)
 {
     if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         return(ARNativePluginStatic.arwStartRunningStereoB(vconfL, cparaBuffL, cparaBuffLenL, vconfR, cparaBuffR, cparaBuffLenR, transL2RBuff, transL2RBuffLen, nearPlane, farPlane));
     }
     else
     {
         return(ARNativePlugin.arwStartRunningStereoB(vconfL, cparaBuffL, cparaBuffLenL, vconfR, cparaBuffR, cparaBuffLenR, transL2RBuff, transL2RBuffLen, nearPlane, farPlane));
     }
 }
Ejemplo n.º 25
0
 public static int arwGetTrackableOptionInt(int markerID, int option)
 {
     if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         return(ARNativePluginStatic.arwGetTrackableOptionInt(markerID, option));
     }
     else
     {
         return(ARNativePlugin.arwGetTrackableOptionInt(markerID, option));
     }
 }
Ejemplo n.º 26
0
 public static int arwGetError()
 {
     if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         return(ARNativePluginStatic.arwGetError());
     }
     else
     {
         return(ARNativePlugin.arwGetError());
     }
 }
Ejemplo n.º 27
0
    /// <summary>
    /// Shuts down the ARToolKit and frees all resources.
    /// N.B.: If this is being called from the destructor of the same module which
    /// supplied the log callback, be sure to set the logCallback = NULL
    /// prior to calling this function.
    /// </summary>
    /// <returns>true if successful, false if an error occurred.</returns>
    /// <seealso cref="arwInitialiseAR"/>
    public bool arwShutdownAR()
    {
        bool ok = false;

        ok = ARNativePlugin.arwShutdownAR();
        if (ok)
        {
            inited = false;
        }
        return(ok);
    }
Ejemplo n.º 28
0
 public static void arwSetTrackableOptionInt(int markerID, int option, int value)
 {
     if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         ARNativePluginStatic.arwSetTrackableOptionInt(markerID, option, value);
     }
     else
     {
         ARNativePlugin.arwSetTrackableOptionInt(markerID, option, value);
     }
 }
Ejemplo n.º 29
0
 public static float arwGetTrackerOptionFloat(int option)
 {
     if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         return(ARNativePluginStatic.arwGetTrackerOptionFloat(option));
     }
     else
     {
         return(ARNativePlugin.arwGetTrackerOptionFloat(option));
     }
 }
Ejemplo n.º 30
0
 public static void arwSetMatrixCodeType(int type)
 {
     if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         ARNativePluginStatic.arwSetMatrixCodeType(type);
     }
     else
     {
         ARNativePlugin.arwSetMatrixCodeType(type);
     }
 }