Ejemplo n.º 1
0
        public SimpleLiteD3d(NyARToolkitCS topLevelForm, ResourceBuilder i_resource)
        {
            NyMath.initialize();
            this._capture = i_resource.createWmCapture();
            this._capture.setOnSample(this);

            this._d3dmgr = i_resource.createD3dManager(topLevelForm);
            this._back_ground = i_resource.createBackGround(this._d3dmgr);
            this._d3dcube = new ColorCube(this._d3dmgr.d3d_device,40);


            //AR用のパターンコードを読み出
            NyARCode code = i_resource.createNyARCode();
            //ARラスタを作る(DirectShowキャプチャ仕様)。
            this.m_raster = i_resource.createARRaster();

            //1パターンのみを追跡するクラスを作成
            this.m_ar = new NyARSingleDetectMarker(i_resource.ar_param, code, 80.0, this.m_raster.getBufferType());
            //計算モードの設定
            this.m_ar.setContinueMode(false);

            ////立方体(頂点数8)の準備


            return;
        }
Ejemplo n.º 2
0
        public SimpleLiteD3d(NyARToolkitCS topLevelForm, ResourceBuilder i_resource)
        {
            NyMath.initialize();
            this._capture = i_resource.createWmCapture();
            this._capture.setOnSample(this);

            this._d3dmgr      = i_resource.createD3dManager(topLevelForm);
            this._back_ground = i_resource.createBackGround(this._d3dmgr);
            this._d3dcube     = new ColorCube(this._d3dmgr.d3d_device, 40);


            //AR用のパターンコードを読み出
            NyARCode code = i_resource.createNyARCode();

            //ARラスタを作る(DirectShowキャプチャ仕様)。
            this.m_raster = i_resource.createARRaster();

            //1パターンのみを追跡するクラスを作成
            this.m_ar = new NyARSingleDetectMarker(i_resource.ar_param, code, 80.0, this.m_raster.getBufferType());
            //計算モードの設定
            this.m_ar.setContinueMode(false);

            ////立方体(頂点数8)の準備


            return;
        }
Ejemplo n.º 3
0
        public void CopyFromRaster(DsRGB565Raster i_raster)
        {
            Debug.Assert(i_raster.isEqualBufferType(NyARBufferType.WORD1D_R5G6B5_16LE));
            int pitch;
            GraphicsStream gs = this._surface.LockRectangle(this.m_src_rect,LockFlags.None, out pitch);
            Marshal.Copy((short[])i_raster.getBuffer(), 0, (IntPtr)((int)gs.InternalData), this._width * 2 * this._height);

            this._surface.UnlockRectangle();

            return;
        }        
Ejemplo n.º 4
0
        public void CopyFromRaster(DsRGB565Raster i_raster)
        {
            Debug.Assert(i_raster.isEqualBufferType(NyARBufferType.WORD1D_R5G6B5_16LE));
            int            pitch;
            GraphicsStream gs = this._surface.LockRectangle(this.m_src_rect, LockFlags.None, out pitch);

            Marshal.Copy((short[])i_raster.getBuffer(), 0, (IntPtr)((int)gs.InternalData), this._width * 2 * this._height);

            this._surface.UnlockRectangle();

            return;
        }
Ejemplo n.º 5
0
        public void CopyFromRaster(DsRGB565Raster i_raster)
        {
            //BUFFERFORMAT_WORD1D_R5G6B5_16LEしか受けられません。
            Debug.Assert(i_raster.isEqualBufferType(NyARBufferType.WORD1D_R5G6B5_16LE));
            int            pi;
            int            w  = this.m_width;
            GraphicsStream gs = this._texture.LockRectangle(0, LockFlags.None, out pi);

            short[] buf   = (short[])i_raster.getBuffer();
            int     st    = this.m_width;
            int     s_idx = 0;
            int     d_idx = 0;

            for (int i = this.m_height - 1; i >= 0; i--)
            {
                Marshal.Copy(buf, s_idx, (IntPtr)((int)gs.InternalData + d_idx), w);
                s_idx += st;
                d_idx += pi;
            }
            this._texture.UnlockRectangle(0);
            return;
        }
Ejemplo n.º 6
0
        public void CopyFromRaster(DsRGB565Raster i_raster)
        {
            Debug.Assert(i_raster.isEqualBufferType(NyARBufferType.WORD1D_R5G6B5_16LE));
            int pitch;
            GraphicsStream gs = this._surface.LockRectangle(this._src_rect, LockFlags.None, out pitch);
            /*
            int cp_size = this.m_width * 4;
            int s_idx=0;
            int d_idx = (this.m_height - 1) * cp_size;
            for(int i=this.m_height-1;i>=0;i--){
                //どう考えてもポインタです。
                Marshal.Copy((byte[])i_sample.getBufferReader().getBuffer(),s_idx,(IntPtr)((int)gs.InternalData+d_idx),cp_size);
                s_idx += cp_size;
                d_idx -= cp_size;
            }
            */
            Marshal.Copy((short[])i_raster.getBuffer(), 0, (IntPtr)((int)gs.InternalData), this._width  * this._height);

            this._surface.UnlockRectangle();

            return;
        }
Ejemplo n.º 7
0
        public void CopyFromRaster(DsRGB565Raster i_raster)
        {
            Debug.Assert(i_raster.isEqualBufferType(NyARBufferType.WORD1D_R5G6B5_16LE));
            int            pitch;
            GraphicsStream gs = this._surface.LockRectangle(this._src_rect, LockFlags.None, out pitch);

            /*
             * int cp_size = this.m_width * 4;
             * int s_idx=0;
             * int d_idx = (this.m_height - 1) * cp_size;
             * for(int i=this.m_height-1;i>=0;i--){
             *  //どう考えてもポインタです。
             *  Marshal.Copy((byte[])i_sample.getBufferReader().getBuffer(),s_idx,(IntPtr)((int)gs.InternalData+d_idx),cp_size);
             *  s_idx += cp_size;
             *  d_idx -= cp_size;
             * }
             */
            Marshal.Copy((short[])i_raster.getBuffer(), 0, (IntPtr)((int)gs.InternalData), this._width * this._height);

            this._surface.UnlockRectangle();

            return;
        }
Ejemplo n.º 8
0
        public Test_NyARRealityD3d_ARMarker(Form1 topLevelForm, ResourceBuilder i_resource)
        {
            this._capture = i_resource.createWmCapture();
            this._capture.setOnSample(this);

            this._d3dmgr      = i_resource.createD3dManager(topLevelForm);
            this._back_ground = i_resource.createBackGround(this._d3dmgr);
            this._d3dcube     = new ColorCube(this._d3dmgr.d3d_device, 40);


            //ARラスタを作る(DirectShowキャプチャ仕様)。
            this.m_raster = i_resource.createARRaster();
            //AR用のパターンコードを読み出


            //マーカライブラリ(ARTKId)の構築
            this._mklib = new ARTKMarkerTable(10, 16, 16, 25, 25, 4);
            //マーカテーブルの作成(1種類)
            this._mklib.addMarker(i_resource.createNyARCode(), 0, "HIRO", 80, 80);

            //Realityの準備
            this._reality        = new NyARRealityD3d(i_resource.ar_param, 10, 10000, 1, 5);
            this._reality_source = new NyARRealitySource_WMCapture(SCREEN_WIDTH, SCREEN_HEIGHT, null, 2, 100);
        }
        public Test_NyARRealityD3d_ARMarker(Form1 topLevelForm, ResourceBuilder i_resource)
        {
            this._capture = i_resource.createWmCapture();
            this._capture.setOnSample(this);

            this._d3dmgr = i_resource.createD3dManager(topLevelForm);
            this._back_ground = i_resource.createBackGround(this._d3dmgr);
            this._d3dcube = new ColorCube(this._d3dmgr.d3d_device,40);


            //ARラスタを作る(DirectShowキャプチャ仕様)。
            this.m_raster = i_resource.createARRaster();
            //AR用のパターンコードを読み出


            //マーカライブラリ(ARTKId)の構築
            this._mklib = new ARTKMarkerTable(10, 16, 16, 25, 25, 4);
            //マーカテーブルの作成(1種類)
            this._mklib.addMarker(i_resource.createNyARCode(), 0, "HIRO", 80, 80);

            //Realityの準備
            this._reality = new NyARRealityD3d(i_resource.ar_param, 10, 10000, 1, 5);
            this._reality_source = new NyARRealitySource_WMCapture(SCREEN_WIDTH, SCREEN_HEIGHT, null, 2, 100);


        }
Ejemplo n.º 10
0
 public void CopyFromRaster(DsRGB565Raster i_raster)
 {
     //BUFFERFORMAT_WORD1D_R5G6B5_16LEしか受けられません。
     Debug.Assert(i_raster.isEqualBufferType(NyARBufferType.WORD1D_R5G6B5_16LE));
     int pi;
     int w = this.m_width;
     GraphicsStream gs = this._texture.LockRectangle(0, LockFlags.None, out pi);
     short[] buf = (short[])i_raster.getBuffer();
     int st = this.m_width;
     int s_idx = 0;
     int d_idx = 0;
     for (int i = this.m_height - 1; i >= 0; i--)
     {
         Marshal.Copy(buf, s_idx, (IntPtr)((int)gs.InternalData + d_idx), w);
         s_idx += st;
         d_idx += pi;
     }
     this._texture.UnlockRectangle(0);
     return;
 }