Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejoAsd committed Jul 12, 2020
0 parents commit e5da9ea
Show file tree
Hide file tree
Showing 34 changed files with 15,525 additions and 0 deletions.
115 changes: 115 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# Jetbrains IDE
.idea/
6 changes: 6 additions & 0 deletions .idea/vcs.xml

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

38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# ASCII Renderer

<div align="center">
<img src="renders/cube-sphere.gif" width="250" />
<img src="renders/cube.gif" width="250" />
</div>

A basic rendering engine that outputs to a text field. Only supports drawing
vertices and a rotationally fixed camera and light set on the origin.

Done for fun to try out 3D rotations and basic rendering.

Heavily inspired by [`a1k0n's donut.c`](https://www.a1k0n.net/2011/07/20/donut-math.html).

# Installation

To install, make sure you have `node` and `npm` installed on your computer, and
run

```bash
npm install
```

# Usage

To start the project run

```bash
npm start
```

and go to `localhost:8080` in your browser.

Use the arrow keys to rotate target objects.

Shapes in the scene are currently set directly in code. Try tweaking the values
in `index.js` to add different objects to the scene, play with lighting and try
out different character sets.
12 changes: 12 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
presets: [
[
'@babel/preset-env',
{
targets: {
node: 'current',
},
},
],
],
};
11 changes: 11 additions & 0 deletions dist/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>ASCII Renderer</title>
</head>
<body>
<pre id="canvas" style="position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);"></pre>
<script src="./bundle.js"></script>
</body>
</html>
Loading

0 comments on commit e5da9ea

Please sign in to comment.