Esempio n. 1
0
    private CubeElement CreateElement(CubeElement _, int i, int j, int k)
    {
        CubeElement element = Instantiate(cubeElementPrefab, transform);

        element.name          = $"Cube Element [{i}, {j}, {k}]";
        element.LocalPosition = GetElementLocalPosition(i, j, k);
        return(element);
    }
Esempio n. 2
0
 public Vector3Int IndexesOf(CubeElement cubeElement)
 {
     int[] indexes = elements.FindIndex((element => element == cubeElement));
     if (indexes == null)
     {
         return(Vector3Int.one * -1);
     }
     return(new Vector3Int(indexes[0], indexes[1], indexes[2]));
 }
Esempio n. 3
0
    public void Read_Xml()
    {
        if (File.Exists(filePath))
        {
            XmlDocument document = new XmlDocument();

            document.Load(filePath);

            XmlElement mapElement = document["MapInfo"];

            mapInfo.Clear();
            foreach (XmlElement CubeElement in mapElement.ChildNodes)
            {
                Cube.CubePosition a = new Cube.CubePosition();
                a.type = System.Convert.ToInt32(CubeElement.GetAttribute("type"));
                var x = System.Convert.ToInt32(CubeElement.GetAttribute("positionX"));
                var y = System.Convert.ToInt32(CubeElement.GetAttribute("positionY"));
                var z = System.Convert.ToInt32(CubeElement.GetAttribute("positionZ"));
                a.position = new Vector3(x, y, z);
                mapInfo.Add(a);
            }
        }
    }
Esempio n. 4
0
 private void ToggleElementVisibility(CubeElement element)
 {
     element.ToggleVisibility();
 }
Esempio n. 5
0
 private bool IsElementZero(CubeElement _, int i, int j, int k)
 {
     return(App.model.cube.FormulaTensor[i, j, k] == "0");
 }
Esempio n. 6
0
 private void SetFormulaTexture(CubeElement element, int i, int j, int k)
 {
     element.FormulaTexture = App.model.cube.FormulaTextures[i, j, k];
 }
Esempio n. 7
0
 private void ShowElement(CubeElement element)
 {
     element.Appear();
 }
Esempio n. 8
0
 private void HideElement(CubeElement element)
 {
     element.Disappear();
 }
    private void SetHitElementIndexes()
    {
        CubeElement hitElement = hit.transform.GetComponent <CubeElement>();

        App.model.cube.SelectedCubeElementIndexes = App.view.cube.IndexesOf(hitElement);
    }
Esempio n. 10
0
        public FormCube()
        {
            InitializeComponent();

            //if (CameraDictionary.Instance.ContainsKey(this.GetType().Name))
            //{
            //    this.camera = CameraDictionary.Instance[this.GetType().Name];
            //}
            //else
            {
                this.camera = new Camera(CameraType.Ortho, this.glCanvas1.Width, this.glCanvas1.Height);
                //CameraDictionary.Instance.Add(this.GetType().Name, this.camera);
            }

            satelliteRoration = new SatelliteRotator(camera);

            Padding padding = new System.Windows.Forms.Padding(40, 40, 40, 40);
            Size    size    = new Size(100, 100);
            //Size size = new Size(5, 5);
            IUILayoutParam param;

            param            = new IUILayoutParam(AnchorStyles.Left | AnchorStyles.Bottom, padding, size);
            uiLeftBottomAxis = new SimpleUIAxis(param);
            //param = new IUILayoutParam(AnchorStyles.Left | AnchorStyles.Top, padding, size);
            //uiLeftTopAxis = new SimpleUIAxis(param);
            //param = new IUILayoutParam(AnchorStyles.Right | AnchorStyles.Bottom, padding, size);
            //uiRightBottomAxis = new SimpleUIAxis(param);
            //param = new IUILayoutParam(AnchorStyles.Right | AnchorStyles.Top, padding, size);
            //uiRightTopAxis = new SimpleUIAxis(param);

            uiLeftBottomAxis.Initialize();
            //uiLeftTopAxis.Initialize();
            //uiRightBottomAxis.Initialize();
            //uiRightTopAxis.Initialize();

            param = new IUILayoutParam(AnchorStyles.Left | AnchorStyles.Bottom, padding, size);
            //uiLeftBottomRect = new SimpleUIRect(param);
            //param = new IUILayoutParam(AnchorStyles.Left | AnchorStyles.Top, padding, size);
            //uiLeftTopRect = new SimpleUIRect(param);
            //param = new IUILayoutParam(AnchorStyles.Right | AnchorStyles.Bottom, padding, size);
            //uiRightBottomRect = new SimpleUIRect(param);
            //param = new IUILayoutParam(AnchorStyles.Right | AnchorStyles.Top, padding, size);
            //uiRightTopRect = new SimpleUIRect(param);

            //uiLeftBottomRect.Initialize();
            //uiLeftTopRect.Initialize();
            //uiRightBottomRect.Initialize();
            //uiRightTopRect.Initialize();

            cubeElement = new CubeElement();
            cubeElement.Initialize();
            cubeElement.BeforeRendering += cubeElement_BeforeRendering;
            cubeElement.AfterRendering  += cubeElement_AfterRendering;

            lightElement = new PyramidElement();
            lightElement.Initialize();
            lightElement.BeforeRendering += lightElement_BeforeRendering;
            lightElement.AfterRendering  += lightElement_AfterRendering;

            this.glCanvas1.MouseWheel += glCanvas1_MouseWheel;
            this.glCanvas1.KeyPress   += glCanvas1_KeyPress;
            this.glCanvas1.MouseDown  += glCanvas1_MouseDown;
            this.glCanvas1.MouseMove  += glCanvas1_MouseMove;
            this.glCanvas1.MouseUp    += glCanvas1_MouseUp;
            this.glCanvas1.OpenGLDraw += glCanvas1_OpenGLDraw;
            this.glCanvas1.Resize     += glCanvas1_Resize;
        }
Esempio n. 11
0
        public FormCube()
        {
            InitializeComponent();

            //if (CameraDictionary.Instance.ContainsKey(this.GetType().Name))
            //{
            //    this.camera = CameraDictionary.Instance[this.GetType().Name];
            //}
            //else
            {
                this.camera = new Camera(CameraType.Ortho, this.glCanvas1.Width, this.glCanvas1.Height);
                //CameraDictionary.Instance.Add(this.GetType().Name, this.camera);
            }

            satelliteRoration = new SatelliteRotator(camera);

            Padding padding = new System.Windows.Forms.Padding(40, 40, 40, 40);
            Size size = new Size(100, 100);
            //Size size = new Size(5, 5);
            IUILayoutParam param;
            param = new IUILayoutParam(AnchorStyles.Left | AnchorStyles.Bottom, padding, size);
            uiLeftBottomAxis = new SimpleUIAxis(param);
            //param = new IUILayoutParam(AnchorStyles.Left | AnchorStyles.Top, padding, size);
            //uiLeftTopAxis = new SimpleUIAxis(param);
            //param = new IUILayoutParam(AnchorStyles.Right | AnchorStyles.Bottom, padding, size);
            //uiRightBottomAxis = new SimpleUIAxis(param);
            //param = new IUILayoutParam(AnchorStyles.Right | AnchorStyles.Top, padding, size);
            //uiRightTopAxis = new SimpleUIAxis(param);

            uiLeftBottomAxis.Initialize();
            //uiLeftTopAxis.Initialize();
            //uiRightBottomAxis.Initialize();
            //uiRightTopAxis.Initialize();

            param = new IUILayoutParam(AnchorStyles.Left | AnchorStyles.Bottom, padding, size);
            //uiLeftBottomRect = new SimpleUIRect(param);
            //param = new IUILayoutParam(AnchorStyles.Left | AnchorStyles.Top, padding, size);
            //uiLeftTopRect = new SimpleUIRect(param);
            //param = new IUILayoutParam(AnchorStyles.Right | AnchorStyles.Bottom, padding, size);
            //uiRightBottomRect = new SimpleUIRect(param);
            //param = new IUILayoutParam(AnchorStyles.Right | AnchorStyles.Top, padding, size);
            //uiRightTopRect = new SimpleUIRect(param);

            //uiLeftBottomRect.Initialize();
            //uiLeftTopRect.Initialize();
            //uiRightBottomRect.Initialize();
            //uiRightTopRect.Initialize();

            cubeElement = new CubeElement();
            cubeElement.Initialize();
            cubeElement.BeforeRendering += cubeElement_BeforeRendering;
            cubeElement.AfterRendering += cubeElement_AfterRendering;

            lightElement = new PyramidElement();
            lightElement.Initialize();
            lightElement.BeforeRendering += lightElement_BeforeRendering;
            lightElement.AfterRendering += lightElement_AfterRendering;

            this.glCanvas1.MouseWheel += glCanvas1_MouseWheel;
            this.glCanvas1.KeyPress += glCanvas1_KeyPress;
            this.glCanvas1.MouseDown += glCanvas1_MouseDown;
            this.glCanvas1.MouseMove += glCanvas1_MouseMove;
            this.glCanvas1.MouseUp += glCanvas1_MouseUp;
            this.glCanvas1.OpenGLDraw += glCanvas1_OpenGLDraw;
            this.glCanvas1.Resize += glCanvas1_Resize;
        }