Class Tools
Namespace: Headjack
Properties
VideoTexture
The active video's streaming texture
Declaration
public static Texture VideoTexture { get; }
Property Value
Type | Description |
---|---|
Texture | The active video's streaming texture |
Methods
BlurImage(Texture, Boolean, Tools.BlurQuality, Int32, Int32)
Apply Gaussian blur to a texture
Declaration
public static Texture BlurImage(Texture texture, bool Mipmaps = true, Tools.BlurQuality Quality = default(Tools.BlurQuality), int newWidth = 0, int newHeight = 0)
Parameters
Type | Name | Description |
---|---|---|
Texture | texture | The target texture |
System.Boolean | Mipmaps | Also generate mipmaps |
Tools.BlurQuality | Quality | Color Quality |
System.Int32 | newWidth | The output texture's width |
System.Int32 | newHeight | The output texture's height |
Returns
Type | Description |
---|---|
Texture | A rendertexture with the image blurred |
Remarks
Note
Apply a few times for a more blurred effect
CleanUpPersistentDataPath()
Remove unused Video folders in PersistentDataPath
Declaration
public static void CleanUpPersistentDataPath()
CopyTbeInObb()
Declaration
public static void CopyTbeInObb()
CropTexture(Material, String, Single, Single, String)
Set texture into a material and crop it to a specific aspect ratio
Declaration
public static void CropTexture(Material material, string id, float targetWidth, float targetHeight, string propertyName = null)
Parameters
Type | Name | Description |
---|---|---|
Material | material | |
System.String | id | |
System.Single | targetWidth | |
System.Single | targetHeight | |
System.String | propertyName |
Examples
void ApplyTexture(string id, Material material)
{
CropTexture(material,id,1920,1080,null);
}
CropTexture(Material, String, Single, String)
Set texture into a material and crop it to a specific aspect ratio
Declaration
public static void CropTexture(Material material, string id, float targetAspectRatio, string propertyName = null)
Parameters
Type | Name | Description |
---|---|---|
Material | material | |
System.String | id | |
System.Single | targetAspectRatio | |
System.String | propertyName |
Examples
void ApplyTexture(string id, Material material)
{
CropTexture(material,id,16f/9f,null);
}
FitTextToBounds(TextMesh, String, Vector2, Int32, Int32)
Resize a textmesh to fit certain bounds
Declaration
public static bool FitTextToBounds(TextMesh target, string newText, Vector2 maxSize, int minFontSize = 0, int maxFontSize = 0)
Parameters
Type | Name | Description |
---|---|---|
TextMesh | target | The target textmesh |
System.String | newText | The text to apply |
Vector2 | maxSize | Max physical size in Unity units |
System.Int32 | minFontSize | Minimal font size. To low will cause blurriness |
System.Int32 | maxFontSize | Maximal font size. Too high will cause aliasing |
Returns
Type | Description |
---|---|
System.Boolean | True on succes |
Remarks
Note
To apply the correct font sharpness, there is a tool window under "Headjack/Tools/Font Bitmap Scaler"
Examples
Textmesh mesh;
void FitInSquaredMeter(string text)
{
FitTextToBounds(mesh,text,new Vector2(1,1),16,48);
}
FitTextToBounds(TextMesh, String, Vector2, Vector2)
Resize a textmesh to fit certain bounds
Declaration
public static bool FitTextToBounds(TextMesh target, string newText, Vector2 maxSize, Vector2 minMaxFontSize)
Parameters
Type | Name | Description |
---|---|---|
TextMesh | target | The target textmesh |
System.String | newText | The text to apply |
Vector2 | maxSize | Max physical size in Unity units |
Vector2 | minMaxFontSize | Minimal and Maximal font size. Too high will cause aliasing, to low will cause blurriness |
Returns
Type | Description |
---|---|
System.Boolean | True on succes |
Remarks
Note
To apply the correct font sharpness, there is a tool window under "Headjack/Tools/Font Bitmap Scaler"
Examples
Textmesh mesh;
void FitInSquaredMeter(string text)
{
FitTextToBounds(mesh,text,new Vector2(1,1),new Vector2(16,48));
}
GenerateSortedSphere(Int32)
Generate a Normalized Cube
Declaration
public static Mesh GenerateSortedSphere(int Resolution = 16)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | Resolution | Grid resolution |
Returns
Type | Description |
---|---|
Mesh | The generated mesh |
Remarks
Note
Normalized cube has more spread out vertex positions
GenerateVideoSphere(Int32)
Generate a UV Sphere
Declaration
public static Mesh GenerateVideoSphere(int Resolution = 64)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | Resolution | Grid resolution |
Returns
Type | Description |
---|---|
Mesh | The generated mesh |
Remarks
Note
UV Spheres have correct uv coordinates for textures