Browse Source

app id; ShaderBlock:read; nil BlendMode;

bjorn 6 years ago
parent
commit
17fca54fe4

+ 58 - 1
api/init.lua

@@ -4782,6 +4782,25 @@ return {
             }
           }
         },
+        {
+          name = "getApplicationId",
+          summary = "Get the application ID.",
+          description = "Returns the platform-specific application ID, or `nil` if this does not apply.\n\nCurrently only implemented on Android.",
+          key = "lovr.filesystem.getApplicationId",
+          module = "lovr.filesystem",
+          variants = {
+            {
+              arguments = {},
+              returns = {
+                {
+                  name = "id",
+                  type = "string",
+                  description = "The application ID."
+                }
+              }
+            }
+          }
+        },
         {
           name = "getDirectoryItems",
           summary = "Get a list of files in a directory..",
@@ -7353,7 +7372,7 @@ return {
           name = "getBlendMode",
           tag = "graphicsState",
           summary = "Get the blend mode.",
-          description = "Returns the current blend mode.  The blend mode controls how each pixel's color is blended with the previous pixel's color when drawn.",
+          description = "Returns the current blend mode.  The blend mode controls how each pixel's color is blended with the previous pixel's color when drawn.\n\nIf blending is disabled, `nil` will be returned.",
           key = "lovr.graphics.getBlendMode",
           module = "lovr.graphics",
           related = {
@@ -9494,6 +9513,11 @@ return {
                 }
               },
               returns = {}
+            },
+            {
+              description = "Disable blending.",
+              arguments = {},
+              returns = {}
             }
           }
         },
@@ -13294,6 +13318,39 @@ return {
                 }
               }
             },
+            {
+              name = "read",
+              summary = "Read a variable from the ShaderBlock.",
+              description = "Returns a variable in the ShaderBlock.",
+              key = "ShaderBlock:read",
+              module = "lovr.graphics",
+              related = {
+                "Shader:send",
+                "Shader:sendBlock",
+                "ShaderBlock:getShaderCode",
+                "ShaderBlock:getOffset",
+                "ShaderBlock:getSize"
+              },
+              variants = {
+                {
+                  arguments = {
+                    {
+                      name = "name",
+                      type = "string",
+                      description = "The name of the variable to read."
+                    }
+                  },
+                  returns = {
+                    {
+                      name = "value",
+                      type = "*",
+                      description = "The value of the variable."
+                    }
+                  }
+                }
+              },
+              notes = "This function is really slow!  Only read back values when you need to.\n\nVectors and matrices will be returned as (flat) tables."
+            },
             {
               name = "send",
               summary = "Update a variable in the ShaderBlock.",

+ 16 - 0
api/lovr/filesystem/getApplicationId.lua

@@ -0,0 +1,16 @@
+return {
+  summary = 'Get the application ID.',
+  description = [[
+    Returns the platform-specific application ID, or `nil` if this does not apply.
+
+    Currently only implemented on Android.
+  ]],
+  arguments = {},
+  returns = {
+    {
+      name = 'id',
+      type = 'string',
+      description = 'The application ID.'
+    }
+  }
+}

+ 30 - 0
api/lovr/graphics/ShaderBlock/read.lua

@@ -0,0 +1,30 @@
+return {
+  summary = 'Read a variable from the ShaderBlock.',
+  description = 'Returns a variable in the ShaderBlock.',
+  arguments = {
+    {
+      name = 'name',
+      type = 'string',
+      description = 'The name of the variable to read.'
+    }
+  },
+  returns = {
+    {
+      name = 'value',
+      type = '*',
+      description = 'The value of the variable.'
+    }
+  },
+  notes = [[
+    This function is really slow!  Only read back values when you need to.
+
+    Vectors and matrices will be returned as (flat) tables.
+  ]],
+  related = {
+    'Shader:send',
+    'Shader:sendBlock',
+    'ShaderBlock:getShaderCode',
+    'ShaderBlock:getOffset',
+    'ShaderBlock:getSize'
+  }
+}

+ 2 - 0
api/lovr/graphics/getBlendMode.lua

@@ -4,6 +4,8 @@ return {
   description = [[
     Returns the current blend mode.  The blend mode controls how each pixel's color is blended with
     the previous pixel's color when drawn.
+
+    If blending is disabled, `nil` will be returned.
   ]],
   arguments = {},
   returns = {

+ 13 - 4
api/lovr/graphics/setBlendMode.lua

@@ -6,18 +6,27 @@ return {
     previous pixel's color when drawn.
   ]],
   arguments = {
-    {
-      name = 'blend',
+    blend = {
       type = 'BlendMode',
       description = 'The blend mode.'
     },
-    {
-      name = 'alphaBlend',
+    alphaBlend = {
       type = 'BlendAlphaMode',
       description = 'The alpha blend mode.'
     }
   },
   returns = {},
+  variants = {
+    {
+      arguments = { 'blend', 'alphaBlend' },
+      returns = {}
+    },
+    {
+      description = 'Disable blending.',
+      arguments = {},
+      returns = {}
+    }
+  },
   related = {
     'BlendMode',
     'BlendAlphaMode'