Browse Source

More Texture stuff;

bjorn 3 years ago
parent
commit
4fffa06b7d

+ 62 - 0
api/init.lua

@@ -7168,6 +7168,25 @@ return {
                 }
               }
             },
+            {
+              name = "getFormat",
+              summary = "Get the format of the Texture.",
+              description = "Returns the format of the texture.  The default is `rgba8`.",
+              key = "Texture:getFormat",
+              module = "lovr.graphics",
+              variants = {
+                {
+                  arguments = {},
+                  returns = {
+                    {
+                      name = "format",
+                      type = "TextureFormat",
+                      description = "The format of the Texture."
+                    }
+                  }
+                }
+              }
+            },
             {
               name = "getHeight",
               summary = "Get the height of the Texture, in pixels.",
@@ -7262,6 +7281,25 @@ return {
                 "lovr.graphics.newTexture"
               }
             },
+            {
+              name = "getType",
+              summary = "Get the type of the Texture.",
+              description = "Returns the type of the texture.",
+              key = "Texture:getType",
+              module = "lovr.graphics",
+              variants = {
+                {
+                  arguments = {},
+                  returns = {
+                    {
+                      name = "type",
+                      type = "TextureType",
+                      description = "The type of the Texture."
+                    }
+                  }
+                }
+              }
+            },
             {
               name = "getWidth",
               summary = "Get the width of the Texture, in pixels.",
@@ -8541,6 +8579,30 @@ return {
             }
           }
         },
+        {
+          name = "TextureType",
+          description = "Different types of textures.  Textures are multidimensional blocks of GPU memory, and the texture's type determines how many dimensions there are, and adds some semantics about what the 3rd dimension means.",
+          key = "TextureType",
+          module = "lovr.graphics",
+          values = {
+            {
+              name = "2d",
+              description = "A single 2D image, the most common type."
+            },
+            {
+              name = "3d",
+              description = "A 3D image, where a sequence of 2D images defines a 3D volume.  Each mipmap level of a 3D texture gets smaller in the x, y, and z axes, unlike cubemap and array textures."
+            },
+            {
+              name = "cube",
+              description = "Six 2D images that define the faces of a cubemap, used for skyboxes or other \"directional\" images."
+            },
+            {
+              name = "array",
+              description = "Array textures are sequences of distinct 2D images."
+            }
+          }
+        },
         {
           name = "TextureUsage",
           description = "These are the different things `Texture`s can be used for.  When creating a Texture, a set of these flags can be provided, restricting what operations are allowed on the texture.  Using a smaller set of flags may improve performance.  If none are provided, the only usage flag applied is `sample`.",

+ 12 - 0
api/lovr/graphics/Texture/getFormat.lua

@@ -0,0 +1,12 @@
+return {
+  summary = 'Get the format of the Texture.',
+  description = 'Returns the format of the texture.  The default is `rgba8`.',
+  arguments = {},
+  returns = {
+    {
+      name = 'format',
+      type = 'TextureFormat',
+      description = 'The format of the Texture.'
+    }
+  }
+}

+ 12 - 0
api/lovr/graphics/Texture/getType.lua

@@ -0,0 +1,12 @@
+return {
+  summary = 'Get the type of the Texture.',
+  description = 'Returns the type of the texture.',
+  arguments = {},
+  returns = {
+    {
+      name = 'type',
+      type = 'TextureType',
+      description = 'The type of the Texture.'
+    }
+  }
+}

+ 31 - 0
api/lovr/graphics/TextureType.lua

@@ -0,0 +1,31 @@
+return {
+  description = [[
+    Different types of textures.  Textures are multidimensional blocks of GPU memory, and the
+    texture's type determines how many dimensions there are, and adds some semantics about what the
+    3rd dimension means.
+  ]],
+  values = {
+    {
+      name = '2d',
+      description = 'A single 2D image, the most common type.'
+    },
+    {
+      name = '3d',
+      description = [[
+        A 3D image, where a sequence of 2D images defines a 3D volume.  Each mipmap level of a 3D
+        texture gets smaller in the x, y, and z axes, unlike cubemap and array textures.
+      ]]
+    },
+    {
+      name = 'cube',
+      description = [[
+        Six 2D images that define the faces of a cubemap, used for skyboxes or other "directional"
+        images.
+      ]]
+    },
+    {
+      name = 'array',
+      description = 'Array textures are sequences of distinct 2D images.'
+    }
+  }
+}