# Stefan Dösinger : wined3d: texm3x3(v) spec normalizes the normal vector.

Alexandre Julliard julliard at winehq.org
Thu Sep 13 07:17:27 CDT 2007

```Module: wine
Branch: master

Author: Stefan Dösinger <stefandoesinger at gmx.at>
Date:   Wed Sep 12 23:46:47 2007 +0200

wined3d: texm3x3(v)spec normalizes the normal vector.

---

2 files changed, 20 insertions(+), 10 deletions(-)

index 08ecfd1..0cbe75a 100644

-    /* Calculate reflection vector (Assume normal is normalized): RF = 2*(N.E)*N -E */
+    /* Calculate reflection vector
+     */
+    /* The .w is ignored when sampling, so I can use TMP2.w to calculate dot(N, N) */

-    /* Calculate reflection vector (Assume normal is normalized): RF = 2*(N.E)*N -E */
+    /* Calculate reflection vector.
+     *
+     *               dot(N, E)
+     * TMP.xyz = 2 * --------- * N - E
+     *               dot(N, N)
+     *
+     * Which normalizes the normal vector
+     */

index 9155a45..664ab61 100644

/* Perform the last matrix multiply operation */
-
-    /* Calculate reflection vector, 2*(tmp0.src1)*tmp0-src1
-     * This is equivalent to reflect(-src1, tmp0); */
+    /* Reflection calculation */

/* Construct the eye-ray vector from w coordinates */
current_state->texcoord_w[0], current_state->texcoord_w[1], reg);
-
-    /* Calculate reflection vector (Assume normal is normalized): RF = 2*(tmp0.tmp1)*tmp0-tmp1
-     * This is equivalent to reflect(-tmp1, tmp0); */