A Shape is a geometrical mesh consisting of vertices that are rendered using a single Shader. It specifies several types of properties:
- Coordinate positioning, mapping this shape's vertex coordinates to those of its parent. 'view' describes the technique to use and establishes the properties required to calculate the transformation, such as 'location' position, 'lookat' or 'rotation' orientation, and 'scale' factor.
- Rendering instructions. Most are set by the .render? method, especially the shader to use and the values for the uniform values it requires. 'draw' indicates what sort of geometry to draw.
- Vertices data. These names of these properties are determined by the shader. Common vertex properties are: 'positions', 'normals' and 'uvs'. A shape can make use of vertex data from another shape using the 'shape' property.
- Boundary shape that encloses all vertices, used for culling and collision detection.
+Shape render?:  shader: @'selflit.acn' draw: 'Polygon' positions: +Xyzs" 0.0, 1.0, -1.0, 1.0, 0.0, -1.0, 0.0, -1.0, -1.0, -1.0, 0.0, -3.0" colors: +Colors" 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0"
To reuse a shape, subtype it.
- Create a new Shape
Instance Properties (see Region)
A shape must specify all vertex attribute properties required by the rendering shader and may also specify its required uniform properties. See Shader for more details.
- TBD - the bounding box, sphere or cylinder for clipping and other purposes
- A Colors collection holding the r,g,b,a values of the shape's vertices.
- A symbol specifying the graphical primitive to use when rendering the vertices.
If not specified, the default is 'Triangles'.
- Individual points
- Line segments from vertex pairs
- Series of connected line segments
- Series of connected line segments, plus one connecting last vertex to first
- Triangles from vertex triples
- Connected triangles: 0,1,2 2,1,3 2,3,4 ...
- Connected triangles: 0,1,2 0,2,3 0,3,4 ...
- Adjacent line segments for a Geometry Shader
- Adjacent line strips for a Geometry Shader
- Adjacent triangles for a Geometry Shader
- Adjacent triangle strips for a Geometry Shader
- Vertices used in a Tessalation Shader
- Integers that hold index values indicating the order to draw the vertices using the 'draw' primitive. Each index value maps to a vertex whose attributes are stored at that position in the vertex properties. This is economical when the shape's vertices are used by multiple faces. If not specified, the vertices are drawn in the order specified in the vertex properties.
- An Xyzs collection holding the x,y,z normals for the shape's vertices.
- A Quat specifying the rotation used to orient the shape in its parent's coordinate system. If not specified, no rotation takes place.
- The location of this shape's 0,0,0 position in the shape's parent's coordinate system. This can be used to specify where to render this shape within its parent group's space. If not specified, +Xyz(0,0,0) is assumed.
- An Xyzs collection holding the x,y,z positions of the shape's vertices.
- The method that is performed before rendering the shape. The method should return 'false' if the shape is not to be rendered. This method will have the render context as 'self', enabling the shape to make use of shared uniforms (minimize use of '+' new here).
- An Xyz vector specifying how much to re-size the shape's vertices when rendering in the parent group, The default is no scaling: +Xyz(1.,1.,1.)
- The shader used when rendering this shape.
- If true, the shape uses translucent colors (their alpha is less than 1). Specifying this is necessary to proper rendering.
- A Uvs collection holding the u,v texture coordinates for the shape's vertices.