示例#1
0
        private void AddAllSkyBoxes()
        {
            skyBoxes.Clear();
            string tempSkyBoxFolder = TheResourceManager.SkyBoxDirectory;

            string[]      files    = Directory.GetFiles(tempSkyBoxFolder, "SkyBox_T*.*");
            List <string> fileList = new List <string>();

            foreach (string aFile in files)
            {
                string extension = Path.GetExtension(aFile);
                if (extension != null)
                {
                    string tempExt = extension.ToLower();

                    if (tempExt == ".jpg" || tempExt == ".png")
                    {
                        string tempRelPath = Path.Combine(skypBoxFolder, Path.GetFileName(aFile));
                        fileList.Add(tempRelPath);
                    }
                }
            }

            foreach (string tempSkyBoxPath in fileList)
            {
                ObjGroupSkyBox tempSkyBoxGroup = ObjGroupSkyBox.GetNewSkyBoxTypeT(program, tempSkyBoxPath);
                tempSkyBoxGroup.Name = Path.GetFileNameWithoutExtension(tempSkyBoxPath);
                skyBoxes.Add(tempSkyBoxGroup);
            }
        }
示例#2
0
        public override void OnLoad()
        {
            // create our shader program
            program = new ShaderProgram(VertexShader, FragmentShader);
            // set up the projection and view matrix
            program.Use();
            projectionMatrix = Matrix4.CreatePerspectiveFieldOfView(Fov, (float)Width / Height, ZNear,
                                                                    ZFar);
            program["projection_matrix"].SetValue(projectionMatrix);
            program["model_matrix"].SetValue(Matrix4.Identity);


            objGroups = new List <ObjGroup>();

            // Add all skyBoxes to the list.
            AddAllSkyBoxes();

            // Use the first one in the list.
            skyBoxObjGroup = skyBoxes[0];
//            skyBoxObjGroup.Scale = Vector3.UnitScale*0.7f;

            objGroups.Add(skyBoxObjGroup);
        }
示例#3
0
 private void ChangeToSkyBox(ObjGroupSkyBox aObjGroupSkyBox)
 {
     skyBoxObjGroup = aObjGroupSkyBox;
     objGroups[0]   = skyBoxObjGroup;
 }