15bd8deadSopenharmony_ciXXX - Not complete yet!!! 25bd8deadSopenharmony_ciName 35bd8deadSopenharmony_ci 45bd8deadSopenharmony_ci SGIX_fog_layers 55bd8deadSopenharmony_ci 65bd8deadSopenharmony_ciName Strings 75bd8deadSopenharmony_ci 85bd8deadSopenharmony_ci GL_SGIX_fog_layers 95bd8deadSopenharmony_ci 105bd8deadSopenharmony_ciVersion 115bd8deadSopenharmony_ci 125bd8deadSopenharmony_ci $Date: 1999/03/30 23:13:43 $ $Revision: 1.14 $ 135bd8deadSopenharmony_ci 145bd8deadSopenharmony_ciNumber 155bd8deadSopenharmony_ci 165bd8deadSopenharmony_ci ?? 175bd8deadSopenharmony_ci 185bd8deadSopenharmony_ciDependencies 195bd8deadSopenharmony_ci 205bd8deadSopenharmony_ci OpenGL 1.2 is required 215bd8deadSopenharmony_ci 225bd8deadSopenharmony_ciOverview 235bd8deadSopenharmony_ci 245bd8deadSopenharmony_ci This extension adds support for layered fog. The layers are 255bd8deadSopenharmony_ci specified using a density profile of the fog with respect to the 265bd8deadSopenharmony_ci elevation using "control" points to represent (elevation, density) 275bd8deadSopenharmony_ci tuples. The density is assumed to vary linearly between successive 285bd8deadSopenharmony_ci control point elevations. The maximum number of such points is 295bd8deadSopenharmony_ci implementation dependent. 305bd8deadSopenharmony_ci 315bd8deadSopenharmony_ci 325bd8deadSopenharmony_ciNew Procedures and Functions 335bd8deadSopenharmony_ci 345bd8deadSopenharmony_ci void FogLayersSGIX(sizei n, const float *points); 355bd8deadSopenharmony_ci 365bd8deadSopenharmony_ci void GetFogLayersSGIX(float *points); 375bd8deadSopenharmony_ci 385bd8deadSopenharmony_ciIssues 395bd8deadSopenharmony_ci 405bd8deadSopenharmony_ci * Should the API present the abstraction of layers to the user ? Or 415bd8deadSopenharmony_ci is this density profile specification good enough ? The problem 425bd8deadSopenharmony_ci with abstracting layers is to guarantee consistency of densities 435bd8deadSopenharmony_ci and elevations when each layer can be manipulated independently of 445bd8deadSopenharmony_ci others! 455bd8deadSopenharmony_ci 465bd8deadSopenharmony_ciNew Tokens 475bd8deadSopenharmony_ci 485bd8deadSopenharmony_ci Accepted by the <pname> parameter of Fogf, Fogi, Fogiv, Fogfv, 495bd8deadSopenharmony_ci GetBooleanv, GetDoublev, GetIntegerv, and GetFloatv: 505bd8deadSopenharmony_ci 515bd8deadSopenharmony_ci FOG_TYPE_SGIX 0x8323 525bd8deadSopenharmony_ci 535bd8deadSopenharmony_ci Accepted by the <param> parameter of Fogf and Fogi, and by the 545bd8deadSopenharmony_ci <params> parameter of Fogiv and Fogfv, when their <pname> 555bd8deadSopenharmony_ci parameter is FOG_TYPE_SGIX: 565bd8deadSopenharmony_ci 575bd8deadSopenharmony_ci UNIFORM_SGIX 0x8324 585bd8deadSopenharmony_ci LAYERED_SGIX 0x8325 595bd8deadSopenharmony_ci 605bd8deadSopenharmony_ci Accepted by the <pname> parameter of Fogfv, Fogiv, GetBooleanv, 615bd8deadSopenharmony_ci GetDoublev, GetIntegerv, and GetFloatv: 625bd8deadSopenharmony_ci 635bd8deadSopenharmony_ci FOG_GROUND_PLANE_SGIX 0x8326 645bd8deadSopenharmony_ci 655bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetBooleanv, GetDoublev, 665bd8deadSopenharmony_ci GetIntegerv, and GetFloatv: 675bd8deadSopenharmony_ci 685bd8deadSopenharmony_ci FOG_LAYERS_POINTS_SGIX 0x8327 695bd8deadSopenharmony_ci MAX_FOG_LAYERS_POINTS_SGIX 0x8328 705bd8deadSopenharmony_ci 715bd8deadSopenharmony_ciAdditions to Chapter 2 of the 1.2 Specification (OpenGL Operation) 725bd8deadSopenharmony_ci 735bd8deadSopenharmony_ci None 745bd8deadSopenharmony_ci 755bd8deadSopenharmony_ciAdditions to Chapter 3 of the 1.2 Specification (Rasterization) 765bd8deadSopenharmony_ci 775bd8deadSopenharmony_ci 3.10 Fog 785bd8deadSopenharmony_ci 795bd8deadSopenharmony_ci In addition to uniform fog density, fog layers can be specified. 805bd8deadSopenharmony_ci The implementation technique that is used to interpolate the 815bd8deadSopenharmony_ci density between successive fog layers is implementation dependent. 825bd8deadSopenharmony_ci The density profile of the fog with respect to elevation is 835bd8deadSopenharmony_ci specified by calling FogLayersSGIX with <points> 845bd8deadSopenharmony_ci pointing at an array of pairs of floating point values, and <n> set 855bd8deadSopenharmony_ci to the number of value pairs in <points>. The first value of each 865bd8deadSopenharmony_ci value pair in <points> specifies the elevation (should not be 875bd8deadSopenharmony_ci negative), and the second value specifies the fog density at that 885bd8deadSopenharmony_ci elevation. The fog density values are clamped to the range [0.0, 895bd8deadSopenharmony_ci 1.0]. The elevations in the specification of the density profile 905bd8deadSopenharmony_ci must be monotonically increasing. At least one point must be 915bd8deadSopenharmony_ci specified. The first point in the distribution must have an 925bd8deadSopenharmony_ci elevation of zero. The maximum number of points is implementation 935bd8deadSopenharmony_ci dependent and may be enquired using Get commands. The initial 945bd8deadSopenharmony_ci state of the fog layer specification is defined by the single 955bd8deadSopenharmony_ci point (0.0, 0.0). The fog density above the maximum user-specified 965bd8deadSopenharmony_ci elevation is the density value in the last point in the profile. 975bd8deadSopenharmony_ci Layered fog computations are defined only for positive elevations; 985bd8deadSopenharmony_ci negative elevations result in switching back to uniform range fog model. 995bd8deadSopenharmony_ci 1005bd8deadSopenharmony_ci The elevation of any eye-space point A = (x, y, z, w) is defined 1015bd8deadSopenharmony_ci as the distance from the ground plane specified using glFog and 1025bd8deadSopenharmony_ci FOG_GROUND_PLANE_SGIX. Let the ground plane be defined by a 1035bd8deadSopenharmony_ci four-component plane equation in object-coordinates 1045bd8deadSopenharmony_ci 1055bd8deadSopenharmony_ci G = (a, b, c, d). 1065bd8deadSopenharmony_ci 1075bd8deadSopenharmony_ci where a, b, c and d are specified in order in the <params> 1085bd8deadSopenharmony_ci argument for Fogfv or Fogiv. 1095bd8deadSopenharmony_ci 1105bd8deadSopenharmony_ci The ground plane is transformed into eye-coordinate space usi 1115bd8deadSopenharmony_ci the inverse transpose of the model-view matrix. Then the elevation 1125bd8deadSopenharmony_ci of point A (in eye-coordinate space) is the dot product A . G' 1135bd8deadSopenharmony_ci (G' - ground plane in eye-coordinate space): 1145bd8deadSopenharmony_ci 1155bd8deadSopenharmony_ci elevation = a*x + b*y + c*z + d*w 1165bd8deadSopenharmony_ci 1175bd8deadSopenharmony_ci Since the eye-point is defined to be at (0,0,0,1) in camera-space, 1185bd8deadSopenharmony_ci the elevation of the eye-point is the same as 'd' (the fourth 1195bd8deadSopenharmony_ci component of the ground plane). 1205bd8deadSopenharmony_ci 1215bd8deadSopenharmony_ci 1225bd8deadSopenharmony_ci ___________ 1235bd8deadSopenharmony_ci | | S |\ 1245bd8deadSopenharmony_ci elevation --| Layered |-----| \ _____ 1255bd8deadSopenharmony_ci | Fog | | \ | | To fog equation 1265bd8deadSopenharmony_ci |_________| | |_____| * |------- 1275bd8deadSopenharmony_ci | | __| | (r*S) 1285bd8deadSopenharmony_ci | / | |_____| 1295bd8deadSopenharmony_ci uniform density ---| / | 1305bd8deadSopenharmony_ci |/ | 1315bd8deadSopenharmony_ci | 1325bd8deadSopenharmony_ci range _______________| 1335bd8deadSopenharmony_ci 1345bd8deadSopenharmony_ci 1355bd8deadSopenharmony_ci 1365bd8deadSopenharmony_ci The effective density 'S' from the eye-point is computed for every 1375bd8deadSopenharmony_ci fragment using the fog layer specification (XXX: how?). This 1385bd8deadSopenharmony_ci density is used in the fog equation to compute the fog blending 1395bd8deadSopenharmony_ci factor 'f' depending on the selected FOG_MODE. 1405bd8deadSopenharmony_ci 1415bd8deadSopenharmony_ci 1425bd8deadSopenharmony_ciAdditions to Chapter 4 of the 1.2 Specification (Per-Fragment Operations 1435bd8deadSopenharmony_ciand the Frame Buffer) 1445bd8deadSopenharmony_ci 1455bd8deadSopenharmony_ci None 1465bd8deadSopenharmony_ci 1475bd8deadSopenharmony_ciAdditions to Chapter 5 of the 1.2 Specification (Special Functions) 1485bd8deadSopenharmony_ci 1495bd8deadSopenharmony_ci None 1505bd8deadSopenharmony_ci 1515bd8deadSopenharmony_ciAdditions to Chapter 6 of the 1.2 Specification (State and State Requests) 1525bd8deadSopenharmony_ci 1535bd8deadSopenharmony_ci The max allowed number of points in the fog layer specification 1545bd8deadSopenharmony_ci is queried by calling GetBooleanv, GetIntegerv, GetFloatv, and 1555bd8deadSopenharmony_ci GetDoublev with <pname> set to MAX_FOG_LAYERS_POINTS_SGIX. The 1565bd8deadSopenharmony_ci number of points in the current fog layers specification is queried 1575bd8deadSopenharmony_ci by calling GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev with 1585bd8deadSopenharmony_ci <pname> set to FOG_LAYERS_POINTS_SGIX. All the points of the 1595bd8deadSopenharmony_ci current fog layer specification are queried by calling 1605bd8deadSopenharmony_ci GetFogLayersSGIX. Points are returned in the same format as they 1615bd8deadSopenharmony_ci are specified in the FogLayersSGIX function. 1625bd8deadSopenharmony_ci 1635bd8deadSopenharmony_ciAdditions to the GLX Specification 1645bd8deadSopenharmony_ci 1655bd8deadSopenharmony_ci None 1665bd8deadSopenharmony_ci 1675bd8deadSopenharmony_ciErrors 1685bd8deadSopenharmony_ci 1695bd8deadSopenharmony_ci INVALID_VALUE is generated if FogLayersSGIX parameter <n> is 1705bd8deadSopenharmony_ci less than 1. 1715bd8deadSopenharmony_ci 1725bd8deadSopenharmony_ci INVALID_VALUE is generated if any elevation is less than zero. 1735bd8deadSopenharmony_ci 1745bd8deadSopenharmony_ci INVALID_OPERATION is generated if FogLayersSGIX is executed 1755bd8deadSopenharmony_ci between execution of Begin and the corresponding execution to 1765bd8deadSopenharmony_ci End. 1775bd8deadSopenharmony_ci 1785bd8deadSopenharmony_ci INVALID_OPERATION is generated if GetFogLayersSGIX is executed 1795bd8deadSopenharmony_ci between execution of Begin and the corresponding execution to 1805bd8deadSopenharmony_ci End. 1815bd8deadSopenharmony_ci 1825bd8deadSopenharmony_ciNew State 1835bd8deadSopenharmony_ci 1845bd8deadSopenharmony_ci Get Value Get Command Type Initial Value Attribute 1855bd8deadSopenharmony_ci --------- ----------- ---- ------------- --------- 1865bd8deadSopenharmony_ci MAX_FOG_LAYERS_POINTS_SGIX GetIntegerv Z+ XXX 1875bd8deadSopenharmony_ci FOG_LAYERS_POINTS_SGIX GetIntegerv Z+ 1 fog 1885bd8deadSopenharmony_ci FOG_GROUND_PLANE_SGIX GetFloatv V (0,0,0,0) fog 1895bd8deadSopenharmony_ci FOG_TYPE_SGIX GetIntegerv Z+ UNIFORM_SGIX fog 1905bd8deadSopenharmony_ci 1915bd8deadSopenharmony_ci 1925bd8deadSopenharmony_ciNew Implementation Dependent State 1935bd8deadSopenharmony_ci 1945bd8deadSopenharmony_ci None 195