idk
This commit is contained in:
1 parent
a1608702ed
commit
e306b64edf
221 files changed
+47803
No files matched your search
@@ -0,0 +1 @@
|
||||
*.js linguist-detectable=false
|
||||
@@ -0,0 +1,2 @@
|
||||
.vscode
|
||||
node_modules
|
||||
@@ -0,0 +1,5 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- node
|
||||
script:
|
||||
- npm run build
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 swift502
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,103 @@
|
||||
<p align="center">
|
||||
<a href="https://jblaha.art/sketchbook/latest"><img src="./src/img/thumbnail.png"></a>
|
||||
<br>
|
||||
<a href="https://jblaha.art/sketchbook/latest">Live demo</a>
|
||||
<br>
|
||||
</p>
|
||||
|
||||
[](https://www.npmjs.com/package/sketchbook)
|
||||
[](https://travis-ci.org/swift502/Sketchbook)
|
||||
[](https://discord.gg/fGuEqCe)
|
||||
|
||||
# Final update (20. Feb 2023)
|
||||
|
||||
As I have no more interest in developing this project, it comes to a conclusion. In order to remain honest about the true state of the project, I am archiving this repository.
|
||||
|
||||
- If you wish to modify Sketchbook feel free to fork it.
|
||||
- To see if someone is currently maintaining a fork, check out the [Network Graph](https://github.com/swift502/Sketchbook/network).
|
||||
- The [NPM package](https://www.npmjs.com/package/sketchbook) name is available, and I'll give it away to anyone who asks for it. The package has never worked properly.
|
||||
|
||||
# 📒 Sketchbook
|
||||
|
||||
Simple web based game engine built on [three.js](https://github.com/mrdoob/three.js) and [cannon.js](https://github.com/schteppe/cannon.js) focused on third-person character controls and related gameplay mechanics.
|
||||
|
||||
Mostly a playground for exploring how conventional third person gameplay mechanics found in modern games work and recreating them in a general way.
|
||||
|
||||
## Features
|
||||
|
||||
* World
|
||||
* Three.js scene
|
||||
* Cannon.js physics
|
||||
* Variable timescale
|
||||
* Frame skipping
|
||||
* FXAA anti-aliasing
|
||||
* Characters
|
||||
* Third-person camera
|
||||
* Raycast character controller with capsule collisions
|
||||
* General state system
|
||||
* Character AI
|
||||
* Vehicles
|
||||
* Cars
|
||||
* Airplanes
|
||||
* Helicopters
|
||||
|
||||
All planned features can be found in the [GitHub Projects](https://github.com/swift502/Sketchbook/projects).
|
||||
|
||||
## Usage
|
||||
|
||||
You can define your own scenes in Blender, and then read them with Sketchbook. Sketchbook needs to run on a local server such as [http-server](https://www.npmjs.com/package/http-server) or [webpack-dev-server](https://github.com/webpack/webpack-dev-server) to be able to load external assets.
|
||||
|
||||
<!-- #### Script tag -->
|
||||
|
||||
1. Import:
|
||||
|
||||
```html
|
||||
<script src="sketchbook.min.js"></script>
|
||||
```
|
||||
|
||||
2. Load a glb scene defined in Blender:
|
||||
|
||||
```javascript
|
||||
const world = new Sketchbook.World('scene.glb');
|
||||
```
|
||||
|
||||
<!--
|
||||
|
||||
#### NPM
|
||||
|
||||
1. Install:
|
||||
|
||||
```
|
||||
npm i sketchbook
|
||||
```
|
||||
|
||||
2. Import:
|
||||
|
||||
```javascript
|
||||
import { World } from 'sketchbook';
|
||||
```
|
||||
|
||||
3. Load a glb scene defined in Blender:
|
||||
|
||||
```javascript
|
||||
const world = new World('scene.glb');
|
||||
```
|
||||
|
||||
-->
|
||||
|
||||
## Contributing
|
||||
|
||||
1. Get the LTS version of [Node.js](https://nodejs.org/en/) 16
|
||||
2. [Fork this repository](https://help.github.com/en/github/getting-started-with-github/fork-a-repo)
|
||||
3. Run `npm install`
|
||||
4. Run `npm run dev`
|
||||
5. Make changes and test them out at http://localhost:8080
|
||||
6. Commit and [make a pull request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork)!
|
||||
|
||||
## Credits
|
||||
|
||||
Big thank you to each of the following github users for contributing to Sketchbook:
|
||||
|
||||
- [aleqsunder](https://github.com/aleqsunder)
|
||||
- [barhatsor](https://github.com/barhatsor)
|
||||
- [danshuri](https://github.com/danshuri)
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,41 @@
|
||||
/*!
|
||||
* Sketchbook 0.4 (https://github.com/swift502/Sketchbook)
|
||||
* Built on three.js (https://github.com/mrdoob/three.js) and cannon.js (https://github.com/schteppe/cannon.js)
|
||||
*/
|
||||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Sketchbook=e():t.Sketchbook=e()}(window,(function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=31)}([function(t,e,n){"use strict";n.r(e),n.d(e,"ACESFilmicToneMapping",(function(){return ct})),n.d(e,"AddEquation",(function(){return C})),n.d(e,"AddOperation",(function(){return nt})),n.d(e,"AdditiveBlending",(function(){return E})),n.d(e,"AlphaFormat",(function(){return jt})),n.d(e,"AlwaysDepth",(function(){return X})),n.d(e,"AlwaysStencilFunc",(function(){return hn})),n.d(e,"AmbientLight",(function(){return Ku})),n.d(e,"AmbientLightProbe",(function(){return xh})),n.d(e,"AnimationClip",(function(){return iu})),n.d(e,"AnimationLoader",(function(){return hu})),n.d(e,"AnimationMixer",(function(){return Qh})),n.d(e,"AnimationObjectGroup",(function(){return Xh})),n.d(e,"AnimationUtils",(function(){return Gl})),n.d(e,"ArcCurve",(function(){return xu})),n.d(e,"ArrayCamera",(function(){return fs})),n.d(e,"ArrowHelper",(function(){return Dd})),n.d(e,"Audio",(function(){return Lh})),n.d(e,"AudioAnalyser",(function(){return Nh})),n.d(e,"AudioContext",(function(){return fh})),n.d(e,"AudioListener",(function(){return Ph})),n.d(e,"AudioLoader",(function(){return mh})),n.d(e,"AxesHelper",(function(){return kd})),n.d(e,"AxisHelper",(function(){return Gp})),n.d(e,"BackSide",(function(){return g})),n.d(e,"BasicDepthPacking",(function(){return We})),n.d(e,"BasicShadowMap",(function(){return d})),n.d(e,"BinaryTextureLoader",(function(){return Qp})),n.d(e,"Bone",(function(){return qs})),n.d(e,"BooleanKeyframeTrack",(function(){return Kl})),n.d(e,"BoundingBoxHelper",(function(){return Wp})),n.d(e,"Box2",(function(){return rd})),n.d(e,"Box3",(function(){return Mi})),n.d(e,"Box3Helper",(function(){return Od})),n.d(e,"BoxBufferGeometry",(function(){return eo})),n.d(e,"BoxGeometry",(function(){return to})),n.d(e,"BoxHelper",(function(){return Rd})),n.d(e,"BufferAttribute",(function(){return lr})),n.d(e,"BufferGeometry",(function(){return Pr})),n.d(e,"BufferGeometryLoader",(function(){return nh})),n.d(e,"ByteType",(function(){return Rt})),n.d(e,"Cache",(function(){return ou})),n.d(e,"Camera",(function(){return ao})),n.d(e,"CameraHelper",(function(){return Pd})),n.d(e,"CanvasRenderer",(function(){return Jp})),n.d(e,"CanvasTexture",(function(){return yc})),n.d(e,"CatmullRomCurve3",(function(){return Au})),n.d(e,"CineonToneMapping",(function(){return st})),n.d(e,"CircleBufferGeometry",(function(){return Rl})),n.d(e,"CircleGeometry",(function(){return Cl})),n.d(e,"ClampToEdgeWrapping",(function(){return yt})),n.d(e,"Clock",(function(){return Sh})),n.d(e,"ClosedSplineCurve3",(function(){return Up})),n.d(e,"Color",(function(){return tr})),n.d(e,"ColorKeyframeTrack",(function(){return Zl})),n.d(e,"CompressedTexture",(function(){return gc})),n.d(e,"CompressedTextureLoader",(function(){return du})),n.d(e,"ConeBufferGeometry",(function(){return Ll})),n.d(e,"ConeGeometry",(function(){return Pl})),n.d(e,"CubeCamera",(function(){return co})),n.d(e,"CubeGeometry",(function(){return to})),n.d(e,"CubeReflectionMapping",(function(){return ut})),n.d(e,"CubeRefractionMapping",(function(){return ht})),n.d(e,"CubeTexture",(function(){return Fo})),n.d(e,"CubeTextureLoader",(function(){return mu})),n.d(e,"CubeUVReflectionMapping",(function(){return mt})),n.d(e,"CubeUVRefractionMapping",(function(){return vt})),n.d(e,"CubicBezierCurve",(function(){return Lu})),n.d(e,"CubicBezierCurve3",(function(){return Cu})),n.d(e,"CubicInterpolant",(function(){return ql})),n.d(e,"CullFaceBack",(function(){return s})),n.d(e,"CullFaceFront",(function(){return c})),n.d(e,"CullFaceFrontBack",(function(){return l})),n.d(e,"CullFaceNone",(function(){return a})),n.d(e,"Curve",(function(){return gu})),n.d(e,"CurvePath",(function(){return Du})),n.d(e,"CustomBlending",(function(){return L})),n.d(e,"CylinderBufferGeometry",(function(){return Tl})),n.d(e,"CylinderGeometry",(function(){return El})),n.d(e,"Cylindrical",(function(){return nd})),n.d(e,"DataTextureLine truncated
|
||||
//!\ DECLARE ALIAS AFTER assign prototype !
|
||||
Object.assign(Wl.prototype,{beforeStart_:Wl.prototype.copySampleValue_,afterEnd_:Wl.prototype.copySampleValue_}),ql.prototype=Object.assign(Object.create(Wl.prototype),{constructor:ql,DefaultSettings_:{endingStart:Re,endingEnd:Re},intervalChanged_:function(t,e,n){var i=this.parameterPositions,r=t-2,o=t+1,a=i[r],s=i[o];if(void 0===a)switch(this.getSettings_().endingStart){case Oe:r=t,a=2*e-n;break;case Fe:a=e+i[r=i.length-2]-i[r+1];break;default:r=t,a=n}if(void 0===s)switch(this.getSettings_().endingEnd){case Oe:o=t,s=2*n-e;break;case Fe:o=1,s=n+i[1]-i[0];break;default:o=t-1,s=e}var c=.5*(n-e),l=this.valueSize;this._weightPrev=c/(e-a),this._weightNext=c/(s-n),this._offsetPrev=r*l,this._offsetNext=o*l},interpolate_:function(t,e,n,i){for(var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=t*a,c=s-a,l=this._offsetPrev,u=this._offsetNext,h=this._weightPrev,d=this._weightNext,p=(n-e)/(i-e),f=p*p,m=f*p,v=-h*m+2*h*f-h*p,g=(1+h)*m+(-1.5-2*h)*f+(-.5+h)*p+1,y=(-1-d)*m+(1.5+d)*f+.5*p,x=d*m-d*f,w=0;w!==a;++w)r[w]=v*o[l+w]+g*o[c+w]+y*o[s+w]+x*o[u+w];return r}}),Xl.prototype=Object.assign(Object.create(Wl.prototype),{constructor:Xl,interpolate_:function(t,e,n,i){for(var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=t*a,c=s-a,l=(n-e)/(i-e),u=1-l,h=0;h!==a;++h)r[h]=o[c+h]*u+o[s+h]*l;return r}}),Yl.prototype=Object.assign(Object.create(Wl.prototype),{constructor:Yl,interpolate_:function(t){return this.copySampleValue_(t-1)}}),Object.assign(Ql,{toJSON:function(t){var e,n=t.constructor;if(void 0!==n.toJSON)e=n.toJSON(t);else{e={name:t.name,times:Gl.convertArray(t.times,Array),values:Gl.convertArray(t.values,Array)};var i=t.getInterpolation();i!==t.DefaultInterpolation&&(e.interpolation=i)}return e.type=t.ValueTypeName,e}}),Object.assign(Ql.prototype,{constructor:Ql,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:Le,InterpolantFactoryMethodDiscrete:function(t){return new Yl(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodLinear:function(t){return new Xl(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:function(t){return new ql(this.times,this.values,this.getValueSize(),t)},setInterpolation:function(t){var e;switch(t){case Pe:e=this.InterpolantFactoryMethodDiscrete;break;case Le:e=this.InterpolantFactoryMethodLinear;break;case Ce:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){var n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(n);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=e,this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Pe;case this.InterpolantFactoryMethodLinear:return Le;case this.InterpolantFactoryMethodSmooth:return Ce}},getValueSize:function(){return this.values.length/this.times.length},shift:function(t){if(0!==t)for(var e=this.times,n=0,i=e.length;n!==i;++n)e[n]+=t;return this},scale:function(t){if(1!==t)for(var e=this.times,n=0,i=e.length;n!==i;++n)e[n]*=t;return this},trim:function(t,e){for(var n=this.times,i=n.length,r=0,o=i-1;r!==i&&n[r]<t;)++r;for(;-1!==o&&n[o]>e;)--o;if(++o,0!==r||o!==i){r>=o&&(r=(o=Math.max(o,1))-1);var a=this.getValueSize();this.times=Gl.arraySlice(n,r,o),this.values=Gl.arraySlice(this.values,r*a,o*a)}return this},validate:function(){var t=!0,e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);var n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);for(var o=null,a=0;a!==r;a++){var s=n[a];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,s),t=!1;break}if(null!==o&&o>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,s,o),t=!1;break}o=s}if(void 0!==i&&Gl.isTypedArray(i)){a=0;for(var c=i.length;a!==c;++a){var l=i[a];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,l),t=!1;break}}}return t},optimize:function(){for(var t=Gl.arraySlice(this.times),e=Gl.arraySlice(this.values),n=this.getValueSize(),i=this.getInterpolation()===Ce,r=1,o=t.length-1,a=1;a<o;++a){var s=!1,c=t[a];if(c!==t[a+1]&&(1!==a||c!==c[0]))if(i)s=!0;else for(var l=a*n,u=l-n,h=l+n,d=0;d!==n;++d){var p=e[l+d];if(p!==e[u+d]||p!==e[h+d]){s=!0;break}}if(s){if(a!==r){t[r]=t[a];var f=a*n,m=r*n;for(d=0;d!==n;++d)e[m+d]=e[f+d]}++r}}if(o>0){t[r]=t[o];for(f=o*n,m=r*n,d=0;d!==n;++d)e[m+d]=e[f+d];++r}return r!==t.length?(this.times=Gl.arraySlice(t,0,r),this.values=Gl.arraySlice(e,0,r*n)):(this.times=t,this.values=e),this},clone:function(){var t=Gl.arraySlice(this.times,0),e=Gl.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}),Kl.prototype=Object.assign(Object.crLine truncated
|
||||
//!\ DECLARE ALIAS AFTER assign prototype !
|
||||
Object.assign(qh.prototype,{_getValue_unbound:qh.prototype.getValue,_setValue_unbound:qh.prototype.setValue}),Object.assign(Xh.prototype,{isAnimationObjectGroup:!0,add:function(){for(var t=this._objects,e=t.length,n=this.nCachedObjects_,i=this._indicesByUUID,r=this._paths,o=this._parsedPaths,a=this._bindings,s=a.length,c=void 0,l=0,u=arguments.length;l!==u;++l){var h=arguments[l],d=h.uuid,p=i[d];if(void 0===p){p=e++,i[d]=p,t.push(h);for(var f=0,m=s;f!==m;++f)a[f].push(new qh(h,r[f],o[f]))}else if(p<n){c=t[p];var v=--n,g=t[v];i[g.uuid]=p,t[p]=g,i[d]=v,t[v]=h;for(f=0,m=s;f!==m;++f){var y=a[f],x=y[v],w=y[p];y[p]=x,void 0===w&&(w=new qh(h,r[f],o[f])),y[v]=w}}else t[p]!==c&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=n},remove:function(){for(var t=this._objects,e=this.nCachedObjects_,n=this._indicesByUUID,i=this._bindings,r=i.length,o=0,a=arguments.length;o!==a;++o){var s=arguments[o],c=s.uuid,l=n[c];if(void 0!==l&&l>=e){var u=e++,h=t[u];n[h.uuid]=l,t[l]=h,n[c]=u,t[u]=s;for(var d=0,p=r;d!==p;++d){var f=i[d],m=f[u],v=f[l];f[l]=m,f[u]=v}}}this.nCachedObjects_=e},uncache:function(){for(var t=this._objects,e=t.length,n=this.nCachedObjects_,i=this._indicesByUUID,r=this._bindings,o=r.length,a=0,s=arguments.length;a!==s;++a){var c=arguments[a],l=c.uuid,u=i[l];if(void 0!==u)if(delete i[l],u<n){var h=--n,d=t[h],p=t[y=--e];i[d.uuid]=u,t[u]=d,i[p.uuid]=h,t[h]=p,t.pop();for(var f=0,m=o;f!==m;++f){var v=(x=r[f])[h],g=x[y];x[u]=v,x[h]=g,x.pop()}}else{var y;i[(p=t[y=--e]).uuid]=u,t[u]=p,t.pop();for(f=0,m=o;f!==m;++f){var x;(x=r[f])[u]=x[y],x.pop()}}}this.nCachedObjects_=n},subscribe_:function(t,e){var n=this._bindingsIndicesByPath,i=n[t],r=this._bindings;if(void 0!==i)return r[i];var o=this._paths,a=this._parsedPaths,s=this._objects,c=s.length,l=this.nCachedObjects_,u=new Array(c);i=r.length,n[t]=i,o.push(t),a.push(e),r.push(u);for(var h=l,d=s.length;h!==d;++h){var p=s[h];u[h]=new qh(p,t,e)}return u},unsubscribe_:function(t){var e=this._bindingsIndicesByPath,n=e[t];if(void 0!==n){var i=this._paths,r=this._parsedPaths,o=this._bindings,a=o.length-1,s=o[a];e[t[a]]=n,o[n]=s,o.pop(),r[n]=r[a],r.pop(),i[n]=i[a],i.pop()}}}),Object.assign(Yh.prototype,{play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(t){return this._startTime=t,this},setLoop:function(t,e){return this.loop=t,this.repetitions=e,this},setEffectiveWeight:function(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(t){return this._scheduleFading(t,0,1)},fadeOut:function(t){return this._scheduleFading(t,1,0)},crossFadeFrom:function(t,e,n){if(t.fadeOut(e),this.fadeIn(e),n){var i=this._clip.duration,r=t._clip.duration,o=r/i,a=i/r;t.warp(1,o,e),this.warp(a,1,e)}return this},crossFadeTo:function(t,e,n){return t.crossFadeFrom(this,e,n)},stopFading:function(){var t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},setEffectiveTimeScale:function(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(t){return this.timeScale=this._clip.duration/t,this.stopWarping()},syncWith:function(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()},halt:function(t){return this.warp(this._effectiveTimeScale,0,t)},warp:function(t,e,n){var i=this._mixer,r=i.time,o=this._timeScaleInterpolant,a=this.timeScale;null===o&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);var s=o.parameterPositions,c=o.sampleValues;return s[0]=r,s[1]=r+n,c[0]=t/a,c[1]=e/a,this},stopWarping:function(){var t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(t,e,n,i){if(this.enabled){var r=this._startTime;if(null!==r){var o=(t-r)*n;if(o<0||0===n)return;this._startTime=null,e=n*o}e*=this._updateTimeScale(t);var a=this._updateTime(e),s=this._updateWeight(t);if(s>0)for(var c=this._interpolants,l=this._propertyBindings,u=0,h=c.length;u!==h;++u)c[u].evaluate(a),l[u].accumulate(i,s)}else this._updateWeight(t)},_updateWeight:function(t){var e=0;if(this.enabled){e=this.weight;var n=this._weightInterpolanLine truncated
|
||||
/**
|
||||
* @license
|
||||
* Lodash <https://lodash.com/>
|
||||
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
||||
* Released under MIT license <https://lodash.com/license>
|
||||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||||
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||||
*/(function(){var o="Expected a function",a="__lodash_placeholder__",s=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],c="[object Arguments]",l="[object Array]",u="[object Boolean]",h="[object Date]",d="[object Error]",p="[object Function]",f="[object GeneratorFunction]",m="[object Map]",v="[object Number]",g="[object Object]",y="[object RegExp]",x="[object Set]",w="[object String]",b="[object Symbol]",_="[object WeakMap]",S="[object ArrayBuffer]",M="[object DataView]",A="[object Float32Array]",E="[object Float64Array]",T="[object Int8Array]",P="[object Int16Array]",L="[object Int32Array]",C="[object Uint8Array]",R="[object Uint16Array]",O="[object Uint32Array]",F=/\b__p \+= '';/g,I=/\b(__p \+=) '' \+/g,N=/(__e\(.*?\)|\b__t\)) \+\n'';/g,B=/&(?:amp|lt|gt|quot|#39);/g,D=/[&<>"']/g,k=RegExp(B.source),z=RegExp(D.source),V=/<%-([\s\S]+?)%>/g,U=/<%([\s\S]+?)%>/g,j=/<%=([\s\S]+?)%>/g,H=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,G=/^\w*$/,W=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,q=/[\\^$.*+?()[\]{}|]/g,X=RegExp(q.source),Y=/^\s+/,Q=/\s/,K=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Z=/\{\n\/\* \[wrapped with (.+)\] \*/,J=/,? & /,$=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,tt=/[()=,{}\[\]\/\s]/,et=/\\(\\)?/g,nt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,it=/\w*$/,rt=/^[-+]0x[0-9a-f]+$/i,ot=/^0b[01]+$/i,at=/^\[object .+?Constructor\]$/,st=/^0o[0-7]+$/i,ct=/^(?:0|[1-9]\d*)$/,lt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ut=/($^)/,ht=/['\n\r\u2028\u2029\\]/g,dt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",pt="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ft="[\\ud800-\\udfff]",mt="["+pt+"]",vt="["+dt+"]",gt="\\d+",yt="[\\u2700-\\u27bf]",xt="[a-z\\xdf-\\xf6\\xf8-\\xff]",wt="[^\\ud800-\\udfff"+pt+gt+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",bt="\\ud83c[\\udffb-\\udfff]",_t="[^\\ud800-\\udfff]",St="(?:\\ud83c[\\udde6-\\uddff]){2}",Mt="[\\ud800-\\udbff][\\udc00-\\udfff]",At="[A-Z\\xc0-\\xd6\\xd8-\\xde]",Et="(?:"+xt+"|"+wt+")",Tt="(?:"+At+"|"+wt+")",Pt="(?:"+vt+"|"+bt+")"+"?",Lt="[\\ufe0e\\ufe0f]?"+Pt+("(?:\\u200d(?:"+[_t,St,Mt].join("|")+")[\\ufe0e\\ufe0f]?"+Pt+")*"),Ct="(?:"+[yt,St,Mt].join("|")+")"+Lt,Rt="(?:"+[_t+vt+"?",vt,St,Mt,ft].join("|")+")",Ot=RegExp("['’]","g"),Ft=RegExp(vt,"g"),It=RegExp(bt+"(?="+bt+")|"+Rt+Lt,"g"),Nt=RegExp([At+"?"+xt+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[mt,At,"$"].join("|")+")",Tt+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[mt,At+Et,"$"].join("|")+")",At+"?"+Et+"+(?:['’](?:d|ll|m|re|s|t|ve))?",At+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",gt,Ct].join("|"),"g"),Bt=RegExp("[\\u200d\\ud800-\\udfff"+dt+"\\ufe0e\\ufe0f]"),Dt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,kt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],zt=-1,Vt={};Vt[A]=Vt[E]=Vt[T]=Vt[P]=Vt[L]=Vt[C]=Vt["[object Uint8ClampedArray]"]=Vt[R]=Vt[O]=!0,Vt[c]=Vt[l]=Vt[S]=Vt[u]=Vt[M]=Vt[h]=Vt[d]=Vt[p]=Vt[m]=Vt[v]=Vt[g]=Vt[y]=Vt[x]=Vt[w]=Vt[_]=!1;var Ut={};Ut[c]=Ut[l]=Ut[S]=Ut[M]=Ut[u]=Ut[h]=Ut[A]=Ut[E]=Ut[T]=Ut[P]=Ut[L]=Ut[m]=Ut[v]=Ut[g]=Ut[y]=Ut[x]=Ut[w]=Ut[b]=Ut[C]=Ut["[object Uint8ClampedArray]"]=Ut[R]=Ut[O]=!0,Ut[d]=Ut[p]=Ut[_]=!1;var jt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ht=parseFloat,Gt=parseInt,Wt="object"==typeof t&&t&&t.Object===Object&&t,qt="object"==typeof self&&self&&self.Object===Object&&self,Xt=Wt||qt||Function("return this")(),Yt=e&&!e.nodeType&&e,Qt=Yt&&"object"==typeof i&&i&&!i.nodeType&&i,Kt=Qt&&Qt.exports===Yt,Zt=Kt&&Wt.process,Jt=function(){try{var t=Qt&&Qt.require&&Qt.require("util").types;return t||Zt&&Zt.binding&&Zt.binding("util")}catch(t){}}(),$t=Jt&&Jt.isArrayBuffer,te=Jt&&Jt.isDate,ee=Jt&&Jt.isMap,ne=Jt&&Jt.isRegExp,ie=Jt&&Jt.isSet,re=Jt&&Jt.isTypedArray;function oe(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function ae(t,e,n,i){for(var r=-1,o=null==t?0:t.length;++r<o;){var a=t[r];e(i,a,n(a),t)}return i}function se(t,e){for(var n=-1,i=null==t?0:t.length;++n<i&&!1!==e(t[n],n,t););return t}function ce(t,e){for(var n=null==t?0:t.length;n--&&!1!==e(t[n],n,t););return t}function le(t,e){for(var n=-1,i=null==t?0:t.length;++n<i;)if(!e(t[n],n,t))return!1;return!0}function ue(t,e){for(var n=-1,i=null==t?0:t.lLine truncated
|
||||
/*!
|
||||
* jQuery JavaScript Library v3.6.0
|
||||
* https://jquery.com/
|
||||
*
|
||||
* Includes Sizzle.js
|
||||
* https://sizzlejs.com/
|
||||
*
|
||||
* Copyright OpenJS Foundation and other contributors
|
||||
* Released under the MIT license
|
||||
* https://jquery.org/license
|
||||
*
|
||||
* Date: 2021-03-02T17:08Z
|
||||
*/!function(e,n){"use strict";"object"==typeof t.exports?t.exports=e.document?n(e,!0):function(t){if(!t.document)throw new Error("jQuery requires a window with a document");return n(t)}:n(e)}("undefined"!=typeof window?window:this,(function(n,r){"use strict";var o=[],a=Object.getPrototypeOf,s=o.slice,c=o.flat?function(t){return o.flat.call(t)}:function(t){return o.concat.apply([],t)},l=o.push,u=o.indexOf,h={},d=h.toString,p=h.hasOwnProperty,f=p.toString,m=f.call(Object),v={},g=function(t){return"function"==typeof t&&"number"!=typeof t.nodeType&&"function"!=typeof t.item},y=function(t){return null!=t&&t===t.window},x=n.document,w={type:!0,src:!0,nonce:!0,noModule:!0};function b(t,e,n){var i,r,o=(n=n||x).createElement("script");if(o.text=t,e)for(i in w)(r=e[i]||e.getAttribute&&e.getAttribute(i))&&o.setAttribute(i,r);n.head.appendChild(o).parentNode.removeChild(o)}function _(t){return null==t?t+"":"object"==typeof t||"function"==typeof t?h[d.call(t)]||"object":typeof t}var S=function(t,e){return new S.fn.init(t,e)};function M(t){var e=!!t&&"length"in t&&t.length,n=_(t);return!g(t)&&!y(t)&&("array"===n||0===e||"number"==typeof e&&e>0&&e-1 in t)}S.fn=S.prototype={jquery:"3.6.0",constructor:S,length:0,toArray:function(){return s.call(this)},get:function(t){return null==t?s.call(this):t<0?this[t+this.length]:this[t]},pushStack:function(t){var e=S.merge(this.constructor(),t);return e.prevObject=this,e},each:function(t){return S.each(this,t)},map:function(t){return this.pushStack(S.map(this,(function(e,n){return t.call(e,n,e)})))},slice:function(){return this.pushStack(s.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(S.grep(this,(function(t,e){return(e+1)%2})))},odd:function(){return this.pushStack(S.grep(this,(function(t,e){return e%2})))},eq:function(t){var e=this.length,n=+t+(t<0?e:0);return this.pushStack(n>=0&&n<e?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:l,sort:o.sort,splice:o.splice},S.extend=S.fn.extend=function(){var t,e,n,i,r,o,a=arguments[0]||{},s=1,c=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||g(a)||(a={}),s===c&&(a=this,s--);s<c;s++)if(null!=(t=arguments[s]))for(e in t)i=t[e],"__proto__"!==e&&a!==i&&(l&&i&&(S.isPlainObject(i)||(r=Array.isArray(i)))?(n=a[e],o=r&&!Array.isArray(n)?[]:r||S.isPlainObject(n)?n:{},r=!1,a[e]=S.extend(l,o,i)):void 0!==i&&(a[e]=i));return a},S.extend({expando:"jQuery"+("3.6.0"+Math.random()).replace(/\D/g,""),isReady:!0,error:function(t){throw new Error(t)},noop:function(){},isPlainObject:function(t){var e,n;return!(!t||"[object Object]"!==d.call(t))&&(!(e=a(t))||"function"==typeof(n=p.call(e,"constructor")&&e.constructor)&&f.call(n)===m)},isEmptyObject:function(t){var e;for(e in t)return!1;return!0},globalEval:function(t,e,n){b(t,{nonce:e&&e.nonce},n)},each:function(t,e){var n,i=0;if(M(t))for(n=t.length;i<n&&!1!==e.call(t[i],i,t[i]);i++);else for(i in t)if(!1===e.call(t[i],i,t[i]))break;return t},makeArray:function(t,e){var n=e||[];return null!=t&&(M(Object(t))?S.merge(n,"string"==typeof t?[t]:t):l.call(n,t)),n},inArray:function(t,e,n){return null==e?-1:u.call(e,t,n)},merge:function(t,e){for(var n=+e.length,i=0,r=t.length;i<n;i++)t[r++]=e[i];return t.length=r,t},grep:function(t,e,n){for(var i=[],r=0,o=t.length,a=!n;r<o;r++)!e(t[r],r)!==a&&i.push(t[r]);return i},map:function(t,e,n){var i,r,o=0,a=[];if(M(t))for(i=t.length;o<i;o++)null!=(r=e(t[o],o,n))&&a.push(r);else for(o in t)null!=(r=e(t[o],o,n))&&a.push(r);return c(a)},guid:1,support:v}),"function"==typeof Symbol&&(S.fn[Symbol.iterator]=o[Symbol.iterator]),S.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),(function(t,e){h["[object "+e+"]"]=e.toLowerCase()}));var A=
|
||||
/*!
|
||||
* Sizzle CSS Selector Engine v2.3.6
|
||||
* https://sizzlejs.com/
|
||||
*
|
||||
* Copyright JS Foundation and other contributors
|
||||
* Released under the MIT license
|
||||
* https://js.foundation/
|
||||
*
|
||||
* Date: 2021-02-16
|
||||
*/
|
||||
function(t){var e,n,i,r,o,a,s,c,l,u,h,d,p,f,m,v,g,y,x,w="sizzle"+1*new Date,b=t.document,_=0,S=0,M=ct(),A=ct(),E=ct(),T=ct(),P=function(t,e){return t===e&&(h=!0),0},L={}.hasOwnProperty,C=[],R=C.pop,O=C.push,F=C.push,I=C.slice,N=function(t,e){for(var n=0,i=t.length;n<i;n++)if(t[n]===e)return n;return-1},B="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",D="[\\x20\\t\\r\\n\\f]",k="(?:\\\\[\\da-fA-F]{1,6}"+D+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",z="\\["+D+"*("+k+")(?:"+D+"*([*^$|!~]?=)"+D+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+k+"))|)"+D+"*\\]",V=":("+k+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+z+")*)|.*)\\)|)",U=new RegExp(D+"+","g"),j=new RegExp("^"+D+"+|((?:^|[^\\\\])(?:\\\\.)*)"+D+"+$","g"),H=new RegExp("^"+D+"*,"+D+"*"),G=new RegExp("^"+D+"*([>+~]|"+D+")"+D+"*"),W=new RegExp(D+"|>"),q=new RegExp(V),X=new RegExp("^"+k+"$"),Y={ID:new RegExp("^#("+k+")"),CLASS:new RegExp("^\\.("+k+")"),TAG:new RegExp("^("+k+"|[*])"),ATTR:new RegExp("^"+z),PSEUDO:new RegExp("^"+V),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+D+"*(even|odd|(([+-]|)(\\d*)n|)"+D+"*(?:([+-]|)"+D+"*(\\d+)|))"+D+"*\\)|)","i"),bool:new RegExp("^(?:"+B+")$","i"),needsContext:new RegExp("^"+D+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+D+"*((?:-\\d)?\\d*)"+D+"*\\)|)(?=[^-]|$)","i")},Q=/HTML$/i,K=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,J=/^[^{]+\{\s*\[native \w/,$=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,tt=/[+~]/,et=new RegExp("\\\\[\\da-fA-F]{1,6}"+D+"?|\\\\([^\\r\\n\\f])","g"),nt=function(t,e){var n="0x"+t.slice(1)-65536;return e||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},it=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,rt=function(t,e){return e?"\0"===t?"�":t.slice(0,-1)+"\\"+t.charCodeAt(t.length-1).toString(16)+" ":"\\"+t},ot=function(){d()},at=wt((function(t){return!0===t.disabled&&"fieldset"===t.nodeName.toLowerCase()}),{dir:"parentNode",next:"legend"});try{F.apply(C=I.call(b.childNodes),b.childNodes),C[b.childNodes.length].nodeType}catch(t){F={apply:C.length?function(t,e){O.apply(t,I.call(e))}:function(t,e){for(var n=t.length,i=0;t[n++]=e[i++];);t.length=n-1}}}function st(t,e,i,r){var o,s,l,u,h,f,g,y=e&&e.ownerDocument,b=e?e.nodeType:9;if(i=i||[],"string"!=typeof t||!t||1!==b&&9!==b&&11!==b)return i;if(!r&&(d(e),e=e||p,m)){if(11!==b&&(h=$.exec(t)))if(o=h[1]){if(9===b){if(!(l=e.getElementById(o)))return i;if(l.id===o)return i.push(l),i}else if(y&&(l=y.getElementById(o))&&x(e,l)&&l.id===o)return i.push(l),i}else{if(h[2])return F.apply(i,e.getElementsByTagName(t)),i;if((o=h[3])&&n.getElementsByClassName&&e.getElementsByClassName)return F.apply(i,e.getElementsByClassName(o)),i}if(n.qsa&&!T[t+" "]&&(!v||!v.test(t))&&(1!==b||"object"!==e.nodeName.toLowerCase())){if(g=t,y=e,1===b&&(W.test(t)||G.test(t))){for((y=tt.test(t)&>(e.parentNode)||e)===e&&n.scope||((u=e.getAttribute("id"))?u=u.replace(it,rt):e.setAttribute("id",u=w)),s=(f=a(t)).length;s--;)f[s]=(u?"#"+u:":scope")+" "+xt(f[s]);g=f.join(",")}try{return F.apply(i,y.querySelectorAll(g)),i}catch(e){T(t,!0)}finally{u===w&&e.removeAttribute("id")}}}return c(t.replace(j,"$1"),e,i,r)}function ct(){var t=[];return function e(n,r){return t.push(n+" ")>i.cacheLength&&delete e[t.shift()],e[n+" "]=r}}function lt(t){return t[w]=!0,t}function ut(t){var e=p.createElement("fieldset");try{return!!t(e)}catch(t){return!1}finally{e.parentNode&&e.parentNode.removeChild(e),e=null}}function ht(t,e){for(var n=t.split("|"),r=n.length;r--;)i.attrHandle[n[r]]=e}function dt(t,e){var n=e&&t,i=n&&1===t.nodeType&&1===e.nodeType&&t.sourceIndex-e.sourceIndex;if(i)return i;if(n)for(;n=n.nextSibling;)if(n===e)return-1;return t?1:-1}function pt(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function ft(t){return function(e){var n=e.nodeName.toLowerCase();return("input"===n||"button"===n)&&e.type===t}}function mt(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&at(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function vt(t){return lt((function(e){return e=+e,lt((function(n,i){for(var r,o=t([],n.length,e),a=o.length;a--;)n[r=o[a]]&&(n[r]=!(i[r]=n[r]))}))}))}function gt(t){return t&&void 0!==t.getElementsByTagName&&t}for(e in n=st.support={},o=st.isXML=function(t){var e=t&&t.namespaceURI,n=t&&(t.ownerDocument||t).documentElement;return!Q.test(e||n&&n.nodeName||"HTML")},d=st.setDocument=function(t){var e,r,a=t?t.ownerDocument||t:b;return a!=p&&9===a.nodeType&&a.documentElement?(f=(p=a).documentElement,m=!o(p),b!=p&&(r=p.defaultView)&&r.top!==r&&(r.addEventListener?r.addEventListener("unload",ot,!1):r.attachEvent&&r.attachEvent("onunload",ot)),n.scope=ut((function(t){return f.appendChild(t).appendChild(p.createElement("div")),void 0!==t.Line truncated
|
||||
@@ -0,0 +1,111 @@
|
||||
import * as THREE from 'three';
|
||||
import * as CANNON from 'cannon';
|
||||
import { KeyBinding } from '../core/KeyBinding';
|
||||
import { VectorSpringSimulator } from '../physics/spring_simulation/VectorSpringSimulator';
|
||||
import { RelativeSpringSimulator } from '../physics/spring_simulation/RelativeSpringSimulator';
|
||||
import { ICharacterAI } from '../interfaces/ICharacterAI';
|
||||
import { World } from '../world/World';
|
||||
import { IControllable } from '../interfaces/IControllable';
|
||||
import { ICharacterState } from '../interfaces/ICharacterState';
|
||||
import { IWorldEntity } from '../interfaces/IWorldEntity';
|
||||
import { VehicleSeat } from '../vehicles/VehicleSeat';
|
||||
import { Vehicle } from '../vehicles/Vehicle';
|
||||
import { CapsuleCollider } from '../physics/colliders/CapsuleCollider';
|
||||
import { VehicleEntryInstance } from './VehicleEntryInstance';
|
||||
import { GroundImpactData } from './GroundImpactData';
|
||||
import { EntityType } from '../enums/EntityType';
|
||||
export declare class Character extends THREE.Object3D implements IWorldEntity {
|
||||
updateOrder: number;
|
||||
entityType: EntityType;
|
||||
height: number;
|
||||
tiltContainer: THREE.Group;
|
||||
modelContainer: THREE.Group;
|
||||
materials: THREE.Material[];
|
||||
mixer: THREE.AnimationMixer;
|
||||
animations: any[];
|
||||
acceleration: THREE.Vector3;
|
||||
velocity: THREE.Vector3;
|
||||
arcadeVelocityInfluence: THREE.Vector3;
|
||||
velocityTarget: THREE.Vector3;
|
||||
arcadeVelocityIsAdditive: boolean;
|
||||
defaultVelocitySimulatorDamping: number;
|
||||
defaultVelocitySimulatorMass: number;
|
||||
velocitySimulator: VectorSpringSimulator;
|
||||
moveSpeed: number;
|
||||
angularVelocity: number;
|
||||
orientation: THREE.Vector3;
|
||||
orientationTarget: THREE.Vector3;
|
||||
defaultRotationSimulatorDamping: number;
|
||||
defaultRotationSimulatorMass: number;
|
||||
rotationSimulator: RelativeSpringSimulator;
|
||||
viewVector: THREE.Vector3;
|
||||
actions: {
|
||||
[action: string]: KeyBinding;
|
||||
};
|
||||
characterCapsule: CapsuleCollider;
|
||||
rayResult: CANNON.RaycastResult;
|
||||
rayHasHit: boolean;
|
||||
rayCastLength: number;
|
||||
raySafeOffset: number;
|
||||
wantsToJump: boolean;
|
||||
initJumpSpeed: number;
|
||||
groundImpactData: GroundImpactData;
|
||||
raycastBox: THREE.Mesh;
|
||||
world: World;
|
||||
charState: ICharacterState;
|
||||
behaviour: ICharacterAI;
|
||||
controlledObject: IControllable;
|
||||
occupyingSeat: VehicleSeat;
|
||||
vehicleEntryInstance: VehicleEntryInstance;
|
||||
private physicsEnabled;
|
||||
constructor(gltf: any);
|
||||
setAnimations(animations: []): void;
|
||||
setArcadeVelocityInfluence(x: number, y?: number, z?: number): void;
|
||||
setViewVector(vector: THREE.Vector3): void;
|
||||
/**
|
||||
* Set state to the player. Pass state class (function) name.
|
||||
* @param {function} State
|
||||
*/
|
||||
setState(state: ICharacterState): void;
|
||||
setPosition(x: number, y: number, z: number): void;
|
||||
resetVelocity(): void;
|
||||
setArcadeVelocityTarget(velZ: number, velX?: number, velY?: number): void;
|
||||
setOrientation(vector: THREE.Vector3, instantly?: boolean): void;
|
||||
resetOrientation(): void;
|
||||
setBehaviour(behaviour: ICharacterAI): void;
|
||||
setPhysicsEnabled(value: boolean): void;
|
||||
readCharacterData(gltf: any): void;
|
||||
handleKeyboardEvent(event: KeyboardEvent, code: string, pressed: boolean): void;
|
||||
handleMouseButton(event: MouseEvent, code: string, pressed: boolean): void;
|
||||
handleMouseMove(event: MouseEvent, deltaX: number, deltaY: number): void;
|
||||
handleMouseWheel(event: WheelEvent, value: number): void;
|
||||
triggerAction(actionName: string, value: boolean): void;
|
||||
takeControl(): void;
|
||||
resetControls(): void;
|
||||
update(timeStep: number): void;
|
||||
inputReceiverInit(): void;
|
||||
displayControls(): void;
|
||||
inputReceiverUpdate(timeStep: number): void;
|
||||
setAnimation(clipName: string, fadeIn: number): number;
|
||||
springMovement(timeStep: number): void;
|
||||
springRotation(timeStep: number): void;
|
||||
getLocalMovementDirection(): THREE.Vector3;
|
||||
getCameraRelativeMovementVector(): THREE.Vector3;
|
||||
setCameraRelativeOrientationTarget(): void;
|
||||
rotateModel(): void;
|
||||
jump(initJumpSpeed?: number): void;
|
||||
findVehicleToEnter(wantsToDrive: boolean): void;
|
||||
enterVehicle(seat: VehicleSeat, entryPoint: THREE.Object3D): void;
|
||||
teleportToVehicle(vehicle: Vehicle, seat: VehicleSeat): void;
|
||||
startControllingVehicle(vehicle: IControllable, seat: VehicleSeat): void;
|
||||
transferControls(entity: IControllable): void;
|
||||
stopControllingVehicle(): void;
|
||||
exitVehicle(): void;
|
||||
occupySeat(seat: VehicleSeat): void;
|
||||
leaveSeat(): void;
|
||||
physicsPreStep(body: CANNON.Body, character: Character): void;
|
||||
feetRaycast(): void;
|
||||
physicsPostStep(body: CANNON.Body, character: Character): void;
|
||||
addToWorld(world: World): void;
|
||||
removeFromWorld(world: World): void;
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
import * as THREE from 'three';
|
||||
export declare class GroundImpactData {
|
||||
velocity: THREE.Vector3;
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
import * as THREE from 'three';
|
||||
import { VehicleSeat } from '../vehicles/VehicleSeat';
|
||||
import { Character } from './Character';
|
||||
export declare class VehicleEntryInstance {
|
||||
character: Character;
|
||||
targetSeat: VehicleSeat;
|
||||
entryPoint: THREE.Object3D;
|
||||
wantsToDrive: boolean;
|
||||
constructor(character: Character);
|
||||
update(timeStep: number): void;
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
import { FollowTarget } from './FollowTarget';
|
||||
import { ICharacterAI } from '../../interfaces/ICharacterAI';
|
||||
import { PathNode } from '../../world/PathNode';
|
||||
export declare class FollowPath extends FollowTarget implements ICharacterAI {
|
||||
nodeRadius: number;
|
||||
reverse: boolean;
|
||||
private staleTimer;
|
||||
private targetNode;
|
||||
constructor(firstNode: PathNode, nodeRadius: number);
|
||||
update(timeStep: number): void;
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
import * as THREE from 'three';
|
||||
import { ICharacterAI } from '../../interfaces/ICharacterAI';
|
||||
import { Character } from '../Character';
|
||||
export declare class FollowTarget implements ICharacterAI {
|
||||
character: Character;
|
||||
isTargetReached: boolean;
|
||||
target: THREE.Object3D;
|
||||
private stopDistance;
|
||||
constructor(target: THREE.Object3D, stopDistance?: number);
|
||||
setTarget(target: THREE.Object3D): void;
|
||||
update(timeStep: number): void;
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
import { ICharacterAI } from '../../interfaces/ICharacterAI';
|
||||
import { Character } from '../Character';
|
||||
export declare class RandomBehaviour implements ICharacterAI {
|
||||
character: Character;
|
||||
private randomFrequency;
|
||||
constructor(randomFrequency?: number);
|
||||
update(timeStep: number): void;
|
||||
}
|
||||
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
import { Character } from '../Character';
|
||||
import { ICharacterState } from '../../interfaces/ICharacterState';
|
||||
export declare abstract class CharacterStateBase implements ICharacterState {
|
||||
character: Character;
|
||||
timer: number;
|
||||
animationLength: any;
|
||||
canFindVehiclesToEnter: boolean;
|
||||
canEnterVehicles: boolean;
|
||||
canLeaveVehicles: boolean;
|
||||
constructor(character: Character);
|
||||
update(timeStep: number): void;
|
||||
onInputChange(): void;
|
||||
noDirection(): boolean;
|
||||
anyDirection(): boolean;
|
||||
fallInAir(): void;
|
||||
animationEnded(timeStep: number): boolean;
|
||||
setAppropriateDropState(): void;
|
||||
setAppropriateStartWalkState(): void;
|
||||
protected playAnimation(animName: string, fadeIn: number): void;
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
import { CharacterStateBase } from './_stateLibrary';
|
||||
import { ICharacterState } from '../../interfaces/ICharacterState';
|
||||
import { Character } from '../Character';
|
||||
export declare class DropIdle extends CharacterStateBase implements ICharacterState {
|
||||
constructor(character: Character);
|
||||
update(timeStep: number): void;
|
||||
onInputChange(): void;
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
import { CharacterStateBase } from './_stateLibrary';
|
||||
import { ICharacterState } from '../../interfaces/ICharacterState';
|
||||
import { Character } from '../Character';
|
||||
export declare class DropRolling extends CharacterStateBase implements ICharacterState {
|
||||
constructor(character: Character);
|
||||
update(timeStep: number): void;
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
import { CharacterStateBase } from './_stateLibrary';
|
||||
import { ICharacterState } from '../../interfaces/ICharacterState';
|
||||
import { Character } from '../Character';
|
||||
export declare class DropRunning extends CharacterStateBase implements ICharacterState {
|
||||
constructor(character: Character);
|
||||
update(timeStep: number): void;
|
||||
onInputChange(): void;
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
import { CharacterStateBase } from './_stateLibrary';
|
||||
import { ICharacterState } from '../../interfaces/ICharacterState';
|
||||
import { Character } from '../Character';
|
||||
export declare class EndWalk extends CharacterStateBase implements ICharacterState {
|
||||
constructor(character: Character);
|
||||
update(timeStep: number): void;
|
||||
onInputChange(): void;
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import { CharacterStateBase } from './_stateLibrary';
|
||||
import { ICharacterState } from '../../interfaces/ICharacterState';
|
||||
import { Character } from '../Character';
|
||||
export declare class Falling extends CharacterStateBase implements ICharacterState {
|
||||
constructor(character: Character);
|
||||
update(timeStep: number): void;
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
import { CharacterStateBase } from './_stateLibrary';
|
||||
import { ICharacterState } from '../../interfaces/ICharacterState';
|
||||
import { Character } from '../Character';
|
||||
export declare class Idle extends CharacterStateBase implements ICharacterState {
|
||||
constructor(character: Character);
|
||||
update(timeStep: number): void;
|
||||
onInputChange(): void;
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
import { CharacterStateBase } from './_stateLibrary';
|
||||
import { ICharacterState } from '../../interfaces/ICharacterState';
|
||||
import { Character } from '../Character';
|
||||
export declare class IdleRotateLeft extends CharacterStateBase implements ICharacterState {
|
||||
constructor(character: Character);
|
||||
update(timeStep: number): void;
|
||||
onInputChange(): void;
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
import { CharacterStateBase } from './_stateLibrary';
|
||||
import { ICharacterState } from '../../interfaces/ICharacterState';
|
||||
import { Character } from '../Character';
|
||||
export declare class IdleRotateRight extends CharacterStateBase implements ICharacterState {
|
||||
constructor(character: Character);
|
||||
update(timeStep: number): void;
|
||||
onInputChange(): void;
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
import { CharacterStateBase } from './_stateLibrary';
|
||||
import { ICharacterState } from '../../interfaces/ICharacterState';
|
||||
import { Character } from '../Character';
|
||||
export declare class JumpIdle extends CharacterStateBase implements ICharacterState {
|
||||
private alreadyJumped;
|
||||
constructor(character: Character);
|
||||
update(timeStep: number): void;
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
import { CharacterStateBase } from './_stateLibrary';
|
||||
import { ICharacterState } from '../../interfaces/ICharacterState';
|
||||
import { Character } from '../Character';
|
||||
export declare class JumpRunning extends CharacterStateBase implements ICharacterState {
|
||||
private alreadyJumped;
|
||||
constructor(character: Character);
|
||||
update(timeStep: number): void;
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import { CharacterStateBase } from './_stateLibrary';
|
||||
import { Character } from '../Character';
|
||||
export declare class Sprint extends CharacterStateBase {
|
||||
constructor(character: Character);
|
||||
update(timeStep: number): void;
|
||||
onInputChange(): void;
|
||||
}
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
import { StartWalkBase } from './_stateLibrary';
|
||||
import { Character } from '../Character';
|
||||
export declare class StartWalkBackLeft extends StartWalkBase {
|
||||
constructor(character: Character);
|
||||
}
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
import { StartWalkBase } from './_stateLibrary';
|
||||
import { Character } from '../Character';
|
||||
export declare class StartWalkBackRight extends StartWalkBase {
|
||||
constructor(character: Character);
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
import { CharacterStateBase } from './_stateLibrary';
|
||||
import { Character } from '../Character';
|
||||
export declare class StartWalkBase extends CharacterStateBase {
|
||||
constructor(character: Character);
|
||||
update(timeStep: number): void;
|
||||
onInputChange(): void;
|
||||
}
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
import { StartWalkBase } from './_stateLibrary';
|
||||
import { Character } from '../Character';
|
||||
export declare class StartWalkForward extends StartWalkBase {
|
||||
constructor(character: Character);
|
||||
}
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
import { StartWalkBase } from './_stateLibrary';
|
||||
import { Character } from '../Character';
|
||||
export declare class StartWalkLeft extends StartWalkBase {
|
||||
constructor(character: Character);
|
||||
}
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
import { StartWalkBase } from './_stateLibrary';
|
||||
import { Character } from '../Character';
|
||||
export declare class StartWalkRight extends StartWalkBase {
|
||||
constructor(character: Character);
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import { CharacterStateBase } from './_stateLibrary';
|
||||
import { Character } from '../Character';
|
||||
export declare class Walk extends CharacterStateBase {
|
||||
constructor(character: Character);
|
||||
update(timeStep: number): void;
|
||||
onInputChange(): void;
|
||||
}
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
export * from './CharacterStateBase';
|
||||
export * from './DropIdle';
|
||||
export * from './DropRolling';
|
||||
export * from './DropRunning';
|
||||
export * from './EndWalk';
|
||||
export * from './Falling';
|
||||
export * from './Idle';
|
||||
export * from './IdleRotateLeft';
|
||||
export * from './IdleRotateRight';
|
||||
export * from './JumpIdle';
|
||||
export * from './JumpRunning';
|
||||
export * from './Sprint';
|
||||
export * from './StartWalkBase';
|
||||
export * from './StartWalkBackLeft';
|
||||
export * from './StartWalkBackRight';
|
||||
export * from './StartWalkForward';
|
||||
export * from './StartWalkLeft';
|
||||
export * from './StartWalkRight';
|
||||
export * from './Walk';
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
import { CharacterStateBase } from '../_stateLibrary';
|
||||
import { Character } from '../../Character';
|
||||
import { VehicleSeat } from '../../../vehicles/VehicleSeat';
|
||||
export declare class CloseVehicleDoorInside extends CharacterStateBase {
|
||||
private seat;
|
||||
private hasClosedDoor;
|
||||
constructor(character: Character, seat: VehicleSeat);
|
||||
update(timeStep: number): void;
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
import { CharacterStateBase } from '../_stateLibrary';
|
||||
import { Character } from '../../Character';
|
||||
import { VehicleSeat } from '../../../vehicles/VehicleSeat';
|
||||
export declare class CloseVehicleDoorOutside extends CharacterStateBase {
|
||||
private seat;
|
||||
private hasClosedDoor;
|
||||
constructor(character: Character, seat: VehicleSeat);
|
||||
update(timeStep: number): void;
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
import { CharacterStateBase } from '../_stateLibrary';
|
||||
import { Character } from '../../Character';
|
||||
import { VehicleSeat } from 'src/ts/vehicles/VehicleSeat';
|
||||
export declare class Driving extends CharacterStateBase {
|
||||
private seat;
|
||||
constructor(character: Character, seat: VehicleSeat);
|
||||
update(timeStep: number): void;
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
import { CharacterStateBase } from '../_stateLibrary';
|
||||
import { Character } from '../../Character';
|
||||
import { VehicleSeat } from '../../../vehicles/VehicleSeat';
|
||||
import { Object3D } from 'three';
|
||||
export declare class EnteringVehicle extends CharacterStateBase {
|
||||
private vehicle;
|
||||
private animData;
|
||||
private seat;
|
||||
private initialPositionOffset;
|
||||
private startPosition;
|
||||
private endPosition;
|
||||
private startRotation;
|
||||
private endRotation;
|
||||
private factorSimulator;
|
||||
constructor(character: Character, seat: VehicleSeat, entryPoint: Object3D);
|
||||
update(timeStep: number): void;
|
||||
private getEntryAnimations;
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import { Character } from '../../Character';
|
||||
import { VehicleSeat } from '../../../vehicles/VehicleSeat';
|
||||
import { ExitingStateBase } from './ExitingStateBase';
|
||||
export declare class ExitingAirplane extends ExitingStateBase {
|
||||
constructor(character: Character, seat: VehicleSeat);
|
||||
update(timeStep: number): void;
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
import * as THREE from 'three';
|
||||
import { CharacterStateBase } from '../_stateLibrary';
|
||||
import { Character } from '../../Character';
|
||||
import { VehicleSeat } from '../../../vehicles/VehicleSeat';
|
||||
import { IControllable } from '../../../interfaces/IControllable';
|
||||
export declare abstract class ExitingStateBase extends CharacterStateBase {
|
||||
protected vehicle: IControllable;
|
||||
protected seat: VehicleSeat;
|
||||
protected startPosition: THREE.Vector3;
|
||||
protected endPosition: THREE.Vector3;
|
||||
protected startRotation: THREE.Quaternion;
|
||||
protected endRotation: THREE.Quaternion;
|
||||
protected exitPoint: THREE.Object3D;
|
||||
protected dummyObj: THREE.Object3D;
|
||||
constructor(character: Character, seat: VehicleSeat);
|
||||
detachCharacterFromVehicle(): void;
|
||||
updateEndRotation(): void;
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import { Character } from '../../Character';
|
||||
import { VehicleSeat } from '../../../vehicles/VehicleSeat';
|
||||
import { ExitingStateBase } from './ExitingStateBase';
|
||||
export declare class ExitingVehicle extends ExitingStateBase {
|
||||
constructor(character: Character, seat: VehicleSeat);
|
||||
update(timeStep: number): void;
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
import * as THREE from 'three';
|
||||
import { CharacterStateBase } from '../_stateLibrary';
|
||||
import { Character } from '../../Character';
|
||||
import { VehicleSeat } from '../../../vehicles/VehicleSeat';
|
||||
export declare class OpenVehicleDoor extends CharacterStateBase {
|
||||
private seat;
|
||||
private entryPoint;
|
||||
private hasOpenedDoor;
|
||||
private startPosition;
|
||||
private endPosition;
|
||||
private startRotation;
|
||||
private endRotation;
|
||||
private factorSimluator;
|
||||
constructor(character: Character, seat: VehicleSeat, entryPoint: THREE.Object3D);
|
||||
update(timeStep: number): void;
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
import { CharacterStateBase } from '../_stateLibrary';
|
||||
import { Character } from '../../Character';
|
||||
import { VehicleSeat } from 'src/ts/vehicles/VehicleSeat';
|
||||
export declare class Sitting extends CharacterStateBase {
|
||||
private seat;
|
||||
constructor(character: Character, seat: VehicleSeat);
|
||||
update(timeStep: number): void;
|
||||
onInputChange(): void;
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
import { CharacterStateBase } from '../_stateLibrary';
|
||||
import { Character } from '../../Character';
|
||||
import { VehicleSeat } from '../../../vehicles/VehicleSeat';
|
||||
export declare class SwitchingSeats extends CharacterStateBase {
|
||||
private toSeat;
|
||||
private startPosition;
|
||||
private endPosition;
|
||||
private startRotation;
|
||||
private endRotation;
|
||||
constructor(character: Character, fromSeat: VehicleSeat, toSeat: VehicleSeat);
|
||||
update(timeStep: number): void;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
import * as THREE from 'three';
|
||||
import { World } from '../world/World';
|
||||
import { IInputReceiver } from '../interfaces/IInputReceiver';
|
||||
import { KeyBinding } from './KeyBinding';
|
||||
import { Character } from '../characters/Character';
|
||||
import { IUpdatable } from '../interfaces/IUpdatable';
|
||||
export declare class CameraOperator implements IInputReceiver, IUpdatable {
|
||||
updateOrder: number;
|
||||
world: World;
|
||||
camera: THREE.Camera;
|
||||
target: THREE.Vector3;
|
||||
sensitivity: THREE.Vector2;
|
||||
radius: number;
|
||||
theta: number;
|
||||
phi: number;
|
||||
onMouseDownPosition: THREE.Vector2;
|
||||
onMouseDownTheta: any;
|
||||
onMouseDownPhi: any;
|
||||
targetRadius: number;
|
||||
movementSpeed: number;
|
||||
actions: {
|
||||
[action: string]: KeyBinding;
|
||||
};
|
||||
upVelocity: number;
|
||||
forwardVelocity: number;
|
||||
rightVelocity: number;
|
||||
followMode: boolean;
|
||||
characterCaller: Character;
|
||||
constructor(world: World, camera: THREE.Camera, sensitivityX?: number, sensitivityY?: number);
|
||||
setSensitivity(sensitivityX: number, sensitivityY?: number): void;
|
||||
setRadius(value: number, instantly?: boolean): void;
|
||||
move(deltaX: number, deltaY: number): void;
|
||||
update(timeScale: number): void;
|
||||
handleKeyboardEvent(event: KeyboardEvent, code: string, pressed: boolean): void;
|
||||
handleMouseWheel(event: WheelEvent, value: number): void;
|
||||
handleMouseButton(event: MouseEvent, code: string, pressed: boolean): void;
|
||||
handleMouseMove(event: MouseEvent, deltaX: number, deltaY: number): void;
|
||||
inputReceiverInit(): void;
|
||||
inputReceiverUpdate(timeStep: number): void;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import * as THREE from 'three';
|
||||
export declare class ClosestObjectFinder<T> {
|
||||
closestObject: T;
|
||||
private closestDistance;
|
||||
private referencePosition;
|
||||
private maxDistance;
|
||||
constructor(referencePosition: THREE.Vector3, maxDistance?: number);
|
||||
consider(object: T, objectPosition: THREE.Vector3): void;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import * as THREE from 'three';
|
||||
import * as CANNON from 'cannon';
|
||||
import { SimulationFrame } from '../physics/spring_simulation/SimulationFrame';
|
||||
import { Side } from '../enums/Side';
|
||||
import { Object3D } from 'three';
|
||||
import { Space } from '../enums/Space';
|
||||
export declare function createCapsuleGeometry(radius?: number, height?: number, N?: number): THREE.Geometry;
|
||||
/**
|
||||
* Constructs a 2D matrix from first vector, replacing the Y axes with the global Y axis,
|
||||
* and applies this matrix to the second vector. Saves performance when compared to full 3D matrix application.
|
||||
* Useful for character rotation, as it only happens on the Y axis.
|
||||
* @param {Vector3} a Vector to construct 2D matrix from
|
||||
* @param {Vector3} b Vector to apply basis to
|
||||
*/
|
||||
export declare function appplyVectorMatrixXZ(a: THREE.Vector3, b: THREE.Vector3): THREE.Vector3;
|
||||
export declare function round(value: number, decimals?: number): number;
|
||||
export declare function roundVector(vector: THREE.Vector3, decimals?: number): THREE.Vector3;
|
||||
/**
|
||||
* Finds an angle between two vectors
|
||||
* @param {THREE.Vector3} v1
|
||||
* @param {THREE.Vector3} v2
|
||||
*/
|
||||
export declare function getAngleBetweenVectors(v1: THREE.Vector3, v2: THREE.Vector3, dotTreshold?: number): number;
|
||||
/**
|
||||
* Finds an angle between two vectors with a sign relative to normal vector
|
||||
*/
|
||||
export declare function getSignedAngleBetweenVectors(v1: THREE.Vector3, v2: THREE.Vector3, normal?: THREE.Vector3, dotTreshold?: number): number;
|
||||
export declare function haveSameSigns(n1: number, n2: number): boolean;
|
||||
export declare function haveDifferentSigns(n1: number, n2: number): boolean;
|
||||
export declare function setDefaults(options: {}, defaults: {}): {};
|
||||
export declare function getGlobalProperties(prefix?: string): any[];
|
||||
export declare function spring(source: number, dest: number, velocity: number, mass: number, damping: number): SimulationFrame;
|
||||
export declare function springV(source: THREE.Vector3, dest: THREE.Vector3, velocity: THREE.Vector3, mass: number, damping: number): void;
|
||||
export declare function threeVector(vec: CANNON.Vec3): THREE.Vector3;
|
||||
export declare function cannonVector(vec: THREE.Vector3): CANNON.Vec3;
|
||||
export declare function threeQuat(quat: CANNON.Quaternion): THREE.Quaternion;
|
||||
export declare function cannonQuat(quat: THREE.Quaternion): CANNON.Quaternion;
|
||||
export declare function setupMeshProperties(child: any): void;
|
||||
export declare function detectRelativeSide(from: Object3D, to: Object3D): Side;
|
||||
export declare function easeInOutSine(x: number): number;
|
||||
export declare function easeOutQuad(x: number): number;
|
||||
export declare function getRight(obj: THREE.Object3D, space?: Space): THREE.Vector3;
|
||||
export declare function getUp(obj: THREE.Object3D, space?: Space): THREE.Vector3;
|
||||
export declare function getForward(obj: THREE.Object3D, space?: Space): THREE.Vector3;
|
||||
export declare function getBack(obj: THREE.Object3D, space?: Space): THREE.Vector3;
|
||||
export declare function getMatrix(obj: THREE.Object3D, space: Space): THREE.Matrix4;
|
||||
export declare function countSleepyBodies(): any;
|
||||
@@ -0,0 +1,16 @@
|
||||
import { InfoStackMessage } from './InfoStackMessage';
|
||||
import { IWorldEntity } from '../interfaces/IWorldEntity';
|
||||
import { EntityType } from '../enums/EntityType';
|
||||
import { World } from '../world/World';
|
||||
export declare class InfoStack implements IWorldEntity {
|
||||
updateOrder: number;
|
||||
entityType: EntityType;
|
||||
messages: InfoStackMessage[];
|
||||
entranceAnimation: string;
|
||||
exitAnimation: string;
|
||||
messageDuration: number;
|
||||
addMessage(text: string): void;
|
||||
update(timeStep: number): void;
|
||||
addToWorld(world: World): void;
|
||||
removeFromWorld(world: World): void;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { InfoStack } from './InfoStack';
|
||||
export declare class InfoStackMessage {
|
||||
domElement: HTMLElement;
|
||||
private customConsole;
|
||||
private elapsedTime;
|
||||
private removalTriggered;
|
||||
constructor(console: InfoStack, domElement: HTMLElement);
|
||||
update(timeStep: number): void;
|
||||
private triggerRemoval;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
import { World } from '../world/World';
|
||||
import { IInputReceiver } from '../interfaces/IInputReceiver';
|
||||
import { IUpdatable } from '../interfaces/IUpdatable';
|
||||
export declare class InputManager implements IUpdatable {
|
||||
updateOrder: number;
|
||||
world: World;
|
||||
domElement: any;
|
||||
pointerLock: any;
|
||||
isLocked: boolean;
|
||||
inputReceiver: IInputReceiver;
|
||||
boundOnMouseDown: (evt: any) => void;
|
||||
boundOnMouseMove: (evt: any) => void;
|
||||
boundOnMouseUp: (evt: any) => void;
|
||||
boundOnMouseWheelMove: (evt: any) => void;
|
||||
boundOnPointerlockChange: (evt: any) => void;
|
||||
boundOnPointerlockError: (evt: any) => void;
|
||||
boundOnKeyDown: (evt: any) => void;
|
||||
boundOnKeyUp: (evt: any) => void;
|
||||
constructor(world: World, domElement: HTMLElement);
|
||||
update(timestep: number, unscaledTimeStep: number): void;
|
||||
setInputReceiver(receiver: IInputReceiver): void;
|
||||
setPointerLock(enabled: boolean): void;
|
||||
onPointerlockChange(event: MouseEvent): void;
|
||||
onPointerlockError(event: MouseEvent): void;
|
||||
onMouseDown(event: MouseEvent): void;
|
||||
onMouseMove(event: MouseEvent): void;
|
||||
onMouseUp(event: MouseEvent): void;
|
||||
onKeyDown(event: KeyboardEvent): void;
|
||||
onKeyUp(event: KeyboardEvent): void;
|
||||
onMouseWheelMove(event: WheelEvent): void;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
export declare class KeyBinding {
|
||||
eventCodes: string[];
|
||||
isPressed: boolean;
|
||||
justPressed: boolean;
|
||||
justReleased: boolean;
|
||||
constructor(...code: string[]);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { LoadingTrackerEntry } from './LoadingTrackerEntry';
|
||||
import { Scenario } from '../world/Scenario';
|
||||
import { World } from '../world/World';
|
||||
export declare class LoadingManager {
|
||||
firstLoad: boolean;
|
||||
onFinishedCallback: () => void;
|
||||
private world;
|
||||
private gltfLoader;
|
||||
private loadingTracker;
|
||||
constructor(world: World);
|
||||
loadGLTF(path: string, onLoadingFinished: (gltf: any) => void): void;
|
||||
addLoadingEntry(path: string): LoadingTrackerEntry;
|
||||
doneLoading(trackerEntry: LoadingTrackerEntry): void;
|
||||
createWelcomeScreenCallback(scenario: Scenario): void;
|
||||
private getLoadingPercentage;
|
||||
private isLoadingDone;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export declare class LoadingTrackerEntry {
|
||||
path: string;
|
||||
progress: number;
|
||||
finished: boolean;
|
||||
constructor(path: string);
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
export declare class UIManager {
|
||||
static setUserInterfaceVisible(value: boolean): void;
|
||||
static setLoadingScreenVisible(value: boolean): void;
|
||||
static setFPSVisible(value: boolean): void;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
export declare enum CollisionGroups {
|
||||
Default = 1,
|
||||
Characters = 2,
|
||||
TrimeshColliders = 4
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
export declare enum EntityType {
|
||||
Character = 0,
|
||||
Airplane = 1,
|
||||
Car = 2,
|
||||
Helicopter = 3,
|
||||
Decoration = 4,
|
||||
System = 5
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
export declare enum SeatType {
|
||||
Driver = "driver",
|
||||
Passenger = "passenger"
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
export declare enum Side {
|
||||
Left = "left",
|
||||
Right = "right"
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
export declare enum Space {
|
||||
Local = "local",
|
||||
Global = "global"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { Character } from '../characters/Character';
|
||||
export interface ICharacterAI {
|
||||
character: Character;
|
||||
update(timeStep: number): void;
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
export interface ICharacterState {
|
||||
canFindVehiclesToEnter: boolean;
|
||||
canEnterVehicles: boolean;
|
||||
canLeaveVehicles: boolean;
|
||||
update(timeStep: number): void;
|
||||
onInputChange(): void;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export interface ICollider {
|
||||
body: CANNON.Body;
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
import { Character } from '../characters/Character';
|
||||
import { IInputReceiver } from './IInputReceiver';
|
||||
import { VehicleSeat } from '../vehicles/VehicleSeat';
|
||||
import { EntityType } from '../enums/EntityType';
|
||||
export interface IControllable extends IInputReceiver {
|
||||
entityType: EntityType;
|
||||
seats: VehicleSeat[];
|
||||
position: THREE.Vector3;
|
||||
controllingCharacter: Character;
|
||||
triggerAction(actionName: string, value: boolean): void;
|
||||
resetControls(): void;
|
||||
allowSleep(value: boolean): void;
|
||||
onInputChange(): void;
|
||||
noDirectionPressed(): boolean;
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
import { KeyBinding } from '../core/KeyBinding';
|
||||
export interface IInputReceiver {
|
||||
actions: {
|
||||
[action: string]: KeyBinding;
|
||||
};
|
||||
handleKeyboardEvent(event: KeyboardEvent, code: string, pressed: boolean): void;
|
||||
handleMouseButton(event: MouseEvent, code: string, pressed: boolean): void;
|
||||
handleMouseMove(event: MouseEvent, deltaX: number, deltaY: number): void;
|
||||
handleMouseWheel(event: WheelEvent, value: number): void;
|
||||
inputReceiverInit(): void;
|
||||
inputReceiverUpdate(timeStep: number): void;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { World } from '../world/World';
|
||||
import { LoadingManager } from '../core/LoadingManager';
|
||||
export interface ISpawnPoint {
|
||||
spawn(loadingManager: LoadingManager, world: World): void;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
export interface IUpdatable {
|
||||
updateOrder: number;
|
||||
update(timestep: number, unscaledTimeStep: number): void;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { World } from '../world/World';
|
||||
import { EntityType } from '../enums/EntityType';
|
||||
import { IUpdatable } from './IUpdatable';
|
||||
export interface IWorldEntity extends IUpdatable {
|
||||
entityType: EntityType;
|
||||
addToWorld(world: World): void;
|
||||
removeFromWorld(world: World): void;
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
import * as CANNON from 'cannon';
|
||||
import * as THREE from 'three';
|
||||
import { ICollider } from '../../interfaces/ICollider';
|
||||
export declare class BoxCollider implements ICollider {
|
||||
options: any;
|
||||
body: CANNON.Body;
|
||||
debugModel: THREE.Mesh;
|
||||
constructor(options: any);
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import * as CANNON from 'cannon';
|
||||
import { ICollider } from '../../interfaces/ICollider';
|
||||
export declare class CapsuleCollider implements ICollider {
|
||||
options: any;
|
||||
body: CANNON.Body;
|
||||
constructor(options: any);
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
import * as CANNON from 'cannon';
|
||||
import { ICollider } from '../../interfaces/ICollider';
|
||||
import { Object3D } from 'three';
|
||||
export declare class ConvexCollider implements ICollider {
|
||||
mesh: any;
|
||||
options: any;
|
||||
body: CANNON.Body;
|
||||
debugModel: any;
|
||||
constructor(mesh: Object3D, options: any);
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
import * as CANNON from 'cannon';
|
||||
import * as THREE from 'three';
|
||||
import { ICollider } from '../../interfaces/ICollider';
|
||||
export declare class SphereCollider implements ICollider {
|
||||
options: any;
|
||||
body: CANNON.Body;
|
||||
debugModel: THREE.Mesh;
|
||||
constructor(options: any);
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
import * as CANNON from 'cannon';
|
||||
import { ICollider } from '../../interfaces/ICollider';
|
||||
import { Object3D } from 'three';
|
||||
export declare class TrimeshCollider implements ICollider {
|
||||
mesh: any;
|
||||
options: any;
|
||||
body: CANNON.Body;
|
||||
debugModel: any;
|
||||
constructor(mesh: Object3D, options: any);
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
import { SimulatorBase } from './SimulatorBase';
|
||||
import { SimulationFrame } from './SimulationFrame';
|
||||
export declare class RelativeSpringSimulator extends SimulatorBase {
|
||||
position: number;
|
||||
velocity: number;
|
||||
target: number;
|
||||
lastLerp: number;
|
||||
cache: SimulationFrame[];
|
||||
constructor(fps: number, mass: number, damping: number, startPosition?: number, startVelocity?: number);
|
||||
/**
|
||||
* Advances the simulation by given time step
|
||||
* @param {number} timeStep
|
||||
*/
|
||||
simulate(timeStep: number): void;
|
||||
/**
|
||||
* Gets another simulation frame
|
||||
*/
|
||||
getFrame(isLastFrame: boolean): SimulationFrame;
|
||||
}
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
export declare class SimulationFrame {
|
||||
position: number;
|
||||
velocity: number;
|
||||
constructor(position: number, velocity: number);
|
||||
}
|
||||
Sketchbook-master/Sketchbook-master/build/types/physics/spring_simulation/SimulationFrameVector.d.ts
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
export declare class SimulationFrameVector {
|
||||
position: THREE.Vector3;
|
||||
velocity: THREE.Vector3;
|
||||
constructor(position: THREE.Vector3, velocity: THREE.Vector3);
|
||||
}
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
export declare abstract class SimulatorBase {
|
||||
mass: any;
|
||||
damping: any;
|
||||
frameTime: number;
|
||||
offset: number;
|
||||
abstract cache: any[];
|
||||
constructor(fps: number, mass: number, damping: number);
|
||||
setFPS(value: number): void;
|
||||
lastFrame(): any;
|
||||
/**
|
||||
* Generates frames between last simulation call and the current one
|
||||
* @param {timeStep} timeStep
|
||||
*/
|
||||
generateFrames(timeStep: number): void;
|
||||
abstract getFrame(isLastFrame: boolean): any;
|
||||
abstract simulate(timeStep: number): void;
|
||||
}
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
import { SimulatorBase } from './SimulatorBase';
|
||||
import { SimulationFrame } from './SimulationFrame';
|
||||
export declare class SpringSimulator extends SimulatorBase {
|
||||
position: number;
|
||||
velocity: number;
|
||||
target: number;
|
||||
cache: SimulationFrame[];
|
||||
constructor(fps: number, mass: number, damping: number, startPosition?: number, startVelocity?: number);
|
||||
/**
|
||||
* Advances the simulation by given time step
|
||||
* @param {number} timeStep
|
||||
*/
|
||||
simulate(timeStep: number): void;
|
||||
/**
|
||||
* Gets another simulation frame
|
||||
*/
|
||||
getFrame(isLastFrame: boolean): SimulationFrame;
|
||||
}
|
||||
Sketchbook-master/Sketchbook-master/build/types/physics/spring_simulation/VectorSpringSimulator.d.ts
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
import * as THREE from 'three';
|
||||
import { SimulatorBase } from './SimulatorBase';
|
||||
import { SimulationFrameVector } from './SimulationFrameVector';
|
||||
export declare class VectorSpringSimulator extends SimulatorBase {
|
||||
position: THREE.Vector3;
|
||||
velocity: THREE.Vector3;
|
||||
target: THREE.Vector3;
|
||||
cache: SimulationFrameVector[];
|
||||
constructor(fps: number, mass: number, damping: number);
|
||||
init(): void;
|
||||
/**
|
||||
* Advances the simulation by given time step
|
||||
* @param {number} timeStep
|
||||
*/
|
||||
simulate(timeStep: number): void;
|
||||
/**
|
||||
* Gets another simulation frame
|
||||
*/
|
||||
getFrame(isLastFrame: boolean): SimulationFrameVector;
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
import '../css/main.css';
|
||||
export { World } from './world/World';
|
||||
@@ -0,0 +1,27 @@
|
||||
import * as THREE from 'three';
|
||||
import * as CANNON from 'cannon';
|
||||
import { Vehicle } from './Vehicle';
|
||||
import { IControllable } from '../interfaces/IControllable';
|
||||
import { IWorldEntity } from '../interfaces/IWorldEntity';
|
||||
import { EntityType } from '../enums/EntityType';
|
||||
export declare class Airplane extends Vehicle implements IControllable, IWorldEntity {
|
||||
entityType: EntityType;
|
||||
rotor: THREE.Object3D;
|
||||
leftAileron: THREE.Object3D;
|
||||
rightAileron: THREE.Object3D;
|
||||
elevators: THREE.Object3D[];
|
||||
rudder: THREE.Object3D;
|
||||
private steeringSimulator;
|
||||
private aileronSimulator;
|
||||
private elevatorSimulator;
|
||||
private rudderSimulator;
|
||||
private enginePower;
|
||||
private lastDrag;
|
||||
constructor(gltf: any);
|
||||
noDirectionPressed(): boolean;
|
||||
update(timeStep: number): void;
|
||||
physicsPreStep(body: CANNON.Body, plane: Airplane): void;
|
||||
onInputChange(): void;
|
||||
readAirplaneData(gltf: any): void;
|
||||
inputReceiverInit(): void;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import * as CANNON from 'cannon';
|
||||
import { Vehicle } from './Vehicle';
|
||||
import { IControllable } from '../interfaces/IControllable';
|
||||
import { EntityType } from '../enums/EntityType';
|
||||
export declare class Car extends Vehicle implements IControllable {
|
||||
entityType: EntityType;
|
||||
drive: string;
|
||||
get speed(): number;
|
||||
private _speed;
|
||||
private steeringWheel;
|
||||
private airSpinTimer;
|
||||
private steeringSimulator;
|
||||
private gear;
|
||||
private shiftTimer;
|
||||
private timeToShift;
|
||||
private canTiltForwards;
|
||||
private characterWantsToExit;
|
||||
constructor(gltf: any);
|
||||
noDirectionPressed(): boolean;
|
||||
update(timeStep: number): void;
|
||||
shiftUp(): void;
|
||||
shiftDown(): void;
|
||||
physicsPreStep(body: CANNON.Body, car: Car): void;
|
||||
onInputChange(): void;
|
||||
inputReceiverInit(): void;
|
||||
readCarData(gltf: any): void;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import * as THREE from 'three';
|
||||
import * as CANNON from 'cannon';
|
||||
import { Vehicle } from './Vehicle';
|
||||
import { IControllable } from '../interfaces/IControllable';
|
||||
import { IWorldEntity } from '../interfaces/IWorldEntity';
|
||||
import { EntityType } from '../enums/EntityType';
|
||||
export declare class Helicopter extends Vehicle implements IControllable, IWorldEntity {
|
||||
entityType: EntityType;
|
||||
rotors: THREE.Object3D[];
|
||||
private enginePower;
|
||||
constructor(gltf: any);
|
||||
noDirectionPressed(): boolean;
|
||||
update(timeStep: number): void;
|
||||
onInputChange(): void;
|
||||
physicsPreStep(body: CANNON.Body, heli: Helicopter): void;
|
||||
readHelicopterData(gltf: any): void;
|
||||
inputReceiverInit(): void;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import * as THREE from 'three';
|
||||
import { Vehicle } from './Vehicle';
|
||||
import { VehicleSeat } from './VehicleSeat';
|
||||
export declare class VehicleDoor {
|
||||
vehicle: Vehicle;
|
||||
seat: VehicleSeat;
|
||||
doorObject: THREE.Object3D;
|
||||
doorVelocity: number;
|
||||
doorWorldPos: THREE.Vector3;
|
||||
lastTrailerPos: THREE.Vector3;
|
||||
lastTrailerVel: THREE.Vector3;
|
||||
rotation: number;
|
||||
achievingTargetRotation: boolean;
|
||||
physicsEnabled: boolean;
|
||||
targetRotation: number;
|
||||
rotationSpeed: number;
|
||||
lastVehicleVel: THREE.Vector3;
|
||||
lastVehiclePos: THREE.Vector3;
|
||||
private sideMultiplier;
|
||||
constructor(seat: VehicleSeat, object: THREE.Object3D);
|
||||
update(timestep: number): void;
|
||||
preStepCallback(): void;
|
||||
open(): void;
|
||||
close(): void;
|
||||
resetPhysTrailer(): void;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import * as THREE from 'three';
|
||||
import { SeatType } from '../enums/SeatType';
|
||||
import { IControllable } from '../interfaces/IControllable';
|
||||
import { VehicleDoor } from './VehicleDoor';
|
||||
import { Character } from '../characters/Character';
|
||||
export declare class VehicleSeat {
|
||||
vehicle: IControllable;
|
||||
seatPointObject: THREE.Object3D;
|
||||
connectedSeatsString: string;
|
||||
connectedSeats: VehicleSeat[];
|
||||
type: SeatType;
|
||||
entryPoints: THREE.Object3D[];
|
||||
door: VehicleDoor;
|
||||
occupiedBy: Character;
|
||||
constructor(vehicle: IControllable, object: THREE.Object3D, gltf: any);
|
||||
update(timeStep: number): void;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
export declare class Wheel {
|
||||
wheelObject: THREE.Object3D;
|
||||
position: THREE.Vector3;
|
||||
steering: boolean;
|
||||
drive: string;
|
||||
rayCastWheelInfoIndex: number;
|
||||
constructor(wheelObject: THREE.Object3D);
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
import { Character } from '../characters/Character';
|
||||
import * as THREE from 'three';
|
||||
import * as CANNON from 'cannon';
|
||||
import { World } from '../world/World';
|
||||
import { KeyBinding } from '../core/KeyBinding';
|
||||
import { VehicleSeat } from './VehicleSeat';
|
||||
import { Wheel } from './Wheel';
|
||||
import { EntityType } from '../enums/EntityType';
|
||||
import { IWorldEntity } from '../interfaces/IWorldEntity';
|
||||
export declare abstract class Vehicle extends THREE.Object3D implements IWorldEntity {
|
||||
updateOrder: number;
|
||||
abstract entityType: EntityType;
|
||||
controllingCharacter: Character;
|
||||
actions: {
|
||||
[action: string]: KeyBinding;
|
||||
};
|
||||
rayCastVehicle: CANNON.RaycastVehicle;
|
||||
seats: VehicleSeat[];
|
||||
wheels: Wheel[];
|
||||
drive: string;
|
||||
camera: any;
|
||||
world: World;
|
||||
help: THREE.AxesHelper;
|
||||
collision: CANNON.Body;
|
||||
materials: THREE.Material[];
|
||||
spawnPoint: THREE.Object3D;
|
||||
private modelContainer;
|
||||
private firstPerson;
|
||||
constructor(gltf: any, handlingSetup?: any);
|
||||
noDirectionPressed(): boolean;
|
||||
update(timeStep: number): void;
|
||||
forceCharacterOut(): void;
|
||||
onInputChange(): void;
|
||||
resetControls(): void;
|
||||
allowSleep(value: boolean): void;
|
||||
handleKeyboardEvent(event: KeyboardEvent, code: string, pressed: boolean): void;
|
||||
setFirstPersonView(value: boolean): void;
|
||||
toggleFirstPersonView(): void;
|
||||
triggerAction(actionName: string, value: boolean): void;
|
||||
handleMouseButton(event: MouseEvent, code: string, pressed: boolean): void;
|
||||
handleMouseMove(event: MouseEvent, deltaX: number, deltaY: number): void;
|
||||
handleMouseWheel(event: WheelEvent, value: number): void;
|
||||
inputReceiverInit(): void;
|
||||
inputReceiverUpdate(timeStep: number): void;
|
||||
setPosition(x: number, y: number, z: number): void;
|
||||
setSteeringValue(val: number): void;
|
||||
applyEngineForce(force: number): void;
|
||||
setBrake(brakeForce: number, driveFilter?: string): void;
|
||||
addToWorld(world: World): void;
|
||||
removeFromWorld(world: World): void;
|
||||
readVehicleData(gltf: any): void;
|
||||
private connectSeats;
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
import { ISpawnPoint } from '../interfaces/ISpawnPoint';
|
||||
import * as THREE from 'three';
|
||||
import { World } from './World';
|
||||
import { LoadingManager } from '../core/LoadingManager';
|
||||
export declare class CharacterSpawnPoint implements ISpawnPoint {
|
||||
private object;
|
||||
constructor(object: THREE.Object3D);
|
||||
spawn(loadingManager: LoadingManager, world: World): void;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import * as THREE from 'three';
|
||||
import { World } from './World';
|
||||
import { IUpdatable } from '../interfaces/IUpdatable';
|
||||
export declare class Ocean implements IUpdatable {
|
||||
updateOrder: number;
|
||||
material: THREE.ShaderMaterial;
|
||||
private world;
|
||||
constructor(object: any, world: World);
|
||||
update(timeStep: number): void;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { PathNode } from './PathNode';
|
||||
export declare class Path {
|
||||
nodes: {
|
||||
[nodeName: string]: PathNode;
|
||||
};
|
||||
private rootNode;
|
||||
constructor(root: THREE.Object3D);
|
||||
addNode(child: any): void;
|
||||
connectNodes(): void;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import { Path } from './Path';
|
||||
import { Object3D } from 'three';
|
||||
export declare class PathNode {
|
||||
object: Object3D;
|
||||
path: Path;
|
||||
nextNode: PathNode;
|
||||
previousNode: PathNode;
|
||||
constructor(child: THREE.Object3D, path: Path);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { World } from '../world/World';
|
||||
import { LoadingManager } from '../core/LoadingManager';
|
||||
export declare class Scenario {
|
||||
id: string;
|
||||
name: string;
|
||||
spawnAlways: boolean;
|
||||
default: boolean;
|
||||
world: World;
|
||||
descriptionTitle: string;
|
||||
descriptionContent: string;
|
||||
private rootNode;
|
||||
private spawnPoints;
|
||||
private invisible;
|
||||
private initialCameraAngle;
|
||||
constructor(root: THREE.Object3D, world: World);
|
||||
createLaunchLink(): void;
|
||||
launch(loadingManager: LoadingManager, world: World): void;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import * as THREE from 'three';
|
||||
import { World } from './World';
|
||||
import { IUpdatable } from '../interfaces/IUpdatable';
|
||||
import { default as CSM } from 'three-csm';
|
||||
export declare class Sky extends THREE.Object3D implements IUpdatable {
|
||||
updateOrder: number;
|
||||
sunPosition: THREE.Vector3;
|
||||
csm: CSM;
|
||||
set theta(value: number);
|
||||
set phi(value: number);
|
||||
private _phi;
|
||||
private _theta;
|
||||
private hemiLight;
|
||||
private maxHemiIntensity;
|
||||
private minHemiIntensity;
|
||||
private skyMesh;
|
||||
private skyMaterial;
|
||||
private world;
|
||||
constructor(world: World);
|
||||
update(timeScale: number): void;
|
||||
refreshSunPosition(): void;
|
||||
refreshHemiIntensity(): void;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import * as THREE from 'three';
|
||||
import { ISpawnPoint } from '../interfaces/ISpawnPoint';
|
||||
import { World } from '../world/World';
|
||||
import { LoadingManager } from '../core/LoadingManager';
|
||||
export declare class VehicleSpawnPoint implements ISpawnPoint {
|
||||
type: string;
|
||||
driver: string;
|
||||
firstAINode: string;
|
||||
private object;
|
||||
constructor(object: THREE.Object3D);
|
||||
spawn(loadingManager: LoadingManager, world: World): void;
|
||||
private getNewVehicleByType;
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
import * as THREE from 'three';
|
||||
import * as CANNON from 'cannon';
|
||||
import { CameraOperator } from '../core/CameraOperator';
|
||||
import { Stats } from '../../lib/utils/Stats';
|
||||
import { CannonDebugRenderer } from '../../lib/cannon/CannonDebugRenderer';
|
||||
import { InputManager } from '../core/InputManager';
|
||||
import { LoadingManager } from '../core/LoadingManager';
|
||||
import { InfoStack } from '../core/InfoStack';
|
||||
import { IWorldEntity } from '../interfaces/IWorldEntity';
|
||||
import { IUpdatable } from '../interfaces/IUpdatable';
|
||||
import { Character } from '../characters/Character';
|
||||
import { Path } from './Path';
|
||||
import { Vehicle } from '../vehicles/Vehicle';
|
||||
import { Scenario } from './Scenario';
|
||||
import { Sky } from './Sky';
|
||||
export declare class World {
|
||||
renderer: THREE.WebGLRenderer;
|
||||
camera: THREE.PerspectiveCamera;
|
||||
composer: any;
|
||||
stats: Stats;
|
||||
graphicsWorld: THREE.Scene;
|
||||
sky: Sky;
|
||||
physicsWorld: CANNON.World;
|
||||
parallelPairs: any[];
|
||||
physicsFrameRate: number;
|
||||
physicsFrameTime: number;
|
||||
physicsMaxPrediction: number;
|
||||
clock: THREE.Clock;
|
||||
renderDelta: number;
|
||||
logicDelta: number;
|
||||
requestDelta: number;
|
||||
sinceLastFrame: number;
|
||||
justRendered: boolean;
|
||||
params: any;
|
||||
inputManager: InputManager;
|
||||
cameraOperator: CameraOperator;
|
||||
timeScaleTarget: number;
|
||||
console: InfoStack;
|
||||
cannonDebugRenderer: CannonDebugRenderer;
|
||||
scenarios: Scenario[];
|
||||
characters: Character[];
|
||||
vehicles: Vehicle[];
|
||||
paths: Path[];
|
||||
scenarioGUIFolder: any;
|
||||
updatables: IUpdatable[];
|
||||
private lastScenarioID;
|
||||
constructor(worldScenePath?: any);
|
||||
update(timeStep: number, unscaledTimeStep: number): void;
|
||||
updatePhysics(timeStep: number): void;
|
||||
isOutOfBounds(position: CANNON.Vec3): boolean;
|
||||
outOfBoundsRespawn(body: CANNON.Body, position?: CANNON.Vec3): void;
|
||||
/**
|
||||
* Rendering loop.
|
||||
* Implements fps limiter and frame-skipping
|
||||
* Calls world's "update" function before rendering.
|
||||
* @param {World} world
|
||||
*/
|
||||
render(world: World): void;
|
||||
setTimeScale(value: number): void;
|
||||
add(worldEntity: IWorldEntity): void;
|
||||
registerUpdatable(registree: IUpdatable): void;
|
||||
remove(worldEntity: IWorldEntity): void;
|
||||
unregisterUpdatable(registree: IUpdatable): void;
|
||||
loadScene(loadingManager: LoadingManager, gltf: any): void;
|
||||
launchScenario(scenarioID: string, loadingManager?: LoadingManager): void;
|
||||
restartScenario(): void;
|
||||
clearEntities(): void;
|
||||
scrollTheTimeScale(scrollAmount: number): void;
|
||||
updateControls(controls: any): void;
|
||||
private generateHTML;
|
||||
private createParamsGUI;
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
@@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Sketchbook</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script src="build/sketchbook.min.js"></script>
|
||||
<script>
|
||||
const world = new Sketchbook.World('build/assets/world.glb');
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
+13480
File diff suppressed because it is too large.
Load diff
Loaded 100 of 221 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user