Howto:Shader programming in FlightGear: Difference between revisions

add property tree verbiage
(add property tree verbiage)
Line 390: Line 390:
  </als-secondary-lights>
  </als-secondary-lights>
</syntaxhighlight>
</syntaxhighlight>
They show up in the Property Tree under sim/rendering/als-secondary-lights and can be activated or manipulated by normal [[Nasal|Nasal]] calls or [[Xml|XML]].
They show up in the [[Property Tree]] under sim/rendering/als-secondary-lights and can be activated or manipulated by normal [[Nasal|Nasal]] calls or [[Xml|XML]].


=== Property Tree ===
The [[Property Tree]] is like the CPU of the [[FlightGear]] program at a user level. It's a go-between that allows the user to see and influence many aspects at the heart of the program in ALMOST real time. More of the internals of [[FlightGear]] are being exposed to the [[Property Tree]] than ever before. This allows us to have user level access in areas of the code that used to only be reserved for [[Programming Resources|programmers]]. Because of the manner in which the [[Property Tree]] is fed information, and the one step removed from the C source, care must be taken in how it is used. Depending on how it is used it won't be as responsive to manipulation as it would be if you were to change the same information at the C source level.
=== Effects File ===
=== Effects File ===
The effects file is the mechanism we use to combine and manipulate all the necessary data to create stunning visual effects. It's the link between the data contained and produced in [[Nasal|Nasal]], [[Xml|XML]] and the Property Tree and the graphics rendering pipeline. It's there to allow us to create these affects without having to know or use the C++ code base. Its flexible framework allows for an almost infinite range of sophisticated effects.
The effects file is the mechanism we use to combine and manipulate all the necessary data to create stunning visual effects. It's the link between the data contained and produced in [[Nasal|Nasal]], [[Xml|XML]] and the [[Property Tree]] and the graphics rendering pipeline. It's there to allow us to create these affects without having to know or use the C++ code base. Its flexible framework allows for an almost infinite range of sophisticated effects.


==== Parameters ====
==== Parameters ====
Parameter entries defined in the Effect file correspond to a property tree data container (static or variable). They will contain the data needed by the shader program to perform its magic. The type of information contained in the property tree might be program control data or variable/static data that the shader program can manipulate prior to sending on to render.
Parameter entries defined in the Effect file correspond to a [[Property Tree]] data container (static or variable). They will contain the data needed by the shader program to perform its magic. The type of information contained in the [[Property Tree]] might be program control data or variable/static data that the shader program can manipulate prior to sending on to render.
In the case of ALS Lights, below is some of the data passed to, and used by, the shader program.
In the case of ALS Lights, below is some of the data passed to, and used by, the shader program.
<syntaxhighlight lang="xml">
<syntaxhighlight lang="xml">
Line 415: Line 418:
</syntaxhighlight>
</syntaxhighlight>


Note the "use-searchlight" entry, it is pointing to the use-searchlight entry in the property tree under "sim/rendering/als-secondary-lights" that was defined in preferences.xml.
Note the "use-searchlight" entry, it is pointing to the use-searchlight entry in the [[Property Tree]] under "sim/rendering/als-secondary-lights" that was defined in preferences.xml.


Some of this data may play a duel role inside the shader program. In other words it might be used to control other functions in addition to ALS Lights.
Some of this data may play a duel role inside the shader program. In other words it might be used to control other functions in addition to ALS Lights.
Line 627: Line 630:
  }
  }
</syntaxhighlight>
</syntaxhighlight>
Note how "use_searchlight" is used in the main function to determine if the property defined in preferences.xml and manipulated in the property tree is set to true or 1.
Note how "use_searchlight" is used in the main function to determine if the property defined in preferences.xml and manipulated in the [[Property Tree]] is set to true or 1.


Some of the variable data contained in the shader program is used for other purposes and is introduced into the shader program from other property, parameter and uniform definitions not pertaining to ALS Lights.
Some of the variable data contained in the shader program is used for other purposes and is introduced into the shader program from other property, parameter and uniform definitions not pertaining to ALS Lights.
330

edits