d3drm: Implement D3DRMVectorReflect.
This commit is contained in:
parent
f9e6f42b86
commit
7fccb04201
|
@ -14,7 +14,7 @@
|
|||
@ stdcall D3DRMVectorModulus(ptr)
|
||||
@ stdcall D3DRMVectorNormalize(ptr)
|
||||
@ stdcall D3DRMVectorRandom(ptr)
|
||||
@ stub D3DRMVectorReflect
|
||||
@ stdcall D3DRMVectorReflect(ptr ptr ptr)
|
||||
@ stub D3DRMVectorRotate
|
||||
@ stdcall D3DRMVectorScale(ptr ptr long)
|
||||
@ stdcall D3DRMVectorSubtract(ptr ptr ptr)
|
||||
|
|
|
@ -102,6 +102,14 @@ LPD3DVECTOR WINAPI D3DRMVectorRandom(LPD3DVECTOR d)
|
|||
return d;
|
||||
}
|
||||
|
||||
/* Reflection of a vector on a surface */
|
||||
LPD3DVECTOR WINAPI D3DRMVectorReflect(LPD3DVECTOR r, LPD3DVECTOR ray, LPD3DVECTOR norm)
|
||||
{
|
||||
D3DVECTOR sca;
|
||||
D3DRMVectorSubtract(r, D3DRMVectorScale(&sca, norm, 2.0*D3DRMVectorDotProduct(ray,norm)), ray);
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Scale a vector */
|
||||
LPD3DVECTOR WINAPI D3DRMVectorScale(LPD3DVECTOR d, LPD3DVECTOR s, D3DVALUE factor)
|
||||
{
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
void VectorTest(void)
|
||||
{
|
||||
D3DVALUE mod,par;
|
||||
D3DVECTOR e,r,u,v,casnul;
|
||||
D3DVECTOR e,r,u,v,casnul,norm,ray;
|
||||
|
||||
u.x=2.0;u.y=2.0;u.z=1.0;
|
||||
v.x=4.0;v.y=4.0;v.z=0.0;
|
||||
|
@ -73,6 +73,13 @@ void VectorTest(void)
|
|||
e.x=1.0; e.y=0.0; e.z=0.0;
|
||||
expect_vec(e,casnul);
|
||||
|
||||
/*____________________VectorReflect_________________________________*/
|
||||
ray.x=3.0; ray.y=-4.0; ray.z=5.0;
|
||||
norm.x=1.0; norm.y=-2.0; norm.z=6.0;
|
||||
e.x=79.0; e.y=-160.0; e.z=487.0;
|
||||
D3DRMVectorReflect(&r,&ray,&norm);
|
||||
expect_vec(e,r);
|
||||
|
||||
/*_______________________VectorScale__________________________*/
|
||||
par=2.5;
|
||||
D3DRMVectorScale(&r,&v,par);
|
||||
|
|
Loading…
Reference in New Issue