Ejemplo n.º 1
0
        /// <summary>
        /// Begins a draw batch operation using the specified sort, given state objects, and transformation matrix.
        /// </summary>
        /// <param name="sortMode">The drawing order.</param>
        /// <param name="blendState">Blending options.</param>
        /// <param name="samplerState">Texture sampling options.</param>
        /// <param name="depthStencilState">Depth and stencil options.</param>
        /// <param name="rasterizerState">Rasterization options.</param>
        /// <param name="effect">Effect state options.</param>
        /// <param name="transform">Transformation matrix for scale, rotate, translate options.</param>
        public void Begin (DrawSortMode sortMode, BlendState blendState, SamplerState samplerState, DepthStencilState depthStencilState, RasterizerState rasterizerState, Effect effect, Matrix transform)
        {
            if (_inDraw)
                throw new InvalidOperationException("DrawBatch already inside Begin/End pair");

            _sortMode = sortMode;
            _blendState = blendState;
            _samplerState = samplerState;
            _depthStencilState = depthStencilState;
            _rasterizerState = rasterizerState;
            _effect = effect;
            _transform = transform;

            _infoBufferIndex = 0;
            _indexBufferIndex = 0;
            _vertexBufferIndex = 0;

            if (sortMode == DrawSortMode.Immediate)
                SetRenderState();

            _inDraw = true;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Begins a draw batch operation using the specified sort and given state objects.
 /// </summary>
 /// <param name="sortMode">The drawing order.</param>
 /// <param name="blendState">Blending options.</param>
 /// <param name="samplerState">Texture sampling options.</param>
 /// <param name="depthStencilState">Depth and stencil options.</param>
 /// <param name="rasterizerState">Rasterization options.</param>
 /// <param name="effect">Effect state options.</param>
 public void Begin (DrawSortMode sortMode, BlendState blendState, SamplerState samplerState, DepthStencilState depthStencilState, RasterizerState rasterizerState, Effect effect)
 {
     Begin(sortMode, blendState, samplerState, depthStencilState, rasterizerState, effect, Matrix.Identity);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Begins a draw batch operation using the specified sort and default state objects.
 /// </summary>
 /// <param name="sortMode">The drawing order.</param>
 public void Begin (DrawSortMode sortMode)
 {
     Begin(sortMode, null, null, null, null, null, Matrix.Identity);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Begins a draw batch operation using the specified sort and given state objects.
 /// </summary>
 /// <param name="sortMode">The drawing order.</param>
 /// <param name="blendState">Blending options.</param>
 public void Begin (DrawSortMode sortMode, BlendState blendState)
 {
     Begin(sortMode, blendState, null, null, null, null, Matrix.Identity);
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Enables a group of figures to be drawn using the same settings.
        /// </summary>
        /// <param name="device"></param>
        //public DrawBatch (GraphicsDevice device)
        //{
        public DrawBatch () : base()
        {
            //if (device == null)
            //    throw new ArgumentNullException("device");

            //_device = device;
            //_device.DeviceReset += GraphicsDeviceReset;

            _infoBuffer = new DrawingInfo[2048];
            //var info = base.CreateGeometryInstance(8192, 32768);
            
            _indexBuffer = new short[32768];
            _vertexBuffer = new VertexPositionColorTexture[8192];
            _computeBuffer = new CCVector2[64];
            _colorBuffer = new Color[64];
            _geometryBuffer = new CCVector2[256];
            _pathBuilder = new PathBuilder();

            //_standardEffect = new BasicEffect(device);
            //_standardEffect.TextureEnabled = true;
            //_standardEffect.VertexColorEnabled = true;

            //_defaultTexture = new Texture2D(device, 1, 1);
            //_defaultTexture.SetData<Color>(new Color[] { Microsoft.Xna.Framework.Color.White });
            _sortMode = DrawSortMode.Immediate;

            _ws = new PenWorkspace();
        }