abstract class WFC::Texture

Overview

Abstract class that allows a texture type to interface with WFC.

To add WFC generation for a texture type, inherit this class, implementing its methods according to the needs of your texture type. For image textures, this would mean implementing conversion methods to and from a pixel array; for the implemented CharTexture type, this means writing codepoints to a buffer, etc.

Direct Known Subclasses

Defined in:

wfc.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(bytes, width, height) #

Creates a new texture from bytes, width, and height.


[View source]

Instance Method Detail

abstract def bytes_per_cell #

The number of bytes per cell in the texture. For example, in a char-based texture such as the one provided in the module, this is 1, since each cell is a single byte.


[View source]
def generate(*arguments) #

Calls WFC.generate with the passed arguments and self as the texture. Does not need to be overridden in subclasses.


[View source]
abstract def height #

The height of the texture.


[View source]
abstract def to_bytes : Bytes #

Converts the texture to a Bytes.


[View source]
abstract def width #

The width of the texture.


[View source]