Kaynağa Gözat

Mesh:get/setMaterial;

bjorn 1 yıl önce
ebeveyn
işleme
396b2f5f18

+ 48 - 0
api/init.lua

@@ -13186,6 +13186,30 @@ return {
                 }
               }
             },
+            {
+              name = "getMaterial",
+              summary = "Get the Material applied to the Mesh.",
+              description = "Returns the `Material` applied to the Mesh.",
+              key = "Mesh:getMaterial",
+              module = "lovr.graphics",
+              related = {
+                "Pass:setMaterial",
+                "Model:getMaterial",
+                "lovr.graphics.newMaterial"
+              },
+              variants = {
+                {
+                  arguments = {},
+                  returns = {
+                    {
+                      name = "material",
+                      type = "Material",
+                      description = "The material."
+                    }
+                  }
+                }
+              }
+            },
             {
               name = "getVertexBuffer",
               summary = "Get the Buffer backing the vertices of the Mesh.",
@@ -13392,6 +13416,30 @@ return {
                 }
               }
             },
+            {
+              name = "setMaterial",
+              summary = "Set a Material to use when drawing the Mesh.",
+              description = "Sets a `Material` to use when drawing the Mesh.",
+              key = "Mesh:setMaterial",
+              module = "lovr.graphics",
+              related = {
+                "Pass:setMaterial",
+                "Model:getMaterial",
+                "lovr.graphics.newMaterial"
+              },
+              variants = {
+                {
+                  arguments = {
+                    {
+                      name = "material",
+                      type = "Material",
+                      description = "The material to use."
+                    }
+                  },
+                  returns = {}
+                }
+              }
+            },
             {
               name = "setVertices",
               summary = "Set vertices in the Mesh.",

+ 22 - 0
api/lovr/graphics/Mesh/getMaterial.lua

@@ -0,0 +1,22 @@
+return {
+  summary = 'Get the Material applied to the Mesh.',
+  description = 'Returns the `Material` applied to the Mesh.',
+  arguments = {},
+  returns = {
+    material = {
+      type = 'Material',
+      description = 'The material.'
+    }
+  },
+  variants = {
+    {
+      arguments = {},
+      returns = { 'material' }
+    }
+  },
+  related = {
+    'Pass:setMaterial',
+    'Model:getMaterial',
+    'lovr.graphics.newMaterial'
+  }
+}

+ 22 - 0
api/lovr/graphics/Mesh/setMaterial.lua

@@ -0,0 +1,22 @@
+return {
+  summary = 'Set a Material to use when drawing the Mesh.',
+  description = 'Sets a `Material` to use when drawing the Mesh.',
+  arguments = {
+    material = {
+      type = 'Material',
+      description = 'The material to use.'
+    }
+  },
+  returns = {},
+  variants = {
+    {
+      arguments = { 'material' },
+      returns = {}
+    }
+  },
+  related = {
+    'Pass:setMaterial',
+    'Model:getMaterial',
+    'lovr.graphics.newMaterial'
+  }
+}