[PATCH 07/11] wined3d: Implement lighting with directional lights in process_vertices_strided().

Henri Verbeet hverbeet at gmail.com
Thu May 16 13:01:07 CDT 2019


On Wed, 15 May 2019 at 19:40, Paul Gofman <gofmanp at gmail.com> wrote:
> +static float dot_vec3(const struct wined3d_vec3 *src1, const struct wined3d_vec3 *src2)
> +{
> +    return src1->x * src2->x + src1->y * src2->y + src1->z * src2->z;
> +}
We'd typically call that "wined3d_vec3_dot()".

> +static void normalize_vec3(struct wined3d_vec3 *dest, const struct wined3d_vec3 *src)
> +{
> +    float rnorm = 1.0f / sqrtf(src->x * src->x + src->y * src->y + src->z * src->z);
"sqrtf(wined3d_vec3_dot(src, src))", right?

> +static void madd_vec(float *dst, const float *src, unsigned int count, float c)
> +{
> +    unsigned int i;
> +
> +    for (i = 0; i < count; ++i)
> +        dst[i] += src[i] * c;
> +}
> +
> +static void multiply_vector3_matrix(struct wined3d_vec3 *dest, const struct wined3d_vec3 *src1,
> +        const float *src2)
> +{
> +    struct wined3d_vec3 temp;
> +
> +    temp.x = (src1->x * src2[0]) + (src1->y * src2[3]) + (src1->z * src2[3 * 2]);
> +    temp.y = (src1->x * src2[1]) + (src1->y * src2[3 + 1]) + (src1->z * src2[3 * 2 + 1]);
> +    temp.z = (src1->x * src2[2]) + (src1->y * src2[3 + 2]) + (src1->z * src2[3 * 2 + 2]);
> +
> +    *dest = temp;
> +}
I think we'd prefer proper matrix and vector structures here.



More information about the wine-devel mailing list