-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
When I try to create StaticMesh and call IPL Static MashCreate encountered an uncaptured crash error:
// 添加几何体
// 定义顶点
IPL.Vector3[] tops = new IPL.Vector3[]{
new IPL.Vector3( 0.0f, 0.0f, 0.0f),
new IPL.Vector3( 1.0f, 0.0f, 0.0f),
new IPL.Vector3( 1.0f, 1.0f, 0.0f),
new IPL.Vector3( 0.0f, 1.0f, 0.0f)
};
// 定义三角形顶点索引
var ts = new IPL.Triangle[2];
ts[0].Indices[0] = 0;
ts[0].Indices[1] = 1;
ts[0].Indices[2] = 2;
ts[1].Indices[0] = 0;
ts[1].Indices[1] = 2;
ts[1].Indices[2] = 3;
// 定义材料
var materials = new IPL.Material[1];
materials[0].Absorption[0] = 0.1f;
materials[0].Absorption[1] = 0.1f;
materials[0].Absorption[2] = 0.1f;
materials[0].Scattering = 0.5f;
materials[0].Transmission[0] = 0.2f;
materials[0].Transmission[1] = 0.2f;
materials[0].Transmission[2] = 0.2f;
var mI = new System.Int32[] { 0, 0 };
// 定义静态物体
IPL.StaticMeshSettings ms = new IPL.StaticMeshSettings();
IPL.StaticMesh mesh = new IPL.StaticMesh();
ms.NumVertices = 4;
ms.NumTriangles = 2;
ms.NumMaterials = 1;
// 创建非托管指针
fixed (void* nv = tops)
fixed (void* nt = ts)
fixed (void* nm = materials)
fixed (void* nmi = mI)
{
ms.Vertices = (IntPtr)nv;
ms.Triangles = (IntPtr)nt;
ms.MaterialIndices = (IntPtr)nmi;
ms.Materials = (IntPtr)nm;
MessageBox.Show(IPL.StaticMeshCreate(Scene, in ms, out mesh).ToString());
}
When executing the last code, there was a crash. I don't know what the problem is and I can't solve it. Please help me, thank you very much!
Metadata
Metadata
Assignees
Labels
No labels