問題は、三角形を生成するために使用されるインデックスの順になっているようです。
次のコードを使用して破損ネットワークを生成すると、三角形が陰影付けされます。
public static void Test()
{
Point3[] vertices = new Point3[9];
IndexedTriangle[] triangles = new IndexedTriangle[8];
vertices[0] = new Point3(0, 100, 0);
vertices[1] = new Point3(50, 100, 5);
vertices[2] = new Point3(100, 100, 10);
vertices[3] = new Point3(0, 50, 15);
vertices[4] = new Point3(50, 50, 20);
vertices[5] = new Point3(100, 50, 25);
vertices[6] = new Point3(0, 0, 30);
vertices[7] = new Point3(50, 0, 35);
vertices[8] = new Point3(100, 0, 40);
triangles[0] = new IndexedTriangle(0, 1, 3);
triangles[1] = new IndexedTriangle(1, 3, 4);
triangles[2] = new IndexedTriangle(1, 2, 4);
triangles[3] = new IndexedTriangle(2, 4, 5);
triangles[4] = new IndexedTriangle(3, 4, 6);
triangles[5] = new IndexedTriangle(4, 6, 7);
triangles[6] = new IndexedTriangle(4, 5, 7);
triangles[7] = new IndexedTriangle(5, 7, 8);
IndexedTriangleMesh triangleMesh = new IndexedTriangleMesh(triangles, vertices, null);
TriangleMesh triMesh = null;
using (ITransaction trans = Slb.Ocean.Core.DataManager.NewTransaction())
{
Project proj = PetrelProject.PrimaryProject;
trans.Lock(proj);
string colName = "TringleMeshes";
Collection collection = Collection.NullObject;
collection = proj.CreateCollection(colName);
trans.Lock(collection);
DomainObjectExtensionRoot root = DomainObjectExtensionRoot.GetInstance();
trans.Lock(root);
triMesh = root.CreateTriangleMesh("TestMesh", Domain.ELEVATION_DEPTH, collection, "Test", "");
trans.Lock(triMesh);
triMesh.IndexedTriangleMeshes = new IndexedTriangleMesh[] { triangleMesh };
triMesh.Color = Color.Blue;
trans.Commit();
}
Project project = PetrelProject.PrimaryProject;
FractureNetwork fractureNetwork;
using (ITransaction trans = Slb.Ocean.Core.DataManager.NewTransaction())
{
trans.Lock(project);
fractureNetwork = project.CreateFractureNetwork("FractureNetwork", Domain.ELEVATION_DEPTH);
fractureNetwork.CreateFracturePatches(triMesh.IndexedTriangleMeshes);
trans.Commit();
}
}
ただし、インデックスの順序が変更されている場合、破損ネットワークは実線です。
public static void Test()
{
Point3[] vertices = new Point3[9];
IndexedTriangle[] triangles = new IndexedTriangle[8];
vertices[0] = new Point3(0, 100, 0);
vertices[1] = new Point3(50, 100, 5);
vertices[2] = new Point3(100, 100, 10);
vertices[3] = new Point3(0, 50, 15);
vertices[4] = new Point3(50, 50, 20);
vertices[5] = new Point3(100, 50, 25);
vertices[6] = new Point3(0, 0, 30);
vertices[7] = new Point3(50, 0, 35);
vertices[8] = new Point3(100, 0, 40);
triangles[0] = new IndexedTriangle(0, 1, 3);
triangles[1] = new IndexedTriangle(1, 4, 3); // switched order of last two values
triangles[2] = new IndexedTriangle(1, 2, 4);
triangles[3] = new IndexedTriangle(2, 5, 4); // switched order of last two values
triangles[4] = new IndexedTriangle(3, 4, 6);
triangles[5] = new IndexedTriangle(4, 7, 6); // switched order of last two values
triangles[6] = new IndexedTriangle(4, 5, 7);
triangles[7] = new IndexedTriangle(5, 8, 7); // switched order of last two values
IndexedTriangleMesh triangleMesh = new IndexedTriangleMesh(triangles, vertices, null);
TriangleMesh triMesh = null;
using (ITransaction trans = Slb.Ocean.Core.DataManager.NewTransaction())
{
Project proj = PetrelProject.PrimaryProject;
trans.Lock(proj);
string colName = "TringleMeshes";
Collection collection = Collection.NullObject;
collection = proj.CreateCollection(colName);
trans.Lock(collection);
DomainObjectExtensionRoot root = DomainObjectExtensionRoot.GetInstance();
trans.Lock(root);
triMesh = root.CreateTriangleMesh("TestMesh", Domain.ELEVATION_DEPTH, collection, "Test", "");
trans.Lock(triMesh);
triMesh.IndexedTriangleMeshes = new IndexedTriangleMesh[] { triangleMesh };
triMesh.Color = Color.Blue;
trans.Commit();
}
Project project = PetrelProject.PrimaryProject;
FractureNetwork fractureNetwork;
using (ITransaction trans = Slb.Ocean.Core.DataManager.NewTransaction())
{
trans.Lock(project);
fractureNetwork = project.CreateFractureNetwork("FractureNetwork", Domain.ELEVATION_DEPTH);
fractureNetwork.CreateFracturePatches(triMesh.IndexedTriangleMeshes);
trans.Commit();
}
}
イメージで見ることができます:http://www.flickr.com/photos/[email protected]/5987611731/
あなたがtriangleMeshを消費し、レンダリングを行うために使用されるいくつかのコードを投稿してもらえますか? – MBen