mirror of
https://codeberg.org/icewind/tf-asset-loader.git
synced 2026-06-03 08:34:21 +02:00
readme update
This commit is contained in:
parent
26a8b2c534
commit
b758e2ea13
2 changed files with 24 additions and 1 deletions
23
README.md
23
README.md
|
|
@ -9,3 +9,26 @@ directory.
|
||||||
|
|
||||||
Supports loading both plain file data, data embedded in `vpk` files and data
|
Supports loading both plain file data, data embedded in `vpk` files and data
|
||||||
embedded in `bsp` maps.
|
embedded in `bsp` maps.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```rust
|
||||||
|
use tf_asset_loader::{Loader, LoaderError};
|
||||||
|
|
||||||
|
fn main() -> Result<(), LoaderError> {
|
||||||
|
let loader = Loader::new()?;
|
||||||
|
if let Some(model) = loader.load("models/props_gameplay/resupply_locker.mdl")? {
|
||||||
|
println!("resupply_locker.mdl is {} bytes large", model.len());
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Additional sources
|
||||||
|
|
||||||
|
You can customize the sources the loader looks for files by using
|
||||||
|
[ `Loader::add_source`](https://docs.rs/tf-asset-loader/latest/tf_asset_loader/struct.Loader.html#method.add_source).
|
||||||
|
This supports folders on the filesystem,
|
||||||
|
[vpk archives](https://crates.io/crates/vpk) or
|
||||||
|
[Pack files](https://docs.rs/vbsp/latest/vbsp/data/struct.Packfile.html) from
|
||||||
|
[bsp files](https://crates.io/crates/vbsp)
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ impl Loader {
|
||||||
|
|
||||||
/// Add a new source to the loader.
|
/// Add a new source to the loader.
|
||||||
///
|
///
|
||||||
/// This is intended to be used to add data from bsp files
|
/// This is mainly intended to be used to add data from bsp files, but can also be used to load from additional paths or vpks.
|
||||||
pub fn add_source<S: AssetSource + Send + Sync + 'static>(&mut self, source: S) {
|
pub fn add_source<S: AssetSource + Send + Sync + 'static>(&mut self, source: S) {
|
||||||
self.sources.push(Arc::new(source))
|
self.sources.push(Arc::new(source))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue