UFO: Alien Invasion
Loading...
Searching...
No Matches
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"
Include dependency graph for ui_node_material_editor.cpp:

Go to the source code of this file.

Data Structures

struct  materialDescription_t

Macros

#define EXTRADATA(node)
#define IMAGE_WIDTH   64
#define MARGIN   3

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
static int UI_MaterialEditorNodeGetImageAtPosition (uiNode_t *node, int x, int y)
 Return index of the image (r_images[i]) else nullptr.
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

◆ EXTRADATA

#define EXTRADATA ( node)

◆ IMAGE_WIDTH

#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().

◆ MARGIN

#define MARGIN   3

Function Documentation

◆ UI_MaterialEditorChangeValue_f()

◆ UI_MaterialEditorGetStage()

◆ UI_MaterialEditorNameToStage()

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_t::name, and materialDescription_t::stageFlag.

Referenced by UI_MaterialEditorChangeValue_f().

◆ UI_MaterialEditorNewStage_f()

◆ UI_MaterialEditorNodeGetImageAtPosition()

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

◆ UI_MaterialEditorNodeGetImageCount()

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_t::name, R_GetImageAtIndex(), r_numImages, and image_t::type.

Referenced by uiMaterialEditorNode::updateView().

◆ UI_MaterialEditorRemoveStage_f()

◆ UI_MaterialEditorSelectStage_f()

◆ UI_MaterialEditorStagesToName()

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

◆ UI_MaterialEditorStart_f()

void UI_MaterialEditorStart_f ( void )
static

Definition at line 374 of file ui_node_material_editor.cpp.

References ca_active, cls, Com_Printf(), and UI_PopWindow().

Referenced by UI_RegisterMaterialEditorNode().

◆ UI_MaterialEditorUpdate()

◆ UI_RegisterMaterialEditorNode()

Variable Documentation

◆ materialDescriptions

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_BLEND
Definition r_material.h:34
#define STAGE_TERRAIN
Definition r_material.h:43
#define STAGE_SCROLL_S
Definition r_material.h:39
#define STAGE_SCROLL_T
Definition r_material.h:40
#define STAGE_STRETCH
Definition r_material.h:37
#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_PULSE
Definition r_material.h:36
#define STAGE_SCALE_T
Definition r_material.h:42
#define STAGE_ANIM
Definition r_material.h:46
#define STAGE_SCALE_S
Definition r_material.h:41
#define STAGE_COLOR
Definition r_material.h:35
#define STAGE_ROTATE
Definition r_material.h:38
#define STAGE_DIRTMAP
Definition r_material.h:47
#define STAGE_TAPE
Definition r_material.h:44

Definition at line 58 of file ui_node_material_editor.cpp.

Referenced by UI_MaterialEditorNameToStage(), and UI_MaterialEditorStagesToName().

◆ materialStageValues

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},
}
@ V_FLOAT
Definition scripts.h:54
@ V_NULL
Definition scripts.h:49
@ V_INT
Definition scripts.h:52
static const vec3_t scale

Definition at line 396 of file ui_node_material_editor.cpp.

Referenced by UI_MaterialEditorChangeValue_f().

◆ materialValues

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 at line 386 of file ui_node_material_editor.cpp.

Referenced by UI_MaterialEditorChangeValue_f().