mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
[WINESYNC] d3dx9: Simplify D3DXSphereBoundProbe() a bit.
Spurred by a patch by Alex Henrie. Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id 18ae539c914a9b5a89f63d8cf9c2a21273eccc6c by Matteo Bruni <mbruni@codeweavers.com>
This commit is contained in:
parent
4c48bb18fd
commit
868f57e6b2
3 changed files with 75 additions and 35 deletions
|
@ -1694,11 +1694,7 @@ static HRESULT WINAPI d3dx9_mesh_OptimizeInplace(ID3DXMesh *iface, DWORD flags,
|
|||
if (FAILED(hr)) goto cleanup;
|
||||
} else if (flags & D3DXMESHOPT_ATTRSORT) {
|
||||
if (!(flags & D3DXMESHOPT_IGNOREVERTS))
|
||||
{
|
||||
FIXME("D3DXMESHOPT_ATTRSORT vertex reordering not implemented.\n");
|
||||
hr = E_NOTIMPL;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
hr = iface->lpVtbl->LockAttributeBuffer(iface, 0, &attrib_buffer);
|
||||
if (FAILED(hr)) goto cleanup;
|
||||
|
@ -2414,20 +2410,21 @@ BOOL WINAPI D3DXIntersectTri(const D3DXVECTOR3 *p0, const D3DXVECTOR3 *p1, const
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL WINAPI D3DXSphereBoundProbe(const D3DXVECTOR3 *pcenter, float radius,
|
||||
const D3DXVECTOR3 *prayposition, const D3DXVECTOR3 *praydirection)
|
||||
BOOL WINAPI D3DXSphereBoundProbe(const D3DXVECTOR3 *center, float radius,
|
||||
const D3DXVECTOR3 *ray_position, const D3DXVECTOR3 *ray_direction)
|
||||
{
|
||||
D3DXVECTOR3 difference;
|
||||
FLOAT a, b, c, d;
|
||||
D3DXVECTOR3 difference = {0};
|
||||
float a, b, c, d;
|
||||
|
||||
a = D3DXVec3LengthSq(praydirection);
|
||||
if (!D3DXVec3Subtract(&difference, prayposition, pcenter)) return FALSE;
|
||||
b = D3DXVec3Dot(&difference, praydirection);
|
||||
D3DXVec3Subtract(&difference, ray_position, center);
|
||||
c = D3DXVec3LengthSq(&difference) - radius * radius;
|
||||
if (c < 0.0f)
|
||||
return TRUE;
|
||||
a = D3DXVec3LengthSq(ray_direction);
|
||||
b = D3DXVec3Dot(&difference, ray_direction);
|
||||
d = b * b - a * c;
|
||||
|
||||
if ( ( d <= 0.0f ) || ( sqrt(d) <= b ) ) return FALSE;
|
||||
return TRUE;
|
||||
return d >= 0.0f && (b <= 0.0f || d > b * b);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
|
|
|
@ -435,18 +435,42 @@ static void D3DXBoundProbeTest(void)
|
|||
radius = sqrt(77.0f);
|
||||
center.x = 1.0f; center.y = 2.0f; center.z = 3.0f;
|
||||
raydirection.x = 2.0f; raydirection.y = -4.0f; raydirection.z = 2.0f;
|
||||
|
||||
rayposition.x = 5.0f; rayposition.y = 5.0f; rayposition.z = 9.0f;
|
||||
result = D3DXSphereBoundProbe(¢er, radius, &rayposition, &raydirection);
|
||||
ok(result == TRUE, "expected TRUE, received FALSE\n");
|
||||
ok(result == TRUE, "Got unexpected result %#x.\n", result);
|
||||
|
||||
rayposition.x = 45.0f; rayposition.y = -75.0f; rayposition.z = 49.0f;
|
||||
result = D3DXSphereBoundProbe(¢er, radius, &rayposition, &raydirection);
|
||||
ok(result == FALSE, "expected FALSE, received TRUE\n");
|
||||
ok(result == FALSE, "Got unexpected result %#x.\n", result);
|
||||
|
||||
raydirection.x = -2.0f; raydirection.y = 4.0f; raydirection.z = -2.0f;
|
||||
result = D3DXSphereBoundProbe(¢er, radius, &rayposition, &raydirection);
|
||||
ok(result == TRUE, "Got unexpected result %#x.\n", result);
|
||||
|
||||
rayposition.x = 5.0f; rayposition.y = 11.0f; rayposition.z = 9.0f;
|
||||
result = D3DXSphereBoundProbe(¢er, radius, &rayposition, &raydirection);
|
||||
ok(result == FALSE, "expected FALSE, received TRUE\n");
|
||||
ok(result == FALSE, "Got unexpected result %#x.\n", result);
|
||||
|
||||
raydirection.x = 2.0f; raydirection.y = -4.0f; raydirection.z = 2.0f;
|
||||
result = D3DXSphereBoundProbe(¢er, radius, &rayposition, &raydirection);
|
||||
ok(result == FALSE, "Got unexpected result %#x.\n", result);
|
||||
|
||||
radius = 1.0f;
|
||||
rayposition.x = 2.0f; rayposition.y = 2.0f; rayposition.z = 3.0f;
|
||||
result = D3DXSphereBoundProbe(¢er, radius, &rayposition, &raydirection);
|
||||
ok(result == FALSE, "Got unexpected result %#x.\n", result);
|
||||
|
||||
raydirection.x = 0.0f; raydirection.y = 0.0f; raydirection.z = 1.0f;
|
||||
result = D3DXSphereBoundProbe(¢er, radius, &rayposition, &raydirection);
|
||||
ok(result == TRUE, "Got unexpected result %#x.\n", result);
|
||||
|
||||
if (0)
|
||||
{
|
||||
/* All these crash on native. */
|
||||
D3DXSphereBoundProbe(¢er, radius, &rayposition, NULL);
|
||||
D3DXSphereBoundProbe(¢er, radius, NULL, &raydirection);
|
||||
D3DXSphereBoundProbe(NULL, radius, &rayposition, &raydirection);
|
||||
}
|
||||
}
|
||||
|
||||
static void D3DXComputeBoundingBoxTest(void)
|
||||
|
|
|
@ -1,18 +1,37 @@
|
|||
directories: {dlls/d3dx9_24: dll/directx/wine/d3dx9_24, dlls/d3dx9_25: dll/directx/wine/d3dx9_25,
|
||||
dlls/d3dx9_26: dll/directx/wine/d3dx9_26, dlls/d3dx9_27: dll/directx/wine/d3dx9_27,
|
||||
dlls/d3dx9_28: dll/directx/wine/d3dx9_28, dlls/d3dx9_29: dll/directx/wine/d3dx9_29,
|
||||
dlls/d3dx9_30: dll/directx/wine/d3dx9_30, dlls/d3dx9_31: dll/directx/wine/d3dx9_31,
|
||||
dlls/d3dx9_32: dll/directx/wine/d3dx9_32, dlls/d3dx9_33: dll/directx/wine/d3dx9_33,
|
||||
dlls/d3dx9_34: dll/directx/wine/d3dx9_34, dlls/d3dx9_35: dll/directx/wine/d3dx9_35,
|
||||
dlls/d3dx9_36: dll/directx/wine/d3dx9_36, dlls/d3dx9_36/tests: modules/rostests/winetests/d3dx9_36,
|
||||
dlls/d3dx9_37: dll/directx/wine/d3dx9_37, dlls/d3dx9_38: dll/directx/wine/d3dx9_38,
|
||||
dlls/d3dx9_39: dll/directx/wine/d3dx9_39, dlls/d3dx9_40: dll/directx/wine/d3dx9_40,
|
||||
dlls/d3dx9_41: dll/directx/wine/d3dx9_41, dlls/d3dx9_42: dll/directx/wine/d3dx9_42,
|
||||
dlls/d3dx9_43: dll/directx/wine/d3dx9_43}
|
||||
files: {include/d3dx9.h: sdk/include/dxsdk/d3dx9.h, include/d3dx9anim.h: sdk/include/dxsdk/d3dx9anim.h,
|
||||
include/d3dx9core.h: sdk/include/dxsdk/d3dx9core.h, include/d3dx9effect.h: sdk/include/dxsdk/d3dx9effect.h,
|
||||
include/d3dx9math.h: sdk/include/dxsdk/d3dx9math.h, include/d3dx9math.inl: sdk/include/dxsdk/d3dx9math.inl,
|
||||
include/d3dx9mesh.h: sdk/include/dxsdk/d3dx9mesh.h, include/d3dx9of.h: sdk/include/dxsdk/d3dx9of.h,
|
||||
include/d3dx9shader.h: sdk/include/dxsdk/d3dx9shader.h, include/d3dx9shape.h: sdk/include/dxsdk/d3dx9shape.h,
|
||||
include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h, include/d3dx9xof.h: sdk/include/dxsdk/d3dx9xof.h}
|
||||
tags: {wine: ea7cf679150f790d2e375d99ee226ea4881b490a}
|
||||
directories:
|
||||
dlls/d3dx9_24: dll/directx/wine/d3dx9_24
|
||||
dlls/d3dx9_25: dll/directx/wine/d3dx9_25
|
||||
dlls/d3dx9_26: dll/directx/wine/d3dx9_26
|
||||
dlls/d3dx9_27: dll/directx/wine/d3dx9_27
|
||||
dlls/d3dx9_28: dll/directx/wine/d3dx9_28
|
||||
dlls/d3dx9_29: dll/directx/wine/d3dx9_29
|
||||
dlls/d3dx9_30: dll/directx/wine/d3dx9_30
|
||||
dlls/d3dx9_31: dll/directx/wine/d3dx9_31
|
||||
dlls/d3dx9_32: dll/directx/wine/d3dx9_32
|
||||
dlls/d3dx9_33: dll/directx/wine/d3dx9_33
|
||||
dlls/d3dx9_34: dll/directx/wine/d3dx9_34
|
||||
dlls/d3dx9_35: dll/directx/wine/d3dx9_35
|
||||
dlls/d3dx9_36: dll/directx/wine/d3dx9_36
|
||||
dlls/d3dx9_36/tests: modules/rostests/winetests/d3dx9_36
|
||||
dlls/d3dx9_37: dll/directx/wine/d3dx9_37
|
||||
dlls/d3dx9_38: dll/directx/wine/d3dx9_38
|
||||
dlls/d3dx9_39: dll/directx/wine/d3dx9_39
|
||||
dlls/d3dx9_40: dll/directx/wine/d3dx9_40
|
||||
dlls/d3dx9_41: dll/directx/wine/d3dx9_41
|
||||
dlls/d3dx9_42: dll/directx/wine/d3dx9_42
|
||||
dlls/d3dx9_43: dll/directx/wine/d3dx9_43
|
||||
files:
|
||||
include/d3dx9.h: sdk/include/dxsdk/d3dx9.h
|
||||
include/d3dx9anim.h: sdk/include/dxsdk/d3dx9anim.h
|
||||
include/d3dx9core.h: sdk/include/dxsdk/d3dx9core.h
|
||||
include/d3dx9effect.h: sdk/include/dxsdk/d3dx9effect.h
|
||||
include/d3dx9math.h: sdk/include/dxsdk/d3dx9math.h
|
||||
include/d3dx9math.inl: sdk/include/dxsdk/d3dx9math.inl
|
||||
include/d3dx9mesh.h: sdk/include/dxsdk/d3dx9mesh.h
|
||||
include/d3dx9of.h: sdk/include/dxsdk/d3dx9of.h
|
||||
include/d3dx9shader.h: sdk/include/dxsdk/d3dx9shader.h
|
||||
include/d3dx9shape.h: sdk/include/dxsdk/d3dx9shape.h
|
||||
include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h
|
||||
include/d3dx9xof.h: sdk/include/dxsdk/d3dx9xof.h
|
||||
tags:
|
||||
wine: 1dcc3ab292151cd91ea4202b92107c3a91527c7a
|
||||
|
|
Loading…
Reference in a new issue