Semi Mod Loader
Static Public Member Functions | Public Attributes | Static Public Attributes | Properties | List of all members
Semi.SpriteDefinition Struct Reference

Wrapper struct for tk2dSpriteDefinition that provides a cleaner interface and works transparently with anything that expects tk2dSpriteDefinitions. More...

Static Public Member Functions

static implicit operator tk2dSpriteDefinition (SpriteDefinition s)
 Implicit cast operator that allows you to use SpriteDefinition anywhere where t2kdSpriteDefinition is expected. More...
 
static void GenerateGeometry (IntVector2 xy, IntVector2 wh, IntVector2 tex_size, Vector2 scale, out Vector2[] uvs, out Vector3 position0, out Vector3 position1, out Vector3 position2, out Vector3 position3)
 Generates sprite geometry. More...
 
static SpriteDefinition Construct (Material mat, string override_name=null, int? region_x=null, int? region_y=null, int? region_w=null, int? region_h=null)
 Constructs a new sprite definition More...
 

Public Attributes

tk2dSpriteDefinition Wrap
 Real tk2d object. More...
 

Static Public Attributes

static readonly Vector3[] DEFAULT_NORMALS
 Default normals. More...
 
static readonly Vector4[] DEFAULT_TANGENTS
 Default tangents. More...
 
static readonly string DEFAULT_SHADER = "Sprites/Default"
 Default sprite shader. More...
 

Properties

Material Material [get, set]
 The material. More...
 
Texture2D Texture [get, set]
 The texture (modifies the Material). More...
 
string Name [get, set]
 The sprite definition name (ID). More...
 
Vector2 Position0 [get, set]
 First position (sprite geometry). More...
 
Vector2 Position1 [get, set]
 Second position (sprite geometry). More...
 
Vector2 Position2 [get, set]
 Third position (sprite geometry). More...
 
Vector2 Position3 [get, set]
 Fourth position (sprite geometry). More...
 
Vector2 TrimmedBoundsCenter [get, set]
 Center of trimmed bounds. More...
 
Vector2 TrimmedBoundsExtents [get, set]
 Extents of trimmed bounds. More...
 
Vector2 UntrimmedBoundsCenter [get, set]
 Center of untrimmed bounds. More...
 
Vector2 UntrimmedBoundsExtents [get, set]
 Extents of untrimmed bounds. More...
 

Detailed Description

Wrapper struct for tk2dSpriteDefinition that provides a cleaner interface and works transparently with anything that expects tk2dSpriteDefinitions.

Member Function Documentation

◆ Construct()

static SpriteDefinition Semi.SpriteDefinition.Construct ( Material  mat,
string  override_name = null,
int?  region_x = null,
int?  region_y = null,
int?  region_w = null,
int?  region_h = null 
)
inlinestatic

Constructs a new sprite definition

Returns
The new sprite definition.
Parameters
matMaterial with assigned texture.
override_nameOptional name override.
region_xOptional region X coordinate (top left, only used if all 4 region arguments are provided).
region_yOptional region Y coordinate (top left, only used if all 4 region arguments are provided).
region_wOptional region width (only used if all 4 region arguments are provided).
region_hOptional region height (only used if all 4 region arguments are provided).

◆ GenerateGeometry()

static void Semi.SpriteDefinition.GenerateGeometry ( IntVector2  xy,
IntVector2  wh,
IntVector2  tex_size,
Vector2  scale,
out Vector2[]  uvs,
out Vector3  position0,
out Vector3  position1,
out Vector3  position2,
out Vector3  position3 
)
inlinestatic

Generates sprite geometry.

Parameters
xyX and Y coordinates (top left origin).
whWidth and height.
tex_sizeTexel size.
scaleScale.
uvsUV array.
position0First quad coordinate.
position1Second quad coordinate.
position2Third quad coordinate.
position3Fourth quad coordinate.

◆ operator tk2dSpriteDefinition()

static implicit Semi.SpriteDefinition.operator tk2dSpriteDefinition ( SpriteDefinition  s)
static

Implicit cast operator that allows you to use SpriteDefinition anywhere where t2kdSpriteDefinition is expected.

Member Data Documentation

◆ DEFAULT_NORMALS

readonly Vector3 [] Semi.SpriteDefinition.DEFAULT_NORMALS
static
Initial value:
= {
new Vector3(0.0f, 0.0f, -1.0f),
new Vector3(0.0f, 0.0f, -1.0f),
new Vector3(0.0f, 0.0f, -1.0f),
new Vector3(0.0f, 0.0f, -1.0f),
}

Default normals.

◆ DEFAULT_SHADER

readonly string Semi.SpriteDefinition.DEFAULT_SHADER = "Sprites/Default"
static

Default sprite shader.

◆ DEFAULT_TANGENTS

readonly Vector4 [] Semi.SpriteDefinition.DEFAULT_TANGENTS
static
Initial value:
= {
new Vector4(1.0f, 0.0f, 0.0f, 1.0f),
new Vector4(1.0f, 0.0f, 0.0f, 1.0f),
new Vector4(1.0f, 0.0f, 0.0f, 1.0f),
new Vector4(1.0f, 0.0f, 0.0f, 1.0f),
}

Default tangents.

◆ Wrap

tk2dSpriteDefinition Semi.SpriteDefinition.Wrap

Real tk2d object.

Property Documentation

◆ Material

Material Semi.SpriteDefinition.Material
getset

The material.

◆ Name

string Semi.SpriteDefinition.Name
getset

The sprite definition name (ID).

◆ Position0

Vector2 Semi.SpriteDefinition.Position0
getset

First position (sprite geometry).

◆ Position1

Vector2 Semi.SpriteDefinition.Position1
getset

Second position (sprite geometry).

◆ Position2

Vector2 Semi.SpriteDefinition.Position2
getset

Third position (sprite geometry).

◆ Position3

Vector2 Semi.SpriteDefinition.Position3
getset

Fourth position (sprite geometry).

◆ Texture

Texture2D Semi.SpriteDefinition.Texture
getset

The texture (modifies the Material).

◆ TrimmedBoundsCenter

Vector2 Semi.SpriteDefinition.TrimmedBoundsCenter
getset

Center of trimmed bounds.

◆ TrimmedBoundsExtents

Vector2 Semi.SpriteDefinition.TrimmedBoundsExtents
getset

Extents of trimmed bounds.

◆ UntrimmedBoundsCenter

Vector2 Semi.SpriteDefinition.UntrimmedBoundsCenter
getset

Center of untrimmed bounds.

◆ UntrimmedBoundsExtents

Vector2 Semi.SpriteDefinition.UntrimmedBoundsExtents
getset

Extents of untrimmed bounds.


The documentation for this struct was generated from the following file: