public override void Init() { depthFBO = new FBO(0, 0, 1, true); ShadowMapping.Create(depthFBO, "lightmask.png"); font = BitmapFont.Load("fonts/comic12.png"); skybox = Sky.Load("sky/sky_", "jpg"); world.Add(skybox); GLSLShader.SetShader("shadowmapping.shader", "SHADOWS"); DotScene ds = DotScene.Load("scene1/scene1.scene", scene); world.Add(scene); actors[0] = AnimatedModel.Load("ugly/ukko.mesh"); actors[0].LoadMD5Animation("act1", "ugly/ukko_action1.anim"); actors[0].LoadMD5Animation("act2", "ugly/ukko_action2.anim"); actors[0].LoadMD5Animation("act3", "ugly/ukko_action3.anim"); actors[0].LoadMD5Animation("walk", "ugly/ukko_walk.anim"); actors[0].SetAnimation("act2"); // idle anim actors[0].Scale = new Vector3(5, 5, 5); world.Add(actors[0]); lightImg = Billboard.Load("lightimg.png"); Camera.Set3D(); base.Init(); }
/// <summary> /// aseta partikkelikuva ja callback-metodi /// </summary> public void SetParticle(Billboard tex, bool isTransparent, bool castShadow, ParticleCallback particleCallback) { this.particleTex = tex; this.IsTransparent = isTransparent; this.callBack = particleCallback; this.CastShadow = castShadow; ParticleGroups.Add(this); }
public static Billboard Load(string fileName, bool softParticle) { if (Particles.SoftParticles == false) softParticle = false; Billboard bb = new Billboard(); bb.billBoard = Texture2D.Load(fileName, true); bb.billBoard.Vbo.Shader = GLSLShader.Load("particles.shader" + (softParticle ? ":SOFT" : "")); return bb; }
public static Billboard Load(string fileName, bool softParticle) { if (Particles.SoftParticles == false) { softParticle = false; } Billboard bb = new Billboard(); bb.billBoard = Texture2D.Load(fileName, true); bb.billBoard.Vbo.Shader = GLSLShader.Load("particles.shader" + (softParticle ? ":SOFT" : "")); return(bb); }
public override void Init() { Particles.DisableSoftParticles(); earth.SetParticle(Billboard.Load("earth.png", false), false, true, null); // ei läpikuultava, varjostaa explosion.SetParticle(Billboard.Load("fire.png"), true, false, new ParticleCallback(RenderParticleCallback)); // läpikuultava, ei varjosta smoke.SetParticle(Billboard.Load("smoke.png"), true, true, null); // läpikuultava, varjostaa SetupParticles(true, true, true); font = BitmapFont.Load("fonts/comic12.png"); camera.Position = new Vector3(0, 0, 150); Camera.Set3D(); base.Init(); }
public override void Dispose() { if (particleTex != null) { particleTex.Dispose(); } if (depthShader != null) { depthShader.Dispose(); } particleTex = null; depthShader = null; particles.Clear(); Log.WriteLine("Disposed: Particles", false); }
public override void Init() { colorFBO = new FBO(0, 0, 2, true); // 2 colorbufferia depthFBO = new FBO(0, 0, 0, true); blurH = PostEffect.Load("blur.shader", "HORIZ"); blurH.SetParameter("size", 1f / (float)colorFBO.Width); blurV = PostEffect.Load("blur.shader", "VERT"); blurV.SetParameter("size", 1f / (float)colorFBO.Width); bloom = PostEffect.Load("bloom.shader", ""); bloom.SetParameter("size", 0.001f); Particles.EnableSoftParticles(); ShadowMapping.Create(depthFBO, "lightmask.png"); font = BitmapFont.Load("fonts/comic12.png"); skybox = Sky.Load("sky/sky2_", "jpg"); world.Add(skybox); lightImg = Billboard.Load("lightimg.png"); GLSLShader.SetShader("shadowmapping.shader", "SHADOWS"); DotScene ds = DotScene.Load("scene1/scene1.scene", scene); world.Add(scene); actors[0] = AnimatedModel.Load("ugly/ukko.mesh"); actors[0].LoadMD5Animation("act1", "ugly/ukko_action1.anim"); actors[0].LoadMD5Animation("act2", "ugly/ukko_action2.anim"); actors[0].LoadMD5Animation("act3", "ugly/ukko_action3.anim"); actors[0].LoadMD5Animation("walk", "ugly/ukko_walk.anim"); actors[0].SetAnimation("act2"); // idle anim actors[0].Position.Y = -0.5f; actors[0].Scale = new Vector3(5, 5, 5); world.Add(actors[0]); explosion = Particles.Load("explosion.particles.xml", new ParticleCallback(RenderParticleCallback)); smoke = Particles.Load("smoke.particles.xml", null); actors[0].Add(smoke); Camera.Set3D(); base.Init(); }
void LoadParticles(string fileName, ParticleCallback particleCallback) { XmlDocument XMLDoc = null; XmlElement XMLRoot; try { using (System.IO.StreamReader file = new System.IO.StreamReader(Settings.ParticleDir + 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 != "particles") { Log.Error("Error [" + fileName + "] Invalid .particles.xml File. Missing <particles>"); } Name = XML.GetAttrib(XMLRoot, "name"); string billboard = XML.GetAttrib(XMLRoot, "billboard"); bool translucent = XML.GetAttribBool(XMLRoot, "translucent", false); bool castshadows = XML.GetAttribBool(XMLRoot, "castshadows", false); origValues.count = (int)XML.GetAttribFloat(XMLRoot, "count", 0); origValues.life = XML.GetAttribFloat(XMLRoot, "life", 0); origValues.life_max = XML.GetAttribFloat(XMLRoot, "life_max", origValues.life); origValues.zrotation = XML.GetAttribFloat(XMLRoot, "zrotation", 0); origValues.zrotation_max = XML.GetAttribFloat(XMLRoot, "zrotation_max", origValues.zrotation); origValues.zrotation_adder = XML.GetAttribFloat(XMLRoot, "zrotation_adder", 0); origValues.zrotation_adder_max = XML.GetAttribFloat(XMLRoot, "zrotation_adder_max", origValues.zrotation_adder); origValues.size = XML.GetAttribFloat(XMLRoot, "size", 0); origValues.size_max = XML.GetAttribFloat(XMLRoot, "size_max", origValues.size); XmlElement node = (XmlElement)XMLRoot.SelectSingleNode("position"); origValues.pos = new Vector3(XML.GetAttribFloat(node, "x", 0), XML.GetAttribFloat(node, "y", 0), XML.GetAttribFloat(node, "z", 0)); origValues.posMax = new Vector3(XML.GetAttribFloat(node, "x_max", origValues.pos.X), XML.GetAttribFloat(node, "y_max", origValues.pos.Y), XML.GetAttribFloat(node, "z_max", origValues.pos.Z)); node = (XmlElement)XMLRoot.SelectSingleNode("direction"); origValues.dir = new Vector3(XML.GetAttribFloat(node, "x", 0), XML.GetAttribFloat(node, "y", 0), XML.GetAttribFloat(node, "z", 0)); origValues.dirMax = new Vector3(XML.GetAttribFloat(node, "x_max", origValues.dir.X), XML.GetAttribFloat(node, "y_max", origValues.dir.Y), XML.GetAttribFloat(node, "z_max", origValues.dir.Z)); node = (XmlElement)XMLRoot.SelectSingleNode("gravitation"); origValues.grav = new Vector3(XML.GetAttribFloat(node, "x", 0), XML.GetAttribFloat(node, "y", 0), XML.GetAttribFloat(node, "z", 0)); node = (XmlElement)XMLRoot.SelectSingleNode("color"); origValues.color = new Vector4(XML.GetAttribFloat(node, "r", 0), XML.GetAttribFloat(node, "g", 0), XML.GetAttribFloat(node, "b", 0), XML.GetAttribFloat(node, "a", 0)); origValues.colorMax = new Vector4(XML.GetAttribFloat(node, "r_max", origValues.color.X), XML.GetAttribFloat(node, "g_max", origValues.color.Y), XML.GetAttribFloat(node, "b_max", origValues.color.Z), XML.GetAttribFloat(node, "a_max", origValues.color.W)); SetParticle(Billboard.Load(billboard), translucent, castshadows, particleCallback); Reset(); }
public override void Dispose() { if (particleTex != null) particleTex.Dispose(); if (depthShader != null) depthShader.Dispose(); particleTex = null; depthShader = null; particles.Clear(); Log.WriteLine("Disposed: Particles", false); }