Documentation / @sw-file-lib/three
@sw-file-lib/three
TypeScript libraries for reading, writing Stormworks files.
This package includes three.js helpers including coordinate conversion, mesh creation, and materials. For other packages, see GitHub Repository.
Documentation
Three.js integration utilities, including mesh conversion and imitation of Stormworks materials and lights.
Useful for tools that show 3D previews of components/vehicles.
Classes
| Class | Description |
|---|---|
| UniformController | Manages shader uniforms for a material. |
| VehicleBodyAssembler | Assembles a single Stormworks vehicle body into Three.js objects. |
Interfaces
| Interface | Description |
|---|---|
| AdditiveUniforms | Uniforms used by the additive material. |
| CreateSwLightsOptions | Options used when creating the default Stormworks-style lights. |
| CreateSwMaterialsOptions | Options used when creating the default Stormworks material set. |
| CreateSwMeshOptions | Options used when creating a render mesh object from parsed mesh data. |
| CreateSwPhysMeshOptions | Options used when creating a physics mesh group from parsed phys data. |
| GlassUniforms | Uniforms used by the glass material. |
| OpaqueUniforms | Uniforms used by the opaque material. |
| SwMaterialSet | Materials and their uniform stores used by Stormworks object creation helpers. |
| SwUniformControllers | Mutable Three.js uniform stores owned by a Stormworks material set. |
| VehicleAssetResolver | Asset resolver used by VehicleBodyAssembler. |
| VehicleBodyBuildOptions | Options for VehicleBodyAssembler.build. |
Type Aliases
| Type Alias | Description |
|---|---|
| AdditiveUniformController | Manages shader uniforms for the additive material. |
| ComponentDefinitionResolver | Resolves a component definition from its component ID. |
| GlassUniformController | Manages shader uniforms for the glass material. |
| MeshAttributeName | The type for the mesh reference attributes in the component definition XML. |
| MeshResolver | Resolves a Three.js geometry from a Stormworks mesh path. |
| OpaqueUniformController | Manages shader uniforms for the opaque material. |
| SwMaterialKind | Material families for Stormworks mesh. |
Variables
| Variable | Description |
|---|---|
| MESH_ATTRIBUTE_NAMES | The names of the mesh reference attributes in the component definition XML. |
Functions
| Function | Description |
|---|---|
| applyBuilderOnBufferGeometry | Transfers the contents of a GeometryBuilder into a THREE.BufferGeometry. |
| bufferGeometryFromBuilder | Creates a new THREE.BufferGeometry from a GeometryBuilder. |
| createAdditiveMaterial | Create an additive material used for materialIndex 2 groups. |
| createAdditiveUniforms | Create the default uniforms used for additive materials. |
| createGlassMaterial | Create the default glass material used for materialIndex 1 groups. |
| createGlassUniforms | Create the default uniforms used for glass materials. |
| createOpaqueMaterial | Create the default opaque material used for materialIndex 0 groups. |
| createOpaqueUniforms | Create the default uniforms used for opaque materials. |
| createSwLightGroup | Create a group containing the default Stormworks-style lights. |
| createSwLights | Create the default Stormworks-style light objects. |
| createSwMaterials | Create the default materials used by Stormworks object helpers. |
| createSwMesh | Create a renderable Three.js mesh from parsed Stormworks mesh data. |
| createSwMeshGeometry | Create buffer geometry for parsed Stormworks render mesh data. |
| createSwPhysGroupGeometry | Create buffer geometry for parsed Stormworks phys group. |
| createSwPhysMeshGroup | Create a Three.js group from parsed Stormworks phys data. |
| createVehicleAssetResolver | Creates a VehicleAssetResolver from raw asset providers. |
| withCache | Wraps an asynchronous resolver with memoization. |