Exemplo n.º 1
0
        protected void CreatePieceMaterials(ContentPackage package)
        {
            SolidColorSpecularMaterial materialWhite    = new SolidColorSpecularMaterial(Vector3.One, MaterialWhiteName);
            SolidColorSpecularMaterial materialBlack    = new SolidColorSpecularMaterial(new Vector3(.5f, .5f, .5f), MaterialBlackName);
            SolidColorSpecularMaterial materialSelected = new SolidColorSpecularMaterial(Color.CornflowerBlue, SelectedMaterialName);

            materialWhite.Load(package);
            materialBlack.Load(package);
            materialSelected.Load(package);
            RenderScene.AddMaterial(materialWhite);
            RenderScene.AddMaterial(materialBlack);
            RenderScene.AddMaterial(materialSelected);

            // Set material parameters
            materialWhite.LightDirection    = new Vector3(1f, -1f, 0f);
            materialBlack.LightDirection    = new Vector3(1f, -1f, 0f);
            materialSelected.LightDirection = new Vector3(1f, -1f, 0f);
            materialWhite.Shininess         = 3f;
            materialBlack.Shininess         = 3f;
            materialSelected.Shininess      = 3f;
            materialWhite.Specularity       = .5f;
            materialBlack.Specularity       = .5f;
            materialSelected.Specularity    = .5f;
        }
Exemplo n.º 2
0
        protected void CreateSelector(ContentPackage package)
        {
            SolidColorSpecularMaterial materialGray = new SolidColorSpecularMaterial(new Vector3(.5f, .5f, 1f), SelectorMaterialName);

            materialGray.Load(package);
            RenderScene.AddMaterial(materialGray);
            materialGray.LightDirection = new Vector3(1f, -1f, 0f);
            materialGray.Shininess      = 3f;
            materialGray.Specularity    = .5f;

            MeshGroup selectorMesh  = package.LoadMeshGroup(SelectorMeshSource);
            Model     selectorModel = new Model()
            {
                Name = SelectorModelName, Material = materialGray, MeshGroup = selectorMesh
            };

            RenderScene.AddModel(selectorModel);

            selector = new RenderNode()
            {
                Model = selectorModel, Transform = Matrix4.Identity
            };
            RenderScene.AddRenderNode(selector);
        }