Giter Site home page Giter Site logo

whitestormjs / whs.js Goto Github PK

View Code? Open in Web Editor NEW
6.1K 251.0 390.0 341.83 MB

:rocket: ๐ŸŒช Super-fast 3D framework for Web Applications ๐Ÿฅ‡ & Games ๐ŸŽฎ. Based on Three.js

License: MIT License

JavaScript 99.98% TypeScript 0.02%
physics framework high-performance web-development webpack component-driven modular react scene-graph

whs.js's Introduction

Three Build Status

Community chat. Join us!

Discord

Table of content

New releases

whs is currently at v2 major version. We had plans for v3 yet but development isn't active. So v2 will probably remain the main stable version until further notice.

We try to publish minor update releases for bug fixes, we will review PRs.

NPM

# Install npm version
$ npm install whs

For [email protected] (Three.js r92) use @beta tag

# Install npm version
$ npm install whs@beta

NPM Version

Basic setup

Download the minified library or link the one from CDN

<script src="js/three.min.js"></script>
<script src="js/whs.min.js"></script>

The code below makes a WHS.App instance which handles all your modules and components for better work with WebGL. This one creates a scene, camera and renderer - we add the following modules to the App.

const app = new WHS.App([
  new WHS.ElementModule(), // Apply to DOM.
  new WHS.SceneModule(), // Create a new THREE.Scene and set it to app.

  new WHS.DefineModule('camera', new WHS.PerspectiveCamera({ // Apply a camera.
    position: new THREE.Vector3(0, 0, 50)
  })),

  new WHS.RenderingModule({bgColor: 0x162129}), // Apply THREE.WebGLRenderer
  new WHS.ResizeModule() // Make it resizable.
]);

app.start(); // Run app.

Featured projects

https://moxy.studio/ https://rmallick6806.github.io/SolarSystemBuilder/ http://www.tpain.com/ http://artifacts.zone/lorenzav/ http://artifacts.zone/tree/ http://abdaily.surge.sh/4/ http://abdaily.surge.sh/2/ http://abdaily.surge.sh/1/ http://theroguepixel.com/ http://supertiny.agency/ https://alexbuzin.me/ https://spatial.100shapes.com/ http://plateaux.space/

Features

  • ๐Ÿ’Ž Simple in usage
  • ๐Ÿš€ Speeds up 3D scene prototyping
  • ๐Ÿ”Œ Component based scene graph
  • ๐Ÿ’ฃ Simple integration of any high performance physics even with Worker (Multithreading)
  • ๐Ÿ’ซ Automatization of rendering
  • ๐Ÿ†• ES2015+ based
  • ๐Ÿ”ท Extension system (modules)
  • ๐Ÿ“ฆ Webpack friendly
  • โœ”๏ธ Integrated Three.js rendering engine
  • ๐Ÿ’ž Work with whs.js and Three.js at the same time

External Modules

Name Status Description
physics-module-ammonext NPM Version Physics module based on Ammo.js

Donate

OpenCollective Backers OpenCollective Sponsors

Backers

Support us with a monthly donation and help us continue framework development๐ŸŽ‰ and adding new features๐Ÿ’ก๐ŸŽ.

whs.js's People

Contributors

bdirl avatar brookshuihualee avatar caco26i avatar codetriage-readme-bot avatar electron0zero avatar hirako2000 avatar jackdalton avatar jackdalton2 avatar jule- avatar noahcoetsee avatar noctisdark avatar panaweec avatar pbalmasov avatar preco21 avatar queengooborg avatar rw251 avatar sasha240100 avatar shaochun avatar shshaw avatar sr6033 avatar taro-0 avatar thejmazz avatar timluq avatar timoxley avatar tyliec avatar typedef42 avatar utrobin avatar yeliex avatar zlatanvasovic avatar zwernberg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

whs.js's Issues

[Bug] Object controls

Cannot control object position, rotation or scale with it's scope.
Example

horse = game.addMorph('assets/models/morph/horse.js',{
  pos: {
    x: 0, y: 0, z: 0
  },
  scale: {
    x: 0.1, y: 0.1, z: 0.1
  }
});
horse._pos.x = 10; //Doesn't do anything, even tried from chrome's console
horse.mesh.position.x = 10; //Works instead

I suggest making scope._pos the same as mesh.pos

[Improve] Engine structure.

To-do:

  • Fix code style in:
    • src/libs/firstPersonControls.js (Remove unnecessary varibles, unused lines of code) (Follow guidelines)
    • src/Objects/addObject.js (Unused code. Complexity.) (Follow guidelines)
    • src/Skybox/addSkybox.js (Unused code. Complexity.) (Follow guidelines)
    • src/Shaders/ShaderTerrain.js (Remove commented code) (Follow guidelines)
    • src/Controls/FPSControls.js (Unused code. Complexity.) (Follow guidelines)
    • Other files in src/ folder. (Follow guidelines)
      • API/*
      • Ground/*
      • Objects/*
      • Controls/*
      • Plugins/*
      • Wagner/*
      • Watchers/*

Guidelines:

  • Follow code style guides:
  • Each line of code should not be longer than 80 symbols
  • https://www.codacy.com/app/siteprogcom/WhitestormJS/dashboard
  • After you fixed one file:
    • Write CSF. {filenamehere} to current version in CHANGELOG.md file.
    • Commit with msg CSF. {filenamhere} #25 or just CSF.
  • Engine structure:
    • src/libs/firstPersonControls.js -> src/Controls/FPSControls.js (Wrap code from 1 file to 2 file)
    • Fix filenames in src/folder :
      • FirstSecondWord.js
      • in src/libs/ keep them like they are. (already done).
    • Clean gulpfile.
    • Remove src/API/Def.js.
    • src/API/IsSame.js-> src/API/RemoveDuplicateFaces.js (Wrap code from 1 file to 2 file)
    • Remove src/API/Loaders.js and src/API/Shape.js (Reason: they are too small)
    • Sort unsorted files.
    • Remove jquery library.
    • Remove assets/ folder.
    • Remove src/API/RotateBody.js (Reason: no need since cannonjs -> physijs)
    • src/libs/OrbitControls.js (Fix parameter.)
    • src/Watchers/Watch.js -> src/API/Watch.js
  • Code structure:
    • src/API/Wrap.js (move scope.remove, scope.retrieve to construct prototype).
    • src/Objects/addObject.js ([Remove] move scope.remove, scope.retrieve toconstruct prototype).
    • Remove dependencies from jQuery (jQuery -> DOM)
    • src/API/Texture.js (defaults for properties).
    • api.def -> $.extend
    • src/whitestorm.js (Use api from src/Watchers/Watch.js)
    • scope.visible -> scope.mesh
    • scope.body - remove.

[Improve] Use aria attributes

Accessible Rich Internet Applications (ARIA)

Use accessibility attributes like aria-label to provide meaningful information for people with visual disabilities.

For more information go to ARIA in HTML

What files to fix:
examples/basic.html
examples/basic_material.html
examples/basic_model.html
examples/fps.html
examples/plugin_example.html
examples/skybox.html
examples/stone_wall.html
or any new example *.html file

How To Do it:
Examples are on Mozilla website Web Technology For Developers

How to test it:

  1. Install Vorlon.JS

  2. add the following line into your test HTML file:

'< script src="http://localhost:1337/vorlon.js" >' '< /script >'

  1. Once Vorlon.JS is done installing, run the server:

$ vorlon

  1. With the server is running, open http://localhost:1337 in your browser to see the Vorlon.JS dashboard.

  2. Open your test html file, and it should appear on the Vorlon.JS dashboard.

  3. In the dashboard, click on the button Best Practice: Accessibility and check the
    use aria attributes

[Improve] Add lang attr on HTML tag

Lang attribute on HTML tag helps people finding out if they will understand content without having to get deep into it.

For more information go to W3

What files to fix:
examples/basic.html
examples/basic_material.html
examples/basic_model.html
examples/fps.html
examples/plugin_example.html
examples/skybox.html
examples/stone_wall.html
or any new example *.html file

How To Do it:
Add language attribute, for example, lang="fr"

How to test it:

  1. Install Vorlon.JS

  2. add the following line into your test HTML file:

'< script src="http://localhost:1337/vorlon.js" >' '< /script >'

  1. Once Vorlon.JS is done installing, run the server:

$ vorlon

  1. With the server is running, open http://localhost:1337 in your browser to see the Vorlon.JS dashboard.

  2. Open your test html file, and it should appear on the Vorlon.JS dashboard.

  3. In the dashboard, click on the button Best Practice: Accessibility and check the
    add lang attr on HTML tag

[Improve] Try bundling your files

Multiple http requests makes your site slower, especially on mobile devices.

What files to fix:
examples/basic.html
examples/basic_material.html
examples/basic_model.html
examples/fps.html
examples/plugin_example.html
examples/skybox.html
examples/stone_wall.html
or any new example *.html file

How To Do it:
Preliminary tests with Vorlon.JS show that there are more than 5 scripts files in a page with the recommendation "consider bundling your scripts".

How to test it:

  1. Install Vorlon.JS

  2. add the following line into your test HTML file:

'< script src="http://localhost:1337/vorlon.js" >' '< /script >'

  1. Once Vorlon.JS is done installing, run the server:

$ vorlon

  1. With the server is running, open http://localhost:1337 in your browser to see the Vorlon.JS dashboard.

  2. Open your test html file, and it should appear on the Vorlon.JS dashboard.

  3. In the dashboard, click on the button Best Practice: PERFORMANCE and check the
    try bundling your files

[Improve] Use meta viewport

Use meta viewport tag to choose how your website will get scaled on smaller devices like phones.

What files to fix:
examples/basic.html
examples/basic_material.html
examples/basic_model.html
examples/fps.html
examples/plugin_example.html
examples/skybox.html
examples/stone_wall.html
or any new example *.html file

How To Do it:
Define at least

How to test it:

  1. Install Vorlon.JS

  2. add the following line into your test HTML file:

'< script src="http://localhost:1337/vorlon.js" >' '< /script >'

  1. Once Vorlon.JS is done installing, run the server:

$ vorlon

  1. With the server is running, open http://localhost:1337 in your browser to see the Vorlon.JS dashboard.

  2. Open your test html file, and it should appear on the Vorlon.JS dashboard.

  3. In the dashboard, click on the button Best Practice: MOBILE WEB
    and check the use meta viewport tag.

[Improve] Define platform icons

Platform icons helps user pinning your website with an icon that fits well on mobile device home.

What files to fix:
examples/basic.html
examples/basic_material.html
examples/basic_model.html
examples/fps.html
examples/plugin_example.html
examples/skybox.html
examples/stone_wall.html
or any new example *.html file

How To Do it:
add Apple - iOS icons by adding link tags like
'< link rel="apple-touch-icon-precomposed" href="youricon" sizes="57x57" />'

add Microsoft - Windows tiles by adding meta tags like
'< link name="msapplication-square150x150logo" content="yourimage" />'

How to test it:

  1. Install Vorlon.JS

  2. add the following line into your test HTML file:

'< script src="http://localhost:1337/vorlon.js" >' '< /script >'

  1. Once Vorlon.JS is done installing, run the server:

$ vorlon

  1. With the server is running, open http://localhost:1337 in your browser to see the Vorlon.JS dashboard.

  2. Open your test html file, and it should appear on the Vorlon.JS dashboard.

  3. In the dashboard, click on the button Best Practice: MOBILE WEB
    and check the define platform icons

[Bug] MouseEvent Polyfill for browsers

Currently script won't work correctly because missed 1 thing:

if( !MouseEvent.prototype.hasOwnProperty('movementX') && // false
    !MouseEvent.prototype.hasOwnProperty('mozMovementX') ) { // true
 // Will be true

It checks for moz in chrome, and return false. Correct one:

if( !MouseEvent.prototype.hasOwnProperty('movementX') || // false
    !MouseEvent.prototype.hasOwnProperty('mozMovementX') ) { // true
 // Wll be false, because chrome allready support it.

[Improve] Code style.

Guys, i have MANY troubles with my code style ;(
So i will be glad if somebody help me in developing engine.
Contributors sought!

All code in src folder. Compile with gulp build command.

You need:

  • Contact me. [email protected]
  • Edit code in src folder.
  • Publish your change.
  • Contact me again.

TODO:

  • Line wrap.
  • Prototypes fix.
  • Restructurize libs.

[Improve] Incorrect use of prefixes

Ensure you use all vendor prefixes and unprefixed version for HTML5 CSS properties.

For more information see CSS3 animation Property

What files to fix:
examples/basic.html
examples/basic_material.html
examples/basic_model.html
examples/fps.html
examples/plugin_example.html
examples/skybox.html
examples/stone_wall.html
or any new example *.html file

How To Do it:
For an example, a test with Vorlon.JS will show what is missing and need to be added to:
inline
#animation
animation : missing -webkit-animation

How to test it:

  1. Install Vorlon.JS

  2. add the following line into your test HTML file:

'< script src="http://localhost:1337/vorlon.js" >' '< /script >'

  1. Once Vorlon.JS is done installing, run the server:

$ vorlon

  1. With the server is running, open http://localhost:1337 in your browser to see the Vorlon.JS dashboard.

  2. Open your test html file, and it should appear on the Vorlon.JS dashboard.

  3. In the dashboard, click on the button * Best Practice: WEB STANDARDS*
    and check the incorrect use of prefixes

[Bug] improve Shadowmap: bias, acne..

New shadows are still unstable. We need to improve shadowmap.
I can't find right value for scope.visible.shadowBias property. Default for solving this problem is 0.05 But in my example it looks not so good.
Some posts, that i found about this problem:

image

What i also found is: https://searchcode.com/codesearch/view/9474428/ - this can help me to write shadowmap without modifying threejs object vertices.

image

[Fix] Clean unused uniforms in terrain shader

Now uniforms looks like:

            "enableDiffuse1"  : { type: "i", value: 0 },
            "enableDiffuse2"  : { type: "i", value: 0 },
            "enableSpecular"  : { type: "i", value: 0 },
            "enableReflection": { type: "i", value: 0 },

            "tDiffuse1"    : { type: "t", value: null },
            "tDiffuse2"    : { type: "t", value: null },
            "tDetail"      : { type: "t", value: null },
            "tNormal"      : { type: "t", value: null },
            "tSpecular"    : { type: "t", value: null },
            "tDisplacement": { type: "t", value: null },

            "uNormalScale": { type: "f", value: 1.0 },

            "uDisplacementBias": { type: "f", value: 0.0 },
            "uDisplacementScale": { type: "f", value: 1.0 },

            "diffuse": { type: "c", value: new THREE.Color( 0xeeeeee ) },
            "specular": { type: "c", value: new THREE.Color( 0x111111 ) },
            "shininess": { type: "f", value: 30 },
            "opacity": { type: "f", value: 1 },

            "uRepeatBase"    : { type: "v2", value: new THREE.Vector2( 1, 1 ) },
            "uRepeatOverlay" : { type: "v2", value: new THREE.Vector2( 1, 1 ) },

            "uOffset" : { type: "v2", value: new THREE.Vector2( 0, 0 ) }

We have some unused ones in code. We need to remove them.

[Bug] FOG doesn't work

Fog doesn't work on FPS example.
Need to improve shader in src/GROUND/addGround.js

UPDATE

src/Components/Fog.js

[Improve] Commit messages

Slang.

  • WIP -> Work in progress.
  • CSF -> Code style fix.
  • README -> Readme.md update. (license, ... - the same).

[Improve] Use responsive approaches

Even if your website target only certain devices, you may have users with unexpected devices or screen ratio.

For more information see Responsive Web Design

What files to fix:
examples/basic.html
examples/basic_material.html
examples/basic_model.html
examples/fps.html
examples/plugin_example.html
examples/skybox.html
examples/stone_wall.html
or any new example *.html file

How To Do it:
Check if your css (either files or inline) use any media queries.
Check if your link tags use any media queries.

How to test it:

  1. Install Vorlon.JS

  2. add the following line into your test HTML file:

'< script src="http://localhost:1337/vorlon.js" >' '< /script >'

  1. Once Vorlon.JS is done installing, run the server:

$ vorlon

  1. With the server is running, open http://localhost:1337 in your browser to see the Vorlon.JS dashboard.

  2. Open your test html file, and it should appear on the Vorlon.JS dashboard.

  3. In the dashboard, click on the button Best Practice: MOBILE WEB and check the
    use responsive approaches

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.