All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.ru.casperix.atlas.Atlas.kt Maven / Gradle / Ivy

The newest version!
package ru.casperix.atlas

import ru.casperix.math.axis_aligned.int32.Box2i
import ru.casperix.math.axis_aligned.int32.Dimension2i
import ru.casperix.math.vector.int32.Vector2i
import ru.casperix.renderer.pixel_map.PixelMap

class Atlas(
    val pages: List
)

class Page(
    val pixelMap: PixelMap,
    val info: PageProperties,
    val regions: List,
)

class PageProperties(
    val name: String,
    val size: Dimension2i,
    val format: String,
    val minFilter: String,
    val magFilter: String,
    val repeat: String,
    val pma: Boolean,
)

enum class OrthogonalRotate(val degree: Int) {
    ZERO(0),
    ONE(90),
    TWO(180),
    THREE(270),
}

class RegionAttributes(
    val name: String,
    val index: Int,
    val bounds: Box2i,
    val offsets: List,
    val rotate: OrthogonalRotate,
    val split: List,
    val pad: List,
) {
    val inAtlasBounds
        get() = if (rotate == OrthogonalRotate.ZERO || rotate == OrthogonalRotate.TWO) {
            bounds
        } else {
            Box2i.byDimension(bounds.min, Vector2i(bounds.dimension.y, bounds.dimension.x))
        }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy