| 106 | |
| 107 | |
| 108 | @JvmStatic |
| 109 | // because of the way that this rewrites the unit of a, potentially already loaded, texture list this isn't very useful outside of the context of Trace |
| 110 | fun fromFile(unit: Int, fn: String): TextureArray? { |
| 111 | |
| 112 | val uu = dirCache.computeIfAbsent(fn) { |
| 113 | val jj = mutableListOf(File(fn)) |
| 114 | |
| 115 | jj.sort() |
| 116 | |
| 117 | val dim = SlowJPEG().dimensions(jj[0].absolutePath) |
| 118 | |
| 119 | val dat = ByteBuffer.allocateDirect(dim[0] * dim[1] * 3 * jj.size) |
| 120 | |
| 121 | jj.forEachIndexed { i, n -> |
| 122 | dat.position(i * dim[0] * dim[1] * 3) |
| 123 | dat.limit((i + 1) * dim[0] * dim[1] * 3) |
| 124 | SlowJPEG().decompressRaw(n.absolutePath, dat, dim[0], dim[1]) |
| 125 | dat.clear() |
| 126 | |
| 127 | } |
| 128 | dat.clear() |
| 129 | |
| 130 | TextureArray(unit, dim[0], dim[1], jj.size, dat) |
| 131 | } |
| 132 | uu?.unit = unit |
| 133 | return uu |
| 134 | } |
| 135 | |
| 136 | } |
| 137 | } |
nothing calls this directly
no test coverage detected