Overrides in Ogre compilers
In case no one knew, I’m a developer on the Ogre library. If you are anywhere near interested in 3D graphics I suggest you check it out.
My most major contribution has been new compilers to handle the scripting interfaces for a lot of Ogre’s resources. As Ogre nears a new stable release (1.6, Shoggoth), the team is trying to finalize the features in HEAD.
A community member (hellcatv, on the Ogre forums) submitted a patch recently that enabled more powerful object overriding. This, along with my work to include variables are making Ogre’s script the most powerful resource scripts out there (easily better than fx, cgfx or equivalent formats). Here’s an example:
material Test1
{
technique
{
pass
{
ambient 1 1 0 1
}
pass
{
ambient 1 0 1 1
}
}
}
material Test2 : Test1
{
technique *
{
pass *
{
ambient 0 0 0 1
}
}
}
Test2 will now contain the 2 passes inherited from Test1, but the ambient property in both passes will be set to “0 0 0 1″. The match is wildcard bases (so it supports more complicated syntax than just *), so you can have some pretty advanced overriding behavior. The above can also be achieved using variables, but this form of overriding has other uses as well. If, later on, the base material is changed to include another technique (perhaps to support lower-end hardware) the wildcard override will catch that technique as well. This makes your scripts more robust to changes within the hierarchy. It also allows you to override materials that perhaps weren’t set up for customization (by providing variables for you change). You can override properties in more objects with less code.
No comments