Skip to content

Commit 46a098e

Browse files
committed
Updated and Refactorized the Library.
1 parent 11a8af6 commit 46a098e

File tree

24 files changed

+170
-682
lines changed

24 files changed

+170
-682
lines changed

Diff for: Cargo.toml

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
[package]
2-
name = "bgfx"
3-
version = "0.1.0"
4-
authors = ["Johan Sköld <[email protected]>"]
2+
name = "bgfx-rs"
3+
version = "0.2.0"
4+
authors = ["Johan Sköld <[email protected]>", "John Benard <[email protected]>"]
55

66
[dependencies]
7-
bitflags = "0.3.2"
8-
libc = "0.2.4"
7+
bitflags = "1.2.1"
8+
libc = "0.2.70"
99

1010
[dependencies.bgfx-sys]
1111
path = "bgfx-sys/"
1212

1313
[dev-dependencies]
14-
cgmath = "0.7.0"
15-
glutin = "0.7.1"
16-
time = "0.1.33"
14+
cgmath = "0.17.0"
15+
glutin = "0.24.0"
16+
time = "0.2.16"

Diff for: README.md

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
bgfx-rs [![travis-ci status](https://travis-ci.org/rhoot/bgfx-rs.svg?branch=master)](https://travis-ci.org/rhoot/bgfx-rs) [![appveyor status](https://ci.appveyor.com/api/projects/status/github/rhoot/bgfx-rs?branch=master&svg=true)](https://ci.appveyor.com/project/rhoot/bgfx-rs/branch/master)
1+
bgfx-rs
22
=======
33

4+
## Reimplemented and Updated from the [bgfx-rs](https://github.com/rhoot/bgfx-rs) repository.
5+
6+
**This repository is in heavy development, the library is currently unstable!**
7+
48
Rust wrapper around [bgfx], providing a clean, safe API for rust applications.
59

610
*Please read the [crate documentation][docs] for build requirements and crate
711
limitations before using.*
812

9-
**Note:** I was originally using this crate as a way of learning Rust. Since I
10-
personally stopped using Rust again however, this crate has ended up more or
11-
less unmaintained. There are a couple of forks that have some more work put
12-
into it already, but if someone wants to take over the project for real,
13-
please let me know so I can direct users to your fork instead.
14-
1513
Documentation
1614
-------------
1715

Diff for: bgfx-sys/bgfx

Submodule bgfx updated 4517 files

Diff for: bgfx-sys/bimg

Submodule bimg updated 187 files

Diff for: bgfx-sys/build.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,20 @@ fn main() {
2828
/// Builds the bgfx binaries for `msvc` targets.
2929
fn build_msvc(bitness: u32) {
3030
let vs_version = env::var("VisualStudioVersion").expect("Visual Studio version not detected");
31-
let platform = if bitness == 32 { "X86" } else { "X64" };
31+
let windows_sdk_version = env::var("WindowsSDKVersion").expect("Windows SDK version not detected");
32+
let platform = if bitness == 32 { "Win32" } else { "X64" };
3233

3334
let vs_release = match vs_version.as_ref() {
3435
"12.0" => "2013",
3536
"14.0" => "2015",
3637
"15.0" => "2017",
38+
"16.0" => "2019",
3739
_ => panic!(format!("Unknown Visual Studio version: {:?}", vs_version)),
3840
};
3941

4042
Command::new("bx/tools/bin/windows/genie.exe")
4143
.current_dir("bgfx")
44+
.arg(format!("--with-windows={}", windows_sdk_version))
4245
.arg("--with-dynamic-runtime")
4346
.arg(format!("vs{}", vs_release))
4447
.output()

Diff for: bgfx-sys/bx

Submodule bx updated 161 files

Diff for: bgfx-sys/src/lib.rs

+12-20
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,19 @@ pub const BGFX_CLEAR_DISCARD_DEPTH: u16 = 0x0800;
4242
pub const BGFX_CLEAR_DISCARD_STENCIL: u16 = 0x1000;
4343

4444
pub const BGFX_CLEAR_DISCARD_COLOR_MASK: u16 =
45-
(
4645
BGFX_CLEAR_DISCARD_COLOR_0 |
4746
BGFX_CLEAR_DISCARD_COLOR_1 |
4847
BGFX_CLEAR_DISCARD_COLOR_2 |
4948
BGFX_CLEAR_DISCARD_COLOR_3 |
5049
BGFX_CLEAR_DISCARD_COLOR_4 |
5150
BGFX_CLEAR_DISCARD_COLOR_5 |
5251
BGFX_CLEAR_DISCARD_COLOR_6 |
53-
BGFX_CLEAR_DISCARD_COLOR_7
54-
);
52+
BGFX_CLEAR_DISCARD_COLOR_7;
5553

5654
pub const BGFX_CLEAR_DISCARD_MASK: u16 =
57-
(
5855
BGFX_CLEAR_DISCARD_COLOR_MASK |
5956
BGFX_CLEAR_DISCARD_DEPTH |
60-
BGFX_CLEAR_DISCARD_STENCIL
61-
);
57+
BGFX_CLEAR_DISCARD_STENCIL;
6258

6359
// Debug flags
6460

@@ -113,10 +109,8 @@ pub const BGFX_BUFFER_ALLOW_RESIZE: u16 = 0x0800;
113109
pub const BGFX_BUFFER_INDEX32: u16 = 0x1000;
114110

115111
pub const BGFX_BUFFER_COMPUTE_READ_WRITE: u16 =
116-
(
117112
BGFX_BUFFER_COMPUTE_READ |
118-
BGFX_BUFFER_COMPUTE_WRITE
119-
);
113+
BGFX_BUFFER_COMPUTE_WRITE;
120114

121115
// State flags
122116

@@ -169,14 +163,12 @@ pub const BGFX_STATE_NONE: u64 = 0x0000000000000000_u64;
169163
pub const BGFX_STATE_MASK: u64 = 0xffffffffffffffff_u64;
170164

171165
pub const BGFX_STATE_DEFAULT: u64 =
172-
(
173166
BGFX_STATE_RGB_WRITE |
174167
BGFX_STATE_ALPHA_WRITE |
175168
BGFX_STATE_DEPTH_TEST_LESS |
176169
BGFX_STATE_DEPTH_WRITE |
177170
BGFX_STATE_CULL_CW |
178-
BGFX_STATE_MSAA
179-
);
171+
BGFX_STATE_MSAA;
180172

181173
#[macro_export]
182174
macro_rules! BGFX_STATE_ALPHA_REF {
@@ -210,14 +202,14 @@ macro_rules! BGFX_STATE_BLEND_EQUATION {
210202
($equation:expr) => (BGFX_STATE_BLEND_EQUATION_SEPARATE!($equation, $equation))
211203
}
212204

213-
pub const BGFX_STATE_BLEND_ADD: u64 = (BGFX_STATE_BLEND_FUNC!(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_ONE ) );
214-
pub const BGFX_STATE_BLEND_ALPHA: u64 = (BGFX_STATE_BLEND_FUNC!(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA) );
215-
pub const BGFX_STATE_BLEND_DARKEN: u64 = (BGFX_STATE_BLEND_FUNC!(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_ONE ) | BGFX_STATE_BLEND_EQUATION!(BGFX_STATE_BLEND_EQUATION_MIN) );
216-
pub const BGFX_STATE_BLEND_LIGHTEN: u64 = (BGFX_STATE_BLEND_FUNC!(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_ONE ) | BGFX_STATE_BLEND_EQUATION!(BGFX_STATE_BLEND_EQUATION_MAX) );
217-
pub const BGFX_STATE_BLEND_MULTIPLY: u64 = (BGFX_STATE_BLEND_FUNC!(BGFX_STATE_BLEND_DST_COLOR, BGFX_STATE_BLEND_ZERO ) );
218-
pub const BGFX_STATE_BLEND_NORMAL: u64 = (BGFX_STATE_BLEND_FUNC!(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_INV_SRC_ALPHA) );
219-
pub const BGFX_STATE_BLEND_SCREEN: u64 = (BGFX_STATE_BLEND_FUNC!(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_INV_SRC_COLOR) );
220-
pub const BGFX_STATE_BLEND_LINEAR_BURN: u64 = (BGFX_STATE_BLEND_FUNC!(BGFX_STATE_BLEND_DST_COLOR, BGFX_STATE_BLEND_INV_DST_COLOR) | BGFX_STATE_BLEND_EQUATION!(BGFX_STATE_BLEND_EQUATION_SUB) );
205+
pub const BGFX_STATE_BLEND_ADD: u64 = BGFX_STATE_BLEND_FUNC!(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_ONE );
206+
pub const BGFX_STATE_BLEND_ALPHA: u64 = BGFX_STATE_BLEND_FUNC!(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA);
207+
pub const BGFX_STATE_BLEND_DARKEN: u64 = BGFX_STATE_BLEND_FUNC!(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_ONE ) | BGFX_STATE_BLEND_EQUATION!(BGFX_STATE_BLEND_EQUATION_MIN);
208+
pub const BGFX_STATE_BLEND_LIGHTEN: u64 = BGFX_STATE_BLEND_FUNC!(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_ONE ) | BGFX_STATE_BLEND_EQUATION!(BGFX_STATE_BLEND_EQUATION_MAX);
209+
pub const BGFX_STATE_BLEND_MULTIPLY: u64 = BGFX_STATE_BLEND_FUNC!(BGFX_STATE_BLEND_DST_COLOR, BGFX_STATE_BLEND_ZERO );
210+
pub const BGFX_STATE_BLEND_NORMAL: u64 = BGFX_STATE_BLEND_FUNC!(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_INV_SRC_ALPHA);
211+
pub const BGFX_STATE_BLEND_SCREEN: u64 = BGFX_STATE_BLEND_FUNC!(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_INV_SRC_COLOR);
212+
pub const BGFX_STATE_BLEND_LINEAR_BURN: u64 = BGFX_STATE_BLEND_FUNC!(BGFX_STATE_BLEND_DST_COLOR, BGFX_STATE_BLEND_INV_DST_COLOR) | BGFX_STATE_BLEND_EQUATION!(BGFX_STATE_BLEND_EQUATION_SUB);
221213

222214
#[macro_export]
223215
macro_rules! BGFX_STATE_BLEND_FUNC_RT_x {

Diff for: examples/00-helloworld.rs

-58
This file was deleted.

0 commit comments

Comments
 (0)