V-man

04-13-2002, 01:52 PM

Here's the code from liquad example in NV OpenGL SDK.

Is C[12]...c[15] arrays of 4 elements each?

and why does it contain the inverse modelview

matrix? It's automatically generated or what?

Why a VSP file and a VP file? How about straight opengl code (an example code that _doesn't_ use nvparse would be nice to see)?

Right now, I know what each instruction does but that's all. http://www.opengl.org/discussion_boards/ubb/smile.gif

V-man

!!VSP1.0

# Transforms the directional L vector from camera to object space.

# Computes an H vector in object space.

# Pre:

# c[12]...c[15] contains the inverse modelview matrix.

# v[0] contains the eye space light vector

# c[8] contains the eye space view vector

# Post:

# c[12]...c[15] contains the inverse modelview matrix.

# c[4] contains the object space L vector

# c[5] contains the object space H vector

# c[8] contains the object space V vector

# Store object space light direction.

DP3 R1.x, c[12], v[0];

DP3 R1.y, c[13], v[0];

DP3 R1.z, c[14], v[0];

MOV c[4], -R1;

# Fetch camera space view vector.

# Transform into object space.

MOV R2, c[8];

DP3 R3.x, c[12], R2;

DP3 R3.y, c[13], R2;

DP3 R3.z, c[14], R2;

MOV c[8], -R3;

# Compute H vector in object space.

ADD R4, -R1, -R3;

DP3 R0, R4, R4;

RSQ R2.x, R0.x;

MUL R5, R4, R2.x;

MOV c[5], R5;

END

Is C[12]...c[15] arrays of 4 elements each?

and why does it contain the inverse modelview

matrix? It's automatically generated or what?

Why a VSP file and a VP file? How about straight opengl code (an example code that _doesn't_ use nvparse would be nice to see)?

Right now, I know what each instruction does but that's all. http://www.opengl.org/discussion_boards/ubb/smile.gif

V-man

!!VSP1.0

# Transforms the directional L vector from camera to object space.

# Computes an H vector in object space.

# Pre:

# c[12]...c[15] contains the inverse modelview matrix.

# v[0] contains the eye space light vector

# c[8] contains the eye space view vector

# Post:

# c[12]...c[15] contains the inverse modelview matrix.

# c[4] contains the object space L vector

# c[5] contains the object space H vector

# c[8] contains the object space V vector

# Store object space light direction.

DP3 R1.x, c[12], v[0];

DP3 R1.y, c[13], v[0];

DP3 R1.z, c[14], v[0];

MOV c[4], -R1;

# Fetch camera space view vector.

# Transform into object space.

MOV R2, c[8];

DP3 R3.x, c[12], R2;

DP3 R3.y, c[13], R2;

DP3 R3.z, c[14], R2;

MOV c[8], -R3;

# Compute H vector in object space.

ADD R4, -R1, -R3;

DP3 R0, R4, R4;

RSQ R2.x, R0.x;

MUL R5, R4, R2.x;

MOV c[5], R5;

END