Horde3D http://www.horde3d.org/forums/ |
|
Horde Resource Generation Library http://www.horde3d.org/forums/viewtopic.php?f=6&t=614 |
Page 1 of 1 |
Author: | DarkAngel [ 19.01.2009, 12:08 ] |
Post subject: | Horde Resource Generation Library |
I've been writing some C++ code to generate Horde resource files from within some of my tools lately, and I was wondering if this code would be useful to someone - like a library for Horde tool programmers? I'm trying to keep this as simple as possible (no dependencies so far, not even Horde), so this is the kind of code I will be writing: Code: struct Material
{ struct TexUnit { std::string name; ubyte index; bool cube; bool useCompression; bool useFiltering; bool useMipMaps; bool repeat; }; struct Uniform { std::string name; float a,b,c,d; }; std::string className; std::string link; std::string shader; std::vector<TexUnit> textures; std::vector<Uniform> uniforms; }; std::ostream& operator<<( std::ostream& xml, const Material m ) { xml << "<Material class=\""<<m.className<<"\" link=\""<<m.link<<"\">\n"; xml << " <Shader source=\""<<m.shader<<"\"/>\n"; for( std::vector<Material::TexUnit>::const_iterator it = m.textures.begin(); it != m.textures.end(); ++it ) { xml << " <TexUnit unit=\""<<it->index<<"\" map=\""<<it->name<<"\" />\n"; } for( std::vector<Material::Uniform>::const_iterator it = m.uniforms.begin(); it != m.uniforms.end(); ++it ) { xml << " <Uniform name=\""<<it->name<<"\" a=\""<<it->a<<"\" b=\""<<it->b<<"\" c=\""<<it->c<<"\" d=\""<<it->d<<"\" />\n"; } xml << "</Material>\n"; } |
Author: | marciano [ 20.01.2009, 20:22 ] |
Post subject: | Re: Horde Resource Generation Library |
I recall several requests on dynamic resources, so I think many people would profit from your work! The code looks really simple and straightforward to use. |
Author: | swiftcoder [ 20.01.2009, 20:40 ] |
Post subject: | Re: Horde Resource Generation Library |
It would definitely be useful - currently I just access the engine directly from C++, and use the internal classes, but that won't work on Windows, where DLL-hell will erupt. |
Page 1 of 1 | All times are UTC + 1 hour |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |