コード例 #1
0
        //
        // Création du tableau des points de sommets
        //
        private void CréerTableauPoints()
        {
            float DeltaX = Étendue.X / TableauPoints.GetLength(0);
            float DeltaY = Étendue.Y;
            float DeltaZ = -Étendue.Z / TableauPoints.GetLength(1);

            for (int i = 0; i < TableauPoints.GetLength(0); ++i)
            {
                for (int j = 0; j < TableauPoints.GetLength(1); ++j)
                {
                    TableauPoints[i, j] = Origine + new Vector3(DeltaX * i, DeltaY * TableauHeight[i, j], DeltaZ * j);
                }
            }
        }
コード例 #2
0
        //
        // Création des sommets.
        //
        protected override void InitialiserSommets()
        {
            int cptSommet = 0;

            for (int i = 0; i < TableauPoints.GetLength(0) - 1; ++i)
            {
                for (int j = 0; j < TableauPoints.GetLength(1) - 1; ++j)
                {
                    int positionDansTexture = TrouverHeightMoyen(TableauPoints[i, j].Y, TableauPoints[i + 1, j].Y, TableauPoints[i, j + 1].Y);
                    TableauSommets[cptSommet++] = new VertexPositionTexture(TableauPoints[i, j + 1], TableauTexture[0, positionDansTexture + 1]);
                    TableauSommets[cptSommet++] = new VertexPositionTexture(TableauPoints[i + 1, j], TableauTexture[1, positionDansTexture]);
                    TableauSommets[cptSommet++] = new VertexPositionTexture(TableauPoints[i, j], TableauTexture[0, positionDansTexture]);

                    positionDansTexture         = TrouverHeightMoyen(TableauPoints[i + 1, j].Y, TableauPoints[i, j + 1].Y, TableauPoints[i + 1, j + 1].Y);
                    TableauSommets[cptSommet++] = new VertexPositionTexture(TableauPoints[i + 1, j + 1], TableauTexture[1, positionDansTexture + 1]);
                    TableauSommets[cptSommet++] = new VertexPositionTexture(TableauPoints[i + 1, j], TableauTexture[1, positionDansTexture]);
                    TableauSommets[cptSommet++] = new VertexPositionTexture(TableauPoints[i, j + 1], TableauTexture[0, positionDansTexture + 1]);
                }
            }
        }