Search Results for

    Show / Hide Table of Contents

    Class RendererCircuits_Instance

    The circuit and bond renderer instance that handles all the data that is added in a round. Has render batches for circuits (colorized lines) and pins (colorized dots) grouped by data with the same properties (like type, color, etc.). These batches are all rendered when the draw loop is called.

    Inheritance
    object
    RendererCircuits_Instance
    Namespace: AS2.Visuals
    Assembly: .dll
    Syntax
    public class RendererCircuits_Instance

    Constructors

    | Edit this page View Source

    RendererCircuits_Instance()

    Declaration
    public RendererCircuits_Instance()

    Fields

    | Edit this page View Source

    bondBatches

    Declaration
    private readonly RendererCircuits_RenderBatch[] bondBatches
    Field Value
    Type Description
    RendererCircuits_RenderBatch[]
    | Edit this page View Source

    bondData

    Declaration
    private List<ParticleBondGraphicState> bondData
    Field Value
    Type Description
    List<ParticleBondGraphicState>
    | Edit this page View Source

    circuitDataMap

    Declaration
    private Dictionary<ParticleGraphicsAdapterImpl, RendererCircuits_Instance.ParticleCircuitData> circuitDataMap
    Field Value
    Type Description
    Dictionary<ParticleGraphicsAdapterImpl, RendererCircuits_Instance.ParticleCircuitData>
    | Edit this page View Source

    colorIndices

    Maps colors to render batch list indices. Use GetColorIndex(Color) to access.

    Declaration
    private Dictionary<Color, int> colorIndices
    Field Value
    Type Description
    Dictionary<Color, int>
    | Edit this page View Source

    degreeList

    Declaration
    private List<float> degreeList
    Field Value
    Type Description
    List<float>
    | Edit this page View Source

    delayedCircuitBatches

    Contains the render batch arrays for delayed batches. Use GetColorIndex(Color) to get the index of the array belonging to the desired color. Use GetBatchGroup(RendererCircuits_RenderBatch[], bool, bool, Color, Vector2, bool) to find the correct batches or use internal_notBeeping etc. directly.

    Declaration
    private List<RendererCircuits_RenderBatch[]> delayedCircuitBatches
    Field Value
    Type Description
    List<RendererCircuits_RenderBatch[]>
    | Edit this page View Source

    external_beeping_active

    Declaration
    private const int external_beeping_active = 4
    Field Value
    Type Description
    int
    | Edit this page View Source

    external_beeping_paused

    Declaration
    private const int external_beeping_paused = 5
    Field Value
    Type Description
    int
    | Edit this page View Source

    external_notBeeping

    Declaration
    private const int external_notBeeping = 3
    Field Value
    Type Description
    int
    | Edit this page View Source

    internal_beeping_active

    Declaration
    private const int internal_beeping_active = 1
    Field Value
    Type Description
    int
    | Edit this page View Source

    internal_beeping_paused

    Declaration
    private const int internal_beeping_paused = 2
    Field Value
    Type Description
    int
    | Edit this page View Source

    internal_notBeeping

    Declaration
    private const int internal_notBeeping = 0
    Field Value
    Type Description
    int
    | Edit this page View Source

    isRenderingActive

    Declaration
    public bool isRenderingActive
    Field Value
    Type Description
    bool
    | Edit this page View Source

    lineBatches

    Contains all line batches for easier iteration.

    Declaration
    private List<RendererCircuits_RenderBatch> lineBatches
    Field Value
    Type Description
    List<RendererCircuits_RenderBatch>
    | Edit this page View Source

    nonDelyedCircuitBatches

    Contains a dictionary mapping offset vectors to render batch arrays for non-delayed batches. Use GetColorIndex(Color) to get the index of the dictionary belonging to the desired color. Use GetNonDelayedArray(int, Vector2) using this index to get the batch array. Then use GetBatchGroup(RendererCircuits_RenderBatch[], bool, bool, Color, Vector2, bool) or internal_notBeeping etc. directly to get the specific batches.

    Declaration
    private List<Dictionary<Vector2, RendererCircuits_RenderBatch[]>> nonDelyedCircuitBatches
    Field Value
    Type Description
    List<Dictionary<Vector2, RendererCircuits_RenderBatch[]>>
    | Edit this page View Source

    pSetSortingList

    Declaration
    private PriorityQueue<ParticlePinGraphicState.PSetData> pSetSortingList
    Field Value
    Type Description
    PriorityQueue<ParticlePinGraphicState.PSetData>
    | Edit this page View Source

    propertiesToPinRenderBatchMap

    Map of render batches for all circle-like elements: Partition set handles, their beep highlights, and circles at circuit line junctions covering the sharp edges.

    Declaration
    public Dictionary<RendererCircuitPins_RenderBatch.PropertyBlockData, RendererCircuitPins_RenderBatch> propertiesToPinRenderBatchMap
    Field Value
    Type Description
    Dictionary<RendererCircuitPins_RenderBatch.PropertyBlockData, RendererCircuitPins_RenderBatch>
    | Edit this page View Source

    renderBatch_bondsCircular_animated

    Declaration
    public RendererCircuits_RenderBatch renderBatch_bondsCircular_animated
    Field Value
    Type Description
    RendererCircuits_RenderBatch
    | Edit this page View Source

    renderBatch_bondsCircular_static

    Declaration
    public RendererCircuits_RenderBatch renderBatch_bondsCircular_static
    Field Value
    Type Description
    RendererCircuits_RenderBatch
    | Edit this page View Source

    renderBatch_bondsHexagonal_animated

    Declaration
    public RendererCircuits_RenderBatch renderBatch_bondsHexagonal_animated
    Field Value
    Type Description
    RendererCircuits_RenderBatch
    | Edit this page View Source

    renderBatch_bondsHexagonal_static

    Declaration
    public RendererCircuits_RenderBatch renderBatch_bondsHexagonal_static
    Field Value
    Type Description
    RendererCircuits_RenderBatch
    | Edit this page View Source

    vectorList

    Declaration
    private List<Vector2> vectorList
    Field Value
    Type Description
    List<Vector2>

    Methods

    | Edit this page View Source

    AddBond(ParticleBondGraphicState, bool)

    Adds a single bond to the system.

    Declaration
    public void AddBond(ParticleBondGraphicState bondState, bool addToBondData = true)
    Parameters
    Type Name Description
    ParticleBondGraphicState bondState

    Graphical information belonging to the bond.

    bool addToBondData

    Whether this is a new bond that should be stored (set to false if this is just a refresh).

    | Edit this page View Source

    AddCircuitLineToBatches(Vector2, Vector2, RendererCircuits_RenderBatch, bool, RendererCircuits_RenderBatch, RendererCircuits_RenderBatch, GDRef, GDRef)

    Adds lines representing a circuit line between the two given positions to the corresponding batches.

    Declaration
    private void AddCircuitLineToBatches(Vector2 globalLineStartPos, Vector2 globalLineEndPos, RendererCircuits_RenderBatch batchBase, bool beeping, RendererCircuits_RenderBatch batchBeepActive, RendererCircuits_RenderBatch batchBeepPaused, RendererCircuits_Instance.GDRef gdRef, RendererCircuits_Instance.GDRef gdRef_beep)
    Parameters
    Type Name Description
    Vector2 globalLineStartPos

    The start position of the line.

    Vector2 globalLineEndPos

    The end position of the line.

    RendererCircuits_RenderBatch batchBase

    The render batch into which the non-beeping part of the line should be added.

    bool beeping

    Whether or not the circuit to which the line belongs is currently beeping.

    RendererCircuits_RenderBatch batchBeepActive

    The render batch to which the animated flashing part of the line should be added if the circuit is beeping. May be null if beeping is false.

    RendererCircuits_RenderBatch batchBeepPaused

    The render batch to which the static part with the white center shown while the simulation is paused should be added if the circuit is beeping. May be null if beeping is false.

    RendererCircuits_Instance.GDRef gdRef

    Graphical data reference for the non-beeping part.

    RendererCircuits_Instance.GDRef gdRef_beep

    Graphical data reference for the beeping part.

    | Edit this page View Source

    AddCircuits(ParticleGraphicsAdapterImpl, ParticlePinGraphicState, PositionSnap, PartitionSetViewType, bool)

    Adds the data of a particle's pin configuration to the system. Combines it with the position data of the particle itself to calculate all positions of the circuits and pins.

    Declaration
    public void AddCircuits(ParticleGraphicsAdapterImpl particle, ParticlePinGraphicState state, ParticleGraphicsAdapterImpl.PositionSnap snap, PartitionSetViewType pSetViewType, bool addToCircuitData = true)
    Parameters
    Type Name Description
    ParticleGraphicsAdapterImpl particle

    The particle the data belongs to.

    ParticlePinGraphicState state

    The particle's graphical pin and partition set data.

    ParticleGraphicsAdapterImpl.PositionSnap snap

    The particle's position and movement data.

    PartitionSetViewType pSetViewType

    The view type that the circuits should be drawn with.

    bool addToCircuitData

    Whether the given input should be added to the circuit data. true by default, set to false when doing something like refreshing the circuits.

    | Edit this page View Source

    AddConnectorPin(Vector2, Color, bool, Vector2, GDRef)

    Adds a colored circle at the position where two internal circuit lines meet to cover the sharp edges.

    Declaration
    private void AddConnectorPin(Vector2 pinPos, Color color, bool delayed, Vector2 movementOffset, RendererCircuits_Instance.GDRef gdRef)
    Parameters
    Type Name Description
    Vector2 pinPos

    The global position where the circle should be drawn.

    Color color

    The color of the circuit to which the circle belongs.

    bool delayed

    Whether the circle should appear delayed because the particle is performing a movement.

    Vector2 movementOffset

    The world coordinate vector pointing from the pin's end position after its movement to its start position.

    RendererCircuits_Instance.GDRef gdRef

    Graphical data belonging to the partition set.

    | Edit this page View Source

    AddLines(Vector2[], Vector2[], Color, bool, bool, bool, Vector2, RendererCircuits_RenderBatch[], RendererCircuits_RenderBatch[], GDRef[], GDRef[])

    Convenience version of AddCircuitLineToBatches(Vector2, Vector2, RendererCircuits_RenderBatch, bool, RendererCircuits_RenderBatch, RendererCircuits_RenderBatch, GDRef, GDRef) for the case that several lines have the exact same properties.

    Declaration
    private void AddLines(Vector2[] globalLineStartPos, Vector2[] globalLineEndPos, Color color, bool isConnectorLine, bool delayed, bool beeping, Vector2 movementOffset, RendererCircuits_RenderBatch[] delayedBatches, RendererCircuits_RenderBatch[] nonDelayedBatches, RendererCircuits_Instance.GDRef[] gdRef, RendererCircuits_Instance.GDRef[] gdRef_beep)
    Parameters
    Type Name Description
    Vector2[] globalLineStartPos

    The start positions of the lines.

    Vector2[] globalLineEndPos

    The end positions of the lines. Must have the same length as globalLineStartPos.

    Color color

    The color of the lines.

    bool isConnectorLine

    Whether the lines are connectors between particles or internal lines.

    bool delayed

    Whether the lines should be displayed with a delay or not.

    bool beeping

    Whether the lines should have a beeping effect or not.

    Vector2 movementOffset

    The movement offset used to animate the line movements. Should be Vector2.zero if delayed is true.

    RendererCircuits_RenderBatch[] delayedBatches

    The render batch array of size 6 containing the delayed batches for the color color.

    RendererCircuits_RenderBatch[] nonDelayedBatches

    The render batch array of size 6 containing the non-delayed batches for the color color and the movement offset movementOffset.

    GDRef[] gdRef

    Graphical data references for the non-beeping lines. Must have the same length as globalLineStartPos.

    GDRef[] gdRef_beep

    Graphical data references for the beeping lines. Must have the same length as globalLineStartPos.

    | Edit this page View Source

    AddLines_PartitionSetContracted(ParticlePinGraphicState, PositionSnap, PSetData, Vector2, bool, Vector2, GDRef)

    Adds the internal and external circuit lines belonging to a partition set of a contracted particle.

    Declaration
    private void AddLines_PartitionSetContracted(ParticlePinGraphicState state, ParticleGraphicsAdapterImpl.PositionSnap snap, ParticlePinGraphicState.PSetData pSet, Vector2 posPartitionSet, bool delayed, Vector2 movementOffset, RendererCircuits_Instance.GDRef gdRef)
    Parameters
    Type Name Description
    ParticlePinGraphicState state

    The graphical circuit information belonging to the particle.

    ParticleGraphicsAdapterImpl.PositionSnap snap

    The position snapshot of the particle.

    ParticlePinGraphicState.PSetData pSet

    The partition set whose lines should be added.

    Vector2 posPartitionSet

    The global position of the partition set handle.

    bool delayed

    Whether the partition set and its lines should be displayed after a delay.

    Vector2 movementOffset

    The world coordinate vector pointing from the particle's end position after its movement to its start position.

    RendererCircuits_Instance.GDRef gdRef

    The graphical data struct in which the new graphical information should be stored.

    | Edit this page View Source

    AddLines_PartitionSetExpanded(ParticlePinGraphicState, PositionSnap, PSetData, Vector2, Vector2, bool, Vector2, GDRef, GDRef)

    Adds the internal and external circuit lines belonging to a partition set of an expanded particle.

    Declaration
    private void AddLines_PartitionSetExpanded(ParticlePinGraphicState state, ParticleGraphicsAdapterImpl.PositionSnap snap, ParticlePinGraphicState.PSetData pSet, Vector2 posPartitionSet1, Vector2 posPartitionSet2, bool delayed, Vector2 movementOffset, RendererCircuits_Instance.GDRef gdRef_lines1, RendererCircuits_Instance.GDRef gdRef_lines2)
    Parameters
    Type Name Description
    ParticlePinGraphicState state

    The graphical circuit information belonging to the particle.

    ParticleGraphicsAdapterImpl.PositionSnap snap

    The position snapshot of the particle.

    ParticlePinGraphicState.PSetData pSet

    The partition set whose lines should be added.

    Vector2 posPartitionSet1

    The global position of the partition set handle in the particle's head.

    Vector2 posPartitionSet2

    The global position of the partition set handle in the particle's tail.

    bool delayed

    Whether the partition set and its lines should be displayed after a delay.

    Vector2 movementOffset

    The world coordinate vector pointing from the particle's end position after its movement to its start position.

    RendererCircuits_Instance.GDRef gdRef_lines1

    The graphical data struct in which the new graphical information for the head lines should be stored.

    RendererCircuits_Instance.GDRef gdRef_lines2

    The graphical data struct in which the new graphical information for the tail lines should be stored.

    | Edit this page View Source

    AddLines_SingletonSetContracted(ParticlePinGraphicState, PositionSnap, PSetData, bool, Vector2)

    Adds the external circuit lines belonging to a singleton partition set of a contracted particle. Also adds a beep highlight if the partition set is a beep origin and a fault highlight if the partition set has a beep fault.

    Declaration
    private void AddLines_SingletonSetContracted(ParticlePinGraphicState state, ParticleGraphicsAdapterImpl.PositionSnap snap, ParticlePinGraphicState.PSetData pSet, bool delayed, Vector2 movementOffset)
    Parameters
    Type Name Description
    ParticlePinGraphicState state

    The graphical circuit information belonging to the particle.

    ParticleGraphicsAdapterImpl.PositionSnap snap

    The position snapshot of the particle.

    ParticlePinGraphicState.PSetData pSet

    The partition set whose lines should be added.

    bool delayed

    Whether the partition set and its lines should be displayed after a delay.

    Vector2 movementOffset

    The world coordinate vector pointing from the particle's end position after its movement to its start position.

    | Edit this page View Source

    AddLines_SingletonSetExpanded(ParticlePinGraphicState, PositionSnap, PSetData, bool, Vector2)

    Adds the internal and external circuit lines belonging to a singleton partition set of an expanded particle. Also adds a beep highlight if the partition set is a beep origin and a fault highlight if the partition set has a beep fault.

    Declaration
    private void AddLines_SingletonSetExpanded(ParticlePinGraphicState state, ParticleGraphicsAdapterImpl.PositionSnap snap, ParticlePinGraphicState.PSetData pSet, bool delayed, Vector2 movementOffset)
    Parameters
    Type Name Description
    ParticlePinGraphicState state

    The graphical circuit information belonging to the particle.

    ParticleGraphicsAdapterImpl.PositionSnap snap

    The position snapshot of the particle.

    ParticlePinGraphicState.PSetData pSet

    The partition set whose lines should be added.

    bool delayed

    Whether the partition set and its lines should be displayed after a delay.

    Vector2 movementOffset

    The world coordinate vector pointing from the particle's end position after its movement to its start position.

    | Edit this page View Source

    AddPin(Vector2, Color, bool, bool, bool, bool, Vector2, GDRef, GDRef, GDRef)

    Adds a pin/partition set handle to the render system, using the corresponding render batch or creating a new one.

    Declaration
    private void AddPin(Vector2 pinPos, Color color, bool delayed, bool beeping, bool beepOrigin, bool faulty, Vector2 movementOffset, RendererCircuits_Instance.GDRef gdRef, RendererCircuits_Instance.GDRef gdRef_beep_origin, RendererCircuits_Instance.GDRef gdRef_beep_fault)
    Parameters
    Type Name Description
    Vector2 pinPos

    The global position of the pin.

    Color color

    The color in which the pin should be rendered.

    bool delayed

    Whether this pin should be displayed with a delay so that it only appears after any movement animations are finished.

    bool beeping

    Whether a beep should be displayed on this pin.

    bool beepOrigin

    Whether this pin is a beep origin.

    bool faulty

    Whether a beep fault should be displayed on this pin.

    Vector2 movementOffset

    The world coordinate vector pointing from the pin's end position after its movement to its start position.

    RendererCircuits_Instance.GDRef gdRef

    Graphical data belonging to the pin.

    RendererCircuits_Instance.GDRef gdRef_beep_origin

    Graphical data belonging to the beep origin. Should usually be the same as gdRef.

    RendererCircuits_Instance.GDRef gdRef_beep_fault

    Graphical data belonging to the beep or fault highlight. Should usually be the same as gdRef.

    | Edit this page View Source

    AddSingletonBeep(Vector2, Color, bool, Vector2)

    Adds a beep highlight to the pin of a singleton partition set.

    Declaration
    private void AddSingletonBeep(Vector2 pinPos, Color color, bool delayed, Vector2 movementOffset)
    Parameters
    Type Name Description
    Vector2 pinPos

    The global position of the pin.

    Color color

    The color of the partition set (will not be rendered; the fault highlight is always red).

    bool delayed

    Whether the pin and fault should appear delayed because the particle is performing a movement.

    Vector2 movementOffset

    The world coordinate vector pointing from the pin's end position after its movement to its start position.

    | Edit this page View Source

    AddSingletonBeepOrigin(Vector2, Color, bool, Vector2)

    Adds a beep origin highlight to the pin of a singleton partition set.

    Declaration
    private void AddSingletonBeepOrigin(Vector2 pinPos, Color color, bool delayed, Vector2 movementOffset)
    Parameters
    Type Name Description
    Vector2 pinPos

    The global position of the pin.

    Color color

    The color of the partition set (will not be rendered; the beep highlight is always light gray).

    bool delayed

    Whether the pin and beep should appear delayed because the particle is performing a movement.

    Vector2 movementOffset

    The world coordinate vector pointing from the pin's end position after its movement to its start position.

    | Edit this page View Source

    AddSingletonFault(Vector2, Color, bool, Vector2)

    Adds a fault highlight to the pin of a singleton partition set.

    Declaration
    private void AddSingletonFault(Vector2 pinPos, Color color, bool delayed, Vector2 movementOffset)
    Parameters
    Type Name Description
    Vector2 pinPos

    The global position of the pin.

    Color color

    The color of the partition set (will not be rendered; the fault highlight is always red).

    bool delayed

    Whether the pin and fault should appear delayed because the particle is performing a movement.

    Vector2 movementOffset

    The world coordinate vector pointing from the pin's end position after its movement to its start position.

    | Edit this page View Source

    CalculateAverageRelativePinPosForPartitionSet(PSetData, ParticleCircuitData, bool)

    Calculates the average relative pin position of pins connected to a partition set. If the particle is expanded and there are pins belonging to the partition set that are in the other part of the particle, one extra virtual pin is added in direction of the other pins.

    Declaration
    private Vector2 CalculateAverageRelativePinPosForPartitionSet(ParticlePinGraphicState.PSetData pSet, RendererCircuits_Instance.ParticleCircuitData circuitData, bool isHead)
    Parameters
    Type Name Description
    ParticlePinGraphicState.PSetData pSet

    The given partition set.

    RendererCircuits_Instance.ParticleCircuitData circuitData

    Contains the references to the data.

    bool isHead

    If we are looking at head pins.

    Returns
    Type Description
    Vector2

    The average position of the pins belonging to pSet, relative to the particle's head or tail.

    | Edit this page View Source

    CalculateCircleLineDegreesForPartitionSets(ParticleCircuitData, List<float>, bool, bool)

    Calculates the degrees on which the partition sets are placed on a circle.

    Declaration
    private void CalculateCircleLineDegreesForPartitionSets(RendererCircuits_Instance.ParticleCircuitData circuitData, List<float> outputList, bool isHead, bool useRelaxationAlgorithm = true)
    Parameters
    Type Name Description
    RendererCircuits_Instance.ParticleCircuitData circuitData

    Contains the references to the data.

    List<float> outputList

    A list that has already been initialized. It will be cleared in this method.

    bool isHead

    Whether we are looking at head partition sets.

    bool useRelaxationAlgorithm

    true to make sure there is sufficient space between partition sets.

    | Edit this page View Source

    CalculateCircleVectorCoordinatesForPartitionSets(ParticleCircuitData, List<Vector2>, bool, bool)

    Calculates the positions at which the partition sets are placed in a circle.

    Declaration
    private void CalculateCircleVectorCoordinatesForPartitionSets(RendererCircuits_Instance.ParticleCircuitData circuitData, List<Vector2> outputList, bool isHead, bool useRelaxationAlgorithm = true)
    Parameters
    Type Name Description
    RendererCircuits_Instance.ParticleCircuitData circuitData

    Contains the references to the data.

    List<Vector2> outputList

    A list that has already been initialized. It will be cleared in this method.

    bool isHead

    Whether we are looking at head partition sets.

    bool useRelaxationAlgorithm

    true to make sure there is sufficient space between partition sets.

    | Edit this page View Source

    CalculateGlobalExpandedPartitionSetCenterNodePosition(Vector2Int, int, int, float, bool)

    Calculates the global position of a circuit connector inside of an expanded particle by distributing the sets along a rotated and offset line.

    Declaration
    private Vector2 CalculateGlobalExpandedPartitionSetCenterNodePosition(Vector2Int gridPosParticle, int partitionSetID, int amountOfPartitionSetsAtNode, float rotationDegrees, bool invertPositions)
    Parameters
    Type Name Description
    Vector2Int gridPosParticle

    The grid coordinates of the particle containing the connector.

    int partitionSetID

    The index of the partition set in the considered part of the particle (head/tail).

    int amountOfPartitionSetsAtNode

    The number of partition set connectors that should be distributed in this part of the particle.

    float rotationDegrees

    The rotation of the line in degrees. 0 means the line is vertical, increasing degrees rotate the line counter-clockwise.

    bool invertPositions

    Whether the partition set indices should increase from bottom to top instead of top to bottom.

    Returns
    Type Description
    Vector2

    The absolute world coordinates of the circuit connector.

    | Edit this page View Source

    CalculateGlobalOuterPinLineCenterPosition(Vector2Int, PinDef, int)

    Calculates the global position of the center of a pin connection between two particles.

    Declaration
    private Vector2 CalculateGlobalOuterPinLineCenterPosition(Vector2Int gridPosParticle, ParticlePinGraphicState.PinDef pinDef, int pinsPerSide)
    Parameters
    Type Name Description
    Vector2Int gridPosParticle

    The grid coordinates of one of the particles.

    ParticlePinGraphicState.PinDef pinDef

    The pin belonging to the first particle.

    int pinsPerSide

    The number of pins each particle has on each edge.

    Returns
    Type Description
    Vector2

    The absolute world coordinates of the position exactly between the specified pin and its neighboring counterpart.

    | Edit this page View Source

    CalculateGlobalPartitionSetPinPosition(Vector2Int, int, int, float, bool)

    Calculates the global position of a partition set handle inside of a particle by distributing the sets along a rotated line.

    Declaration
    private Vector2 CalculateGlobalPartitionSetPinPosition(Vector2Int gridPosParticle, int partitionSetID, int amountOfPartitionSetsAtNode, float rotationDegrees, bool invertPositions)
    Parameters
    Type Name Description
    Vector2Int gridPosParticle

    The grid coordinates of the particle that contains the partition set.

    int partitionSetID

    The index of the partition set in the considered part of the particle (head/tail).

    int amountOfPartitionSetsAtNode

    The number of partition sets that should be distributed in this part of the particle.

    float rotationDegrees

    The rotation of the line in degrees. 0 means the line is vertical, increasing degrees rotate the line counter-clockwise.

    bool invertPositions

    Whether the partition set indices should increase from bottom to top instead of top to bottom.

    Returns
    Type Description
    Vector2

    The absolute world coordinates of the partition set hanlde.

    | Edit this page View Source

    CalculateGlobalPinPosition(Vector2Int, PinDef, int)

    Calculates the global position of a specific pin belonging to a particle.

    Declaration
    private Vector2 CalculateGlobalPinPosition(Vector2Int gridPosParticle, ParticlePinGraphicState.PinDef pinDef, int pinsPerSide)
    Parameters
    Type Name Description
    Vector2Int gridPosParticle

    The grid coordinates of the particle that contains the pin.

    ParticlePinGraphicState.PinDef pinDef

    The pin whose position should be calculated.

    int pinsPerSide

    The number of pins on each edge of the particle.

    Returns
    Type Description
    Vector2

    The absolute world coordinates of the pin.

    | Edit this page View Source

    CalculatePartitionSetPositions(ParticleCircuitData, PartitionSetViewType)

    Sets the positions of all partition set handles in the given particle according to the positioning settings and placement type.

    Declaration
    private void CalculatePartitionSetPositions(RendererCircuits_Instance.ParticleCircuitData circuitData, PartitionSetViewType pSetViewType_global)
    Parameters
    Type Name Description
    RendererCircuits_Instance.ParticleCircuitData circuitData

    The circuit data belonging to a single particle.

    PartitionSetViewType pSetViewType_global

    The current partition set view type set by the user.

    | Edit this page View Source

    CalculateRelativeExpandedPartitionSetCenterNodePosition(int, int, float, bool)

    Calculates the relative position of a circuit connector inside of an expanded particle by distributing the sets along a rotated and offset line.

    Declaration
    private Vector2 CalculateRelativeExpandedPartitionSetCenterNodePosition(int partitionSetID, int amountOfPartitionSetsAtNode, float rotationDegrees, bool invertPositions)
    Parameters
    Type Name Description
    int partitionSetID

    The index of the partition set in the considered part of the particle (head/tail).

    int amountOfPartitionSetsAtNode

    The number of partition set connectors that should be distributed in this part of the particle.

    float rotationDegrees

    The rotation of the line in degrees. 0 means the line is vertical, increasing degrees rotate the line counter-clockwise.

    bool invertPositions

    Whether the partition set indices should increase from bottom to top instead of top to bottom.

    Returns
    Type Description
    Vector2

    The world coordinates of the circuit connector relative to the particle center.

    | Edit this page View Source

    CalculateRelativePartitionSetPinPosition(int, int, float, bool)

    Calculates the relative position of a partition set handle inside of a particle by distributing the sets along a rotated line.

    Declaration
    private Vector2 CalculateRelativePartitionSetPinPosition(int partitionSetID, int amountOfPartitionSetsAtNode, float rotationDegrees, bool invertPositions)
    Parameters
    Type Name Description
    int partitionSetID

    The index of the partition set in the considered part of the particle (head/tail).

    int amountOfPartitionSetsAtNode

    The number of partition sets that should be distributed in this part of the particle.

    float rotationDegrees

    The rotation of the line in degrees. 0 means the line is vertical, increasing degrees rotate the line counter-clockwise.

    bool invertPositions

    Whether the partition set indices should increase from bottom to top instead of top to bottom.

    Returns
    Type Description
    Vector2

    The world coordinates of the partition set hanlde relative to the particle center.

    | Edit this page View Source

    Clear(bool, bool)

    Clears or nullifies the matrices to reset the data structures.

    Declaration
    public void Clear(bool keepCircuitData = false, bool keepBondData = false)
    Parameters
    Type Name Description
    bool keepCircuitData

    Whether circuit data should be kept in the system.

    bool keepBondData

    Whether bond data should be kept in the system.

    | Edit this page View Source

    GetArrayBatch(RendererCircuits_RenderBatch[], int, Color, Vector2, bool)

    Gets a render batch from the given array, at the given index and for the given parameters. If the array entry at index idx is null, a new render batch is created using the given parameters and added to the list of circuit line batches.

    Declaration
    private RendererCircuits_RenderBatch GetArrayBatch(RendererCircuits_RenderBatch[] arr, int idx, Color c, Vector2 offset, bool delayed = true)
    Parameters
    Type Name Description
    RendererCircuits_RenderBatch[] arr

    The array of size 6 from which to get the render batch.

    int idx

    The array index obtained from GetArrayIndex(bool, bool, bool).

    Color c

    The color of the desired render batch (must be the one used to obtain the list index of the array or the dictionary).

    Vector2 offset

    The animation offset of the desired render batch. Set to Vector2.zero if the batch is delayed anyway, otherwise it must be the offset that was given to GetNonDelayedArray(int, Vector2) to obtain the array arr.

    bool delayed

    Whether the given array belongs to the delayed list or the non-delayed list of dictionaries.

    Returns
    Type Description
    RendererCircuits_RenderBatch

    The desired render batch from the given array.

    | Edit this page View Source

    GetArrayIndex(bool, bool, bool)

    Calculates the array index of a render batch for circuit lines based on the line's type, beeping and activeState flags.

    Declaration
    private int GetArrayIndex(bool isInternal, bool beeping, bool active = true)
    Parameters
    Type Name Description
    bool isInternal

    Whether the circuit line is internal (as opposed to being an external line between particles).

    bool beeping

    Whether the line belongs to a circuit that is currently beeping.

    bool active

    If beeping is true, this differentiates between the animated flashing part of the line (true) and the static part with the white center that is shown while the simulation is paused (false).

    Returns
    Type Description
    int

    The index of the desired batch in its array of size 6.

    | Edit this page View Source

    GetBatchGroup(RendererCircuits_RenderBatch[], bool, bool, Color, Vector2, bool)

    Convenience method getting the non-beeping and the two beeping render batches from the given array. This is useful because for beeping circuits, each connection is made up of 3 lines that have to be added to different batches.

    Declaration
    private RendererCircuits_RenderBatch[] GetBatchGroup(RendererCircuits_RenderBatch[] arr, bool isInternal, bool beeping, Color c, Vector2 movementOffset, bool delayed)
    Parameters
    Type Name Description
    RendererCircuits_RenderBatch[] arr

    The array of size 6 from which to get the desired batches.

    bool isInternal

    Whether the internal or the external batches should be returned.

    bool beeping

    Whether or not the circuit to which the lines belong is currently beeping.

    Color c

    The color of the lines.

    Vector2 movementOffset

    The movement offset of the lines.

    bool delayed

    Whether the given array arr belongs to the delayed or the non-delayed batch list.

    Returns
    Type Description
    RendererCircuits_RenderBatch[]

    A render batch array containing the non-beeping batch at index 0 and the beeping active and beeping paused batches at positions 1 and 2 respectively. If beeping is false, the latter two entries are both null.

    | Edit this page View Source

    GetBatch_CircuitLine(Color, LineType, bool, bool, bool, Vector2, ActiveState)

    Returns the fitting batch for rendering circuit lines.

    WARNING: Use this only for special cases where only a few batches are required. Use the alternative indexing system for more frequent accesses to get better performance.

    Declaration
    private RendererCircuits_RenderBatch GetBatch_CircuitLine(Color color, RendererCircuits_RenderBatch.PropertyBlockData.LineType lineType, bool delayed, bool beeping, bool animated, Vector2 movementOffset, RendererCircuits_RenderBatch.PropertyBlockData.ActiveState activeState = ActiveState.SimActiveOrPaused)
    Parameters
    Type Name Description
    Color color

    The color of the line.

    RendererCircuits_RenderBatch.PropertyBlockData.LineType lineType

    The type of the line.

    bool delayed

    Whether the line should be shown delayed.

    bool beeping

    Whether the line should beep.

    bool animated

    Whether this batch is updated manually each frame.

    Vector2 movementOffset

    The offset for the joint movement. Set to Vector2.zero if no joint movement is present.

    RendererCircuits_RenderBatch.PropertyBlockData.ActiveState activeState

    The state of the simulator for which the line should be drawn.

    Returns
    Type Description
    RendererCircuits_RenderBatch

    A render batch that renders all lines with the given properties.

    | Edit this page View Source

    GetBatch_Pin(PropertyBlockData)

    Returns the fitting batch for rendering pins.

    Declaration
    private RendererCircuitPins_RenderBatch GetBatch_Pin(RendererCircuitPins_RenderBatch.PropertyBlockData propertyBlockData)
    Parameters
    Type Name Description
    RendererCircuitPins_RenderBatch.PropertyBlockData propertyBlockData
    Returns
    Type Description
    RendererCircuitPins_RenderBatch

    A render batch that renders all pins with the given properties.

    | Edit this page View Source

    GetBatch_Pin(Color, bool, bool, bool, bool, bool, bool, Vector2)

    Returns the fitting batch for rendering pins.

    Declaration
    private RendererCircuitPins_RenderBatch GetBatch_Pin(Color color, bool delayed, bool singleton, bool beeping, bool beepOrigin, bool faulty, bool connector, Vector2 movementOffset)
    Parameters
    Type Name Description
    Color color

    The color of the pin.

    bool delayed

    Whether the pin should be shown delayed.

    bool singleton

    Whether the pin is a singleton highlight.

    bool beeping

    Whether the pin should beep.

    bool beepOrigin

    Whether this is just a beep origin highlight.

    bool faulty

    Whether the pin is faulty. Must not be true at the same time as beeping.

    bool connector

    Whether this is a circuit line connector.

    Vector2 movementOffset

    The offset for the joint movement. Set to Vector2.zero if no joint movement is present.

    Returns
    Type Description
    RendererCircuitPins_RenderBatch

    A render batch that renders all pins with the given properties.

    | Edit this page View Source

    GetColorIndex(Color)

    Finds the render batch list index for the given color. If there is no entry for this color yet, a new entry is created.

    Use GetArrayBatch(RendererCircuits_RenderBatch[], int, Color, Vector2, bool) to get an actual render batch from an array obtained using this index..

    Declaration
    private int GetColorIndex(Color c)
    Parameters
    Type Name Description
    Color c

    The color whose batch list index should be found.

    Returns
    Type Description
    int

    The list index of the batch array or dictionary belonging to color c.

    | Edit this page View Source

    GetNonDelayedArray(int, Vector2)

    Finds the render batch array in the list of batches for non-delayed lines at the given index and for the given animation offset. If no entry for the given entry exists yet, a new array is added to the dictionary.

    Declaration
    private RendererCircuits_RenderBatch[] GetNonDelayedArray(int colorIdx, Vector2 offset)
    Parameters
    Type Name Description
    int colorIdx

    The list index obtained from GetColorIndex(Color).

    Vector2 offset

    The animation offset vector of the desired render batch.

    Returns
    Type Description
    RendererCircuits_RenderBatch[]

    The array of size 6 that stores the render batches for lines with the specified color and animation offset and which are not delayed.

    Use GetArrayBatch(RendererCircuits_RenderBatch[], int, Color, Vector2, bool) to get an actual render batch from the array.

    | Edit this page View Source

    GetParticleCircuitData(ParticleGraphicsAdapterImpl)

    Gets the circuit data belonging to the given particle.

    Declaration
    public RendererCircuits_Instance.ParticleCircuitData GetParticleCircuitData(ParticleGraphicsAdapterImpl p)
    Parameters
    Type Name Description
    ParticleGraphicsAdapterImpl p

    The particle whose circuit data to return.

    Returns
    Type Description
    RendererCircuits_Instance.ParticleCircuitData

    The circuit data belonging to p.

    | Edit this page View Source

    Refresh(PartitionSetViewType)

    Redraws the circuits with the given partition set view type.

    Declaration
    public void Refresh(PartitionSetViewType pSetViewType)
    Parameters
    Type Name Description
    PartitionSetViewType pSetViewType

    The view type the circuits are drawn in.

    | Edit this page View Source

    ReinitBatches()

    Reinitializes all batches. Helpful in case settings have been changed.

    Declaration
    public void ReinitBatches()
    | Edit this page View Source

    Render(ViewType)

    Renders everything stored in the render batches.

    Declaration
    public void Render(ViewType type)
    Parameters
    Type Name Description
    ViewType type

    The visualization mode that should be used to render the system. Determines what shape the particles have and whether circuits should be drawn.

    | Edit this page View Source

    StoreRenderBatchIndex(GDRef, RenderBatchIndex, bool, bool, bool)

    Stores the given batch index in the corresponding field of the graphical data struct.

    Declaration
    private void StoreRenderBatchIndex(RendererCircuits_Instance.GDRef gdRef, RenderBatchIndex index, bool isLine, bool isBeepOrigin, bool isBeepOrFault)
    Parameters
    Type Name Description
    RendererCircuits_Instance.GDRef gdRef

    The graphical data struct in which the batch index should be stored.

    RenderBatchIndex index

    The render batch index to be stored.

    bool isLine

    Whether the index belongs to a circuit line.

    bool isBeepOrigin

    Whether the index belongs to a beep origin highlight or to a beeping circuit line.

    bool isBeepOrFault

    Whether the index belongs to an object with a beep or fault highlight. Should never be true when isBeepOriginis also true.

    • Edit this page
    • View Source
    In this article
    Back to top AmoebotSim 2.0 Documentation v1.11
    Copyright © 2025 AmoebotSim 2.0 Authors
    Generated by DocFX