On Wednesday 02 May 2012 07:55:19 Renk Thorsten wrote:
> > No, you got the system wrong.
> > When an effect inherits from another it "rewrites" those parts that are
> > common
> > between the two xml files, keeping the parts that are different.
>
> Yes, but what's wrong with making that conditional based on technique
> number? What functionality would this destroy? Or what is the use of the
> current setup in which higher techniques overwrite lower techniques?
>
> * Thorsten
>
Every other effect written so far.
Better explanation:
Think of the parent and the child effect as two property trees. At runtime
they get merged, with any paths in the child effect overwriting the same paths
in the parent, all under the heading of the child effect.
The lower techniques override higher techniques. The functionality is to
enable you to use different options in specific conditions that are present in
the <predicate> section of each technique. As you are using them in the
terrain effect.
It's not the effects that change at runtime between those specific conditions,
it's a different technique of the same effect that's used.
The default effects usually specify their techniques with higher numbers to
allow any inheriting effect to insert their own techniques below them,
techniques that get activated by the same condition.
Say you have shaders active, the default effect has a technique that specifies
some default shaders to be used. Now you make your own effect, but you want to
use different shaders in the same situation; in that case you add a lower
numbered technique in your new effect, that by the order of precedence (lower
numbers before higher numbers) trumps the technique used in the default, and
this new technique specifies the different set of shaders that you want.
By putting the sky-dome technique in a low enough place, you ensure that your
new technique will not be overwritten and will be lower placed than any other
in the child effects' trees, ensuring that those shaders are activated when
the sky-dome is active, and that they take precedence over less strict
conditions that would activate some other set of shaders/options in one of the
other effects. Keep in mind though, that they will then use the merged
parameters as they're specified in the child effect (this includes textures).
Important note: the *<texture n="x">* numbers in the parameters section can be
as high as you need them, but the *<texture-unit><unit>y</unit>* numbers in
the technique section should be kept <=7 as those are the actual texture units
as seen by the shader, and some impplementations oanly have 8 texture units
available. *y* and *x* don't have to match. In fact you can get very creative
and have 3 different *<texture n="x1">*, *<texture n="x2">*, *<texture
n="x3">* in the parameters section that are assigned to the same
*<unit>y</unit>*, each in a different technique, according to different
predicates.
Regards,
Emilian
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel