forge-svf-utils
Version:
Utilities for working with Autodesk Forge SVF file format.
190 lines • 4.67 kB
TypeScript
/// <reference types="node" />
export declare enum AssetType {
Image = "Autodesk.CloudPlatform.Image",
PropertyViewables = "Autodesk.CloudPlatform.PropertyViewables",
PropertyOffsets = "Autodesk.CloudPlatform.PropertyOffsets",
PropertyAttributes = "Autodesk.CloudPlatform.PropertyAttributes",
PropertyValues = "Autodesk.CloudPlatform.PropertyValues",
PropertyIDs = "Autodesk.CloudPlatform.PropertyIDs",
PropertyAVs = "Autodesk.CloudPlatform.PropertyAVs",
PropertyRCVs = "Autodesk.CloudPlatform.PropertyRCVs",
ProteinMaterials = "ProteinMaterials",
PackFile = "Autodesk.CloudPlatform.PackFile",
FragmentList = "Autodesk.CloudPlatform.FragmentList",
GeometryMetadataList = "Autodesk.CloudPlatform.GeometryMetadataList",
InstanceTree = "Autodesk.CloudPlatform.InstanceTree"
}
/**
* Parsed content of an actual *.svf file.
*/
export interface ISvfRoot {
manifest: ISvfManifest;
metadata: ISvfMetadata;
embedded: {
[key: string]: Buffer;
};
}
/**
* Top-level manifest containing URIs and types of all assets
* referenced by or embedded in a specific SVF file.
* The URIs are typically relative to the SVF file itself.
*/
export interface ISvfManifest {
name: string;
manifestversion: number;
toolkitversion: string;
assets: ISvfManifestAsset[];
typesets: ISvfManifestTypeSet[];
}
/**
* Description of a specific asset referenced by or embedded in an SVF,
* including the URI, compressed and uncompressed size, type of the asset itself,
* and types of all entities inside the asset.
*/
export interface ISvfManifestAsset {
id: string;
type: AssetType;
typeset?: string;
URI: string;
size: number;
usize: number;
}
/**
* Collection of type definitions.
*/
export interface ISvfManifestTypeSet {
id: string;
types: ISvfManifestType[];
}
/**
* Single type definition.
*/
export interface ISvfManifestType {
class: string;
type: string;
version: number;
}
/**
* Additional metadata for SVF such as the definition of "up" vector,
* default background, etc.
*/
export interface ISvfMetadata {
version: string;
metadata: {
[key: string]: any;
};
}
/**
* Fragment represents a single scene object,
* linking together material, geometry, and database IDs,
* and providing world transform and bounding box on top of that.
*/
export interface IFragment {
visible: boolean;
materialID: number;
geometryID: number;
dbID: number;
transform: Transform | null;
bbox: number[];
}
/**
* Lightweight data structure pointing to a mesh in a specific packfile and entry.
* Contains additional information about the type of mesh and its primitive count.
*/
export interface IGeometryMetadata {
fragType: number;
primCount: number;
packID: number;
entityID: number;
topoID?: number;
}
export interface IMaterial {
diffuse?: number[];
specular?: number[];
ambient?: number[];
emissive?: number[];
glossiness?: number;
reflectivity?: number;
opacity?: number;
metal?: boolean;
maps?: {
diffuse?: IMaterialMap;
specular?: IMaterialMap;
normal?: IMaterialMap;
bump?: IMaterialMap;
alpha?: IMaterialMap;
};
}
export interface IMaterialMap {
uri: string;
}
/**
* Triangular mesh data, including indices, vertices, optional normals and UVs.
*/
export interface IMesh {
vcount: number;
tcount: number;
uvcount: number;
attrs: number;
flags: number;
comment: string;
uvmaps: IUVMap[];
indices: Uint16Array;
vertices: Float32Array;
normals?: Float32Array;
min: IVector3;
max: IVector3;
}
/**
* Line segment data.
*/
export interface ILines {
isLines: true;
vcount: number;
lcount: number;
vertices: Float32Array;
indices: Uint16Array;
colors?: Float32Array;
lineWidth: number;
}
/**
* Point cloud data.
*/
export interface IPoints {
isPoints: true;
vcount: number;
vertices: Float32Array;
colors?: Float32Array;
pointSize: number;
}
/**
* Single UV channel. {@link IMesh} can have more of these.
*/
export interface IUVMap {
name: string;
file: string;
uvs: Float32Array;
}
export interface IVector3 {
x: number;
y: number;
z: number;
}
export interface IQuaternion {
x: number;
y: number;
z: number;
w: number;
}
export declare type Matrix3x3 = number[];
export declare type Transform = {
t: IVector3;
} | {
t: IVector3;
s: IVector3;
q: IQuaternion;
} | {
matrix: Matrix3x3;
t: IVector3;
};
//# sourceMappingURL=schema.d.ts.map