[orx-dnk3, orx-runway] Use new loadImage interface
This commit is contained in:
@@ -9,6 +9,7 @@ import org.openrndr.math.Matrix44
|
|||||||
import org.openrndr.math.Quaternion
|
import org.openrndr.math.Quaternion
|
||||||
import org.openrndr.math.Vector3
|
import org.openrndr.math.Vector3
|
||||||
import org.openrndr.math.transforms.transform
|
import org.openrndr.math.transforms.transform
|
||||||
|
import org.openrndr.utils.buffer.MPPBuffer
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.nio.Buffer
|
import java.nio.Buffer
|
||||||
import java.nio.ByteOrder
|
import java.nio.ByteOrder
|
||||||
@@ -92,7 +93,8 @@ fun GltfFile.buildSceneNodes(): GltfSceneData {
|
|||||||
require(localBufferView.byteLength != null)
|
require(localBufferView.byteLength != null)
|
||||||
localBuffer.position(localBufferView.byteOffset)
|
localBuffer.position(localBufferView.byteOffset)
|
||||||
localBuffer.limit(localBufferView.byteOffset + localBufferView.byteLength)
|
localBuffer.limit(localBufferView.byteOffset + localBufferView.byteLength)
|
||||||
val cb = ColorBuffer.fromBuffer(localBuffer, null)
|
|
||||||
|
val cb = loadImage(MPPBuffer(localBuffer))
|
||||||
cb.generateMipmaps()
|
cb.generateMipmaps()
|
||||||
cb.filter(MinifyingFilter.LINEAR_MIPMAP_LINEAR, MagnifyingFilter.LINEAR)
|
cb.filter(MinifyingFilter.LINEAR_MIPMAP_LINEAR, MagnifyingFilter.LINEAR)
|
||||||
cb.anisotropy = 100.0
|
cb.anisotropy = 100.0
|
||||||
|
|||||||
@@ -22,18 +22,7 @@ fun ColorBuffer.toData(format: ImageFileFormat = ImageFileFormat.JPG): String {
|
|||||||
return "data:image/jpeg;base64,$base64Data"
|
return "data:image/jpeg;base64,$base64Data"
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Construct a color buffer from a base64 data string
|
|
||||||
*/
|
|
||||||
fun ColorBuffer.Companion.fromData(data: String): ColorBuffer {
|
|
||||||
val decoder = Base64.getDecoder()
|
|
||||||
val commaIndex = data.indexOf(",")
|
|
||||||
val imageData = decoder.decode(data.drop(commaIndex + 1))
|
|
||||||
|
|
||||||
ByteArrayInputStream(imageData).use {
|
|
||||||
return ColorBuffer.fromStream(it)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform a Runway query
|
* Perform a Runway query
|
||||||
|
|||||||
Reference in New Issue
Block a user