skia / external / github.com / KhronosGroup / OpenGL-Registry / 5f3fea090d8df5638b6df385c8b431f51b284651 / . / extensions / EXT / EXT_rescale_normal.txt

Name | |

EXT_rescale_normal | |

Name Strings | |

GL_EXT_rescale_normal | |

Version | |

$Date: 1997/07/02 23:38:17 $ $Revision: 1.7 $ | |

Number | |

27 | |

Dependencies | |

None | |

Overview | |

When normal rescaling is enabled a new operation is added to the | |

transformation of the normal vector into eye coordinates. The normal vector | |

is rescaled after it is multiplied by the inverse modelview matrix and | |

before it is normalized. | |

The rescale factor is chosen so that in many cases normal vectors with unit | |

length in object coordinates will not need to be normalized as they | |

are transformed into eye coordinates. | |

New Procedures and Functions | |

None | |

New Tokens | |

Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, | |

and by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, | |

and GetDoublev: | |

RESCALE_NORMAL_EXT 0x803A | |

Additions to Chapter 2 of the 1.1 Specification (OpenGL Operation) | |

Section 2.10.3 | |

Finally, we consider how the ModelView transformation state affects | |

normals. Normals are of interest only in eye coordinates, so the rules | |

governing their transformation to other coordinate systems are not | |

examined. | |

Normals which have unit length when sent to the GL, have their length | |

changed by the inverse of the scaling factor after transformation by | |

the model-view inverse matrix when the model-view matrix represents | |

a uniform scale. If rescaling is enabled, then normals specified with | |

the Normal command are rescaled after transformation by the ModelView | |

Inverse. | |

Normals sent to the GL may or may not have unit length. In addition, | |

the length of the normals after transformation might be altered due | |

to transformation by the model-view inverse matrix. If normalization | |

is enabled, then normals specified with the Normal3 command are | |

normalized after transformation by the model-view inverse matrix and | |

after rescaling if rescaling is enabled. Normalization and rescaling | |

are controlled with | |

void Enable( enum target); | |

and | |

void Disable( enum target); | |

with target equal to NORMALIZE or RESCALE_NORMAL. This requires two | |

bits of state. The initial state is for normals not to be normalized or | |

rescaled. | |

. | |

. | |

. | |

Therefore, if the modelview matrix is M, then the transformed plane equation | |

is | |

(n_x' n_y' n_z' q') = ((n_x n_y n_z q) * (M^-1)), | |

the rescaled normal is | |

(n_x" n_y" n_z") = f * (n_x' n_y' n_z'), | |

and the fully transformed normal is | |

1 (n_x") | |

____________ (n_y") (2.1) | |

__________________________________ (n_z") | |

V (n_x")^2 + (n_y")^2 + (n_z")^2 | |

If rescaling is disabled then f is 1, otherwise f is computed | |

as follows: | |

Let m_ij denote the matrix element in row i and column j of M^-1, | |

numbering the topmost row of the matrix as row 1, and the leftmost | |

column as column 1. Then | |

1 | |

__________ | |

f = ________________________________ | |

V (m_31)^2 + (m_32)^2 + (m_33)^2 | |

Alternatively, an implementation my chose to normalize the normal | |

instead of rescaling the normal. Then | |

1 | |

__________ | |

f = ________________________________ | |

V (n_x')^2 + (n_y')^2 + (n_z')^2 | |

If normalization is disabled, then the square root in equation 2.1 is | |

replaced with 1, otherwise . . . . | |

Additions to Chapter 3 of the 1.1 Specification (Rasterization) | |

None | |

Additions to Chapter 4 of the 1.1 Specification (Per-Fragment Operations and | |

the Framebuffer) | |

None | |

Additions to Chapter 5 of the 1.1 Specification (Special Functions) | |

None | |

Additions to Chapter 6 of the 1.1 Specification (State and State Requests) | |

None | |

Additions to the GLX Specification | |

None | |

GLX Protocol | |

None | |

Errors | |

None | |

New State | |

Get Value Get Command Type Initial Value Attribute | |

--------- ----------- ---- ------------- --------- | |

RESCALE_NORMAL_EXT IsEnabled B FALSE transform/enable | |

New Implementation Dependent State | |

None |