From a2f5559c02e9a2a82823f55b624d3079a1824116 Mon Sep 17 00:00:00 2001 From: Elham Aryanpur Date: Fri, 29 Mar 2024 05:35:40 +0300 Subject: [PATCH] chore: fixed typos --- CONTRIBUTING.md | 4 +-- Dockerfile | 59 ++++++++++++++++++++++++++++++++++ examples/utils/render_order.rs | 4 +-- src/definition.rs | 12 +++---- src/header.rs | 10 +++--- src/objects.rs | 26 +++++++-------- src/window.rs | 8 ++--- 7 files changed, 91 insertions(+), 32 deletions(-) create mode 100644 Dockerfile diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 69a25b1..ec17e1e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,4 @@ -# Contibuting guidelines +# Contributing guidelines As an open source project, the community is the backbone of the engine. As such, any contribution is welcome. Here are some ways you can contribute: @@ -8,6 +8,6 @@ As an open source project, the community is the backbone of the engine. As such, * `Writing tutorials`: Knowledgebase is important, but tutorials and usage guides are important as well. This is an area the engine lacks a lot and would appreciate help the most! * `Writing documentation`: The codebase move fast, often times documentation is forgotten to be added until a few versions. -## Contibution license +## Contribution license By contributing to this repository through issues, addition, modification, or deletion of any kind to the codebase, you agree to your work being licensed under the same license as the engine, which you can obtain a copy of in the repository. diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..114fa0a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,59 @@ +FROM archlinux + +RUN pacman -Syu --noconfirm +RUN pacman -S --noconfirm jdk8-openjdk unzip wget cmake rustup openssl pkgconf + +# github override HOME, so here we are +ENV RUSTUP_HOME=/usr/local/rustup \ + CARGO_HOME=/usr/local/cargo \ + PATH=/usr/local/cargo/bin:$PATH + +RUN rustup toolchain install 1.71.0 +RUN rustup default 1.71 +RUN rustc --version + +RUN rustup target add armv7-linux-androideabi +RUN rustup target add aarch64-linux-android +RUN rustup target add i686-linux-android +RUN rustup target add x86_64-linux-android + +# Install Android SDK +ENV ANDROID_HOME /opt/android-sdk-linux +ENV JAVA_HOME /usr/lib/jvm/default +RUN mkdir ${ANDROID_HOME} && \ + cd ${ANDROID_HOME} && \ + wget -q https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip && \ + unzip -q sdk-tools-linux-4333796.zip && \ + rm sdk-tools-linux-4333796.zip && \ + chown -R root:root /opt +RUN mkdir -p ~/.android && touch ~/.android/repositories.cfg +RUN yes | ${ANDROID_HOME}/tools/bin/sdkmanager "platform-tools" | grep -v = || true +RUN yes | ${ANDROID_HOME}/tools/bin/sdkmanager "platforms;android-31" | grep -v = || true +RUN yes | ${ANDROID_HOME}/tools/bin/sdkmanager "build-tools;31.0.0" | grep -v = || true +RUN ${ANDROID_HOME}/tools/bin/sdkmanager --update | grep -v = || true + +# Install Android NDK +RUN cd /usr/local && \ + wget -q http://dl.google.com/android/repository/android-ndk-r25-linux.zip && \ + unzip -q android-ndk-r25-linux.zip && \ + rm android-ndk-r25-linux.zip +ENV NDK_HOME /usr/local/android-ndk-r25 + +# Copy contents to container. Should only use this on a clean directory +COPY . /root/cargo-apk + +# This should be on top, but I am saving some time rebuilding the container. Sorry! +RUN pacman -S --noconfirm gcc + +# Install binary +RUN cargo install --path /root/cargo-apk + +# Remove source and build files +RUN rm -rf /root/cargo-apk + +# Add build-tools to PATH, for apksigner +ENV PATH="/opt/android-sdk-linux/build-tools/31.0.0/:${PATH}" + +# Make directory for user code +RUN mkdir /root/src +WORKDIR /root/src \ No newline at end of file diff --git a/examples/utils/render_order.rs b/examples/utils/render_order.rs index 2ce579b..7c63ccb 100644 --- a/examples/utils/render_order.rs +++ b/examples/utils/render_order.rs @@ -34,7 +34,7 @@ fn main() { .objects .get_mut("layer1") .expect("failed to gete object"); - // set a color to differenciate it + // set a color to differentiate it layer1 .set_uniform_color(1f32, 0.5, 0f32, 1f32) .expect("failed to set color"); @@ -48,7 +48,7 @@ fn main() { .objects .get_mut("layer2") .expect("failed to gete object"); - // set a color to differenciate it + // set a color to differentiate it layer2 .set_uniform_color(0f32, 0f32, 1f32, 1f32) .expect("failed to set color"); diff --git a/src/definition.rs b/src/definition.rs index fa5cc1e..067eef1 100644 --- a/src/definition.rs +++ b/src/definition.rs @@ -304,17 +304,17 @@ impl crate::header::Renderer { Ok((uniform_bind_group, uniform_bind_group_layout)) } - /// Creates a new vertex buffer and indecies + /// Creates a new vertex buffer and indices pub fn build_vertex_buffer( &mut self, - verticies: &Vec, - indicies: &Vec, + vertices: &Vec, + indices: &Vec, ) -> color_eyre::Result { let vertex_buffer = self .device .create_buffer_init(&wgpu::util::BufferInitDescriptor { label: Some("Vertex Buffer"), - contents: bytemuck::cast_slice(verticies.as_slice()), + contents: bytemuck::cast_slice(vertices.as_slice()), usage: wgpu::BufferUsages::VERTEX, }); @@ -322,14 +322,14 @@ impl crate::header::Renderer { .device .create_buffer_init(&wgpu::util::BufferInitDescriptor { label: Some("Index Buffer"), - contents: bytemuck::cast_slice(indicies.as_slice()), + contents: bytemuck::cast_slice(indices.as_slice()), usage: wgpu::BufferUsages::INDEX, }); Ok(VertexBuffers { vertex_buffer, index_buffer, - length: indicies.len() as u32, + length: indices.len() as u32, }) } diff --git a/src/header.rs b/src/header.rs index a3ee0d3..8017f2e 100644 --- a/src/header.rs +++ b/src/header.rs @@ -100,13 +100,13 @@ pub struct Object { pub rotation: glm::Vec3, // flags the object to be updated until next frame pub(crate) changed: bool, - /// Transformation matricies helps to apply changes to your object, including position, orientation, ... + /// Transformation matrices helps to apply changes to your object, including position, orientation, ... /// Best choice is to let the Object system handle it pub position_matrix: nalgebra_glm::Mat4, - /// Transformation matricies helps to apply changes to your object, including position, orientation, ... + /// Transformation matrices helps to apply changes to your object, including position, orientation, ... /// Best choice is to let the Object system handle it pub scale_matrix: nalgebra_glm::Mat4, - /// Transformation matricies helps to apply changes to your object, including position, orientation, ... + /// Transformation matrices helps to apply changes to your object, including position, orientation, ... /// Best choice is to let the Object system handle it pub rotation_matrix: nalgebra_glm::Mat4, /// Transformation matrix, but inversed @@ -168,7 +168,7 @@ unsafe impl Sync for ObjectSettings {} /// the engine, you might be able to even run the engine in headless mode meaning there would not be a need for a window and the /// renders would come as image files. /// -/// If you so wish to have a window, you would need to start a window update loop. The update loop of window runs a frame every few milisecond, +/// If you so wish to have a window, you would need to start a window update loop. The update loop of window runs a frame every few millisecond, /// and gives you details of what is happening during this time, like input events. You can also modify existing parts of the engine during /// this update loop, such as changing camera to look differently, or creating a new object on the scene, or even changing window details! /// @@ -422,7 +422,7 @@ pub struct ShaderSettings { /// value `!0` pub mask: u64, /// When enabled, produces another sample mask per pixel - /// based on the alpha output value, that is ANDed with the + /// based on the alpha output value, that is ANDead with the /// sample_mask and the primitive coverage to restrict the /// set of samples affected by a primitive. diff --git a/src/objects.rs b/src/objects.rs index 3d636f6..831f8ba 100644 --- a/src/objects.rs +++ b/src/objects.rs @@ -20,17 +20,17 @@ impl Renderer { /// /// # Arguments /// * `name` - The name of the object. - /// * `verticies` - A list of vertices for the object to draw with - /// * `indicies` - A list of indicies that references the vertices, defining draw order + /// * `vertices` - A list of vertices for the object to draw with + /// * `indices` - A list of indices that references the vertices, defining draw order /// * `settings` - The settings of the object pub fn build_object( &mut self, name: impl StringBuffer, - verticies: Vec, - indicies: Vec, + vertices: Vec, + indices: Vec, settings: ObjectSettings, ) -> color_eyre::Result { - let vertex_buffer = self.build_vertex_buffer(&verticies, &indicies)?; + let vertex_buffer = self.build_vertex_buffer(&vertices, &indices)?; let uniform = self.build_uniform_buffer(&vec![ self.build_uniform_buffer_part("Transformation Matrix", DEFAULT_MATRIX_4), @@ -68,8 +68,8 @@ impl Renderer { Ok(Object { name: name.as_string(), - vertices: verticies, - indices: indicies, + vertices: vertices, + indices: indices, pipeline: Pipeline { vertex_buffer: PipelineData::Data(vertex_buffer), shader: PipelineData::Data(shader), @@ -119,14 +119,14 @@ impl ObjectStorage { pub fn new_object( &mut self, name: impl StringBuffer, - verticies: Vec, - indicies: Vec, + vertices: Vec, + indices: Vec, settings: ObjectSettings, renderer: &mut Renderer, ) -> color_eyre::Result<()> { self.add_object( name.clone(), - renderer.build_object(name.clone(), verticies, indicies, settings)?, + renderer.build_object(name.clone(), vertices, indices, settings)?, )?; /*self.update_object(name, |object| { @@ -379,10 +379,10 @@ impl Object { renderer: &mut Renderer, ) -> color_eyre::Result<(crate::VertexBuffers, crate::UniformBuffers, crate::Shaders)> { let vertex_buffer = self.update_vertex_buffer_and_return(renderer)?; - let unifrom_buffer = self.update_uniform_buffer_and_return(renderer)?; + let uniform_buffer = self.update_uniform_buffer_and_return(renderer)?; let shader = self.update_shader_and_return(renderer)?; self.changed = false; - Ok((vertex_buffer, unifrom_buffer, shader)) + Ok((vertex_buffer, uniform_buffer, shader)) } /// Update and apply changes done to the vertex buffer @@ -583,7 +583,7 @@ impl ShaderBuilder { shader_builder } - /// Builds the shader with the configruation defined + /// Builds the shader with the configuration defined pub fn build(&mut self) { if self.camera_effect { for i in &self.configs { diff --git a/src/window.rs b/src/window.rs index bc7a9c0..1bc018e 100644 --- a/src/window.rs +++ b/src/window.rs @@ -31,17 +31,17 @@ impl Engine { pub(crate) fn new_inner(settings: WindowDescriptor) -> color_eyre::Result { #[cfg(feature = "debug")] env_logger::init(); - // Dimentions of the window, as width and height + // Dimensions of the window, as width and height // and then are set as a logical size that the window can accept #[cfg(not(feature = "android"))] - let dimention = winit::dpi::PhysicalSize { + let dimension = winit::dpi::PhysicalSize { width: settings.width, // Which sets the width of the window height: settings.height, // And sets the height of the window }; - // Here the size is finally made according to the dimentions we set earlier + // Here the size is finally made according to the dimensions we set earlier #[cfg(not(feature = "android"))] - let size = winit::dpi::Size::Physical(dimention); + let size = winit::dpi::Size::Physical(dimension); // And we will create a new window and set all the options we stored #[cfg(not(feature = "android"))]