/// <summary> /// <p>Requests allocation of a mesh container object.</p> /// </summary> /// <param name="name"><dd> <p>Name of the mesh.</p> </dd></param> /// <param name="meshDataRef"><dd> <p>Pointer to the mesh data structure. See <strong><see cref="SharpDX.Direct3D9.MeshData"/></strong>.</p> </dd></param> /// <param name="materialsRef"><dd> <p>Array of materials used in the mesh.</p> </dd></param> /// <param name="effectInstancesRef"><dd> <p>Array of effect instances used in the mesh. See <strong><see cref="SharpDX.Direct3D9.EffectInstance"/></strong>.</p> </dd></param> /// <param name="numMaterials"><dd> <p>Number of materials in the materials array.</p> </dd></param> /// <param name="adjacencyRef"><dd> <p>Adjacency array for the mesh.</p> </dd></param> /// <param name="skinInfoRef"><dd> <p>Pointer to the skin mesh object if skin data is found. See <strong><see cref="SharpDX.Direct3D9.SkinInfo"/></strong>.</p> </dd></param> /// <param name="newMeshContainerOut"><dd> <p>Returns the created mesh container. See <strong><see cref="SharpDX.Direct3D9.MeshContainer"/></strong>.</p> </dd></param> /// <returns><p>The return values of this method are implemented by an application programmer. In general, if no error occurs, program the method to return <see cref="SharpDX.Direct3D9.ResultCode.Success"/>. Otherwise, program the method to return an appropriate error message from D3DERR or D3DXERR, as this will cause <strong><see cref="SharpDX.Direct3D9.D3DX9.LoadMeshHierarchyFromXW"/></strong> to fail also, and return the error.</p></returns> /// <include file='.\..\Documentation\CodeComments.xml' path="/comments/comment[@id='ID3DXAllocateHierarchy::CreateMeshContainer']/*"/> /// <msdn-id>bb205621</msdn-id> /// <unmanaged>HRESULT ID3DXAllocateHierarchy::CreateMeshContainer([In] const char* Name,[In] const D3DXMESHDATA* pMeshData,[In] const D3DXMATERIAL* pMaterials,[In] const D3DXEFFECTINSTANCE* pEffectInstances,[In] unsigned int NumMaterials,[In] const unsigned int* pAdjacency,[In] ID3DXSkinInfo* pSkinInfo,[In] D3DXMESHCONTAINER** ppNewMeshContainer)</unmanaged> /// <unmanaged-short>ID3DXAllocateHierarchy::CreateMeshContainer</unmanaged-short> public void CreateMeshContainer(string name, SharpDX.Direct3D9.MeshData meshDataRef, ref SharpDX.Direct3D9.ExtendedMaterial materialsRef, SharpDX.Direct3D9.EffectInstance effectInstancesRef, int numMaterials, int adjacencyRef, SharpDX.Direct3D9.SkinInfo skinInfoRef, SharpDX.Direct3D9.MeshContainer newMeshContainerOut) { unsafe { IntPtr name_ = Utilities.StringToHGlobalAnsi(name); var materialsRef_ = new SharpDX.Direct3D9.ExtendedMaterial.__Native(); materialsRef.__MarshalTo(ref materialsRef_); var effectInstancesRef_ = new SharpDX.Direct3D9.EffectInstance.__Native(); effectInstancesRef.__MarshalTo(ref effectInstancesRef_); var newMeshContainerOut_ = new SharpDX.Direct3D9.MeshContainer.__Native(); newMeshContainerOut.__MarshalTo(ref newMeshContainerOut_); SharpDX.Result __result__; __result__= SharpDX.Direct3D9.LocalInterop.Calliint(_nativePointer, (void*)name_, &meshDataRef, &materialsRef_, &effectInstancesRef_, numMaterials, &adjacencyRef, (void*)((skinInfoRef == null)?IntPtr.Zero:skinInfoRef.NativePointer), &newMeshContainerOut_,((void**)(*(void**)_nativePointer))[1]); Marshal.FreeHGlobal(name_ ); materialsRef.__MarshalFree(ref materialsRef_); effectInstancesRef.__MarshalFree(ref effectInstancesRef_); newMeshContainerOut.__MarshalFree(ref newMeshContainerOut_); __result__.CheckError(); } }
/// <summary> /// <p>Saves a mesh to a .x file.</p> /// </summary> /// <param name="filenameRef"><dd> <p>Pointer to a string that specifies the filename. If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the string data type resolves to LPCSTR. See Remarks.</p> </dd></param> /// <param name="meshRef"><dd> <p>Pointer to an <strong><see cref="SharpDX.Direct3D9.Mesh"/></strong> interface, representing the mesh to save to a .x file.</p> </dd></param> /// <param name="adjacencyRef"><dd> <p>Pointer to an array of three DWORDs per face that specify the three neighbors for each face in the mesh. This parameter may be <strong><c>null</c></strong>.</p> </dd></param> /// <param name="materialsRef"><dd> <p>Pointer to an array of <strong><see cref="SharpDX.Direct3D9.ExtendedMaterial"/></strong> structures, containing material information to be saved in the .x file.</p> </dd></param> /// <param name="effectInstancesRef"><dd> <p>Pointer to an array of effect instances, one per attribute group in the mesh. This parameter may be <strong><c>null</c></strong>. An effect instance is a particular instance of state information used to initialize an effect. For more information, see <strong><see cref="SharpDX.Direct3D9.EffectInstance"/></strong>.</p> </dd></param> /// <param name="numMaterials"><dd> <p>Number of <strong><see cref="SharpDX.Direct3D9.ExtendedMaterial"/></strong> structures in the <em>pMaterials</em> array.</p> </dd></param> /// <param name="format"><dd> <p>A combination of file format and save options when saving an .x file. See D3DX X File Constants.</p> </dd></param> /// <returns><p>If the function succeeds, the return value is <see cref="SharpDX.Direct3D9.ResultCode.Success"/>. If the function fails, the return value can be one of the following: <see cref="SharpDX.Direct3D9.ResultCode.InvalidCall"/>.</p></returns> /// <remarks> /// <p>The compiler setting also determines the function version. If Unicode is defined, the function call resolves to <see cref="SharpDX.Direct3D9.D3DX9.SaveMeshToXW"/>. Otherwise, the function call resolves to D3DXSaveMeshToXA because ANSI strings are being used.</p><p>The default file format is binary; however, if a file is specified as both a binary and a text file, it will be saved as a text file. Regardless of the file format, you may also use the compressed format to reduce the file size. </p><p>The following is a typical code example of how to use this function. </p><pre> <see cref="SharpDX.Direct3D9.Mesh"/>* m_pMesh; // Mesh object to be saved to a .x file /// <see cref="SharpDX.Direct3D9.ExtendedMaterial"/>* m_pMaterials; // Array of material structs in the mesh /// DWORD m_dwNumMaterials; // Number of material structs in the mesh DWORD dwFormat = <see cref="SharpDX.Direct3D9.XFileFormat.Binary"/>; // Binary-format .x file (default) /// // DWORD dwFormat = <see cref="SharpDX.Direct3D9.XFileFormat.Text"/>; // Text-format .x file // Load mesh into m_pMesh and determine values of m_pMaterials and /// // m_dwNumMaterials with calls to D3DXLoadMeshxxx or other D3DX functions // ... <see cref="SharpDX.Direct3D9.D3DX9.SaveMeshToXW"/>( L"outputxfilename.x", m_pMesh, <c>null</c>, m_pMaterials, <c>null</c>, m_dwNumMaterials, dwFormat ); /// </pre> /// </remarks> /// <include file='.\..\Documentation\CodeComments.xml' path="/comments/comment[@id='D3DXSaveMeshToXW']/*"/> /// <msdn-id>bb205428</msdn-id> /// <unmanaged>HRESULT D3DXSaveMeshToXW([In] const wchar_t* pFilename,[In] ID3DXMesh* pMesh,[In] const unsigned int* pAdjacency,[In] const D3DXMATERIAL* pMaterials,[In] const D3DXEFFECTINSTANCE* pEffectInstances,[In] unsigned int NumMaterials,[In] unsigned int Format)</unmanaged> /// <unmanaged-short>D3DXSaveMeshToXW</unmanaged-short> public static void SaveMeshToXW(string filenameRef, SharpDX.Direct3D9.Mesh meshRef, int adjacencyRef, ref SharpDX.Direct3D9.ExtendedMaterial materialsRef, SharpDX.Direct3D9.EffectInstance effectInstancesRef, int numMaterials, int format) { unsafe { IntPtr filenameRef_ = Utilities.StringToHGlobalUni(filenameRef); var materialsRef_ = new SharpDX.Direct3D9.ExtendedMaterial.__Native(); materialsRef.__MarshalTo(ref materialsRef_); var effectInstancesRef_ = new SharpDX.Direct3D9.EffectInstance.__Native(); effectInstancesRef.__MarshalTo(ref effectInstancesRef_); SharpDX.Result __result__; __result__= D3DXSaveMeshToXW_((void*)filenameRef_, (void*)((meshRef == null)?IntPtr.Zero:meshRef.NativePointer), &adjacencyRef, &materialsRef_, &effectInstancesRef_, numMaterials, format); Marshal.FreeHGlobal(filenameRef_ ); materialsRef.__MarshalFree(ref materialsRef_); effectInstancesRef.__MarshalFree(ref effectInstancesRef_); __result__.CheckError(); } }
/// <summary> /// No documentation. /// </summary> /// <param name="streamRef">No documentation.</param> /// <param name="materialsRef">No documentation.</param> /// <param name="effectInstancesRef">No documentation.</param> /// <param name="numMaterials">No documentation.</param> /// <returns>No documentation.</returns> /// <include file='.\..\Documentation\CodeComments.xml' path="/comments/comment[@id='ID3DXPMesh::Save']/*"/> /// <unmanaged>HRESULT ID3DXPMesh::Save([In] IStream* pStream,[In] const D3DXMATERIAL* pMaterials,[In] const D3DXEFFECTINSTANCE* pEffectInstances,[In] unsigned int NumMaterials)</unmanaged> /// <unmanaged-short>ID3DXPMesh::Save</unmanaged-short> internal void Save_(System.IntPtr streamRef, ref SharpDX.Direct3D9.ExtendedMaterial materialsRef, SharpDX.Direct3D9.EffectInstance effectInstancesRef, int numMaterials) { unsafe { var materialsRef_ = new SharpDX.Direct3D9.ExtendedMaterial.__Native(); materialsRef.__MarshalTo(ref materialsRef_); var effectInstancesRef_ = new SharpDX.Direct3D9.EffectInstance.__Native(); effectInstancesRef.__MarshalTo(ref effectInstancesRef_); SharpDX.Result __result__; __result__= SharpDX.Direct3D9.LocalInterop.Calliint(_nativePointer, (void*)streamRef, &materialsRef_, &effectInstancesRef_, numMaterials,((void**)(*(void**)_nativePointer))[32]); materialsRef.__MarshalFree(ref materialsRef_); effectInstancesRef.__MarshalFree(ref effectInstancesRef_); __result__.CheckError(); } }