Reference Source

Function

Static Public Summary
public

Helper to convert multi-block structures to models used by ModelRender

public

OrbitControls(object: *, domElement: *)

public

contour(grid: Function, start: Array): Array

Computes a contour for a given input grid function using the marching squares algorithm.

public

loadBlockState(state: string, assetRoot: string): Promise<object>

Loads a blockstate file and returns the contained JSON

public

Loads a model file and returns the contained JSON

public

loadTextureAsBase64(root: string, namespace: string, dir: string, name: string): Promise<string>

Loads a Mincraft texture an returns it as Base64

public

loadTextureMeta(texture: *, assetRoot: *): *

public

scaleUv(uv: number, size: number, scale: number): number

Scales UV values

Static Public

public ModelConverter() source

import ModelConverter from 'minerender/src/model/modelConverter.js'

Helper to convert multi-block structures to models used by ModelRender

public OrbitControls(object: *, domElement: *) source

import OrbitControls from 'minerender/src/lib/OrbitControls.js'

Params:

NameTypeAttributeDescription
object *
domElement *

public contour(grid: Function, start: Array): Array source

Computes a contour for a given input grid function using the marching squares algorithm. Returns the contour polygon as an array of points.

Params:

NameTypeAttributeDescription
grid Function

a two-input function(x, y) that returns true for values inside the contour and false for values outside the contour.

start Array
  • optional

an optional starting point [x, y] on the grid.

Return:

Array

polygon [[x1, y1], [x2, y2], ...]

public loadBlockState(state: string, assetRoot: string): Promise<object> source

import {loadBlockState} from 'minerender/src/renderBase.js'

Loads a blockstate file and returns the contained JSON

Params:

NameTypeAttributeDescription
state string

Name of the blockstate

assetRoot string

Asset root, see DEFAULT_ROOT

Return:

Promise<object>

public loadJsonFromPath(root: string, path: string): Promise<object> source

import {loadJsonFromPath} from 'minerender/src/renderBase.js'

Loads a model file and returns the contained JSON

Params:

NameTypeAttributeDescription
root string

Asset root, see DEFAULT_ROOT

path string

Path to the model file

Return:

Promise<object>

public loadTextureAsBase64(root: string, namespace: string, dir: string, name: string): Promise<string> source

import {loadTextureAsBase64} from 'minerender/src/renderBase.js'

Loads a Mincraft texture an returns it as Base64

Params:

NameTypeAttributeDescription
root string

Asset root, see DEFAULT_ROOT

namespace string

Namespace, usually 'minecraft'

dir string

Directory of the texture

name string

Name of the texture

Return:

Promise<string>

public loadTextureMeta(texture: *, assetRoot: *): * source

import {loadTextureMeta} from 'minerender/src/renderBase.js'

Params:

NameTypeAttributeDescription
texture *
assetRoot *

Return:

*

public scaleUv(uv: number, size: number, scale: number): number source

import {scaleUv} from 'minerender/src/renderBase.js'

Scales UV values

Params:

NameTypeAttributeDescription
uv number

UV value

size number
scale number
  • optional
  • default: 16

Return:

number