public override void Init() { depthFBO = new FBO(0, 0, 1, true); ShadowMapping.Create(depthFBO, "lightmask.png"); Fog.CreateFog(0.005f, Fog.Color); GLSLShader.SetShader("default.shader", "FOG"); skybox = Sky.Load("sky/sky2_", "jpg"); world.Add(skybox); GLSLShader.SetShader("default.shader", "LIGHTING:PERPIXEL:FOG"); Model scene = new Model(); DotScene ds = DotScene.Load("scene1/scene1.scene", scene); world.Add(scene); camPath = Path.GetPath("Path_camera"); camPath.Attach(camera, true, true); font = BitmapFont.Load("fonts/comic12.png"); Camera.Set3D(); base.Init(); }
void LoadMesh(string name, string fileName) { Name = name; XmlDocument XMLDoc = null; XmlElement XMLRoot; try { using (System.IO.StreamReader file = new System.IO.StreamReader(Settings.ModelDir + fileName)) { // tiedosto muistiin string data = file.ReadToEnd(); XMLDoc = new XmlDocument(); XMLDoc.LoadXml(data); } } catch (Exception e) { Log.Error(e.ToString()); } // Validate the File XMLRoot = XMLDoc.DocumentElement; if (XMLRoot.Name != "mesh") { Log.Error("Error [" + fileName + "] Invalid .mesh.xml File. Missing <mesh>"); } bool isPath = false; // jos meshi on pathi if (name.StartsWith("Path_")) isPath = true; // Process the mesh processMesh(XMLRoot, isPath); if (isPath == false) { Vbo = new VBO(); Vbo.DataToVBO(VertexBuffer, IndexBuffer, VBO.VertexMode.UV1); Boundings = new BoundingSphere(); Boundings.CreateBoundingVolume(this); // lataa shader string shader = Material.ShaderName; if (shader != "") { Vbo.Shader = GLSLShader.Load(shader); } } else { Path path = new Path(); path.AddPath(name, VertexBuffer); } }