@@ -12,25 +12,58 @@ pc.extend(pc, function () {
1212
1313 /**
1414 * @name pc.VertexFormat
15- * @class A vertex format is a descriptor that defines the layout of vertex element data inside
16- * a pc.VertexBuffer object.
17- * @description Returns a new pc.VertexFormat object. It is constructed from a description
18- * that explicitly defines how data is to be laid out inside a vertex buffer (pc.VertexBuffer).
19- * The description is defined as an array of elements, where each element is an object with the
20- * following properties:
21- * semantic: pc.SEMANTIC_.
22- * components: the number of components used by the element.
23- * type: (pc.ELEMENTTYPE_).
24- * normalize: true to remap element values to a range of 0 to 1. Defaults to false.
15+ * @class A vertex format is a descriptor that defines the layout of vertex data inside
16+ * a {@link pc.VertexBuffer}.
17+ * @description Returns a new pc.VertexFormat object.
2518 * @param {pc.GraphicsDevice } graphicsDevice The graphics device used to manage this vertex format.
26- * @param {Object[] } description An array of vertex element descriptions.
19+ * @param {Object[] } description An array of vertex attribute descriptions.
20+ * @param {Number } description[].semantic The meaning of the vertex element. This is used to link
21+ * the vertex data to a shader input. Can be:
22+ * <ul>
23+ * <li>pc.SEMANTIC_POSITION</li>
24+ * <li>pc.SEMANTIC_NORMAL</li>
25+ * <li>pc.SEMANTIC_TANGENT</li>
26+ * <li>pc.SEMANTIC_BLENDWEIGHT</li>
27+ * <li>pc.SEMANTIC_BLENDINDICES</li>
28+ * <li>pc.SEMANTIC_COLOR</li>
29+ * <li>pc.SEMANTIC_TEXCOORD0</li>
30+ * <li>pc.SEMANTIC_TEXCOORD1</li>
31+ * <li>pc.SEMANTIC_TEXCOORD2</li>
32+ * <li>pc.SEMANTIC_TEXCOORD3</li>
33+ * <li>pc.SEMANTIC_TEXCOORD4</li>
34+ * <li>pc.SEMANTIC_TEXCOORD5</li>
35+ * <li>pc.SEMANTIC_TEXCOORD6</li>
36+ * <li>pc.SEMANTIC_TEXCOORD7</li>
37+ * </ul>
38+ * If vertex data has a meaning other that one of those listed above, use the user-defined
39+ * semantics: pc.SEMANTIC_ATTR0 to pc.SEMANTIC_ATTR15.
40+ * @param {Number } description[].components The number of components of the vertex attribute.
41+ * Can be 1, 2, 3 or 4.
42+ * @param {Number } description[].type The data type of the attribute. Can be:
43+ * <ul>
44+ * <li>pc.ELEMENTTYPE_INT8</li>
45+ * <li>pc.ELEMENTTYPE_UINT8</li>
46+ * <li>pc.ELEMENTTYPE_INT16</li>
47+ * <li>pc.ELEMENTTYPE_UINT16</li>
48+ * <li>pc.ELEMENTTYPE_INT32</li>
49+ * <li>pc.ELEMENTTYPE_UINT32</li>
50+ * <li>pc.ELEMENTTYPE_FLOAT32</li>
51+ * </ul>
52+ * @param {Boolean } description[].normalize If true, vertex attribute data will be mapped from a
53+ * 0 to 255 range down to 0 to 1 when fed to a shader. If false, vertex attribute data is left
54+ * unchanged. If this property is unspecified, false is assumed.
2755 * @example
56+ * // Specify 3-component positions (x, y, z)
57+ * var vertexFormat = new pc.VertexFormat(graphicsDevice, [
58+ * { semantic: pc.SEMANTIC_POSITION, components: 3, type: pc.ELEMENTTYPE_FLOAT32 },
59+ * ]);
60+ * @example
61+ * // Specify 2-component positions (x, y), a texture coordinate (u, v) and a vertex color (r, g, b, a)
2862 * var vertexFormat = new pc.VertexFormat(graphicsDevice, [
2963 * { semantic: pc.SEMANTIC_POSITION, components: 2, type: pc.ELEMENTTYPE_FLOAT32 },
3064 * { semantic: pc.SEMANTIC_TEXCOORD0, components: 2, type: pc.ELEMENTTYPE_FLOAT32 },
3165 * { semantic: pc.SEMANTIC_COLOR, components: 4, type: pc.ELEMENTTYPE_UINT8, normalize: true }
3266 * ]);
33- *
3467 * @author Will Eastcott
3568 */
3669 var VertexFormat = function ( graphicsDevice , description ) {
0 commit comments