write_obj: Write Wavefront OBJ files of board game pieces

Description Usage Arguments Value Examples

View source: R/write_obj.R

Description

write_obj creates Wavefront OBJ files (including associated MTL and texture image).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
write_obj(
  piece_side = "tile_face",
  suit = 1,
  rank = 1,
  cfg = pp_cfg(),
  ...,
  x = 0,
  y = 0,
  z = 0,
  angle = 0,
  axis_x = 0,
  axis_y = 0,
  width = NA,
  height = NA,
  depth = NA,
  filename = tempfile(fileext = ".obj"),
  scale = 1,
  res = 72
)

Arguments

piece_side

A string with piece and side separated by a underscore e.g. "coin_face"

suit

Number of suit (starting from 1).

rank

Number of rank (starting from 1)

cfg

Piecepack configuration list or pp_cfg object, a list of pp_cfg objects, or a character vector of pp_cfg objects

...

Ignored.

x

Where to place piece on x axis of viewport

y

Where to place piece on y axis of viewport

z

z-coordinate of the piece. Has no effect if op_scale is 0.

angle

Angle (on xy plane) to draw piece at

axis_x

Ignored for now.

axis_y

Ignored for now.

width

Width of piece

height

Height of piece

depth

Depth (thickness) of piece. Has no effect if op_scale is 0.

filename

Name of Wavefront OBJ object.

scale

Multiplicative scaling factor to apply to width, height, and depth.

res

Resolution of the faces.

Value

A list with named elements "obj", "mtl", "png" with the created filenames.

Examples

1
2
3
    cfg <- piecepackr::game_systems("dejavu3d")$piecepack
    files <- write_obj("tile_face", suit = 3, rank = 3, cfg = cfg)
    print(files)

piecepackr/piecepackr3d documentation built on Feb. 8, 2020, 1:15 a.m.