Class CustomWatermark
Inheritance
Namespace: RenderHeads.Media.AVProMovieCapture
Assembly: cs.temp.dll.dll
Syntax
public class CustomWatermark : MonoBehaviour
Fields
CustomMovementFunc
Declaration
public CustomWatermark.CustomMovementFunction CustomMovementFunc
Field Value
| Type | Description |
|---|---|
| CustomWatermark.CustomMovementFunction |
Properties
CaptureComponent
Declaration
public CaptureBase CaptureComponent { get; set; }
Property Value
| Type | Description |
|---|---|
| CaptureBase |
RenderToFace
Declaration
public int RenderToFace { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
ScreenSize
Declaration
public Vector2 ScreenSize { get; }
Property Value
| Type | Description |
|---|---|
| Vector2 |
Texture
Declaration
public Texture2D Texture { get; }
Property Value
| Type | Description |
|---|---|
| Texture2D |
UpdatePosition
Declaration
public bool UpdatePosition { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Methods
AddWatermarkToTexture(RenderTexture)
Adds the watermark to the provided RenderTexture by blitting it with a custom material.
- Ensures the internal screenSize matches the texture's dimensions.
- Initializes the watermark blit material if not already set, using a custom shader.
- Sets the watermark and main textures on the material.
- Calculates the normalized size and offset for the watermark using GetOffset().
- Sets the watermark position and size on the material.
- Performs a two-step blit: first draws the watermark onto a temporary texture, then copies it back to the original texture.
- Releases the temporary texture after use. This function is called by texture-based capture components before the texture is sent to native code.
Declaration
public Texture AddWatermarkToTexture(RenderTexture texture)
Parameters
| Type | Name | Description |
|---|---|---|
| RenderTexture | texture | The RenderTexture to which the watermark will be added. |
Returns
| Type | Description |
|---|---|
| Texture | Texture with the watermark applied. |
DoesODSSupportWatermark()
This is used to determine if the 360ODS compoenent has been setup to allow for watermarking.
Declaration
public bool DoesODSSupportWatermark()
Returns
| Type | Description |
|---|---|
| System.Boolean | True if watermarking is supported for by the current 360ODS capture component; otherwise, false. |
GetCaptureType()
Returns the integer value representing the current capture type in use by this watermark component.
- Checks the type name of the assigned _captureComponent and maps it to the corresponding internal CaptureType enum value (Camera, Camera360, Camera360ODS, Screen, Texture, WebCamTexture).
- If no capture component is assigned, or the type is unrecognized, returns -1.
Declaration
public int GetCaptureType()
Returns
| Type | Description |
|---|---|
| System.Int32 | Integer value of the current capture type, or -1 if not set or unknown. |
GetOffset()
Calculates the normalized size and position offset for the watermark based on the current configuration.
- Determines the watermark's pixel offset using the selected positioning mode (_positionOption), which can be anchor, random, lerp random, curve-based, or custom.
- Ensures the watermark stays within the screen bounds by clamping the offset.
- Converts both the watermark size and offset from pixel coordinates to normalized [0,1] values, making them resolution-independent for rendering.
- For 360 ODS capture, updates the screen size to match the recording resolution.
- Updates the last call time for time-based position calculations.
Declaration
public (Vector2, Vector2) GetOffset()
Returns
| Type | Description |
|---|---|
| System.ValueTuple<Vector2, Vector2> | A tuple containing:
|
IsUsingCustomFunction()
checks if the CustomWatermark is using the custom function for positioning of the watermark
Declaration
public bool IsUsingCustomFunction()
Returns
| Type | Description |
|---|---|
| System.Boolean | True if using custom function method for positioning; otherwise false |
OnDisable()
Declaration
public void OnDisable()
OnEnable()
Declaration
public void OnEnable()
Setup()
Setup the watermark component, this method is to allow for captures the happen during play mode, and not nececarrly at the start
Declaration
public void Setup()
Stop()
Handles Cleanup of the Watermark component, removing any camera post render actions, as well as removing the watermark from any Capture components
Declaration
public void Stop()