Ejemplo n.º 1
0
        public ViewBoxNode()
        {
            RelativeScreenLocationX = 0.8f;
            ViewBoxMeshModel        = new MeshNode()
            {
                EnableViewFrustumCheck = false
            };
            ViewBoxMeshModel.RenderCore.RenderType = RenderType.ScreenSpaced;
            var sampler = DefaultSamplers.LinearSamplerWrapAni1;

            sampler.BorderColor = Color.Gray;
            sampler.AddressU    = sampler.AddressV = sampler.AddressW = TextureAddressMode.Border;

            ViewBoxMeshModel.CullMode             = CullMode.Back;
            ViewBoxMeshModel.OnSetRenderTechnique = (host) => { return(host.EffectsManager[DefaultRenderTechniqueNames.ViewCube]); };
            this.AddChildNode(ViewBoxMeshModel);
            ViewBoxMeshModel.Material = new PhongMaterialCore()
            {
                DiffuseColor      = Color.White,
                DiffuseMapSampler = sampler
            };

            CornerModel = new InstancingMeshNode()
            {
                EnableViewFrustumCheck = false,
                Material = new PhongMaterialCore()
                {
                    DiffuseColor = Color.Yellow
                },
                Geometry  = cornerGeometry,
                Instances = cornerInstances,
                Visible   = false
            };
            CornerModel.OnSetRenderTechnique  = (host) => { return(host.EffectsManager[DefaultRenderTechniqueNames.Diffuse]); };
            CornerModel.RenderCore.RenderType = RenderType.ScreenSpaced;
            this.AddChildNode(CornerModel);

            EdgeModel = new InstancingMeshNode()
            {
                EnableViewFrustumCheck = false,
                Material = new PhongMaterialCore()
                {
                    DiffuseColor = Color.Silver
                },
                Geometry  = edgeGeometry,
                Instances = edgeInstances,
                Visible   = false
            };
            EdgeModel.OnSetRenderTechnique  = (host) => { return(host.EffectsManager[DefaultRenderTechniqueNames.Diffuse]); };
            EdgeModel.RenderCore.RenderType = RenderType.ScreenSpaced;
            this.AddChildNode(EdgeModel);
            UpdateModel(UpDirection);
        }
Ejemplo n.º 2
0
            public ViewBoxNode()
            {
                CameraType = ScreenSpacedCameraType.Perspective;
                RelativeScreenLocationX = 0.8f;
                ViewBoxMeshModel        = new MeshNode()
                {
                    EnableViewFrustumCheck = false, CullMode = CullMode.Back
                };
                var sampler = DefaultSamplers.LinearSamplerWrapAni1;

                sampler.BorderColor = Color.Gray;
                sampler.AddressU    = sampler.AddressV = sampler.AddressW = TextureAddressMode.Border;
                this.AddChildNode(ViewBoxMeshModel);
                ViewBoxMeshModel.Material = new ViewCubeMaterialCore()
                {
                    DiffuseColor      = Color.White,
                    DiffuseMapSampler = sampler
                };

                CornerModel = new InstancingMeshNode()
                {
                    EnableViewFrustumCheck = false,
                    Material = new DiffuseMaterialCore()
                    {
                        DiffuseColor = Color.Yellow
                    },
                    Geometry  = cornerGeometry,
                    Instances = cornerInstances,
                    Visible   = false
                };
                this.AddChildNode(CornerModel);

                EdgeModel = new InstancingMeshNode()
                {
                    EnableViewFrustumCheck = false,
                    Material = new DiffuseMaterialCore()
                    {
                        DiffuseColor = Color.Silver
                    },
                    Geometry  = edgeGeometry,
                    Instances = edgeInstances,
                    Visible   = false
                };
                this.AddChildNode(EdgeModel);
                UpdateModel(UpDirection);
            }