Example #1
0
        /// <summary>
        /// Constructor
        /// </summary>
        public OpenGLPanelViewState()
        {
            ang3D = 0;
            viewZoom = 1;
            viewZoomLinear = 0;

            viewOffset = new Vector2(0.0f, 0.0f);
            viewTempOffset = new Vector2(0.0f, 0.0f);

            drawNutrientInitialPos = false;

             crossSection = new Boundary(BoundaryShapes.Cuboid, 100, 100, 5, 0);
            crossSectionFacing = CrossSectionFacingDirection.Front;
            CrossSectionOffset = new Vector3(0,0,0);
            crossSectionEnabled = false;

            currentCameraPos = CameraPosition.Corner;
            nextCameraPos = CameraPosition.Front;
            animationCounter = 0.0f;
            angAboutY = 0.0f;
            oldAngAboutY = 0.0f;

            currentCamCoords = new Vector3(80.0f, 80.0f, 80.0f);
            oldCamCoords = new Vector3(0.0f, 0.0f, 0.0f);
            currentUpVect = new Vector3(0.0f, 1.0f, 0.0f);
            oldUpVect = new Vector3(0.0f, 0.0f, 0.0f);
        }
Example #2
0
        /// <summary>
        /// updates the size of the cross section given a facing and boundary
        /// </summary>
        /// <param name="facing"></param>
        /// <param name="bounds"></param>
        public void UpdateCrossSectionSize(CrossSectionFacingDirection facing, Boundary bounds)
        {
            float width = 0;
            float height = 0;
            float depth = 0;

            this.crossSectionFacing = facing;

            switch (bounds.Shape)
            {

                case BoundaryShapes.Cuboid:

                    width = bounds.Width;
                    height = bounds.Height;
                    depth = bounds.Depth;

                    break;

                case BoundaryShapes.Cylinder:

                    width = depth = bounds.Radius * 2;
                    height = bounds.Height;

                    break;

                case BoundaryShapes.Sphere:

                    width = height = depth = bounds.Radius * 2;

                    break;

            }

            switch (facing)
            {

                case CrossSectionFacingDirection.Front:
                    crossSection = new Boundary(BoundaryShapes.Cuboid, width * 1.3f, height * 1.3f, depth*0.05f, 0);
                    break;

                case CrossSectionFacingDirection.Top:
                    crossSection = new Boundary(BoundaryShapes.Cuboid, width * 1.3f, height * 0.05f, depth * 1.3f, 0);
                    break;

            }
        }