示例#1
0
        public IEnumerator TestGetModelOutput()
        {
            var modelOutput = new Core.Data.GemPy.Output
            {
                RexMeshData = new byte[] { 0x20, }
            };

            bool waiting = true;

            rest.LoadModel(geoModelUrn: testModelName)
            .Then(() =>
            {
                return(rest.GetModelOutput(geoModelUrn: testModelName));
            })
            .Then(_modelOutput =>
            {
                modelOutput = _modelOutput;

                waiting = false;
            });

            while (waiting)
            {
                yield return(null);
            }

            Assert.AreEqual(modelOutput.RexMeshData.Length, 760214);
        }
示例#2
0
        public IEnumerator TestSpawnModelOutput()
        {
            bool waiting = true;

            int expectedSpawnedMeshesCount = 6;

            var container = new Core.Data.GemPy.GameObjectContainers.Output();

            rest.LoadModel(geoModelUrn: testModelName)
            .Then(() =>
            {
                return(rest.GetModelOutput(geoModelUrn: testModelName));
            })
            .Then(modelOutput =>
            {
                return(spawning.SpawnModelOutput(
                           outputData: modelOutput,
                           outputContainer: container));
            })
            .Then(() =>
            {
                waiting = false;
            })
            .Catch(error =>
            {
                Debug.Log(error.Message);

                waiting = false;
            });

            while (waiting)
            {
                yield return(null);
            }

            int meshRendererCount = container.RexMeshesGameObject.GetComponentsInChildren <MeshRenderer>().Length;

            Debug.Log("Spawned " + meshRendererCount + " game objects with mesh renderers.");

            Assert.AreEqual(expectedSpawnedMeshesCount, meshRendererCount);
        }