Begin upgrade dependencies
This commit is contained in:
parent
d4800a9cb1
commit
a6c6eb3c3e
10 changed files with 2723 additions and 1165 deletions
7
.vscode/extensions.json
vendored
Normal file
7
.vscode/extensions.json
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"recommendations": [
|
||||
"rust-lang.rust-analyzer", // Rust LSP
|
||||
"tamasfe.even-better-toml", // TOML language support
|
||||
"nemurubaka.cratesx", // Add usefull tools to manage Crates
|
||||
]
|
||||
}
|
3681
Cargo.lock
generated
3681
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
16
Cargo.toml
16
Cargo.toml
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "tuto1"
|
||||
name = "rust_micro_game_engine"
|
||||
version = "0.1.0"
|
||||
authors = ["Florian RICHER <florian.richer@unova.fr>"]
|
||||
edition = "2021"
|
||||
|
@ -14,20 +14,20 @@ cfg-if = "1"
|
|||
anyhow = "1.0"
|
||||
bytemuck = { version = "1.13", features = [ "derive" ] }
|
||||
cgmath = "0.18"
|
||||
env_logger = "0.10"
|
||||
pollster = "0.3.0"
|
||||
env_logger = "0.11"
|
||||
pollster = "0.4.0"
|
||||
log = "0.4"
|
||||
rayon = "1.7"
|
||||
tobj = { version = "3.2", features = ["async"]}
|
||||
wgpu = { version = "0.15" }
|
||||
winit = "0.28"
|
||||
tobj = { version = "4.0", features = ["async"]}
|
||||
wgpu = { version = "23" }
|
||||
winit = "0.30"
|
||||
instant = "0.1"
|
||||
async-std = "1.12"
|
||||
profiling = "1.0"
|
||||
tracy-client = "0.15"
|
||||
tracy-client = "0.17"
|
||||
|
||||
[dependencies.image]
|
||||
version = "0.24"
|
||||
version = "0.25"
|
||||
default-features = false
|
||||
features = ["png", "jpeg"]
|
||||
|
||||
|
|
82
flake.lock
Normal file
82
flake.lock
Normal file
|
@ -0,0 +1,82 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1726560853,
|
||||
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1730272153,
|
||||
"narHash": "sha256-B5WRZYsRlJgwVHIV6DvidFN7VX7Fg9uuwkRW9Ha8z+w=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "2d2a9ddbe3f2c00747398f3dc9b05f7f2ebb0f53",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"rust-overlay": "rust-overlay"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1730601085,
|
||||
"narHash": "sha256-Sgax33jGuvVHTjl1P78IwzlhAGyOxtx5Q26inKja8S4=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "8d1b40f8dfd7539aaa3de56e207e22b3cc451825",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
58
flake.nix
Normal file
58
flake.nix
Normal file
|
@ -0,0 +1,58 @@
|
|||
{
|
||||
description = "DRM test rust configuration";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
rust-overlay = {
|
||||
url = "github:oxalica/rust-overlay";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils, rust-overlay }:
|
||||
flake-utils.lib.eachSystem flake-utils.lib.allSystems (system:
|
||||
let
|
||||
overlays = [ (import rust-overlay) ];
|
||||
pkgs = import nixpkgs {
|
||||
inherit system overlays;
|
||||
};
|
||||
rust = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
||||
|
||||
rustPlatform = pkgs.recurseIntoAttrs (pkgs.makeRustPlatform {
|
||||
rustc = rust;
|
||||
cargo = rust;
|
||||
});
|
||||
|
||||
libs = with pkgs; [ ]
|
||||
++ pkgs.lib.optional pkgs.stdenv.hostPlatform.isDarwin [ pkgs.darwin.apple_sdk.frameworks.SystemConfiguration ];
|
||||
in
|
||||
{
|
||||
devShells = {
|
||||
default = pkgs.mkShell {
|
||||
nativeBuildInputs = with pkgs; [
|
||||
(rust.override { extensions = ["rust-src" "rust-analyzer"]; })
|
||||
pkg-config
|
||||
];
|
||||
|
||||
buildInputs = libs;
|
||||
};
|
||||
};
|
||||
|
||||
packages = {
|
||||
default = rustPlatform.buildRustPackage {
|
||||
pname = "rust_micro_game_engine";
|
||||
version = "0.1.0";
|
||||
|
||||
src = self;
|
||||
|
||||
nativeBuildInputs = with pkgs; [ pkg-config ];
|
||||
buildInputs = libs;
|
||||
|
||||
cargoLock = {
|
||||
lockFile = ./Cargo.lock;
|
||||
};
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
2
rust-toolchain.toml
Normal file
2
rust-toolchain.toml
Normal file
|
@ -0,0 +1,2 @@
|
|||
[toolchain]
|
||||
channel = "1.82.0"
|
30
src/lib.rs
30
src/lib.rs
|
@ -142,12 +142,30 @@ pub async fn run() {
|
|||
#[cfg(not(target_arch = "wasm32"))]
|
||||
tracy_client::Client::running().unwrap().set_thread_name("MAIN THREAD");
|
||||
|
||||
let event_loop = EventLoop::new();
|
||||
let event_loop = EventLoop::new().unwrap();
|
||||
let title = env!("CARGO_PKG_NAME");
|
||||
let window = winit::window::WindowBuilder::new()
|
||||
.with_title(title)
|
||||
.build(&event_loop)
|
||||
.unwrap();
|
||||
|
||||
let mut window_attributes = winit::window::WindowAttributes::default()
|
||||
.with_title(title);
|
||||
|
||||
#[cfg(any(x11_platform, wayland_platform))]
|
||||
if let Some(token) = event_loop.read_token_from_env() {
|
||||
startup_notify::reset_activation_token_env();
|
||||
info!("Using token {:?} to activate a window", token);
|
||||
window_attributes = window_attributes.with_activation_token(token);
|
||||
}
|
||||
|
||||
#[cfg(macos_platform)]
|
||||
if let Some(tab_id) = _tab_id {
|
||||
window_attributes = window_attributes.with_tabbing_identifier(&tab_id);
|
||||
}
|
||||
|
||||
#[cfg(web_platform)]
|
||||
{
|
||||
window_attributes = window_attributes.with_append(true);
|
||||
}
|
||||
|
||||
let window = event_loop.create_window(window_attributes).unwrap();
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
{
|
||||
|
@ -170,7 +188,7 @@ pub async fn run() {
|
|||
let mut default_state = Arc::from(DefaultState::new(renderer.deref()).await);
|
||||
|
||||
let mut last_render_time = instant::Instant::now();
|
||||
event_loop.run(move |base_event, _, control_flow| {
|
||||
event_loop.run_app(move |base_event, _, control_flow| {
|
||||
*control_flow = ControlFlow::Poll;
|
||||
let renderer = Arc::get_mut(&mut renderer).unwrap();
|
||||
let state = Arc::get_mut(&mut default_state).unwrap();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use tuto1::run;
|
||||
use rust_micro_game_engine::run;
|
||||
|
||||
fn main() {
|
||||
async_std::task::block_on(run());
|
||||
|
|
|
@ -93,8 +93,9 @@ pub async fn load_model(
|
|||
|
||||
let mut materials = Vec::new();
|
||||
for m in obj_materials? {
|
||||
let diffuse_texture = load_texture(&m.diffuse_texture, false, device, queue).await?;
|
||||
let normal_texture = load_texture(&m.normal_texture, true, device, queue).await?;
|
||||
// TODO: Add support of optional diffuse texture and normal texture
|
||||
let diffuse_texture = load_texture(&m.diffuse_texture.unwrap(), false, device, queue).await?;
|
||||
let normal_texture = load_texture(&m.normal_texture.unwrap(), true, device, queue).await?;
|
||||
|
||||
materials.push(model::Material::new(
|
||||
device,
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use anyhow::*;
|
||||
use image::GenericImageView;
|
||||
use std::num::NonZeroU32;
|
||||
|
||||
pub struct Texture {
|
||||
pub texture: wgpu::Texture,
|
||||
|
@ -104,8 +103,8 @@ impl Texture {
|
|||
&rgba,
|
||||
wgpu::ImageDataLayout {
|
||||
offset: 0,
|
||||
bytes_per_row: NonZeroU32::new(4 * dimensions.0),
|
||||
rows_per_image: NonZeroU32::new(dimensions.1),
|
||||
bytes_per_row: Some(4 * dimensions.0),
|
||||
rows_per_image: Some(dimensions.1),
|
||||
},
|
||||
size,
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue