Exemplo n.º 1
0
        public void update()
        {
            setCylinderValues();

            //Updates mesh
            multiCylinder.UpdateCylinders();
        }
Exemplo n.º 2
0
        public void update(float bottomStart, float height, float botWidth, float topWidth, float thickness)
        {
            float    maxWidth  = (topWidth > botWidth)? topWidth : botWidth;
            float    widthDiff = (topWidth > botWidth) ? topWidth - botWidth : botWidth - topWidth;
            Cylinder c0        = multiCylinder.cylinders[0];
            Cylinder c1        = multiCylinder.cylinders[1];
            Cylinder c2        = multiCylinder.cylinders[2];

            //Sets outer shell values
            c0.bottomStart = bottomStart;
            c0.height      = height;
            c0.botWidth    = botWidth;
            c0.topWidth    = topWidth;
            c0.tiling      = 2;
            c0.uvBot       = 0;
            c0.uvTop       = (height) / (6 * maxWidth / c0.tiling);
            if (c0.uvTop > 240 / 512f)
            {
            }
            c0.uvTop = 240 / 512f;

            //Sets top bit values
            c1.bottomStart = bottomStart + height;
            c1.height      = 0;
            c1.botWidth    = topWidth;
            c1.topWidth    = topWidth - thickness * topWidth;
            c1.uvBot       = (241 / 512f);
            c1.uvTop       = ((512 - 241) / 512f);
            c1.tiling      = ((int)(6 * (30 / 512f) / (thickness * topWidth) * (6 * topWidth))) / 6f;

            //Sets inner shell values
            c2.bottomStart = bottomStart + height;
            c2.height      = -height;
            c2.botWidth    = topWidth - thickness * topWidth;
            c2.topWidth    = botWidth - thickness * topWidth;
            c2.uvBot       = ((512 - 240) / 512f);
            c2.uvTop       = 1;

            //Updates mesh
            multiCylinder.UpdateCylinders();
        }
Exemplo n.º 3
0
        public void update()
        {
            getDecouplerShroudValues();

            topWidth += antiZFightSizeIncrease;
            botWidth += antiZFightSizeIncrease;

            float    maxWidth  = (topWidth > botWidth)? topWidth : botWidth;
            float    widthDiff = (topWidth > botWidth) ? topWidth - botWidth : botWidth - topWidth;
            Cylinder c0        = multiCylinder.cylinders[0];      //outside shell
            Cylinder c1        = multiCylinder.cylinders[1];      //top flat bit
            Cylinder c2        = multiCylinder.cylinders[2];      //inside
            Cylinder c3        = multiCylinder.cylinders[3];      //bottom tucked in edge
            Cylinder c4        = multiCylinder.cylinders[4];      //top bevel in edge

            Vector2 bevel = new Vector2((botWidth - topWidth), height).normalized + Vector2.right;

            bevel = bevel.normalized * topBevelSize;

            //Creates bottom edge
            c3.bottomStart = vertOffset - bottomEdgeSize;
            c3.height      = bottomEdgeSize;
            c3.botWidth    = botWidth - bottomEdgeSize;
            c3.topWidth    = botWidth;
            c3.tiling      = 2;
            c3.uvBot       = 0;
            c3.uvTop       = .01f;

            //Sets outer shell values
            c0.bottomStart = vertOffset;
            c0.height      = height - bevel.y;
            c0.botWidth    = botWidth;
            c0.topWidth    = topWidth;
            c0.tiling      = 2;
            c0.uvBot       = 0.01f;
            c0.uvTop       = 240 / 512f - .01f;
            //c0.uvTop = (height) / (6*maxWidth / c0.tiling);
            //if (c0.uvTop > 240 / 512f) {
            //}

            //Set top Bevel
            c4.bottomStart = vertOffset + height - bevel.y;
            c4.height      = bevel.y;
            c4.botWidth    = topWidth;
            c4.topWidth    = topWidth - bevel.x;
            c4.tiling      = 2;
            c4.uvBot       = 240 / 512f - .01f;
            c4.uvTop       = 240 / 512f;

            //Sets top bit values
            c1.bottomStart = vertOffset + height;
            c1.height      = 0;
            c1.botWidth    = topWidth - bevel.x;
            c1.topWidth    = (topWidth - bevel.x) - thickness * topWidth;
            c1.uvBot       = (241 / 512f);
            c1.uvTop       = ((512 - 241) / 512f);
            c1.tiling      = ((int)(6 * (30 / 512f) / (thickness * topWidth) * (6 * topWidth))) / 6f;

            //Sets inner shell values
            c2.bottomStart = vertOffset + height;
            c2.height      = -height;
            c2.botWidth    = topWidth - thickness * topWidth;
            c2.topWidth    = botWidth - thickness * topWidth;
            c2.uvBot       = ((512 - 240) / 512f);
            c2.uvTop       = 1;


            topWidth -= antiZFightSizeIncrease;
            botWidth -= antiZFightSizeIncrease;

            //Updates mesh
            multiCylinder.UpdateCylinders();
        }