UFO: Alien Invasion
Loading...
Searching...
No Matches
ui_node_material_editor.cpp
Go to the documentation of this file.
1
5
6/*
7Copyright (C) 1997-2001 Id Software, Inc.
8
9This program is free software; you can redistribute it and/or
10modify it under the terms of the GNU General Public License
11as published by the Free Software Foundation; either version 2
12of the License, or (at your option) any later version.
13
14This program is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
18See the GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23
24*/
25
26#include "../../client.h"
27#include "../ui_main.h"
28#include "../ui_data.h"
29#include "../ui_windows.h"
30#include "../ui_nodes.h"
31#include "../ui_behaviour.h"
32#include "../ui_actions.h"
33#include "../ui_render.h"
34#include "../ui_parse.h"
35#include "../ui_lua.h"
36
40
41#include "../../cl_video.h"
44
46
47#define EXTRADATA(node) UI_EXTRADATA(node, abstractScrollableExtraData_t)
48
49/*#define ANYIMAGES*/
51#define IMAGE_WIDTH 64
52
53typedef struct materialDescription_s {
54 const char* name;
55 const int stageFlag;
57
59 {"texture", STAGE_TEXTURE},
60 {"envmap", STAGE_ENVMAP},
61 {"blend", STAGE_BLEND},
62 {"color", STAGE_COLOR},
63 {"pulse", STAGE_PULSE},
64 {"stretch", STAGE_STRETCH},
65 {"rotate", STAGE_ROTATE},
66 {"scroll.s", STAGE_SCROLL_S},
67 {"scroll.t", STAGE_SCROLL_T},
68 {"scale.s", STAGE_SCALE_S},
69 {"scale.t", STAGE_SCALE_T},
70 {"terrain", STAGE_TERRAIN},
71 {"tape", STAGE_TAPE},
72 {"lightmap", STAGE_LIGHTMAP},
73 {"anim", STAGE_ANIM},
74 {"dirtmap", STAGE_DIRTMAP},
75
76 {nullptr, 0}
77};
78
79static materialStage_t* UI_MaterialEditorGetStage (material_t* material, int stageIndex)
80{
81 materialStage_t* materialStage = material->stages;
82 while (stageIndex-- > 0) {
83 if (materialStage)
84 materialStage = materialStage->next;
85 else
86 break;
87 }
88 return materialStage;
89}
90
95{
96 int cnt = 0;
97
98 for (int i = 0; i < r_numImages; i++) {
99#ifndef ANYIMAGES
100 const image_t* image = R_GetImageAtIndex(i);
101 /* filter */
102 if (image->type != it_world)
103 continue;
104
105 if (strstr(image->name, "tex_common"))
106 continue;
107#endif
108 cnt++;
109 }
110 return cnt;
111}
112
117{
118 const int imageCount = UI_MaterialEditorNodeGetImageCount(node);
119 const int imagesPerLine = (node->box.size[0] - node->padding) / (IMAGE_WIDTH + node->padding);
120 const int imagesPerColumn = (node->box.size[1] - node->padding) / (IMAGE_WIDTH + node->padding);
121
122 /* update view */
123 if (imagesPerLine > 0 && imagesPerColumn > 0) {
124 const int pos = reset ? 0 : -1;
125 setScrollY(node, pos, imagesPerColumn, imageCount / imagesPerLine);
126 } else
127 setScrollY(node, 0, 0, 0);
128}
129
134{
135 const int imagesPerLine = (node->box.size[0] - node->padding) / (IMAGE_WIDTH + node->padding);
136
137 if (isSizeChange(node))
138 updateView(node, false);
139
140 /* width too small to display anything */
141 if (imagesPerLine <= 0)
142 return;
143
144 vec2_t pos;
145 UI_GetNodeAbsPos(node, pos);
146
147 /* display images */
148 int cnt = 0;
149 int cntView = 0;
150 for (int i = 0; i < r_numImages; i++) {
151 image_t* image = R_GetImageAtIndex(i);
152 vec2_t imagepos;
153
154#ifndef ANYIMAGES
155 /* filter */
156 if (image->type != it_world)
157 continue;
158
159 if (strstr(image->name, "tex_common"))
160 continue;
161#endif
162
163 /* skip images before the scroll position */
164 if (cnt / imagesPerLine < EXTRADATA(node).scrollY.viewPos) {
165 cnt++;
166 continue;
167 }
168
170 imagepos[0] = pos[0] + node->padding + (cntView % imagesPerLine) * (IMAGE_WIDTH + node->padding);
171 imagepos[1] = pos[1] + node->padding + (cntView / imagesPerLine) * (IMAGE_WIDTH + node->padding);
172
173 /* vertical overflow */
174 if (imagepos[1] + IMAGE_WIDTH + node->padding >= pos[1] + node->box.size[1])
175 break;
176
177 if (i == node->num) {
178#define MARGIN 3
179 UI_DrawRect(imagepos[0] - MARGIN, imagepos[1] - MARGIN, IMAGE_WIDTH + MARGIN * 2, IMAGE_WIDTH + MARGIN * 2, node->selectedColor, 2, 0xFFFF);
180#undef MARGIN
181 }
182
183 UI_DrawNormImage(false, imagepos[0], imagepos[1], IMAGE_WIDTH, IMAGE_WIDTH, 0, 0, 0, 0, image);
184
185 cnt++;
186 cntView++;
187 }
188}
189
193static int UI_MaterialEditorNodeGetImageAtPosition (uiNode_t* node, int x, int y)
194{
195 const int imagesPerLine = (node->box.size[0] - node->padding) / (IMAGE_WIDTH + node->padding);
196 const int imagesPerColumn = (node->box.size[1] - node->padding) / (IMAGE_WIDTH + node->padding);
197
198 UI_NodeAbsoluteToRelativePos(node, &x, &y);
199
200 /* have we click between 2 images? */
201 if (((x % (IMAGE_WIDTH + node->padding)) < node->padding)
202 || ((y % (IMAGE_WIDTH + node->padding)) < node->padding))
203 return -1;
204
205 /* get column and line of the image */
206 int columnRequested = x / (IMAGE_WIDTH + node->padding);
207 int lineRequested = y / (IMAGE_WIDTH + node->padding);
208
209 /* have we click outside? */
210 if (columnRequested >= imagesPerLine || lineRequested >= imagesPerColumn)
211 return -1;
212
213 vec2_t pos;
214 int cnt = 0;
215 int cntView = 0;
216 UI_GetNodeAbsPos(node, pos);
217
218 /* check images */
219 for (int i = 0; i < r_numImages; i++) {
220#ifndef ANYIMAGES
221 /* filter */
222 image_t* image = R_GetImageAtIndex(i);
223 if (image->type != it_world)
224 continue;
225
226 if (strstr(image->name, "tex_common"))
227 continue;
228#endif
229
230 /* skip images before the scroll position */
231 if (cnt / imagesPerLine < EXTRADATA(node).scrollY.viewPos) {
232 cnt++;
233 continue;
234 }
235
236 if (cntView % imagesPerLine == columnRequested && cntView / imagesPerLine == lineRequested)
237 return i;
238
239 /* vertical overflow */
240 if (cntView / imagesPerLine > lineRequested)
241 break;
242
243 cnt++;
244 cntView++;
245 }
246
247 return -1;
248}
249
250static void UI_MaterialEditorStagesToName (const materialStage_t* stage, char* buf, size_t size)
251{
253
254 while (md->name) {
255 if (stage->flags & md->stageFlag)
256 Q_strcat(buf, size, "%s ", md->name);
257 md++;
258 }
259}
260
266static void UI_MaterialEditorUpdate (image_t* image, materialStage_t* materialStage)
267{
268 linkedList_t* materialStagesList = nullptr;
269
270 if (image->normalmap == nullptr)
271 UI_ExecuteConfunc("hideshaders true 0 0 0 0");
272 else
273 UI_ExecuteConfunc("hideshaders false %f %f %f %f", image->material.bump,
274 image->material.hardness, image->material.parallax, image->material.specular);
275
276 if (image->normalmap == nullptr)
277 Cvar_Set("me_imagename", "%s", image->name);
278 else
279 Cvar_Set("me_imagename", "%s (nm)", image->name);
280
281 if (!image->material.num_stages) {
282 UI_ExecuteConfunc("hidestages true");
283 } else {
284 if (materialStage) {
285 const char* stageType = Cvar_GetString("me_stagetype");
286 if (stageType[0] == '\0')
287 stageType = "stretch";
288 UI_ExecuteConfunc("hidestages false %s", stageType);
289 } else
290 Cvar_Set("me_stage_id", "-1");
291 for (int i = 0; i < image->material.num_stages; i++) {
292 const materialStage_t* stage = UI_MaterialEditorGetStage(&image->material, i);
293 char stageName[MAX_VAR] = "stage ";
294 if (stage == materialStage) {
295 UI_ExecuteConfunc("updatestagevalues %f %f %f %f %f %f %f %f %f %f %f %f %f %f",
296 stage->rotate.hz, stage->rotate.deg,
297 stage->stretch.hz, stage->stretch.dhz, stage->stretch.amp, stage->stretch.damp,
298 stage->pulse.hz, stage->pulse.dhz,
299 stage->scroll.ds, stage->scroll.dt, stage->scroll.s, stage->scroll.t,
300 stage->scale.s, stage->scale.t);
301 }
302 UI_MaterialEditorStagesToName(stage, stageName, sizeof(stageName) - 1);
303 LIST_AddString(&materialStagesList, stageName);
304 }
305 }
307}
308
314static int UI_MaterialEditorNameToStage (const char* stageName)
315{
317
318 while (md->name) {
319 if (!strncmp(md->name, stageName, strlen(md->name)))
320 return md->stageFlag;
321 md++;
322 }
323 return -1;
324}
325
326void uiMaterialEditorNode::onMouseDown (uiNode_t* node, int x, int y, int button)
327{
328 int id;
329 if (button != K_MOUSE1)
330 return;
331
333 if (id == -1)
334 return;
335
337 /* have we selected a new image? */
338 if (node->num != id) {
339 image_t* image = R_GetImageAtIndex(id);
340 UI_MaterialEditorUpdate(image, nullptr);
341
342 node->num = id;
343
344 if (node->onChange) {
345 UI_ExecuteEventActions(node, node->onChange);
346 }
347 if (node->lua_onChange != LUA_NOREF) {
349 }
350 }
351}
352
357{
358 node->num = -1;
359 updateView(node, true);
360}
361
365bool uiMaterialEditorNode::onScroll (uiNode_t* node, int deltaX, int deltaY)
366{
367 bool down = deltaY > 0;
368 const int diff = (down) ? 1 : -1;
369 if (deltaY == 0)
370 return false;
371 return scrollY(node, diff);
372}
373
374static void UI_MaterialEditorStart_f (void)
375{
376 /* material editor only makes sense in battlescape mode */
377#ifndef ANYIMAGES
378 if (cls.state != ca_active) {
379 Com_Printf("Material editor is only usable in battlescape mode\n");
380 UI_PopWindow();
381 return;
382 }
383#endif
384}
385
386static const value_t materialValues[] = {
387 {"bump", V_FLOAT, offsetof(material_t, bump), 0},
388 {"parallax", V_FLOAT, offsetof(material_t, parallax), 0},
389 {"specular", V_FLOAT, offsetof(material_t, specular), 0},
390 {"hardness", V_FLOAT, offsetof(material_t, hardness), 0},
391
392 {nullptr, V_NULL, 0, 0},
393};
394
395
396static const value_t materialStageValues[] = {
397 {"rotate.hz", V_FLOAT, offsetof(materialStage_t, rotate.deg), 0},
398 {"rotate.deg", V_FLOAT, offsetof(materialStage_t, rotate.hz), 0},
399 {"stretch.hz", V_FLOAT, offsetof(materialStage_t, stretch.hz), 0},
400 {"stretch.dhz", V_FLOAT, offsetof(materialStage_t, stretch.dhz), 0},
401 {"stretch.amp", V_FLOAT, offsetof(materialStage_t, stretch.amp), 0},
402 {"stretch.damp", V_FLOAT, offsetof(materialStage_t, stretch.damp), 0},
403 {"pulse.hz", V_FLOAT, offsetof(materialStage_t, pulse.hz), 0},
404 {"pulse.dhz", V_FLOAT, offsetof(materialStage_t, pulse.dhz), 0},
405 {"scroll.s", V_FLOAT, offsetof(materialStage_t, scroll.s), 0},
406 {"scroll.t", V_FLOAT, offsetof(materialStage_t, scroll.t), 0},
407 {"scroll.ds", V_FLOAT, offsetof(materialStage_t, scroll.ds), 0},
408 {"scroll.dt", V_FLOAT, offsetof(materialStage_t, scroll.dt), 0},
409 {"scale.s", V_FLOAT, offsetof(materialStage_t, scale.s), 0},
410 {"scale.t", V_FLOAT, offsetof(materialStage_t, scale.t), 0},
411 {"terrain.floor", V_FLOAT, offsetof(materialStage_t, terrain.floor), 0},
412 {"terrain.ceil", V_FLOAT, offsetof(materialStage_t, terrain.ceil), 0},
413 {"tape.floor", V_FLOAT, offsetof(materialStage_t, tape.floor), 0},
414 {"tape.ceil", V_FLOAT, offsetof(materialStage_t, tape.ceil), 0},
415 {"tape.center", V_FLOAT, offsetof(materialStage_t, tape.center), 0},
416 {"anim.frames", V_INT, offsetof(materialStage_t, anim.num_frames), 0},
417 {"anim.dframe", V_INT, offsetof(materialStage_t, anim.dframe), 0},
418 {"anim.dtime", V_FLOAT, offsetof(materialStage_t, anim.dtime), 0},
419 {"anim.fps", V_FLOAT, offsetof(materialStage_t, anim.fps), 0},
420 {"dirt.intensity", V_FLOAT, offsetof(materialStage_t, dirt.intensity), 0},
421 {"blend.src", V_INT, offsetof(materialStage_t, blend.src), 0},
422 {"blend.dest", V_INT, offsetof(materialStage_t, blend.dest), 0},
423
424 {nullptr, V_NULL, 0, 0},
425};
426
428{
429 image_t* image;
430 int id, stageType;
431 const char* var, *value;
432 size_t bytes;
433
434 if (Cmd_Argc() < 5) {
435 Com_Printf("Usage: %s <image index> <stage index> <variable> <value>\n", Cmd_Argv(0));
436 return;
437 }
438
439 id = atoi(Cmd_Argv(1));
441 Com_Printf("Given image index (%i) is out of bounds\n", id);
442 return;
443 }
444
445 var = Cmd_Argv(3);
446 value = Cmd_Argv(4);
447
448 image = R_GetImageAtIndex(id);
449
450 stageType = UI_MaterialEditorNameToStage(var);
451 if (stageType == -1) {
453 if (!val) {
454 Com_Printf("Could not find material variable for '%s'\n", var);
455 return;
456 }
457 Com_ParseValue(&image->material, value, val->type, val->ofs, val->size, &bytes);
458 } else {
459 materialStage_t* stage;
460 int stageID;
462
463 if (!val) {
464 Com_Printf("Could not find material stage variable for '%s'\n", var);
465 return;
466 }
467
468 stageID = atoi(Cmd_Argv(2));
469 if (stageID < 0 || stageID >= image->material.num_stages) {
470 Com_Printf("Given stage index (%i) is out of bounds\n", stageID);
471 return;
472 }
473
474 stage = UI_MaterialEditorGetStage(&image->material, stageID);
475 assert(stage);
476
477 stage->flags |= stageType;
478
479 Com_ParseValue(stage, value, val->type, val->ofs, val->size, &bytes);
480
481 /* a texture or envmap means render it */
482 if (stage->flags & (STAGE_TEXTURE | STAGE_ENVMAP))
483 stage->flags |= STAGE_RENDER;
484
485 if (stage->flags & (STAGE_TAPE | STAGE_TERRAIN | STAGE_DIRTMAP))
486 stage->flags |= STAGE_LIGHTING;
487 }
488
490}
491
493{
494 image_t* image;
495 int id, stageID;
496 materialStage_t* materialStage;
497
498 if (Cmd_Argc() < 3) {
499 Com_Printf("Usage: %s <image index> <stage index>\n", Cmd_Argv(0));
500 return;
501 }
502
503 id = atoi(Cmd_Argv(1));
505 Com_Printf("Given image index (%i) is out of bounds\n", id);
506 return;
507 }
508
509 image = R_GetImageAtIndex(id);
510
511 stageID = atoi(Cmd_Argv(2));
512 if (stageID < 0 || stageID >= image->material.num_stages) {
513 Com_Printf("Given stage index (%i) is out of bounds\n", stageID);
514 return;
515 }
516
517 materialStage = UI_MaterialEditorGetStage(&image->material, stageID);
518 UI_MaterialEditorUpdate(image, materialStage);
519}
520
522{
523 image_t* image;
524 int id, stageID;
525
526 if (Cmd_Argc() < 3) {
527 Com_Printf("Usage: %s <image index> <stage index>\n", Cmd_Argv(0));
528 return;
529 }
530
531 id = atoi(Cmd_Argv(1));
533 Com_Printf("Given image index (%i) is out of bounds\n", id);
534 return;
535 }
536
537 image = R_GetImageAtIndex(id);
538
539 stageID = atoi(Cmd_Argv(2));
540 if (stageID < 0 || stageID >= image->material.num_stages) {
541 Com_Printf("Given stage index (%i) is out of bounds\n", stageID);
542 return;
543 }
544
545 materialStage_t** const anchor = stageID == 0 ? &image->material.stages : &UI_MaterialEditorGetStage(&image->material, stageID - 1)->next;
546 materialStage_t* const s = *anchor;
547 *anchor = s->next;
548 Mem_Free(s);
549
550 image->material.num_stages--;
551
552 UI_MaterialEditorUpdate(image, nullptr);
553}
554
556{
557 material_t* m;
558 int id;
559
560 if (Cmd_Argc() < 2) {
561 Com_Printf("Usage: %s <image index>\n", Cmd_Argv(0));
562 return;
563 }
564
565 id = atoi(Cmd_Argv(1));
567 Com_Printf("Given image index (%i) is out of bounds\n", id);
568 return;
569 }
570
573 m->num_stages++;
574
575 /* append the stage to the chain */
576 if (!m->stages)
577 m->stages = s;
578 else {
579 materialStage_t* ss = m->stages;
580 while (ss->next)
581 ss = ss->next;
582 ss->next = s;
583 }
584
586}
587
589{
590 behaviour->name = "material_editor";
591 behaviour->extends = "abstractscrollable";
592 behaviour->manager = UINodePtr(new uiMaterialEditorNode());
593 behaviour->lua_SWIG_typeinfo = UI_SWIG_TypeQuery("uiMaterialEditorNode_t *");
594
596 Cmd_AddCommand("ui_materialeditor_removestage", UI_MaterialEditorRemoveStage_f, "Removes the selected material stage");
597 Cmd_AddCommand("ui_materialeditor_newstage", UI_MaterialEditorNewStage_f, "Creates a new material stage for the current selected material");
598 Cmd_AddCommand("ui_materialeditor_selectstage", UI_MaterialEditorSelectStage_f, "Select a given material stage");
599 Cmd_AddCommand("ui_materialeditor_changevalue", UI_MaterialEditorChangeValue_f, "Initializes the material editor window");
600 Cmd_AddCommand("ui_materialeditor", UI_MaterialEditorStart_f, "Initializes the material editor window");
601}
int down
Definition cl_input.cpp:66
@ K_MOUSE1
Definition cl_keys.h:46
memPool_t * vid_imagePool
Definition cl_main.cpp:88
client_static_t cls
Definition cl_main.cpp:83
@ ca_active
Definition cl_shared.h:80
Video driver defs.
bool scrollY(uiNode_t *node, int offset)
Scroll the Y scroll with a relative position, and call event if need.
bool setScrollY(uiNode_t *node, int viewPos, int viewSize, int fullSize)
Set the Y scroll to a position, and call event if need.
bool isSizeChange(uiNode_t *node)
return true if the node size change and update the cache
void onWindowOpened(uiNode_t *node, linkedList_t *params) override
Called when we push a window with this node.
void updateView(uiNode_t *node, bool reset)
Update the scrollable view.
void draw(uiNode_t *node) override
bool onScroll(uiNode_t *node, int deltaX, int deltaY) override
Called when the user wheel the mouse over the node.
void onMouseDown(uiNode_t *node, int x, int y, int button) override
Primary header for client.
const char * Cmd_Argv(int arg)
Returns a given argument.
Definition cmd.cpp:516
int Cmd_Argc(void)
Return the number of arguments of the current command. "command parameter" will result in a argc of 2...
Definition cmd.cpp:505
void Cmd_AddCommand(const char *cmdName, xcommand_t function, const char *desc)
Add a new command to the script interface.
Definition cmd.cpp:744
void Com_Printf(const char *const fmt,...)
Definition common.cpp:428
cvar_t * Cvar_Set(const char *varName, const char *value,...)
Sets a cvar value.
Definition cvar.cpp:615
const char * Cvar_GetString(const char *varName)
Returns the value of cvar as string.
Definition cvar.cpp:210
voidpf void uLong size
Definition ioapi.h:42
voidpf void * buf
Definition ioapi.h:42
void LIST_AddString(linkedList_t **listDest, const char *data)
Adds an string to a new or to an already existing linked list. The string is copied here.
Definition list.cpp:139
static struct mdfour * m
Definition md4.cpp:35
#define Mem_Free(ptr)
Definition mem.h:35
#define Mem_PoolAllocType(type, pool)
Definition mem.h:43
QGL_EXTERN GLint i
Definition r_gl.h:113
QGL_EXTERN GLuint * id
Definition r_gl.h:86
image_t * R_GetImageAtIndex(int i)
Returns an image pointer from the r_images linked list, as if r_images would be a plain contiguous ar...
Definition r_image.cpp:718
int r_numImages
Definition r_image.cpp:41
@ it_world
Definition r_image.h:54
#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_LIGHTING
Definition r_material.h:52
#define STAGE_TAPE
Definition r_material.h:44
#define STAGE_RENDER
Definition r_material.h:55
Brush model header file.
void R_ModReloadSurfacesArrays(void)
resultStatus_t Com_ParseValue(void *base, const char *token, valueTypes_t type, int ofs, size_t size, size_t *writtenBytes)
Parse a value from a string.
Definition scripts.cpp:656
@ V_FLOAT
Definition scripts.h:54
@ V_NULL
Definition scripts.h:49
@ V_INT
Definition scripts.h:52
Header for lua script functions.
#define MAX_VAR
Definition shared.h:36
void Q_strcat(char *dest, size_t destsize, const char *format,...)
Safely (without overflowing the destination buffer) concatenates two strings.
Definition shared.cpp:475
char name[MAX_QPATH]
Definition r_image.h:62
struct image_s * normalmap
Definition r_image.h:69
material_t material
Definition r_image.h:68
imagetype_t type
Definition r_image.h:63
materialStage_t * stages
Definition r_material.h:164
float parallax
Definition r_material.h:160
float hardness
Definition r_material.h:161
float specular
Definition r_material.h:162
scroll_t scroll
Definition r_material.h:140
rotate_t rotate
Definition r_material.h:139
stretch_t stretch
Definition r_material.h:138
struct materialStage_s * next
Definition r_material.h:147
float dhz
Definition r_material.h:81
float hz
Definition r_material.h:81
float deg
Definition r_material.h:73
float hz
Definition r_material.h:73
float s
Definition r_material.h:96
float t
Definition r_material.h:96
float ds
Definition r_material.h:92
float dt
Definition r_material.h:92
float t
Definition r_material.h:91
float s
Definition r_material.h:91
float hz
Definition r_material.h:86
float amp
Definition r_material.h:87
float dhz
Definition r_material.h:86
float damp
Definition r_material.h:87
node behaviour, how a node work
const char * name
void * lua_SWIG_typeinfo
UINodePtr manager
const char * extends
vec2_t size
Definition ui_nodes.h:52
Atomic structure used to define most of the UI.
Definition ui_nodes.h:80
LUA_EVENT lua_onChange
Definition ui_nodes.h:162
struct uiAction_s * onChange
Definition ui_nodes.h:143
vec4_t selectedColor
Definition ui_nodes.h:128
uiBox_t box
Definition ui_nodes.h:96
int padding
Definition ui_nodes.h:109
int num
Definition ui_nodes.h:111
size_t ofs
Definition scripts.h:170
size_t size
Definition scripts.h:171
valueTypes_t type
Definition scripts.h:169
vec_t vec2_t[2]
Definition ufotypes.h:38
void UI_ExecuteEventActions(uiNode_t *source, const uiAction_t *firstAction)
void UI_RegisterLinkedListText(int dataId, linkedList_t *text)
share a linked list of text with a data id
Definition ui_data.cpp:131
Data and interface to share data.
@ TEXT_MATERIAL_STAGES
Definition ui_dataids.h:65
bool UI_ExecuteLuaEventScript(uiNode_t *node, LUA_EVENT event)
Executes a lua event handler.
Definition ui_lua.cpp:71
Basic lua initialization for the ui.
void * UI_SWIG_TypeQuery(const char *name)
This function queries the SWIG type table for a type information structure. It is used in combination...
void UI_ExecuteConfunc(const char *fmt,...)
Executes confunc - just to identify those confuncs in the code - in this frame.
Definition ui_main.cpp:110
void UI_NodeAbsoluteToRelativePos(const uiNode_t *node, int *x, int *y)
Update an absolute position to a relative one.
Definition ui_node.cpp:604
void UI_GetNodeAbsPos(const uiNode_t *node, vec2_t pos)
Returns the absolute position of a node.
Definition ui_node.cpp:526
SharedPtr< uiNode > UINodePtr
#define EXTRADATA(node)
base code for scrollable node
static const vec3_t scale
static const value_t materialValues[]
static void UI_MaterialEditorNewStage_f(void)
static void UI_MaterialEditorChangeValue_f(void)
static void UI_MaterialEditorRemoveStage_f(void)
static const materialDescription_t materialDescriptions[]
void UI_RegisterMaterialEditorNode(uiBehaviour_t *behaviour)
static int UI_MaterialEditorNodeGetImageCount(uiNode_t *node)
return the number of images we can display
#define EXTRADATA(node)
static void UI_MaterialEditorStart_f(void)
static void UI_MaterialEditorSelectStage_f(void)
static int UI_MaterialEditorNameToStage(const char *stageName)
static void UI_MaterialEditorStagesToName(const materialStage_t *stage, char *buf, size_t size)
#define IMAGE_WIDTH
#define MARGIN
static void UI_MaterialEditorUpdate(image_t *image, materialStage_t *materialStage)
static materialStage_t * UI_MaterialEditorGetStage(material_t *material, int stageIndex)
static const value_t materialStageValues[]
static int UI_MaterialEditorNodeGetImageAtPosition(uiNode_t *node, int x, int y)
Return index of the image (r_images[i]) else nullptr.
Material editor related header.
const value_t * UI_FindPropertyByName(const value_t *propertyList, const char *name)
Find a value_t by name into a array of value_t.
Definition ui_parse.cpp:154
void UI_DrawRect(int x, int y, int w, int h, const vec4_t color, float lineWidth, int pattern)
Definition ui_render.cpp:42
void UI_DrawNormImage(bool flip, float x, float y, float w, float h, float sh, float th, float sl, float tl, const image_t *image)
Draw a normalized (to the screen) image.
void UI_PopWindow(bool all)
Pops a window from the window stack.