Beispiel #1
0
 /// <summary>
 /// This places all of the smaller classes in the root node
 /// </summary>
 /// <param name="node">The root node in question</param>
 private void CreateGameTree(GroupNode node)
 {
     try
     {
         node.Name = "Workspace";                                             // set the name so it will appear in the browser properly
         node.Initialize();                                                   // initialise root node
         Image            skbx   = new Bitmap(800, 800, System.Drawing.Imaging.PixelFormat.Format8bppIndexed);
         Nodes.SkyboxNode skybox = Nodes.SkyboxNode.Create(new Bitmap(skbx)); // create the skybox
         try
         {
             skybox = Nodes.SkyboxNode.Create(new Bitmap(Image.FromFile("Content/skybox.png"))); // attempt loading the skybox "skybox"
         }
         catch (Exception e)
         {
             skybox = Nodes.SkyboxNode.Create(Resources.NoSkyDefault); // otherwise load the noskydefault
         }
         skybox.Name = "Skybox";
         node.Children.Add(skybox); // add this to the rootnode
     } catch (Exception e)
     {
         if (throwFatalInsteadOfMsg)
         {
             throw;
         }
         GameFatal gf = new GameFatal(e);
         gf.Show();
     }
 }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="totalBmp"></param>
        /// <returns></returns>
        public static SkyboxNode Create(Bitmap totalBmp)
        {
            var vs       = new VertexShader(vertexCode);
            var fs       = new FragmentShader(fragmentCode);
            var provider = new ShaderArray(vs, fs);
            var map      = new AttributeMap();

            map.Add(inPosition, Skybox.strPosition);
            var builder = new RenderMethodBuilder(provider, map, new CullFaceSwitch(CullFaceMode.Front));
            var model   = new Skybox();
            var node    = new SkyboxNode(model, Skybox.strPosition, totalBmp, builder);

            node.Initialize();
            node.Scale = new vec3(9000000, 9000000, 9000000);
            return(node);
        }