-
Notifications
You must be signed in to change notification settings - Fork 8
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
Ziwei Zong
authored and
Ziwei Zong
committed
Nov 14, 2015
1 parent
44f602a
commit 49439db
Showing
17 changed files
with
43,118 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Basic Three trytry.js App</title> | ||
<script src="lib/jquery-2.1.4.min.js"></script> | ||
<script src="lib/es6-promise.min.js"></script> | ||
|
||
<script src="lib/three.js"></script> | ||
<script src="lib/OrbitControls.js"></script> | ||
<script src="lib/OBJLoader.js"></script> | ||
<script src="lib/webgl-debug.js"></script> | ||
<script src="lib/seedrandom.min.js"></script> | ||
|
||
<script src="lib/stats.min.js"></script> | ||
<script src="lib/dat.gui.js"></script> | ||
|
||
<script src="js/main.js"></script> | ||
<script src="js/BasicTry.js"></script> | ||
<style> | ||
html, body { margin: 0; padding: 0; overflow: hidden; } | ||
</style> | ||
</head> | ||
<body> | ||
<canvas id="canvas" width="800px" height="600px"></canvas> | ||
</body> | ||
</html> |
Binary file not shown.
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 |
---|---|---|
@@ -0,0 +1,93 @@ | ||
var gl, gl_draw_buffers; | ||
var width, height; | ||
|
||
(function() { | ||
'use strict'; | ||
|
||
var canvas,camera,renderer; | ||
var shaderProgram; | ||
|
||
var initExtensions = function() { | ||
var extensions = gl.getSupportedExtensions(); | ||
console.log(extensions); | ||
|
||
var reqd = [ | ||
'OES_texture_float', | ||
'OES_texture_float_linear', | ||
'WEBGL_depth_texture', | ||
'WEBGL_draw_buffers' | ||
]; | ||
for (var i = 0; i < reqd.length; i++) { | ||
var e = reqd[i]; | ||
if (extensions.indexOf(e) < 0) { | ||
abort('unable to load extension: ' + e); | ||
} | ||
} | ||
|
||
gl.getExtension('OES_texture_float'); | ||
gl.getExtension('OES_texture_float_linear'); | ||
gl.getExtension('WEBGL_depth_texture'); | ||
|
||
gl_draw_buffers = gl.getExtension('WEBGL_draw_buffers'); | ||
var maxdb = gl.getParameter(gl_draw_buffers.MAX_DRAW_BUFFERS_WEBGL); | ||
console.log('MAX_DRAW_BUFFERS_WEBGL: ' + maxdb); | ||
}; | ||
|
||
|
||
|
||
var InitGL = function() | ||
{ | ||
canvas = document.getElementById('canvas'); | ||
renderer = new THREE.WebGLRenderer({ | ||
canvas: canvas, | ||
preserveDrawingBuffer: false | ||
}); | ||
gl = renderer.context; | ||
|
||
initExtensions();//???_!!!_change to not using renderer later... | ||
|
||
camera = new THREE.PerspectiveCamera( | ||
45, // Field of view | ||
canvas.width / canvas.height, // Aspect ratio | ||
1.0, // Near plane | ||
100 // Far plane | ||
); | ||
camera.position.set(-15.5, 1, -1); | ||
|
||
//1. fill in positions | ||
//2. fill in indices | ||
//3. disable vsync & setup springs | ||
//4. Setup * massSpringShader | ||
// * particleShader | ||
// * renderShader | ||
//5. create vbo | ||
//6. setup transform feedback attributes | ||
} | ||
|
||
var Simulate = function() | ||
{ | ||
//1. Use massSpringShader | ||
// Active..Bind..etc | ||
// Begin Transform Feedback | ||
// glDarwArrays | ||
// End Transform Feedback | ||
|
||
//2. Use renderShader | ||
|
||
//3. Use particleShader | ||
} | ||
|
||
var OnRender = function() | ||
{ | ||
//... | ||
Simulate(); | ||
} | ||
|
||
var mainInit = function() | ||
{ | ||
InitGL(); | ||
requestAnimationFrame(OnRender); | ||
} | ||
|
||
window.handle_load.push(mainInit); | ||
})(); |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
var handle_load = []; | ||
|
||
(function() { | ||
'use strict'; | ||
|
||
window.onload = function() { | ||
for (var i = 0; i < handle_load.length; i++) { | ||
handle_load[i](); | ||
} | ||
}; | ||
})(); |
Oops, something went wrong.