Giter Club home page Giter Club logo

node-vulkan's Introduction

node-vulkan

This is a Vulkan API for node.js.

The bindings are machine generated and provide an API to interact from JavaScript with the low-level interface of Vulkan. The API of this project strives to be as close as possible to Vulkan's original API.

Note: This is an early experiment, use with honor!

Preview:

Structure:

  • generator: code for binding generation
  • generated: the generated binding code
  • examples: contains a triangle and cube demo
  • lib: required third party libs

Requirements:

  • node.js >= v10.9.0

Generator:

Installation:

Windows:

Make sure you have either Visual Studio >= 15 installed or use

npm install --global --production windows-build-tools

Install the Vulkan SDK from here

Clone this repo

git clone [email protected]:maierfelix/node-vulkan.git

Install dependencies

npm install

API:

Syntax:

npm run [script] [flag] [value]

Flags:

 [-vkversion] [version]: The vulkan version to generate bindings for

Usage:

Generation:

You can specify a version to generate bindings for like this:

npm run generate -vkversion=1.1.82
  • Make sure the specified version to generate bindings for can be found here
  • The binding specification file gets auto-downloaded and is stored in generate/specifications/{vkversion}.xml
  • The generated bindings can then be found in generated/{vkversion}/

Building:

You can build the generated bindings like this:

npm run build -vkversion=1.1.82

The compiled bindings can then be found in generated/{vkversion}/build

Syntactic Sugar:

The API gives you some sugar to write things quicker, but still gives you the option to write everything explicitly

sType auto-filling

sType members get auto-filled, but you can still set them yourself

let appInfo = new VkApplicationInfo();
appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;

Becomes:

let appInfo = new VkApplicationInfo(); // sType auto-filled

Object based Structure creation

Instead of:

let offset = new VkOffset2D();
offset.x = 0;
offset.y = 0;
let extent = new VkExtent2D();
extent.width = 640; extent.height = 480;
let renderArea = new VkRect2D();
renderArea.offset = offset;
renderArea.extent = extent;

You can write:

let renderArea = new VkRect2D({
  offset: new VkOffset2D({ x: 0, y: 0 }),
  extent: new VkExtent2D({ width: 640, height: 480 })
});

TODOs:

  • Struct generation (~85%)
  • Handle generation (~100%)
  • Enum generation (100%)
  • Function generation (~85%)
  • Deallocation (~0%)
  • Vulkan API fill V8 reflection (~85%)

node-vulkan's People

Contributors

maierfelix avatar

Watchers

 avatar  avatar

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.