Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

120 lines
4.5 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1998 - 1999
  6. //
  7. // File: d3drmface2obj.cpp
  8. //
  9. //--------------------------------------------------------------------------
  10. // d3drmFace22Obj.cpp : Implementation of CDirectApp and DLL registration.
  11. //#define LPDIRECT3DRMFACE2 I_dxj_Direct3dRMFace2*
  12. #include "stdafx.h"
  13. #include "Direct.h"
  14. #include "dms.h"
  15. #include "d3drmFace2Obj.h"
  16. #include "d3drmTexture3Obj.h"
  17. #include "d3drmMaterial2Obj.h"
  18. CONSTRUCTOR( _dxj_Direct3dRMFace2,{});
  19. DESTRUCTOR( _dxj_Direct3dRMFace2,{});
  20. GETSET_OBJECT(_dxj_Direct3dRMFace2);
  21. CLONE_R(_dxj_Direct3dRMFace2,Direct3DRMFace2);
  22. GETNAME_R(_dxj_Direct3dRMFace2);
  23. SETNAME_R(_dxj_Direct3dRMFace2);
  24. GETCLASSNAME_R(_dxj_Direct3dRMFace2);
  25. ADDDESTROYCALLBACK_R(_dxj_Direct3dRMFace2);
  26. DELETEDESTROYCALLBACK_R(_dxj_Direct3dRMFace2);
  27. GET_DIRECT_R(_dxj_Direct3dRMFace2, getAppData, GetAppData, long);
  28. GET_DIRECT_R(_dxj_Direct3dRMFace2, getColor, GetColor, d3dcolor);
  29. GET_DIRECT_R(_dxj_Direct3dRMFace2, getVertexCount, GetVertexCount, int);
  30. GET_DIRECT1_R(_dxj_Direct3dRMFace2, getVertexIndex, GetVertexIndex, int, long);
  31. GET_DIRECT1_R(_dxj_Direct3dRMFace2, getTextureCoordinateIndex, GetTextureCoordinateIndex, int, long);
  32. PASS_THROUGH_CAST_1_R(_dxj_Direct3dRMFace2, setAppData, SetAppData, long,(DWORD));
  33. PASS_THROUGH_CAST_1_R(_dxj_Direct3dRMFace2, setColor, SetColor, d3dcolor,(DWORD));
  34. PASS_THROUGH2_R(_dxj_Direct3dRMFace2, setTextureTopology, SetTextureTopology, long, long);
  35. PASS_THROUGH_CAST_2_R(_dxj_Direct3dRMFace2, addVertexAndNormalIndexed, AddVertexAndNormalIndexed, long,(DWORD),long,(DWORD));
  36. //PASS_THROUGH2_R(_dxj_Direct3dRMFace2, getTextureTopology, GetTextureTopology, int*, int*); //2 BOOL ptrs?
  37. PASS_THROUGH3_R(_dxj_Direct3dRMFace2, addVertex, AddVertex, d3dvalue, d3dvalue,d3dvalue);
  38. PASS_THROUGH3_R(_dxj_Direct3dRMFace2, setColorRGB, SetColorRGB, d3dvalue, d3dvalue, d3dvalue);
  39. PASS_THROUGH_CAST_3_R(_dxj_Direct3dRMFace2, getTextureCoordinates, GetTextureCoordinates, long,(DWORD), d3dvalue*,(float*), d3dvalue*,(float*));
  40. PASS_THROUGH_CAST_3_R(_dxj_Direct3dRMFace2, setTextureCoordinates, SetTextureCoordinates, long,(DWORD), d3dvalue,(float), d3dvalue,(float));
  41. PASS_THROUGH_CAST_3_R(_dxj_Direct3dRMFace2, getVertex, GetVertex, long, (DWORD), D3dVector*, (_D3DVECTOR*),D3dVector*, (_D3DVECTOR*));
  42. DO_GETOBJECT_ANDUSEIT_R(_dxj_Direct3dRMFace2, setMaterial, SetMaterial, _dxj_Direct3dRMMaterial2);
  43. RETURN_NEW_ITEM_R(_dxj_Direct3dRMFace2, getMaterial, GetMaterial, _dxj_Direct3dRMMaterial2);
  44. STDMETHODIMP C_dxj_Direct3dRMFace2Object::getTextureTopology(long *u, long *v)
  45. {
  46. HRESULT hr;
  47. hr= m__dxj_Direct3dRMFace2->GetTextureTopology((BOOL*)u,(BOOL*)v);
  48. return hr;
  49. }
  50. STDMETHODIMP C_dxj_Direct3dRMFace2Object::getTexture(I_dxj_Direct3dRMTexture3 **tex)
  51. {
  52. IDirect3DRMTexture3 *realtext3=NULL;
  53. HRESULT hr;
  54. hr= m__dxj_Direct3dRMFace2->GetTexture(&realtext3);
  55. if FAILED(hr) return hr;
  56. INTERNAL_CREATE(_dxj_Direct3dRMTexture3,realtext3,tex);
  57. return hr;
  58. }
  59. STDMETHODIMP C_dxj_Direct3dRMFace2Object::setTexture(I_dxj_Direct3dRMTexture3 *tex)
  60. {
  61. if (tex==NULL) return E_INVALIDARG;
  62. IDirect3DRMTexture3 *realtext3=NULL;
  63. tex->InternalGetObject((IUnknown**)&realtext3);
  64. return m__dxj_Direct3dRMFace2->SetTexture( realtext3);
  65. }
  66. /////////////////////////////////////////////////////////////////////////////
  67. STDMETHODIMP C_dxj_Direct3dRMFace2Object::getNormal(D3dVector *norm)
  68. {
  69. return m__dxj_Direct3dRMFace2->GetNormal( (D3DVECTOR*) norm);
  70. }
  71. /////////////////////////////////////////////////////////////////////////////
  72. STDMETHODIMP C_dxj_Direct3dRMFace2Object::getVerticesJava(long cnt, float *v, float* n )
  73. {
  74. HRESULT hr;
  75. __try {
  76. hr=m__dxj_Direct3dRMFace2->GetVertices((unsigned long *)&cnt, (D3DVECTOR *)v, (D3DVECTOR *)n);
  77. }
  78. __except(1,1){
  79. return E_INVALIDARG;
  80. }
  81. return hr;
  82. }
  83. /////////////////////////////////////////////////////////////////////////////
  84. STDMETHODIMP C_dxj_Direct3dRMFace2Object::getVertices(long cnt, SAFEARRAY **ppsv, SAFEARRAY **ppsn )
  85. {
  86. if ((*ppsv==NULL)||(*ppsn==NULL)) return E_INVALIDARG;
  87. if (!ISSAFEARRAY1D(ppsv,(DWORD)cnt)) return E_INVALIDARG;
  88. if (!ISSAFEARRAY1D(ppsn,(DWORD)cnt)) return E_INVALIDARG;
  89. D3DVECTOR *v= (D3DVECTOR*)((SAFEARRAY*)*ppsv)->pvData;
  90. D3DVECTOR *n= (D3DVECTOR*)((SAFEARRAY*)*ppsn)->pvData;
  91. return m__dxj_Direct3dRMFace2->GetVertices((unsigned long *)&cnt, (D3DVECTOR *)v, (D3DVECTOR *)n);
  92. }