示例#1
0
 private CameraHelper(Camera camera, Geometry geometry, LineBasicMaterial material)
     : base(geometry, material, LineType.Pieces)
 {
     this.camera = camera;
     this.matrixWorld = camera.matrixWorld;
     this.matrixAutoUpdate = false;
 }
示例#2
0
 public static BoxHelper Create(Renderer renderer, Object3D o)
 {
     var mat = new LineBasicMaterial(renderer)
     {
         Diffuse = new Color(0xffff00)
     };
     var geo = new Geometry();
     var boxHelper = new BoxHelper(geo, mat);
     boxHelper.o = o;
     boxHelper.Update();
     return boxHelper;
 }
示例#3
0
        private BoxHelper(Geometry geometry, LineBasicMaterial material)
            : base(geometry, material, LineType.Pieces)
        {

        }
示例#4
0
文件: Line.cs 项目: prepare/three.net
 public Line(Geometry geometry, LineBasicMaterial material, LineType type = LineType.Strip)
 {
     this.geometry = geometry;
     Material = material;
     this.Type = type;
 }
示例#5
0
        public static CameraHelper Create(Renderer renderer, Camera camera)
        {
            var pointMap = new Dictionary<string, List<int>>();

            var geometry = new Geometry();
            var material = new LineBasicMaterial(renderer)
            {
                Diffuse = Color.White,
                VertexColors = VertexColorMode.Vertex
            };
            var cameraHelper = new CameraHelper(camera, geometry, material);

            //Colors
            var hexFrustum = new Color(0xffaa00);
            var hexCone = new Color(0xff0000);
            var hexUp = new Color(0x00aaff);
            var hexTarget = new Color(0xffffff);
            var hexCross = new Color(0x333333);

            // near
            cameraHelper.AddLine("n1", "n2", hexFrustum);
            cameraHelper.AddLine("n2", "n4", hexFrustum);
            cameraHelper.AddLine("n4", "n3", hexFrustum);
            cameraHelper.AddLine("n3", "n1", hexFrustum);
            
            // far
            cameraHelper.AddLine("f1", "f2", hexFrustum);
            cameraHelper.AddLine("f2", "f4", hexFrustum);
            cameraHelper.AddLine("f4", "f3", hexFrustum);
            cameraHelper.AddLine("f3", "f1", hexFrustum);
            
            // sides
            cameraHelper.AddLine("n1", "f1", hexFrustum);
            cameraHelper.AddLine("n2", "f2", hexFrustum);
            cameraHelper.AddLine("n3", "f3", hexFrustum);
            cameraHelper.AddLine("n4", "f4", hexFrustum);
            
            // cone
            cameraHelper.AddLine("p", "n1", hexCone);
            cameraHelper.AddLine("p", "n2", hexCone);
            cameraHelper.AddLine("p", "n3", hexCone);
            cameraHelper.AddLine("p", "n4", hexCone);
            
            // up
            cameraHelper.AddLine("u1", "u2", hexUp);
            cameraHelper.AddLine("u2", "u3", hexUp);
            cameraHelper.AddLine("u3", "u1", hexUp);
            
            // target
            cameraHelper.AddLine("c", "t", hexTarget);
            cameraHelper.AddLine("p", "c", hexCross);
            
            // cross
            cameraHelper.AddLine("cn1", "cn2", hexCross);
            cameraHelper.AddLine("cn3", "cn4", hexCross);
            cameraHelper.AddLine("cf1", "cf2", hexCross);
            cameraHelper.AddLine("cf3", "cf4", hexCross);

            cameraHelper.Update();
            return cameraHelper;
        }