Example #1
0
        /// <summary>
        /// Construct the new Window
        /// </summary>
        public ASWindow()
        {
            InitializeComponent();

            // Init the world info dictionary and set its values
            m_worldInfo = new Dictionary <string, int>();
            SetWorldInfo();

            // Create a new model from file and then build the, by default we
            // will draw the cube to the screen
            m_model    = new ASMesh(m_currModel);
            m_renderer = new ASRenderer(m_model.GetMeshData(), this);

            // Create the model list and update the GUI labels for this mesh
            // and then set the world info dictionary
            InitModelList();
            UpdateLabels();
        }
Example #2
0
        /// <summary>
        /// Calls the renderer to draw the mesh to the screen
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void canvas_Paint(object sender, PaintEventArgs e)
        {
            // Check if the mesh has already been drawn, there was a bug where
            // the canvas would keep firing draw events, wasn't showing in stack trace
            // so this is a temp fix...This bool is reset on a btnDraw click event
            if (m_hasBeenDrawn)
            {
                return;
            }

            // Set the model to draw
            m_model = new ASMesh(m_currModel);

            // Update the renderer and then reload the canvas
            m_renderer.SetWorldInfo(m_worldInfo, m_originX, m_originY, m_scaleFactor, m_showPoints);
            m_renderer.SetMeshData(m_model.GetMeshData());

            UpdateLabels();
            m_hasBeenDrawn = m_renderer.RenderMesh();
        }