2gl
Π£Π·ΠΊΠΎΡΠΏΠ΅ΡΠΈΠ°Π»ΠΈΠ·ΠΈΡΠΎΠ²Π°Π½Π½Π°Ρ Π±ΠΈΠ±Π»ΠΈΠΎΡΠ΅ΠΊΠ° WebGL Π΄Π»Ρ ΠΈΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°Π½ΠΈΡ Π² ΠΏΡΠΎΠ΅ΠΊΡΠ°Ρ 2GIS
- ΠΠ»Ρ ΡΠ°Π±ΠΎΡΡ Ρ ΠΌΠ°ΡΡΠΈΡΠ°ΠΌΠΈ ΠΈ Π²Π΅ΠΊΡΠΎΡΠ°ΠΌΠΈ ΠΈΡΠΏΠΎΠ»ΡΠ·ΡΠ΅ΡΡΡ Π±ΠΈΠ±Π»ΠΈΠΎΡΠ΅ΠΊΠ° glMatrix
- Π Π°Π±ΠΎΡΠ° Ρ Π³Π΅ΠΎΠΌΠ΅ΡΡΠΈΡΠ΅ΡΠΊΠΈΠΌΠΈ ΠΎΠ±ΡΠ΅ΠΊΡΠ°ΠΌΠΈ, Π½Π°ΠΏΡΠΈΠΌΠ΅Ρ, Plane, Line3, Ray, Π²Π·ΡΡΠ° ΠΈΠ· three.js
ΠΠ° Π΄Π°Π½Π½ΡΠΉ ΠΌΠΎΠΌΠ΅Π½Ρ ΠΌΠΎΠΆΠ΅Ρ ΡΠ°Π±ΠΎΡΠ°ΡΡ ΡΠΎ ΡΠ»Π΅Π΄ΡΡΡΠΈΠΌΠΈ ΡΠΈΠΏΠ°ΠΌΠΈ ΠΎΠ±ΡΠ΅ΠΊΡΠΎΠ² Π΄Π»Ρ ΠΎΡΠΎΠ±ΡΠ°ΠΆΠ΅Π½ΠΈΡ:
- Basic mesh - ΠΌΠ΅Ρ, Π·Π°ΠΊΡΠ°ΡΠΈΠ²Π°Π΅ΡΡΡ Π² ΠΎΠ΄ΠΈΠ½ ΡΠ²Π΅Ρ
- Complex mesh - ΠΌΠ΅Ρ, Π΄Π»Ρ ΠΊΠΎΡΠΎΡΠΎΠ³ΠΎ ΠΌΠΎΠΆΠ½ΠΎ ΡΡΡΠ°Π½ΠΎΠ²ΠΈΡΡ: ΡΠ²Π΅ΡΠ° Π΄Π»Ρ ΠΊΠ°ΠΆΠ΄ΠΎΠΉ ΠΈΠ· Π²Π΅ΡΡΠΈΠ½, ΠΎΡΠ²Π΅ΡΠ΅Π½ΠΈΠ΅, ΡΠ΅ΠΊΡΡΡΡΡ ΠΈ ΠΎΠΏΡΠ΅Π΄Π΅Π»ΡΡΡ Π΄Π»Ρ ΠΊΠ°ΠΊΠΎΠΉ ΠΈΠ· Π²Π΅ΡΡΠΈΠ½ Π±ΡΠ΄Π΅Ρ ΠΈΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΡΡΡ ΡΠ΅ΠΊΡΡΡΡΠ°
- Sprite - ΡΠΏΡΠ°ΠΉΡ, ΠΊ ΠΊΠ°ΠΌΠ΅ΡΠ΅ ΡΠ°ΡΠΏΠΎΠ»ΠΎΠΆΠ΅Π½ Π²ΡΠ΅Π³Π΄Π° ΠΎΠ΄Π½ΠΎΠΉ Π³ΡΠ°Π½ΡΡ, ΡΠ΄Π°Π»ΡΠ½Π½ΠΎΡΡΡ Π½Π΅ Π²Π»ΠΈΡΠ΅Ρ Π½Π° ΡΠ°Π·ΠΌΠ΅ΡΡ ΠΈΠ·ΠΎΠ±ΡΠ°ΠΆΠ΅Π½ΠΈΡ
- MultiSprite - ΠΌΡΠ»ΡΡΠΈΡΠΏΡΠ°ΠΉΡ ΠΏΡΠ΅Π΄ΡΡΠ°Π²Π»ΡΠ΅Ρ ΡΠΎΠ±ΠΎΠΉ ΠΌΠ½ΠΎΠΆΠ΅ΡΡΠ²ΠΎ ΡΠΏΡΠ°ΠΉΡΠΎΠ², ΠΊΠΎΡΠΎΡΡΠ΅ ΡΠΈΡΡΡΡΡΡ Π² ΠΎΠ΄ΠΈΠ½ draw call
Examples
Π£ΡΡΠ°Π½ΠΎΠ²ΠΊΠ°
npm install 2gl
ΠΠΎΠ΄ΠΊΠ»ΡΡΠ΅Π½ΠΈΠ΅
ΠΡΡΡ Π½Π΅ΡΠΊΠΎΠ»ΡΠΊΠΎ ΡΠΏΠΎΡΠΎΠ±ΠΎΠ² ΠΏΠΎΠ΄ΠΊΠ»ΡΡΠ΅Π½ΠΈΡ Π±ΠΈΠ±Π»ΠΈΠΎΡΠ΅ΠΊΠΈ:
- ΠΠ°ΠΏΡΡΠΌΡΡ ΡΠ΅ΡΠ΅Π· ΡΠ΅Π³, ΡΠΊΡΠΈΠΏΡ
2gl.js
Π»Π΅ΠΆΠΈΡ Π² ΠΏΠ°ΠΏΠΊΠ΅dist
ΠΈ ΡΠΎΠ΄Π΅ΡΠΆΠΈΡ Π²ΡΠ΅ ΠΊΠΎΠΌΠΏΠΎΠ½Π΅Π½ΡΡ Π±ΠΈΠ±Π»ΠΈΠΎΡΠ΅ΠΊΠΈ:
<script src="2gl.js"></script>
- ΠΡΠ»ΠΈ Π²Ρ ΠΈΡΠΏΠΎΠ»ΡΠ·ΡΠ΅ΡΠ΅ ΡΠ±ΠΎΡΡΠΈΠΊΠΈ, Π½Π°ΠΏΡΠΈΠΌΠ΅Ρ,
browserify
ΠΈΠ»ΠΈwebpack
:
var dgl = require("2gl"); // CommonJS
import dgl from "2gl"; // ES6
- ΠΠΎΠΆΠ½ΠΎ ΠΏΠΎΠ΄ΠΊΠ»ΡΡΠ°ΡΡ ΡΠΎΠ»ΡΠΊΠΎ Π½ΡΠΆΠ½ΡΠ΅ ΠΊΠΎΠΌΠΏΠΎΠ½Π΅Π½ΡΡ Π΄Π»Ρ ΡΠΌΠ΅Π½ΡΡΠ΅Π½ΠΈΡ ΡΠ°Π·ΠΌΠ΅ΡΠ°:
var Mesh = require("2gl/Mesh");
var AmbientLight = require("2gl/lights/AmbientLight");
Development
npm install
npm start
Checking examples locally
- Install
http-server
- Run
http-server
at the root project directory - Open http://localhost:8080/ and navigate to some
*.html
demo at theexamples
directory
Release
If you plan to release a new version from your branch
- Bump version via
npm version major | minor | patch
- Merge your branch into master
- Create a new release, this will run the release workflow
Beta-release
Beta-release is suitable to perform some checks/integrations with npm-package.
It releases the same npm package as a regular release, but in the beta tag, which do not update latest version on npm.
To make beta-release you should create a tag with a current version in package.json
and suffix, e.g.
npm version 0.12.0-foo-bar
And then push tag.
git push --tags
Pushed tag will run the beta-release workflow.