Пример #1
0
        /// <summary>
        /// Initialize the visualization
        /// </summary>
        /// <param name="sm">The small multiple data to use</param>
        public void Init(VTKUnitySmallMultiple sm, IDataProvider provider, bool isMiniature = false)
        {
            base.Init(sm.SubDataset, provider, isMiniature);

            m_unloadModel = Instantiate(UnloadModel, transform);
            m_unloadModel.SetActive(!m_isMiniature);
            m_materialNormalScale = new Material(ColorMaterial);
            m_materialDownScale   = new Material(ColorMaterialDownScale);

            m_sm = sm;

            //Compute the Mesh. A regular rectangle where ray casting will be applied
            Vector3[] meshPos   = new Vector3[4];
            Vector2[] meshUV    = new Vector2[4];
            int[]     meshFaces = new int[6];

            meshPos[0] = new Vector3(-1, -1, 0);
            meshPos[1] = new Vector3(1, -1, 0);
            meshPos[2] = new Vector3(1, 1, 0);
            meshPos[3] = new Vector3(-1, 1, 0);

            meshUV[0] = new Vector2(0, 0);
            meshUV[1] = new Vector2(1, 0);
            meshUV[2] = new Vector2(1, 1);
            meshUV[3] = new Vector2(0, 1);

            meshFaces[0] = 0; meshFaces[1] = 1; meshFaces[2] = 2;
            meshFaces[3] = 0; meshFaces[4] = 2; meshFaces[5] = 3;

            m_mesh           = new Mesh();
            m_mesh.vertices  = meshPos;
            m_mesh.triangles = meshFaces;
            m_mesh.UploadMeshData(false);
            m_mesh.bounds = new Bounds(new Vector3(0, 0, 0), new Vector3(1, 1, 1));

            //Quad screen mesh
            m_screenTextureMesh           = new Mesh();
            m_screenTextureMesh.vertices  = meshPos;
            m_screenTextureMesh.uv        = meshUV;
            m_screenTextureMesh.triangles = meshFaces;
            m_screenTextureMesh.UploadMeshData(false);
            m_screenTextureMesh.bounds = new Bounds(new Vector3(0, 0, 0), new Vector3(1, 1, 1));

            //Change our transformation matrix
            float maxRatio = Math.Max(m_sm.DescPts.Size[0] / m_sm.Dimensions.x,
                                      Math.Max(m_sm.DescPts.Size[1] / m_sm.Dimensions.y,
                                               m_sm.DescPts.Size[2] / m_sm.Dimensions.z));

            transform.localScale = new Vector3((m_sm.DescPts.Size[0] / m_sm.Dimensions.x) / maxRatio,
                                               (m_sm.DescPts.Size[1] / m_sm.Dimensions.y) / maxRatio,
                                               (m_sm.DescPts.Size[2] / m_sm.Dimensions.z) / maxRatio);

            LinkToSM();

            m_outlineColor = m_dataProvider.GetHeadsetColor(-1);
            Check3DTexture();

            UpdateMaterial();
        }
Пример #2
0
        /// <summary>
        /// Create a small multiple object
        /// </summary>
        /// <parent name="sd">The SubDataset to use</parent>
        /// <returns>A VTKUnitySmallMultiple object.</returns>
        public VTKUnitySmallMultiple CreatePointFieldSmallMultiple(SubDataset sd)
        {
            VTKUnitySmallMultiple sm = new VTKUnitySmallMultiple();

            unsafe
            {
                if (sm.Init(m_dataset.Parser, sd, m_dimensions, m_dataProvider))
                {
                    m_smallMultiples.Add(sm);
                    return(sm);
                }
            }
            return(null);
        }
Пример #3
0
 /// <summary>
 /// Remove a known small multiple
 /// </summary>
 /// <param name="sm">the small multiple to remove</param>
 public void RemoveSmallMultiple(VTKUnitySmallMultiple sm)
 {
     m_smallMultiples.Remove(sm);
 }