Exemplo n.º 1
0
		/// <summary>
		/// Get Default
		/// </summary>
		/// <returns></returns>
		public static RenderingContext Default()
		{
			RenderingContext ret = new RenderingContext();
			ret.UseNormal = true;
			ret.UseObjectColor = true;
			ret.Wireframe = false;
			ret.DefaultFaceMaterial = GLMaterial.Default();
			ret.DefaultLineMaterial = GLMaterial.Default();
			ret.DefaultLineMaterial.Ambiant = Color.DarkGray;
			ret.Lightning = true;
			return ret;
		}
Exemplo n.º 2
0
			/// <summary>
			/// Render this Slice to OpenGL
			/// </summary>
			/// <param name="context"></param>
        public override void Render(ref RenderingContext context)
        {
					if (context.Wireframe)
					{
						GL.PolygonOffset(-1, -1);
						RenderingContext linecontext = context;
						linecontext.Lightning = false;
						linecontext.UseObjectColor = context.UseObjectColor;
						RenderAsWireFrame(ref linecontext);
					}
					GL.PolygonOffset(0, 0);
					RenderAsFace(ref context);
				}
Exemplo n.º 3
0
			/// <summary>
			/// Render thes Slice WireFrame
			/// </summary>
			/// <param name="context"></param>
        protected void RenderAsWireFrame(ref RenderingContext context)
        {
            PrimitiveType oldPrim = m_Primitive;
            m_Primitive = PrimitiveType.LineStrip;
            context.ApplyLineDefault();
	           base.Render(ref context);

            ScanLine l1 = new ScanLine(-1, Count / 2);
            ScanLine l2 = new ScanLine(-1, Count / 2);
            for (int i = 0; i < Count; i++)
                if (i % 2 == 0)
                    l1.Add(this[i]);
                else
                    l2.Add(this[i]);
            l1.Render(ref context);
            l2.Render(ref context);

            m_Primitive = oldPrim;
        }
Exemplo n.º 4
0
			/// <summary>
			/// Render this slice Faces
			/// </summary>
			/// <param name="context"></param>
        protected void RenderAsFace(ref RenderingContext context)
        {
            PrimitiveType oldPrim = m_Primitive;
            context.ApplyFaceDefault();
            m_Primitive = PrimitiveType.TriangleStrip;
            base.Render(ref context);
            m_Primitive=oldPrim;
        }
Exemplo n.º 5
0
		/// <summary>
		/// Render this point to OpenGL
		/// </summary>
		/// <param name="context"></param>
		public void ToGL(ref RenderingContext context)
		{
			if (context.UseObjectColor)
				GL.Color3(Color);
			if (context.UseNormal)
				GL.Normal3(Normal);
			GL.Vertex3(Position);
		}