Skip to content

Commit

Permalink
Update README, publish 0.17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
LPGhatguy committed Oct 8, 2024
1 parent 343c9d3 commit 19f9f35
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 57 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "crevice"
description = "Create GLSL-compatible versions of structs with explicitly-initialized padding"
version = "0.16.0"
rust-version = "1.58.0"
version = "0.17.0"
rust-version = "1.74.0"
edition = "2021"
authors = ["Lucien Greathouse <me@lpghatguy.com>"]
documentation = "https://docs.rs/crevice"
Expand Down
57 changes: 4 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ other math libraries by use of the mint crate. Crevice currently supports:

* mint 0.5, enabled by default
* cgmath 0.18, using the `cgmath` feature
* nalgebra 0.31, using the `nalgebra` feature
* glam 0.23, using the `glam` feature
* nalgebra 0.33, using the `nalgebra` feature
* glam 0.29, using the `glam` feature

PRs are welcome to add or update math libraries to Crevice.

Expand Down Expand Up @@ -92,57 +92,6 @@ buffer POINT_LIGHTS {
} point_lights;
```

```rust
use crevice::std140::{self, AsStd140};

#[derive(AsStd140)]
struct PointLight {
position: mint::Point3<f32>,
color: mint::Vector3<f32>,
brightness: f32,
}

let lights = vec![
PointLight {
position: [0.0, 1.0, 0.0].into(),
color: [1.0, 0.0, 0.0].into(),
brightness: 0.6,
},
PointLight {
position: [0.0, 4.0, 3.0].into(),
color: [1.0, 1.0, 1.0].into(),
brightness: 1.0,
},
];

let target_buffer = map_gpu_buffer_for_write();
let mut writer = std140::Writer::new(target_buffer);

let light_count = lights.len() as u32;
writer.write(&light_count)?;

// Crevice will automatically insert the required padding to align the
// PointLight structure correctly. In this case, there will be 12 bytes of
// padding between the length field and the light list.

writer.write(lights.as_slice())?;

unmap_gpu_buffer();

```

### Features

* `std` (default): Enables [`std::io::Write`]-based structs.
* `cgmath`: Enables support for types from cgmath.
* `nalgebra`: Enables support for types from nalgebra.
* `glam`: Enables support for types from glam.

### Minimum Supported Rust Version (MSRV)

Crevice supports Rust 1.74.0 and newer.

[glsl-layout]: https://github.com/rustgd/glsl-layout

[std140::AsStd140]: https://docs.rs/crevice/latest/crevice/std140/trait.AsStd140.html
[std140::AsStd140::as_std140]: https://docs.rs/crevice/latest/crevice/std140/trait.AsStd140.html#method.as_std140
Expand All @@ -154,6 +103,8 @@ Crevice supports Rust 1.74.0 and newer.
[`bytemuck::Pod`]: https://docs.rs/bytemuck/latest/bytemuck/trait.Pod.html
[`bytemuck::Zeroable`]: https://docs.rs/bytemuck/latest/bytemuck/trait.Zeroable.html

[glsl-layout]: https://docs.rs/glsl-layout/latest/glsl_layout/

## License

Licensed under either of
Expand Down
2 changes: 2 additions & 0 deletions README.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
[`bytemuck::Pod`]: https://docs.rs/bytemuck/latest/bytemuck/trait.Pod.html
[`bytemuck::Zeroable`]: https://docs.rs/bytemuck/latest/bytemuck/trait.Zeroable.html

[glsl-layout]: https://docs.rs/glsl-layout/latest/glsl_layout/

## License

Licensed under either of
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ other math libraries by use of the mint crate. Crevice currently supports:
* mint 0.5, enabled by default
* cgmath 0.18, using the `cgmath` feature
* nalgebra 0.31, using the `nalgebra` feature
* glam 0.23, using the `glam` feature
* nalgebra 0.33, using the `nalgebra` feature
* glam 0.29, using the `glam` feature
PRs are welcome to add or update math libraries to Crevice.
Expand Down

0 comments on commit 19f9f35

Please sign in to comment.