Пример #1
0
        public IActionResult Get()
        {
            Epico.EpicoGraphics epico = new Epico.EpicoGraphics();
            Estrela             obj   = new Estrela();

            obj.Mat_render.CorBorda  = new Epico.Sistema2D.RGBA(255, 0, 0, 0);
            obj.Mat_render.CorSolida = new Epico.Sistema2D.RGBA(255, 0, 150, 200);
            epico.AddObjeto2D(obj);
            epico.CriarCamera(640, 480);
            epico.Camera.Focar(obj);

            while (true)
            {
                using (Stream stream = new MemoryStream())
                {
                    Bitmap bmp = epico.Camera.Renderizar();
                    bmp.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg);

                    MultipartResult multipartResult = new MultipartResult
                    {
                        ContentType = "image/jpeg",
                        Stream      = stream
                    };
                    return(multipartResult);
                }
            }
        }
Пример #2
0
        public ImageStream()
        {
            epico = new Epico.EpicoGraphics();
            Estrela obj = new Estrela();

            obj.Mat_render.CorBorda  = new Epico.Sistema2D.RGBA(255, 0, 0, 0);
            obj.Mat_render.CorSolida = new Epico.Sistema2D.RGBA(255, 0, 150, 200);
            epico.AddObjeto2D(obj);
            epico.CriarCamera(640, 480);
            epico.Camera.Focar(obj);
        }
Пример #3
0
        /// <summary>
        /// Obtém objetos no espaço 2D conforme a seleção pela tela da câmera
        /// </summary>
        /// <param name="engine"></param>
        /// <param name="cam"></param>
        /// <param name="verticesTela"></param>
        /// <returns></returns>
        public static IEnumerable <Objeto2D> ObterObjetos2DMouseXY(this EpicoGraphics engine, Camera2D cam, params Vertice2[] verticesTela)
        {
            for (int i = 0; i < verticesTela.Length; i++)
            {
                // Converte X e Y da tela para as coordenadas X e Y no mundo 2D
                Eixos2 xy = ObterPosEspaco2DMouseXY(cam, verticesTela[i]);
                verticesTela[i].X = xy.X;
                verticesTela[i].Y = xy.Y;
            }

            for (int i = 0; i < engine.objetos2D.Count; i++)
            {
                if (IntersecaoEntrePoligonos(verticesTela,
                                             engine.objetos2D[i].Vertices.Select(x => new Vertice2(x.Global.X, x.Global.Y)).ToArray()))
                {
                    yield return(engine.objetos2D[i]);
                }
            }
        }
Пример #4
0
 public static Objeto2D ObterUnicoObjeto2DMouseXY(this EpicoGraphics engine, Camera2D camera, Eixos2 ponto)
 {
     return(ObterObjetos2DMouseXY(engine, camera, ponto).LastOrDefault());
 }
Пример #5
0
 public static IEnumerable <Objeto2D> ObterObjetos2DMouseXY(
     this EpicoGraphics engine, Camera2D camera, Eixos2 ponto)
 {
     return(ObterObjetos2DMouseXY(engine, camera, new Vertice2(ponto.X, ponto.Y)));
 }