-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
991 additions
and
291 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,21 @@ | ||
const webpack = require('webpack'); | ||
const p = require('path'); | ||
const readDir = require('readdir'); | ||
const fs = require('fs-promise'); | ||
|
||
|
||
async function dasbootGen(projectPath) { | ||
const dasBootSourceDirectoryPath = p.join(__dirname, '../dasBoot'); | ||
const dasBootLibSourceFilePaths = readDir.readSync( | ||
dasBootSourceDirectoryPath, | ||
['lib/*.js'], | ||
readDir.ABSOLUTE_PATHS | ||
).sort(); | ||
const dasBootSourceFilePaths = readDir.readSync( | ||
dasBootSourceDirectoryPath, | ||
['*.js'], | ||
readDir.ABSOLUTE_PATHS | ||
).sort(); | ||
|
||
const dasBootDestinationFilePath = p.join(projectPath, 'gen', 'dasBoot.js'); | ||
const allFiles = dasBootLibSourceFilePaths.concat(dasBootSourceFilePaths); | ||
Promise.all(allFiles.map(file => fs.readFile(file))) | ||
.then(files => fs.writeFile(dasBootDestinationFilePath, Buffer.concat(files))); | ||
return new Promise((resolve, reject) => { | ||
webpack({ | ||
entry: [ | ||
p.join(__dirname, '..', 'dasBoot', 'bootstrap.js') | ||
], | ||
output: { | ||
path: p.join(projectPath, 'gen'), | ||
filename: 'dasBoot.js', | ||
} | ||
}).run(err => { | ||
err ? reject() : resolve(); | ||
}); | ||
}); | ||
} | ||
|
||
module.exports = dasbootGen; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,32 @@ | ||
(function() { | ||
var framesPerBEAT; | ||
var framesPerBEAT; | ||
window.BEAN = 0; | ||
window.BEAT = false; | ||
|
||
initBeatBean = function() { | ||
BEAN = 0; | ||
BEAT = false; | ||
const initBeatBean = function() { | ||
window.BEAN = 0; | ||
window.BEAT = false; | ||
|
||
var BEATsPerMinute = PROJECT.music.bpm * PROJECT.music.subdivision; | ||
var BEATsPerSecond = BEATsPerMinute / 60; | ||
var framesPerSecond = 60; | ||
framesPerBEAT = framesPerSecond / BEATsPerSecond; | ||
var BEATsPerMinute = PROJECT.music.bpm * PROJECT.music.subdivision; | ||
var BEATsPerSecond = BEATsPerMinute / 60; | ||
var framesPerSecond = 60; | ||
framesPerBEAT = framesPerSecond / BEATsPerSecond; | ||
|
||
BEAN_FOR_FRAME = function(frame) { | ||
return (frame + 1.5) / framesPerBEAT | 0; | ||
}; | ||
|
||
FRAME_FOR_BEAN = function(bean) { | ||
return (bean * framesPerBEAT - 0.5) | 0; | ||
}; | ||
window.BEAN_FOR_FRAME = function(frame) { | ||
return (frame + 1.5) / framesPerBEAT | 0; | ||
}; | ||
|
||
updateBeatBean = function(frame) { | ||
BEAT = false; | ||
if ((((frame + 1.5) / framesPerBEAT) | 0) > | ||
((frame + 0.5) / framesPerBEAT) | 0) { | ||
BEAT = true; | ||
} | ||
BEAN = (frame + 1.5) / framesPerBEAT | 0; | ||
window.FRAME_FOR_BEAN = function(bean) { | ||
return (bean * framesPerBEAT - 0.5) | 0; | ||
}; | ||
})(); | ||
}; | ||
|
||
const updateBeatBean = function(frame) { | ||
window.BEAT = false; | ||
if ((((frame + 1.5) / framesPerBEAT) | 0) > | ||
((frame + 0.5) / framesPerBEAT) | 0) { | ||
window.BEAT = true; | ||
} | ||
window.BEAN = (frame + 1.5) / framesPerBEAT | 0; | ||
}; | ||
|
||
module.exports = {initBeatBean, updateBeatBean}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,5 @@ function Random(seed){ | |
return result + 0.5; | ||
} | ||
} | ||
|
||
module.exports = Random; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,29 @@ | ||
(function(NIN) { | ||
'use strict'; | ||
class RootNode extends NIN.Node { | ||
constructor(id, options) { | ||
super(id, { | ||
inputs: {screen: new NIN.TextureInput()} | ||
}); | ||
|
||
class RootNode extends NIN.Node { | ||
constructor(id, options) { | ||
super(id, { | ||
inputs: {screen: new NIN.TextureInput()} | ||
}); | ||
|
||
this.camera = new THREE.OrthographicCamera(-1, 1, 1, -1, 0, 1); | ||
this.scene = new THREE.Scene(); | ||
this.quad = new THREE.Mesh(new THREE.PlaneBufferGeometry(2, 2), null); | ||
this.scene.add(this.quad); | ||
this.material = new THREE.MeshBasicMaterial(); | ||
} | ||
this.camera = new THREE.OrthographicCamera(-1, 1, 1, -1, 0, 1); | ||
this.scene = new THREE.Scene(); | ||
this.quad = new THREE.Mesh(new THREE.PlaneBufferGeometry(2, 2), null); | ||
this.scene.add(this.quad); | ||
this.material = new THREE.MeshBasicMaterial(); | ||
} | ||
|
||
render(renderer) { | ||
if(renderer.overrideToScreenTexture) { | ||
this.quad.material = new THREE.MeshBasicMaterial({ | ||
map: renderer.overrideToScreenTexture | ||
}); | ||
} else { | ||
var A = this.inputs.screen.getValue(); | ||
this.quad.material = new THREE.MeshBasicMaterial({ | ||
map: A | ||
}); | ||
} | ||
renderer.render(this.scene, this.camera); | ||
render(renderer) { | ||
if(renderer.overrideToScreenTexture) { | ||
this.quad.material = new THREE.MeshBasicMaterial({ | ||
map: renderer.overrideToScreenTexture | ||
}); | ||
} else { | ||
var A = this.inputs.screen.getValue(); | ||
this.quad.material = new THREE.MeshBasicMaterial({ | ||
map: A | ||
}); | ||
} | ||
renderer.render(this.scene, this.camera); | ||
} | ||
} | ||
|
||
NIN.RootNode = RootNode; | ||
})(this.NIN); | ||
|
||
module.exports = RootNode; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,43 @@ | ||
(function(NIN) { | ||
'use strict'; | ||
|
||
class ShaderNode extends NIN.Node { | ||
constructor(id, options) { | ||
super(id, { | ||
inputs: options.inputs, | ||
outputs: { | ||
render: new NIN.TextureOutput() | ||
} | ||
}); | ||
|
||
this.scene = new THREE.Scene(); | ||
this.camera = new THREE.OrthographicCamera(-1, 1, 1, -1, 0, 100); | ||
this.renderTarget = new THREE.WebGLRenderTarget(640, 360, { | ||
minFilter: THREE.LinearFilter, | ||
magFilter: THREE.LinearFilter, | ||
format: THREE.RGBFormat | ||
}); | ||
|
||
const shader = typeof options.shader === 'string' | ||
? SHADERS[options.shader] : options.shader; | ||
|
||
this.quad = new THREE.Mesh( | ||
new THREE.PlaneBufferGeometry(2, 2), | ||
new THREE.ShaderMaterial(shader).clone()); | ||
this.uniforms = this.quad.material.uniforms; | ||
|
||
this.scene.add(this.quad); | ||
this.resize(); | ||
} | ||
|
||
update() { | ||
} | ||
|
||
resize() { | ||
this.renderTarget.setSize(16 * GU, 9 * GU); | ||
} | ||
|
||
render(renderer) { | ||
renderer.render(this.scene, this.camera, this.renderTarget, true); | ||
this.outputs.render.setValue(this.renderTarget.texture); | ||
} | ||
class ShaderNode extends NIN.Node { | ||
constructor(id, options) { | ||
super(id, { | ||
inputs: options.inputs, | ||
outputs: { | ||
render: new NIN.TextureOutput() | ||
} | ||
}); | ||
|
||
this.scene = new THREE.Scene(); | ||
this.camera = new THREE.OrthographicCamera(-1, 1, 1, -1, 0, 100); | ||
this.renderTarget = new THREE.WebGLRenderTarget(640, 360, { | ||
minFilter: THREE.LinearFilter, | ||
magFilter: THREE.LinearFilter, | ||
format: THREE.RGBFormat | ||
}); | ||
|
||
const shader = typeof options.shader === 'string' | ||
? SHADERS[options.shader] : options.shader; | ||
|
||
this.quad = new THREE.Mesh( | ||
new THREE.PlaneBufferGeometry(2, 2), | ||
new THREE.ShaderMaterial(shader).clone()); | ||
this.uniforms = this.quad.material.uniforms; | ||
|
||
this.scene.add(this.quad); | ||
this.resize(); | ||
} | ||
|
||
NIN.ShaderNode = ShaderNode; | ||
})(this.NIN); | ||
update() { | ||
} | ||
|
||
resize() { | ||
this.renderTarget.setSize(16 * GU, 9 * GU); | ||
} | ||
|
||
render(renderer) { | ||
renderer.render(this.scene, this.camera, this.renderTarget, true); | ||
this.outputs.render.setValue(this.renderTarget.texture); | ||
} | ||
} | ||
|
||
module.exports = ShaderNode; |
Oops, something went wrong.