Package com.io7m.smfj.processing.api

## Class SMFMemoryMeshProducer

- java.lang.Object
- - com.io7m.smfj.processing.api.SMFMemoryMeshProducer

- All Implemented Interfaces:
    `SMFParserEventsBodyType`, `SMFParserEventsDataAttributesNonInterleavedType`, `SMFParserEventsDataAttributeValuesType`, `SMFParserEventsDataMetaOptionalSupplierType`, `SMFParserEventsDataMetaType`, `SMFParserEventsDataTrianglesType`, `SMFParserEventsErrorType`, `SMFParserEventsHeaderType`, `SMFParserEventsType`, `SMFMemoryMeshProducerType`

      public final class SMFMemoryMeshProducer
      extends java.lang.Object
      implements SMFMemoryMeshProducerType, SMFParserEventsHeaderType, SMFParserEventsBodyType, SMFParserEventsDataTrianglesType, SMFParserEventsDataAttributesNonInterleavedType, SMFParserEventsDataMetaType, SMFParserEventsDataAttributeValuesType

  The default implementation of the `SMFMemoryMeshProducerType` interface.

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static SMFMemoryMeshProducerType` | `create()` |
    `java.util.List<SMFErrorType>` | `errors()` |
    `SMFHeader` | `header()` | The parsed header, if no parse errors were encountered.
    `SMFMemoryMesh` | `mesh()` | The parsed mesh, if no parse errors were encountered.
    `java.util.Optional<SMFParserEventsDataAttributesNonInterleavedType>` | `onAttributesNonInterleaved()` |
    `void` | `onDataAttributesNonInterleavedFinish()` | Called when parsing of all non-interleaved attribute data has finished.
    `java.util.Optional<SMFParserEventsDataAttributeValuesType>` | `onDataAttributeStart​(SMFAttribute attribute)` | Parsing of data for the attribute has started.
    `void` | `onDataAttributeValueFinish()` | Parsing of data for the attribute has finished.
    `void` | `onDataAttributeValueFloat1​(double x)` | A data value has been received.
    `void` | `onDataAttributeValueFloat2​(double x, double y)` | A data value has been received.
    `void` | `onDataAttributeValueFloat3​(double x, double y, double z)` | A data value has been received.
    `void` | `onDataAttributeValueFloat4​(double x, double y, double z, double w)` | A data value has been received.
    `void` | `onDataAttributeValueIntegerSigned1​(long x)` | A data value has been received.
    `void` | `onDataAttributeValueIntegerSigned2​(long x, long y)` | A data value has been received.
    `void` | `onDataAttributeValueIntegerSigned3​(long x, long y, long z)` | A data value has been received.
    `void` | `onDataAttributeValueIntegerSigned4​(long x, long y, long z, long w)` | A data value has been received.
    `void` | `onDataAttributeValueIntegerUnsigned1​(long x)` | A data value has been received.
    `void` | `onDataAttributeValueIntegerUnsigned2​(long x, long y)` | A data value has been received.
    `void` | `onDataAttributeValueIntegerUnsigned3​(long x, long y, long z)` | A data value has been received.
    `void` | `onDataAttributeValueIntegerUnsigned4​(long x, long y, long z, long w)` | A data value has been received.
    `void` | `onDataTriangle​(long v0, long v1, long v2)` | A triangle has been parsed.
    `void` | `onDataTrianglesFinish()` | Parsing of triangles has completed.
    `void` | `onError​(SMFErrorType e)` | An error has occurred.
    `void` | `onFinish()` | Parsing has finished.
    `java.util.Optional<SMFParserEventsBodyType>` | `onHeaderParsed​(SMFHeader in_header)` | Parsing of the header was successful.
    `java.util.Optional<SMFParserEventsDataMetaType>` | `onMeta​(SMFSchemaIdentifier schema)` |
    `void` | `onMetaData​(SMFSchemaIdentifier schema, byte[] data)` | Metadata is ready for delivery.
    `void` | `onStart()` | Parsing has started.
    `java.util.Optional<SMFParserEventsDataTrianglesType>` | `onTriangles()` |
    `java.util.Optional<SMFParserEventsHeaderType>` | `onVersionReceived​(SMFFormatVersion version)` | The file format version has been successfully parsed.
    `void` | `onWarning​(SMFWarningType w)` | An error has occurred of a severity low enough that it should just be considered a warning.
    `java.util.List<SMFWarningType>` | `warnings()` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### create

          public static SMFMemoryMeshProducerType create()

      Returns:
        A new memory mesh producer

    - #### onError

          public void onError​(SMFErrorType e)

      Description copied from interface: `SMFParserEventsErrorType`
      An error has occurred. Parsing will continue but the file as a whole must be considered invalid.
      Specified by:
        `onError` in interface `SMFParserEventsErrorType`
      Parameters:
        `e` - The error

    - #### onWarning

          public void onWarning​(SMFWarningType w)

      Description copied from interface: `SMFParserEventsErrorType`
      An error has occurred of a severity low enough that it should just be considered a warning.
      Specified by:
        `onWarning` in interface `SMFParserEventsErrorType`
      Parameters:
        `w` - The warning

    - #### onStart

          public void onStart()

      Description copied from interface: `SMFParserEventsType`
      Parsing has started.
      Specified by:
        `onStart` in interface `SMFParserEventsType`

    - #### onVersionReceived

          public java.util.Optional<SMFParserEventsHeaderType> onVersionReceived​(SMFFormatVersion version)

      Description copied from interface: `SMFParserEventsType`
      The file format version has been successfully parsed. The functions should return a receiver for the header information if parsing should continue, or `Optional.empty()` if parsing should stop.
      Specified by:
        `onVersionReceived` in interface `SMFParserEventsType`
      Parameters:
        `version` - The file format version
      Returns:
        A receiver for the header, if any

    - #### onFinish

          public void onFinish()

      Description copied from interface: `SMFParserEventsType`
      Parsing has finished. This method will be called unconditionally when the parser is closed, regardless of any errors encountered.
      Specified by:
        `onFinish` in interface `SMFParserEventsType`

    - #### errors

          public java.util.List<SMFErrorType> errors()

      Specified by:
        `errors` in interface `SMFMemoryMeshProducerType`
      Returns:
        The list of errors encountered, if any

    - #### warnings

          public java.util.List<SMFWarningType> warnings()

      Specified by:
        `warnings` in interface `SMFMemoryMeshProducerType`
      Returns:
        The list of warnings encountered, if any

    - #### header

          public SMFHeader header()
                           throws java.lang.IllegalStateException

      Description copied from interface: `SMFMemoryMeshProducerType`
      The parsed header, if no parse errors were encountered.
      Specified by:
        `header` in interface `SMFMemoryMeshProducerType`
      Returns:
        The parsed header
      Throws:
        `java.lang.IllegalStateException` - If `SMFMemoryMeshProducerType.errors()` is non-empty

    - #### mesh

          public SMFMemoryMesh mesh()
                             throws java.lang.IllegalStateException

      Description copied from interface: `SMFMemoryMeshProducerType`
      The parsed mesh, if no parse errors were encountered.
      Specified by:
        `mesh` in interface `SMFMemoryMeshProducerType`
      Returns:
        The parsed mesh
      Throws:
        `java.lang.IllegalStateException` - If `SMFMemoryMeshProducerType.errors()` is non-empty

    - #### onAttributesNonInterleaved

          public java.util.Optional<SMFParserEventsDataAttributesNonInterleavedType> onAttributesNonInterleaved()

      Specified by:
        `onAttributesNonInterleaved` in interface `SMFParserEventsBodyType`
      Returns:
        A listener that will receive non-interleaved mesh data

    - #### onTriangles

          public java.util.Optional<SMFParserEventsDataTrianglesType> onTriangles()

      Specified by:
        `onTriangles` in interface `SMFParserEventsBodyType`
      Returns:
        A listener that will receive triangle data

    - #### onDataAttributeValueIntegerSigned1

          public void onDataAttributeValueIntegerSigned1​(long x)

      Description copied from interface: `SMFParserEventsDataAttributeValuesType`
      A data value has been received.
      Specified by:
        `onDataAttributeValueIntegerSigned1` in interface `SMFParserEventsDataAttributeValuesType`
      Parameters:
        `x` - The x value

    - #### onDataAttributeValueIntegerSigned2

          public void onDataAttributeValueIntegerSigned2​(long x,
                                                         long y)

      Description copied from interface: `SMFParserEventsDataAttributeValuesType`
      A data value has been received.
      Specified by:
        `onDataAttributeValueIntegerSigned2` in interface `SMFParserEventsDataAttributeValuesType`
      Parameters:
        `x` - The x value
        `y` - The y value

    - #### onDataAttributeValueIntegerSigned3

          public void onDataAttributeValueIntegerSigned3​(long x,
                                                         long y,
                                                         long z)

      Description copied from interface: `SMFParserEventsDataAttributeValuesType`
      A data value has been received.
      Specified by:
        `onDataAttributeValueIntegerSigned3` in interface `SMFParserEventsDataAttributeValuesType`
      Parameters:
        `x` - The x value
        `y` - The y value
        `z` - The z value

    - #### onDataAttributeValueIntegerSigned4

          public void onDataAttributeValueIntegerSigned4​(long x,
                                                         long y,
                                                         long z,
                                                         long w)

      Description copied from interface: `SMFParserEventsDataAttributeValuesType`
      A data value has been received.
      Specified by:
        `onDataAttributeValueIntegerSigned4` in interface `SMFParserEventsDataAttributeValuesType`
      Parameters:
        `x` - The x value
        `y` - The y value
        `z` - The z value
        `w` - The w value

    - #### onDataAttributeValueIntegerUnsigned1

          public void onDataAttributeValueIntegerUnsigned1​(long x)

      Description copied from interface: `SMFParserEventsDataAttributeValuesType`
      A data value has been received.
      Specified by:
        `onDataAttributeValueIntegerUnsigned1` in interface `SMFParserEventsDataAttributeValuesType`
      Parameters:
        `x` - The x value

    - #### onDataAttributeValueIntegerUnsigned2

          public void onDataAttributeValueIntegerUnsigned2​(long x,
                                                           long y)

      Description copied from interface: `SMFParserEventsDataAttributeValuesType`
      A data value has been received.
      Specified by:
        `onDataAttributeValueIntegerUnsigned2` in interface `SMFParserEventsDataAttributeValuesType`
      Parameters:
        `x` - The x value
        `y` - The y value

    - #### onDataAttributeValueIntegerUnsigned3

          public void onDataAttributeValueIntegerUnsigned3​(long x,
                                                           long y,
                                                           long z)

      Description copied from interface: `SMFParserEventsDataAttributeValuesType`
      A data value has been received.
      Specified by:
        `onDataAttributeValueIntegerUnsigned3` in interface `SMFParserEventsDataAttributeValuesType`
      Parameters:
        `x` - The x value
        `y` - The y value
        `z` - The z value

    - #### onDataAttributeValueIntegerUnsigned4

          public void onDataAttributeValueIntegerUnsigned4​(long x,
                                                           long y,
                                                           long z,
                                                           long w)

      Description copied from interface: `SMFParserEventsDataAttributeValuesType`
      A data value has been received.
      Specified by:
        `onDataAttributeValueIntegerUnsigned4` in interface `SMFParserEventsDataAttributeValuesType`
      Parameters:
        `x` - The x value
        `y` - The y value
        `z` - The z value
        `w` - The w value

    - #### onDataAttributeValueFloat1

          public void onDataAttributeValueFloat1​(double x)

      Description copied from interface: `SMFParserEventsDataAttributeValuesType`
      A data value has been received.
      Specified by:
        `onDataAttributeValueFloat1` in interface `SMFParserEventsDataAttributeValuesType`
      Parameters:
        `x` - The x value

    - #### onDataAttributeValueFloat2

          public void onDataAttributeValueFloat2​(double x,
                                                 double y)

      Description copied from interface: `SMFParserEventsDataAttributeValuesType`
      A data value has been received.
      Specified by:
        `onDataAttributeValueFloat2` in interface `SMFParserEventsDataAttributeValuesType`
      Parameters:
        `x` - The x value
        `y` - The y value

    - #### onDataAttributeValueFloat3

          public void onDataAttributeValueFloat3​(double x,
                                                 double y,
                                                 double z)

      Description copied from interface: `SMFParserEventsDataAttributeValuesType`
      A data value has been received.
      Specified by:
        `onDataAttributeValueFloat3` in interface `SMFParserEventsDataAttributeValuesType`
      Parameters:
        `x` - The x value
        `y` - The y value
        `z` - The z value

    - #### onDataAttributeValueFloat4

          public void onDataAttributeValueFloat4​(double x,
                                                 double y,
                                                 double z,
                                                 double w)

      Description copied from interface: `SMFParserEventsDataAttributeValuesType`
      A data value has been received.
      Specified by:
        `onDataAttributeValueFloat4` in interface `SMFParserEventsDataAttributeValuesType`
      Parameters:
        `x` - The x value
        `y` - The y value
        `z` - The z value
        `w` - The w value

    - #### onDataAttributeValueFinish

          public void onDataAttributeValueFinish()

      Description copied from interface: `SMFParserEventsDataAttributeValuesType`
      Parsing of data for the attribute has finished.
      Specified by:
        `onDataAttributeValueFinish` in interface `SMFParserEventsDataAttributeValuesType`

    - #### onDataTriangle

          public void onDataTriangle​(long v0,
                                     long v1,
                                     long v2)

      Description copied from interface: `SMFParserEventsDataTrianglesType`
      A triangle has been parsed.
      Specified by:
        `onDataTriangle` in interface `SMFParserEventsDataTrianglesType`
      Parameters:
        `v0` - The index of the first vertex
        `v1` - The index of the second vertex
        `v2` - The index of the third vertex

    - #### onDataTrianglesFinish

          public void onDataTrianglesFinish()

      Description copied from interface: `SMFParserEventsDataTrianglesType`
      Parsing of triangles has completed.
      Specified by:
        `onDataTrianglesFinish` in interface `SMFParserEventsDataTrianglesType`

    - #### onHeaderParsed

          public java.util.Optional<SMFParserEventsBodyType> onHeaderParsed​(SMFHeader in_header)

      Description copied from interface: `SMFParserEventsHeaderType`
      Parsing of the header was successful. The function must return an event receiver if it wishes parsing to continue.
      Specified by:
        `onHeaderParsed` in interface `SMFParserEventsHeaderType`
      Parameters:
        `in_header` - The parsed header
      Returns:
        An event receiver

    - #### onDataAttributeStart

          public java.util.Optional<SMFParserEventsDataAttributeValuesType> onDataAttributeStart​(SMFAttribute attribute)

      Description copied from interface: `SMFParserEventsDataAttributesNonInterleavedType`

      Parsing of data for the attribute has started.

      This method must return a receiver for the given attribute if it wants to receive values, or `Optional.empty()` if it does not.

      Specified by:
        `onDataAttributeStart` in interface `SMFParserEventsDataAttributesNonInterleavedType`
      Parameters:
        `attribute` - The attribute
      Returns:
        A value receiver

    - #### onDataAttributesNonInterleavedFinish

          public void onDataAttributesNonInterleavedFinish()

      Description copied from interface: `SMFParserEventsDataAttributesNonInterleavedType`
      Called when parsing of all non-interleaved attribute data has finished.
      Specified by:
        `onDataAttributesNonInterleavedFinish` in interface `SMFParserEventsDataAttributesNonInterleavedType`

    - #### onMetaData

          public void onMetaData​(SMFSchemaIdentifier schema,
                                 byte[] data)

      Description copied from interface: `SMFParserEventsDataMetaType`
      Metadata is ready for delivery.
      Specified by:
        `onMetaData` in interface `SMFParserEventsDataMetaType`
      Parameters:
        `schema` - The metadata schema
        `data` - The data

    - #### onMeta

          public java.util.Optional<SMFParserEventsDataMetaType> onMeta​(SMFSchemaIdentifier schema)

      Specified by:
        `onMeta` in interface `SMFParserEventsDataMetaOptionalSupplierType`
      Parameters:
        `schema` - The schema ID
      Returns:
        A listener that will receive metadata