Commit 37491bb5 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Simplify the transformed position fixup a bit.

parent 75b89c93
...@@ -506,27 +506,15 @@ static inline void fixup_d3dcolor(DWORD *dst_color) ...@@ -506,27 +506,15 @@ static inline void fixup_d3dcolor(DWORD *dst_color)
static inline void fixup_transformed_pos(float *p) static inline void fixup_transformed_pos(float *p)
{ {
float x, y, z, w; /* rhw conversion like in position_float4(). */
if (p[3] != 1.0 && p[3] != 0.0)
/* rhw conversion like in drawStridedSlow */
if (p[3] == 1.0 || ((p[3] < eps) && (p[3] > -eps)))
{
x = p[0];
y = p[1];
z = p[2];
w = 1.0;
}
else
{ {
w = 1.0 / p[3]; float w = 1.0 / p[3];
x = p[0] * w; p[0] *= w;
y = p[1] * w; p[1] *= w;
z = p[2] * w; p[2] *= w;
p[3] = w;
} }
p[0] = x;
p[1] = y;
p[2] = z;
p[3] = w;
} }
const BYTE *buffer_get_memory(IWineD3DBuffer *iface, UINT offset, GLuint *buffer_object) const BYTE *buffer_get_memory(IWineD3DBuffer *iface, UINT offset, GLuint *buffer_object)
......
...@@ -4316,13 +4316,16 @@ static void WINE_GLAPI position_float4(const void *data) ...@@ -4316,13 +4316,16 @@ static void WINE_GLAPI position_float4(const void *data)
{ {
const GLfloat *pos = data; const GLfloat *pos = data;
if (pos[3] < eps && pos[3] > -eps) if (pos[3] != 0.0 && pos[3] != 1.0)
glVertex3fv(pos); {
else {
float w = 1.0 / pos[3]; float w = 1.0 / pos[3];
glVertex4f(pos[0] * w, pos[1] * w, pos[2] * w, w); glVertex4f(pos[0] * w, pos[1] * w, pos[2] * w, w);
} }
else
{
glVertex3fv(pos);
}
} }
static void WINE_GLAPI diffuse_d3dcolor(const void *data) static void WINE_GLAPI diffuse_d3dcolor(const void *data)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment