예제 #1
0
        public DebugRenderer(SlimDX.Direct3D11.Device device)
        {
            mEffect = EffectUtil.CompileEffect(device, @"Shaders\DebugRenderer.fx");

            var positionInputElements = new[]
            {
                new InputElement("POSITION", 0, POSITION_FORMAT, POSITION_SLOT)
            };

            var positionTexcoordInputElements = new[]
            {
                new InputElement("POSITION", 0, POSITION_FORMAT, POSITION_SLOT),
                new InputElement("TEXCOORD", 0, TEXCOORD_FORMAT, TEXCOORD_SLOT)
            };

            EffectTechnique effectTechnique;

            effectTechnique      = mEffect.GetTechniqueByName("RenderWireframe");
            mRenderWireframePass = effectTechnique.GetPassByName("RenderWireframe");

            effectTechnique  = mEffect.GetTechniqueByName("RenderSolid");
            mRenderSolidPass = effectTechnique.GetPassByName("RenderSolid");

            effectTechnique      = mEffect.GetTechniqueByName("RenderTexture3D");
            mRenderTexture3DPass = effectTechnique.GetPassByName("RenderTexture3D");

            effectTechnique = mEffect.GetTechniqueByName("RenderGreyScaleTexture3D");
            mRenderGreyScaleTexture3DPass = effectTechnique.GetPassByName("RenderGreyScaleTexture3D");

            mRenderWireframeInputLayout          = new InputLayout(device, mRenderWireframePass.Description.Signature, positionInputElements);
            mRenderSolidInputLayout              = new InputLayout(device, mRenderSolidPass.Description.Signature, positionInputElements);
            mRenderTexture3DInputLayout          = new InputLayout(device, mRenderTexture3DPass.Description.Signature, positionTexcoordInputElements);
            mRenderGreyScaleTexture3DInputLayout = new InputLayout(device, mRenderGreyScaleTexture3DPass.Description.Signature, positionTexcoordInputElements);

            mPositionVertexBuffer = new SlimDX.Direct3D11.Buffer(device,
                                                                 null,
                                                                 NUM_VERTICES * POSITION_NUM_COMPONENTS_PER_VERTEX * POSITION_NUM_BYTES_PER_COMPONENT,
                                                                 ResourceUsage.Dynamic,
                                                                 BindFlags.VertexBuffer,
                                                                 CpuAccessFlags.Write,
                                                                 ResourceOptionFlags.None,
                                                                 0);

            mTexCoordVertexBuffer = new SlimDX.Direct3D11.Buffer(device,
                                                                 null,
                                                                 NUM_VERTICES * TEXCOORD_NUM_COMPONENTS_PER_VERTEX * TEXCOORD_NUM_BYTES_PER_COMPONENT,
                                                                 ResourceUsage.Dynamic,
                                                                 BindFlags.VertexBuffer,
                                                                 CpuAccessFlags.Write,
                                                                 ResourceOptionFlags.None,
                                                                 0);
        }
        public MergeSegmentationRenderingStrategy(SlimDX.Direct3D11.Device device, DeviceContext deviceContext, TileManager tileManager)
        {
            mTileManager   = tileManager;
            mDebugRenderer = new DebugRenderer(device);

            mEffect = EffectUtil.CompileEffect(device, @"Shaders\MergeRenderer2D.fx");

            var positionTexcoordInputElements = new[]
            {
                new InputElement("POSITION", 0, POSITION_FORMAT, POSITION_SLOT),
                new InputElement("TEXCOORD", 0, TEXCOORD_FORMAT, TEXCOORD_SLOT)
            };

            EffectTechnique effectTechnique = mEffect.GetTechniqueByName("TileManager2D");

            mPass = effectTechnique.GetPassByName("TileManager2D");

            mInputLayout = new InputLayout(device, mPass.Description.Signature, positionTexcoordInputElements);

            mPositionVertexBuffer = new Buffer(device,
                                               null,
                                               QUAD_NUM_VERTICES * POSITION_NUM_COMPONENTS_PER_VERTEX * POSITION_NUM_BYTES_PER_COMPONENT,
                                               ResourceUsage.Dynamic,
                                               BindFlags.VertexBuffer,
                                               CpuAccessFlags.Write,
                                               ResourceOptionFlags.None,
                                               0);

            mTexCoordVertexBuffer = new Buffer(device,
                                               null,
                                               QUAD_NUM_VERTICES * TEXCOORD_NUM_COMPONENTS_PER_VERTEX * TEXCOORD_NUM_BYTES_PER_COMPONENT,
                                               ResourceUsage.Dynamic,
                                               BindFlags.VertexBuffer,
                                               CpuAccessFlags.Write,
                                               ResourceOptionFlags.None,
                                               0);

            //bool result;
            //mTinyTextContext = new Context( device, deviceContext, Constants.MAX_NUM_TINY_TEXT_CHARACTERS, out result );
            //Release.Assert( result );

            mStopwatch.Start();
        }