Read 3 or 4 numbers and return them as a Vec4

If there is no fourth value, Vec4::w is set to 1.0.

Property definitions

gamnit :: model_parser_base $ StringProcessor :: read_vec4
	# Read 3 or 4 numbers and return them as a `Vec4`
	#
	# If there is no fourth value, `Vec4::w` is set to 1.0.
	protected fun read_vec4: Vec4
	do
		var vec = new Vec4
		vec.x = read_number
		vec.y = read_number
		vec.z = read_number

		var wstr = read_token
		if wstr.length > 0 then
			vec.w = if wstr.is_numeric then wstr.to_f else 0.0
		else
			vec.w = 1.0
		end

		return vec
	end
lib/gamnit/model_parsers/model_parser_base.nit:104,2--122,4