Coder Social home page Coder Social logo

transvoxel-data's Introduction

Transvoxel tables for JavaScript

This is the data used for the Transvoxel algorithm exposed as an npm package. All I did was take the ./Transvoxel.h file and convert it into TypeScript.

The built package includes esm, iife and commonjs versions as well as type definitions.

The browser version defaults to esm, the Node version defaults to commonjs.

One performance consideration I haven't evaluated yet is whether it's better to make all of the data a single large ArrayBuffer instead of classes. One advantage lower level languages have that JavaScript doesn't make easy is structs and inlining. This is likely a case where you'd want to do that. But if its a problem in my usecase, I'll fix it here.

If you're running in a browser which doesn't support ESM, try using transvoxel-iife.js.

Installation

yarn:

yarn add transvoxel-data

npm:

npm install transvoxel-data

Usage

This doesn't implement the Transvoxel algorithm โ€“ just the data.

Here's most of what you can import or require from transvoxel-data:

export declare class CellData {
  geometryCounts: number;
  vertexIndex: number[] | Uint8Array;
  vertexCount: number;
  triangleCount: number;
  constructor(geometryCounts: number, vertexIndex: Uint8Array);
  static getVertexCount(geometryCounts: number): number;
  static getTriangleCount(geometryCounts: number): number;
}
export declare class RegularCellData extends CellData {
  vertexIndex: VertexIndexList;
}
export declare class TransitionCellData extends CellData {
  vertexIndex: TransitionVertexIndexList;
}
export declare const regularCellClass: Uint8Array;
export declare const regularCellData: RegularCellData[];
export declare function getLocalIndexA(edgeCode: number): number;
export declare function getLocalIndexB(edgeCode: number): number;
export declare const regularVertexData: number[][];
export declare const transitionCellClass: number[];
export declare const transitionCornerData: number[];
export declare const transitionVertexData: number[][];
export {};

transvoxel-data's People

Contributors

jarred-sumner avatar

Stargazers

 avatar  avatar

Watchers

 avatar  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.