Class ToUnsignedByteScaleByType


public final class ToUnsignedByteScaleByType extends ToUnsignedByte
Converts voxel buffers to a UnsignedByteBuffer scaling against the maximum value in each buffer.

There is no clamping of values, but some might become very small.

Author:
Owen Feehan
  • Constructor Details

    • ToUnsignedByteScaleByType

      public ToUnsignedByteScaleByType()
  • Method Details

    • convertUnsignedShort

      protected void convertUnsignedShort(UnsignedShortBuffer in, UnsignedByteBuffer out)
      Description copied from class: VoxelsConverter
      Copies a value from the current position in a UnsignedShortBuffer to the current position in a buffer of type T.
      Specified by:
      convertUnsignedShort in class VoxelsConverter<UnsignedByteBuffer>
      Parameters:
      in - the current position of this buffer gives the value to convert, and the position is incremented.
      out - the converted value is written to the current position of this buffer, and the position is incremented.
    • convertUnsignedInt

      protected void convertUnsignedInt(UnsignedIntBuffer in, UnsignedByteBuffer out)
      Description copied from class: VoxelsConverter
      Copies a value from the current position in a UnsignedIntBuffer to the current position in a buffer of type T.
      Specified by:
      convertUnsignedInt in class VoxelsConverter<UnsignedByteBuffer>
      Parameters:
      in - the current position of this buffer gives the value to convert, and the position is incremented.
      out - the converted value is written to the current position of this buffer, and the position is incremented.
    • convertFloat

      protected void convertFloat(FloatBuffer in, UnsignedByteBuffer out)
      Converts the current position in a FloatBuffer to the current position in a UnsignedShortBuffer.

      We pretend the maximum effective value of the float is the same as UnsignedIntVoxelType.MAX_VALUE, and scale to this range fits the buffer.

      Specified by:
      convertFloat in class VoxelsConverter<UnsignedByteBuffer>
      Parameters:
      in - the current position of this buffer gives the value to convert, and the position is incremented.
      out - the converted value is written to the current position of this buffer, and the position is incremented.