Ejemplo n.º 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));
        }
Ejemplo n.º 2
0
        protected override void CreateGeometry()
        {
            var height = 2;
            var edges  = 12;
            var radius = 0.5f;

            Geometry.AddVertices(CylinderComposer.Create(radius, height, edges,
                                                         new GeometryTextureRectangle(new Rectangle(0, 0, 96, 10), _texture),
                                                         new GeometryTextureRectangle(new Rectangle(0, 20, 40, 40), _texture)));
        }
Ejemplo n.º 3
0
        private static EntityGeometry Cylinder(EntityData data, Texture2D propTexture)
        {
            var elementCount = data.tubeResolution;
            ITextureDefintion sideTexture   = DefaultTextureDefinition.Instance;
            ITextureDefintion topTexture    = DefaultTextureDefinition.Instance;
            ITextureDefintion bottomTexture = DefaultTextureDefinition.Instance;

            var wrapTexture = data.wrapTexture;

            var textures = data.Textures;

            if (textures != null && textures.Length > 0)
            {
                if (wrapTexture)
                {
                    sideTexture = new TextureTubeWrapper(textures[0], propTexture.Bounds, elementCount);
                }
                else
                {
                    sideTexture = new TextureRectangle(textures[0], propTexture);
                }
            }
            if (textures != null && textures.Length == 2)
            {
                topTexture    = new TextureRectangle(textures[1], propTexture);
                bottomTexture = new TextureRectangle(textures[1], propTexture);
            }
            else if (textures != null && textures.Length > 2)
            {
                topTexture    = new TextureRectangle(textures[1], propTexture);
                bottomTexture = new TextureRectangle(textures[2], propTexture);
            }

            var size = data.Size2;
            // /2 because it's radius, not diameter.
            var vertices = CylinderComposer.Create(size.X / 2f, size.Y, elementCount, sideTexture, topTexture, bottomTexture);

            var geometry = new EntityGeometry
            {
                Vertices = vertices,
                Heights  = new[] { size.Y, size.Y, size.Y, size.Y },
                Size     = new Vector3(size.X, size.Y, size.X)
            };

            return(geometry);
        }
Ejemplo n.º 4
0
 protected override void CreateGeometry()
 {
     Geometry.AddVertices(CylinderComposer.Create(0.1f, HEIGHT, 10));
 }
Ejemplo n.º 5
0
 protected override void CreateGeometry()
 {
     Geometry.AddVertices(CylinderComposer.Create(2000f, 4000f, 50,
                                                  new GeometryTexturePoleWrapper(_texture.Bounds, _texture.Bounds, 50),
                                                  new GeometryTextureRectangle(new Rectangle(1, 1, 1, 1), _texture)));
 }