NodeGeometry

public protocol NodeGeometry: class

The NodeGeometry protocol is used to give an object enough information to be placed in a scene and possibly rendered.

Note

Any rendered Node must have the camera property be non-nil. I’m still trying to figure out a nicer way to enforce this.

  • discussion: Conforming to this protocol will grant access to most of the underlying maths required to render an object properly. Additionally, conforming to Tree will grant access to adding custom nodes to a Scene graph. Renderable has all the required information to do both of the above, as well as draw a node using a custom Pipeline.

  • Seealso

    Renderable and Tree.

    • Any object that wishes to be placed in a Scene requires a Camera.

      Declaration

      Swift

      var camera: Camera? { get set }
    • The size in world coordinates. This should NOT take the scale property into considering. By default, modifying this property modifies the actual vectors being used by the GPU.

      Seealso

      Renderable where the default implementation of func updateSize() is located.

      Declaration

      Swift

      var size: CGSize { get set }
    • width Default implementation

      The width in world coordinates. This uses the scale property by default.

      Default Implementation

      Undocumented

      Declaration

      Swift

      var width: Float { get }
    • height Default implementation

      The height in world coordinates. This uses the scale property by default.

      Default Implementation

      Undocumented

      Declaration

      Swift

      var height: Float { get }
    • The relative position to which various calculations will be done. This is in unit coordinates in the coordinate system of the model.

      Declaration

      Swift

      var anchorPoint: (x: Float, y: Float) { get set }
    • x

      The x position. This is relative to the parent or if the scene is a parent, then world coordinates.

      Declaration

      Swift

      var x: Float { get set }
    • y

      The y position. This is relative to the parent or if the scene is a parent, then world coordinates.

      Declaration

      Swift

      var y: Float { get set }
    • position Default implementation

      A convenience var for getting the position variables.

      Default Implementation

      Undocumented

      Declaration

      Swift

      var position: (x: Float, y: Float) { get set }
    • This controls the rendering depth.

      Declaration

      Swift

      var zPosition: Int { get set }
    • How much to rotate by.

      Declaration

      Swift

      var rotation: Float { get set }
    • scale Default implementation

      How much to scale by. In general, this does not affect the size property but will modify the width and height.

      Default Implementation

      Undocumented

      Declaration

      Swift

      var scale: (x: Float, y: Float) { get set }
    • How much to scale in the x direction.

      Declaration

      Swift

      var xScale: Float { get set }
    • How much to scale in the y direction.

      Declaration

      Swift

      var yScale: Float { get set }
    • modelMatrix Default implementation

      This is actual 4x4 matrix being sent to the GPU in order to properly render a node. The default implementation should be sufficient for creating a custom rendering pipeline.

      Seealso

      Renderable and Uniforms.

      Default Implementation

      Undocumented

      Declaration

      Swift

      var modelMatrix: Mat4 { get }
    • updateSize() Default implementation

      This function updates the actual geometry size of the vertices. It’s not used as scaling is in the model matrix. The actual model matrix will apply it’s changes to the update vertices. It’s default implementation is in Renderable.

      Seealso

      Renderable

      Default Implementation

      Undocumented

      Declaration

      Swift

      func updateSize()
    • z Extension method

      Undocumented

      Declaration

      Swift

      public protocol NodeGeometry: class