Exemplo n.º 1
0
 public virtual void Draw(DrawEventArgs e)
 {
     Matrix4 model = this.modelMatrix * e.ModelMatrix;
     DrawEventArgs child_event = new DrawEventArgs(e.Scene, e.Camera, model);
     foreach (Component child in this.children)
         child.Draw(child_event);
 }
Exemplo n.º 2
0
 public override void Draw(DrawEventArgs e)
 {
     Matrix4 base_model;
     Matrix4.Mult(ref this.modelMatrix, ref e.ModelMatrix, out base_model);
     for(int i = 0; i < 8; i++)
     {
         if (nodes[i] == null) continue;
         Matrix4 model = transforms[i] * base_model;
         DrawEventArgs ec = new DrawEventArgs(e.Scene, e.Camera, model);
         nodes[i].Draw(ec);
     }
 }
Exemplo n.º 3
0
        public override void Draw(DrawEventArgs e)
        {
            /* Calculate Model/View/Projection matrix */
            Matrix4.Mult(ref this.modelMatrix, ref e.ModelMatrix, out mvp);
            Matrix4.Mult(ref mvp, ref e.Camera.ViewProjection, out mvp);

            shader.Use();
            shader.SetMatrix("mvp", ref mvp);

            GL.LineWidth(2.0f);
            geometry.Draw(6);
            GL.LineWidth(1.0f);

            base.Draw(e);
        }
Exemplo n.º 4
0
        public override void Draw(DrawEventArgs e)
        {
            shader.Use();

            /* Calculate Model/View/Projection matrix */
            Matrix4.Mult(ref this.modelMatrix, ref e.ModelMatrix, out mvp);
            Matrix3 m = new Matrix3(mvp);
            shader.SetMatrix3("model", ref m); // TODO: Mat4 instead?
            Matrix4.Mult(ref mvp, ref e.Camera.ViewProjection, out mvp);
            shader.SetMatrix("mvp", ref mvp);

            /* Normal matrix */
            m.Invert();
            m.Transpose();
            shader.SetMatrix3("G", ref m);

            mesh.DrawElements(this.triangles * 3, DrawElementsType.UnsignedShort);

            base.Draw(e);
        }
Exemplo n.º 5
0
        protected override void OnRenderFrame(FrameEventArgs e)
        {
            base.OnRenderFrame(e);
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            shader.Use();

            Vector3 eye = camera.Position;
            shader.SetVector3("eye", ref eye);

            DrawEventArgs args = new DrawEventArgs(null, this.camera, Matrix4.Identity);

            //octree.Draw(args);
            axis.Draw(args);

            shader.Use();
            model.Draw(args);

            SwapBuffers();
        }
Exemplo n.º 6
0
        public override void Draw(DrawEventArgs e)
        {
            shader.Use();

            /* Calculate Model/View/Projection matrix */
            Matrix4.Mult(ref this.modelMatrix, ref e.ModelMatrix, out mvp);
            Matrix3 m = new Matrix3(mvp); // Copy the top-right 3x3 model matrix for later...
            Matrix4.Mult(ref mvp, ref e.Camera.ViewProjection, out mvp);
            shader.SetMatrix("mvp", ref mvp);

            /* Normal matrix */
            m.Invert();
            m.Transpose();
            shader.SetMatrix3("G", ref m);

            geometry.Draw(vertexData.Length);

            base.Draw(e);
        }