public void AccessPolygons()
 {
     FixedList<ColoredPolygon> pols = new FixedList<ColoredPolygon>(
     new ColoredPolygon(Color.Black, new Vector3(0, 0, 0)));
       ColoredPolygonMesh mesh = new ColoredPolygonMesh(pols);
       Assert.AreEqual(mesh.Polygons, pols);
 }
示例#2
0
        public MainForm()
        {
            InitializeComponent();

              airplane = CplLoader.FromByteArray(Mesh.GreenAirplane);
              Application.Idle += new EventHandler(Application_Idle);
              keyboard.KeyDown += new KeyDownEvent(keyboard_KeyDown);
              keyboard.KeyUp += new KeyUpEvent(keyboard_KeyUp);
        }
示例#3
0
 public void SingleYellowTriangle()
 {
     ColoredPolygon pol = new ColoredPolygon(Color.Yellow,
     v(0, 1, 2),
     v(3, 4, 5),
     v(600, 7, 8));
       ColoredPolygonMesh expected = new ColoredPolygonMesh(pol);
       string repr = @"cpl
     vertices 3
     polygons 1
     ---8<---
     0 1 2
     3 4 5
     600 7 8
     3 255 255 0 0 1 2
     ";
       ColoredPolygonMesh result = CplLoader.FromString(repr);
       Assert.AreEqual(expected, result);
 }
 public void Construct()
 {
     List<ColoredPolygon> polygons = new List<ColoredPolygon>();
       ColoredPolygonMesh mesh = new ColoredPolygonMesh(polygons);
 }
示例#5
0
 private void Form1_Load(object sender, EventArgs e)
 {
     GLControlUtil.Init(glControl1, 1000);
       GLUtil.SunLightDirection(0, 1, 0);
       mesh = CplLoader.FromString(File.ReadAllText("B.cpl"));
 }
示例#6
0
 public static void DrawMeshIgnoreColor(ColoredPolygonMesh coloredPolygonMesh)
 {
     DrawMeshInternal(coloredPolygonMesh, true);
 }
示例#7
0
 public static void DrawMesh(ColoredPolygonMesh mesh)
 {
     DrawMeshInternal(mesh, false);
 }
示例#8
0
 private static void DrawMeshInternal(
     ColoredPolygonMesh mesh,
     bool ignorecolors)
 {
     foreach (ColoredPolygon polygon in mesh)
       {
     GL.Begin(BeginMode.Polygon);
     if(!ignorecolors)
       GL.Color3(polygon.Color);
     GL.Normal3(polygon.Normal);
     foreach (Vector3 v in polygon)
       GL.Vertex3(v);
     GL.End();
       }
 }
示例#9
0
 private void Form1_Load(object sender, EventArgs e)
 {
     mesh = CplLoader.FromString(Resources.Tower);
       GLControlUtil.Init(glCtrl, 1000);
       GLUtil.SunLightDirection(1, 0, -1);
 }
示例#10
0
 private void DrawMesh(ColoredPolygonMesh mesh)
 {
     GLUtil.DrawMesh(mesh);
 }
示例#11
0
 private void LoadFile(string file)
 {
     try
       {
     mesh = CplLoader.FromString(File.ReadAllText(file));
       }
       catch
       {
     MessageBox.Show("There was an error loading the file.");
     mesh = null;
       }
       glCtrl.Invalidate();
 }