This node allow to include a 3D-model into the GUI. It provide a way to create composite models, check [[How to script UI::How to create a composite model]]. We call it "main model" when a model is a child node of a non model node, and "submodel" when the node is a child node of a model node. More...
#include "../ui_main.h"
#include "../ui_internal.h"
#include "../ui_nodes.h"
#include "../ui_parse.h"
#include "../ui_input.h"
#include "ui_node_model.h"
#include "ui_node_abstractnode.h"
#include "../../client.h"
#include "../../renderer/r_draw.h"
#include "../../renderer/r_mesh.h"
#include "../../renderer/r_mesh_anim.h"
Go to the source code of this file.
Defines | |
#define | EXTRADATA_TYPE modelExtraData_t |
#define | EXTRADATA(node) UI_EXTRADATA(node, EXTRADATA_TYPE) |
#define | ROTATE_SPEED 0.5 |
#define | MAX_OLDREFVALUE MAX_VAR |
Functions | |
uiModel_t * | UI_GetUIModel (const char *modelName) |
Returns pointer to UI model. | |
static void | UI_ListUIModels_f (void) |
static void | UI_ModelNodeDraw (uiNode_t *node) |
static void | UI_InitModelInfoView (uiNode_t *node, modelInfo_t *mi, uiModel_t *model) |
Set the Model info view (angle,origin,scale) according to the node definition. | |
static void | UI_DrawModelNodeWithUIModel (uiNode_t *node, const char *source, modelInfo_t *mi, uiModel_t *model) |
Draw a model using UI model definition. | |
void | UI_DrawModelNode (uiNode_t *node, const char *source) |
static void | UI_ModelNodeCapturedMouseMove (uiNode_t *node, int x, int y) |
static void | UI_ModelNodeMouseDown (uiNode_t *node, int x, int y, int button) |
static void | UI_ModelNodeMouseUp (uiNode_t *node, int x, int y, int button) |
static void | UI_ModelNodeLoading (uiNode_t *node) |
Called before loading. Used to set default attribute values. | |
static void | UI_ModelNodeClone (const uiNode_t *source, uiNode_t *clone) |
Call to update a cloned node. | |
static void | UI_ModelNodeNew (uiNode_t *node) |
static void | UI_ModelNodeDelete (uiNode_t *node) |
static void | UI_ModelNodeLoaded (uiNode_t *node) |
void | UI_RegisterModelNode (uiBehaviour_t *behaviour) |
Variables | |
static const uiBehaviour_t const * | localBehaviour |
static vec3_t | nullVector = {0, 0, 0} |
static int | oldMousePosX = 0 |
static int | oldMousePosY = 0 |
static const value_t | properties [] |
valid properties for model |
This node allow to include a 3D-model into the GUI. It provide a way to create composite models, check [[How to script UI::How to create a composite model]]. We call it "main model" when a model is a child node of a non model node, and "submodel" when the node is a child node of a model node.
Definition in file ui_node_model.c.
#define EXTRADATA | ( | node | ) | UI_EXTRADATA(node, EXTRADATA_TYPE) |
Definition at line 45 of file ui_node_model.c.
#define EXTRADATA_TYPE modelExtraData_t |
Definition at line 44 of file ui_node_model.c.
#define MAX_OLDREFVALUE MAX_VAR |
Definition at line 48 of file ui_node_model.c.
Referenced by UI_DrawModelNode(), UI_ModelNodeClone(), UI_ModelNodeLoaded(), and UI_ModelNodeNew().
#define ROTATE_SPEED 0.5 |
Definition at line 47 of file ui_node_model.c.
void UI_DrawModelNode | ( | uiNode_t * | node, | |
const char * | source | |||
) |
< We use model extradata
Definition at line 248 of file ui_node_model.c.
References modelInfo_t::angles, animState_s::backlerp, modelInfo_t::backlerp, uiNode_s::behaviour, modelInfo_t::center, cl_genericPool, cls, uiNode_s::color, modelInfo_t::color, Com_Error(), Com_Printf(), ERR_DROP, EXTRADATA, uiNode_s::firstChild, animState_s::frame, modelInfo_t::frame, client_static_s::frametime, uiNode_s::invis, MAX_OLDREFVALUE, MAX_VAR, Mem_Free, Mem_PoolAlloc, modelInfo_t::mesh, modelInfo_t::model, modelInfo_t::name, uiNode_s::next, nullVector, animState_s::oldframe, modelInfo_t::oldframe, modelInfo_t::origin, uiNode_s::padding, Q_strncpyz(), R_AnimChange(), R_AnimGetName(), R_AnimRun(), R_CleanupDepthBuffer(), R_DrawModelDirect(), R_ModelAutoScale(), R_PopClipRect(), R_PushClipRect(), R_RegisterModelShort(), modelInfo_t::scale, uiNode_s::size, modelInfo_t::skin, UI_CheckVisibility(), UI_DrawModelNodeWithUIModel(), UI_GetNodeAbsPos(), UI_GetReferenceString(), UI_GetUIModel(), and UI_NodeInstanceOf().
Referenced by GAME_CP_DisplayItemInfo(), UI_DrawItem(), UI_ItemNodeDraw(), and UI_ModelNodeDraw().
static void UI_DrawModelNodeWithUIModel | ( | uiNode_t * | node, | |
const char * | source, | |||
modelInfo_t * | mi, | |||
uiModel_t * | model | |||
) | [static] |
Draw a model using UI model definition.
Definition at line 115 of file ui_node_model.c.
References uiModel_s::angles, modelInfo_t::angles, uiModel_s::anim, uiModel_s::animState, animState_s::backlerp, modelInfo_t::backlerp, uiModel_s::center, modelInfo_t::center, cls, uiNode_s::color, uiModel_s::color, modelInfo_t::color, Com_Error(), Com_Printf(), ERR_DROP, EXTRADATA, animState_s::frame, modelInfo_t::frame, client_static_s::frametime, MAX_VAR, modelInfo_t::model, uiModel_s::model, modelInfo_t::name, uiModel_s::next, animState_s::oldframe, modelInfo_t::oldframe, uiModel_s::origin, modelInfo_t::origin, uiNode_s::padding, uiModel_s::parent, uiNode_s::pos, qfalse, qtrue, R_AnimChange(), R_AnimGetName(), R_AnimRun(), R_DrawModelDirect(), R_ModelAutoScale(), R_RegisterModelShort(), uiNode_s::root, uiModel_s::scale, modelInfo_t::scale, uiNode_s::size, uiModel_s::skin, modelInfo_t::skin, Sys_Error(), uiModel_s::tag, UI_GetReferenceString(), UI_GetUIModel(), UI_InitModelInfoView(), and Vector4Copy.
Referenced by UI_DrawModelNode().
uiModel_t* UI_GetUIModel | ( | const char * | modelName | ) |
Returns pointer to UI model.
[in] | modelName | model id from script files |
Definition at line 57 of file ui_node_model.c.
References i, uiModel_s::id, m, MAX_VAR, uiGlobal_s::models, uiGlobal_s::numModels, and ui_global.
Referenced by GAME_GetModelForItem(), UI_DrawModelNode(), UI_DrawModelNodeWithUIModel(), and UI_ParseUIModel().
static void UI_InitModelInfoView | ( | uiNode_t * | node, | |
modelInfo_t * | mi, | |||
uiModel_t * | model | |||
) | [inline, static] |
Set the Model info view (angle,origin,scale) according to the node definition.
Definition at line 97 of file ui_node_model.c.
References modelInfo_t::angles, modelInfo_t::center, EXTRADATA, nullVector, modelInfo_t::origin, modelInfo_t::scale, scale, uiNode_s::size, UI_GetNodeAbsPos(), and VectorCopy.
Referenced by UI_DrawModelNodeWithUIModel().
static void UI_ListUIModels_f | ( | void | ) | [static] |
Definition at line 70 of file ui_node_model.c.
References Com_Printf(), i, uiModel_s::id, uiModel_s::model, uiGlobal_s::models, uiModel_s::need, uiGlobal_s::numModels, and ui_global.
Referenced by UI_RegisterModelNode().
static void UI_ModelNodeCapturedMouseMove | ( | uiNode_t * | node, | |
int | x, | |||
int | y | |||
) | [static] |
Definition at line 417 of file ui_node_model.c.
References EXTRADATA, oldMousePosX, oldMousePosY, ROLL, ROTATE_SPEED, and YAW.
Referenced by UI_RegisterModelNode().
Call to update a cloned node.
Definition at line 473 of file ui_node_model.c.
References uiBehaviour_s::clone, uiNode_s::dynamic, EXTRADATA, MAX_OLDREFVALUE, uiBehaviour_s::super, and UI_AllocStaticString().
Referenced by UI_RegisterModelNode().
static void UI_ModelNodeDelete | ( | uiNode_t * | node | ) | [static] |
Definition at line 486 of file ui_node_model.c.
References EXTRADATA, and Mem_Free.
Referenced by UI_RegisterModelNode().
static void UI_ModelNodeDraw | ( | uiNode_t * | node | ) | [static] |
Definition at line 80 of file ui_node_model.c.
References EXTRADATA, MAX_VAR, Q_strncpyz(), UI_DrawModelNode(), and UI_GetReferenceString().
Referenced by UI_RegisterModelNode().
static void UI_ModelNodeLoaded | ( | uiNode_t * | node | ) | [static] |
Definition at line 492 of file ui_node_model.c.
References uiNode_s::behaviour, Com_Printf(), EXTRADATA, MAX_OLDREFVALUE, uiNode_s::parent, uiNode_s::size, UI_AllocStaticString(), and UI_GetPath().
Referenced by UI_RegisterModelNode().
static void UI_ModelNodeLoading | ( | uiNode_t * | node | ) | [static] |
Called before loading. Used to set default attribute values.
Definition at line 463 of file ui_node_model.c.
References uiNode_s::color, EXTRADATA, qtrue, scale, Vector4Set, and VectorSet.
Referenced by UI_RegisterModelNode().
static void UI_ModelNodeMouseDown | ( | uiNode_t * | node, | |
int | x, | |||
int | y, | |||
int | button | |||
) | [static] |
Definition at line 440 of file ui_node_model.c.
References EXTRADATA, K_MOUSE1, oldMousePosX, oldMousePosY, and UI_SetMouseCapture().
Referenced by UI_RegisterModelNode().
static void UI_ModelNodeMouseUp | ( | uiNode_t * | node, | |
int | x, | |||
int | y, | |||
int | button | |||
) | [static] |
Definition at line 451 of file ui_node_model.c.
References K_MOUSE1, UI_GetMouseCapture(), and UI_MouseRelease().
Referenced by UI_RegisterModelNode().
static void UI_ModelNodeNew | ( | uiNode_t * | node | ) | [static] |
Definition at line 480 of file ui_node_model.c.
References EXTRADATA, MAX_OLDREFVALUE, Mem_PoolAlloc, and ui_dynPool.
Referenced by UI_RegisterModelNode().
void UI_RegisterModelNode | ( | uiBehaviour_t * | behaviour | ) |
Definition at line 537 of file ui_node_model.c.
References uiBehaviour_s::capturedMouseMove, uiBehaviour_s::clone, Cmd_AddCommand(), uiBehaviour_s::delete, uiBehaviour_s::draw, uiBehaviour_s::drawItselfChild, EXTRADATA_TYPE, uiBehaviour_s::extraDataSize, uiBehaviour_s::loaded, uiBehaviour_s::loading, uiBehaviour_s::mouseDown, uiBehaviour_s::mouseUp, uiBehaviour_s::name, uiBehaviour_s::new, uiBehaviour_s::properties, qtrue, UI_ListUIModels_f(), UI_ModelNodeCapturedMouseMove(), UI_ModelNodeClone(), UI_ModelNodeDelete(), UI_ModelNodeDraw(), UI_ModelNodeLoaded(), UI_ModelNodeLoading(), UI_ModelNodeMouseDown(), UI_ModelNodeMouseUp(), and UI_ModelNodeNew().
const uiBehaviour_t const* localBehaviour [static] |
Definition at line 50 of file ui_node_model.c.
vec3_t nullVector = {0, 0, 0} [static] |
Definition at line 91 of file ui_node_model.c.
Referenced by UI_DrawModelNode(), and UI_InitModelInfoView().
int oldMousePosX = 0 [static] |
Definition at line 414 of file ui_node_model.c.
Referenced by UI_ModelNodeCapturedMouseMove(), and UI_ModelNodeMouseDown().
int oldMousePosY = 0 [static] |
Definition at line 415 of file ui_node_model.c.
Referenced by UI_ModelNodeCapturedMouseMove(), and UI_ModelNodeMouseDown().
const value_t properties[] [static] |
{ {"anim", V_CVAR_OR_STRING, UI_EXTRADATA_OFFSETOF(modelExtraData_t, animation), 0}, {"angles", V_VECTOR, UI_EXTRADATA_OFFSETOF(modelExtraData_t, angles), MEMBER_SIZEOF(modelExtraData_t, angles)}, {"origin", V_VECTOR, UI_EXTRADATA_OFFSETOF(modelExtraData_t, origin), MEMBER_SIZEOF(modelExtraData_t, origin)}, {"scale", V_VECTOR, UI_EXTRADATA_OFFSETOF(modelExtraData_t, scale), MEMBER_SIZEOF(modelExtraData_t, scale)}, {"tag", V_CVAR_OR_STRING, UI_EXTRADATA_OFFSETOF(modelExtraData_t, tag), 0}, {"autoscale", V_BOOL, UI_EXTRADATA_OFFSETOF(modelExtraData_t, autoscale), MEMBER_SIZEOF(modelExtraData_t, autoscale)}, {"rotatewithmouse", V_BOOL, UI_EXTRADATA_OFFSETOF(modelExtraData_t, rotateWithMouse), MEMBER_SIZEOF(modelExtraData_t, rotateWithMouse)}, {"clipoverflow", V_BOOL, UI_EXTRADATA_OFFSETOF(modelExtraData_t, clipOverflow), MEMBER_SIZEOF(modelExtraData_t, clipOverflow)}, {"src", V_CVAR_OR_STRING, UI_EXTRADATA_OFFSETOF(modelExtraData_t, model), 0}, {"skin", V_CVAR_OR_STRING, UI_EXTRADATA_OFFSETOF(modelExtraData_t, skin), 0}, {NULL, V_NULL, 0, 0} }
valid properties for model
Definition at line 510 of file ui_node_model.c.