Skip to content

Commit

Permalink
Documentation: StaticMesh, Texture, AssetManager
Browse files Browse the repository at this point in the history
  • Loading branch information
mholtkamp committed Dec 13, 2024
1 parent 5549a39 commit bb6ba16
Show file tree
Hide file tree
Showing 6 changed files with 324 additions and 7 deletions.
53 changes: 53 additions & 0 deletions Documentation/Lua/Assets/StaticMesh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# StaticMesh

An asset that contains a triangle mesh.

---
### GetMaterial
Get the default material.

Sig: `material = StaticMesh:GetMaterial()`
- Ret: `Material material` Default material
---
### SetMaterial
Set the default material.

Sig: `StaticMesh:SetMaterial(material)`
- Arg: `Material material` Default material
---
### GetNumIndices
Get the number of indices.

Sig: `num = StaticMesh:GetNumIndices()`
- Ret: `integer num` Number of indices
---
### GetNumFaces
Get the number of faces.

Sig: `num = StaticMesh:GetNumFaces()`
- Ret: `integer num` Number of faces
---
### GetNumVertices
Get the number of vertices.

Sig: `num = StaticMesh:GetNumVertices()`
- Ret: `integer num` Number of vertices
---
### HasVertexColor
Check if the mesh has vertex color data.

Sig: `hasColor = StaticMesh:HasVertexColor()`
- Ret: `boolean hasColor` Has vertex color
---
### HasTriangleMeshCollision
Check if the mesh has triangle collision data.

Sig: `triCollision = StaticMesh:HasTriangleMeshCollision()`
- Ret: `boolean triCollision` Has triangle collision data
---
### EnableTriangleMeshCollision
Set whether this mesh should have triangle collision data generated.

Sig: `StaticMesh:EnableTriangleMeshCollision(enable)`
- Arg: `boolean enable` Enable triangle collision
---
29 changes: 29 additions & 0 deletions Documentation/Lua/Assets/Texture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Texture

An asset containing image data.

---
### IsMipmapped
Check if the texture is mipmapped.

Sig: `mipmapped = Texture:IsMipmapped()`
- Ret: `boolean mipmapped` Is mipmapped
---
### GetWidth
Get the texture width.

Sig: `width = Texture:GetWidth()`
- Ret: `integer width` Texture width
---
### GetHeight
Get the texture height.

Sig: `height = Texture:GetHeight()`
- Ret: `integer height` Texture height
---
### GetMipLevels
Get the number of mip levels.

Sig: `levels = Texture:GetMipLevels()`
- Ret: `integer levels` Number of mip levels
---
144 changes: 144 additions & 0 deletions Documentation/Lua/Misc/Enums.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,147 @@ Tables that act as enumerations.
- `None` Do not cull triangle no matter which way it is facing
- `Back` Cull triangles that are facing away from the camera
- `Front` Cull triangles that are facing the camera

## Mouse
- `Left`
- `Right`
- `Middle`
- `X1`
- `X2`
- `1`
- `2`
- `3`
- `4`
- `5`

## Gamepad
- `A`
- `B`
- `C`
- `X`
- `Y`
- `Z`
- `L1`
- `R1`
- `L2`
- `R2`
- `L3`
- `R3`
- `Start`
- `Select`
- `Left`
- `Right`
- `Up`
- `Down`
- `Home`
- `AxisL`
- `AxisR`
- `AxisLX`
- `AxisLY`
- `AxisRX`
- `AxisRY`

## Key
- `Back`
- `Escape`
- `N0`
- `N1`
- `N2`
- `N3`
- `N4`
- `N5`
- `N6`
- `N7`
- `N8`
- `N9`
- `Zero`
- `One`
- `Two`
- `Three`
- `Four`
- `Five`
- `Six`
- `Seven`
- `Eight`
- `Nine`
- `A`
- `B`
- `C`
- `D`
- `E`
- `F`
- `G`
- `H`
- `I`
- `J`
- `K`
- `L`
- `M`
- `N`
- `O`
- `P`
- `Q`
- `R`
- `S`
- `T`
- `U`
- `V`
- `W`
- `X`
- `Y`
- `Z`
- `Space`
- `Enter`
- `Backspace`
- `Tab`
- `ShiftL`
- `ControlL`
- `AltL`
- `ShiftR`
- `ControlR`
- `AltR`
- `Insert`
- `Delete`
- `Home`
- `End`
- `PageUp`
- `PageDown`
- `Up`
- `Down`
- `Left`
- `Right`
- `Numpad0`
- `Numpad1`
- `Numpad2`
- `Numpad3`
- `Numpad4`
- `Numpad5`
- `Numpad6`
- `Numpad7`
- `Numpad8`
- `Numpad9`
- `F1`
- `F2`
- `F3`
- `F4`
- `F5`
- `F6`
- `F7`
- `F8`
- `F9`
- `F10`
- `F11`
- `F12`
- `Period`
- `Comma`
- `Plus`
- `Minus`
- `Colon`
- `Question`
- `Squiggle`
- `LeftBracket`
- `BackSlash`
- `RightBracket`
- `Quote`
- `Decimal`

38 changes: 38 additions & 0 deletions Documentation/Lua/Misc/Globals.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Globals

Global functions.

---
### RefSweep
Unload any assets that are no longer references.

Sig: `RefSweep()`

---
### GetAsset
Get an asset by name. Does not load it. Will return nil if the asset hasn't been loaded.

Sig: `asset = GetAsset(name)`
- Arg: `string name` Asset name
- Ret: `Asset asset` Asset
---
### LoadAsset
Load and get an asset immediately.

Sig: `asset = LoadAsset(name)`
- Arg: `string name` Asset name
- Ret: `Asset asset` Loaded asset
---
### AsyncLoadAsset
Request the an asset be loaded asynchronously. This function will return a reference to an asset, and you can check if it has been loaded. Call asset:IsLoaded() to see if it has been loaded. TODO: Add function callback to handle when asset is loaded.

Sig: `asset = AsyncLoadAsset(name)`
- Arg: `string name` Asset name
- Ret: `Asset asset` Pending asset
---
### UnloadAsset
Unload an unreferenced asset.

Sig: `UnloadAsset(name)`
- Arg: `string name` Asset name
---
53 changes: 53 additions & 0 deletions Documentation/Lua/Systems/AssetManager.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# AssetManager

System that manages loading and unloading assets.

---
### RefSweep
Unload any assets that are no longer references.

Sig: `AssetManager.RefSweep()`

---
### GetAsset
Get an asset by name. Does not load it. Will return nil if the asset hasn't been loaded.

Sig: `asset = AssetManager.GetAsset(name)`
- Arg: `string name` Asset name
- Ret: `Asset asset` Asset
---
### LoadAsset
Load and get an asset immediately.

Sig: `asset = AssetManager.LoadAsset(name)`
- Arg: `string name` Asset name
- Ret: `Asset asset` Loaded asset
---
### SaveAsset
Save an asset. Only available in Editor.

Sig: `AssetManager.Save(name)`
- Arg: `string name` Asset name
---
### AsyncLoadAsset
Request the an asset be loaded asynchronously. This function will return a reference to an asset, and you can check if it has been loaded. Call asset:IsLoaded() to see if it has been loaded. TODO: Add function callback to handle when asset is loaded.

Sig: `asset = AssetManager.AsyncLoadAsset(name)`
- Arg: `string name` Asset name
- Ret: `Asset asset` Pending asset
---
### UnloadAsset
Unload an unreferenced asset.

Sig: `AssetManager.UnloadAsset(name)`
- Arg: `string name` Asset name
---
### CreateAndRegisterAsset
Create an asset of a given type.

Sig: `asset = AssetManager.CreateAndRegisterAsset(typeName, path, name)`
- Arg: `string typeName` Name of the type to create (e.g. MaterialLite)
- Arg: `string path` Where the asset should be saved
- Arg: `string name` Name of the new asset
- Ret: `Asset asset` The newly created asset
---
14 changes: 7 additions & 7 deletions Engine/Source/LuaBindings/Texture_Lua.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ int Texture_Lua::GetWidth(lua_State* L)

uint32_t ret = texture->GetWidth();

lua_pushboolean(L, (int)ret);
lua_pushinteger(L, (int)ret);
return 1;
}

Expand All @@ -41,7 +41,7 @@ int Texture_Lua::GetHeight(lua_State* L)

uint32_t ret = texture->GetHeight();

lua_pushboolean(L, (int)ret);
lua_pushinteger(L, (int)ret);
return 1;
}

Expand All @@ -51,7 +51,7 @@ int Texture_Lua::GetMipLevels(lua_State* L)

uint32_t ret = texture->GetMipLevels();

lua_pushboolean(L, (int)ret);
lua_pushinteger(L, (int)ret);
return 1;
}

Expand All @@ -61,7 +61,7 @@ int Texture_Lua::GetLayers(lua_State* L)

uint32_t ret = texture->GetLayers();

lua_pushboolean(L, (int)ret);
lua_pushinteger(L, (int)ret);
return 1;
}

Expand All @@ -71,7 +71,7 @@ int Texture_Lua::GetFormat(lua_State* L)

PixelFormat ret = texture->GetFormat();

lua_pushboolean(L, (int)ret);
lua_pushinteger(L, (int)ret);
return 1;
}

Expand All @@ -81,7 +81,7 @@ int Texture_Lua::GetFilterType(lua_State* L)

FilterType ret = texture->GetFilterType();

lua_pushboolean(L, (int)ret);
lua_pushinteger(L, (int)ret);
return 1;
}

Expand All @@ -91,7 +91,7 @@ int Texture_Lua::GetWrapMode(lua_State* L)

WrapMode ret = texture->GetWrapMode();

lua_pushboolean(L, (int)ret);
lua_pushinteger(L, (int)ret);
return 1;
}

Expand Down

0 comments on commit bb6ba16

Please sign in to comment.