MDL: evaluating or changing Color Objects

Discussion area for user-created Allegiance models, textures, voicechats, music, and other ingame content.
Bunnywabbit
Posts: 965
Joined: Sun May 15, 2005 7:00 am
Location: Amsterdam, the Netherlands

Post by Bunnywabbit »

Hi,

Im wondering if it's possible to change or evaluate color objects in mdl.

a color object is created like this:

Code: Select all

//without Alpha Channel
White = 
    ColorA(1,1,1)
    
//With Alpha Channel
WhiteOpaque =     
    ColorA(1,1,1,1)
    
WhiteSemiTransparent = 
    ColorA(1,1,1,0.5)
Now what i would like to know is whether it's possible to either
a) call the hudColor, and make it more transparent
b) evaluate the hudcolor, and pick a more transparent color.
c) evaluate mayebe some other property relating to the teamcolor, and change/pick a color based on that.

is there a way to do either of these things?

i promise to wikify everything i'm discovering while testing :)
ImageImage current version r158 new beta as of jan 23 2012
KGJV
Posts: 1474
Joined: Tue Jul 01, 2003 7:00 am
Location: Transilvania

Post by KGJV »

Question not clear... Are you referring to the hudColor variable that is defined in the "gamepanes" namespace ?
Image
Bunnywabbit
Posts: 965
Joined: Sun May 15, 2005 7:00 am
Location: Amsterdam, the Netherlands

Post by Bunnywabbit »

Yes, that hudColor is one color object in particular i want to mess with, yes.
ImageImage current version r158 new beta as of jan 23 2012
KGJV
Posts: 1474
Joined: Tue Jul 01, 2003 7:00 am
Location: Transilvania

Post by KGJV »

Bunnywabbit wrote:QUOTE (Bunnywabbit @ Apr 19 2010, 01:37 PM) Yes, that hudColor is one color object in particular i want to mess with, yes.
I thought so. Unfortunately this requires code change as its value is updated every frame to the same fixed value (it shouldn't and the original developers knew about this but left this that way).

the value is computed from team color like this (from DoTrekUpdate() method in WinTrek.cpp)

Code: Select all

            //NYI this should only be done once or on a side change
            const float alpha = 0.75f;

            IsideIGC* pside = trekClient.GetShip()->GetSide();
            assert (pside);
            Color   colorHUD = pside->GetColor();
            colorHUD = colorHUD * g_hudBright;
            colorHUD.SetAlpha(alpha);
            m_pcolorHUD->SetValue(colorHUD);
g_hudBright is a constant set 0.85

so basically the value is m_pcolorHUD = color of team * 0.85 with alpha set to 0.75.

m_pcolorHUD is then exported to MDL namespace as 'hudColor'

so

Code: Select all

hudColor = ColorA(0.85*TeamR, 0.85*TeamG, 0.85*TeamB, 0.75)
We need to change code so it's not updated every frame if you wanna play with it.

Ideally we should let the MDL define its value not the code (use GetSideColor() to get team color).
Image
Bunnywabbit
Posts: 965
Joined: Sun May 15, 2005 7:00 am
Location: Amsterdam, the Netherlands

Post by Bunnywabbit »

Ok, so using GetSideColor(Me, OnMeChange) would make more sense in that respect, right?

What if I wanted to do a similar operation on my own colorobject? Say i use GetSideColor and i want it darker. Could I do that?
ImageImage current version r158 new beta as of jan 23 2012
KGJV
Posts: 1474
Joined: Tue Jul 01, 2003 7:00 am
Location: Transilvania

Post by KGJV »

You lost me here ...

hudColor or GetSideColor are just variables/functions defined by the 'code' (allegiance.exe) so you can use them in 'UI scripts' (mdl files).

if you don't like their values you can always write your own mdl code to set whatever values you want.

But since hudColor value is updated by the code every frame, you'll have to change 'hudColor' everywhere it appears with your own variable name (or expression).

GetSideColor is a function so its value is computed every time it's called.
Last edited by KGJV on Mon Apr 19, 2010 1:10 pm, edited 1 time in total.
Image
Bunnywabbit
Posts: 965
Joined: Sun May 15, 2005 7:00 am
Location: Amsterdam, the Netherlands

Post by Bunnywabbit »

yeah, but i'm too noob to figure out if a given hudColor or getSideColor is yellow, blue, purple or green.

in other words: could i grab a colorobject from getsidecolor, and from that colorobject, discover which teamcolor i'm on. Or maybe there's a cleverer way of figuring that out?

It's not critical, i'm just curious.
ImageImage current version r158 new beta as of jan 23 2012
KGJV
Posts: 1474
Joined: Tue Jul 01, 2003 7:00 am
Location: Transilvania

Post by KGJV »

Bunnywabbit wrote:QUOTE (Bunnywabbit @ Apr 19 2010, 02:54 PM) yeah, but i'm too noob to figure out if a given hudColor or getSideColor is yellow, blue, purple or green.

in other words: could i grab a colorobject from getsidecolor, and from that colorobject, discover which teamcolor i'm on. Or maybe there's a cleverer way of figuring that out?

It's not critical, i'm just curious.
"discover which teamcolor i'm on" is what i don't get. Why would you need that ?

you're in the 'MDL world', you can only do MDL stuff in there. Do you need the team number ? if so what for ? or do you need to perform a test based on team color ? if so what for ? etc
Image
Bunnywabbit
Posts: 965
Joined: Sun May 15, 2005 7:00 am
Location: Amsterdam, the Netherlands

Post by Bunnywabbit »

Well part of the idea is to have all the elements in the HUD assume the appropriate team color. So if you're blue, your HUD is blue, if you're yellow it's yellow, etc.

Letting Mdl 'color in' one set of HUD-elements (including gauges) is by far my preferred method. But if i can't dynamically color gauges with the team color, i may have to create 4+ sets of images to create the appropriate HUD, should i decide to go forward with it. The only way i can have the mdl file select the appropriate set, is if i have some way of determining what team we're on. I couldn't find any other reference to the team besides the color so i figured i'd have to use that.

as of yet i don't really have much concept art available, as i'm just poking around and seeing what's possible.

As you'd probably guess from my previous endeavours, there is a lot of transparency involved.
ImageImage current version r158 new beta as of jan 23 2012
KGJV
Posts: 1474
Joined: Tue Jul 01, 2003 7:00 am
Location: Transilvania

Post by KGJV »

Since there is no 'if', you need to use a switch (SwitchString, SwitchImage or SwitchPane).

But any switch variant requires tested value to be a number not a color so you need to get the team number instead of team color. Kinda a dead end.

Some kind of "getSideNumber" function is missing. (returns 0 if noat, 1 if team 1, 2 if team 2, etc)

Another thing in the TODO list I guess ;)

you should (or someone else) start making a list of missing stuff so I can work on coding these.
Image
Post Reply