Ejemplo n.º 1
0
        private unsafe void Flush()
        {
            ApplyStates();

            if (_numSprites == 0)
                return;

            fixed(SpriteVertex *p = &_vertexInfo[0]) _vertexBuffer.SetDataPointerEXT(0, (IntPtr)p, _numSprites * 4 * SpriteVertex.SizeInBytes, SetDataOptions.None);

            DrawInfo   current = _textureInfo[0];
            int        offset  = 0;
            Techniques last    = Techniques.None;

            for (int i = 1; i < _numSprites; i++)
            {
                if (_textureInfo[i].Texture != current.Texture || _textureInfo[i].Technique != current.Technique)
                {
                    InternalDraw(current, offset, i - offset, ref last);
                    current = _textureInfo[i];
                    offset  = i;
                }
                else
                {
                    Merged++;
                }
            }

            InternalDraw(current, offset, _numSprites - offset, ref last);
            Calls      += _numSprites;
            _numSprites = 0;
        }
Ejemplo n.º 2
0
        //--------------------//

        #region Passes
        /// <summary>
        /// Runs the actual shader passes
        /// </summary>
        /// <param name="render">The render delegate (is called once for every shader pass)</param>
        /// <param name="sceneSize">The size of the scene on the screen - leave empty for fullscreen</param>
        /// <param name="sceneMap">A texture containing the rendered scene, <c>null</c> if the shader doesn't need it</param>
        protected virtual void RunPasses(Action render, Size sceneSize, RenderTarget sceneMap)
        {
            if (render == null)
            {
                throw new ArgumentNullException(nameof(render));
            }

            int passCount = Effect.Begin(FX.None);
            IList <SasScriptCommand> techniqueScript;

            if (Techniques.TryGetValue(Effect.Technique, out techniqueScript))
            {
                ExecuteScript(techniqueScript, render, sceneSize, sceneMap);
            }
            else
            {
                for (int i = 0; i < passCount; i++)
                {
                    // ReSharper disable AccessToModifiedClosure
                    using (new ProfilerEvent(() => "Pass " + i))
                    {
                        Effect.BeginPass(i);
                        render();
                        Effect.EndPass();
                    }
                    // ReSharper restore AccessToModifiedClosure
                }
            }

            Effect.End();
        }
Ejemplo n.º 3
0
 public Techniques(Techniques other) : this(OgrePINVOKE.new_Techniques__SWIG_1(Techniques.getCPtr(other)), true)
 {
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Ejemplo n.º 4
0
 private void DrawAllVertices(Techniques first, Techniques last)
 {
     // draw normal objects
     for (var effect = first; effect <= last; effect++)
     {
         //switch (effect)
         //{
         //    case Techniques.Hued: _effect.CurrentTechnique = _effect.Techniques["HueTechnique"]; break;
         //    case Techniques.MiniMap: _effect.CurrentTechnique = _effect.Techniques["MiniMapTechnique"]; break;
         //    case Techniques.Grayscale: _effect.CurrentTechnique = _effect.Techniques["GrayscaleTechnique"]; break;
         //    case Techniques.ShadowSet: _effect.CurrentTechnique = _effect.Techniques["ShadowSetTechnique"]; SetDepthStencilState(true, true); break;
         //    case Techniques.StencilSet: // do nothing; break;
         //    default: Utils.Critical("Unknown effect in SpriteBatch3D.Flush(). Effect index is {effect}"); break;
         //}
         //_effect.CurrentTechnique.Passes[0].Apply();
         var vertexEnumerator = _drawQueue[(int)effect].GetEnumerator();
         while (vertexEnumerator.MoveNext())
         {
             var texture    = vertexEnumerator.Current.Key;
             var vertexList = vertexEnumerator.Current.Value;
             //GraphicsDevice.Textures[0] = texture;
             //GraphicsDevice.DrawUserIndexedPrimitives(PrimitiveType.TriangleList, CopyVerticesToArray(vertexList), 0, Math.Min(vertexList.Count, MAX_VERTICES_PER_DRAW), _indexBuffer, 0, vertexList.Count / 2);
             vertexList.Clear();
             _vertexListQueue.Enqueue(vertexList);
         }
         _drawQueue[(int)effect].Clear();
     }
 }
        public async Task <IActionResult> PutTechniques(int id, Techniques techniques)
        {
            if (id != techniques.Id)
            {
                return(BadRequest());
            }

            _context.Entry(techniques).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TechniquesExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Ejemplo n.º 6
0
 public TechniquesEnumerator(Techniques collection)
 {
     collectionRef = collection;
     currentIndex  = -1;
     currentObject = null;
     currentSize   = collectionRef.Count;
 }
Ejemplo n.º 7
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Description")] Techniques techniques)
        {
            if (id != techniques.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(techniques);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TechniquesExists(techniques.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(techniques));
        }
Ejemplo n.º 8
0
        public BasicEffect(GraphicsDevice graphicsDevice)
            : base(graphicsDevice)
        {
            var technique = new EffectTechnique("Basic");

            ThreadingHelper.BlockOnUIThread(() => {
                Shader[] shaders = new Shader[]
                {
                    new Shader(ShaderType.VertexShader, vertexShader),
                    new Shader(ShaderType.FragmentShader, pixelShader)
                };

                foreach (Shader shader in shaders)
                {
                    shader.Compile();
                }
                EffectPass pass = new EffectPass("Basic");
                pass.AttachShaders(shaders);
                pass.BindAttribute(VertexElementUsage.Color, "color");
                pass.BindAttribute(VertexElementUsage.TextureCoordinate, "textureCoordinate");
                pass.BindAttribute(VertexElementUsage.Position, "position");
                pass.Link();



                technique.Passes.Add(pass);
                Techniques.Add(technique);
            });
            CurrentTechnique = technique;


            Initialize();

            World = View = Projection = Matrix.Identity;
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Runs the actual shader passes
        /// </summary>
        /// <param name="render">The render delegate (is called once for every shader pass)</param>
        /// <param name="material">The material to be used by this shader; <c>null</c> for device texture</param>
        /// <param name="lights">An array of all lights this shader should consider; <c>null</c> for no lighting</param>
        protected virtual void RunPasses(Action render, XMaterial material, params LightSource[] lights)
        {
            #region Sanity checks
            if (render == null)
            {
                throw new ArgumentNullException(nameof(render));
            }
            if (lights == null)
            {
                throw new ArgumentNullException(nameof(lights));
            }
            #endregion

            int passCount = Effect.Begin(FX.None);
            IList <SasScriptCommand> techniqueScript;
            if (Techniques.TryGetValue(Effect.Technique, out techniqueScript))
            {
                ExecuteScript(techniqueScript, render);
            }
            else
            {
                for (int i = 0; i < passCount; i++)
                {
                    Effect.BeginPass(i);
                    render();
                    Effect.EndPass();
                }
            }

            Effect.End();
        }
Ejemplo n.º 10
0
        public Tags(IEnumerable <Footwork> footwork,
                    IEnumerable <Technique> techniques,
                    IEnumerable <Target> targets,
                    IEnumerable <Guard> guards,
                    IEnumerable <GuardModifier> guardModifiers,
                    IEnumerable <Measure> measures)
        {
            Footwork.AddRange(footwork);
            Techniques.AddRange(techniques);
            Targets.AddRange(targets);
            Guards.AddRange(guards);
            GuardModifiers.AddRange(guardModifiers);
            Measures.AddRange(measures);

            Footwork.Insert(0, new Footwork()
            {
            });
            Techniques.Insert(0, new Technique()
            {
            });
            Targets.Insert(0, new Target()
            {
            });
            Guards.Insert(0, new Guard()
            {
            });
            GuardModifiers.Insert(0, new GuardModifier()
            {
            });
            Measures.Insert(0, new Measure()
            {
            });
        }
Ejemplo n.º 11
0
        public bool DrawSprite(Texture2D texture, SpriteVertex[] vertices, Techniques technique = Techniques.Default)
        {
            if (!_isStarted)
            {
                throw new Exception();
            }

            if (texture == null || texture.IsDisposed)
            {
                return(false);
            }

            bool draw = false;

            for (byte i = 0; i < 4; i++)
            {
                if (_drawingArea.Contains(vertices[i].Position) == ContainmentType.Contains)
                {
                    draw = true;
                    break;
                }
            }

            if (!draw)
            {
                return(false);
            }

#if !ORIONSORT
            vertices[0].Position.Z = vertices[1].Position.Z = vertices[2].Position.Z = vertices[3].Position.Z = GetZ();
#endif
            Push(texture, vertices, technique);

            return(true);
        }
Ejemplo n.º 12
0
        private void Flush()
        {
            if (_numSprites == 0)
            {
                return;
            }
            int        offset = 0;
            Techniques last   = Techniques.None;

            ApplyStates();
            _vertexBuffer.SetData(0, _vertexInfo, 0, _numSprites * 4, SpriteVertex.SizeInBytes);
            DrawInfo current = _textureInfo[0];

            for (int i = 1; i < _numSprites; i++)
            {
                if (_textureInfo[i].Texture != current.Texture || _textureInfo[i].Technique != current.Technique)
                {
                    InternalDraw(current, offset, i - offset, ref last);
                    current = _textureInfo[i];
                    offset  = i;
                }
                else
                {
                    Merged++;
                }
            }

            InternalDraw(current, offset, _numSprites - offset, ref last);
            Calls      += _numSprites;
            _numSprites = 0;
        }
Ejemplo n.º 13
0
 public void AddRange(Techniques values)
 {
     OgrePINVOKE.Techniques_AddRange(swigCPtr, Techniques.getCPtr(values));
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Ejemplo n.º 14
0
 public void SetRange(int index, Techniques values)
 {
     OgrePINVOKE.Techniques_SetRange(swigCPtr, index, Techniques.getCPtr(values));
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
        public ActionResult DeleteConfirmed(int id)
        {
            Techniques techniques = db.Techniques.Find(id);

            db.Techniques.Remove(techniques);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 16
0
        public Techniques getSupportedTechniques()
        {
            Techniques ret = new Techniques(OgrePINVOKE.MaterialPtr_getSupportedTechniques(swigCPtr), false);

            if (OgrePINVOKE.SWIGPendingException.Pending)
            {
                throw OgrePINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Ejemplo n.º 17
0
        public async Task <IActionResult> Create([Bind("Id,Name,Description")] Techniques techniques)
        {
            if (ModelState.IsValid)
            {
                _context.Add(techniques);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(techniques));
        }
Ejemplo n.º 18
0
            public ShadowMapEffect(Effect cloneSource)
                : base(cloneSource)
            {
                world = Parameters["World"];
                lightViewProjection = Parameters["LightViewProjection"];

                defaultTechnique = Techniques["Default"];
                vsmTechnique     = Techniques["Vsm"];

                ShadowMapTechnique = DefaultShadowMapTechnique;
            }
Ejemplo n.º 19
0
        public Texture(Texture2D texture, Vector2 position, Techniques technique, float scale = 1, Texture2D flowmap = null)
        {
            _effect  = Game1.MyContent.Load <Effect>(@"effects/Texture");
            _texture = texture;

            _technique = technique;

            _flowMap = flowmap;

            CreateWith16BitIndices(position, scale);
        }
Ejemplo n.º 20
0
        private void DrawAllVertices(Techniques first, Techniques last)
        {
            // draw normal objects
            for (Techniques effect = first; effect <= last; effect++)
            {
                switch (effect)
                {
                case Techniques.Hued:
                    m_Effect.CurrentTechnique = m_Effect.Techniques["HueTechnique"];
                    break;

                case Techniques.MiniMap:
                    m_Effect.CurrentTechnique = m_Effect.Techniques["MiniMapTechnique"];
                    break;

                case Techniques.Grayscale:
                    m_Effect.CurrentTechnique = m_Effect.Techniques["GrayscaleTechnique"];
                    break;

                case Techniques.ShadowSet:
                    m_Effect.CurrentTechnique = m_Effect.Techniques["ShadowSetTechnique"];
                    SetDepthStencilState(true, true);
                    break;

                case Techniques.StencilSet:
                    // do nothing;
                    break;

                default:
                    Tracer.Critical("Unknown effect in SpriteBatch3D.Flush(). Effect index is {0}", effect);
                    break;
                }
                m_Effect.CurrentTechnique.Passes[0].Apply();

                IEnumerator <KeyValuePair <Texture2D, List <VertexPositionNormalTextureHue> > > vertexEnumerator = m_DrawQueue[(int)effect].GetEnumerator();
                while (vertexEnumerator.MoveNext())
                {
                    Texture2D texture = vertexEnumerator.Current.Key;
                    List <VertexPositionNormalTextureHue> vertexList = vertexEnumerator.Current.Value;
                    GraphicsDevice.Textures[0] = texture;

                    if (effect == Techniques.Hued)
                    {
                        GraphicsDevice.Textures[1] = HueData.HueTexture0;
                        GraphicsDevice.Textures[2] = HueData.HueTexture1;
                    }

                    GraphicsDevice.DrawUserIndexedPrimitives(PrimitiveType.TriangleList, CopyVerticesToArray(vertexList), 0, vertexList.Count, m_IndexBuffer, 0, vertexList.Count / 2);
                    vertexList.Clear();
                    m_VertexListQueue.Enqueue(vertexList);
                }
                m_DrawQueue[(int)effect].Clear();
            }
        }
Ejemplo n.º 21
0
        public Techniques GetRange(int index, int count)
        {
            global::System.IntPtr cPtr = OgrePINVOKE.Techniques_GetRange(swigCPtr, index, count);
            Techniques            ret  = (cPtr == global::System.IntPtr.Zero) ? null : new Techniques(cPtr, true);

            if (OgrePINVOKE.SWIGPendingException.Pending)
            {
                throw OgrePINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Ejemplo n.º 22
0
        public static Techniques Repeat(Technique value, int count)
        {
            global::System.IntPtr cPtr = OgrePINVOKE.Techniques_Repeat(Technique.getCPtr(value), count);
            Techniques            ret  = (cPtr == global::System.IntPtr.Zero) ? null : new Techniques(cPtr, true);

            if (OgrePINVOKE.SWIGPendingException.Pending)
            {
                throw OgrePINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Ejemplo n.º 23
0
 public void Reset()
 {
     Books.Reset();
     Parts.Reset();
     Footwork.Reset();
     Targets.Reset();
     Measure.Reset();
     Techniques.Reset();
     Weapons.Reset();
     Guards.Reset();
     StartingGuards.Reset();
 }
 public ActionResult Edit([Bind(Include = "TechniqueID,TechniqueName,StartPositionID,EndPositionID,TechniqueType,DateAdded,StartingCondition,Steps,KeyPoints,CommonMistakes")] Techniques techniques)
 {
     if (ModelState.IsValid)
     {
         db.Entry(techniques).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.EndPositionID   = new SelectList(db.Positions, "PositionID", "PositionName", techniques.EndPositionID);
     ViewBag.StartPositionID = new SelectList(db.Positions, "PositionID", "PositionName", techniques.StartPositionID);
     return(View(techniques));
 }
        // GET: Techniques/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Techniques techniques = db.Techniques.Find(id);

            if (techniques == null)
            {
                return(HttpNotFound());
            }
            return(View(techniques));
        }
Ejemplo n.º 26
0
        public unsafe bool DrawSprite(Texture2D texture, SpriteVertex[] vertices, Techniques technique = Techniques.Default, Rectangle?scissorRectangle = null)
        {
            if (texture == null || texture.IsDisposed)
            {
                return(false);
            }
            bool draw = false;

            for (byte i = 0; i < 4; i++)
            {
                if (_drawingArea.Contains(vertices[i].Position) == ContainmentType.Contains)
                {
                    draw = true;

                    break;
                }
            }

            if (!draw)
            {
                return(false);
            }

            if (_numSprites >= MAX_SPRITES)
            {
                Flush();
            }
#if !ORIONSORT
            vertices[0].Position.Z = vertices[1].Position.Z = vertices[2].Position.Z = vertices[3].Position.Z = GetZ();
#endif
            _textureInfo[_numSprites] = new DrawInfo(texture, scissorRectangle.HasValue, scissorRectangle);

            fixed(SpriteVertex *p = &_vertexInfo[_numSprites * 4])
            {
                fixed(SpriteVertex *t = &vertices[0])
                {
                    SpriteVertex *ptr0 = p;

                    ptr0[0] = t[0];
                    ptr0[1] = t[1];
                    ptr0[2] = t[2];
                    ptr0[3] = t[3];
                }
            }

            _numSprites++;

            return(true);
        }
        public ActionResult Create([Bind(Include = "TechniqueID,TechniqueName,StartPositionID,EndPositionID,TechniqueType,DateAdded,StartingCondition,Steps,KeyPoints,CommonMistakes")] Techniques techniques)
        {
            if (ModelState.IsValid)
            {
                //This finds the posiiton based on starting positon then adds the technique to the collection of positions
                Positions pos = db.Positions.Find(techniques.StartPositionID);
                pos.Techniques.Add(techniques);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.EndPositionID   = new SelectList(db.Positions, "PositionID", "PositionName", techniques.EndPositionID);
            ViewBag.StartPositionID = new SelectList(db.Positions, "PositionID", "PositionName", techniques.StartPositionID);
            return(View(techniques));
        }
        // GET: Techniques/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Techniques techniques = db.Techniques.Find(id);

            if (techniques == null)
            {
                return(HttpNotFound());
            }
            ViewBag.EndPositionID   = new SelectList(db.Positions, "PositionID", "PositionName", techniques.EndPositionID);
            ViewBag.StartPositionID = new SelectList(db.Positions, "PositionID", "PositionName", techniques.StartPositionID);
            return(View(techniques));
        }
Ejemplo n.º 29
0
        private unsafe void Push(Texture2D texture, SpriteVertex[] vertices, Techniques technique)
        {
            AddQuadrilateralIndices(_vertexCount);

            if (_vertexCount + VERTEX_COUNT > _vertices.Length || _indicesCount + INDEX_COUNT > _indices.Length)
            {
                Flush();
            }

            DrawCallInfo call = new DrawCallInfo(texture, technique, _indicesCount, PRIMITIVES_COUNT, 0);


            fixed(SpriteVertex *p = &_vertices[_vertexCount])
            {
                fixed(SpriteVertex *t = &vertices[0])
                {
                    SpriteVertex *ptr  = p;
                    SpriteVertex *tptr = t;

                    *ptr++ = *tptr++;
                    *ptr++ = *tptr++;
                    *ptr++ = *tptr++;
                    *ptr   = *tptr;
                }
            }

            fixed(short *p = &_indices[_indicesCount])
            {
                fixed(short *t = &_geometryIndices[0])
                {
                    short *ptr  = p;
                    short *tptr = t;

                    *ptr++ = *tptr++;
                    *ptr++ = *tptr++;
                    *ptr++ = *tptr++;
                    *ptr++ = *tptr++;
                    *ptr++ = *tptr++;
                    *ptr   = *tptr;
                }
            }

            _vertexCount  += VERTEX_COUNT;
            _indicesCount += INDEX_COUNT;

            Enqueue(ref call);
        }
Ejemplo n.º 30
0
        public unsafe bool DrawSprite(Texture2D texture, SpriteVertex[] vertices, Techniques technique = Techniques.Default)
        {
            if (texture == null || texture.IsDisposed)
            {
                return(false);
            }
            bool draw = false;

            for (byte i = 0; i < 4; i++)
            {
                if (_drawingArea.Contains(vertices[i].Position) == ContainmentType.Contains)
                {
                    draw = true;

                    break;
                }
            }

            if (!draw)
            {
                return(false);
            }

            if (_numSprites >= MAX_SPRITES)
            {
                Flush();
            }

            _textureInfo[_numSprites] = texture;

            fixed(SpriteVertex *p = &_vertexInfo[_numSprites * 4])
            {
                fixed(SpriteVertex *t = &vertices[0])
                {
                    SpriteVertex *ptr0 = p;

                    ptr0[0] = t[0];
                    ptr0[1] = t[1];
                    ptr0[2] = t[2];
                    ptr0[3] = t[3];
                }
            }

            _numSprites++;

            return(true);
        }
Ejemplo n.º 31
0
 public void reset(Techniques tec)
 {
     switch (tec)
     {
         case Techniques.PSR:
             tEntradaN.Text = "6";
             tResultado.Text = tecnMath.permutacionSinRepeticion(6).ToString();
             break;
         case Techniques.PCR:
             tEntradaN.Text = "8";
             List<double> subsets = new List<double>();
             subsets.Add(3);
             subsets.Add(2);
             tResultado.Text = tecnMath.permutacionConRepeticion(8, subsets).ToString();
             break;
         case Techniques.VSR:
             tEntradaN.Text = "8";
             tEntradaM.Text = "3";
             bCalcular_Click(null, null);
             break;
         case Techniques.VCR:
             tEntradaN.Text = "2";
             tEntradaM.Text = "9";
             bCalcular_Click(null, null);
             break;
         case Techniques.CSR:
             tEntradaN.Text = "8";
             tEntradaM.Text = "3";
             bCalcular_Click(null, null);
             break;
         case Techniques.CCR:
             tEntradaN.Text = "3";
             tEntradaM.Text = "20";
             bCalcular_Click(null, null);
             break;
         case Techniques.PC:
             tEntradaN.Text = "5";
             bCalcular_Click(null, null);
             break;
         case Techniques.RM:
             break;
         case Techniques.RA:
             break;
     }
 }
Ejemplo n.º 32
0
        public Form1()
        {
            InitializeComponent();
            tecnMath = new TecnicasConteo();
            tResultado.ReadOnly = true;
            tecnActual = Techniques.PSR;
            ejemplos = new string[CANT_EJEMPLOS];

            ejemplos[0] = "E.g, ¿De cuántas se pueden formar 6 personas para abordar el autobús?";
            ejemplos[1] = "E.g, ¿Cuántas permutaciones se pueden hacer con la palabra infinito?";
            ejemplos[2] = "E.g, En un concurso nacional de programación, hay 8 finalistas. \nEncuentre el número de ordenamientos posibles al final del concurso para las primeras tres posiciones?";
            ejemplos[3] = "E.g, ¿En cuántas formas distdoubleas se puede responder una prueba de verdadero o falso que consta de 9 preguntas?";
            ejemplos[4] = "E.g, ¿Cuántas formas hay para seleccionar a 3 candidatos de 8 recien graduados \nigualmente calificados para las vacantes de una empresa?";
            ejemplos[5] = "E.g, Considere el siguiente segmento de un programa en Pascal, donde i, j, k son variables enteras. For i = 1 to 20 do \n    For j = 1 to i do \n For k = 1 to j do \n writeln(i*j + k)\n ¿Cuántas veces se repite writeln?";
            ejemplos[6] = "E.g, ¿De cuántas maneras se pueden plantar 5 árboles distdoubleos en un redondel?";
            ejemplos[7] = "E.g, Marco va armar una computadora por sí mismo. \nTiene la opción de comprar los chips entre 2 marcas, un disco duro de 4 marcas, la memoria de tres marcas, \ny un conjunto de accesorios en 5 tiendas locales. \n¿De cuántas formas diferentes puede Marco comprar las partes de la computadora?";
            ejemplos[8] = "¿De cuántas maneras se pueden seleccionar 2 libros de temas diferentes entre 5 libros de computación distdoubleos, \n3 libros de matemáticas diferentes y 2 libros de arte distdoubleos?";

            lExample.Text = ejemplos[0];
            reset(tecnActual);
        }
Ejemplo n.º 33
0
 private void rbRM_CheckedChanged(object sender, EventArgs e)
 {
     tEntradaM.Enabled = false;
     tecnActual = Techniques.RM;
     lExample.Text = ejemplos[7];
     reset(tecnActual);
 }
Ejemplo n.º 34
0
 private void rbVSR_CheckedChanged(object sender, EventArgs e)
 {
     tEntradaM.Enabled = true;
     tecnActual = Techniques.VSR;
     lExample.Text = ejemplos[2];
     reset(tecnActual);
 }
Ejemplo n.º 35
0
        /// <summary>
        /// Draws a quad on screen with the specified texture and vertices.
        /// </summary>
        /// <param name="texture"></param>
        /// <param name="vertices"></param>
        /// <returns>True if the object was drawn, false otherwise.</returns>
        public bool DrawSprite(Texture2D texture, VertexPositionNormalTextureHue[] vertices, Techniques effect = Techniques.Default)
        {
            bool draw = false;

            // Sanity: do not draw if there is no texture to draw with.
            if (texture == null)
                return false;

            // Check: only draw if the texture is within the visible area.
            for (int i = 0; i < 4; i++) // only draws a 2 triangle tristrip.
            {
                if (m_ViewportArea.Contains(vertices[i].Position) == ContainmentType.Contains)
                {
                    draw = true;
                    break;
                }
            }
            if (!draw)
                return false;

            // Set the draw position's z value, and increment the z value for the next drawn object.
            vertices[0].Position.Z = vertices[1].Position.Z = vertices[2].Position.Z = vertices[3].Position.Z = GetNextUniqueZ();

            // Get the vertex list for this texture. if none exists, dequeue existing or create a new vertex list.
            List<VertexPositionNormalTextureHue> vertexList = GetVertexList(texture, effect);

            // Add the drawn object to the vertex list.
            for(int i = 0; i < vertices.Length; i++)
                vertexList.Add(vertices[i]);

            return true;
        }
Ejemplo n.º 36
0
        private void DrawAllVertices(Techniques first, Techniques last)
        {
            // draw normal objects
            for (Techniques effect = first; effect <= last; effect++)
            {
                switch (effect)
                {
                    case Techniques.Hued:
                        m_Effect.CurrentTechnique = m_Effect.Techniques["HueTechnique"];
                        break;
                    case Techniques.MiniMap:
                        m_Effect.CurrentTechnique = m_Effect.Techniques["MiniMapTechnique"];
                        break;
                    case Techniques.Grayscale:
                        m_Effect.CurrentTechnique = m_Effect.Techniques["GrayscaleTechnique"];
                        break;
                    case Techniques.ShadowSet:
                        m_Effect.CurrentTechnique = m_Effect.Techniques["ShadowSetTechnique"];
                        SetDepthStencilState(true, true);
                        break;
                    case Techniques.StencilSet:
                        // do nothing;
                        break;
                    default:
                        Tracer.Critical("Unknown effect in SpriteBatch3D.Flush(). Effect index is {0}", effect);
                        break;
                }
                m_Effect.CurrentTechnique.Passes[0].Apply();

                IEnumerator<KeyValuePair<Texture2D, List<VertexPositionNormalTextureHue>>> vertexEnumerator = m_DrawQueue[(int)effect].GetEnumerator();
                while (vertexEnumerator.MoveNext())
                {
                    Texture2D texture = vertexEnumerator.Current.Key;
                    List<VertexPositionNormalTextureHue> vertexList = vertexEnumerator.Current.Value;
                    GraphicsDevice.Textures[0] = texture;
                    GraphicsDevice.DrawUserIndexedPrimitives(PrimitiveType.TriangleList, CopyVerticesToArray(vertexList), 0,  Math.Min(vertexList.Count,MAX_VERTICES_PER_DRAW), m_IndexBuffer, 0, vertexList.Count / 2);
                    vertexList.Clear();
                    m_VertexListQueue.Enqueue(vertexList);
                }
                m_DrawQueue[(int)effect].Clear();
            }
        }
Ejemplo n.º 37
0
 private List<VertexPositionNormalTextureHue> GetVertexList(Texture2D texture, Techniques effect)
 {
     List<VertexPositionNormalTextureHue> vertexList;
     if (m_DrawQueue[(int)effect].ContainsKey(texture))
     {
         vertexList = m_DrawQueue[(int)effect][texture];
     }
     else
     {
         if (m_VertexListQueue.Count > 0)
         {
             vertexList = m_VertexListQueue.Dequeue();
             vertexList.Clear();
         }
         else
         {
             vertexList = new List<VertexPositionNormalTextureHue>(1024);
         }
         m_DrawQueue[(int)effect].Add(texture, vertexList);
     }
     return vertexList;
 }
Ejemplo n.º 38
0
        /// <summary>
        /// Draws a quad on screen with the specified texture and vertices.
        /// </summary>
        /// <param name="texture"></param>
        /// <param name="vertices"></param>
        /// <returns>True if the object was drawn, false otherwise.</returns>
        public bool Draw(Texture2D texture, VertexPositionNormalTextureHue[] vertices, Techniques effects = Techniques.Default)
        {
            bool draw = false;

            // Check: do not draw if there is no texture to draw with.
            if (texture == null)
                return false;

            // Check: only draw if the texture is within the visible area.
            for (int i = 0; i < 4; i++) // only draws a 2 triangle tristrip.
            {
                if (ViewportArea.Contains(vertices[i].Position) == ContainmentType.Contains)
                {
                    draw = true;
                    break;
                }
            }
            if (!draw)
                return false;

            // Set the draw position's z value, and increment the z value for the next drawn object.
            vertices[0].Position.Z = vertices[1].Position.Z = vertices[2].Position.Z = vertices[3].Position.Z = Z++;

            // Get the vertex list for this texture. if none exists, dequeue or create a new vertex list.
            List<VertexPositionNormalTextureHue> vertexList;
            if(m_drawQueue[(int)effects].ContainsKey(texture))
            {
                vertexList = m_drawQueue[(int)effects][texture];
            }
            else
            {
                if(m_vertexListQueue.Count > 0)
                {
                    vertexList = m_vertexListQueue.Dequeue();
                    vertexList.Clear();
                }
                else
                {
                    vertexList = new List<VertexPositionNormalTextureHue>(1024);
                }
                m_drawQueue[(int)effects].Add(texture, vertexList);
            }

            // Add the drawn object to the vertex list.
            for(int i = 0; i < vertices.Length; i++)
                vertexList.Add(vertices[i]);

            return true;
        }