Class DomeMesh

java.lang.Object
com.jme3.scene.Mesh
jme3utilities.mesh.DomeMesh
All Implemented Interfaces:
com.jme3.export.Savable, com.jme3.util.clone.JmeCloneable, Cloneable

public class DomeMesh extends com.jme3.scene.Mesh
A 3-D, static, Triangles-mode mesh for a dome (or a pie-cut segment thereof) with radius=1, centered at the origin, with its apex at (0,1,0) and its equator in the X-Z plane.

The key differences between this class and com.jme3.scene.shape.Dome are:

  1. the radius and center ARE NOT configurable,
  2. the texture coordinates, segment angle, and vertical angle ARE configurable, and
  3. the normal vectors have the correct sign (JME issue #615).

The projection to texture space is an "azimuthal equidistant projection". The dome's equator maps to a circle of radius uvScale centered at (topU,topV). The +X direction maps to +U, and the +Z direction maps to -V.

  • Nested Class Summary

    Nested classes/interfaces inherited from class com.jme3.scene.Mesh

    com.jme3.scene.Mesh.Mode
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final float
    default for the first (U) texture coordinate at the apex of the dome
    static final float
    default for the 2nd (V) texture coordinate at the apex of the dome
    static final float
    default UV distance from apex to rim
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    No-argument constructor needed by SavableClassUtil.
     
    DomeMesh(int rimSamples, int quadrantSamples)
    Instantiate an inward-facing hemispherical dome with a specified number of samples on each axis.
     
    DomeMesh(int rimSamples, int quadrantSamples, float topU, float topV, float uvScale, boolean inwardFacing)
    Instantiate a hemispherical dome with a specified number of samples on each axis and a specified texture coordinate-system.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.jme3.math.Vector2f
    directionUV(com.jme3.math.Vector3f direction)
    Determine the texture coordinate of a point on this mesh that's in the specified direction from the center of the mesh.
    float
    elevationAngle(float u, float v)
    Compute the elevation angle of a point on this mesh, given its texture coordinates.
    float
    Read the U-V scale of this dome.
    float
    Deprecated.
    float
    Read the vertical angle of this dome.
    void
    read(com.jme3.export.JmeImporter importer)
    De-serialize this mesh, for example when loading from a J3O file.
    void
    setSegmentAngle(float newAngle)
    Regenerate the mesh for a new segment angle: 2*Pi produces a complete dome, Pi results in a half dome, and so on.
    void
    setVerticalAngle(float newAngle)
    Regenerate the mesh for a new vertical angle: Pi/2 produces a hemisphere and so on.
    void
    write(com.jme3.export.JmeExporter exporter)
    Serialize this mesh, for example when saving to a J3O file.

    Methods inherited from class com.jme3.scene.Mesh

    addMorphTarget, clearBuffer, clearCollisionData, clone, cloneFields, cloneForAnim, collideWith, createCollisionData, deepClone, extractVertexData, generateBindPose, generateBindPose, getBound, getBuffer, getBufferList, getBuffers, getElementLengths, getFloatBuffer, getId, getIndexBuffer, getIndicesAsList, getInstanceCount, getLineWidth, getLodLevel, getMaxNumWeights, getMode, getModeStart, getMorphIndex, getMorphTarget, getMorphTargetNames, getMorphTargets, getNumLodLevels, getPatchVertexCount, getPointSize, getShortBuffer, getTriangle, getTriangle, getTriangle, getTriangleCount, getTriangleCount, getVertexCount, hasMorphTargets, isAnimated, isAnimatedByBone, isAnimatedByJoint, jmeClone, prepareForAnim, removeMorphTarget, removeMorphTarget, scaleTextureCoordinates, setBound, setBuffer, setBuffer, setBuffer, setBuffer, setBuffer, setBuffer, setBuffer, setBuffer, setBuffer, setBuffer, setDynamic, setElementLengths, setId, setInterleaved, setLineWidth, setLodLevels, setMaxNumWeights, setMode, setModeStart, setPatchVertexCount, setStatic, setStreamed, updateBound, updateCounts

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • defaultTopU

      public static final float defaultTopU
      default for the first (U) texture coordinate at the apex of the dome
      See Also:
    • defaultTopV

      public static final float defaultTopV
      default for the 2nd (V) texture coordinate at the apex of the dome
      See Also:
    • defaultUvScale

      public static final float defaultUvScale
      default UV distance from apex to rim
      See Also:
  • Constructor Details

    • DomeMesh

      protected DomeMesh()
      No-argument constructor needed by SavableClassUtil.
    • DomeMesh

      public DomeMesh(int rimSamples, int quadrantSamples)
      Instantiate an inward-facing hemispherical dome with a specified number of samples on each axis. Use this constructor to generate domes for SkyMaterial.
      Parameters:
      rimSamples - number of samples around the rim (≥3)
      quadrantSamples - number of samples from apex to rim, inclusive (≥2)
    • DomeMesh

      public DomeMesh(int rimSamples, int quadrantSamples, float topU, float topV, float uvScale, boolean inwardFacing)
      Instantiate a hemispherical dome with a specified number of samples on each axis and a specified texture coordinate-system. This is the most general form of the constructor.
      Parameters:
      rimSamples - number of samples around the rim (≥3)
      quadrantSamples - number of samples from apex to rim, inclusive (≥2)
      topU - U-coordinate of the apex (≤1, ≥0)
      topV - V-coordinate of the apex (≤1, ≥0)
      uvScale - UV distance from apex to equator (<0.5, >0)
      inwardFacing - if true, vertex normals point inward; if false, they point outward
  • Method Details

    • directionUV

      public com.jme3.math.Vector2f directionUV(com.jme3.math.Vector3f direction)
      Determine the texture coordinate of a point on this mesh that's in the specified direction from the center of the mesh.
      Parameters:
      direction - (length>0, unaffected)
      Returns:
      a new vector, or null if direction is too far below the equator
    • elevationAngle

      public float elevationAngle(float u, float v)
      Compute the elevation angle of a point on this mesh, given its texture coordinates.
      Parameters:
      u - the first texture coordinate (≤1, ≥0)
      v - the 2nd texture coordinate (≤1, ≥0)
      Returns:
      angle in radians (≤Pi/2)
    • getUVScale

      @Deprecated public float getUVScale()
      Deprecated.
      Read the U-V scale of this dome.
      Returns:
      UV distance from apex to equator (<0.5, >0)
    • getUvScale

      public float getUvScale()
      Read the U-V scale of this dome.
      Returns:
      UV distance from apex to equator (<0.5, >0)
    • getVerticalAngle

      public float getVerticalAngle()
      Read the vertical angle of this dome.
      Returns:
      angle (in radians, <Pi, >0)
      See Also:
    • setSegmentAngle

      public void setSegmentAngle(float newAngle)
      Regenerate the mesh for a new segment angle: 2*Pi produces a complete dome, Pi results in a half dome, and so on.
      Parameters:
      newAngle - (in radians, ≤2*Pi, >0)
    • setVerticalAngle

      public void setVerticalAngle(float newAngle)
      Regenerate the mesh for a new vertical angle: Pi/2 produces a hemisphere and so on.
      Parameters:
      newAngle - (in radians, <Pi, >0)
    • read

      public void read(com.jme3.export.JmeImporter importer) throws IOException
      De-serialize this mesh, for example when loading from a J3O file.
      Specified by:
      read in interface com.jme3.export.Savable
      Overrides:
      read in class com.jme3.scene.Mesh
      Parameters:
      importer - (not null)
      Throws:
      IOException - from importer
    • write

      public void write(com.jme3.export.JmeExporter exporter) throws IOException
      Serialize this mesh, for example when saving to a J3O file.
      Specified by:
      write in interface com.jme3.export.Savable
      Overrides:
      write in class com.jme3.scene.Mesh
      Parameters:
      exporter - (not null)
      Throws:
      IOException - from exporter