コード例 #1
0
        protected override void CreateGeometry()
        {
            var sideTexture = new GeometryTexturePoleWrapper(new Rectangle(0, 0, 16, 64), _texture.Bounds, 20);
            var topTexure   = new GeometryTextureRectangle(new Rectangle(0, 64, 16, 16), _texture);

            Geometry.AddVertices(CylinderComposer.Create(0.375f, 1f, 20, sideTexture, topTexure));
        }
コード例 #2
0
        protected override void CreateGeometry()
        {
            Geometry.AddVertices(RectangleComposer.Create(new[]
            {
                new Vector3(-0.5f, 0.25f, -0.25f),
                new Vector3(0.5f, 0.25f, -0.25f),
                new Vector3(-0.5f, -0.25f, 0),
                new Vector3(0.5f, -0.25f, 0),
            }));

            var textureRectangle = new GeometryTextureRectangle(new Rectangle(1, 1, 1, 1), _texture, 1);

            Geometry.AddVertices(RectangleComposer.Create(new[]
            {
                new Vector3(-0.5f, 0.25f, -0.25f),
                new Vector3(-0.5f, -0.25f, 0),
                new Vector3(-0.5f, 0f, -0.5f),
                new Vector3(-0.5f, -0.25f, -0.4f),
            }, textureRectangle));

            Geometry.AddVertices(RectangleComposer.Create(new[]
            {
                new Vector3(0.5f, 0.25f, -0.25f),
                new Vector3(0.5f, -0.25f, 0),
                new Vector3(0.5f, 0f, -0.5f),
                new Vector3(0.5f, -0.25f, -0.4f),
            }, textureRectangle));

            Geometry.AddVertices(RectangleComposer.Create(new[]
            {
                new Vector3(0.5f, 0.25f, -0.25f),
                new Vector3(0.5f, 0f, -0.5f),
                new Vector3(-0.5f, 0.25f, -0.25f),
                new Vector3(-0.5f, 0f, -0.5f),
            }, textureRectangle));

            Geometry.AddVertices(RectangleComposer.Create(new[]
            {
                new Vector3(0.5f, 0f, -0.5f),
                new Vector3(0.5f, -0.25f, -0.4f),
                new Vector3(-0.5f, 0f, -0.5f),
                new Vector3(-0.5f, -0.25f, -0.4f),
            }, textureRectangle));

            var test = Geometry.Vertices.Select(v => v.TextureIndex).ToArray();
        }
コード例 #3
0
ファイル: StreetLamp.cs プロジェクト: nilllzz/Hardliner
        protected override void CreateGeometry()
        {
            Geometry.AddVertices(CuboidComposer.Create(0.2f, 10f, 0.2f,
                                                       new GeometryTextureRectangle(new Rectangle(0, 4, 4, 4), _texture)));

            var sideTexture1  = new GeometryTextureRectangle(new Rectangle(0, 0, 8, 4), _texture);
            var sideTexture2  = new GeometryTextureRectangle(new Rectangle(12, 4, 4, 4), _texture);
            var bottomTexture = new GeometryTextureRectangle(new Rectangle(8, 0, 8, 4), _texture);
            var cuboidTexture = new GeometryTextureCuboidWrapper();

            cuboidTexture.AddSide(new[] { CuboidSide.Left, CuboidSide.Right }, sideTexture2);
            cuboidTexture.AddSide(new[] { CuboidSide.Front, CuboidSide.Back, CuboidSide.Top }, sideTexture1);
            cuboidTexture.AddSide(new[] { CuboidSide.Bottom }, bottomTexture);

            var topPart = CuboidComposer.Create(0.8f, 0.4f, 0.4f, cuboidTexture);

            VertexTransformer.Offset(topPart, new Vector3(0.25f, 5f, 0f));
            Geometry.AddVertices(topPart);
        }