Showing the changes to libraries/script-engine/src/ModelScriptingInterface.h (1 of 2 files). Show all
Unified · Split
| @@ -17,19 +17,79 @@ · 16 unmodified lines | ||
| 17 | 17 | #include <RegisteredMetaTypes.h> |
| 18 | 18 | class QScriptEngine; |
| 19 | 19 | |
| 20 | +/**jsdoc | |
| 21 | + * The <code>Model</code> API provides the ability to manipulate meshes. You can get the meshes for an entity using | |
| 22 | + * {@link Entities.getMeshes}, or create a new mesh using {@link Model.newMesh}. | |
| 23 | + * <p>See also, the {@link Graphics} API.</p> | |
| 24 | + * | |
| 25 | + * @namespace Model | |
| 26 | + * | |
| 27 | + * @hifi-interface | |
| 28 | + * @hifi-client-entity | |
| 29 | + * @hifi-avatar | |
| 30 | + * @hifi-server-entity | |
| 31 | + * @hifi-assignment-client | |
| 32 | + * | |
| 33 | + * @deprecated This API is deprecated. Use the {@link Graphics} API instead. | |
| 34 | + */ | |
| 20 | 35 | class ModelScriptingInterface : public QObject { |
| 21 | 36 | Q_OBJECT |
| 22 | 37 | |
| 23 | 38 | public: |
| 24 | 39 | ModelScriptingInterface(QObject* parent); |
| 25 | 40 | |
| 41 | + /**jsdoc | |
| 42 | + * Exports meshes to an OBJ format model. | |
| 43 | + * @function Model.meshToOBJ | |
| 44 | + * @param {MeshProxy[]} meshes - The meshes to export. | |
| 45 | + * @returns {string} The OBJ format representation of the meshes. | |
| 46 | + */ | |
| 26 | 47 | Q_INVOKABLE QString meshToOBJ(MeshProxyList in); |
| 48 | + | |
| 49 | + /**jsdoc | |
| 50 | + * Combines multiple meshes into one. | |
| 51 | + * @function Model.appendMeshes | |
| 52 | + * @param {MeshProxy[]} meshes - The meshes to combine. | |
| 53 | + * @returns {MeshProxy} The combined mesh. | |
| 54 | + */ | |
| 27 | 55 | Q_INVOKABLE QScriptValue appendMeshes(MeshProxyList in); |
| 56 | + | |
| 57 | + /**jsdoc | |
| 58 | + * Transforms the vertices in a mesh. | |
| 59 | + * @function Model.transformMesh | |
| 60 | + * @param {Mat4} transform - The transform to apply. | |
| 61 | + * @param {MeshProxy} mesh - The mesh to apply the transform to. | |
| 62 | + * @returns {MeshProxy|boolean} The transformed mesh, if valid. <code>false</code> if an error. | |
| 63 | + */ | |
| 28 | 64 | Q_INVOKABLE QScriptValue transformMesh(glm::mat4 transform, MeshProxy* meshProxy); |
| 65 | + | |
| 66 | + /**jsdoc | |
| 67 | + * Creates a new mesh. | |
| 68 | + * @function Model.newMesh | |
| 69 | + * @param {Vec3[]} vertices - The vertices in the mesh. | |
| 70 | + * @param {Vec3[]} normals - The normals in the mesh. | |
| 71 | + * @param {MeshFace[]} faces - The faces in the mesh. | |
| 72 | + * @returns {MeshProxy} A new mesh. | |
| 73 | + */ | |
| 29 | 74 | Q_INVOKABLE QScriptValue newMesh(const QVector<glm::vec3>& vertices, |
| 30 | 75 | const QVector<glm::vec3>& normals, |
| 31 | 76 | const QVector<MeshFace>& faces); |
| 77 | + | |
| 78 | + /**jsdoc | |
| 79 | + * Gets the number of vertices in a mesh. | |
| 80 | + * @function Model.getVertexCount | |
| 81 | + * @param {MeshProxy} mesh - The mesh to count the vertices in. | |
| 82 | + * @returns {number|boolean} The number of vertices in the mesh, if valid. <code>false</code> if an error. | |
| 83 | + */ | |
| 32 | 84 | Q_INVOKABLE QScriptValue getVertexCount(MeshProxy* meshProxy); |
| 85 | + | |
| 86 | + /**jsdoc | |
| 87 | + * Gets the position of a vertex in a mesh. | |
| 88 | + * @function Model.getVertex | |
| 89 | + * @param {MeshProxy} mesh - The mesh. | |
| 90 | + * @param {number} index - The index of the vertex to get. | |
| 91 | + * @returns {Vec3|boolean} The local position of the vertex relative to the mesh, if valid. <code>false</code> if an error. | |
| 92 | + */ | |
| 33 | 93 | Q_INVOKABLE QScriptValue getVertex(MeshProxy* meshProxy, int vertexIndex); |
| 34 | 94 | |
| 35 | 95 | private: |