Skip to content

Commit

Permalink
Merge pull request #34 from AryanpurTech/FromOrdinaryToWonder
Browse files Browse the repository at this point in the history
inline traits
  • Loading branch information
ElhamAryanpur authored Aug 22, 2023
2 parents 142a683 + 334dbc0 commit c5cc442
Show file tree
Hide file tree
Showing 13 changed files with 2,550 additions and 2,550 deletions.
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
target
.vscode
tools
res
target
.vscode
tools
res
402 changes: 201 additions & 201 deletions LICENSE.txt

Large diffs are not rendered by default.

100 changes: 50 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
<img src="https://raw.githubusercontent.com/AryanpurTech/BlueEngineDocs/master/resources/logo_3d.gif" loop=infinite width="100%" />

[![Rust Linux](https://github.com/AryanpurTech/BlueEngine/actions/workflows/rust-linux.yml/badge.svg)](https://github.com/AryanpurTech/BlueEngine/actions/workflows/rust-linux.yml)
[![Rust Windows](https://github.com/AryanpurTech/BlueEngine/actions/workflows/rust-win.yml/badge.svg)](https://github.com/AryanpurTech/BlueEngine/actions/workflows/rust-win.yml)
[![Rust MacOS](https://github.com/AryanpurTech/BlueEngine/actions/workflows/rust-osx.yml/badge.svg)](https://github.com/AryanpurTech/BlueEngine/actions/workflows/rust-osx.yml)

Make sure to use latest Rust version, as the engine is always kept up to date.

## About

Blue Engine is a general-purpose, easy-to-use, extendable, and portable graphics engine written in rust. The engine can run on many popular back-end APIs including Vulkan, D3D-12, GL-ES 3, and Metal as well as Windows, Linux, Mobile, and OSX to ensure cross-platform compatibility.

Hello World:

```rust
use blue_engine::{
header::{ Engine, ObjectSettings },
primitive_shapes::triangle
};

fn main() {
// initialize the engine
let mut engine = Engine::new().expect("engine couldn't be initialized");

// create a triangle
triangle("my triangle", ObjectSettings::default(), &mut engine.renderer, &mut engine.objects).unwrap();

// run the engine
engine
.update_loop(move |_, _, _, _, _, _| {})
.expect("Error during update loop");
}
```

* [Join our discord server](https://discord.gg/s7xsj9q)

* [WIP] [Guide](https://aryanpurtech.github.io/BlueEngineDocs/)

* Check out the [workflow](https://github.com/orgs/AryanpurTech/projects/2) for roadmap, status, ...

* Check out the [examples](https://github.com/AryanpurTech/BlueEngine/tree/master/examples) folder to get a sense of how things are done

* Check out the [utilities library](https://github.com/AryanpurTech/BlueEngineUtilities) for extra functionality with the engine

* Check out the [editor](https://github.com/rustylabs/blue_flame)

*the credits to the image on top: NotPB*


*the development might seem slow sometimes, its due to multiple repositories being handled and due to my education taking a large chunk of my time. The project isn't dead, just slow.*
<img src="https://raw.githubusercontent.com/AryanpurTech/BlueEngineDocs/master/resources/logo_3d.gif" loop=infinite width="100%" />

[![Rust Linux](https://github.com/AryanpurTech/BlueEngine/actions/workflows/rust-linux.yml/badge.svg)](https://github.com/AryanpurTech/BlueEngine/actions/workflows/rust-linux.yml)
[![Rust Windows](https://github.com/AryanpurTech/BlueEngine/actions/workflows/rust-win.yml/badge.svg)](https://github.com/AryanpurTech/BlueEngine/actions/workflows/rust-win.yml)
[![Rust MacOS](https://github.com/AryanpurTech/BlueEngine/actions/workflows/rust-osx.yml/badge.svg)](https://github.com/AryanpurTech/BlueEngine/actions/workflows/rust-osx.yml)

Make sure to use latest Rust version, as the engine is always kept up to date.

## About

Blue Engine is a general-purpose, easy-to-use, extendable, and portable graphics engine written in rust. The engine can run on many popular back-end APIs including Vulkan, D3D-12, GL-ES 3, and Metal as well as Windows, Linux, Mobile, and OSX to ensure cross-platform compatibility.

Hello World:

```rust
use blue_engine::{
header::{ Engine, ObjectSettings },
primitive_shapes::triangle
};

fn main() {
// initialize the engine
let mut engine = Engine::new().expect("engine couldn't be initialized");

// create a triangle
triangle("my triangle", ObjectSettings::default(), &mut engine.renderer, &mut engine.objects).unwrap();

// run the engine
engine
.update_loop(move |_, _, _, _, _, _| {})
.expect("Error during update loop");
}
```

* [Join our discord server](https://discord.gg/s7xsj9q)

* [WIP] [Guide](https://aryanpurtech.github.io/BlueEngineDocs/)

* Check out the [workflow](https://github.com/orgs/AryanpurTech/projects/2) for roadmap, status, ...

* Check out the [examples](https://github.com/AryanpurTech/BlueEngine/tree/master/examples) folder to get a sense of how things are done

* Check out the [utilities library](https://github.com/AryanpurTech/BlueEngineUtilities) for extra functionality with the engine

* Check out the [editor](https://github.com/rustylabs/blue_flame)

*the credits to the image on top: NotPB*


*the development might seem slow sometimes, its due to multiple repositories being handled and due to my education taking a large chunk of my time. The project isn't dead, just slow.*
90 changes: 45 additions & 45 deletions examples/dev/resource/default_shader.wgsl
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
// Vertex Stage

[[block]]
struct VertexUniforms {
camera_matrix: mat4x4<f32>;
};
[[group(1), binding(0)]]
var<uniform> vertex_uniforms: VertexUniforms;

struct VertexInput {
[[location(0)]] position: vec3<f32>;
[[location(1)]] texture_coordinates: vec2<f32>;
};

struct VertexOutput {
[[builtin(position)]] position: vec4<f32>;
[[location(0)]] texture_coordinates: vec2<f32>;
};

[[stage(vertex)]]
fn main(input: VertexInput) -> VertexOutput {
var out: VertexOutput;
out.position = vertex_uniforms.camera_matrix * vec4<f32>(input.position, 1.0);
out.texture_coordinates = input.texture_coordinates;
return out;
}

// Fragment Stage

[[block]]
struct FragmentUniforms {
color: vec4<f32>;
};
[[group(1), binding(1)]]
var<uniform> fragment_uniforms: FragmentUniforms;

[[group(0), binding(0)]]
var texture_diffuse: texture_2d<f32>;

[[group(0), binding(1)]]
var sampler_diffuse: sampler;

[[stage(fragment)]]
fn main(input: VertexOutput) -> [[location(0)]] vec4<f32> {
return textureSample(texture_diffuse, sampler_diffuse, input.texture_coordinates) * fragment_uniforms.color;
// Vertex Stage

[[block]]
struct VertexUniforms {
camera_matrix: mat4x4<f32>;
};
[[group(1), binding(0)]]
var<uniform> vertex_uniforms: VertexUniforms;

struct VertexInput {
[[location(0)]] position: vec3<f32>;
[[location(1)]] texture_coordinates: vec2<f32>;
};

struct VertexOutput {
[[builtin(position)]] position: vec4<f32>;
[[location(0)]] texture_coordinates: vec2<f32>;
};

[[stage(vertex)]]
fn main(input: VertexInput) -> VertexOutput {
var out: VertexOutput;
out.position = vertex_uniforms.camera_matrix * vec4<f32>(input.position, 1.0);
out.texture_coordinates = input.texture_coordinates;
return out;
}

// Fragment Stage

[[block]]
struct FragmentUniforms {
color: vec4<f32>;
};
[[group(1), binding(1)]]
var<uniform> fragment_uniforms: FragmentUniforms;

[[group(0), binding(0)]]
var texture_diffuse: texture_2d<f32>;

[[group(0), binding(1)]]
var sampler_diffuse: sampler;

[[stage(fragment)]]
fn main(input: VertexOutput) -> [[location(0)]] vec4<f32> {
return textureSample(texture_diffuse, sampler_diffuse, input.texture_coordinates) * fragment_uniforms.color;
}
Loading

0 comments on commit c5cc442

Please sign in to comment.