add render chain

This commit is contained in:
casperlamboo 2017-11-06 17:23:21 +01:00
parent c0dde779e1
commit 5080402c85
2 changed files with 21 additions and 1 deletions

19
src/d3/RenderChain.js vendored Normal file
View File

@ -0,0 +1,19 @@
export default class RenderChain {
constructor(renderer, scene, camera) {
this._renderer = renderer;
this._scene = scene;
this._camera = camera;
}
setSize(width, height) {
this._renderer.setSize(width, height);
// adjust aspect ratio of camera
this._camera.aspect = width / height;
this._camera.updateProjectionMatrix();
}
render() {
this._renderer.render(this._scene, this._camera);
}
}

3
src/d3/index.js vendored
View File

@ -1,7 +1,8 @@
import createSceneData from './createSceneData.js'; import createSceneData from './createSceneData.js';
import createScene from './createScene.js'; import createScene from './createScene.js';
import RenderChain from './RenderChain.js';
import ToonShaderRenderChain from './ToonShaderRenderChain.js'; import ToonShaderRenderChain from './ToonShaderRenderChain.js';
import ShapeMesh from './ShapeMesh.js'; import ShapeMesh from './ShapeMesh.js';
import ShapesManager from './ShapesManager.js'; import ShapesManager from './ShapesManager.js';
export { createSceneData, createScene, ToonShaderRenderChain, ShapeMesh, ShapesManager }; export { createSceneData, createScene, RenderChain, ToonShaderRenderChain, ShapeMesh, ShapesManager };