From 30427a6120fd679e99b5e5a8540fe4a4584982ad Mon Sep 17 00:00:00 2001 From: JimmyBinoculars <91781252+JimmyBinoculars@users.noreply.github.com> Date: Sun, 19 May 2024 16:09:59 +0100 Subject: [PATCH] trunk --- .trunk/.gitignore | 9 +++++ .trunk/configs/.markdownlint.yaml | 2 ++ .trunk/configs/.shellcheckrc | 7 ++++ .trunk/configs/.yamllint.yaml | 7 ++++ .trunk/trunk.yaml | 40 ++++++++++++++++++++++ example/index.js | 57 +++---------------------------- 6 files changed, 69 insertions(+), 53 deletions(-) create mode 100644 .trunk/.gitignore create mode 100644 .trunk/configs/.markdownlint.yaml create mode 100644 .trunk/configs/.shellcheckrc create mode 100644 .trunk/configs/.yamllint.yaml create mode 100644 .trunk/trunk.yaml diff --git a/.trunk/.gitignore b/.trunk/.gitignore new file mode 100644 index 0000000..15966d0 --- /dev/null +++ b/.trunk/.gitignore @@ -0,0 +1,9 @@ +*out +*logs +*actions +*notifications +*tools +plugins +user_trunk.yaml +user.yaml +tmp diff --git a/.trunk/configs/.markdownlint.yaml b/.trunk/configs/.markdownlint.yaml new file mode 100644 index 0000000..b40ee9d --- /dev/null +++ b/.trunk/configs/.markdownlint.yaml @@ -0,0 +1,2 @@ +# Prettier friendly markdownlint config (all formatting rules disabled) +extends: markdownlint/style/prettier diff --git a/.trunk/configs/.shellcheckrc b/.trunk/configs/.shellcheckrc new file mode 100644 index 0000000..8c7b1ad --- /dev/null +++ b/.trunk/configs/.shellcheckrc @@ -0,0 +1,7 @@ +enable=all +source-path=SCRIPTDIR +disable=SC2154 + +# If you're having issues with shellcheck following source, disable the errors via: +# disable=SC1090 +# disable=SC1091 diff --git a/.trunk/configs/.yamllint.yaml b/.trunk/configs/.yamllint.yaml new file mode 100644 index 0000000..184e251 --- /dev/null +++ b/.trunk/configs/.yamllint.yaml @@ -0,0 +1,7 @@ +rules: + quoted-strings: + required: only-when-needed + extra-allowed: ["{|}"] + key-duplicates: {} + octal-values: + forbid-implicit-octal: true diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml new file mode 100644 index 0000000..4d6ba9a --- /dev/null +++ b/.trunk/trunk.yaml @@ -0,0 +1,40 @@ +# This file controls the behavior of Trunk: https://docs.trunk.io/cli +# To learn more about the format of this file, see https://docs.trunk.io/reference/trunk-yaml +version: 0.1 +cli: + version: 1.22.1 +# Trunk provides extensibility via plugins. (https://docs.trunk.io/plugins) +plugins: + sources: + - id: trunk + ref: v1.5.0 + uri: https://github.com/trunk-io/plugins +# Many linters and tools depend on runtimes - configure them here. (https://docs.trunk.io/runtimes) +runtimes: + enabled: + - go@1.21.0 + - node@18.12.1 + - python@3.10.8 +# This is the section where you manage your linters. (https://docs.trunk.io/check/configuration) +lint: + enabled: + - actionlint@1.7.0 + - checkov@3.2.95 + - eslint@8.57.0 + - git-diff-check + - markdownlint@0.40.0 + - osv-scanner@1.7.3 + - oxipng@9.1.1 + - prettier@3.2.5 + - shellcheck@0.10.0 + - shfmt@3.6.0 + - trivy@0.51.1 + - trufflehog@3.76.3 + - yamllint@1.35.1 +actions: + disabled: + - trunk-announce + - trunk-check-pre-push + - trunk-fmt-pre-commit + enabled: + - trunk-upgrade-available diff --git a/example/index.js b/example/index.js index cf69787..a9ba2b9 100644 --- a/example/index.js +++ b/example/index.js @@ -1,62 +1,13 @@ const lib = require("textvox3d"); -/** - * Calculate viewport dimensions. - * - * @param {object} camera - The camera object. - * @param {number} d - Distance. - * @param {number} cubeSize - The size of the cube. - * @return {object} - Object containing the width and height of the viewport. - */ -function calibrateViewportDimensions(camera, d, cubeSize) { - const focalLength = camera.fl; - const viewportHeight = 2 * cubeSize; - const viewportWidth = (viewportHeight * d) / focalLength; - - return { width: viewportWidth, height: viewportHeight }; -} - const f = 0; -const camera = new lib.camera(55, 10, [7, -7, 5], [64, 0, 47]); -const viewport = new lib.viewport( +const camera = new lib.Camera(55, 10, [7, -7, 5], [64, 0, 47]); +const viewport = new lib.Viewport( process.stdout.columns, process.stdout.rows - 1, ); const cubeMesh = lib.getMesh("cube"); -const cube = new lib.gameobject(cubeMesh, [0, 0, 0], [0, 0, 0], [2, 2, 2]); - -// Anti - JSLint -cube; -camera; -calibrateViewportDimensions(camera, 10, 100); - -/** - * Function to test the viewport. - */ -function viewportTest() { - let i = 0; - while (i < viewport.height) { - if (i === 0) { - const a = lib.repeatStringNumTimes( - "0", - viewport.width - (f.toString().length + 2), - ); - console.log(`${a}f=${f}`); - } else { - console.log("0"); - } - i++; - } -} - -/** - * Function to update the frame. - */ -function frame() { - viewportTest(); - f++; -} +const cube = new lib.GameObject(cubeMesh, [0, 0, 0], [0, 0, 0], [2, 2, 2]); -frame(); -// setInterval(frame, 50) +// We will do just horizontal first