Packages

  • package root
    Definition Classes
    root
  • package io
    Definition Classes
    root
  • package github
    Definition Classes
    io
  • package memo33
    Definition Classes
    github
  • package scdbpf

    Provides methods for accessing and modifying the contents of DBPF formatted files.

    Provides methods for accessing and modifying the contents of DBPF formatted files. Currently, only DBPF version 1.0 is supported (used by SimCity 4).

    DBPF files are accessed via DbpfFiles, a container of DbpfEntries. The content of a DbpfEntry can be accessed from BufferedEntries in decoded form as DbpfType, such as Exemplar, Fsh or Sc4Path.

    This package object provides additional type aliases for DbpfExceptions.

    Examples

    To get started, it is easiest to start the REPL via sbt console, which loads all the dependencies and useful initial import statements. Reading a DBPF file, sorting its entries by TGI and writing back to the same file could be achieved like this:

    val dbpf = DbpfFile.read(new File("foobar.dat"))
    dbpf.write(dbpf.entries.sortBy(_.tgi))

    This example shifts the GIDs of all LTexts by +3:

    dbpf.write(dbpf.entries.map { e =>
      if (e.tgi matches Tgi.LText)
        e.copy(e.tgi.copy(gid = e.tgi.gid + 3))
      else
        e
    })

    Another example: This decodes all the Sc4Path entries and rotates them by 90 degree.

    val writeList = for (e <- dbpf.entries) yield {
      if (e.tgi matches Tgi.Sc4Path) {
        val be = e.toBufferedEntry.convertContentTo(Sc4Path)
        be.copy(content = be.content * RotFlip.R1F0)
      } else {
        e
      }
    }
    dbpf.write(writeList)

    The following example finds the first entry that is an exemplar and contains a property with a specific ID. (Note the view to avoid unnecessary decoding if the exemplar is already among the first entries.)

    val id = UInt(0x12345678)
    dbpf.entries.view.
      filter(_.tgi matches Tgi.Exemplar).
      map(_.toBufferedEntry.convertContentTo(Exemplar)).
      find(_.content.properties.contains(id))
    Definition Classes
    memo33
  • package compat
    Definition Classes
    scdbpf
  • BufferedEntry
  • DbpfEntry
  • DbpfExceptions
  • DbpfFile
  • DbpfPackager
  • DbpfProperty
  • DbpfType
  • DbpfTypeCompanion
  • DbpfUtil
  • Exemplar
  • Experimental
  • Fsh
  • LText
  • RawEntry
  • RawType
  • S3d
  • Sc4Path
  • StreamedEntry
  • Tgi
  • TgiMask
  • WithContentConverter

trait S3d extends DbpfType

Source
S3d.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. S3d
  2. DbpfType
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract val anim: AnimSection
  2. abstract def data: Array[Byte]

    the uncompressed raw byte data of the entry

    the uncompressed raw byte data of the entry

    Attributes
    protected
    Definition Classes
    DbpfType
  3. abstract val indx: IndexedSeq[IndxGroup]
  4. abstract val mats: IndexedSeq[MatsGroup]
  5. abstract val prim: IndexedSeq[PrimGroup]
  6. abstract val prop: IndexedSeq[PropGroup]
  7. abstract val regp: IndexedSeq[RegpGroup]
  8. abstract val vert: IndexedSeq[VertGroup]

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. def *(rf: RotFlip): S3d

    Rotates and flips the model.

    Rotates and flips the model. If it is flipped, the normals will be flipped back automatically. Currently only supported for models without RegpGroup, and flipping is only supported for models consisting of triangles.

    Exceptions thrown

    UnsupportedOperationException if model has a non-empty RegpGroup or if rf.flipped and PrimGroup has other than triangles.

  4. def ++(that: S3d): S3d

    Combines two S3d-models by appending that to this.

    Combines two S3d-models by appending that to this. Anim-properties playMode, numFrames, frameRate and displacement are copied from this, only.

  5. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  8. def convert[B <: DbpfType](implicit eh: ExceptionHandler, conv: Converter[DbpfType, B]): ![B, DbpfDecodeFailedException]

    Deprecated: Prefer convertTo instead.

    Deprecated: Prefer convertTo instead.

    Converts this type to B. The implicit converter is usually provided by the companion object of B.

    An ExceptionHandler needs to be brought into scope via imports (either strategy.throwExceptions or strategy.captureExceptions from the scdbpf package).

    B

    the type which this type gets converted to

    Definition Classes
    DbpfType
    Exceptions thrown

    DbpfDecodeFailedException if this type cannot be converted to type B structurally

  9. def convertTo[B <: DbpfType](dbpfType: DbpfTypeCompanion[B])(implicit eh: ExceptionHandler): ![B, DbpfDecodeFailedException]

    Convert this type to B.

    Convert this type to B.

    An ExceptionHandler needs to be brought into scope via imports (either strategy.throwExceptions or strategy.captureExceptions from the scdbpf package).

    B

    the type which this type gets converted to

    dbpfType

    (the companion object of) the type which this type gets converted to

    Definition Classes
    DbpfType
    Exceptions thrown

    DbpfDecodeFailedException if this type cannot be converted to type B structurally

  10. def copy(vert: IndexedSeq[VertGroup] = vert, indx: IndexedSeq[IndxGroup] = indx, prim: IndexedSeq[PrimGroup] = prim, mats: IndexedSeq[MatsGroup] = mats, anim: AnimSection = anim, prop: IndexedSeq[PropGroup] = prop, regp: IndexedSeq[RegpGroup] = regp): S3d
  11. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  12. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  13. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  14. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  15. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  16. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  17. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  19. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  20. def scale(s: Float): S3d

    Scales the model uniformly by a factor.

  21. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  22. def toString(): String
    Definition Classes
    AnyRef → Any
  23. def translate(t: Translation): S3d

    Translates the model on the three axes.

  24. def trim: S3d

    Removes Mats, Indx, Prim and Vert groups that are unused, i.e.

    Removes Mats, Indx, Prim and Vert groups that are unused, i.e. are not referenced in the Anim section. It does not perform a deep check, i.e. to the individual vertices that might be redundant.

  25. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  26. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  27. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  28. def withNormalsFlipped: S3d

    Flips the normals by reversing the order of every triangle in the PrimGroups.

    Flips the normals by reversing the order of every triangle in the PrimGroups. Currently, only supported for models consisting of triangles.

    Exceptions thrown

    UnsupportedOperationException if PrimGroup has other than triangles.

Inherited from DbpfType

Inherited from AnyRef

Inherited from Any

Ungrouped