コード例 #1
0
        public void MakeMove(TMove move)
        {
            Select(move);
            var group = new TObject3D();
            var angle = (move.Angle + 1) * 90;

            if (move.Axis == 0)
            {
                group.RotateX(angle);
            }
            else if (move.Axis == 1)
            {
                group.RotateY(angle);
            }
            else
            {
                group.RotateZ(angle);
            }

            for (int i = 0; i < Selection.Count; i++)
            {
                var cubic = Selection[i];
                cubic.MultMatrix(group.Transform);
                Cubiks[cubic.Z, cubic.Y, cubic.X] = cubic;
            }
        }
コード例 #2
0
 void DrawObject(TObject3D obj)
 {
     OpenGL.glPushMatrix();
     OpenGL.glMultMatrixd(obj.Transform);
     OpenGL.glBegin(OpenGL.GL_TRIANGLES);
     for (int i = 0; i < obj.Faces.Count; i++)
     {
         var vertex = obj.Vertices[obj.Faces[i]];
         if (i % 6 == 0)
         {
             OpenGL.glColor3d(vertex.X, vertex.Y, vertex.Z);
         }
         OpenGL.glVertex3d(vertex.X, vertex.Y, vertex.Z);
     }
     //foreach (var face in obj.Faces)
     //{
     //    if (!face.Smooth)
     //        OpenGL.glNormal3dv(face.Normal.Items);
     //    foreach (var vertex in face.Vertices)
     //    {
     //        if (face.Smooth)
     //            OpenGL.glNormal3dv(vertex.Normal.Items);
     //        OpenGL.glColor3dv(vertex.Coords.Items);
     //        OpenGL.glVertex3dv(vertex.Coords.Items);
     //    }
     //}
     OpenGL.glEnd();
     foreach (var child in obj.Children)
     {
         DrawObject(child);
     }
     OpenGL.glPopMatrix();
 }
コード例 #3
0
 public void Group()
 {
     Wall = new TObject3D();
     for (int i = 0; i < Selection.Count; i++)
     {
         Selection[i].Parent = Wall;
     }
     Wall.Parent = this;
 }