WarpChess include file

Declared objects

This include file declares the following untextured objects:


It also declares textured versions of these objects. These have the word "White" or "Black" before the piece name, like:


The materials of the pieces can be modified by #declaring any of these material identifiers before #including "WarpChess.inc":


The materials can be transparent (and have ior). If the base of the pieces should not use its own material (but simply share the material of the rest of the piece), the identifier WarpChess_UseBaseMaterial can be declared as false before the #include.

If the textured pieces should use a photons block, this can be achieved by implementing a macro called WarpChess_UsePhotons() before the #include. This macro should contain the entire photons block (ie. "photons { ...something... }").

A chessboard is also included as an object:


The following optional identifiers can be declared before #including "WarpChess.inc" to set up the texturing and labels:

WarpChess_BoardFont (default is "timrom.ttf")

If WarpChess_BoardFont is declared to be an empty string the labels will not be created.

Declared macros

This include file also defines two macros to create a chessboard with pieces placed on it:


Simply creates a chessboard with all the pieces in their initial places.


Creates a chessboard based on the given moves. The parameter should be an array of strings, each string denoting a chess move. These moves are similar to the moves of a regular chess game record. The board situation is started from the initial position, and pieces are moved according to the given moves. Captured pieces are moved to the edge of the board.

Example usage:

#declare Moves = array[8]
{ "E2E4", "E7E5", "G1F3", "B8C6",
  "D2D3", "F8B4", "B1C3", "G8F6" }


The following identifier can be declared before #including "WarpChess.inc" to affect the placement of captured pieces:

WarpChess_DropCapturedPieces (default is false)

If WarpChess_DropCapturedPieces is true, captured pieces will not be created at all, else they will be created at the ends of the board.

If a piece arrangement which is not the result of a series of moves is desired, the following macro can be used to make the task easier:

WarpChess_TranslatePiece(X_Index, Z_Index)

Where X_Index and Z_Index are integers between 0 and 7 (although fractional values and values outside the range are possible as well). It simply creates a translate command that moves an origin-centered object on the corresponding square of the (yet untransformed) board. For example:

object { WarpChess_Board }
object { WarpChess_BlackKing WarpChess_TranslatePiece(4, 4) }

Note: Since the board is created oriented on the X axis, with the white side on the positive X side, and the parameters to the macro correspond directly to world coordinates, the indices (0, 0) correspond to the board coordinates "A8" and the indices (7, 7) to the board coordinates "H1".