
simplex3d.data.float.SerializableRFloat.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of simplex3d-data-float_2.10 Show documentation
Show all versions of simplex3d-data-float_2.10 Show documentation
Data Binding API, Float Module.
The newest version!
/*
* Simplex3dData - Float Module
* Copyright (C) 2010-2011, Aleksey Nikiforov
*
* This file is part of Simplex3dData.
*
* Simplex3dData is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Simplex3dData is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*/
package simplex3d.data
package float
import simplex3d.data.extension._
/**
* @author Aleksey Nikiforov (lex)
*/
@SerialVersionUID(8104346712419693669L)
private[data] class PrimitiveRFloat(val rawEnum: Int) extends SerializablePrimitive with Serializable {
protected def toReadDataArray(): ReadDataArray[_, _] = {
import RawEnum._
rawEnum match {
case SByte => DataArray[RFloat, SByte](content.asInstanceOf[Array[Byte]])
case UByte => DataArray[RFloat, UByte](content.asInstanceOf[Array[Byte]])
case SShort => DataArray[RFloat, SShort](content.asInstanceOf[Array[Short]])
case UShort => DataArray[RFloat, UShort](content.asInstanceOf[Array[Char]])
case SInt => DataArray[RFloat, SInt](content.asInstanceOf[Array[Int]])
case UInt => DataArray[RFloat, UInt](content.asInstanceOf[Array[Int]])
case HFloat => DataArray[RFloat, HFloat](content.asInstanceOf[Array[Short]])
case RFloat => DataArray[RFloat, RFloat](content.asInstanceOf[Array[Float]])
}
}
}
@SerialVersionUID(8104346712419693669L)
private[data] class CompositeRFloat(val components: Int) extends SerializableComposite with Serializable {
protected def toReadDataArray(
primitives: ReadDataArray[_ <: PrimitiveFormat, _]
): ReadDataArray[_ <: CompositeFormat, _] = {
components match {
case 2 => FactoryVec2f.mkReadDataArray(primitives.asInstanceOf[ReadDataArray[RFloat, _ <: TangibleFloat]])
case 3 => FactoryVec3f.mkReadDataArray(primitives.asInstanceOf[ReadDataArray[RFloat, _ <: TangibleFloat]])
case 4 => FactoryVec4f.mkReadDataArray(primitives.asInstanceOf[ReadDataArray[RFloat, _ <: TangibleFloat]])
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy