Skip to content

Commit 2498748

Browse files
authored
Merge pull request #1687 from ctrlaltdavid/doc/improve-material-entity-doc
Improve Material entity documentation.
2 parents f723157 + 5ede042 commit 2498748

File tree

2 files changed

+58
-62
lines changed

2 files changed

+58
-62
lines changed

libraries/entities/src/EntityItemProperties.cpp

+12-11
Original file line numberDiff line numberDiff line change
@@ -950,38 +950,39 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
950950
* Material entities render as non-scalable spheres if they don't have their parent set.</p>
951951
*
952952
* @typedef {object} Entities.EntityProperties-Material
953-
* @property {Vec3} dimensions=0.1,0.1,0.1 - Used when <code>materialMappingMode == "projected"</code>.
954-
* @property {string} materialURL="" - URL to a {@link Entities.MaterialResource|MaterialResource}. Alternatively, set the
953+
* @property {Vec3} [dimensions=0.1,0.1,0.1] - Used when <code>materialMappingMode == "projected"</code>.
954+
* @property {string} [materialURL=""] - URL to a {@link Entities.MaterialResource|MaterialResource}. Alternatively, set the
955955
* property value to <code>"materialData"</code> to use the <code>materialData</code> property for the
956956
* {@link Entities.MaterialResource|MaterialResource} values. If you append <code>"#name"</code> to the URL, the material
957957
* with that name will be applied to the entity. You can also use the ID of another Material entity as the URL, in which
958958
* case this material will act as a copy of that material, with its own unique material transform, priority, etc.
959-
* @property {string} materialData="" - Used to store {@link Entities.MaterialResource|MaterialResource} data as a JSON string.
959+
* @property {string} [materialData=""] - Used to store {@link Entities.MaterialResource|MaterialResource} data as a JSON string.
960960
* You can use <code>JSON.parse()</code> to parse the string into a JavaScript object which you can manipulate the
961961
* properties of, and use <code>JSON.stringify()</code> to convert the object into a string to put in the property.
962-
* @property {number} priority=0 - The priority for applying the material to its parent. Only the highest priority material is
962+
* @property {number} [priority=0] - The priority for applying the material to its parent. Only the highest priority material is
963963
* applied, with materials of the same priority randomly assigned. Materials that come with the model have a priority of
964964
* <code>0</code>.
965-
* @property {string} parentMaterialName="0" - Selects the mesh part or parts within the parent to which to apply the material.
965+
* @property {string} [parentMaterialName="0"] - Selects the mesh part or parts within the parent to which to apply the material.
966966
* If in the format <code>"mat::string"</code>, all mesh parts with material name <code>"string"</code> are replaced.
967967
* If <code>"all"</code>, then all mesh parts are replaced.
968968
* Otherwise the property value is parsed as an unsigned integer, specifying the mesh part index to modify.
969969
* <p>If the string represents an array (starts with <code>"["</code> and ends with <code>"]"</code>), the string is split
970970
* at each <code>","</code> and each element parsed as either a number or a string if it starts with <code>"mat::"</code>.
971971
* For example, <code>"[0,1,mat::string,mat::string2]"</code> will replace mesh parts 0 and 1, and any mesh parts with
972972
* material <code>"string"</code> or <code>"string2"</code>. Do not put spaces around the commas. Invalid values are parsed
973-
* to <code>0</code>.</p>
974-
* @property {string} materialMappingMode="uv" - How the material is mapped to the entity. Either <code>"uv"</code> or
973+
* to <code>"0"</code>.</p>
974+
* @property {string} [materialMappingMode="uv"] - How the material is mapped to the entity. Either <code>"uv"</code> or
975975
* <code>"projected"</code>. In <code>"uv"</code> mode, the material is evaluated within the UV space of the mesh it is
976976
* applied to. In <code>"projected"</code> mode, the 3D transform (position, rotation, and dimensions) of the Material
977977
* entity is used to evaluate the texture coordinates for the material.
978-
* @property {Vec2} materialMappingPos=0,0 - Offset position in UV-space of the top left of the material, range
978+
* @property {Vec2} [materialMappingPos=0.0,0.0] - Offset position in UV-space of the top left of the material, range
979979
* <code>{ x: 0, y: 0 }</code> &ndash; <code>{ x: 1, y: 1 }</code>.
980-
* @property {Vec2} materialMappingScale=1,1 - How much to scale the material within the parent's UV-space.
981-
* @property {number} materialMappingRot=0 - How much to rotate the material within the parent's UV-space, in degrees.
982-
* @property {boolean} materialRepeat=true - <code>true</code> if the material repeats, <code>false</code> if it doesn't. If
980+
* @property {Vec2} [materialMappingScale=1.0,1.0] - How much to scale the material within the parent's UV-space.
981+
* @property {number} [materialMappingRot=0] - How much to rotate the material within the parent's UV-space, in degrees.
982+
* @property {boolean} [materialRepeat=true] - <code>true</code> if the material repeats, <code>false</code> if it doesn't. If
983983
* <code>false</code>, fragments outside of texCoord 0 &ndash; 1 will be discarded. Works in both <code>"uv"</code> and
984984
* <code>"projected"</code> modes.
985+
*
985986
* @example <caption>Color a sphere using a Material entity.</caption>
986987
* var entityID = Entities.addEntity({
987988
* type: "Sphere",

0 commit comments

Comments
 (0)