1 /** 2 * @file 3 */ 4 5 /* 6 Copyright (C) 2002-2013 UFO: Alien Invasion. 7 8 This program is free software; you can redistribute it and/or 9 modify it under the terms of the GNU General Public License 10 as published by the Free Software Foundation; either version 2 11 of the License, or (at your option) any later version. 12 13 This program is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 17 See the GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with this program; if not, write to the Free Software 21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 22 23 */ 24 25 #pragma once 26 27 #include "../ui_nodes.h" 28 #include "ui_node_abstractnode.h" 29 #include "../../cl_renderer.h" /**< include animState_t */ 30 31 class uiModelNode : public uiLocatedNode { 32 void draw(uiNode_t* node) override; 33 void onMouseDown(uiNode_t* node, int x, int y, int button) override; 34 void onMouseUp(uiNode_t* node, int x, int y, int button) override; 35 void onLoading(uiNode_t* node) override; 36 void onLoaded(uiNode_t* node) override; 37 void clone(uiNode_t const* source, uiNode_t* clone) override; 38 void newNode(uiNode_t* node) override; 39 void deleteNode(uiNode_t* node) override; 40 void onCapturedMouseMove(uiNode_t* node, int x, int y) override; 41 }; 42 43 #define UI_MAX_MODELS 128 44 45 /** @brief Model that have more than one part (top and down part of an aircraft) */ 46 typedef struct uiModel_s { 47 char* id; 48 char* anim; /**< animation to run for this model */ 49 char* parent; /**< parent model id */ 50 char* tag; /**< the tag the model should placed onto */ 51 int skin; /**< skin number to use - default 0 (first skin) */ 52 char* model; 53 animState_t animState; 54 vec3_t origin, scale, angles, center; /**< to cache the calculated values */ 55 vec4_t color; /**< rgba */ 56 struct uiModel_s* next; 57 } uiModel_t; 58 59 /** 60 * @brief extradata for the model node 61 */ 62 typedef struct modelExtraData_s { 63 char* oldRefValue; /**< used for storing old reference values */ 64 vec3_t angles; 65 vec3_t origin; 66 vec3_t omega; 67 vec3_t scale; 68 const char* skin; 69 const char* model; 70 const char* tag; /**< the tag to place the model onto */ 71 animState_t* animationState; /**< holds then anim state for the current model */ 72 const char* animation; /**< Anim string from the *.anm files */ 73 bool autoscale; /**< If true autoscale the model when we draw it */ 74 bool rotateWithMouse; /**< If true the user can rotate the model with the mouse */ 75 bool clipOverflow; /**< If true (default) model outside the node are clipped */ 76 bool containerLike; /**< Display an item like an item from the container */ 77 } modelExtraData_t; 78 79 uiModel_t* UI_GetUIModel(const char* modelName); 80 void UI_DrawModelNode(uiNode_t* node, const char* source); 81 void UI_RegisterModelNode(uiBehaviour_t* behaviour); 82