[Gtkradiant] working on a plugin, need some advice
Joseph, William
gtkradiant@zerowing.idsoftware.com
Mon, 20 Oct 2003 10:22:02 +0100
This may not help you write the plugin =3D).
I think your problem illustrates a design problem with the LoadImage =
API.
I suggest we decouple the image-loading from the VFS.
We could change the LoadImage API from..
void LoadImage(const char* filename, ... )
to..
RGBAImage* LoadImage(InputStream& inputstream, unsigned int size)
so you can do..
file_t file =3D vfsLoadFile(relative_filename);
if(file.size > 0)
{
RGBAImage* image =3D LoadImage(file.stream, file.size);
}
or..
FileInputStream filestream(absolute_filename);
LoadImage(filestream, size);
and LoadJPG does...
{
char* buffer =3D new char[size];
inputstream.read(buffer, size);
return LoadJPGBuff(buffer, ...);
}
-SPoG
-----Original Message-----
From: Reed Mideke [mailto:rfm@collectivecomputing.com]
Sent: 20 October 2003 00:02
To: gtkradiant@zerowing.idsoftware.com
Subject: [Gtkradiant] working on a plugin, need some advice
*This message was transferred with a trial version of CommuniGate(tm) =
Pro*
I'm working on a plugin for this feature:
http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=3D88
"loading a background image in the 2D view to use as a layout"
I have the basic functionality working:
http://www.splashdamage.com/forums/viewtopic.php?t=3D4765
Now I'm trying to clean it up and make is user friendly.
Currently, it uses m_pfnLoadImage from radiant to load the
background. This is handy, since it means I don't have to
write any loading code, and users have plenty of format choices.
The downside is, as far as I can tell, this will only load the
file from the under the game directory (main, baseq3 etc) or
a .pk3 file. That means that if I use a standard file dialog,
I would have to munge the path, and users might browse outside
of the the usable directories.
It sure would be nice if there was a way to tell VFS 'it is OK
to try an absolute path first'
Any suggestion on a good way around that ?
Another issue with the plugin is that it renders after
everything else in the 2d window, so it is not really a
proper background image. I get around this by having user
selectable alpha, as well as allowing the use of the
images own alpha channel.
Blending works reasonably well, but it would be faster and more
convenient to have the background image just get rendered at the
very start of the 2d windows stuff. I don't see any way to do
that without either putting it in the radiant core, or adding
another point to hook into.
Thanks in advance for any advice.
--=20
Email: rfm(at)collectivecomputing.com or rfm(at)portalofevil.com
Home page: http://www.collectivecomputing.com/rfm
_______________________________________________
Gtkradiant mailing list
Gtkradiant@zerowing.idsoftware.com
http://zerowing.idsoftware.com/mailman/listinfo/gtkradiant