Get mesh type instead of checking triangle count.
This commit is contained in:
parent
3d04114d86
commit
3795b5cacd
@ -1,3 +1,17 @@
|
||||
OV.MeshType =
|
||||
{
|
||||
Empty : 0,
|
||||
TriangleMesh : 1
|
||||
};
|
||||
|
||||
OV.GetMeshType = function (mesh)
|
||||
{
|
||||
if (mesh.TriangleCount () > 0) {
|
||||
return OV.MeshType.TriangleMesh;
|
||||
}
|
||||
return OV.MeshType.Empty;
|
||||
};
|
||||
|
||||
OV.CalculateTriangleNormal = function (v0, v1, v2)
|
||||
{
|
||||
let v = OV.SubCoord3D (v1, v0);
|
||||
|
||||
@ -23,7 +23,8 @@ OV.ModelFinalizer = class
|
||||
{
|
||||
for (let i = 0; i < model.MeshCount (); i++) {
|
||||
let mesh = model.GetMesh (i);
|
||||
if (mesh.TriangleCount () === 0) {
|
||||
let type = OV.GetMeshType (mesh);
|
||||
if (type === OV.MeshType.Empty) {
|
||||
model.RemoveMesh (i);
|
||||
i = i - 1;
|
||||
continue;
|
||||
|
||||
@ -2,7 +2,7 @@ OV.IsModelEmpty = function (model)
|
||||
{
|
||||
let isEmpty = true;
|
||||
model.EnumerateMeshInstances ((meshInstance) => {
|
||||
if (meshInstance.TriangleCount () > 0) {
|
||||
if (OV.GetMeshType (meshInstance) !== OV.MeshType.Empty) {
|
||||
isEmpty = false;
|
||||
}
|
||||
});
|
||||
|
||||
@ -197,9 +197,6 @@ OV.ConvertModelToThreeObject = function (model, params, output, callbacks)
|
||||
{
|
||||
let mesh = model.GetMesh (meshInstanceId.meshIndex);
|
||||
let triangleCount = mesh.TriangleCount ();
|
||||
if (triangleCount === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let triangleIndices = [];
|
||||
for (let i = 0; i < triangleCount; i++) {
|
||||
@ -312,7 +309,8 @@ OV.ConvertModelToThreeObject = function (model, params, output, callbacks)
|
||||
function ConvertMesh (threeObject, model, meshInstanceId, modelThreeMaterials)
|
||||
{
|
||||
let mesh = model.GetMesh (meshInstanceId.meshIndex);
|
||||
if (mesh.TriangleCount () > 0) {
|
||||
let type = OV.GetMeshType (mesh);
|
||||
if (type === OV.MeshType.TriangleMesh) {
|
||||
let threeMesh = CreateThreeMesh (model, meshInstanceId, modelThreeMaterials);
|
||||
threeObject.add (threeMesh);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user