Game Development Community

TGEA material.cs Generator

by James Thompson · 02/16/2007 (5:19 pm) · 15 comments

Download Code File

TGEA material.cs generator, generates a materials file from textures in its current directory
I was fed up of doing these files so I wrote a generator.
I was going to post this as a tools resource but I wanted to upload it to the GG site to save time, so here it is

Source code soon :)


Known Issues:
-> You cant have a '.' in the texture name for example "te.st.jpg" is invalid

Future Development:
-> GUI (complete)
-> Custom options (shaders etc)
-> More file types
-> any ideas?


Versions:
V0.1 - Initial release, simple
v0.2 - Added a GUI
v0.3 - Bug fixes and an option to overwrite existing materials.cs files

#1
02/16/2007 (9:40 pm)
does this also work with interior?
#2
02/17/2007 (9:28 am)
of course it does...
Its a material.cs generator it doesnt say "Hey this is for interiors so Ill skip this". It just makes a materials.cs file from all images in its current directory.
#3
03/02/2007 (12:54 am)
Wow thanks for this tool. This is coming in handy already!!
#4
03/02/2007 (4:47 pm)
Glad to hear it :)
#5
03/04/2007 (12:20 pm)
This is a great resource! I'm using it for testing and it works great.

An idea for future development would be if a materials.cs file already exists, it checks if a material has already been defined and if not, create a definition for it. Otherwise, if it already exists it shouldn't overwrite it since the user might have made customizations on it. I know, not the easiest feature to implement but it would become much more usable.

Nick
#6
05/11/2007 (3:40 pm)
care to share your source with me ?

I would be happy to add a few things...email me if this interests you.
eb[at]fragstudios[dot]com
#7
05/11/2007 (5:03 pm)
yea sorry i keep meaning to re-write it in c++, will do over weekend
#8
05/18/2007 (11:42 pm)
No worries James. I am sure you have better things to do with your time besides translate code ;)

...a friend of mine and I started to write a small standalone app.
We are generating simple output right now...
// -------------------------------------
new Material([user_defined_prefix]+filename)
{
baseTex[0] = "filename";
bumpTex[0] = "filename+[user_defined_suffix]";
mapTo = "filename";
pixelSpecular[0] = true;
specular[0] = "1.0 1.0 1.0 0.1";
specularPower[0] = 32.0;
};
// -------------------------------------
We plan on utilizing all of TGEA's material functionality with a GUI that can append and edit the materials.cs files. We're planning a bit more as well but I don't want to get ahead of ourselves with words!
#9
05/19/2007 (12:56 pm)
Gd luk, whats wd be good is if u flew up to the building or wateva, right click it, select materials properties and then change it like that :D
#10
08/28/2007 (12:45 am)
Sorry for the long delay on this...it turns out that this project came to a screeching halt when I/we realized how poor the documentation on this topic 'is' and even worse -> the capabilities of the material system is short of what the docs explained.
*Needless to say...I am disappointed.

So until I learn the full functionalities of their ill-explained-material system...this is on hold for the power-user functionalities. Even after that I still have to convince my coding-buddy that it is worth-while-project.
Perhaps a scripted GUI instead....we'll see.

Sincere apologies to anyone that was in hoping/waiting...

P.S.:
If anyone has made a material with multiple layers doing different animation functions...plz post here.
I would be amazed to hear how you achieved this without HLSL.
AsI currently find that all animation layers inherit the base animated layer function.
#11
08/28/2007 (8:40 am)
Hey,

I have to admit the docs on TGEA arent really that good.

Im sure you could release a 0.1 version though, with basic functionality.
Or are you like me and dont like releasing till its at version 1?
#12
01/10/2008 (2:16 pm)
Yes, it was a dull job to create materials.cs manually. :/

But I suggest the right way to do that it let the exporter to generate material.cs file when it exports.

Anyway, thank you for your effort.

Good job. :-)
#13
03/01/2008 (7:16 pm)
My Gawd !
30 minutes ago I wrote my LAST materials.cs file in long-form ! It occurred to me to check if anyone out there felt the same as I and lo and behold Abydos did it !

Good job !
#14
03/02/2008 (10:22 am)
thx :)

Btw I have a new version which creates each material from a template, i.e. you type in:

new Material(TEXNAME)
{
// place
}

It will replace TEXNAME with the name of the material its currently processing and it will copy everything else...

Anyway I should have it uploaded soon.
#15
09/27/2008 (5:25 am)
Hi, if i want to affect transparency during game, ie by enabling and disabling the transparency in materials.cs how can i call the definition that it needs to use and switch between them, for example I currently have as follows;

new Material(player_norm)
{
mapTo = "player";
basetex[0] = "~/data/shapes/Alien/playerTrans";
translucent = false;
};

new Material(player_trans)
{
mapTo = "player";
basetex[0] = "~/data/shapes/Alien/playerTrans";

translucent = true;
};


Also if it can't be done this way, is there another way you could suggest?