コード例 #1
0
        public int[] GetIndecies()
        {
            var indecies = new int[cone.PointCount * 6];

            TesselationToolbox.GetIndeciesForTriangeFan(0, 1, cone.PointCount, ref indecies, 0, true);
            TesselationToolbox.GetIndeciesForTriangeFan(cone.PointCount + 1, 1, cone.PointCount, ref indecies,
                                                        cone.PointCount * 3, false);

            return(indecies);
        }
コード例 #2
0
        public Vec3[] GetPositions()
        {
            var vecHeight = new Vec3(0, cone.Height, 0);
            var positions = new Vec3[cone.PointCount + 2];

            positions[0] = vecHeight / 2;
            positions[cone.PointCount + 1] = -vecHeight / 2;

            TesselationToolbox.GetCirclePointsOnXZPlane(-vecHeight / 2, cone.Radius, cone.PointCount, ref positions, 1);

            return(positions);
        }
コード例 #3
0
        public int[] GetIndecies()
        {
            var indecies = new int[frustrumOfCone.PointCount * 12];

            TesselationToolbox.GetIndeciesForTriangeFan(0, 1, frustrumOfCone.PointCount, ref indecies, 0, true);
            TesselationToolbox.GetIndeciesForTriangeFan(2 * frustrumOfCone.PointCount + 1,
                                                        frustrumOfCone.PointCount + 1, frustrumOfCone.PointCount,
                                                        ref indecies, frustrumOfCone.PointCount * 3, false);

            TesselationToolbox.GetIndeciesForTriangeStripBetweenTwoPointCircles(1, frustrumOfCone.PointCount + 1,
                                                                                frustrumOfCone.PointCount, ref indecies,
                                                                                frustrumOfCone.PointCount * 6);
            return(indecies);
        }
コード例 #4
0
        public Vec3[] GetPositions()
        {
            var vecHeight = new Vec3(0, frustrumOfCone.Height, 0);
            var positions = new Vec3[frustrumOfCone.PointCount * 2 + 2];

            positions[0] = vecHeight / 2;
            positions[frustrumOfCone.PointCount * 2 + 1] = -vecHeight / 2;

            TesselationToolbox.GetCirclePointsOnXZPlane(vecHeight / 2, frustrumOfCone.Radius2,
                                                        frustrumOfCone.PointCount, ref positions, 1);
            TesselationToolbox.GetCirclePointsOnXZPlane(-vecHeight / 2, frustrumOfCone.Radius1,
                                                        frustrumOfCone.PointCount, ref positions,
                                                        frustrumOfCone.PointCount + 1);
            return(positions);
        }
コード例 #5
0
        public int[] GetIndecies()
        {
            var indecies = new int[(sphere.PointsPerCircle * 2) * 3 + (sphere.CircleCount - 1) * (2 * sphere.PointsPerCircle) * 3];

            TesselationToolbox.GetIndeciesForTriangeFan(0, 1, sphere.PointsPerCircle, ref indecies, 0, true);
            TesselationToolbox.GetIndeciesForTriangeFan(sphere.CircleCount * sphere.PointsPerCircle + 1,
                                                        ((sphere.CircleCount - 1) * sphere.PointsPerCircle) + 1,
                                                        sphere.PointsPerCircle, ref indecies, sphere.PointsPerCircle * 3,
                                                        false);

            for (var i = 0; i < sphere.CircleCount - 1; i++)
            {
                TesselationToolbox.GetIndeciesForTriangeStripBetweenTwoPointCircles(i * sphere.PointsPerCircle + 1,
                                                                                    (i + 1) * sphere.PointsPerCircle + 1,
                                                                                    sphere.PointsPerCircle,
                                                                                    ref indecies,
                                                                                    sphere.PointsPerCircle * 6 +
                                                                                    i * sphere.PointsPerCircle * 6);
            }
            return(indecies);
        }
コード例 #6
0
        public Vec3[] GetPositions()
        {
            var positions = new Vec3[sphere.CircleCount * sphere.PointsPerCircle + 2];
            var vecHeight = new Vec3(0, sphere.Radius, 0);

            positions[0] = vecHeight;
            positions[sphere.CircleCount * sphere.PointsPerCircle + 1] = -vecHeight;

            var step = (2 * vecHeight) / (sphere.CircleCount + 1);

            for (var i = 0; i < sphere.CircleCount; i++)
            {
                var vecHeightTmp = vecHeight - (i + 1) * step;
                var radiusTmp    = Math.Sqrt(sphere.Radius * sphere.Radius - vecHeightTmp.Length * vecHeightTmp.Length);

                TesselationToolbox.GetCirclePointsOnXZPlane(vecHeightTmp,
                                                            radiusTmp,
                                                            sphere.PointsPerCircle,
                                                            ref positions,
                                                            i * sphere.PointsPerCircle + 1);
            }

            return(positions);
        }