/// <summary> /// Builds circle UVs. /// </summary> public override void UV(out Vector2[] uvs, GeometryBuilderUVSettings settings) { uvs = new Vector2[_numVertices]; BuildCircleUVs( _numSides, ref uvs); }
/// <summary> /// Generates UVs for a quad. /// </summary> /// <param name="uvs"></param> /// <param name="settings"></param> public override void UV(out Vector2[] uvs, GeometryBuilderUVSettings settings) { uvs = new[] { new Vector2(0, 0), new Vector2(1, 0), new Vector2(1, 1), new Vector2(0, 1) }; }
/// <summary> /// Provides uvs for cylinder. /// </summary> public override void UV(out Vector2[] uvs, GeometryBuilderUVSettings settings) { uvs = new Vector2[_numVertices]; for (var i = 0; i < _numSides; i++) { var u = (float)i / _numSides; uvs[i] = new Vector2(u, 0); uvs[i + _numSides] = new Vector2(u, 1); } if (_settings.Endcaps) { BuildCircleUVs(2 * _numSides, ref uvs); BuildCircleUVs(3 * _numSides + 1, ref uvs); } }
/// <summary> /// Generates UVs for a plane. /// </summary> /// <param name="uvs"></param> /// <param name="settings"></param> public override void UV(out Vector2[] uvs, GeometryBuilderUVSettings settings) { uvs = new Vector2[_numVertices]; var invXVerts = 1f / (_xVerts - 1); var invZVerts = 1f / (_zVerts - 1); for (int x = 0; x < _xVerts; x++) { for (int z = 0; z < _zVerts; z++) { int vertIndex = x + z * _xVerts; uvs[vertIndex] = new Vector2( x * invXVerts, z * invZVerts); } } }
/// <summary> /// Returns uvs. /// </summary> /// <param name="uvs"></param> /// <param name="settings"></param> public override void UV(out Vector2[] uvs, GeometryBuilderUVSettings settings) { uvs = _uvs; }
/// <summary> /// Returns null UVs. /// </summary> /// <param name="uvs"></param> /// <param name="settings"></param> public virtual void UV(out Vector2[] uvs, GeometryBuilderUVSettings settings) { uvs = null; }