Class RendererCircuitPins_RenderBatch
Renderer for the circuit pins. Each instance of this class renders pins with the same properties (like color, type, etc.) with Unity's instanced drawing.
Inheritance
Implements
Namespace: AS2.Visuals
Assembly: .dll
Syntax
public class RendererCircuitPins_RenderBatch : IGenerateDynamicMesh
Constructors
| Edit this page View SourceRendererCircuitPins_RenderBatch(PropertyBlockData)
Declaration
public RendererCircuitPins_RenderBatch(RendererCircuitPins_RenderBatch.PropertyBlockData properties)
Parameters
| Type | Name | Description |
|---|---|---|
| RendererCircuitPins_RenderBatch.PropertyBlockData | properties |
Fields
| Edit this page View SourcecircuitMatrices_PinConnectors
Declaration
private List<Matrix4x4[]> circuitMatrices_PinConnectors
Field Value
| Type | Description |
|---|---|
| List<Matrix4x4[]> |
circuitMatrices_Pins
Declaration
private List<Matrix4x4[]> circuitMatrices_Pins
Field Value
| Type | Description |
|---|---|
| List<Matrix4x4[]> |
currentIndex
Declaration
private int currentIndex
Field Value
| Type | Description |
|---|---|
| int |
currentIndex_connectors
Declaration
private int currentIndex_connectors
Field Value
| Type | Description |
|---|---|
| int |
maxArraySize
Declaration
private const int maxArraySize = 1023
Field Value
| Type | Description |
|---|---|
| int |
pinMaterial
Declaration
private Material pinMaterial
Field Value
| Type | Description |
|---|---|
| Material |
pinQuad
Declaration
private Mesh pinQuad
Field Value
| Type | Description |
|---|---|
| Mesh |
properties
Declaration
public RendererCircuitPins_RenderBatch.PropertyBlockData properties
Field Value
| Type | Description |
|---|---|
| RendererCircuitPins_RenderBatch.PropertyBlockData |
propertyBlock_circuitMatrices_PinConnectors
Declaration
private MaterialPropertyBlockData_Circuits propertyBlock_circuitMatrices_PinConnectors
Field Value
| Type | Description |
|---|---|
| MaterialPropertyBlockData_Circuits |
propertyBlock_circuitMatrices_Pins
Declaration
private MaterialPropertyBlockData_Circuits propertyBlock_circuitMatrices_Pins
Field Value
| Type | Description |
|---|---|
| MaterialPropertyBlockData_Circuits |
zOffset
Declaration
private float zOffset
Field Value
| Type | Description |
|---|---|
| float |
Methods
| Edit this page View SourceAddConnectorPin(Vector2)
Adds a connector pin. A connector pin is an internal pin in expanded particles that connects the two sides of the particle. It has the width and color of the circuit lines, so that two lines that go to the same point do not have visibly sharp edges and seem like a connected structure.
Declaration
public RenderBatchIndex AddConnectorPin(Vector2 pinPos)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | pinPos | The global pin center position. |
Returns
| Type | Description |
|---|---|
| RenderBatchIndex |
AddPin(Vector2, bool)
Adds a pin.
Declaration
public RenderBatchIndex AddPin(Vector2 pinPos, bool singletonPin)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | pinPos | The global pin center position. |
| bool | singletonPin | Whether this is a singleton pin. Singleton pins have their own pin size. |
Returns
| Type | Description |
|---|---|
| RenderBatchIndex | The index of the new pin's matrix in this batch. |
ApplyMovementTimestamps(float, float)
Applies the timestamps for the movement offsets.
Declaration
public void ApplyMovementTimestamps(float movementStartTime, float movementDuration)
Parameters
| Type | Name | Description |
|---|---|---|
| float | movementStartTime | Start time of the animation. |
| float | movementDuration | Duration of the animation. |
ApplyUpdates(float)
Applies the updates for the animations.
Declaration
public void ApplyUpdates(float animationStartTime)
Parameters
| Type | Name | Description |
|---|---|---|
| float | animationStartTime | The start time of the animation. |
CalculatePinConnectorMatrix(Vector2)
Calculates the pin connector matrix from the positional information about the pin connector. We basically take a standard quad with a pin texture and transform it so that it forms a pin of the right size.
Declaration
private Matrix4x4 CalculatePinConnectorMatrix(Vector2 pinPos)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | pinPos | The global position of the pin center. |
Returns
| Type | Description |
|---|---|
| Matrix4x4 | A translation, rotation and scaling matrix for a pin mesh with the given properties. |
CalculatePinMatrix(Vector2, bool)
Calculates the pin matrix from the positional information about the pin. We basically take a standard quad with a pin texture and transform it so that it forms a pin of the right size.
Declaration
private Matrix4x4 CalculatePinMatrix(Vector2 pinPos, bool isSingletonPin)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | pinPos | The global position of the pin. |
| bool | isSingletonPin | Whether this is a singleton pin. Singleton pins have their own pin size. |
Returns
| Type | Description |
|---|---|
| Matrix4x4 | A translation, rotation and scaling matrix for a pin mesh with the given properties. |
ClearMatrices()
Clears the matrices, so nothing gets rendered anymore. The lists can be filled with new data now. (Actually just sets the index to 0, so we don't draw anything anymore.)
Declaration
public void ClearMatrices()
Init()
Initializes the materials and settings of this class.
Declaration
public void Init()
RegenerateMeshes()
Regenerates the meshes of this class.
Declaration
public void RegenerateMeshes()
Render(ViewType, bool)
Renders the pins.
Declaration
public void Render(ViewType type, bool firstRenderFrame)
Parameters
| Type | Name | Description |
|---|---|---|
| ViewType | type | The current view type. Useful for deciding what to show. |
| bool | firstRenderFrame | If this is the first frame of the new round. |
UpdateConnectorPin(Vector2, RenderBatchIndex)
Updates a connector pin.
Declaration
public void UpdateConnectorPin(Vector2 pinPos, RenderBatchIndex index)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | pinPos | The new global pin center position. |
| RenderBatchIndex | index | The batch index of the pin to update. |
UpdatePin(Vector2, bool, RenderBatchIndex)
Updates a pin.
Declaration
public void UpdatePin(Vector2 pinPos, bool singletonPin, RenderBatchIndex index)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | pinPos | The global pin center position. |
| bool | singletonPin | Whether this is a singleton pin. Singleton pins have their own pin size. |
| RenderBatchIndex | index | The index of the pin to update. |