Add image asset type and summary formatting
This commit is contained in:
@@ -329,6 +329,10 @@ function isModelAsset(asset: ProjectAssetRecord): asset is ModelAssetRecord {
|
|||||||
return asset.kind === "model";
|
return asset.kind === "model";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isImageAsset(asset: ProjectAssetRecord): asset is ImageAssetRecord {
|
||||||
|
return asset.kind === "image";
|
||||||
|
}
|
||||||
|
|
||||||
function formatByteLength(byteLength: number): string {
|
function formatByteLength(byteLength: number): string {
|
||||||
if (byteLength < 1024) {
|
if (byteLength < 1024) {
|
||||||
return `${byteLength} B`;
|
return `${byteLength} B`;
|
||||||
@@ -369,6 +373,16 @@ function formatModelAssetSummary(asset: ModelAssetRecord): string {
|
|||||||
return details.join(" | ");
|
return details.join(" | ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatImageAssetSummary(asset: ImageAssetRecord): string {
|
||||||
|
const details = [
|
||||||
|
`${asset.metadata.width} x ${asset.metadata.height}`,
|
||||||
|
asset.metadata.hasAlpha ? "alpha" : "opaque",
|
||||||
|
formatByteLength(asset.byteLength)
|
||||||
|
];
|
||||||
|
|
||||||
|
return details.join(" | ");
|
||||||
|
}
|
||||||
|
|
||||||
function createModelInstancePlacementPosition(asset: ModelAssetRecord, anchor: Vec3 | null): Vec3 {
|
function createModelInstancePlacementPosition(asset: ModelAssetRecord, anchor: Vec3 | null): Vec3 {
|
||||||
const boundingBox = asset.metadata.boundingBox;
|
const boundingBox = asset.metadata.boundingBox;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user