UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ui_node_material_editor.cpp File Reference

Material editor related code. More...

#include "../../client.h"
#include "../ui_main.h"
#include "../ui_data.h"
#include "../ui_windows.h"
#include "../ui_nodes.h"
#include "../ui_behaviour.h"
#include "../ui_actions.h"
#include "../ui_render.h"
#include "../ui_parse.h"
#include "../ui_lua.h"
#include "ui_node_abstractnode.h"
#include "ui_node_abstractscrollable.h"
#include "ui_node_material_editor.h"
#include "../../cl_video.h"
#include "../../renderer/r_image.h"
#include "../../renderer/r_model.h"
#include "../../../common/scripts_lua.h"

Go to the source code of this file.

Data Structures

struct  materialDescription_s
 

Macros

#define EXTRADATA(node)   UI_EXTRADATA(node, abstractScrollableExtraData_t)
 
#define IMAGE_WIDTH   64
 
#define MARGIN   3
 

Typedefs

typedef struct
materialDescription_s 
materialDescription_t
 

Functions

static materialStage_tUI_MaterialEditorGetStage (material_t *material, int stageIndex)
 
static int UI_MaterialEditorNodeGetImageCount (uiNode_t *node)
 return the number of images we can display More...
 
static int UI_MaterialEditorNodeGetImageAtPosition (uiNode_t *node, int x, int y)
 Return index of the image (r_images[i]) else nullptr. More...
 
static void UI_MaterialEditorStagesToName (const materialStage_t *stage, char *buf, size_t size)
 
static void UI_MaterialEditorUpdate (image_t *image, materialStage_t *materialStage)
 
static int UI_MaterialEditorNameToStage (const char *stageName)
 
static void UI_MaterialEditorStart_f (void)
 
static void UI_MaterialEditorChangeValue_f (void)
 
static void UI_MaterialEditorSelectStage_f (void)
 
static void UI_MaterialEditorRemoveStage_f (void)
 
static void UI_MaterialEditorNewStage_f (void)
 
void UI_RegisterMaterialEditorNode (uiBehaviour_t *behaviour)
 

Variables

static const materialDescription_t materialDescriptions []
 
static const value_t materialValues []
 
static const value_t materialStageValues []
 

Detailed Description

Material editor related code.

Definition in file ui_node_material_editor.cpp.

Macro Definition Documentation

#define EXTRADATA (   node)    UI_EXTRADATA(node, abstractScrollableExtraData_t)
#define IMAGE_WIDTH   64
Todo:
Replace magic number 64 by some script definition

Definition at line 51 of file ui_node_material_editor.cpp.

Referenced by uiMaterialEditorNode::draw(), UI_MaterialEditorNodeGetImageAtPosition(), and uiMaterialEditorNode::updateView().

#define MARGIN   3

Typedef Documentation

Function Documentation

static materialStage_t* UI_MaterialEditorGetStage ( material_t material,
int  stageIndex 
)
static
static int UI_MaterialEditorNameToStage ( const char *  stageName)
static

Converts a stage name into the stage flag

Parameters
stageNameThe name to search the flag for
Returns
-1 if no flag was not found for the given name

Definition at line 314 of file ui_node_material_editor.cpp.

References materialDescriptions, materialDescription_s::name, and materialDescription_s::stageFlag.

Referenced by UI_MaterialEditorChangeValue_f().

static int UI_MaterialEditorNodeGetImageAtPosition ( uiNode_t node,
int  x,
int  y 
)
static
static int UI_MaterialEditorNodeGetImageCount ( uiNode_t node)
static

return the number of images we can display

Definition at line 94 of file ui_node_material_editor.cpp.

References i, it_world, image_s::name, R_GetImageAtIndex(), r_numImages, and image_s::type.

Referenced by uiMaterialEditorNode::updateView().

static void UI_MaterialEditorStagesToName ( const materialStage_t stage,
char *  buf,
size_t  size 
)
static
static void UI_MaterialEditorStart_f ( void  )
static

Variable Documentation

const materialDescription_t materialDescriptions[]
static
Initial value:
= {
{"texture", STAGE_TEXTURE},
{"envmap", STAGE_ENVMAP},
{"blend", STAGE_BLEND},
{"color", STAGE_COLOR},
{"pulse", STAGE_PULSE},
{"stretch", STAGE_STRETCH},
{"rotate", STAGE_ROTATE},
{"scroll.s", STAGE_SCROLL_S},
{"scroll.t", STAGE_SCROLL_T},
{"scale.s", STAGE_SCALE_S},
{"scale.t", STAGE_SCALE_T},
{"terrain", STAGE_TERRAIN},
{"tape", STAGE_TAPE},
{"lightmap", STAGE_LIGHTMAP},
{"anim", STAGE_ANIM},
{"dirtmap", STAGE_DIRTMAP},
{nullptr, 0}
}
#define STAGE_TAPE
Definition: r_material.h:44
#define STAGE_STRETCH
Definition: r_material.h:37
#define STAGE_TERRAIN
Definition: r_material.h:43
#define STAGE_ROTATE
Definition: r_material.h:38
#define STAGE_DIRTMAP
Definition: r_material.h:47
#define STAGE_LIGHTMAP
Definition: r_material.h:45
#define STAGE_TEXTURE
Definition: r_material.h:32
#define STAGE_ENVMAP
Definition: r_material.h:33
#define STAGE_SCROLL_T
Definition: r_material.h:40
#define STAGE_PULSE
Definition: r_material.h:36
#define STAGE_COLOR
Definition: r_material.h:35
#define STAGE_SCROLL_S
Definition: r_material.h:39
#define STAGE_SCALE_S
Definition: r_material.h:41
#define STAGE_SCALE_T
Definition: r_material.h:42
#define STAGE_BLEND
Definition: r_material.h:34
#define STAGE_ANIM
Definition: r_material.h:46

Definition at line 58 of file ui_node_material_editor.cpp.

Referenced by UI_MaterialEditorNameToStage(), and UI_MaterialEditorStagesToName().

const value_t materialStageValues[]
static
Initial value:
= {
{"rotate.hz", V_FLOAT, offsetof(materialStage_t, rotate.deg), 0},
{"rotate.deg", V_FLOAT, offsetof(materialStage_t, rotate.hz), 0},
{"stretch.hz", V_FLOAT, offsetof(materialStage_t, stretch.hz), 0},
{"stretch.dhz", V_FLOAT, offsetof(materialStage_t, stretch.dhz), 0},
{"stretch.amp", V_FLOAT, offsetof(materialStage_t, stretch.amp), 0},
{"stretch.damp", V_FLOAT, offsetof(materialStage_t, stretch.damp), 0},
{"pulse.hz", V_FLOAT, offsetof(materialStage_t, pulse.hz), 0},
{"pulse.dhz", V_FLOAT, offsetof(materialStage_t, pulse.dhz), 0},
{"scroll.s", V_FLOAT, offsetof(materialStage_t, scroll.s), 0},
{"scroll.t", V_FLOAT, offsetof(materialStage_t, scroll.t), 0},
{"scroll.ds", V_FLOAT, offsetof(materialStage_t, scroll.ds), 0},
{"scroll.dt", V_FLOAT, offsetof(materialStage_t, scroll.dt), 0},
{"scale.s", V_FLOAT, offsetof(materialStage_t, scale.s), 0},
{"scale.t", V_FLOAT, offsetof(materialStage_t, scale.t), 0},
{"terrain.floor", V_FLOAT, offsetof(materialStage_t, terrain.floor), 0},
{"terrain.ceil", V_FLOAT, offsetof(materialStage_t, terrain.ceil), 0},
{"tape.floor", V_FLOAT, offsetof(materialStage_t, tape.floor), 0},
{"tape.ceil", V_FLOAT, offsetof(materialStage_t, tape.ceil), 0},
{"tape.center", V_FLOAT, offsetof(materialStage_t, tape.center), 0},
{"anim.frames", V_INT, offsetof(materialStage_t, anim.num_frames), 0},
{"anim.dframe", V_INT, offsetof(materialStage_t, anim.dframe), 0},
{"anim.dtime", V_FLOAT, offsetof(materialStage_t, anim.dtime), 0},
{"anim.fps", V_FLOAT, offsetof(materialStage_t, anim.fps), 0},
{"dirt.intensity", V_FLOAT, offsetof(materialStage_t, dirt.intensity), 0},
{"blend.src", V_INT, offsetof(materialStage_t, blend.src), 0},
{"blend.dest", V_INT, offsetof(materialStage_t, blend.dest), 0},
{nullptr, V_NULL, 0, 0},
}
static const vec3_t scale
Definition: scripts.h:49
Definition: scripts.h:52

Definition at line 396 of file ui_node_material_editor.cpp.

const value_t materialValues[]
static
Initial value:
= {
{"bump", V_FLOAT, offsetof(material_t, bump), 0},
{"parallax", V_FLOAT, offsetof(material_t, parallax), 0},
{"specular", V_FLOAT, offsetof(material_t, specular), 0},
{"hardness", V_FLOAT, offsetof(material_t, hardness), 0},
{nullptr, V_NULL, 0, 0},
}
Definition: scripts.h:49

Definition at line 386 of file ui_node_material_editor.cpp.