PDA

View Full Version : Animation Shaders not working in the Main menu


Subject452
07-21-2002, 09:58 AM
Im trying to make some shader animations for the main menu (animap).

So i made a shader file named myshader.shader and placed it in the shaders dir with the content:

shaders/myshader
{
{
animmap 0.5 textures/aap/screen02.tga textures/aap/screen01.tga
textures/aap/screen05.tga
textures/aap/screen03.tga
textures/aap/screen04.tga
textures/aap/screen06.tga
textures/aap/screen09.tga
textures/aap/screen10.tga
}
}

Then i tested it with q3ace and it works, then i made a new itemdef in main.menu under the menu1 entry for the main menu background like this:

// animap Test
itemDef
{
name animap_pic
group none
style WINDOW_STYLE_SHADER
rect 0 0 140 180
asset_shader "shaders/myshader"
forecolor 1 1 1 1
visible 1
decoration
}

offcourse i placed the screen01,02 etc in the directory specified in the shader file.

What it does now is draw a BLANK screen in the defined rectangle of 140 180 (the blank screen u get when it cant find the shader), so what i did i also placed the contents of myshader.shader at the bottom of ui.shader, but that got the same effect then i tried adjusting the asset_shader string to the following things:

"shaders/myshader.shader"
"myshader"
"myshader.shader"

but all gave the same effect, there are no other examples in the .menu files of calling a asset_shader only examples of calling asset_model. However the code for calling a shader through a menu file is defined in the uicode, this the code for it:

// asset_shader <string>
qboolean ItemParse_asset_shader( itemDef_t *item, int handle ) {
const char *temp;

if (!PC_String_Parse(handle, &temp)) {
return qfalse;
}
item->asset = DC->registerShaderNoMip(temp);
return qtrue;
}

and in the itemParseKeywords table:

{"asset_shader", ItemParse_asset_shader, NULL },


Offcourse i tested it all by making a good working pk3 file of it all.
Has anyone else tried this before????? what am i overseeing or doing wrong?

Commodus
07-22-2002, 12:16 AM
This is a very wild stab in the dark, but are the tga files meant to cached?

Also (another stab in the dark) nstead of using shaders, you might want to use ROQ files (I think you add "cinematic xx.roq" where xx is the name of the ROQ file)...

Sorry if that didn't help, I am not good with coding but I'm trying to learn....

Subject452
07-22-2002, 03:20 AM
Atleast a reply =), thanks, i'll give it a try ASAP

Tchouky
07-22-2002, 07:18 AM
you can also use ownerdraw and display the shader from within the ui code, check the ui_main.c for ownerdraw.
and then create a new menu def and in the big switch add your's and then draw it with :
UI_DrawHandlePic
that should make it .
i used it to draw my rgb visualisation box in my mod but i think it could work for you.

Subject452
07-22-2002, 10:56 AM
i think u mean Item def instead of menudef, so what i need todo is something like the following:

case UI_ANIMAP_TEST:
UI_DrawAnimap(&rect, scale, color, textStyle, ui????, 1, 2, iMenuFont);
break;

in the ownerdraw function, and then make a item def in main.menu and call it like this ownerdraw "ui_animap_test"

did i understood correct?