Public Types | Static Functions | Properties | List of all members
Headjack.Tools Class Reference
Inheritance diagram for Headjack.Tools:

Public Types

enum  BlurQuality { q16 = RenderTextureFormat.RGB565, q32 = RenderTextureFormat.ARGB32 }
 Blurred image's color quality More...
 

Static Functions

static Texture BlurImage (Texture texture, bool Mipmaps=true, BlurQuality Quality=BlurQuality.q16, int newWidth=0, int newHeight=0)
 Apply Gaussian blur to a texture More...
 
static void CropTexture (Material material, string id, float targetWidth, float targetHeight, string propertyName=null)
 Set texture into a material and crop it to a specific aspect ratio More...
 
static void CropTexture (Material material, string id, float targetAspectRatio, string propertyName=null)
 Set texture into a material and crop it to a specific aspect ratio More...
 
static bool FitTextToBounds (TextMesh target, string newText, Vector2 maxSize, Vector2 minMaxFontSize)
 Resize a textmesh to fit certain bounds More...
 
static bool FitTextToBounds (TextMesh target, string newText, Vector2 maxSize, int minFontSize=0, int maxFontSize=0)
 Resize a textmesh to fit certain bounds More...
 
static Mesh GenerateSortedSphere (int Resolution=16)
 Generate a Normalized Cube More...
 
static Mesh GenerateVideoSphere (int Resolution=64)
 Generate a UV Sphere More...
 

Properties

static Texture VideoTexture [get]
 The active video's streaming texture More...
 

Member Enumeration Documentation

§ BlurQuality

Blurred image's color quality

Note
Default is always ARGB32, only use RGB565 by encountering memory issues

Member Function Documentation

§ BlurImage()

static Texture Headjack.Tools.BlurImage ( Texture  texture,
bool  Mipmaps = true,
BlurQuality  Quality = BlurQuality.q16,
int  newWidth = 0,
int  newHeight = 0 
)
inlinestatic

Apply Gaussian blur to a texture

Parameters
textureThe target texture
MipmapsAlso generate mipmaps
QualityColor Quality
newWidthThe output texture's width
newHeightThe output texture's height
Returns
A rendertexture with the image blurred
Note
Apply a few times for a more blurred effect

§ CropTexture() [1/2]

static void Headjack.Tools.CropTexture ( Material  material,
string  id,
float  targetWidth,
float  targetHeight,
string  propertyName = null 
)
inlinestatic

Set texture into a material and crop it to a specific aspect ratio

Example

void ApplyTexture(string id, Material material)
{
CropTexture(material,id,1920,1080,null);
}

§ CropTexture() [2/2]

static void Headjack.Tools.CropTexture ( Material  material,
string  id,
float  targetAspectRatio,
string  propertyName = null 
)
inlinestatic

Set texture into a material and crop it to a specific aspect ratio

Example

void ApplyTexture(string id, Material material)
{
CropTexture(material,id,16f/9f,null);
}

§ FitTextToBounds() [1/2]

static bool Headjack.Tools.FitTextToBounds ( TextMesh  target,
string  newText,
Vector2  maxSize,
Vector2  minMaxFontSize 
)
inlinestatic

Resize a textmesh to fit certain bounds

Parameters
targetThe target textmesh
newTextThe text to apply
maxSizeMax physical size in Unity units
minMaxFontSizeMinimal and Maximal font size. Too high will cause aliasing, to low will cause blurriness
Returns
True on succes
Note
To apply the correct font sharpness, there is a tool window under "Headjack/Tools/Font Bitmap Scaler"

Example

Textmesh mesh;
void FitInSquaredMeter(string text)
{
FitTextToBounds(mesh,text,new Vector2(1,1),new Vector2(16,48));
}

§ FitTextToBounds() [2/2]

static bool Headjack.Tools.FitTextToBounds ( TextMesh  target,
string  newText,
Vector2  maxSize,
int  minFontSize = 0,
int  maxFontSize = 0 
)
inlinestatic

Resize a textmesh to fit certain bounds

Parameters
targetThe target textmesh
newTextThe text to apply
maxSizeMax physical size in Unity units
minFontSizeMinimal font size. To low will cause blurriness
maxFontSizeMaximal font size. Too high will cause aliasing
Returns
True on succes
Note
To apply the correct font sharpness, there is a tool window under "Headjack/Tools/Font Bitmap Scaler"

Example

Textmesh mesh;
void FitInSquaredMeter(string text)
{
FitTextToBounds(mesh,text,new Vector2(1,1),16,48);
}

§ GenerateSortedSphere()

static Mesh Headjack.Tools.GenerateSortedSphere ( int  Resolution = 16)
inlinestatic

Generate a Normalized Cube

Parameters
ResolutionGrid resolution
Returns
The generated mesh
Note
Normalized cube has more spread out vertex positions

§ GenerateVideoSphere()

static Mesh Headjack.Tools.GenerateVideoSphere ( int  Resolution = 64)
inlinestatic

Generate a UV Sphere

Parameters
ResolutionGrid resolution
Returns
The generated mesh
Note
UV Spheres have correct uv coordinates for textures

Property Documentation

§ VideoTexture

Texture Headjack.Tools.VideoTexture
staticget

The active video's streaming texture

Returns
The active video's streaming texture

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