Пример #1
0
 void Awake()
 {
     //Rey取得
     gvrRay     = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <GvrPointerPhysicsRaycaster> ();
     lightTrans = lightTrans_obj.GetComponent <LightTransform> ();
     mana_bar   = mana_bar_obj.GetComponent <circleProcess> ();
 }
Пример #2
0
        public void UpdateTransform()
        {
            if (ModelRepresentation != null)
            {
                if (ViewLotEditor.LightTypes[this.LightType.InstanceId] == "Spot")
                {
                    Transform3DGroup transforms = new Transform3DGroup();
                    transforms.Children.Add(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(1, 0, 0), 90)));
                    transforms.Children.Add(new MatrixTransform3D(this.ModelRepresentation.Transform.Value));

                    LightTransform.SetMatrix(transforms.Value);
                }
                else if (ViewLotEditor.LightTypes[this.LightType.InstanceId] == "Point")
                {
                    LightTransform.SetMatrix(this.ModelRepresentation.Transform.Value);
                }
                else if (ViewLotEditor.LightTypes[this.LightType.InstanceId] == "Line")
                {
                    Transform3DGroup transforms = new Transform3DGroup();

                    transforms.Children.Add(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(1, 0, 0), -90)));
                    transforms.Children.Add(new MatrixTransform3D(this.ModelRepresentation.Transform.Value));


                    LightTransform.SetMatrix(transforms.Value);
                }
            }
        }
Пример #3
0
        public LotEditorItemMarker CreateGeometry()
        {
            LotEditorItemMarker marker;

            if (this.ModelRepresentation == null)
            {
                marker = new LotEditorItemMarker(this);
            }
            else
            {
                marker = this.ModelRepresentation;
            }

            if (ViewLotEditor.LightTypes[LightType.InstanceId] == "Spot")
            {
                TruncatedConeVisual3D cone = new TruncatedConeVisual3D();
                cone.Height     = LightLength.Value;
                cone.BaseRadius = 0;
                cone.TopRadius  = LightOuterRadius.Value;
                Transform3DGroup transforms = new Transform3DGroup();
                transforms.Children.Add(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(1, 0, 0), -90)));
                Transform3D coneTransform = new MatrixTransform3D(LightTransform.GetAsMatrix3D());
                transforms.Children.Add(coneTransform);
                // cone.Transform = transforms;

                cone.Material = MaterialHelper.CreateMaterial(Brushes.Black, new SolidColorBrush(LightColor.Color), opacity: 0.6);
                //ModelRepresentation.Model = cone.Model;

                marker.Transform        = transforms;
                marker.ManipulatorModel = cone.Model;
                ModelRepresentation     = marker;
                return(marker);
            }
            else if (ViewLotEditor.LightTypes[LightType.InstanceId] == "Point")
            {
                HelixToolkit.Wpf.SphereVisual3D sphere = new HelixToolkit.Wpf.SphereVisual3D();
                sphere.Radius = 1;

                sphere.Material = MaterialHelper.CreateMaterial(Brushes.Black, new SolidColorBrush(LightColor.Color));

                marker.Transform        = new MatrixTransform3D(LightTransform.GetAsMatrix3D());
                marker.ManipulatorModel = sphere.Model;
                ModelRepresentation     = marker;
                return(marker);
            }
            else if (ViewLotEditor.LightTypes[LightType.InstanceId] == "Line")
            {
                BoxVisual3D lineLight = new BoxVisual3D();
                lineLight.Height = LightLength.Value;

                lineLight.Center = new Point3D(0, 0, -(LightLength.Value / 2));

                Transform3DGroup transforms = new Transform3DGroup();
                // transforms.Children.Add(new TranslateTransform3D(0, 0, -(light.LightLength / 2)));
                transforms.Children.Add(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(1, 0, 0), 90)));
                transforms.Children.Add(new MatrixTransform3D(LightTransform.GetAsMatrix3D()));

                lineLight.Material = MaterialHelper.CreateMaterial(Brushes.Black, new SolidColorBrush(LightColor.Color));

                marker.Transform        = transforms;
                marker.ManipulatorModel = lineLight.Model;
                ModelRepresentation     = marker;
                return(marker);
            }

            return(new LotEditorItemMarker(this));
        }