mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
gfx_get_texture
Some checks are pending
Build coop / build-linux (push) Waiting to run
Build coop / build-steamos (push) Waiting to run
Build coop / build-windows-opengl (push) Waiting to run
Build coop / build-windows-directx (push) Waiting to run
Build coop / build-macos-arm (push) Waiting to run
Build coop / build-macos-intel (push) Waiting to run
Some checks are pending
Build coop / build-linux (push) Waiting to run
Build coop / build-steamos (push) Waiting to run
Build coop / build-windows-opengl (push) Waiting to run
Build coop / build-windows-directx (push) Waiting to run
Build coop / build-macos-arm (push) Waiting to run
Build coop / build-macos-intel (push) Waiting to run
returns a pointer to the texture in the gfx command
This commit is contained in:
parent
50f83b1ffe
commit
e1aab9c479
6 changed files with 60 additions and 0 deletions
|
|
@ -10307,6 +10307,13 @@ function gfx_get_vertex_count(cmd)
|
|||
-- ...
|
||||
end
|
||||
|
||||
--- @param cmd Pointer_Gfx
|
||||
--- @return Pointer_integer
|
||||
--- Gets the texture from a display list command if it has an image related op
|
||||
function gfx_get_texture(cmd)
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- @param gfx Pointer_Gfx
|
||||
--- @return integer
|
||||
--- Gets the max length of a display list
|
||||
|
|
|
|||
|
|
@ -2679,6 +2679,29 @@ Gets the number of vertices from a display list command if it has the op `G_VTX`
|
|||
|
||||
<br />
|
||||
|
||||
## [gfx_get_texture](#gfx_get_texture)
|
||||
|
||||
### Description
|
||||
Gets the texture from a display list command if it has an image related op
|
||||
|
||||
### Lua Example
|
||||
`local PointerValue = gfx_get_texture(cmd)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| cmd | `Pointer` <`Gfx`> |
|
||||
|
||||
### Returns
|
||||
- `Pointer` <`integer`>
|
||||
|
||||
### C Prototype
|
||||
`u8 *gfx_get_texture(Gfx *cmd);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [gfx_get_length](#gfx_get_length)
|
||||
|
||||
### Description
|
||||
|
|
|
|||
|
|
@ -1872,6 +1872,7 @@
|
|||
- [gfx_get_display_list](functions-6.md#gfx_get_display_list)
|
||||
- [gfx_get_vertex_buffer](functions-6.md#gfx_get_vertex_buffer)
|
||||
- [gfx_get_vertex_count](functions-6.md#gfx_get_vertex_count)
|
||||
- [gfx_get_texture](functions-6.md#gfx_get_texture)
|
||||
- [gfx_get_length](functions-6.md#gfx_get_length)
|
||||
- [gfx_get_command](functions-6.md#gfx_get_command)
|
||||
- [gfx_get_next_command](functions-6.md#gfx_get_next_command)
|
||||
|
|
|
|||
|
|
@ -31406,6 +31406,23 @@ int smlua_func_gfx_get_vertex_count(lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_gfx_get_texture(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 1) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "gfx_get_texture", 1, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Gfx * cmd = (Gfx *)smlua_to_cobject(L, 1, LOT_GFX);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "gfx_get_texture"); return 0; }
|
||||
|
||||
smlua_push_pointer(L, LVT_U8_P, (void*)gfx_get_texture(cmd), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_gfx_get_length(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
|
|
@ -36994,6 +37011,7 @@ void smlua_bind_functions_autogen(void) {
|
|||
smlua_bind_function(L, "gfx_get_display_list", smlua_func_gfx_get_display_list);
|
||||
smlua_bind_function(L, "gfx_get_vertex_buffer", smlua_func_gfx_get_vertex_buffer);
|
||||
smlua_bind_function(L, "gfx_get_vertex_count", smlua_func_gfx_get_vertex_count);
|
||||
smlua_bind_function(L, "gfx_get_texture", smlua_func_gfx_get_texture);
|
||||
smlua_bind_function(L, "gfx_get_length", smlua_func_gfx_get_length);
|
||||
smlua_bind_function(L, "gfx_get_command", smlua_func_gfx_get_command);
|
||||
smlua_bind_function(L, "gfx_get_next_command", smlua_func_gfx_get_next_command);
|
||||
|
|
|
|||
|
|
@ -238,6 +238,15 @@ u16 gfx_get_vertex_count(Gfx *cmd) {
|
|||
return C0(cmd, 12, 8);
|
||||
}
|
||||
|
||||
u8 *gfx_get_texture(Gfx *cmd) {
|
||||
if (!cmd) { return 0; }
|
||||
u32 op = GFX_OP(cmd);
|
||||
if (op != G_SETCIMG && op != G_SETZIMG && op != G_SETTIMG) { return 0; }
|
||||
if (cmd->words.w1 == 0) { return 0; }
|
||||
|
||||
return (u8 *) cmd->words.w1;
|
||||
}
|
||||
|
||||
u32 gfx_get_length(Gfx *gfx) {
|
||||
if (!gfx) { return 0; }
|
||||
|
||||
|
|
|
|||
|
|
@ -66,6 +66,8 @@ Gfx *gfx_get_display_list(Gfx *cmd);
|
|||
Vtx *gfx_get_vertex_buffer(Gfx *cmd);
|
||||
/* |description|Gets the number of vertices from a display list command if it has the op `G_VTX`|descriptionEnd| */
|
||||
u16 gfx_get_vertex_count(Gfx *cmd);
|
||||
/* |description|Gets the texture from a display list command if it has an image related op|descriptionEnd| */
|
||||
u8 *gfx_get_texture(Gfx *cmd);
|
||||
|
||||
/* |description|Gets the max length of a display list|descriptionEnd| */
|
||||
u32 gfx_get_length(Gfx *gfx);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue