Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            DirectEngine renderer = new DirectEngine();
            Texture2D mtex = renderer.createTexture(512, 512);
            mtex.Draw();
            Console.WriteLine("Renderer is active");
            //Shader myder = renderer.createBasicShader();

            //myder.Draw();

            //List<Vector3D> points = new List<Vector3D>();
            //Vector3D top = new Vector3D();
            //top.X = 0;
            //top.Y = 0;
            //top.Z = 0;
            //Vector3D bottom = new Vector3D();
            //bottom.X = 1;
            //bottom.Y = 0;
            //bottom.Z = 0;
            //Vector3D right = new Vector3D();
            //right.X = 1;
            //right.Y = 1;
            //right.Z = 0;
            //points.Add(top);
            //points.Add(bottom);
            //points.Add(right);
            //List<Vector2D> texcoords = new List<Vector2D>();
            //texcoords.Add(new Vector2D() { X = 0, Y = 0});
            //texcoords.Add(new Vector2D() { X = 1, Y = 0});
            //texcoords.Add(new Vector2D() { X = 1, Y = 1});
            ////VertexBuffer mbuffer = renderer.CreateVertexBuffer(points.ToArray(),texcoords.ToArray(),points.ToArray());
            ////mbuffer.Draw();
            //Primitives.createRectangle(renderer,0,-.5f,0,1,1).Draw();
        }
Exemplo n.º 2
0
        static Renderer CreateRenderer()
        {
            Renderer renderer;
            try
            {
                if (System.Diagnostics.Debugger.IsAttached)
                {
                    throw new Exception("For debugging purposes");
                }
                renderer = new DirectEngine();

            }
            catch (Exception er)
            {
                renderer = new GLRenderer();
            }
            renderer.defaultKeyboard.onKeyDown += new keyboardeventargs(defaultKeyboard_onKeyDown);
            renderer.defaultKeyboard.onKeyUp += new keyboardeventargs(defaultKeyboard_onKeyUp);

            renderer.cameraPosition.Z = -5;
            return renderer;
        }
Exemplo n.º 3
0
        public RenderTargetChange(DXTexture target, DirectEngine engine, Vector3D _campos, Vector3D _camrot)
        {
            _engine = engine;
            interntarget = target;
            if (mchange != null)
            {
                hasran = true;
                previous = mchange.previous;
            }
            mchange = this;

            prevpos = _engine.cameraPosition;
            prevrot = _engine.worldRotation;
            campos = _campos;
            camrot = _camrot;
        }
Exemplo n.º 4
0
 public DXVertBuffer(DirectEngine mgine,Vector3D[] vertices,Vector3D[] normals, Vector2D[] texcoords)
 {
     engine = mgine;
     verts = vertices;
     norms = normals;
     texas = texcoords;
 }
Exemplo n.º 5
0
 public DXTexture(DirectEngine ngine, Bitmap bitmap)
     : base(bitmap.Width,bitmap.Height)
 {
     engine = ngine;
     this.bitmap = bitmap;
 }
Exemplo n.º 6
0
 public DXTexture(DirectEngine ngine, int width, int height)
     : base(width,height)
 {
     engine = ngine;
     _width = width;
     _height = height;
 }
Exemplo n.º 7
0
 public BasicShader(DirectEngine engine)
 {
     StreamReader mreader = new StreamReader("basicdxshader.txt");
     shader = mreader.ReadToEnd();
     this.engine = engine;
 }