{"_id":"@deathlegion/huy.js","name":"@deathlegion/huy.js","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@deathlegion/huy.js","version":"1.0.0","description":"A lightweight, easy-to-use 3D graphics library for the web — by Death Legion Team","main":"src/huy.js","module":"src/huy.js","scripts":{"start":"npx http-server demos -p 8080 -c-1"},"keywords":["3d","webgl","webgpu","graphics","vr","ar","rendering"],"author":{"name":"Death Legion Team"},"license":"MIT","repository":{"type":"git","url":""},"gitHead":"7841111e17dbbf419fae382f7c774636fa9c1bc4","_id":"@deathlegion/huy.js@1.0.0","_nodeVersion":"24.16.0","_npmVersion":"11.13.0","dist":{"integrity":"sha512-mMY4u7c7jqsei8pGuj2rAdORg0KPs2CAKX6GHORQ+Ed6SEu43RiynxNOEoYJMluOb2FwVqi4IR5JsNSuX+cq7w==","shasum":"6cf2467430b3937897d808fe1b1e808cb9e8b038","tarball":"https://registry.npmjs.org/@deathlegion/huy.js/-/huy.js-1.0.0.tgz","fileCount":41,"unpackedSize":118048,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCMlXLCFoCU5wokuWmwBf6og5o10egcPgo7WVSG+y0HkwIgG5GsERy2XV5KRRM+cvVJXRzRAn1fWI4ZOMnb1vdweiM="}]},"_npmUser":{"name":"deathlegion","email":"bbhhexa@gmail.com"},"directories":{},"maintainers":[{"name":"deathlegion","email":"bbhhexa@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/huy.js_1.0.0_1781458135130_0.20767655338985458"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-14T17:28:54.948Z","1.0.0":"2026-06-14T17:28:55.278Z","modified":"2026-06-14T17:28:55.487Z"},"maintainers":[{"name":"deathlegion","email":"bbhhexa@gmail.com"}],"description":"A lightweight, easy-to-use 3D graphics library for the web — by Death Legion Team","keywords":["3d","webgl","webgpu","graphics","vr","ar","rendering"],"repository":{"type":"git","url":""},"author":{"name":"Death Legion Team"},"license":"MIT","readme":"# huy.js\n\n**A lightweight, easy-to-use 3D graphics library for the web** — built from scratch by the **Death Legion Team**.\n\n[![Version](https://img.shields.io/badge/version-1.0.0-red.svg)]()\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)]()\n[![Zero Dependencies](https://img.shields.io/badge/dependencies-zero-green.svg)]()\n\n---\n\n## ✨ Features\n\n- **Zero dependencies** — every line written from scratch\n- **WebGL / WebGL2** — auto-detects the best available API\n- **Simple API** — get a 3D scene running in 15 lines of code\n- **Scene graph** — hierarchical parent/child object relationships\n- **Blinn-Phong shading** — built-in lit material with ambient, diffuse, and specular\n- **Multiple light types** — ambient, directional, and point lights (up to 4 of each)\n- **Geometry primitives** — box, sphere, plane, cylinder, and cone\n- **VR/AR ready** — forward-compatible WebXR hooks\n- **Lightweight** — minimal footprint, fast startup\n\n---\n\n## 🚀 Quick Start\n\n```html\n<!DOCTYPE html>\n<html>\n<body>\n  <canvas id=\"c\"></canvas>\n  <script type=\"module\">\n    import {\n      Scene, PerspectiveCamera, BoxGeometry, PhongMaterial,\n      Mesh, AmbientLight, DirectionalLight, WebGLRenderer,\n      AnimationLoop\n    } from './src/huy.js';\n\n    // 1. Scene + Camera\n    const scene  = new Scene();\n    const camera = new PerspectiveCamera(60, innerWidth/innerHeight, 0.1, 100);\n    camera.position.set(0, 1.5, 4);\n    camera.lookAt(0, 0, 0);\n\n    // 2. A spinning cube\n    const cube = new Mesh(new BoxGeometry(), new PhongMaterial(0xff4466));\n    scene.add(cube);\n\n    // 3. Lights\n    scene.add(new AmbientLight(0x404040));\n    const sun = new DirectionalLight(0xffffff, 1);\n    sun.position.set(3, 5, 2);\n    scene.add(sun);\n\n    // 4. Renderer + Animation\n    const renderer = new WebGLRenderer(document.getElementById('c'));\n    renderer.setSize(innerWidth, innerHeight);\n\n    new AnimationLoop((t, dt) => {\n      cube.rotateY(dt);\n      renderer.render(scene, camera);\n    }).start();\n\n    window.onresize = () => {\n      renderer.setSize(innerWidth, innerHeight);\n      camera.aspect = innerWidth / innerHeight;\n      camera.updateProjectionMatrix();\n    };\n  </script>\n</body>\n</html>\n```\n\n---\n\n## 📁 Project Structure\n\n```\nhuy.js/\n├── src/\n│   ├── huy.js              ← Main entry point (import from here)\n│   ├── math/\n│   │   ├── Vec3.js          3D vector\n│   │   ├── Vec4.js          4D vector\n│   │   ├── Mat4.js          4×4 matrix (column-major)\n│   │   ├── Quaternion.js    Unit quaternion\n│   │   └── Euler.js         Euler angles\n│   ├── core/\n│   │   ├── Object3D.js      Base scene object\n│   │   ├── Scene.js         Root scene container\n│   │   ├── Camera.js        Camera base\n│   │   ├── PerspectiveCamera.js\n│   │   └── OrthographicCamera.js\n│   ├── geometry/\n│   │   ├── Geometry.js      Vertex buffer container\n│   │   ├── BoxGeometry.js\n│   │   ├── SphereGeometry.js\n│   │   ├── PlaneGeometry.js\n│   │   └── CylinderGeometry.js\n│   ├── material/\n│   │   ├── Material.js      Base material\n│   │   ├── BasicMaterial.js Unlit (flat color)\n│   │   ├── PhongMaterial.js Blinn-Phong lit\n│   │   └── WireframeMaterial.js\n│   ├── objects/\n│   │   ├── Mesh.js          Geometry + Material\n│   │   └── Lights.js        Ambient, Directional, Point\n│   ├── renderer/\n│   │   ├── WebGLRenderer.js Core rendering engine\n│   │   └── ShaderSource.js  Built-in GLSL shaders\n│   ├── animation/\n│   │   ├── AnimationLoop.js requestAnimationFrame loop\n│   │   └── Clock.js         High-precision timer\n│   ├── utils/\n│   │   └── Color.js         RGB color class\n│   └── vr/\n│       └── VRManager.js     WebXR integration stubs\n├── demos/\n│   ├── quick-start.html     Minimal 15-line example\n│   ├── spinning-cube.html   Animated cube with stats\n│   └── multi-object.html    Multiple objects + mouse orbit\n├── docs/\n│   └── index.html           Full API documentation\n└── package.json\n```\n\n---\n\n## 📖 API Overview\n\n### Scene Setup\n\n| Class | Description |\n|-------|-------------|\n| `Scene` | Root container for objects and lights |\n| `PerspectiveCamera(fov, aspect, near, far)` | Standard 3D camera |\n| `OrthographicCamera(l, r, t, b, n, f)` | Parallel projection camera |\n\n### Geometry\n\n| Class | Description |\n|-------|-------------|\n| `BoxGeometry(w, h, d)` | Cube / rectangular box |\n| `SphereGeometry(r, wSeg, hSeg)` | UV sphere |\n| `PlaneGeometry(w, h)` | Flat plane |\n| `CylinderGeometry(rTop, rBot, h)` | Cylinder / cone |\n\n### Material\n\n| Class | Description |\n|-------|-------------|\n| `BasicMaterial(color)` | Unlit solid color |\n| `PhongMaterial(color)` | Blinn-Phong lit material |\n| `WireframeMaterial(color)` | Wireframe-only rendering |\n\n### Lighting\n\n| Class | Description |\n|-------|-------------|\n| `AmbientLight(color, intensity)` | Uniform omnidirectional light |\n| `DirectionalLight(color, intensity)` | Parallel rays (sunlight) |\n| `PointLight(color, intensity, distance, decay)` | Point source with falloff |\n\n### Rendering\n\n| Class | Description |\n|-------|-------------|\n| `WebGLRenderer(canvas, options)` | WebGL rendering engine |\n| `AnimationLoop(callback)` | Frame loop with delta time |\n| `Clock` | High-precision timer |\n\n### Math\n\n| Class | Description |\n|-------|-------------|\n| `Vec3` | 3D vector with arithmetic & geometry ops |\n| `Vec4` | 4D vector |\n| `Mat4` | 4×4 column-major matrix |\n| `Quaternion` | Unit quaternion for rotations |\n| `Euler` | Euler angle representation |\n| `Color` | RGB color (hex, CSS, float) |\n\n---\n\n## 🥽 VR / AR Support\n\nhuy.js includes forward-compatible WebXR integration:\n\n```javascript\nimport { VRManager } from './src/huy.js';\n\nconst vr = new VRManager(renderer);\n\n// Check support\nconst vrOK = await vr.isVRSupported();\nconst arOK = await vr.isARSupported();\n\n// Start immersive session\nif (vrOK) await vr.startVR();\n\n// End session\nawait vr.endSession();\n```\n\n**Current:** API surface and capability detection  \n**Planned:** Stereo rendering, controller input, hand tracking, AR hit testing, anchors, and light estimation.\n\n---\n\n## 🎮 Demos\n\n| Demo | Description |\n|------|-------------|\n| `demos/quick-start.html` | Minimal 15-line spinning cube |\n| `demos/spinning-cube.html` | Animated cube with FPS stats |\n| `demos/multi-object.html` | Box, sphere, cylinder + lights + mouse orbit |\n\nOpen any demo in a browser (use a local server for ES module support):\n\n```bash\nnpx http-server . -p 8080 -c-1\n# Then open http://localhost:8080/demos/quick-start.html\n```\n\n---\n\n## 🛠️ Building from Source\n\nNo build step required! huy.js uses native ES modules. Just serve the files with any HTTP server.\n\n---\n\n## 📄 License\n\nMIT License — © Death Legion Team\n\n---\n\n**huy.js** — *Lightweight 3D for the web. By Death Legion Team.*\n","readmeFilename":"README.md","_rev":"1-62012030eb8fc653299dbe40894c20dc"}