ui_node_material_editor.c 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_actions.h"
#include "../ui_render.h"
#include "../ui_parse.h"
#include "ui_node_abstractnode.h"
#include "ui_node_abstractscrollable.h"
#include "../../cl_video.h"
#include "../../renderer/r_image.h"
#include "../../renderer/r_draw.h"
#include "../../renderer/r_model.h"
#include "ui_node_material_editor.h"
Include dependency graph for ui_node_material_editor.c:

Go to the source code of this file.

Data Structures

struct  materialDescription_s

Defines

#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
static void UI_MaterialEditorNodeUpdateView (uiNode_t *node, qboolean reset)
 Update the scrollable view.
static void UI_MaterialEditorNodeDraw (uiNode_t *node)
static int UI_MaterialEditorNodeGetImageAtPosition (uiNode_t *node, int x, int y)
 Return index of the image (r_images[i]) else NULL.
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_MaterialEditorMouseDown (uiNode_t *node, int x, int y, int button)
static void UI_MaterialEditorNodeInit (uiNode_t *node)
 Called when we push a window with this node.
static void UI_MaterialEditorNodeWheel (uiNode_t *node, qboolean down, int x, int y)
 Called when the user wheel the mouse over the node.
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.c.


Define Documentation

#define EXTRADATA ( node   )     UI_EXTRADATA(node, abstractScrollableExtraData_t)

Definition at line 42 of file ui_node_material_editor.c.

#define IMAGE_WIDTH   64
Todo:
Replace magic number 64 by some script definition

Definition at line 46 of file ui_node_material_editor.c.

Referenced by UI_MaterialEditorNodeDraw(), UI_MaterialEditorNodeGetImageAtPosition(), and UI_MaterialEditorNodeUpdateView().

#define MARGIN   3

Typedef Documentation


Function Documentation

static void UI_MaterialEditorChangeValue_f ( void   )  [static]
static materialStage_t* UI_MaterialEditorGetStage ( material_t material,
int  stageIndex 
) [static]
static void UI_MaterialEditorMouseDown ( uiNode_t node,
int  x,
int  y,
int  button 
) [static]

Note:
here we use "num" to cache the selected image id. We can reuse it on the script with "<num>"

Definition at line 327 of file ui_node_material_editor.c.

References id, K_MOUSE1, uiNode_s::num, uiNode_s::onChange, r_images, UI_ExecuteEventActions(), UI_MaterialEditorNodeGetImageAtPosition(), and UI_MaterialEditorUpdate().

Referenced by UI_RegisterMaterialEditorNode().

static int UI_MaterialEditorNameToStage ( const char *  stageName  )  [static]

Converts a stage name into the stage flag

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

Definition at line 315 of file ui_node_material_editor.c.

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

Referenced by UI_MaterialEditorChangeValue_f().

static void UI_MaterialEditorNewStage_f ( void   )  [static]
static void UI_MaterialEditorNodeDraw ( uiNode_t node  )  [static]
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 89 of file ui_node_material_editor.c.

References i, it_world, image_s::name, r_images, r_numImages, and image_s::type.

Referenced by UI_MaterialEditorNodeUpdateView().

static void UI_MaterialEditorNodeInit ( uiNode_t node  )  [static]

Called when we push a window with this node.

Definition at line 353 of file ui_node_material_editor.c.

References uiNode_s::num, qtrue, and UI_MaterialEditorNodeUpdateView().

Referenced by UI_RegisterMaterialEditorNode().

static void UI_MaterialEditorNodeUpdateView ( uiNode_t node,
qboolean  reset 
) [static]
static void UI_MaterialEditorNodeWheel ( uiNode_t node,
qboolean  down,
int  x,
int  y 
) [static]

Called when the user wheel the mouse over the node.

Definition at line 362 of file ui_node_material_editor.c.

References UI_AbstractScrollableNodeScrollY().

Referenced by UI_RegisterMaterialEditorNode().

static void UI_MaterialEditorRemoveStage_f ( void   )  [static]
static void UI_MaterialEditorSelectStage_f ( void   )  [static]
static void UI_MaterialEditorStagesToName ( const materialStage_t stage,
char *  buf,
size_t  size 
) [static]
static void UI_MaterialEditorStart_f ( void   )  [static]
static void UI_MaterialEditorUpdate ( image_t image,
materialStage_t materialStage 
) [static]
void UI_RegisterMaterialEditorNode ( uiBehaviour_t behaviour  ) 

Variable Documentation

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},

    {NULL, 0}
}

Definition at line 53 of file ui_node_material_editor.c.

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},

    {NULL, V_NULL, 0, 0},
}

Definition at line 390 of file ui_node_material_editor.c.

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},

    {NULL, V_NULL, 0, 0},
}

Definition at line 380 of file ui_node_material_editor.c.


Generated by  doxygen 1.6.2