Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Smudge

Index

Constructors

constructor

  • new Smudge(name?: string, width?: number, height?: number): Smudge
  • Creates the smudge instace.

    Parameters

    • Default value name: string = "untitled"
    • Optional width: number

      The width of the drawing.

    • Optional height: number

      The height of the drawing.

    Returns Smudge

Properties

buffers

buffers: object

Type declaration

  • [key: string]: Framebuffer

canvas

canvas: HTMLCanvasElement

gl

gl: WebGLRenderingContext

height

height: number

name

name: string

width

width: number

Methods

bufferToCanvas

  • bufferToCanvas(bufferOrName?: Framebuffer | string): Promise<void>
  • Copies the provided buffer to the canvas

    Parameters

    • Default value bufferOrName: Framebuffer | string = "albedo"

    Returns Promise<void>

clear

  • Clears buffers using provided material color values Ignores material blend modes and texture settings

    Parameters

    • Default value material: Material2 = Material2.clearing

      material to clear to

    Returns void

ellipse

  • ellipse(x: number, y: number, w: number, h: number, material: Material2, matrix?: Matrix, sides?: number): void
  • Draws an ellipse

    Parameters

    • x: number

      left

    • y: number

      right

    • w: number

      width

    • h: number

      height

    • material: Material2
    • Default value matrix: Matrix = new Matrix()
    • Optional sides: number

      number of sides to draw, auto calculates if undefined

    Returns void

export

  • export(layout?: IExportLayout | string, exportName?: string): void
  • Parameters

    • Default value layout: IExportLayout | string = exportLayouts.albedo
    • Default value exportName: string = `custom_${this.name}`

    Returns void

getBuffer

  • getBuffer(bufferName: string): Framebuffer
  • Get Framebuffer with name.

    Parameters

    • bufferName: string

    Returns Framebuffer

line

  • Strokes a provided path as configured in options

    Parameters

    • points: number[][]

      array of points [[0,0],[1,1],...]

    • Default value options: number | ILineOptions = 1

      ILineOptions

    • material: Material2
    • Default value matrix: Matrix = new Matrix()

    Returns void

loadTexture

  • loadTexture(path: string): Promise<Texture>
  • Loads an image from a file and creates a texture for the image. const t = await smudge.loadTexture("images/a.png");

    Parameters

    • path: string

      path to image to load

    Returns Promise<Texture>

pack

  • pack(packingLayout?: object, clearColor?: number[], targetBuffer?: Framebuffer): void
  • clears target to clear_color, then copies/swizzles colors from the channel buffers according to packing_layout targets smudge.canvas or provided targetBuffer

    Parameters

    • Default value packingLayout: object = {}

      how values should be packed

    • Default value clearColor: number[] = [0, 0, 0, 0]

      the intial color value

    • Default value targetBuffer: Framebuffer = null

      the buffer to copy to, defaults to smudge.canvas

    Returns void

quad

  • quad(verticies: number[][], material: Material2, matrix?: Matrix, uvs?: number[][]): void
  • Fills a figure given as four points.

    Parameters

    • verticies: number[][]

      array of the quad corners [[0, 0],[0, 1],[1, 1],[.8, .8]]

    • material: Material2
    • Default value matrix: Matrix = new Matrix()
    • Optional uvs: number[][]

      array of the uv coords [[0, 0],[0, 1],[1, 1],[1, 0]]

    Returns void

rect

  • rect(x: number, y: number, w: number, h: number, material: Material2, matrix?: Matrix): void
  • Draws a rectangle

    Parameters

    • x: number

      left side

    • y: number

      bottom

    • w: number

      width

    • h: number

      height

    • material: Material2
    • Default value matrix: Matrix = new Matrix()

    Returns void

saveBufferEXR

  • saveBufferEXR(fileName: string, buffer?: string | Framebuffer, gamma?: number): void
  • Parameters

    • fileName: string
    • Default value buffer: string | Framebuffer = "albedo"
    • Default value gamma: number = 1

    Returns void

saveBufferPNG

  • saveBufferPNG(fileName: string, buffer?: string | Framebuffer): void
  • Parameters

    • fileName: string
    • Default value buffer: string | Framebuffer = "albedo"

    Returns void

saveCanvasAs

  • saveCanvasAs(fileName: string): void
  • Saves current canvas to as download file.

    Parameters

    • fileName: string

      name of download

    Returns void

show

  • show(bufferOrName?: Framebuffer | string): Promise<void>
  • Parameters

    • Default value bufferOrName: Framebuffer | string = "albedo"

    Returns Promise<void>

Static setLoggingLevel

  • setLoggingLevel(level: "trace" | "info" | "report" | "log" | "warn" | "error"): void
  • Parameters

    • level: "trace" | "info" | "report" | "log" | "warn" | "error"

    Returns void

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc