コード例 #1
0
        public override void setup(CaptureDevice i_cap)
        {
            Device d3d = this.size(SCREEN_WIDTH, SCREEN_HEIGHT);

            i_cap.PrepareCapture(SCREEN_WIDTH, SCREEN_HEIGHT, 30.0f);
            INyARMarkerSystemConfig cf = new NyARMarkerSystemConfig(SCREEN_WIDTH, SCREEN_HEIGHT);

            d3d.RenderState.ZBufferEnable = true;
            d3d.RenderState.Lighting      = false;
            d3d.RenderState.CullMode      = Cull.CounterClockwise;
            this._ms = new NyARD3dMarkerSystem(cf);
            //recommended be NyARBufferType.BYTE1D_B8G8R8X8_32 or NyARBufferType.CS_BITMAP
            this._ss = new NyARDirectShowCamera(i_cap, NyARBufferType.OBJECT_CS_Bitmap);
            this._rs = new NyARD3dRender(d3d, this._ms);
            this.mid = this._ms.addARMarker(AR_CODE_FILE, 16, 25, 80);

            //set View mmatrix
            this._rs.loadARViewMatrix(d3d);
            //set Viewport matrix
            this._rs.loadARViewPort(d3d);
            //setD3dProjectionMatrix
            this._rs.loadARProjectionMatrix(d3d);
            this._ss.start();
            //should be NyARBufferType.BYTE1D_B8G8R8X8_32 or NyARBufferType.CS_BITMAP
            this._raster = new NyARBitmapRaster(64, 64, NyARBufferType.OBJECT_CS_Bitmap);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: xiaoxinwt/NyARToolkitCS
        public override void setup(CaptureDevice i_cap)
        {
            Device d3d = this.size(SCREEN_WIDTH, SCREEN_HEIGHT);
            INyARMarkerSystemConfig cf = new NyARMarkerSystemConfig(SCREEN_WIDTH, SCREEN_HEIGHT);

            d3d.RenderState.ZBufferEnable = true;
            d3d.RenderState.Lighting      = false;
            d3d.RenderState.CullMode      = Cull.CounterClockwise;
            this._ms = new NyARD3dMarkerSystem(cf);
            this._ss = new NyARSensor(cf.getScreenSize());
            this._rs = new NyARD3dRender(d3d, this._ms);
            this.mid = this._ms.addARMarker(AR_CODE_FILE, 16, 25, 80);
            //set View mmatrix
            this._rs.loadARViewMatrix(d3d);
            //set Viewport matrix
            this._rs.loadARViewPort(d3d);
            //setD3dProjectionMatrix
            this._rs.loadARProjectionMatrix(d3d);
            Bitmap src   = new Bitmap(TEST_IMAGE);
            Bitmap input = new Bitmap(src.Width, src.Height, System.Drawing.Imaging.PixelFormat.Format32bppRgb);

            using (Graphics g = Graphics.FromImage(input))
            {
                g.DrawImage(src, 0, 0);
            }
            this._ss.update(new NyARBitmapRaster(input));
        }
コード例 #3
0
        public override void setup(CaptureDevice i_cap)
        {
            Device d3d = this.size(SCREEN_WIDTH, SCREEN_HEIGHT);

            i_cap.PrepareCapture(SCREEN_WIDTH, SCREEN_HEIGHT, 30.0f);
            INyARMarkerSystemConfig cf = new NyARMarkerSystemConfig(SCREEN_WIDTH, SCREEN_HEIGHT);

            d3d.RenderState.ZBufferEnable = true;
            d3d.RenderState.Lighting      = false;
            d3d.RenderState.CullMode      = Cull.CounterClockwise;
            this._ms = new NyARD3dMarkerSystem(cf);
            this._ss = new NyARDirectShowCamera(i_cap);
            this._rs = new NyARD3dRender(d3d, this._ms);
            this.mid = this._ms.addARMarker(AR_CODE_FILE, 16, 25, 80);
//            this.mid = this._ms.addPsARPlayCard(1,80);
//            this.mid = this._ms.addARMarker(new Bitmap("../../../../../data/hiro.png"), 16, 25, 80); // you can use PNG style marker too.
            //this.mid = this._ms.addNyIdMarker(0, 80);// For Id  marker #0

            //set View mmatrix
            this._rs.loadARViewMatrix(d3d);
            //set Viewport matrix
            this._rs.loadARViewPort(d3d);
            //setD3dProjectionMatrix
            this._rs.loadARProjectionMatrix(d3d);
            this._ss.start();
        }
コード例 #4
0
 private void setup(CaptureDevice i_cap)
 {
     Device d3d = this.size(SCREEN_WIDTH, SCREEN_HEIGHT);
     i_cap.PrepareCapture(SCREEN_WIDTH, SCREEN_HEIGHT, 30.0f);
     INyARMarkerSystemConfig cf = new NyARMarkerSystemConfig(SCREEN_WIDTH, SCREEN_HEIGHT);
     d3d.RenderState.ZBufferEnable = true;
     d3d.RenderState.Lighting = false;
     d3d.RenderState.CullMode = Cull.CounterClockwise;
     this._ms = new NyARD3dMarkerSystem(cf);
     this._ss = new NyARDirectShowCamera(i_cap);
     this._rs = new NyARD3dRender(d3d, this._ms);
     this.mid = this._ms.addARMarker(AR_CODE_FILE, 16, 25, 80);
     this._rs.loadARViewMatrix(d3d);
     this._rs.loadARViewPort(d3d);
     this._rs.loadARProjectionMatrix(d3d);
     this._ss.start();
 }
コード例 #5
0
ファイル: Program.cs プロジェクト: xiaoxinwt/NyARToolkitCS
            public override void setup(CaptureDevice i_cap)
            {
                Device d3d = this.size(SCREEN_WIDTH, SCREEN_HEIGHT);

                i_cap.PrepareCapture(SCREEN_WIDTH, SCREEN_HEIGHT, 30.0f);
                INyARNftSystemConfig cf = new NyARNftSystemConfig(File.OpenRead(cparam_file), SCREEN_WIDTH, SCREEN_HEIGHT);

                d3d.RenderState.ZBufferEnable = true;
                d3d.RenderState.Lighting      = false;
                d3d.RenderState.CullMode      = Cull.CounterClockwise;
                this._ms = new NyARD3dNftSystem(cf);
                this._ss = new NyARDirectShowCamera(i_cap);
                this._rs = new NyARD3dRender(d3d, this._ms);
                this.mid = this._ms.addNftTarget(fset3file, 160);

                //set View mmatrix
                this._rs.loadARViewMatrix(d3d);
                //set Viewport matrix
                this._rs.loadARViewPort(d3d);
                //setD3dProjectionMatrix
                this._rs.loadARProjectionMatrix(d3d);
                this._ss.start();
            }