add release build. Use FPS Camera and better input.
This commit is contained in:
15
.vscode/launch.json
vendored
Normal file
15
.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name":"Launch index.html",
|
||||||
|
"type": "chrome",
|
||||||
|
"request": "launch",
|
||||||
|
"file": "${workspaceFolder}/index.html",
|
||||||
|
"preLaunchTask": "npm: build:debug"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
15
.vscode/tasks.json
vendored
Normal file
15
.vscode/tasks.json
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||||
|
// for the documentation about the tasks.json format
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"type": "npm",
|
||||||
|
"script": "build",
|
||||||
|
"group": {
|
||||||
|
"kind": "build",
|
||||||
|
"isDefault": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
28
index.html
28
index.html
@@ -84,7 +84,7 @@
|
|||||||
vec3 color = vec3(n) * 0.3;
|
vec3 color = vec3(n) * 0.3;
|
||||||
gl_FragColor = vec4(color,1.0);
|
gl_FragColor = vec4(color,1.0);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script id="ndc-vs" type="x-shader/x-vertex">
|
<script id="ndc-vs" type="x-shader/x-vertex">
|
||||||
attribute vec3 positionAttr;
|
attribute vec3 positionAttr;
|
||||||
|
|
||||||
@@ -188,33 +188,35 @@
|
|||||||
v_uv = positionAttr.xy;
|
v_uv = positionAttr.xy;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script id="texture-fs" type="x-shader/x-fragment">
|
<script id="sky-fs" type="x-shader/x-fragment">
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
uniform sampler2D u_texture;
|
varying vec3 fragPos;
|
||||||
varying vec2 v_uv;
|
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
gl_FragColor = texture2D(u_texture, v_uv);
|
gl_FragColor = vec4(fragPos,1.0);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script id="texture-vs" type="x-shader/x-vertex">
|
<script id="sky-vs" type="x-shader/x-vertex">
|
||||||
attribute vec3 positionAttr;
|
attribute vec3 positionAttr;
|
||||||
attribute vec2 a_uv;
|
|
||||||
|
|
||||||
varying vec2 v_uv;
|
uniform mat4 projection;
|
||||||
uniform mat4 u_mvp;
|
uniform mat4 view;
|
||||||
|
uniform mat4 testModel;
|
||||||
|
|
||||||
|
varying vec3 fragPos;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
gl_Position = u_mvp * vec4(positionAttr, 1.0);
|
gl_PointSize = 10.;
|
||||||
v_uv = a_uv;
|
gl_Position = projection * mat4(mat3(view)) * vec4(positionAttr, 1.0);
|
||||||
|
fragPos = (view * vec4(positionAttr,1.0)).xyz; //This is wrong probably
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<canvas id="window" width="800" height="600"
|
<canvas id="window" width="800" height="600"
|
||||||
style="margin:0 auto; border: solid #000000 1px; display:block;"></canvas>
|
style="margin:0 auto; border: solid #000000 1px; display:block; cursor:move;"></canvas>
|
||||||
<script src="build/app.js"></script>
|
<script src="build/app.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
11
package.json
11
package.json
@@ -4,8 +4,11 @@
|
|||||||
"description": "Simulating a ocean with typescript and webgl.",
|
"description": "Simulating a ocean with typescript and webgl.",
|
||||||
"main": "index.html",
|
"main": "index.html",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"livedev": "concurrently --kill-others \"npm-watch\"",
|
||||||
"build": "tsc && browserify ./build/main.js -o ./build/app.js"
|
"build:release": "tsc && browserify ./build/main.js | uglifyjs > ./build/app.js",
|
||||||
|
"build:debug": "tsc && browserify --debug ./build/main.js -o ./build/app.js",
|
||||||
|
"build:tsc": "tsc",
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"webgl",
|
"webgl",
|
||||||
@@ -20,7 +23,9 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/gl-matrix": "^2.4.5",
|
"@types/gl-matrix": "^2.4.5",
|
||||||
"browserify": "^16.5.0",
|
"browserify": "^16.5.0",
|
||||||
"typescript": "^3.7.5"
|
"concurrently": "^5.1.0",
|
||||||
|
"typescript": "^3.7.5",
|
||||||
|
"uglifyjs": "^2.4.11"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"gl-matrix": "^3.1.0"
|
"gl-matrix": "^3.1.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user