1
0
Fork 0

Update README file to cover new 3D cloud commands.

This commit is contained in:
Stuart Buchanan 2011-04-23 22:23:08 +01:00
parent 4a8dba3af8
commit 53b1836ab3

View file

@ -1,9 +1,107 @@
Configuring 3D Clouds Configuring 3D Clouds
===================== =====================
3D clouds are configured using the file data/cloudlayers.xml. 3D clouds can be created in two ways:
- By placing individual clouds using a command (e.g. from Nasal)
- Using the global weather function, which reads cloud definition from
an XML file.
This file has 3 distinct sections: layers, cloud boxes and clouds, Placing Clouds Individually
===========================
Clouds are created using the "add-cloud" command, passing a property
node defining the location and characterstics of the cloud.
Location is defined by the following properties:
<layer> - The cloud layer number to add the cloud to. (default 0)
<index> - A unique identifier for the cloud in the layer. If a cloud
already exists with this index, the new cloud will not be
created, and 0 is returned.
<lon-deg> - Longitude to place the cloud, in degrees (default 0)
<lat-deg> - Latitude t place the cloud, in degrees (default 0)
<alt-ft> - Altitude to place the cloud, relative to the layer (!) in ft
(default 0)
<x-offset-m> - Offset in m from the lon-deg. +ve is south (default 0)
<y-offset-m> - Offset in m from the lat-deg. +ve is east (default 0)
The cloud itself is built up of a number of "sprites" - simple 2D textures
that are always rotated to be facing the viewer. These sprites are handled
by a OpenGL Shader - a small program that is run on your graphics card.
The cloud is defined by the following properties:
<min-cloud-width-m> - minimum width of the cloud in meters (default 500)
<max-cloud-width-m> - maximum width of the cloud (default min-cloud-width-m)
<min-cloud-height-m> - minimum height of the cloud (default min-cloud-width-m)
<max-cloud-height-m> - maximum height of the cloud (default max-cloud-width-m)
<texture> - texture file of sprites to use (default cl_cumulus.png)
<num-textures-x> - number of cloud textures defined horizontally in the
texture file (default 4)
<num-textures-y> - number of cloud textures defined vertically in the
texture file (default 4)
<num-sprites> - Number of sprite to generate for the cloud (default 20)
<bottom-shade> - Light multiplier for sprites at the bottom of the cloud
(default 1.0)
<min-sprite-width-m> - minimum width of the sprites used to create the cloud
(default 200)
<max-sprite-width-m> - maximum width of the sprites used to create the cloud
(default min-sprite-width-m)
<min-sprite-height-m> - minimum height of the spites used to create the cloud
(default min-sprite-width-m)
<max-sprite-height-m> - maximum height of the sprites used to create the cloud
(default max-sprite-height-m)
The texture to use for the sprites is defined in the <texture> tag.
To allow some variation, you can create a texture file containing multiple
sprites in a grid, and define the <num-textures-x/y> tags. The code
decides which texture to use for a given sprite : randomly in the x-direction
and based on the altitude of the sprite within the cloud in the y-direction.
Therefore, you should put sprite textures you want to use for the bottom of
your cloud at the bottom of the texture file, and those you want to use for
the top of the cloud at the top of the texture file.
For example, the following Nasal snippet will create a cloud immediately above the
aircraft at an altitude of 1000 ft above /environment/clouds/layer[0]/elevation-ft :
var p = props.Node.new({ "layer" : 0,
"index": 1,
"lat-deg": getprop("/position/latitude-deg"),
"lon-deg": getprop("/position/longitude-deg"),
"alt-ft" : 1000 });
fgcommand("add-cloud", p);
Moving Individual Clouds
========================
Clouds may be moved by using the "move-cloud" command. This takes the following
property arguments.
<layer> - The cloud layer number containing the cloud to move. (default 0)
<index> - The unique identifier of the cloud to move.
<lon-deg> - Longitude to place the cloud, in degrees (default 0)
<lat-deg> - Latitude t place the cloud, in degrees (default 0)
<alt-ft> - Altitude to place the cloud, relative to the layer (!) in ft
(default 0)
TODO: Add offset arguments for consistency with add-cloud.
Deleting Individual Clouds
===========================
Clouds may be deleted by using the "del-cloud" command. This takes the following
property arguments.
<layer> - The cloud layer number containing the cloud to delet. (default 0)
<index> - The unique identifier of the cloud to delete.
Global 3D Clouds
================
The global weather system uses sets of clouds defined in cloudlayers.xml
in your FG_ROOT.
The file has 3 distinct sections: layers, cloud boxes and clouds,
described below. described below.
Notes for those editing clouds: Notes for those editing clouds:
@ -23,41 +121,9 @@ Notes for those editing clouds:
Clouds Clouds
====== ======
The <clouds> section contains definitions of clouds themselves, built The cloud definitions are as described above for placing individual
up of a number of "sprites" - simple 2D textures that are always clouds, but no position information is used (this is defined in the
rotated to be facing the viewer. These sprites are handled by a OpenGL cloud box and layers below).
Shader - a small program that is run on your graphics card.
Sets of these clouds are be built up into bigger masses, described below.
Each cloud group has a completely user-defined name, and contains the
following tags.
<min-cloud-width-m> - minimum width of the cloud
<max-cloud-width-m> - maximum width of the cloud
<min-cloud-height-m> - minimum height of the cloud
<max-cloud-height-m> - maximum height of the cloud
<texture> - texture file of sprites to use
<num-textures-x> - number of cloud textures defined horizontally in the
texture file
<num-textures-y> - number of cloud textures defined vertically in the
texture file
<num-sprites> - Number of sprite to generate for the cloud
<bottom-shade> - Light multiplier for sprites at the bottom of the cloud.
<min-sprite-width-m> - minimum width of the sprites used to create the cloud
<max-sprite-width-m> - maximum width of the sprites used to create the cloud
<min-sprite-height-m> - minimum height of the spites used to create the cloud
<max-sprite-height-m> - maximum height of the sprites used to create the cloud
The texture to use for the sprites is defined in the XML <texture> tag.
To allow some variation, you can create a texture file containing multiple
sprites in a grid, and define the <num-textures-x/y> tags. The code
decides which texture to use for a given sprite : randomly in the x-direction
and based on the altitude of the sprite within the cloud in the y-direction.
Therefore, you should put sprite textures you want to use for the bottom of
your cloud at the bottom of the texture file, and those you want to use for
the top of the cloud at the top of the texture file.
Cloud Boxes Cloud Boxes
=========== ===========