|
| 1 | +package engine.resources; |
| 2 | + |
| 3 | +/** |
| 4 | + * Represents the texture wrapping mode used to determine how textures are applied when texture |
| 5 | + * coordinates exceed the standard [0, 1] range. |
| 6 | + * |
| 7 | + * <p>This enum provides two wrapping modes: |
| 8 | + * |
| 9 | + * <ul> |
| 10 | + * <li>{@link #CLAMP} - Clamps the texture coordinates to the edges of the texture. This prevents |
| 11 | + * repetition and ensures that the texture borders extend outward. |
| 12 | + * <li>{@link #REPEAT} - Repeats the texture in both directions when the texture coordinates |
| 13 | + * exceed the [0, 1] range. This is useful for creating seamless, tiled patterns. |
| 14 | + * </ul> |
| 15 | + * |
| 16 | + * <p>Depending on the rendering backend, more wrapping modes may be supported. This abstraction |
| 17 | + * allows for easy integration with different graphics libraries while keeping the codebase flexible |
| 18 | + * and maintainable. |
| 19 | + * |
| 20 | + * @see engine.texture.Texture |
| 21 | + */ |
| 22 | +public enum TextureWrapMode { |
| 23 | + |
| 24 | + /** |
| 25 | + * Clamps texture coordinates to the edges of the texture. |
| 26 | + * |
| 27 | + * <p>This mode ensures that any texture coordinate outside the [0, 1] range will be mapped to the |
| 28 | + * nearest edge of the texture, effectively stretching the border pixels. It is commonly used to |
| 29 | + * avoid visible seams on models when the texture should not repeat. |
| 30 | + * |
| 31 | + * <p><b>Example Use Case:</b> |
| 32 | + * |
| 33 | + * <ul> |
| 34 | + * <li>Skyboxes |
| 35 | + * <li>UI elements |
| 36 | + * <li>Billboards |
| 37 | + * </ul> |
| 38 | + */ |
| 39 | + CLAMP, |
| 40 | + |
| 41 | + /** |
| 42 | + * Repeats the texture in both directions when the texture coordinates exceed the [0, 1] range. |
| 43 | + * This mode is useful for creating seamless, tiled patterns such as terrain, walls, or floors in |
| 44 | + * games and 3D environments. |
| 45 | + * |
| 46 | + * <p><b>Example Use Case:</b> |
| 47 | + * |
| 48 | + * <ul> |
| 49 | + * <li>Terrain textures |
| 50 | + * <li>Repeating patterns on walls, floors, or ceilings |
| 51 | + * <li>Cloth or fabric simulations |
| 52 | + * </ul> |
| 53 | + */ |
| 54 | + REPEAT |
| 55 | +} |
0 commit comments