Exemplo n.º 1
0
		public override void InitializeGraphics()
		{
			if (mat == null)
			{
				Glorg2.Resource.MaterialImporter imp = new Glorg2.Resource.MaterialImporter();
				using (var stream = System.IO.File.OpenRead(".\\shaders\\Default.mxl"))
				{
					mat = imp.Import<StdMaterial>(stream, "Default", null);
				}
			}
				CylinderBuilder builder = new CylinderBuilder()
				{
					Height = 1,
					Radius = 1,
					Sides = 32
				};
				model = builder.Build();

		}
Exemplo n.º 2
0
        public override void InitializeGraphics()
        {
            if (mat == null)
            {
                Glorg2.Resource.MaterialImporter imp = new Glorg2.Resource.MaterialImporter();
                using (var stream = System.IO.File.OpenRead(".\\shaders\\Default.mxl"))
                {
                    mat = imp.Import <StdMaterial>(stream, "Default", null);
                }
            }
            CylinderBuilder builder = new CylinderBuilder()
            {
                Height = 1,
                Radius = 1,
                Sides  = 32
            };

            model = builder.Build();
        }
Exemplo n.º 3
0
        public void InitializeGraphics()
        {
            if (vb != null)
                vb.Dispose();

            if (mat == null)
            {
                Glorg2.Resource.MaterialImporter imp = new Glorg2.Resource.MaterialImporter();
                using(var stream = System.IO.File.OpenRead(".\\shaders\\Grid.mxl"))
                {
                    mat = imp.Import<StdMaterial>(stream, "grid", null);
                }
            }
            vb = new VertexBuffer<WireframeVertex>(WireframeVertex.Description);

            vb.Allocate(Columns * 2 + Rows * 2 + 4);
            float tot_w = Size * Columns;
            float tot_h = Size * Rows;
            float fi = -tot_w / 2;
            int i;
            for (i = 0; i <= Columns; i++, fi += Size)
            {
                Vector4 color;
                if(Major == 0 || (i % Major) == 0)
                    color = MajorColor;
                else
                    color = MinorColor;
                vb[i * 2]     = new WireframeVertex() { Position = new Vector3(fi, 0, -tot_h / 2), Color = color };
                vb[i * 2 + 1] = new WireframeVertex() { Position = new Vector3(fi, 0,  tot_h / 2), Color = color };
            }
            int start = i * 2;
            fi = -tot_h / 2;
            for (int j = 0; j <= Rows; j++, fi += Size)
            {
                Vector4 color;
                if (Major == 0 || (j % Major) == 0)
                    color = MajorColor;
                else
                    color = MinorColor;
                vb[start + j * 2]     = new WireframeVertex() { Position = new Vector3(-tot_h / 2, 0, fi), Color = color };
                vb[start + j * 2 + 1] = new WireframeVertex() { Position = new Vector3( tot_h / 2, 0, fi), Color = color };
            }
            vb.BufferData(VboUsage.GL_STATIC_DRAW);
            vb.FreeClientData();
        }
Exemplo n.º 4
0
        public void InitializeGraphics()
        {
            if (vb != null)
            {
                vb.Dispose();
            }

            if (mat == null)
            {
                Glorg2.Resource.MaterialImporter imp = new Glorg2.Resource.MaterialImporter();
                using (var stream = System.IO.File.OpenRead(".\\shaders\\Grid.mxl"))
                {
                    mat = imp.Import <StdMaterial>(stream, "grid", null);
                }
            }
            vb = new VertexBuffer <WireframeVertex>(WireframeVertex.Description);

            vb.Allocate(Columns * 2 + Rows * 2 + 4);
            float tot_w = Size * Columns;
            float tot_h = Size * Rows;
            float fi    = -tot_w / 2;
            int   i;

            for (i = 0; i <= Columns; i++, fi += Size)
            {
                Vector4 color;
                if (Major == 0 || (i % Major) == 0)
                {
                    color = MajorColor;
                }
                else
                {
                    color = MinorColor;
                }
                vb[i * 2] = new WireframeVertex()
                {
                    Position = new Vector3(fi, 0, -tot_h / 2), Color = color
                };
                vb[i * 2 + 1] = new WireframeVertex()
                {
                    Position = new Vector3(fi, 0, tot_h / 2), Color = color
                };
            }
            int start = i * 2;

            fi = -tot_h / 2;
            for (int j = 0; j <= Rows; j++, fi += Size)
            {
                Vector4 color;
                if (Major == 0 || (j % Major) == 0)
                {
                    color = MajorColor;
                }
                else
                {
                    color = MinorColor;
                }
                vb[start + j * 2] = new WireframeVertex()
                {
                    Position = new Vector3(-tot_h / 2, 0, fi), Color = color
                };
                vb[start + j * 2 + 1] = new WireframeVertex()
                {
                    Position = new Vector3(tot_h / 2, 0, fi), Color = color
                };
            }
            vb.BufferData(VboUsage.GL_STATIC_DRAW);
            vb.FreeClientData();
        }