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
.
-
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.Declaration
Swift
var size: CGSize { get set }
-
width
Default implementationThe width in world coordinates. This uses the
scale
property by default.Default Implementation
Undocumented
Declaration
Swift
var width: Float { get }
-
height
Default implementationThe 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 }
-
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 }
-
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 implementationA 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 implementationHow 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 implementationThis 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.
Default Implementation
Undocumented
Declaration
Swift
var modelMatrix: Mat4 { get }
-
updateSize()
Default implementationThis 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 methodUndocumented
Declaration
Swift
public protocol NodeGeometry: class