Difference between revisions of "GPU Instancer Pro:APIDocumentation"

From GurBu Wiki
Jump to: navigation, search
Line 2: Line 2:
  
  
==== GPUICoreAPI ====
+
== GPUICoreAPI ==
  
 
==== RegisterRenderer ====
 
==== RegisterRenderer ====

Revision as of 13:01, 11 April 2024

About GPU Instance Pro | Getting Started | Terminology | Best Practices | API Documentation | F.A.Q.


GPUICoreAPI

RegisterRenderer



public static bool RegisterRenderer(UnityEngine.Object source, GameObject prefab, out int rendererKey)

Parameters
source The source responsible for registering the renderer. E.g. the MonoBehaviour class
prefab GameObject that the renderers will be based on
rendererKey Integer key that uniquely identifies the renderer


Description:

The RegisterRenderer method is used to set up GPUI renderers for the specified GameObject. This method needs to be called to produce a renderKey, which can then be used with the SetMatrices method to start rendering instances with the given transform matrices. To stop the rendering, the DisposeRenderer method should be called with the rendererKey output.



RegisterRenderer



public static bool RegisterRenderer(UnityEngine.Object source, GameObject prefab, GPUIProfile profile, out int rendererKey)

Parameters
source The source responsible for registering the renderer. E.g. the MonoBehaviour class
prefab GameObject that the renderers will be based on
profile GPUIProfile that determines various rendering settings
rendererKey Integer key that uniquely identifies the renderer


Description:

The RegisterRenderer method is used to set up GPUI renderers for the specified GameObject. This method needs to be called to produce a renderKey, which can then be used with the SetMatrices method to start rendering instances with the given transform matrices. To stop the rendering, the DisposeRenderer method should be called with the rendererKey output.



DisposeRenderer



public static void DisposeRenderer(int rendererKey)

Parameters
rendererKey Integer key that uniquely identifies the renderer


Description:

Disposes the renderer data previously defined with the RegisterRenderer method.



SetMatrices



public static bool SetMatrices(int rendererKey, Matrix4x4[] matrices)

Parameters
rendererKey Integer key that uniquely identifies the renderer


Description:

Sets the transform matrix data to a renderer previously defined with the RegisterRenderer method.



SetMatrices



public static bool SetMatrices(int rendererKey, List<Matrix4x4> matrices)

Parameters
rendererKey Integer key that uniquely identifies the renderer


Description:

Sets the transform matrix data to a renderer previously defined with the RegisterRenderer method.



SetMatrices



public static bool SetMatrices(int rendererKey, NativeArray<Matrix4x4> matrices)

Parameters
rendererKey Integer key that uniquely identifies the renderer


Description:

Sets the transform matrix data to a renderer previously defined with the RegisterRenderer method.



SetBufferSize



public static bool SetBufferSize(int rendererKey, int bufferSize)

Parameters
rendererKey Integer key that uniquely identifies the renderer


Description:

Sets the transform matrix data to a renderer previously defined with the RegisterRenderer method.



AddCameraEventOnPreCull



public static void AddCameraEventOnPreCull(UnityAction<GPUICameraData> cameraEvent)

Parameters


Description:

Adds a method to execute before each camera's visibility calculations.



RemoveCameraEventOnPreCull



public static void RemoveCameraEventOnPreCull(UnityAction<GPUICameraData> cameraEvent)

Parameters


Description:

Removes the method previously added with the AddCameraEventOnPreCull method.



AddCameraEventOnPreRender



public static void AddCameraEventOnPreRender(UnityAction<GPUICameraData> cameraEvent)

Parameters


Description:

Adds a method to execute after each camera's visibility calculations and before draw calls.



RemoveCameraEventOnPreRender



public static void RemoveCameraEventOnPreRender(UnityAction<GPUICameraData> cameraEvent)

Parameters


Description:

Removes the method previously added with the AddCameraEventOnPreRender method.



AddCameraEventOnPostRender



public static void AddCameraEventOnPostRender(UnityAction<GPUICameraData> cameraEvent)

Parameters


Description:

Adds a method to execute after each camera's draw calls.



RemoveCameraEventOnPostRender



public static void RemoveCameraEventOnPostRender(UnityAction<GPUICameraData> cameraEvent)

Parameters


Description:

Removes the method previously added with the AddCameraEventOnPostRender method.