Establish working stub code (still no build system)

This commit is contained in:
Glen Whitney 2019-11-24 13:15:44 -05:00
parent c83019656e
commit fa63ce50ed
3 changed files with 40 additions and 1 deletions

View File

@ -7,6 +7,7 @@ The intial modest outline for bootstrapping dyna3 is as follows:
- dyna3 will be an npm project, but as it runs entirely client-side, there's no initial concern for being able to run under Node.js. However, npm will be useful as a dependency manager and build tool
- The package will build into a top-level site/directory, which will contain all and only the files that must be on a server to deliver dyna3 to a client browser. Everything in site/ will generated from the package files; nothing in site/ will be committed to the repository. Right now the planned contents a of site/ are just a handful of top-level files, the modules/ directory for in-package javascript, the /doc directory for generated documentation, and a copy of the node_modules/ directory as a backup for the external dependencies.
- Literate coffeescript modules (in the src/modules directory except for the top-level application) will compile into individual js modules in the site/modules directory (again, except for the top-level application)
- Why coffeescript? The motivation for the javascript family of languages is wide deployability and availability of numerous libraries; the motivation for coffeescript is that it (still) reduces the amount of punctuation and extraneous characters from Javascript, resulting in better readability. And Literate coffeescript so that the manual and code are co-located.
- The list of external modules will be harvested from npm, automatically generating a site/modules/externals.js from which specific external items can be imported into the local modules. Within externals.js, modules will be imported from the appropriate CDN, with a fallback to a copy in site/node_modules/ for when the CDN is off line.
- All modules will use ES Modules syntax/format for imports.
- index.html will be minimal, perhaps containing just a title, and maybe a link to generated documentation in the site/doc directory. All of the modules will create the DOM elements needed to display themselves on the fly.
@ -15,5 +16,5 @@ The intial modest outline for bootstrapping dyna3 is as follows:
Specific packages/implementation approaches for components of dyna3 will include:
- For WebGL rendering of the 3D view of the geometry, the three package from npm.
- For test harness for the package: QUnit
-

27
src/dyna3.litcoffee Normal file
View File

@ -0,0 +1,27 @@
## A Brief Tour of dyna3
When you load dyna3, you should initially see a three-dimensional coordinate system with labeled axes.
```javascript
import {threeLoaded, three as J3} from './externals.js'
main = () ->
renderer = new J3.WebGLRenderer()
rwd = window.innerWidth
rht = window.innerHeight
renderer.setSize(rwd, rht)
document.body.appendChild renderer.domElement
scene = new J3.Scene()
geometry = new J3.SphereBufferGeometry(1, 5, 5)
material = new J3.MeshBasicMaterial( {color: 0x0000ff} )
ball = new J3.Mesh(geometry, material)
scene.add ball
camera = new J3.PerspectiveCamera(75, rwd/rht, 0.1, 1000)
camera.position.z = 5
renderer.render(scene, camera)
threeLoaded.then(main)
```

11
src/index.html Normal file
View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>dyna3</title>
</head>
<body><script type="module" src="dyna3.js"></script>
</body>
</html>