commit af215f8291af7c48af6ea3a0a8a63a6ac7e0c352 Author: CDaut Date: Fri Nov 17 19:35:54 2023 +0100 nitial setup diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c872275 --- /dev/null +++ b/.gitignore @@ -0,0 +1,138 @@ +/target +# Created by https://www.toptal.com/developers/gitignore/api/rust +# Edit at https://www.toptal.com/developers/gitignore?templates=rust + +### Rust ### +# Generated by Cargo +# will have compiled files and executables +debug/ +target/ + +# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries +# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html +Cargo.lock + +# These are backup files generated by rustfmt +**/*.rs.bk + +# MSVC Windows builds of rustc generate these, which store debugging information +*.pdb + +# End of https://www.toptal.com/developers/gitignore/api/rust +# Created by https://www.toptal.com/developers/gitignore/api/intellij +# Edit at https://www.toptal.com/developers/gitignore?templates=intellij + +### Intellij ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# SonarLint plugin +.idea/sonarlint/ + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### Intellij Patch ### +# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 + +# *.iml +# modules.xml +# .idea/misc.xml +# *.ipr + +# Sonarlint plugin +# https://plugins.jetbrains.com/plugin/7973-sonarlint +.idea/**/sonarlint/ + +# SonarQube Plugin +# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin +.idea/**/sonarIssues.xml + +# Markdown Navigator plugin +# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced +.idea/**/markdown-navigator.xml +.idea/**/markdown-navigator-enh.xml +.idea/**/markdown-navigator/ + +# Cache file creation bug +# See https://youtrack.jetbrains.com/issue/JBR-2257 +.idea/$CACHE_FILE$ + +# CodeStream plugin +# https://plugins.jetbrains.com/plugin/12206-codestream +.idea/codestream.xml + +# Azure Toolkit for IntelliJ plugin +# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij +.idea/**/azureSettings.xml + +# End of https://www.toptal.com/developers/gitignore/api/intellij diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..36fefc5 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/raytrace-rs.iml b/.idea/raytrace-rs.iml new file mode 100644 index 0000000..c254557 --- /dev/null +++ b/.idea/raytrace-rs.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..7665320 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "raytrace-rs" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +easy-gltf = "1.1.1" +clap = { version = "4.4.8", features = ["derive"] } + +[alias] +runx = "run /home/clemens/repositorys/raytrace-rs/scenes/cube_on_plane.glb 0" \ No newline at end of file diff --git a/scenes/cube_on_plane.blend b/scenes/cube_on_plane.blend new file mode 100644 index 0000000..a345c0b Binary files /dev/null and b/scenes/cube_on_plane.blend differ diff --git a/scenes/cube_on_plane.glb b/scenes/cube_on_plane.glb new file mode 100644 index 0000000..ca0d948 Binary files /dev/null and b/scenes/cube_on_plane.glb differ diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..1e49cba --- /dev/null +++ b/src/main.rs @@ -0,0 +1,26 @@ +mod renderer; + +use std::string::String; +use clap::{Parser}; +use crate::renderer::render; + +#[derive(Parser, Debug)] +#[command(author, version, about, long_about = None)] +struct Args { + gltf_file_path: String, + //which scene to use in the gltf file + scene_index: u32, +} + +fn main() { + //parse clargs + let args = Args::parse(); + + //load gltf scene + let scenes = easy_gltf::load( + &args.gltf_file_path) + .expect(&*format!("Failed to load glTF file {}", &args.gltf_file_path)); + + render(scenes, args.scene_index) +} + diff --git a/src/renderer.rs b/src/renderer.rs new file mode 100644 index 0000000..1ea7884 --- /dev/null +++ b/src/renderer.rs @@ -0,0 +1,4 @@ +use easy_gltf::Scene; + +pub fn render(scenes: Vec, scene_idx: u32) { +} \ No newline at end of file