コード例 #1
0
        private void ReadTextureCoord()
        {
            var parts = SplitLine();

            if (parts.Length < 2 || parts.Length > 4)
            {
                ThrowInvalidModelFormatException("Wrong texture coordinate format");
            }

            if (!TryStrictDoubleParse(parts[1], out var u))
            {
                ThrowParseException("texture coord U");
            }

            double v = 0;

            if (parts.Length > 2 && !TryStrictDoubleParse(parts[2], out v))
            {
                ThrowParseException("texture coord V");
            }

            double w = 0;

            if (parts.Length > 3 && !TryStrictDoubleParse(parts[3], out w))
            {
                ThrowParseException("texture coord W");
            }

            _model.AddTextureCoord(new TextureCoord {
                U = u, V = v, W = w
            });
        }