Example #1
0
        public Catalog(Scene s)
        {
            this.my_scene = s;

            this.marker       = new MarkerNode(my_scene.MarkerTracker, "palette_marker.xml");
            this.changeMarker = new MarkerNode(my_scene.MarkerTracker, "palette_turn_marker.xml");
            my_scene.RootNode.AddChild(marker);
            my_scene.RootNode.AddChild(changeMarker);
            library = new ItemLibrary("models.txt");
            names2itemsInCatalog = new Dictionary <string, Item>();
            names2itemsInRoom    = new Dictionary <string, Item>();
            item_list            = library.getAllItems();
            //  this.objects = l;
            int grid_x = 0;
            int grid_y = 0;

            foreach (Item i in item_list)
            {
                names2itemsInCatalog.Add(i.Label, i);
                i.setGroupID(catalogGroupID);
                i.Scale = new Vector3(9.0f, 9.0f, 9.0f) / i.Radius;
            }
            for (int i = cur_start; i < cur_end && i < item_list.Count; i++)
            {
                if (grid_x > 15)
                {
                    grid_x  = 0;
                    grid_y -= 15;
                }
                item_list[i].BindTo(marker);
                item_list[i].MoveTo(new Vector3(grid_x, grid_y, 0));
                grid_x += 15;
            }

            // Create a geometry node with a model of box
            GeometryNode boxNode = new GeometryNode("Box");

            boxNode.Model = new Box(30, 30, 0.1f);

            TransformNode boxTransNode = new TransformNode();

            boxTransNode.AddChild(boxNode);
            boxTransNode.Translation += new Vector3(6, -6, -0.5f);

            Material boxMat = new Material();

            boxMat.Diffuse = Color.DimGray.ToVector4();

            boxNode.Material = boxMat;

            marker.AddChild(boxTransNode);
        }
Example #2
0
        public Catalog(Scene s)
        {
            this.my_scene = s;

            this.marker = new MarkerNode(my_scene.MarkerTracker, "palette_marker.xml");
            this.changeMarker = new MarkerNode(my_scene.MarkerTracker, "palette_turn_marker.xml");
            my_scene.RootNode.AddChild(marker);
            my_scene.RootNode.AddChild(changeMarker);
            library = new ItemLibrary("models.txt");
            names2itemsInCatalog = new Dictionary<string, Item>();
            names2itemsInRoom = new Dictionary<string, Item>();
            item_list = library.getAllItems();
              //  this.objects = l;
            int grid_x = 0;
            int grid_y = 0;
            foreach (Item i in item_list)
            {
                names2itemsInCatalog.Add(i.Label, i);
                i.setGroupID(catalogGroupID);
                i.Scale = new Vector3(9.0f, 9.0f, 9.0f) / i.Radius;

            }
            for (int i = cur_start; i < cur_end && i < item_list.Count; i++)
            {

                if (grid_x > 15)
                {
                    grid_x = 0;
                    grid_y -= 15;
                }
                item_list[i].BindTo(marker);
                item_list[i].MoveTo(new Vector3(grid_x, grid_y, 0));
                grid_x += 15;

            }

            // Create a geometry node with a model of box
            GeometryNode boxNode = new GeometryNode("Box");
            boxNode.Model = new Box(30,30,0.1f);

            TransformNode boxTransNode = new TransformNode();
            boxTransNode.AddChild(boxNode);
            boxTransNode.Translation += new Vector3(6, -6, -0.5f);

            Material boxMat = new Material();
            boxMat.Diffuse = Color.DimGray.ToVector4();

            boxNode.Material = boxMat;

            marker.AddChild(boxTransNode);
        }