Exemplo n.º 1
0
    Shape CreateCloud(uint id, MeshResource mesh)
    {
        PointCloudShape cloud = new PointCloudShape(mesh, id);

        cloud.ID       = id;
        cloud.Position = new Tes.Maths.Vector3((float)id);
        return(cloud);
    }
    bool ValidateCloud(Shape shape, Shape referenceShape, MessageHandler handler)
    {
        PointCloudHandler cloudHandler   = (PointCloudHandler)handler;
        PointsComponent   pointsData     = cloudHandler.ShapeCache.GetShapeData <PointsComponent>(shape.ID);
        PointCloudShape   cloudReference = (PointCloudShape)referenceShape;

        if (pointsData == null)
        {
            Debug.LogError("Unable to resolve point cloud data.");
            return(false);
        }

        bool ok = true;

        // Only validate vertices.
        ok = ValidateVectors("Point", pointsData.Mesh.Mesh.Vertices, cloudReference.PointCloud.Vertices()) && ok;

        return(ok);
    }
Exemplo n.º 3
0
        public void ValidatePointCloudShape(Shape shapeArg, Shape referenceArg, Dictionary <ulong, Resource> resources)
        {
            ShapeTestFramework.ValidateShape(shapeArg, referenceArg, resources);
            PointCloudShape shape     = (PointCloudShape)shapeArg;
            PointCloudShape reference = (PointCloudShape)referenceArg;

            Assert.Equal(reference.PointScale, shape.PointScale);
            Assert.NotNull(reference.PointCloud);
            Assert.NotNull(shape.PointCloud);

            Assert.Equal(reference.PointCloud.ID, shape.PointCloud.ID);

            // Resolve the mesh resource.
            Resource resource;

            Assert.True(resources.TryGetValue(shape.PointCloud.UniqueKey(), out resource));
            // Remember, resource will be a SimpleMesh, not a PointCloud.
            MeshResource cloud = (MeshResource)resource;

            ValidateMesh(cloud, reference.PointCloud);
        }