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
Andor
authored and
Andor
committed
Mar 2, 2011
1 parent
ca3027a
commit 48f2380
Showing
10 changed files
with
512 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,42 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/> | ||
<title>Sundae</title> | ||
<script type="text/javascript" src="sundae.js" ></script> | ||
</head> | ||
<body> | ||
<h1>Sundae Ref Test Runner</h1> | ||
<h3>Settings</h3> | ||
<div id="setup">Run Tests: | ||
<select id="type"> | ||
<option value="a" selected="selected">All</option> | ||
<option value="s">Static</option> | ||
<option value="c">Calibration</option> | ||
</select> | ||
Blur Radius: <input type="text" size="2" id="sigma" value="2"/> | ||
Epsilon (0-1.0): <input type="text" size="4" id="epsilon" value="0.05"/> | ||
</div> | ||
<script type="text/javascript"> | ||
var d = document; | ||
var t = d.getElementById("type").value; | ||
var s = d.getElementById("sigma").value; | ||
var e = d.getElementById("epsilon").value; | ||
var b = d.createElement("input"); | ||
b.setAttribute("type", "Button"); | ||
b.setAttribute("name", "Test!"); | ||
b.setAttribute("value", "Begin Tests"); | ||
b.setAttribute("onClick", "beginTester();"); | ||
d.getElementById("setup").appendChild(b); | ||
|
||
function beginTester() { | ||
//Optional Global Setters | ||
sundae.setBlurRadius(s); | ||
sundae.setTolerance(e); | ||
sundae.setTestTag(t); | ||
//Start tester | ||
sundae.init(); | ||
} | ||
</script> | ||
</body> | ||
</html> |
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,16 @@ | ||
function start(cvs){ | ||
var acorn; | ||
var ps = new PointStream(); | ||
ps.setup(cvs); | ||
ps.pointSize(5); | ||
ps.onRender = function(){ | ||
ps.background([1, 1, 1, 1]); | ||
ps.clear(); | ||
ps.translate(0, 0, -25); | ||
ps.render(acorn); | ||
if(acorn.status === 3){ | ||
ps.onRender = function(){}; | ||
} | ||
}; | ||
acorn = ps.load('../../clouds/acorn.asc'); | ||
} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,16 @@ | ||
function start(cvs){ | ||
var pointCloud; | ||
var ps = new PointStream(); | ||
ps.setup(cvs); | ||
ps.pointSize(5); | ||
ps.onRender = function(){ | ||
ps.background([1,1,1,1]); | ||
ps.clear(); | ||
ps.translate(0, 0, -25); | ||
ps.render(pointCloud); | ||
if(pointCloud.status === 3){ | ||
ps.onRender = function(){}; | ||
} | ||
}; | ||
pointCloud = ps.load('../../clouds/acorn_only_verts.asc'); | ||
} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,42 @@ | ||
{ | ||
"testSuite": [{ | ||
"test": | ||
[ | ||
{ | ||
"name": "user shader", | ||
"dependancyURL": ["../../mjs.js", | ||
"../../psapi.js", | ||
"../../parsers/asc.js", | ||
"resources/user_shader/user_shader.js"], | ||
"referenceImageURL": "resources/user_shader/mickey_lit.png", | ||
"run": {"src": "resources/user_shader/test.js", "func": "start" } | ||
}, | ||
|
||
{ | ||
"name": "only verts", | ||
"dependancyURL": ["../../mjs.js", | ||
"../../psapi.js", | ||
"../../parsers/asc.js"], | ||
"referenceImageURL": "resources/only_verts.png", | ||
"run": {"src": "resources/only_verts.js", "func": "start" } | ||
}, | ||
{ | ||
"name": "1", | ||
"dependancyURL": ["../../mjs.js", | ||
"../../psapi.js", | ||
"../../parsers/asc.js"], | ||
"referenceImageURL": "resources/acorn_unlit.png", | ||
"run": {"src": "resources/acorn_unlit.js", "func": "start" } | ||
}, | ||
{ | ||
"name": "2", | ||
"dependancyURL": ["../../mjs.js", | ||
"../../psapi.js", | ||
"../../parsers/asc.js"], | ||
"referenceImageURL": "resources/acorn_unlit.png", | ||
"run": {"src": "resources/acorn_unlit.js", "func": "start" } | ||
} | ||
] | ||
}] | ||
} | ||
|
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,20 @@ | ||
function start(cvs){ | ||
var ps, pointCloud; | ||
ps = new PointStream(); | ||
ps.setup(cvs); | ||
ps.onRender = function(){ | ||
ps.clear(); | ||
ps.uniformi("reflection", false); | ||
ps.uniformf("lightPos", [0, 50, 10]); | ||
ps.uniformf("uReflection", [1, 1, 1, 1]); | ||
ps.translate(0, 10, -80); | ||
ps.render(pointCloud); | ||
if(pointCloud.status === 3){ | ||
ps.onRender = function(){}; | ||
} | ||
}; | ||
var progObj = ps.createProgram(vertShader, fragShader); | ||
ps.useProgram(progObj); | ||
ps.pointSize(10); | ||
pointCloud = ps.load("../../clouds/mickey.asc"); | ||
} |
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,62 @@ | ||
var vertShader = | ||
"varying vec4 frontColor;" + | ||
|
||
"attribute vec3 ps_Vertex;" + | ||
"attribute vec3 ps_Normal;" + | ||
"attribute vec4 ps_Color;" + | ||
|
||
"uniform float ps_PointSize;" + | ||
"uniform vec3 ps_Attenuation;" + | ||
|
||
"uniform vec3 lightPos;" + | ||
"uniform bool reflection;"+ | ||
|
||
"uniform mat4 ps_ModelViewMatrix;" + | ||
"uniform mat4 ps_ProjectionMatrix;" + | ||
"uniform mat4 ps_NormalMatrix;" + | ||
|
||
"void PointLight(inout vec3 col, in vec3 ecPos, in vec3 vertNormal) {" + | ||
" vec3 VP = lightPos - ecPos;" + | ||
" VP = normalize( VP );" + | ||
" float nDotVP = max( 0.0, dot( vertNormal, VP ));" + | ||
" col += vec3(1.0, 1.0, 1.0) * nDotVP;" + | ||
"}" + | ||
|
||
"void main(void) {" + | ||
" vec3 transNorm = vec3(ps_NormalMatrix * vec4(ps_Normal, 0.0));" + | ||
|
||
" vec4 ecPos4 = ps_ModelViewMatrix * vec4(ps_Vertex, 1.0);" + | ||
" vec3 ecPos = (vec3(ecPos4))/ecPos4.w;" + | ||
|
||
" vec3 col = vec3(0.0, 0.0, 0.0);" + | ||
" PointLight(col, ecPos, transNorm);" + | ||
|
||
" frontColor = ps_Color * vec4(col, 1.0);" + | ||
|
||
" if(reflection){" + | ||
" float l = length(ps_Vertex - vec3(0.0, -20.0, 0.0))/20.0;" + | ||
// magic number that super saturates to white | ||
" float col = l * 5.0;" + | ||
" frontColor += vec4(col, col, col, 1.0);" + | ||
" }" + | ||
|
||
" float dist = length( ecPos4 );" + | ||
" float attn = ps_Attenuation[0] + " + | ||
" (ps_Attenuation[1] * dist) + " + | ||
" (ps_Attenuation[2] * dist * dist);" + | ||
|
||
" gl_PointSize = ps_PointSize * sqrt(1.0/attn);" + | ||
" gl_Position = ps_ProjectionMatrix * ecPos4;" + | ||
"}"; | ||
|
||
var fragShader = | ||
"#ifdef GL_ES\n" + | ||
" precision highp float;\n" + | ||
"#endif\n" + | ||
|
||
"uniform vec4 uReflection;" + | ||
|
||
"varying vec4 frontColor;" + | ||
"void main(void){" + | ||
" gl_FragColor = frontColor * uReflection;" + | ||
"}"; |
Oops, something went wrong.