コード例 #1
0
ファイル: TexturedTriangle.cs プロジェクト: Gaunt/Soft3D
 //vytvori otexturovany trojuhelnik z t, s texturou texture namapovanou podle coords
 public TexturedTriangle(Triangle3D t,Triangle2D coords,Int32[,] texture)
     : base(t.V1,t.V2,t.V3)
 {
     texcoords = coords;
     bitmap = texture;
     width = texture.GetLength(0);
     height = texture.GetLength(1);
     port = new Viewport(1,1,width,width);
 }
コード例 #2
0
ファイル: .Soft3dScreen.cs プロジェクト: Gaunt/Soft3D
        private double[,] zbuffer; //pamet hloubky

        #endregion Fields

        #region Constructors

        //nastavi promenne na defaultni hodnoty.
        //parametrem bitmap se predava odkaz na bitmapu do ktere se bude kreslit
        public Soft3DScreen(Int32[,] bitmap)
        {
            screen = bitmap;
            screenHeight = bitmap.GetLength(1);
            screenWidth = bitmap.GetLength(0);
            zbuffer = new double[screenWidth, screenHeight];
            for(int i = 0;i<screenWidth;i++)
              for(int j = 0;j<screenHeight;j++)
                zbuffer[i,j] = 1;//inicializace z bufferu na max hodnotu

            projection = new Projection(Math.PI/4,(double)screenWidth/(double)screenHeight,
            2.4,50);//nastaveni projekce,zorny uhel je 45 stupnu
            viewport = new Viewport(2,2,
                        screenWidth,screenHeight);
            byte[] white = {255,255,255,255};
            color = BitConverter.ToInt32(white, 0);
            viewMatrix=Matrix44.GetIdentityMatrix();
        }
コード例 #3
0
ファイル: Vector2i.cs プロジェクト: Gaunt/Soft3D
 public Vector2i(Vector3 v,Viewport port)
 {
     x = port.GetIntX(v.X);
       y = port.GetIntY(v.Y);
 }