Beispiel #1
0
        public void DrawCylinder(float topRadius, float bottomRadius, float halfHeight, int upAxis, ref IndexedMatrix matrix, ref IndexedMatrix view, ref IndexedMatrix projection, ref IndexedVector3 color)
        {
            IndexedVector3 scale  = new IndexedVector3(topRadius, halfHeight, bottomRadius);
            IndexedMatrix  rotate = IndexedMatrix.Identity;

            if (upAxis == 0)
            {
                rotate = IndexedMatrix.CreateRotationZ(MathUtil.SIMD_HALF_PI);
            }
            if (upAxis == 1)
            {
                rotate = IndexedMatrix.CreateRotationY(MathUtil.SIMD_HALF_PI);
            }
            else if (upAxis == 2)
            {
                rotate = IndexedMatrix.CreateRotationX(MathUtil.SIMD_HALF_PI);
            }

            IndexedMatrix copy = matrix;

            copy._origin = IndexedVector3.Zero;
            copy         = copy * rotate;
            copy._origin = matrix._origin;

            ModelScalingData modelScalingData = new ModelScalingData(m_cylinderModel, scale, copy);

            modelScalingData.color = color;
            m_modelScalingData.Add(modelScalingData);
        }