Ejemplo n.º 1
0
 /**
  * ImputStreamからARToolKit形式のマーカデータを読み、o_raster[4]に格納します。
  * @param i_stream
  * 読出し元のストリームです。
  * @param o_raster
  * 出力先のラスタ配列です。
  * バッファ形式は形式はINT1D_X8R8G8B8_32であり、4要素、かつ全て同一なサイズである必要があります。
  * @
  */
 public static void loadFromARToolKitFormFile(Stream i_stream, NyARRaster[] o_raster)
 {
     Debug.Assert(o_raster.Length == 4);
     //4個の要素をラスタにセットする。
     try
     {
         using (StreamReader sr = new StreamReader(i_stream))
         {
             string[] data = sr.ReadToEnd().Split(new Char[] { ' ', '\r', '\n' });
             //GBRAで一度読みだす。
             int idx = 0;
             for (int h = 0; h < 4; h++)
             {
                 Debug.Assert(o_raster[h].isEqualBufferType(NyARBufferType.INT1D_X8R8G8B8_32));
                 NyARRaster ra = o_raster[h];
                 idx = readBlock(data, idx, ra.getWidth(), ra.getHeight(), (int[])ra.getBuffer());
             }
         }
     }
     catch (Exception e)
     {
         throw new NyARRuntimeException(e);
     }
     return;
 }