예제 #1
0
    public IEnumerator AlphaTextureShouldWork()
    {
        yield return(InitVisualTestsScene("PBRMaterialVisualTests_AlphaTextureShouldWork"));

        DCLTexture texture = TestHelpers.CreateDCLTexture(scene, Utils.GetTestsAssetsPath() + "/Images/alphaTexture.png");

        yield return(texture.routine);

        Vector3 camTarget = new Vector3(5, 2, 5);

        VisualTestHelpers.RepositionVisualTestsCamera(VisualTestController.i.camera, camTarget - new Vector3(2, -1, 2), camTarget);

        PBRMaterial matPBR = TestHelpers.CreateEntityWithPBRMaterial(scene, new PBRMaterial.Model
        {
            albedoTexture    = texture.id,
            transparencyMode = 2,
            albedoColor      = Color.blue
        }, camTarget, out IDCLEntity entity);

        yield return(matPBR.routine);


        yield return(new WaitForAllMessagesProcessed());

        yield return(VisualTestHelpers.TakeSnapshot());
    }
예제 #2
0
        public IEnumerator VisualTest0()
        {
            yield return(InitVisualTestsScene("AvatarNamesHUD_VisualTest0"));

            //Set the canvas to CameraSpace so it gets renderer in the screenshot
            Canvas canvas = hudView.GetComponent <Canvas>();

            canvas.worldCamera = Camera.main;
            canvas.renderMode  = RenderMode.ScreenSpaceCamera;

            VisualTestHelpers.RepositionVisualTestsCamera(VisualTestController.i.camera, new Vector3(6, 1.2f, -1.5f), new Vector3(6, 1.2f, -1.5f) + Vector3.forward);

            BoxShape     box0  = TestHelpers.CreateEntityWithBoxShape(scene, new Vector3(4, 0, 4), true);
            PlayerStatus user0 = new PlayerStatus {
                id = "user0", name = "The User0 in Box", worldPosition = box0.attachedEntities.First().gameObject.transform.position, isTalking = false
            };

            yield return(box0.routine);

            hudView.TrackPlayer(user0);

            SphereShape  sphere = TestHelpers.CreateEntityWithSphereShape(scene, new Vector3(8, 0, 8), true);
            PlayerStatus user1  = new PlayerStatus {
                id = "user1", name = "The User1 in Sphere", worldPosition = sphere.attachedEntities.First().gameObject.transform.position, isTalking = true
            };

            yield return(sphere.routine);

            hudView.TrackPlayer(user1);

            yield return(null);

            yield return(VisualTestHelpers.TakeSnapshot());
        }
    public IEnumerator AlbedoTexture_AlbedoAlpha(float alpha)
    {
        yield return(InitVisualTestsScene($"PBRMaterialVisualTests_AlbedoTexture_AlbedoAlpha_{alpha.ToString(CultureInfo.InvariantCulture)}"));

        VisualTestHelpers.SetSSAOActive(true);

        Vector3 camTarget = new Vector3(5, 1, 5);

        VisualTestHelpers.RepositionVisualTestsCamera(VisualTestController.i.camera, new Vector3(4.6f, 1.8f, 0.6f), camTarget);

        DCLTexture texture = TestHelpers.CreateDCLTexture(scene, TestAssetsUtils.GetPath() + "/Images/avatar.png");

        yield return(texture.routine);

        PlaneShape plane       = TestHelpers.CreateEntityWithPlaneShape(scene, new Vector3(5, 1, 5), true);
        IDCLEntity planeEntity = plane.attachedEntities.FirstOrDefault();

        TestHelpers.SetEntityTransform(scene, planeEntity, new Vector3(5, 1, 5), Quaternion.Euler(0, 0, 180), Vector3.one * 3);
        PBRMaterial planeMaterial = TestHelpers.AttachPBRMaterialToEntity(scene, planeEntity, new PBRMaterial.Model
        {
            transparencyMode = 2,
            albedoTexture    = texture.id,
            albedoColor      = new Color(1, 1, 1, alpha)
        });

        yield return(plane.routine);

        yield return(planeMaterial.routine);

        yield return(null);

        yield return(VisualTestHelpers.TakeSnapshot());
    }
    public IEnumerator AlphaTestWearable()
    {
        //Arrange
        yield return(InitVisualTestsScene("WearableVisualTests_AlphaTestWearable"));

        VisualTestHelpers.RepositionVisualTestsCamera(VisualTestController.i.camera, new Vector3(8, 1.8f, 9), new Vector3(8, 1.75f, 8));
        const string ALPHA_TEST_WEARABLE_ID = "urn:decentraland:ethereum:collections-v1:tech_tribal_marc0matic:techtribal_beast_mask";

        //Act
        yield return(LoadWearable(ALPHA_TEST_WEARABLE_ID, WearableLiterals.BodyShapes.MALE, new Vector3(8, -0.75f, 8)));

        //Assert
        yield return(VisualTestHelpers.TakeSnapshot());
    }
    public IEnumerator AlphaBlendWearable()
    {
        //Arrange
        yield return(InitVisualTestsScene("WearableVisualTests_AlphaBlendWearable"));

        VisualTestHelpers.RepositionVisualTestsCamera(VisualTestController.i.camera, new Vector3(8, 1.8f, 9), new Vector3(8, 1.75f, 8));
        const string ALPHA_BLEND_WEARABLE_ID = "urn:decentraland:ethereum:collections-v1:community_contest:cw_raver_eyewear";

        //Act
        yield return(LoadWearable(ALPHA_BLEND_WEARABLE_ID, WearableLiterals.BodyShapes.MALE, new Vector3(8, -0.65f, 8.5f)));

        //Assert
        yield return(VisualTestHelpers.TakeSnapshot());
    }
    public IEnumerator EmissiveWearable()
    {
        //Arrange
        yield return(InitVisualTestsScene("WearableVisualTests_EmissiveWearable"));

        VisualTestHelpers.RepositionVisualTestsCamera(VisualTestController.i.camera, new Vector3(8, 1.8f, 9), new Vector3(8, 1.75f, 8));
        const string EMISSIVE_WEARABLE_ID = "urn:decentraland:ethereum:collections-v1:dc_niftyblocksmith:blocksmith_feet";

        //Act
        yield return(LoadWearable(EMISSIVE_WEARABLE_ID, WearableLiterals.BodyShapes.MALE, new Vector3(8, 1, 8)));

        //Assert
        yield return(VisualTestHelpers.TakeSnapshot());
    }
예제 #7
0
        public IEnumerator AvatarShapeVisualTest2()
        {
            yield return(InitVisualTestsScene("AvatarShape_B"));

            AvatarAssetsTestHelpers.CreateTestCatalogLocal();
            AvatarShape avatar = AvatarShapeTestHelpers.CreateAvatarShape(scene, "Avatar #2", "TestAvatar2.json");

            Vector3 camPos    = new Vector3(-0.75f, 2.0f, 2.25f);
            Vector3 camTarget = avatar.transform.position + Vector3.up * 2.0f;

            VisualTestHelpers.RepositionVisualTestsCamera(camPos, camTarget);

            yield return(new DCL.WaitUntil(() => avatar.everythingIsLoaded, 20));

            yield return(VisualTestHelpers.TakeSnapshot());
        }
        public IEnumerator MouthWithMask()
        {
            yield return(InitVisualTestsScene("AvatarShapeVisualTests_MouthWithMask"));

            AvatarAssetsTestHelpers.CreateTestCatalogLocal();
            var         model  = AvatarShapeTestHelpers.GetTestAvatarModel("Avatar #1", "TestAvatar_MaskMouth.json");
            AvatarShape avatar = AvatarShapeTestHelpers.CreateAvatarShape(scene, model);

            Vector3 camPos    = new Vector3(-0.75f, 2.0f, 2.25f);
            Vector3 camTarget = avatar.transform.position + Vector3.up * 2.0f;

            VisualTestHelpers.RepositionVisualTestsCamera(camPos, camTarget);

            yield return(new WaitUntil(() => avatar.everythingIsLoaded, 20));

            yield return(VisualTestHelpers.TakeSnapshot());
        }
    [Explicit, Category("Explicit")] //Enable the test once we properly render opaque objects with SSAO behind transparents
    public IEnumerator TransparentObjectsAndSSAO()
    {
        yield return(InitVisualTestsScene("PBRMaterialVisualTests_TransparentObjectsAndSSAO"));

        VisualTestHelpers.SetSSAOActive(true);

        Vector3 camTarget = new Vector3(5, 1, 5);

        VisualTestHelpers.RepositionVisualTestsCamera(VisualTestController.i.camera, new Vector3(4.6f, 1.8f, 0.6f), camTarget);

        PlaneShape plane       = TestHelpers.CreateEntityWithPlaneShape(scene, new Vector3(5, 1, 5), true);
        IDCLEntity planeEntity = plane.attachedEntities.FirstOrDefault();

        TestHelpers.SetEntityTransform(scene, planeEntity, new Vector3(5, 1, 5), Quaternion.identity, Vector3.one * 3);
        PBRMaterial planeMaterial = TestHelpers.AttachPBRMaterialToEntity(scene, planeEntity, new PBRMaterial.Model {
            alphaTest = 1, transparencyMode = 1, albedoColor = Vector4.one
        });

        yield return(plane.routine);

        yield return(planeMaterial.routine);

        BoxShape    box1         = TestHelpers.CreateEntityWithBoxShape(scene, new Vector3(4, 1, 6), true);
        PBRMaterial box1Material = TestHelpers.AttachPBRMaterialToEntity(scene, box1.attachedEntities.FirstOrDefault(), new PBRMaterial.Model {
            transparencyMode = 0, albedoColor = Color.blue
        });

        yield return(box1.routine);

        yield return(box1Material.routine);

        BoxShape    box2         = TestHelpers.CreateEntityWithBoxShape(scene, new Vector3(5, 1, 6.5f), true);
        PBRMaterial box2Material = TestHelpers.AttachPBRMaterialToEntity(scene, box2.attachedEntities.FirstOrDefault(), new PBRMaterial.Model {
            transparencyMode = 0, albedoColor = Color.red
        });

        yield return(box2.routine);

        yield return(box2Material.routine);

        yield return(null);

        yield return(VisualTestHelpers.TakeSnapshot());
    }
예제 #10
0
    public IEnumerator ProcessTexturesUVs()
    {
        yield return(InitVisualTestsScene("GLTFImporterVisualTests_ProcessTexturesUVs"));

        GLTFShape gltfShape = TestHelpers.CreateEntityWithGLTFShape(scene, Vector3.zero, Utils.GetTestsAssetsPath() + "/GLB/PlaneUVsMultichannel/PlaneUVsMultichannel.glb", out DecentralandEntity entity);

        yield return(gltfShape.routine);

        yield return(new WaitForAllMessagesProcessed());

        yield return(new WaitUntil(() => GLTFComponent.downloadingCount == 0));

        Vector3 camPos    = new Vector3(0f, 2f, 5f);
        Vector3 camTarget = new Vector3(7.5f, 0f, 10f);

        VisualTestHelpers.RepositionVisualTestsCamera(camPos, camTarget);
        yield return(new WaitForAllMessagesProcessed());

        yield return(VisualTestHelpers.TakeSnapshot());
    }
예제 #11
0
    public IEnumerator CastShadowTrueShouldWork()
    {
        yield return(InitVisualTestsScene("BasicMaterialVisualTests_CastShadowTrueShouldWork"));

        Vector3 camTarget = new Vector3(5, 1, 5);

        VisualTestHelpers.RepositionVisualTestsCamera(camTarget + new Vector3(5, 1, 5), camTarget);

        BasicMaterial basicMaterialComponent = TestHelpers.CreateEntityWithBasicMaterial(scene, new BasicMaterial.Model
        {
            alphaTest   = 1f,
            castShadows = true
        }, camTarget, out DecentralandEntity entity);

        yield return(basicMaterialComponent.routine);

        yield return(new WaitForAllMessagesProcessed());

        yield return(VisualTestHelpers.TakeSnapshot());
    }
예제 #12
0
    public IEnumerator ReceiveShadowsCorrectly()
    {
        yield return(InitVisualTestsScene("PlaneShape_ReceiveShadowsCorrectly"));

        TestHelpers.CreateEntityWithBoxShape(scene, Vector3.up);

        var planeShape = TestHelpers.CreateEntityWithPlaneShape(scene, Vector3.zero);
        var entity     = planeShape.attachedEntities.First();

        TestHelpers.SetEntityTransform(scene, entity, Vector3.zero, Quaternion.Euler(90, 0, 0), Vector3.one);

        Vector3 camPos    = new Vector3(-0.75f, 2.0f, 2.25f);
        Vector3 camTarget = Vector3.zero;

        VisualTestHelpers.RepositionVisualTestsCamera(camPos, camTarget);

        yield return(new WaitForAllMessagesProcessed());

        yield return(VisualTestHelpers.TakeSnapshot());
    }
    public IEnumerator ProcessTextureOffsetAndScale()
    {
        yield return(InitVisualTestsScene("GLTFImporterVisualTests_ProcessTextureOffsetAndScale"));

        GLTFShape gltfShape = TestHelpers.CreateEntityWithGLTFShape(scene, Vector3.zero, TestAssetsUtils.GetPath() + "/GLB/PlaneUVsOffset/planeUVsOffset.glb", out IDCLEntity entity);

        yield return(gltfShape.routine);

        yield return(new WaitForAllMessagesProcessed());

        yield return(new WaitUntil(() => GLTFComponent.downloadingCount == 0));

        Vector3 camPos    = new Vector3(0f, 2f, 5f);
        Vector3 camTarget = new Vector3(7.5f, 0f, 10f);

        VisualTestHelpers.RepositionVisualTestsCamera(VisualTestController.i.camera, camPos, camTarget);
        yield return(new WaitForAllMessagesProcessed());

        yield return(VisualTestHelpers.TakeSnapshot());
    }
    public IEnumerator StandardConfigurations()
    {
        yield return(InitVisualTestsScene("PBRMaterialVisualTests_StandardConfigurations"));

        Vector3 camTarget = new Vector3(8, 3, 8);

        VisualTestHelpers.RepositionVisualTestsCamera(VisualTestController.i.camera, new Vector3(9, 4, 17), camTarget);

        GLTFShape gltfShape = TestHelpers.CreateEntityWithGLTFShape(scene, Vector3.zero,
                                                                    new LoadableShape.Model
        {
            src = TestAssetsUtils.GetPath() + "/GLB/MaterialsScene.glb"
        }, out IDCLEntity entity);

        TestHelpers.SetEntityTransform(scene, entity, new DCLTransform.Model {
            position = new Vector3(0, 0, 8), rotation = Quaternion.Euler(90, 180, 0)
        });

        LoadWrapper loader = GLTFShape.GetLoaderForEntity(entity);

        yield return(new WaitUntil(() => loader.alreadyLoaded));

        yield return(VisualTestHelpers.TakeSnapshot());
    }