Skip to content

Commit

Permalink
trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmyBinoculars committed May 19, 2024
1 parent d1d5a7f commit 30427a6
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 53 deletions.
9 changes: 9 additions & 0 deletions .trunk/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*out
*logs
*actions
*notifications
*tools
plugins
user_trunk.yaml
user.yaml
tmp
2 changes: 2 additions & 0 deletions .trunk/configs/.markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Prettier friendly markdownlint config (all formatting rules disabled)
extends: markdownlint/style/prettier
7 changes: 7 additions & 0 deletions .trunk/configs/.shellcheckrc
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions .trunk/configs/.yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
rules:
quoted-strings:
required: only-when-needed
extra-allowed: ["{|}"]
key-duplicates: {}
octal-values:
forbid-implicit-octal: true
40 changes: 40 additions & 0 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
@@ -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
57 changes: 4 additions & 53 deletions example/index.js
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 30427a6

Please sign in to comment.