Class TimbnModelFaces
Describes a model made from pictures, for Build(string, Action<TimbnModelFaces>). Every
picture is exactly what the player sees, so its own size is the size of the face and you only say where it stands.
The game's camera tilts forward and down and never sideways, so only two kinds of face are ever seen, one standing
up toward the camera (Front) and one lying face up (Top), and a solid box is just
both of them (Block). Sides, backs and undersides are never built.
public sealed class TimbnModelFaces
- Inheritance
-
TimbnModelFaces
- Inherited Members
Examples
A still with a 60x36 shadow lying on the floor, a 44 wide block for its base (20 front rows under 32 top rows) and a 24x26 pot standing up.
var still = Models.Build("SpiritStill", model => model
.Top("still_shadow", x: 0, y: 1, z: 0)
.Block("still_base", x: 0, y: 0, z: 4, depth: 32)
.Front("still_pot", x: 4, y: 20, z: 16));
Remarks
Positions are in pixels from the model's front, bottom, left corner as the player sees it, standing in front, with x running right, y running up and z running away from the player. They can't be negative. One world unit is 50 pixels across, 30 up and 40 deep, so a point further back sits higher on screen. Two faces on the same plane can't cover the same spot, since they would flicker, but faces on different planes may touch. Transparent pixels are see through, and pixels that are only half see through may not draw right.
Methods
Block(byte[], int, int, int, int, string?)
Adds a solid block from one picture made in code.
public TimbnModelFaces Block(byte[] png, int x, int y, int z, int depth, string? name = null)
Parameters
pngbyte[]The PNG file's bytes.
xintPixels from the model's left edge to the block's left edge.
yintPixels up from the floor to the block's bottom.
zintPixels back from the model's front to the block's front.
depthintFront to back, in pixels, which is also how many rows of the picture are the top.
namestringWhat error messages call this block. It defaults to its place in the model.
Returns
Exceptions
- ArgumentOutOfRangeException
A position is below zero or the depth is below 1.
Block(string, int, int, int, int)
Adds a solid block from one picture of it as the player sees it, with the top face stacked above the front face.
The upper depth rows are the top and the rest are the front, so the front is the PNG's height
minus the depth. Both share the block's x and width.
public TimbnModelFaces Block(string pngName, int x, int y, int z, int depth)
Parameters
pngNamestringA PNG embedded in the plugin's DLL, named without ".png".
xintPixels from the model's left edge to the block's left edge.
yintPixels up from the floor to the block's bottom.
zintPixels back from the model's front to the block's front.
depthintFront to back, in pixels, which is also how many rows of the picture are the top.
Returns
Exceptions
- ArgumentOutOfRangeException
A position is below zero or the depth is below 1.
- InvalidOperationException
The plugin has no such embedded resource.
Front(byte[], int, int, int, string?)
Stands a picture made in code up facing the camera.
public TimbnModelFaces Front(byte[] png, int x, int y, int z, string? name = null)
Parameters
pngbyte[]The PNG file's bytes.
xintPixels from the model's left edge to the picture's left edge.
yintPixels up from the floor to the picture's bottom.
zintPixels back from the model's front to the picture.
namestringWhat error messages call this face. It defaults to its place in the model.
Returns
Exceptions
- ArgumentOutOfRangeException
A position is below zero.
Front(string, int, int, int)
Stands a picture up facing the camera, such as a monitor screen or a sign. Its width and height are the PNG's.
public TimbnModelFaces Front(string pngName, int x, int y, int z)
Parameters
pngNamestringA PNG embedded in the plugin's DLL, named without ".png", for example "still_pot". Embed it with
LogicalName="%(Filename)%(Extension)".xintPixels from the model's left edge to the picture's left edge.
yintPixels up from the floor to the picture's bottom.
zintPixels back from the model's front to the picture.
Returns
Exceptions
- ArgumentOutOfRangeException
A position is below zero.
- InvalidOperationException
The plugin has no such embedded resource.
Top(byte[], int, int, int, string?)
Lays a picture made in code flat facing up.
public TimbnModelFaces Top(byte[] png, int x, int y, int z, string? name = null)
Parameters
pngbyte[]The PNG file's bytes.
xintPixels from the model's left edge to the picture's left edge.
yintPixels up from the floor to the picture.
zintPixels back from the model's front to the picture's front edge.
namestringWhat error messages call this face. It defaults to its place in the model.
Returns
Exceptions
- ArgumentOutOfRangeException
A position is below zero.
Top(string, int, int, int)
Lays a picture flat facing up, such as a shadow on the floor or a keyboard on a desk. The picture's bottom row is its front edge and its top row is its back edge, so it reaches from z to z plus the PNG's height. Put it 1 pixel above any surface under it so the two don't flicker.
public TimbnModelFaces Top(string pngName, int x, int y, int z)
Parameters
pngNamestringA PNG embedded in the plugin's DLL, named without ".png".
xintPixels from the model's left edge to the picture's left edge.
yintPixels up from the floor to the picture.
zintPixels back from the model's front to the picture's front edge.
Returns
Exceptions
- ArgumentOutOfRangeException
A position is below zero.
- InvalidOperationException
The plugin has no such embedded resource.