Skip to content

Commit

Permalink
Merge pull request #80 from AryanpurTech/Indices-Size-Increase
Browse files Browse the repository at this point in the history
increased indices from u16 to u32
  • Loading branch information
ElhamAryanpur authored Sep 8, 2024
2 parents daabd99 + 11d6aa9 commit d09e956
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "blue_engine"
version = "0.5.18"
version = "0.5.19"
authors = ["Elham Aryanpur <[email protected]>"]
edition = "2021"
description = "General-Purpose, Easy-to-use, Fast, and Portable graphics engine"
Expand Down
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
[![Rust Windows](https:/AryanpurTech/BlueEngine/actions/workflows/rust-win.yml/badge.svg)](https:/AryanpurTech/BlueEngine/actions/workflows/rust-win.yml)
[![Rust MacOS](https:/AryanpurTech/BlueEngine/actions/workflows/rust-osx.yml/badge.svg)](https:/AryanpurTech/BlueEngine/actions/workflows/rust-osx.yml)
[![rust-clippy analyze](https:/AryanpurTech/BlueEngine/actions/workflows/rust-clippy.yml/badge.svg)](https:/AryanpurTech/BlueEngine/actions/workflows/rust-clippy.yml)
![Static Badge](https://img.shields.io/badge/Join-The_Discord-blue?style=flat&logo=discord&color=blue)
![Static Badge](https://img.shields.io/badge/Read_The_Docs-blue?style=flat&logo=docsdotrs&color=%23000000)

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

Expand Down Expand Up @@ -33,19 +35,12 @@ fn main() {
}
```

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

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

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

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

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

* Check out the [editor](https:/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.*
2 changes: 1 addition & 1 deletion src/definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ impl crate::header::Renderer {
pub fn build_vertex_buffer(
&mut self,
vertices: &Vec<Vertex>,
indices: &Vec<u16>,
indices: &Vec<u32>,
) -> eyre::Result<VertexBuffers> {
let vertex_buffer = self
.device
Expand Down
2 changes: 1 addition & 1 deletion src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ pub struct Object {
/// A list of Vertex
pub vertices: Vec<Vertex>,
/// A list of indices that dictates the order that vertices appear
pub indices: Vec<u16>,
pub indices: Vec<u32>,
/// Describes how to uniform buffer is structures
pub uniform_layout: wgpu::BindGroupLayout,
/// Pipeline holds all the data that is sent to GPU, including shaders and textures
Expand Down
4 changes: 2 additions & 2 deletions src/objects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl Renderer {
&mut self,
name: impl StringBuffer,
vertices: Vec<Vertex>,
indices: Vec<u16>,
indices: Vec<u32>,
settings: ObjectSettings,
) -> eyre::Result<Object> {
let vertex_buffer = self.build_vertex_buffer(&vertices, &indices)?;
Expand Down Expand Up @@ -117,7 +117,7 @@ impl ObjectStorage {
&mut self,
name: impl StringBuffer,
vertices: Vec<Vertex>,
indices: Vec<u16>,
indices: Vec<u32>,
settings: ObjectSettings,
renderer: &mut Renderer,
) -> eyre::Result<()> {
Expand Down
14 changes: 7 additions & 7 deletions src/primitive_shapes/three_dimensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ pub fn uv_sphere(
let stack_step = std::f32::consts::PI / stacks;

let mut vertices: Vec<Vertex> = Vec::with_capacity(details.0 * details.1);
let mut indices: Vec<u16> = Vec::with_capacity(details.0 * details.1 * 2 * 3);
let mut indices: Vec<u32> = Vec::with_capacity(details.0 * details.1 * 2 * 3);

for i in 0..details.0 + 1 {
let stack_angle = std::f32::consts::PI / 2. - (i as f32) * stack_step;
Expand All @@ -194,14 +194,14 @@ pub fn uv_sphere(
let mut k2 = k1 + details.1 + 1;
for _j in 0..details.1 {
if i != 0 {
indices.push(k1 as u16);
indices.push(k2 as u16);
indices.push((k1 + 1) as u16);
indices.push(k1 as u32);
indices.push(k2 as u32);
indices.push((k1 + 1) as u32);
}
if i != details.0 - 1 {
indices.push((k1 + 1) as u16);
indices.push(k2 as u16);
indices.push((k2 + 1) as u16);
indices.push((k1 + 1) as u32);
indices.push(k2 as u32);
indices.push((k2 + 1) as u32);
}
k1 += 1;
k2 += 1;
Expand Down
2 changes: 1 addition & 1 deletion src/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ impl Renderer {
render_pass.set_vertex_buffer(1, i.instance_buffer.slice(..));
render_pass.set_index_buffer(
vertex_buffer.index_buffer.slice(..),
wgpu::IndexFormat::Uint16,
wgpu::IndexFormat::Uint32,
);

// shader
Expand Down

0 comments on commit d09e956

Please sign in to comment.