About Store Forum Documentation Contact



Post Reply 
Suggestions anyone?
Author Message
JonathonA Offline
Member

Post: #1
Suggestions anyone?
Hey everyone, run across a problem that I am having trouble solving.

Basically I am implementing the day/night cycle and had a quick look over the demo code which is great but for our game I have several environment text files for different points in time (6am, 12pm, 6pm, 12am).

I know how to load the files and get the values out of them, but I am having a problem figuring out how to blend (interpolate) or step between the values from each environment file. Heres an example from the 12pm and 6pm environment files.

Code:
Sun // 12pm
{
...
RaysColor = "0.537, 0.416, 0.176, 1.000"
}

Sun // 6pm
{
...
RaysColor = "0.856, 0.682, 0.337, 1.000"
}

As you can see I can't linearly step between the two, can I even do this using say Lerp functions? I know that Lerp(...) has Vec parameters but the step for each value in the Vec will be different so I didn't think I could use Lerp?

Has anyone got any recommendations on how I can solve this?
(This post was last modified: 02-24-2012 12:11 AM by JonathonA.)
02-24-2012 12:09 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Zervox Offline
Member

Post: #2
RE: Suggestions anyone?
Lerp between two vecs, lerps the values of their members, eg
vec.x is lerped with vec2.x so the end result will be the same anyways the lerp will continue untill everyone has gotten their final lerped value.

Sun.color=Lerp(sun.color,RaysColor,timestep);
02-24-2012 03:16 AM
Find all posts by this user Quote this message in a reply
JonathonA Offline
Member

Post: #3
RE: Suggestions anyone?
Right I see; thank you Zervox I will try that. Also, if I have a seperate EnvironmentOptions variable that stores the next time environment settings (say 6pm as in my example), to get the values from it do I have to call toGui() and then access prop variables? You see I don't want to apply it to the Gui, I just want to get the values without changing the current display settings.
(This post was last modified: 02-25-2012 12:45 PM by JonathonA.)
02-24-2012 11:27 PM
Visit this user's website Find all posts by this user Quote this message in a reply
JonathonA Offline
Member

Post: #4
RE: Suggestions anyone?
Dont think my last message made a lot of sense; I know how to populate an EnvironmentOptions variable with values from a file, I just don't know how to get the values without changing the current display settings.
02-25-2012 10:38 PM
Visit this user's website Find all posts by this user Quote this message in a reply
EthanC Offline
Member

Post: #5
RE: Suggestions anyone?
Bump. Jon and I have a deadline coming up and were hoping for a chance we might have this working before there.
(This post was last modified: 02-27-2012 12:34 AM by EthanC.)
02-27-2012 12:33 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #6
RE: Suggestions anyone?
EnvironmentOptions class is provided as a means of helpful source code allowing to extract the data from the file, however for actual game I recommend that you use you're own c++ class for management of display settings.
02-27-2012 11:56 AM
Find all posts by this user Quote this message in a reply
yvanvds Offline
Member

Post: #7
RE: Suggestions anyone?
It's not exactly what you need, but maybe this can help: http://www.esenthel.com/community/showth...p?tid=4573
02-29-2012 06:35 PM
Find all posts by this user Quote this message in a reply
JonathonA Offline
Member

Post: #8
RE: Suggestions anyone?
Hey yvanvds thanks for that I'm sure it will come in handy smile

Got most of it working now; I was wondering though, assuming the EnvironmentOptions code uses EEs FileText class and methods, why are vectors and float values surrounded in quotes in environment.txt files? Doesn't that imply they are a string and not a value so when you use methods like f.getVec4() you will have to convert it?
(This post was last modified: 03-05-2012 05:41 PM by JonathonA.)
03-05-2012 02:31 PM
Visit this user's website Find all posts by this user Quote this message in a reply
JonathonA Offline
Member

Post: #9
RE: Suggestions anyone?
Okay so ran a few quick tests with the FileText get(...) methods and as suspected the quotes in the environment.txt files means the getReal(), getVec() methods don't work. What am I missing? I'd rather not have our world designer set environment settings in the Editor, save them, then have to strip out all the quotes for my custom loader to pick out all the values; yes we can do that but seems stupid since the Edit::EnvironmentOptions.loadText(...) method can handle it.
03-06-2012 08:16 PM
Visit this user's website Find all posts by this user Quote this message in a reply
JonathonA Offline
Member

Post: #10
RE: Suggestions anyone?
So apparently I overlooked the fact that the String class has operators provided for conversion between numerical data types and String (my bad) but I am still unsure as to how to read the following using FileText methods:

LightsColor = "0.000, 0.000, 0.000, 0.000"

f.get(...) doesn't work, neither does f.getVec().
(This post was last modified: 03-11-2012 12:12 PM by JonathonA.)
03-11-2012 11:53 AM
Visit this user's website Find all posts by this user Quote this message in a reply
yvanvds Offline
Member

Post: #11
RE: Suggestions anyone?
Seems like one step too many, but perhaps:

Str temp;
f.getStr(temp);
Color lightsColor = TextColor(temp);
03-11-2012 01:11 PM
Find all posts by this user Quote this message in a reply
JonathonA Offline
Member

Post: #12
RE: Suggestions anyone?
Aha thank you yvanvds they were the sort of functions I was looking for and couldn't find them in the brief searches I made smile

Certainly looks like the only way to accomplish it at present.
If you use FileText instead of File then TextColor(f.getName()) is a way of handling the quoted values also; again seems like one step too many.
(This post was last modified: 03-11-2012 11:37 PM by JonathonA.)
03-11-2012 11:20 PM
Visit this user's website Find all posts by this user Quote this message in a reply
yvanvds Offline
Member

Post: #13
RE: Suggestions anyone?
I just looked again at the code i posted before (the environment system) and it seems I do it like this:

if (f.cur("mapcolor")) {
f.get(mapColor);
continue;
}

where f is a FileText and mapColor a Color. But my file is like this:

mapcolor = 255, 255, 255, 255

So without quotes.

Edit: Oh, sorry. Now I remember the whole point was doing it WITH quotes :-)
(This post was last modified: 03-12-2012 01:08 AM by yvanvds.)
03-12-2012 01:06 AM
Find all posts by this user Quote this message in a reply
JonathonA Offline
Member

Post: #14
RE: Suggestions anyone?
Haha its no problem yvanvds wink
03-12-2012 01:20 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply