Unify under one project
This commit is contained in:
parent
c9cb936836
commit
c7b279257f
27 changed files with 2510 additions and 4 deletions
33
build.sbt
33
build.sbt
|
@ -1,4 +1,31 @@
|
|||
lazy val core = (project in file("core")).settings(
|
||||
lazy val scodec = (project in file("scodec")).settings(
|
||||
organization := "tf.bug",
|
||||
name := "fancadescodec",
|
||||
version := "0.1.0",
|
||||
scalaVersion := "2.13.2",
|
||||
libraryDependencies ++= Seq(
|
||||
"org.scodec" %% "scodec-core" % "1.11.7",
|
||||
"org.scodec" %% "scodec-bits" % "1.1.14",
|
||||
"org.scodec" %% "scodec-stream" % "2.0.0",
|
||||
"org.typelevel" %% "cats-effect" % "2.1.2",
|
||||
"org.typelevel" %% "cats-core" % "2.1.1",
|
||||
"co.fs2" %% "fs2-core" % "2.3.0",
|
||||
"co.fs2" %% "fs2-io" % "2.3.0",
|
||||
),
|
||||
mainClass in assembly := Some("tf.bug.fancadescodec.Main"),
|
||||
)
|
||||
|
||||
lazy val graph = (project in file("graph")).settings(
|
||||
organization := "tf.bug",
|
||||
name := "fancadegraph",
|
||||
version := "0.1.0",
|
||||
scalaVersion := "2.13.2",
|
||||
libraryDependencies ++= Seq(
|
||||
"org.scala-graph" %% "graph-core" % "1.13.2",
|
||||
),
|
||||
).dependsOn(scodec)
|
||||
|
||||
lazy val tagless = (project in file("tagless")).settings(
|
||||
organization := "tf.bug",
|
||||
name := "fancadetagless",
|
||||
version := "0.1.0",
|
||||
|
@ -9,10 +36,8 @@ lazy val core = (project in file("core")).settings(
|
|||
"org.typelevel" %% "cats-core" % "2.1.1",
|
||||
"org.typelevel" %% "cats-effect" % "2.1.2",
|
||||
"io.chrisdavenport" %% "fuuid" % "0.3.0",
|
||||
"tf.bug" %% "fancadescodec" % "0.1.1",
|
||||
"tf.bug" %% "fancadegraph" % "0.1.0",
|
||||
"org.scalameta" %% "munit" % "0.7.9" % Test,
|
||||
),
|
||||
testFrameworks += new TestFramework("munit.Framework"),
|
||||
addCompilerPlugin("org.typelevel" %% "kind-projector" % "0.11.0" cross CrossVersion.full),
|
||||
)
|
||||
).dependsOn(scodec, graph)
|
||||
|
|
34
graph/src/main/scala/tf/bug/fancadegraph/Argument.scala
Normal file
34
graph/src/main/scala/tf/bug/fancadegraph/Argument.scala
Normal file
|
@ -0,0 +1,34 @@
|
|||
package tf.bug.fancadegraph
|
||||
|
||||
import tf.bug.{fancadescodec => fansc}
|
||||
|
||||
trait Argument[T] {
|
||||
def encode(value: T)(pos: fansc.Position): Vector[fansc.Metadata]
|
||||
}
|
||||
|
||||
object Argument {
|
||||
implicit val unitArg: Argument[Unit] = new Argument[Unit] {
|
||||
override def encode(value: Unit)(pos: fansc.Position): Vector[fansc.Metadata] = Vector.empty
|
||||
}
|
||||
implicit val stringArg: Argument[String] = new Argument[String] {
|
||||
override def encode(value: String)(pos: fansc.Position): Vector[fansc.Metadata] = Vector(
|
||||
fansc.Metadata.Text(pos, value)
|
||||
)
|
||||
}
|
||||
implicit val floatArg: Argument[Float] = new Argument[Float] {
|
||||
override def encode(value: Float)(pos: fansc.Position): Vector[fansc.Metadata] = Vector(
|
||||
fansc.Metadata.Number(pos, value)
|
||||
)
|
||||
}
|
||||
implicit val soundOptionsArg: Argument[SoundOptions] = new Argument[SoundOptions] {
|
||||
override def encode(value: SoundOptions)(pos: fansc.Position): Vector[fansc.Metadata] = Vector(
|
||||
fansc.Metadata.PlaySoundLoop(pos, value.loop),
|
||||
fansc.Metadata.PlaySoundSample(pos, value.sample)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
case class SoundOptions(
|
||||
loop: Boolean,
|
||||
sample: fansc.Metadata.Sample
|
||||
)
|
22
graph/src/main/scala/tf/bug/fancadegraph/Block.scala
Normal file
22
graph/src/main/scala/tf/bug/fancadegraph/Block.scala
Normal file
|
@ -0,0 +1,22 @@
|
|||
package tf.bug.fancadegraph
|
||||
|
||||
import tf.bug.fancadescodec.{Metadata, Position}
|
||||
|
||||
case class Block[T](
|
||||
position: Position,
|
||||
definition: BlockDefinition[T],
|
||||
argument: T
|
||||
)(
|
||||
implicit ev: Argument[T]
|
||||
) {
|
||||
def metadata: Vector[Metadata] = ev.encode(argument)(position)
|
||||
}
|
||||
|
||||
object Block {
|
||||
def apply(position: Position, definition: BlockDefinition[Unit]): Block[Unit] =
|
||||
new Block(
|
||||
position,
|
||||
definition,
|
||||
()
|
||||
)
|
||||
}
|
1186
graph/src/main/scala/tf/bug/fancadegraph/BlockDefinition.scala
Normal file
1186
graph/src/main/scala/tf/bug/fancadegraph/BlockDefinition.scala
Normal file
File diff suppressed because it is too large
Load diff
87
graph/src/main/scala/tf/bug/fancadegraph/Level.scala
Normal file
87
graph/src/main/scala/tf/bug/fancadegraph/Level.scala
Normal file
|
@ -0,0 +1,87 @@
|
|||
package tf.bug.fancadegraph
|
||||
|
||||
import cats.data._
|
||||
import scalax.collection.Graph
|
||||
import scalax.collection.GraphEdge.DiHyperEdge
|
||||
import tf.bug.{fancadescodec => fansc}
|
||||
|
||||
case class Level(
|
||||
blocks: Set[Block[_]],
|
||||
wires: Graph[Pin, DiHyperEdge]
|
||||
)
|
||||
|
||||
object Level {
|
||||
|
||||
def validate(level: Level): Chain[String] = {
|
||||
???
|
||||
}
|
||||
|
||||
def encode(level: Level): tf.bug.fancadescodec.Entry = {
|
||||
val boundary = level.blocks.foldLeft(fansc.Boundary(0, 0, 0)) {
|
||||
case (fansc.Boundary(lr, du, nf), block) =>
|
||||
val tlr = block.position.lr + block.definition.width
|
||||
val tdu = block.position.du + block.definition.height
|
||||
val tnf = block.position.nf + block.definition.depth
|
||||
fansc.Boundary(lr.max(tlr), du.max(tdu), nf.max(tnf))
|
||||
}
|
||||
val objs: Vector[fansc.Obj] = {
|
||||
val initialVector = Vector.fill(boundary.sizeNF, boundary.sizeDU, boundary.sizeLR)(fansc.Obj.empty)
|
||||
level.blocks.foldLeft(initialVector) {
|
||||
case (ew, nb) =>
|
||||
val fansc.Position(sx, sy, sz) = nb.position
|
||||
(0 until nb.definition.depth).foldLeft(ew) {
|
||||
case (zw, z) =>
|
||||
(0 until nb.definition.height).foldLeft(zw) {
|
||||
case (yw, y) =>
|
||||
(0 until nb.definition.width).foldLeft(yw) {
|
||||
case (xw, x) =>
|
||||
val objInd = x + (y * nb.definition.width) + (z * nb.definition.width * nb.definition.height)
|
||||
xw.updated(sz + z, xw(sz + z).updated(sy + y, xw(sz + z)(sy + y).updated(sx + x, nb.definition.ids(objInd))))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}.flatten.flatten
|
||||
val metadatas = level.blocks.toVector.map(_.metadata).flatten
|
||||
val wires = level.wires.edges.toVector.map(_.edge).flatMap {
|
||||
edge =>
|
||||
val from = edge.nodeSeq.head
|
||||
edge.nodeSeq.tail.map { to =>
|
||||
if(from.definition.dataType == PinType.Pull) {
|
||||
fansc.Wire(
|
||||
to.owner.position,
|
||||
from.owner.position,
|
||||
to.definition.voxel,
|
||||
from.definition.voxel
|
||||
)
|
||||
} else {
|
||||
fansc.Wire(
|
||||
from.owner.position,
|
||||
to.owner.position,
|
||||
from.definition.voxel,
|
||||
to.definition.voxel
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
fansc.Entry(
|
||||
Some(0x03), // TODO
|
||||
"hello", // TODO
|
||||
None, // TODO
|
||||
Some(fansc.World(
|
||||
boundary,
|
||||
objs
|
||||
)),
|
||||
Some(metadatas),
|
||||
Some(wires)
|
||||
)
|
||||
}
|
||||
|
||||
def toScodec(ours: Level): ValidatedNec[String, tf.bug.fancadescodec.Entry] = {
|
||||
NonEmptyChain.fromChain(validate(ours))
|
||||
.fold[ValidatedNec[String, tf.bug.fancadescodec.Entry]](
|
||||
Validated.Valid(encode(ours))
|
||||
)(Validated.Invalid(_))
|
||||
}
|
||||
|
||||
}
|
47
graph/src/main/scala/tf/bug/fancadegraph/Main.scala
Normal file
47
graph/src/main/scala/tf/bug/fancadegraph/Main.scala
Normal file
|
@ -0,0 +1,47 @@
|
|||
package tf.bug.fancadegraph
|
||||
|
||||
import cats.effect.{Blocker, ExitCode, IO, IOApp}
|
||||
import cats.implicits._
|
||||
import fs2._
|
||||
import java.nio.file.{Paths, StandardOpenOption}
|
||||
import scalax.collection.Graph
|
||||
import scalax.collection.GraphEdge.DiHyperEdge
|
||||
import scodec.stream.StreamEncoder
|
||||
import tf.bug.fancadescodec.{Cartridge, Codecs, Position}
|
||||
|
||||
object Main extends IOApp {
|
||||
|
||||
override def run(args: List[String]): IO[ExitCode] = {
|
||||
val winBlock = Block(Position(0, 0, 0), BlockDefinition.Win)
|
||||
val loseBlock = Block(Position(0, 0, 3), BlockDefinition.Lose)
|
||||
val loseAfter = Pin(loseBlock, BlockDefinition.Lose.after)
|
||||
val winBefore = Pin(winBlock, BlockDefinition.Win.before)
|
||||
val level = Level(
|
||||
Set(
|
||||
winBlock,
|
||||
loseBlock
|
||||
),
|
||||
Graph[Pin, DiHyperEdge](
|
||||
DiHyperEdge(winBefore, loseAfter)
|
||||
)
|
||||
)
|
||||
|
||||
val output = Paths.get("""C:\Users\aprim\Documents\FancadeLevels\GraphTest""")
|
||||
val cart = Cartridge(
|
||||
"Graph Test",
|
||||
"Raymond AC",
|
||||
"Test of Fancade Graph Library",
|
||||
Vector(
|
||||
Level.encode(level)
|
||||
)
|
||||
)
|
||||
|
||||
(for {
|
||||
blocker <- Stream.resource(Blocker[IO])
|
||||
result <- Stream.emit[IO, Cartridge](cart)
|
||||
.through(StreamEncoder.once(Codecs.encCartridge).toPipeByte[IO])
|
||||
.through(io.file.writeAll(output, blocker, Seq(StandardOpenOption.CREATE_NEW)))
|
||||
} yield result).compile.drain.as(ExitCode.Success)
|
||||
}
|
||||
|
||||
}
|
6
graph/src/main/scala/tf/bug/fancadegraph/Pin.scala
Normal file
6
graph/src/main/scala/tf/bug/fancadegraph/Pin.scala
Normal file
|
@ -0,0 +1,6 @@
|
|||
package tf.bug.fancadegraph
|
||||
|
||||
case class Pin(
|
||||
owner: Block[_],
|
||||
definition: PinDefinition
|
||||
)
|
47
graph/src/main/scala/tf/bug/fancadegraph/PinDefinition.scala
Normal file
47
graph/src/main/scala/tf/bug/fancadegraph/PinDefinition.scala
Normal file
|
@ -0,0 +1,47 @@
|
|||
package tf.bug.fancadegraph
|
||||
|
||||
import tf.bug.fancadescodec.Position
|
||||
|
||||
case class PinDefinition(
|
||||
dataType: PinType,
|
||||
direction: PinDirection,
|
||||
voxel: Position
|
||||
)
|
||||
|
||||
sealed trait PinType
|
||||
object PinType {
|
||||
|
||||
case object Number extends PinType
|
||||
case object Object extends PinType
|
||||
case object Vector extends PinType
|
||||
case object Rotation extends PinType
|
||||
case object Truth extends PinType
|
||||
case object Constraint extends PinType
|
||||
case object Pull extends PinType
|
||||
|
||||
case class Pointer(of: PinType) extends PinType
|
||||
|
||||
}
|
||||
|
||||
sealed trait PinDirection
|
||||
object PinDirection {
|
||||
|
||||
case object Input extends PinDirection
|
||||
case object Output extends PinDirection
|
||||
|
||||
}
|
||||
|
||||
object PinPosition {
|
||||
|
||||
def bottom(n: Int): Position = Position(3 + (8 * n), 1, 0)
|
||||
def top(depth: Int)(n: Int): Position = Position(3 + (8 * n), 1, 6 + (8 * (depth - 1)))
|
||||
def left(n: Int): Position = Position(0, 1, 3 + (8 * n))
|
||||
def right(width: Int)(n: Int): Position = Position(6 + (8 * (width - 1)), 1, 3 + (8 * n))
|
||||
|
||||
val top1: Int => Position = top(1)
|
||||
val top2: Int => Position = top(2)
|
||||
val top3: Int => Position = top(3)
|
||||
val top4: Int => Position = top(4)
|
||||
val right2: Int => Position = right(2)
|
||||
|
||||
}
|
2
project/plugins.sbt
Normal file
2
project/plugins.sbt
Normal file
|
@ -0,0 +1,2 @@
|
|||
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.11")
|
||||
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.10")
|
13
scodec/src/main/scala/tf/bug/fancadescodec/Boundary.scala
Normal file
13
scodec/src/main/scala/tf/bug/fancadescodec/Boundary.scala
Normal file
|
@ -0,0 +1,13 @@
|
|||
package tf.bug.fancadescodec
|
||||
|
||||
case class Position(
|
||||
lr: Int,
|
||||
du: Int,
|
||||
nf: Int
|
||||
)
|
||||
|
||||
case class Boundary(
|
||||
sizeLR: Int,
|
||||
sizeDU: Int,
|
||||
sizeNF: Int
|
||||
)
|
|
@ -0,0 +1,8 @@
|
|||
package tf.bug.fancadescodec
|
||||
|
||||
case class Cartridge(
|
||||
title: String,
|
||||
author: String,
|
||||
description: String,
|
||||
entries: Vector[Entry]
|
||||
)
|
159
scodec/src/main/scala/tf/bug/fancadescodec/Codecs.scala
Normal file
159
scodec/src/main/scala/tf/bug/fancadescodec/Codecs.scala
Normal file
|
@ -0,0 +1,159 @@
|
|||
package tf.bug.fancadescodec
|
||||
|
||||
import scodec._
|
||||
import scodec.bits.{BitVector, ByteVector}
|
||||
import scodec.codecs._
|
||||
|
||||
object Codecs {
|
||||
|
||||
lazy val low: Codec[Unit] = constant(BitVector.low(1L))
|
||||
lazy val high: Codec[Unit] = constant(BitVector.high(1L))
|
||||
|
||||
def optionC[A](b: Boolean, c: Codec[A]): Codec[Option[A]] =
|
||||
optional(provide(b), c)
|
||||
|
||||
lazy val fancadeString: Codec[String] = variableSizeBytes(uint8L, utf8)
|
||||
|
||||
lazy val cartridgeMagic: Codec[Unit] = constant(ByteVector(0x1B, 0x00))
|
||||
lazy val entriesMagic: Codec[Unit] = constant(ByteVector(0x2C, 0x02))
|
||||
|
||||
lazy val cartridge: Codec[Cartridge] =
|
||||
(
|
||||
cartridgeMagic ~>
|
||||
fancadeString ::
|
||||
fancadeString ::
|
||||
fancadeString ::
|
||||
(entriesMagic ~> vectorOfN(uint16L, entry)).hlist
|
||||
).as[Cartridge]
|
||||
|
||||
lazy val boundary: Codec[Boundary] =
|
||||
(uint16L :: uint16L :: uint16L).as[Boundary]
|
||||
|
||||
lazy val position: Codec[Position] =
|
||||
(uint16L :: uint16L :: uint16L).as[Position]
|
||||
|
||||
lazy val face: Codec[Vector[Int]] = fixedSizeBytes(8L * 8L * 8L, vector(uint8L))
|
||||
lazy val faces: Codec[Faces] =
|
||||
(face :: face :: face :: face :: face :: face).as[Faces]
|
||||
|
||||
lazy val obj: Codec[Obj] = uint16L.xmap(Obj(_), _.id)
|
||||
|
||||
lazy val world: Codec[World] = boundary.flatPrepend { b =>
|
||||
vectorOfN(provide(b.sizeLR * b.sizeDU * b.sizeNF), obj).hlist
|
||||
}.as[World]
|
||||
|
||||
lazy val wires: Codec[Vector[Wire]] = vectorOfN(uint16L, wire)
|
||||
lazy val wire: Codec[Wire] =
|
||||
(position :: position :: position :: position.hlist).as[Wire]
|
||||
|
||||
lazy val metadatas: Codec[Vector[Metadata]] = vectorOfN(uint16L, metadata)
|
||||
lazy val metadata: Codec[Metadata] =
|
||||
discriminated[Metadata].by(uint16L)
|
||||
.subcaseP(0x0100) {
|
||||
case psl: Metadata.PlaySoundLoop => psl
|
||||
} (metadataPlaySoundLoop)
|
||||
.subcaseP(0x0201) {
|
||||
case pss: Metadata.PlaySoundSample => pss
|
||||
} (metadataPlaySoundSample)
|
||||
.subcaseP(0x0400) {
|
||||
case num: Metadata.Number => num
|
||||
} (metadataNumber)
|
||||
.subcaseP(0x0500) {
|
||||
case triple: Metadata.Triple => triple
|
||||
} (metadataTriple)
|
||||
.subcaseP(0x0600) {
|
||||
case text: Metadata.Text => text
|
||||
} (metadataText)
|
||||
.subcaseP(0x0700) {
|
||||
case terminal: Metadata.Terminal => terminal
|
||||
} (metadataTerminal)
|
||||
|
||||
lazy val metadataPlaySoundLoop: Codec[Metadata.PlaySoundLoop] =
|
||||
(position :: bool(8).hlist).as[Metadata.PlaySoundLoop]
|
||||
lazy val metadataPlaySoundSample: Codec[Metadata.PlaySoundSample] =
|
||||
(position :: sample.hlist).as[Metadata.PlaySoundSample]
|
||||
lazy val metadataNumber: Codec[Metadata.Number] =
|
||||
(position :: floatL.hlist).as[Metadata.Number]
|
||||
lazy val metadataTriple: Codec[Metadata.Triple] =
|
||||
(position :: floatL :: floatL :: floatL.hlist).as[Metadata.Triple]
|
||||
lazy val metadataText: Codec[Metadata.Text] =
|
||||
(position :: fancadeString.hlist).as[Metadata.Text]
|
||||
lazy val metadataTerminal: Codec[Metadata.Terminal] =
|
||||
(position :: fancadeString.hlist).as[Metadata.Terminal]
|
||||
|
||||
lazy val sample: Codec[Metadata.Sample] =
|
||||
discriminated[Metadata.Sample].by(uint16L)
|
||||
.subcaseP(0) {
|
||||
case chirp @ Metadata.Sample.Chirp => chirp
|
||||
} (provide(Metadata.Sample.Chirp))
|
||||
.subcaseP(1) {
|
||||
case scrape @ Metadata.Sample.Scrape => scrape
|
||||
} (provide(Metadata.Sample.Scrape))
|
||||
.subcaseP(2) {
|
||||
case squeek @ Metadata.Sample.Squeek => squeek
|
||||
} (provide(Metadata.Sample.Squeek))
|
||||
.subcaseP(3) {
|
||||
case engine @ Metadata.Sample.Engine => engine
|
||||
} (provide(Metadata.Sample.Engine))
|
||||
.subcaseP(4) {
|
||||
case button @ Metadata.Sample.Button => button
|
||||
} (provide(Metadata.Sample.Button))
|
||||
.subcaseP(5) {
|
||||
case ball @ Metadata.Sample.Ball => ball
|
||||
} (provide(Metadata.Sample.Ball))
|
||||
.subcaseP(6) {
|
||||
case piano @ Metadata.Sample.Piano => piano
|
||||
} (provide(Metadata.Sample.Piano))
|
||||
.subcaseP(7) {
|
||||
case marimba @ Metadata.Sample.Marimba => marimba
|
||||
} (provide(Metadata.Sample.Marimba))
|
||||
.subcaseP(8) {
|
||||
case pad @ Metadata.Sample.Pad => pad
|
||||
} (provide(Metadata.Sample.Pad))
|
||||
.subcaseP(9) {
|
||||
case beep @ Metadata.Sample.Beep => beep
|
||||
} (provide(Metadata.Sample.Beep))
|
||||
.subcaseP(10) {
|
||||
case plop @ Metadata.Sample.Plop => plop
|
||||
} (provide(Metadata.Sample.Plop))
|
||||
.subcaseP(11) {
|
||||
case flop @ Metadata.Sample.Flop => flop
|
||||
} (provide(Metadata.Sample.Flop))
|
||||
.subcaseP(12) {
|
||||
case splash @ Metadata.Sample.Splash => splash
|
||||
} (provide(Metadata.Sample.Splash))
|
||||
.subcaseP(13) {
|
||||
case boom @ Metadata.Sample.Boom => boom
|
||||
} (provide(Metadata.Sample.Boom))
|
||||
.subcaseP(14) {
|
||||
case hit @ Metadata.Sample.Hit => hit
|
||||
} (provide(Metadata.Sample.Hit))
|
||||
.subcaseP(15) {
|
||||
case clang @ Metadata.Sample.Clang => clang
|
||||
} (provide(Metadata.Sample.Clang))
|
||||
.subcaseP(16) {
|
||||
case jump @ Metadata.Sample.Jump => jump
|
||||
} (provide(Metadata.Sample.Jump))
|
||||
|
||||
lazy val entry: Codec[Entry] =
|
||||
( low ~ low ~ low ~ low ~
|
||||
bool ~ bool ~ bool ~ bool ~
|
||||
low ~ low ~ low ~ bool ~
|
||||
high ~ low ~ low ~ low).consume {
|
||||
case (_ ~ _ ~ _ ~ _ ~ isFaces ~ isWorld ~ isMetadata ~ isWires ~ _ ~ _ ~ _ ~ isVisible ~ _ ~ _ ~ _ ~ _) =>
|
||||
(
|
||||
optionC(isVisible, uint8L) ::
|
||||
fancadeString ::
|
||||
optionC(isFaces, faces) ::
|
||||
optionC(isWorld, world) ::
|
||||
optionC(isMetadata, metadatas) ::
|
||||
optionC(isWires, wires).hlist
|
||||
).as[Entry]
|
||||
} {
|
||||
case Entry(vFlags, _, f, wd, mt, wr) =>
|
||||
(() ~ () ~ () ~ () ~ f.isDefined ~ wd.isDefined ~ mt.isDefined ~ wr.isDefined ~ () ~ () ~ () ~ vFlags.isDefined ~ () ~ () ~ () ~ ())
|
||||
}
|
||||
|
||||
lazy val encCartridge: Codec[Cartridge] = zlib(cartridge)
|
||||
|
||||
}
|
10
scodec/src/main/scala/tf/bug/fancadescodec/Entry.scala
Normal file
10
scodec/src/main/scala/tf/bug/fancadescodec/Entry.scala
Normal file
|
@ -0,0 +1,10 @@
|
|||
package tf.bug.fancadescodec
|
||||
|
||||
case class Entry(
|
||||
visibilityFlags: Option[Int],
|
||||
name: String,
|
||||
faces: Option[Faces],
|
||||
world: Option[World],
|
||||
metadatas: Option[Vector[Metadata]],
|
||||
wires: Option[Vector[Wire]]
|
||||
)
|
10
scodec/src/main/scala/tf/bug/fancadescodec/Faces.scala
Normal file
10
scodec/src/main/scala/tf/bug/fancadescodec/Faces.scala
Normal file
|
@ -0,0 +1,10 @@
|
|||
package tf.bug.fancadescodec
|
||||
|
||||
case class Faces(
|
||||
faceRight: Vector[Int],
|
||||
faceLeft: Vector[Int],
|
||||
faceUp: Vector[Int],
|
||||
faceDown: Vector[Int],
|
||||
faceFar: Vector[Int],
|
||||
faceNear: Vector[Int]
|
||||
)
|
125
scodec/src/main/scala/tf/bug/fancadescodec/Main.scala
Normal file
125
scodec/src/main/scala/tf/bug/fancadescodec/Main.scala
Normal file
|
@ -0,0 +1,125 @@
|
|||
package tf.bug.fancadescodec
|
||||
|
||||
import cats.effect._
|
||||
import cats.implicits._
|
||||
import fs2._
|
||||
import java.nio.file.Paths
|
||||
import scodec.stream.{StreamDecoder, StreamEncoder}
|
||||
|
||||
object Main extends IOApp {
|
||||
|
||||
override def run(args: List[String]): IO[ExitCode] = {
|
||||
(Stream.resource(Blocker[IO]) >>= write[IO]).compile.drain.as(ExitCode.Success)
|
||||
}
|
||||
|
||||
def read[F[_] : RaiseThrowable : Sync : ContextShift](blocker: Blocker): Stream[F, Unit] = {
|
||||
val input = Paths.get("""C:\Users\aprim\Documents\FancadeLevels\MetaWires""")
|
||||
io.file.readAll[F](input, blocker, 1024)
|
||||
.through(StreamDecoder.once(Codecs.encCartridge).toPipeByte)
|
||||
.evalMap(c => Sync[F].delay(println(c)))
|
||||
}
|
||||
|
||||
def write[F[_] : RaiseThrowable : Sync : ContextShift](blocker: Blocker): Stream[F, Unit] = {
|
||||
val output = Paths.get("""C:\Users\aprim\Documents\FancadeLevels\AllTheSamples""")
|
||||
|
||||
val outputCartridge = Cartridge(
|
||||
"AllTheSamples",
|
||||
"rayc",
|
||||
"A Fancade game",
|
||||
Vector(
|
||||
Entry(
|
||||
Some(0x03),
|
||||
"New Level",
|
||||
None,
|
||||
Some(
|
||||
World(
|
||||
Boundary(2, 17, 2),
|
||||
Vector.fill(17)(Vector(Obj.playSound0, Obj.playSound1)).flatten ++ Vector.fill(17)(Vector(Obj.playSound2, Obj.playSound3)).flatten
|
||||
)
|
||||
),
|
||||
Some(
|
||||
(0 until 17).map { case h =>
|
||||
Metadata.PlaySoundSample(
|
||||
Position(0, h, 0),
|
||||
h match {
|
||||
case 0 => Metadata.Sample.Chirp
|
||||
case 1 => Metadata.Sample.Scrape
|
||||
case 2 => Metadata.Sample.Squeek
|
||||
case 3 => Metadata.Sample.Engine
|
||||
case 4 => Metadata.Sample.Button
|
||||
case 5 => Metadata.Sample.Ball
|
||||
case 6 => Metadata.Sample.Piano
|
||||
case 7 => Metadata.Sample.Marimba
|
||||
case 8 => Metadata.Sample.Pad
|
||||
case 9 => Metadata.Sample.Beep
|
||||
case 10 => Metadata.Sample.Plop
|
||||
case 11 => Metadata.Sample.Flop
|
||||
case 12 => Metadata.Sample.Splash
|
||||
case 13 => Metadata.Sample.Boom
|
||||
case 14 => Metadata.Sample.Hit
|
||||
case 15 => Metadata.Sample.Clang
|
||||
case 16 => Metadata.Sample.Jump
|
||||
}
|
||||
)
|
||||
}.toVector
|
||||
),
|
||||
None
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
Stream.emit[F, Cartridge](outputCartridge)
|
||||
.through(StreamEncoder.once(Codecs.encCartridge).toPipeByte)
|
||||
.through(io.file.writeAll[F](output, blocker))
|
||||
}
|
||||
|
||||
val paletteMap: ((Int, Int, Int)) => String = Map(
|
||||
(238, 165, 162) -> "Brown 1",
|
||||
(255, 255, 255) -> "Tan 1",
|
||||
(192, 152, 255) -> "Purple 1",
|
||||
(255, 203, 252) -> "Pink 1",
|
||||
(255, 170, 170) -> "Red 1",
|
||||
(255, 185, 142) -> "Orange 1",
|
||||
(255, 255, 134) -> "Yellow 1",
|
||||
(194, 255, 118) -> "Green 1",
|
||||
(0, 205, 255) -> "Blue 1",
|
||||
(255, 255, 255) -> "White 1",
|
||||
(109, 111, 126) -> "Black 1",
|
||||
(203, 117, 137) -> "Brown 2",
|
||||
(255, 231, 207) -> "Tan 2",
|
||||
(153, 122, 234) -> "Purple 2",
|
||||
(255, 164, 224) -> "Pink 2",
|
||||
(255, 81, 115) -> "Red 2",
|
||||
(255, 123, 91) -> "Orange 2",
|
||||
(255, 234, 0) -> "Yellow 2",
|
||||
(72, 208, 85) -> "Green 2",
|
||||
(0, 154, 255) -> "Blue 2",
|
||||
(206, 208, 216) -> "White 2",
|
||||
(68, 68, 83) -> "Black 2",
|
||||
(156, 90, 100) -> "Brown 3",
|
||||
(255, 195, 180) -> "Tan 3",
|
||||
(113, 91, 173) -> "Purple 3",
|
||||
(255, 123, 186) -> "Pink 3",
|
||||
(205, 59, 86) -> "Red 3",
|
||||
(215, 89, 71) -> "Orange 3",
|
||||
(246, 185, 0) -> "Yellow 3",
|
||||
(0, 147, 82) -> "Green 3",
|
||||
(0, 117, 237) -> "Blue 3",
|
||||
(156, 158, 173) -> "White 3",
|
||||
(31, 31, 41) -> "Black 3",
|
||||
).withDefaultValue("Transparent")
|
||||
val indexMap: String => Int = List(
|
||||
"Black",
|
||||
"White",
|
||||
"Brown",
|
||||
"Tan",
|
||||
"Red",
|
||||
"Orange",
|
||||
"Yellow",
|
||||
"Green",
|
||||
"Blue",
|
||||
"Purple",
|
||||
"Pink"
|
||||
).flatMap(n => List(s"$n 3", s"$n 2", s"$n 1")).zipWithIndex.map { case (n, i) => (n, i + 1) }.toMap.withDefaultValue(0)
|
||||
|
||||
}
|
60
scodec/src/main/scala/tf/bug/fancadescodec/Metadata.scala
Normal file
60
scodec/src/main/scala/tf/bug/fancadescodec/Metadata.scala
Normal file
|
@ -0,0 +1,60 @@
|
|||
package tf.bug.fancadescodec
|
||||
|
||||
sealed trait Metadata
|
||||
|
||||
object Metadata {
|
||||
|
||||
case class PlaySoundLoop(
|
||||
block: Position,
|
||||
doLoop: Boolean
|
||||
) extends Metadata
|
||||
|
||||
case class PlaySoundSample(
|
||||
block: Position,
|
||||
sample: Sample
|
||||
) extends Metadata
|
||||
|
||||
sealed trait Sample
|
||||
object Sample {
|
||||
case object Chirp extends Sample
|
||||
case object Scrape extends Sample
|
||||
case object Squeek extends Sample
|
||||
case object Engine extends Sample
|
||||
case object Button extends Sample
|
||||
case object Ball extends Sample
|
||||
case object Piano extends Sample
|
||||
case object Marimba extends Sample
|
||||
case object Pad extends Sample
|
||||
case object Beep extends Sample
|
||||
case object Plop extends Sample
|
||||
case object Flop extends Sample
|
||||
case object Splash extends Sample
|
||||
case object Boom extends Sample
|
||||
case object Hit extends Sample
|
||||
case object Clang extends Sample
|
||||
case object Jump extends Sample
|
||||
}
|
||||
|
||||
case class Number(
|
||||
block: Position,
|
||||
value: Float
|
||||
) extends Metadata
|
||||
|
||||
case class Text(
|
||||
block: Position,
|
||||
name: String
|
||||
) extends Metadata
|
||||
|
||||
case class Triple(
|
||||
block: Position,
|
||||
x: Float,
|
||||
y: Float,
|
||||
z: Float
|
||||
) extends Metadata
|
||||
|
||||
case class Terminal(
|
||||
voxel: Position,
|
||||
name: String
|
||||
) extends Metadata
|
||||
|
||||
}
|
651
scodec/src/main/scala/tf/bug/fancadescodec/Obj.scala
Normal file
651
scodec/src/main/scala/tf/bug/fancadescodec/Obj.scala
Normal file
|
@ -0,0 +1,651 @@
|
|||
package tf.bug.fancadescodec
|
||||
|
||||
case class Obj(
|
||||
id: Int
|
||||
) extends AnyVal
|
||||
|
||||
object Obj {
|
||||
|
||||
final val empty = Obj(0)
|
||||
|
||||
final val bricks = Obj(2)
|
||||
final val grass = Obj(3)
|
||||
final val grassDotty = Obj(4)
|
||||
final val dirt = Obj(5)
|
||||
final val dirtDotty = Obj(493)
|
||||
final val dirtSlab = Obj(384)
|
||||
final val foliageSlab = Obj(499)
|
||||
final val foliageDotty = Obj(496)
|
||||
final val foliageTop = Obj(497)
|
||||
final val foliage = Obj(495)
|
||||
final val foliageBottom = Obj(498)
|
||||
final val stone = Obj(501)
|
||||
final val stoneDotty = Obj(502)
|
||||
final val stoneSlab = Obj(505)
|
||||
final val stoneTop = Obj(503)
|
||||
final val stoneBottom = Obj(504)
|
||||
final val stoneBlock = Obj(1)
|
||||
final val stonePillar = Obj(506)
|
||||
final val stoneHalf = Obj(507)
|
||||
final val slate = Obj(547)
|
||||
final val slateDotty = Obj(548)
|
||||
final val slateNE = Obj(549)
|
||||
final val slateNW = Obj(550)
|
||||
final val slateSE = Obj(551)
|
||||
final val slateSW = Obj(552)
|
||||
final val slateTop = Obj(553)
|
||||
final val slateBottom = Obj(554)
|
||||
final val woodLR = Obj(6)
|
||||
final val woodDU = Obj(8)
|
||||
final val woodNF = Obj(7)
|
||||
final val woodLowLR = Obj(508)
|
||||
final val woodLowNF = Obj(509)
|
||||
final val woodHighLR = Obj(510)
|
||||
final val woodHighNF = Obj(511)
|
||||
final val steel = Obj(385)
|
||||
final val box = Obj(388)
|
||||
final val sphere = Obj(546)
|
||||
final val physicsBox = Obj(425)
|
||||
final val physicsSphere = Obj(426)
|
||||
final val passThrough = Obj(448)
|
||||
final val scriptBlock = Obj(545)
|
||||
final val flowers = Obj(494)
|
||||
final val particle = Obj(555)
|
||||
final val marker = Obj(536)
|
||||
final val shrub = Obj(500)
|
||||
final val archLower = Obj(386)
|
||||
final val archHigher = Obj(387)
|
||||
final val stickLR = Obj(512)
|
||||
final val stickDU = Obj(513)
|
||||
final val stickNF = Obj(514)
|
||||
final val stickRF = Obj(515)
|
||||
final val stickLF = Obj(516)
|
||||
final val stickLN = Obj(517)
|
||||
final val stickRN = Obj(518)
|
||||
final val stickRU = Obj(519)
|
||||
final val stickUF = Obj(520)
|
||||
final val stickLU = Obj(521)
|
||||
final val stickUN = Obj(522)
|
||||
final val stickRD = Obj(523)
|
||||
final val stickDF = Obj(524)
|
||||
final val stickLD = Obj(525)
|
||||
final val stickDN = Obj(526)
|
||||
|
||||
final val win0 = Obj(252)
|
||||
final val win1 = Obj(253)
|
||||
final val win2 = Obj(254)
|
||||
final val win3 = Obj(255)
|
||||
|
||||
final val lose0 = Obj(256)
|
||||
final val lose1 = Obj(257)
|
||||
final val lose2 = Obj(258)
|
||||
final val lose3 = Obj(259)
|
||||
|
||||
final val setScore0 = Obj(260)
|
||||
final val setScore1 = Obj(261)
|
||||
final val setScore2 = Obj(262)
|
||||
final val setScore3 = Obj(263)
|
||||
|
||||
final val setCamera0 = Obj(268)
|
||||
final val setCamera1 = Obj(269)
|
||||
final val setCamera2 = Obj(270)
|
||||
final val setCamera3 = Obj(271)
|
||||
final val setCamera4 = Obj(272)
|
||||
final val setCamera5 = Obj(273)
|
||||
|
||||
final val setLight0 = Obj(274)
|
||||
final val setLight1 = Obj(275)
|
||||
final val setLight2 = Obj(276)
|
||||
final val setLight3 = Obj(277)
|
||||
|
||||
final val screenSize0 = Obj(220)
|
||||
final val screenSize1 = Obj(221)
|
||||
final val screenSize2 = Obj(222)
|
||||
final val screenSize3 = Obj(223)
|
||||
|
||||
final val accelerometer0 = Obj(224)
|
||||
final val accelerometer1 = Obj(225)
|
||||
final val accelerometer2 = Obj(226)
|
||||
final val accelerometer3 = Obj(227)
|
||||
|
||||
final val getPosition0 = Obj(278)
|
||||
final val getPosition1 = Obj(279)
|
||||
final val getPosition2 = Obj(280)
|
||||
final val getPosition3 = Obj(281)
|
||||
|
||||
final val setPosition0 = Obj(282)
|
||||
final val setPosition1 = Obj(283)
|
||||
final val setPosition2 = Obj(284)
|
||||
final val setPosition3 = Obj(285)
|
||||
final val setPosition4 = Obj(286)
|
||||
final val setPosition5 = Obj(287)
|
||||
|
||||
final val raycast0 = Obj(228)
|
||||
final val raycast1 = Obj(229)
|
||||
final val raycast2 = Obj(230)
|
||||
final val raycast3 = Obj(231)
|
||||
final val raycast4 = Obj(232)
|
||||
final val raycast5 = Obj(233)
|
||||
|
||||
final val getSize0 = Obj(489)
|
||||
final val getSize1 = Obj(490)
|
||||
final val getSize2 = Obj(491)
|
||||
final val getSize3 = Obj(492)
|
||||
|
||||
final val setVisible0 = Obj(306)
|
||||
final val setVisible1 = Obj(307)
|
||||
final val setVisible2 = Obj(308)
|
||||
final val setVisible3 = Obj(309)
|
||||
|
||||
final val createObject0 = Obj(316)
|
||||
final val createObject1 = Obj(317)
|
||||
final val createObject2 = Obj(318)
|
||||
final val createObject3 = Obj(319)
|
||||
|
||||
final val destroyObject0 = Obj(320)
|
||||
final val destroyObject1 = Obj(321)
|
||||
final val destroyObject2 = Obj(322)
|
||||
final val destroyObject3 = Obj(323)
|
||||
|
||||
final val playSound0 = Obj(264)
|
||||
final val playSound1 = Obj(265)
|
||||
final val playSound2 = Obj(266)
|
||||
final val playSound3 = Obj(267)
|
||||
|
||||
final val stopSound0 = Obj(397)
|
||||
final val stopSound1 = Obj(398)
|
||||
final val stopSound2 = Obj(399)
|
||||
final val stopSound3 = Obj(400)
|
||||
|
||||
final val volumePitch0 = Obj(391)
|
||||
final val volumePitch1 = Obj(392)
|
||||
final val volumePitch2 = Obj(393)
|
||||
final val volumePitch3 = Obj(394)
|
||||
final val volumePitch4 = Obj(395)
|
||||
final val volumePitch5 = Obj(396)
|
||||
|
||||
final val addForce0 = Obj(298)
|
||||
final val addForce1 = Obj(299)
|
||||
final val addForce2 = Obj(300)
|
||||
final val addForce3 = Obj(301)
|
||||
final val addForce4 = Obj(302)
|
||||
final val addForce5 = Obj(303)
|
||||
final val addForce6 = Obj(304)
|
||||
final val addForce7 = Obj(305)
|
||||
|
||||
final val getVelocity0 = Obj(288)
|
||||
final val getVelocity1 = Obj(289)
|
||||
final val getVelocity2 = Obj(290)
|
||||
final val getVelocity3 = Obj(291)
|
||||
|
||||
final val setVelocity0 = Obj(292)
|
||||
final val setVelocity1 = Obj(293)
|
||||
final val setVelocity2 = Obj(294)
|
||||
final val setVelocity3 = Obj(295)
|
||||
final val setVelocity4 = Obj(296)
|
||||
final val setVelocity5 = Obj(297)
|
||||
|
||||
final val setLocked0 = Obj(310)
|
||||
final val setLocked1 = Obj(311)
|
||||
final val setLocked2 = Obj(312)
|
||||
final val setLocked3 = Obj(313)
|
||||
final val setLocked4 = Obj(314)
|
||||
final val setLocked5 = Obj(315)
|
||||
|
||||
final val setMass0 = Obj(328)
|
||||
final val setMass1 = Obj(329)
|
||||
final val setMass2 = Obj(330)
|
||||
final val setMass3 = Obj(331)
|
||||
|
||||
final val setFriction0 = Obj(332)
|
||||
final val setFriction1 = Obj(333)
|
||||
final val setFriction2 = Obj(334)
|
||||
final val setFriction3 = Obj(335)
|
||||
|
||||
final val setBounciness0 = Obj(336)
|
||||
final val setBounciness1 = Obj(337)
|
||||
final val setBounciness2 = Obj(338)
|
||||
final val setBounciness3 = Obj(339)
|
||||
|
||||
final val setGravity0 = Obj(324)
|
||||
final val setGravity1 = Obj(325)
|
||||
final val setGravity2 = Obj(326)
|
||||
final val setGravity3 = Obj(327)
|
||||
|
||||
final val addConstraint0 = Obj(340)
|
||||
final val addConstraint1 = Obj(341)
|
||||
final val addConstraint2 = Obj(342)
|
||||
final val addConstraint3 = Obj(343)
|
||||
final val addConstraint4 = Obj(344)
|
||||
final val addConstraint5 = Obj(345)
|
||||
|
||||
final val linearLimits0 = Obj(346)
|
||||
final val linearLimits1 = Obj(347)
|
||||
final val linearLimits2 = Obj(348)
|
||||
final val linearLimits3 = Obj(349)
|
||||
final val linearLimits4 = Obj(350)
|
||||
final val linearLimits5 = Obj(351)
|
||||
|
||||
final val angularLimits0 = Obj(352)
|
||||
final val angularLimits1 = Obj(353)
|
||||
final val angularLimits2 = Obj(354)
|
||||
final val angularLimits3 = Obj(355)
|
||||
final val angularLimits4 = Obj(356)
|
||||
final val angularLimits5 = Obj(357)
|
||||
|
||||
final val linearSpring0 = Obj(358)
|
||||
final val linearSpring1 = Obj(359)
|
||||
final val linearSpring2 = Obj(360)
|
||||
final val linearSpring3 = Obj(361)
|
||||
final val linearSpring4 = Obj(362)
|
||||
final val linearSpring5 = Obj(363)
|
||||
|
||||
final val angularSpring0 = Obj(364)
|
||||
final val angularSpring1 = Obj(365)
|
||||
final val angularSpring2 = Obj(366)
|
||||
final val angularSpring3 = Obj(367)
|
||||
final val angularSpring4 = Obj(368)
|
||||
final val angularSpring5 = Obj(369)
|
||||
|
||||
final val linearMotor0 = Obj(370)
|
||||
final val linearMotor1 = Obj(371)
|
||||
final val linearMotor2 = Obj(372)
|
||||
final val linearMotor3 = Obj(373)
|
||||
final val linearMotor4 = Obj(374)
|
||||
final val linearMotor5 = Obj(375)
|
||||
|
||||
final val angularMotor0 = Obj(376)
|
||||
final val angularMotor1 = Obj(377)
|
||||
final val angularMotor2 = Obj(378)
|
||||
final val angularMotor3 = Obj(379)
|
||||
final val angularMotor4 = Obj(380)
|
||||
final val angularMotor5 = Obj(381)
|
||||
|
||||
final val if0 = Obj(234)
|
||||
final val if1 = Obj(235)
|
||||
final val if2 = Obj(236)
|
||||
final val if3 = Obj(237)
|
||||
|
||||
final val playSensor0 = Obj(238)
|
||||
final val playSensor1 = Obj(239)
|
||||
final val playSensor2 = Obj(240)
|
||||
final val playSensor3 = Obj(241)
|
||||
|
||||
final val boxArtSensor0 = Obj(409)
|
||||
final val boxArtSensor1 = Obj(410)
|
||||
final val boxArtSensor2 = Obj(411)
|
||||
final val boxArtSensor3 = Obj(412)
|
||||
|
||||
final val touchSensor0 = Obj(242)
|
||||
final val touchSensor1 = Obj(243)
|
||||
final val touchSensor2 = Obj(244)
|
||||
final val touchSensor3 = Obj(245)
|
||||
final val touchSensor4 = Obj(246)
|
||||
final val touchSensor5 = Obj(247)
|
||||
|
||||
final val swipeSensor0 = Obj(248)
|
||||
final val swipeSensor1 = Obj(249)
|
||||
final val swipeSensor2 = Obj(250)
|
||||
final val swipeSensor3 = Obj(251)
|
||||
|
||||
final val collision0 = Obj(401)
|
||||
final val collision1 = Obj(402)
|
||||
final val collision2 = Obj(403)
|
||||
final val collision3 = Obj(404)
|
||||
final val collision4 = Obj(405)
|
||||
final val collision5 = Obj(406)
|
||||
|
||||
final val negate0 = Obj(90)
|
||||
final val negate1 = Obj(91)
|
||||
|
||||
final val inverse0 = Obj(440)
|
||||
final val inverse1 = Obj(441)
|
||||
|
||||
final val addNumbers0 = Obj(92)
|
||||
final val addNumbers1 = Obj(93)
|
||||
final val addNumbers2 = Obj(94)
|
||||
final val addNumbers3 = Obj(95)
|
||||
|
||||
final val addVectors0 = Obj(96)
|
||||
final val addVectors1 = Obj(97)
|
||||
final val addVectors2 = Obj(98)
|
||||
final val addVectors3 = Obj(99)
|
||||
|
||||
final val subtractNumbers0 = Obj(100)
|
||||
final val subtractNumbers1 = Obj(101)
|
||||
final val subtractNumbers2 = Obj(102)
|
||||
final val subtractNumbers3 = Obj(103)
|
||||
|
||||
final val subtractVectors0 = Obj(104)
|
||||
final val subtractVectors1 = Obj(105)
|
||||
final val subrtactVectors2 = Obj(106)
|
||||
final val subtractVectors3 = Obj(107)
|
||||
|
||||
final val multiply0 = Obj(108)
|
||||
final val multiply1 = Obj(109)
|
||||
final val multiply2 = Obj(110)
|
||||
final val multiply3 = Obj(111)
|
||||
|
||||
final val scale0 = Obj(112)
|
||||
final val scale1 = Obj(113)
|
||||
final val scale2 = Obj(114)
|
||||
final val scale3 = Obj(115)
|
||||
|
||||
final val rotate0 = Obj(116)
|
||||
final val rotate1 = Obj(117)
|
||||
final val rotate2 = Obj(118)
|
||||
final val rotate3 = Obj(119)
|
||||
|
||||
final val combine0 = Obj(120)
|
||||
final val combine1 = Obj(121)
|
||||
final val combine2 = Obj(122)
|
||||
final val combine3 = Obj(123)
|
||||
|
||||
final val divide0 = Obj(124)
|
||||
final val divide1 = Obj(125)
|
||||
final val divide2 = Obj(126)
|
||||
final val divide3 = Obj(127)
|
||||
|
||||
final val power0 = Obj(457)
|
||||
final val power1 = Obj(458)
|
||||
final val power2 = Obj(459)
|
||||
final val power3 = Obj(460)
|
||||
|
||||
final val equalNumbers0 = Obj(132)
|
||||
final val equalNumbers1 = Obj(133)
|
||||
final val equalNumbers2 = Obj(134)
|
||||
final val equalNumbers3 = Obj(135)
|
||||
|
||||
final val equalVectors0 = Obj(136)
|
||||
final val equalVectors1 = Obj(137)
|
||||
final val equalVectors2 = Obj(138)
|
||||
final val equalVectors3 = Obj(139)
|
||||
|
||||
final val equalObjects0 = Obj(140)
|
||||
final val equalObjects1 = Obj(141)
|
||||
final val equalObjects2 = Obj(142)
|
||||
final val equalObjects3 = Obj(143)
|
||||
|
||||
final val equalTruths0 = Obj(421)
|
||||
final val equalTruths1 = Obj(422)
|
||||
final val equalTruths2 = Obj(423)
|
||||
final val equalTruths3 = Obj(424)
|
||||
|
||||
final val lessThan0 = Obj(128)
|
||||
final val lessThan1 = Obj(129)
|
||||
final val lessThan2 = Obj(130)
|
||||
final val lessThan3 = Obj(131)
|
||||
|
||||
final val greaterThan0 = Obj(481)
|
||||
final val greaterThan1 = Obj(482)
|
||||
final val greaterThan2 = Obj(483)
|
||||
final val greaterThan3 = Obj(484)
|
||||
|
||||
final val and0 = Obj(146)
|
||||
final val and1 = Obj(147)
|
||||
final val and2 = Obj(148)
|
||||
final val and3 = Obj(149)
|
||||
|
||||
final val or0 = Obj(417)
|
||||
final val or1 = Obj(418)
|
||||
final val or2 = Obj(419)
|
||||
final val or3 = Obj(420)
|
||||
|
||||
final val not0 = Obj(144)
|
||||
final val not1 = Obj(145)
|
||||
|
||||
final val random0 = Obj(168)
|
||||
final val random1 = Obj(169)
|
||||
final val random2 = Obj(170)
|
||||
final val random3 = Obj(171)
|
||||
|
||||
final val randomSeed0 = Obj(485)
|
||||
final val randomSeed1 = Obj(486)
|
||||
final val randomSeed2 = Obj(487)
|
||||
final val randomSeed3 = Obj(488)
|
||||
|
||||
final val min0 = Obj(176)
|
||||
final val min1 = Obj(177)
|
||||
final val min2 = Obj(178)
|
||||
final val min3 = Obj(179)
|
||||
|
||||
final val max0 = Obj(180)
|
||||
final val max1 = Obj(181)
|
||||
final val max2 = Obj(182)
|
||||
final val max3 = Obj(183)
|
||||
|
||||
final val sin0 = Obj(413)
|
||||
final val sin1 = Obj(414)
|
||||
|
||||
final val cos0 = Obj(453)
|
||||
final val cos1 = Obj(454)
|
||||
|
||||
final val round0 = Obj(184)
|
||||
final val round1 = Obj(185)
|
||||
|
||||
final val floor0 = Obj(186)
|
||||
final val floor1 = Obj(187)
|
||||
|
||||
final val ceiling0 = Obj(188)
|
||||
final val ceiling1 = Obj(189)
|
||||
|
||||
final val absolute0 = Obj(455)
|
||||
final val absolute1 = Obj(456)
|
||||
|
||||
final val modulo0 = Obj(172)
|
||||
final val modulo1 = Obj(173)
|
||||
final val modulo2 = Obj(174)
|
||||
final val modulo3 = Obj(175)
|
||||
|
||||
final val breakVector0 = Obj(156)
|
||||
final val breakVector1 = Obj(157)
|
||||
final val breakVector2 = Obj(158)
|
||||
final val breakVector3 = Obj(159)
|
||||
final val breakVector4 = Obj(160)
|
||||
final val breakVector5 = Obj(161)
|
||||
|
||||
final val makeVector0 = Obj(150)
|
||||
final val makeVector1 = Obj(151)
|
||||
final val makeVector2 = Obj(152)
|
||||
final val makeVector3 = Obj(153)
|
||||
final val makeVector4 = Obj(154)
|
||||
final val makeVector5 = Obj(155)
|
||||
|
||||
final val breakRotation0 = Obj(442)
|
||||
final val breakRotation1 = Obj(443)
|
||||
final val breakRotation2 = Obj(444)
|
||||
final val breakRotation3 = Obj(445)
|
||||
final val breakRotation4 = Obj(446)
|
||||
final val breakRotation5 = Obj(447)
|
||||
|
||||
final val makeRotation0 = Obj(162)
|
||||
final val makeRotation1 = Obj(163)
|
||||
final val makeRotation2 = Obj(164)
|
||||
final val makeRotation3 = Obj(165)
|
||||
final val makeRotation4 = Obj(166)
|
||||
final val makeRotation5 = Obj(167)
|
||||
|
||||
final val distance0 = Obj(190)
|
||||
final val distance1 = Obj(191)
|
||||
final val distance2 = Obj(192)
|
||||
final val distance3 = Obj(193)
|
||||
|
||||
final val lerp0 = Obj(194)
|
||||
final val lerp1 = Obj(195)
|
||||
final val lerp2 = Obj(196)
|
||||
final val lerp3 = Obj(197)
|
||||
final val lerp4 = Obj(198)
|
||||
final val lerp5 = Obj(199)
|
||||
|
||||
final val axisAngle0 = Obj(200)
|
||||
final val axisAngle1 = Obj(201)
|
||||
final val axisAngle2 = Obj(202)
|
||||
final val axisAngle3 = Obj(203)
|
||||
|
||||
final val screenToWorld0 = Obj(216)
|
||||
final val screenToWorld1 = Obj(217)
|
||||
final val screenToWorld2 = Obj(218)
|
||||
final val screenToWorld3 = Obj(219)
|
||||
|
||||
final val worldToScreen0 = Obj(477)
|
||||
final val worldToScreen1 = Obj(478)
|
||||
final val worldToScreen2 = Obj(479)
|
||||
final val worldToScreen3 = Obj(480)
|
||||
|
||||
final val lineVsPlane0 = Obj(208)
|
||||
final val lineVsPlane1 = Obj(209)
|
||||
final val lineVsPlane2 = Obj(210)
|
||||
final val lineVsPlane3 = Obj(211)
|
||||
final val lineVsPlane4 = Obj(212)
|
||||
final val lineVsPlane5 = Obj(213)
|
||||
final val lineVsPlane6 = Obj(214)
|
||||
final val lineVsPlane7 = Obj(215)
|
||||
|
||||
final val lookRotation0 = Obj(204)
|
||||
final val lookRotation1 = Obj(205)
|
||||
final val lookRotation2 = Obj(206)
|
||||
final val lookRotation3 = Obj(207)
|
||||
|
||||
final val number0 = Obj(36)
|
||||
final val number1 = Obj(37)
|
||||
|
||||
final val vector0 = Obj(38)
|
||||
final val vector1 = Obj(39)
|
||||
final val vector2 = Obj(40)
|
||||
final val vector3 = Obj(41)
|
||||
|
||||
final val rotation0 = Obj(42)
|
||||
final val rotation1 = Obj(43)
|
||||
final val rotation2 = Obj(44)
|
||||
final val rotation3 = Obj(45)
|
||||
|
||||
final val true0 = Obj(449)
|
||||
final val true1 = Obj(450)
|
||||
|
||||
final val false0 = Obj(451)
|
||||
final val false1 = Obj(452)
|
||||
|
||||
final val comment = Obj(15)
|
||||
|
||||
final val inspectNumber0 = Obj(16)
|
||||
final val inspectNumber1 = Obj(17)
|
||||
final val inspectNumber2 = Obj(18)
|
||||
final val inspectNumber3 = Obj(19)
|
||||
|
||||
final val inspectVector0 = Obj(20)
|
||||
final val inspectVector1 = Obj(21)
|
||||
final val inspectVector2 = Obj(22)
|
||||
final val inspectVector3 = Obj(23)
|
||||
|
||||
final val inspectRotation0 = Obj(24)
|
||||
final val inspectRotation1 = Obj(25)
|
||||
final val inspectRotation2 = Obj(26)
|
||||
final val inspectRotation3 = Obj(27)
|
||||
|
||||
final val inspectTruth0 = Obj(28)
|
||||
final val inspectTruth1 = Obj(29)
|
||||
final val inspectTruth2 = Obj(30)
|
||||
final val inspectTruth3 = Obj(31)
|
||||
|
||||
final val inspectObject0 = Obj(32)
|
||||
final val inspectObject1 = Obj(33)
|
||||
final val inspectObject2 = Obj(34)
|
||||
final val inspectObject3 = Obj(35)
|
||||
|
||||
final val getNumber0 = Obj(46)
|
||||
final val getNumber1 = Obj(47)
|
||||
|
||||
final val getObject0 = Obj(54)
|
||||
final val getObject1 = Obj(55)
|
||||
|
||||
final val getVector0 = Obj(48)
|
||||
final val getVector1 = Obj(49)
|
||||
|
||||
final val getRotation0 = Obj(50)
|
||||
final val getRotation1 = Obj(51)
|
||||
|
||||
final val getTruth0 = Obj(52)
|
||||
final val getTruth1 = Obj(53)
|
||||
|
||||
final val getConstraint0 = Obj(56)
|
||||
final val getConstraint1 = Obj(57)
|
||||
|
||||
final val setNumber0 = Obj(428)
|
||||
final val setNumber1 = Obj(429)
|
||||
|
||||
final val setObject0 = Obj(436)
|
||||
final val setObject1 = Obj(437)
|
||||
|
||||
final val setVector0 = Obj(430)
|
||||
final val setVector1 = Obj(431)
|
||||
|
||||
final val setRotation0 = Obj(432)
|
||||
final val setRotation1 = Obj(433)
|
||||
|
||||
final val setTruth0 = Obj(434)
|
||||
final val setTruth1 = Obj(435)
|
||||
|
||||
final val setConstraint0 = Obj(438)
|
||||
final val setConstraint1 = Obj(439)
|
||||
|
||||
final val setNumberReference0 = Obj(58)
|
||||
final val setNumberReference1 = Obj(59)
|
||||
final val setNumberReference2 = Obj(60)
|
||||
final val setNumberReference3 = Obj(61)
|
||||
|
||||
final val setObjectReference0 = Obj(74)
|
||||
final val setObjectReference1 = Obj(75)
|
||||
final val setObjectReference2 = Obj(76)
|
||||
final val setObjectReference3 = Obj(77)
|
||||
|
||||
final val setVectorReference0 = Obj(62)
|
||||
final val setVectorReference1 = Obj(63)
|
||||
final val setVectorReference2 = Obj(64)
|
||||
final val setVectorReference3 = Obj(65)
|
||||
|
||||
final val setRotationReference0 = Obj(66)
|
||||
final val setRotationReference1 = Obj(67)
|
||||
final val setRotationReference2 = Obj(68)
|
||||
final val setRotationReference3 = Obj(69)
|
||||
|
||||
final val setTruthReference0 = Obj(70)
|
||||
final val setTruthReference1 = Obj(71)
|
||||
final val setTruthReference2 = Obj(72)
|
||||
final val setTruthReference3 = Obj(73)
|
||||
|
||||
final val setConstraintReference0 = Obj(78)
|
||||
final val setConstraintReference1 = Obj(79)
|
||||
final val setConstraintReference2 = Obj(80)
|
||||
final val setConstraintReference3 = Obj(81)
|
||||
|
||||
final val listNumber0 = Obj(82)
|
||||
final val listNumber1 = Obj(83)
|
||||
final val listNumber2 = Obj(84)
|
||||
final val listNumber3 = Obj(85)
|
||||
|
||||
final val listObject0 = Obj(86)
|
||||
final val listObject1 = Obj(87)
|
||||
final val listObject2 = Obj(88)
|
||||
final val listObject3 = Obj(89)
|
||||
|
||||
final val listVector0 = Obj(461)
|
||||
final val listVector1 = Obj(462)
|
||||
final val listVector2 = Obj(463)
|
||||
final val listVector3 = Obj(464)
|
||||
|
||||
final val listRotation0 = Obj(465)
|
||||
final val listRotation1 = Obj(466)
|
||||
final val listRotation2 = Obj(467)
|
||||
final val listRotation3 = Obj(468)
|
||||
|
||||
final val listTruth0 = Obj(469)
|
||||
final val listTruth1 = Obj(470)
|
||||
final val listTruth2 = Obj(471)
|
||||
final val listTruth3 = Obj(472)
|
||||
|
||||
final val listConstraint0 = Obj(473)
|
||||
final val listConstraint1 = Obj(474)
|
||||
final val listConstraint2 = Obj(475)
|
||||
final val listConstraint3 = Obj(476)
|
||||
|
||||
}
|
8
scodec/src/main/scala/tf/bug/fancadescodec/Wire.scala
Normal file
8
scodec/src/main/scala/tf/bug/fancadescodec/Wire.scala
Normal file
|
@ -0,0 +1,8 @@
|
|||
package tf.bug.fancadescodec
|
||||
|
||||
case class Wire(
|
||||
startNearLeftBottom: Position,
|
||||
endNearLeftBottom: Position,
|
||||
startVoxel: Position,
|
||||
endVoxel: Position
|
||||
)
|
6
scodec/src/main/scala/tf/bug/fancadescodec/World.scala
Normal file
6
scodec/src/main/scala/tf/bug/fancadescodec/World.scala
Normal file
|
@ -0,0 +1,6 @@
|
|||
package tf.bug.fancadescodec
|
||||
|
||||
case class World(
|
||||
boundary: Boundary,
|
||||
objs: Vector[Obj]
|
||||
)
|
Loading…
Reference in a new issue