Class PrimitiveMeshes

java.lang.Object
dev.engine.graphics.common.mesh.PrimitiveMeshes

public final class PrimitiveMeshes extends Object
Factory for common primitive meshes. All meshes have position (loc 0, 3 floats) + normal (loc 1, 3 floats) + uv (loc 2, 2 floats).
  • Field Details

    • STANDARD_FORMAT

      public static final VertexFormat STANDARD_FORMAT
  • Method Details

    • quad

      public static MeshData quad()
      A 1x1 quad centered at origin in the XY plane, facing +Z.
    • quad

      public static MeshData quad(float uvScale)
      A 1x1 quad with the given UV scale. uvScale=3 means UVs go 0→3, tiling the texture 3 times.
    • cube

      public static MeshData cube()
      A 1x1x1 cube centered at origin. 24 vertices (4 per face with correct normals).
    • sphere

      public static MeshData sphere(int segments, int rings)
      UV sphere with given segments and rings.
    • sphere

      public static MeshData sphere()
      UV sphere with default detail (32 segments, 16 rings).
    • cylinder

      public static MeshData cylinder(int segments)
      Cylinder along Y axis, radius 0.5, height 1.
    • cone

      public static MeshData cone(int segments)
      Cone along Y axis, radius 0.5, height 1. Tip at Y=0.5.
    • plane

      public static MeshData plane(int subdivisionsX, int subdivisionsZ)
      Subdivided plane in the XZ plane.
    • fullscreenTriangle

      public static MeshData fullscreenTriangle()
      Fullscreen triangle for post-processing. Position only, no normals/UVs.