protected override void OnLoad()
        {
            base.OnLoad();

            Layer  = LayerUI;
            server = MMW.GetAsset <Server>();
        }
Exemplo n.º 2
0
        protected override void OnLoad()
        {
            base.OnLoad();

            Layer = LayerUI;

            lerp = new Lerper(MMW.ClientSize.Height + 40.0f);

            execs.Add("Show", (obj, args) =>
            {
                Show();
                return(true);
            });
            execs.Add("Hide", (obj, args) =>
            {
                Hide();
                return(true);
            });

            tex = new Texture2D(Resources.mmw_icon);
            tex.Load();

            userData  = MMW.GetAsset <UserData>();
            resources = MMW.GetAsset <WorldResources>();

            Show();
        }
Exemplo n.º 3
0
        public SelectWorldPanel(WorldInfo info)
        {
            Info         = info;
            defBackImage = Resources.mmw_defaultbackpanel;

            texImage = MMW.GetAsset <Texture2D>("default back panel");
            if (texImage == null)
            {
                texImage      = new Texture2D(defBackImage);
                texImage.Name = "default back panel";
                MMW.RegistAsset(texImage);
            }
            if (!texImage.Loaded)
            {
                texImage.Load();
            }

            Clicked += (s, e) => SelectedPanel = this;

            timer = new Timer((t) =>
            {
                var data = NetworkUtil.QueryWorldInfoUdp(info.HostName, info.Port);
                ReceivedServerDesc(data);
            }, null, 0, 3000);
        }
Exemplo n.º 4
0
        protected internal override void OnLoad()
        {
            base.OnLoad();

            renderTexture              = new RenderTexture(MMW.RenderResolution);
            renderTexture.MagFilter    = TextureMagFilter.Linear;
            renderTexture.MinFilter    = TextureMinFilter.Linear;
            renderTexture.ColorFormat0 = MMW.Configuration.DefaultPixelFormat;
            renderTexture.Load();

            ccShader = (GLSLShader)MMW.GetAsset <Shader>("Color Collect");
            if (ccShader == null)
            {
                ccShader = new ColorCollectShader();
                MMW.RegistAsset(ccShader);
            }

            loc_con        = ccShader.GetUniformLocation("contrast");
            loc_sat        = ccShader.GetUniformLocation("saturation");
            loc_brt        = ccShader.GetUniformLocation("brightness");
            loc_resolution = ccShader.GetUniformLocation("resolutionInverse");
            loc_mvp        = ccShader.GetUniformLocation("MVP");

            if (GameObject != null)
            {
                Camera        = GameObject.GetComponent <Camera>();
                RenderTexture = Camera.TargetTexture;
            }

            orthoMatrix = Matrix4.CreateOrthographicOffCenter(-1, 1, -1, 1, -1, 1);
        }
Exemplo n.º 5
0
        protected internal override void OnLoad()
        {
            base.OnLoad();

            renderTexture              = new RenderTexture(MMW.RenderResolution);
            renderTexture.MagFilter    = TextureMagFilter.Linear;
            renderTexture.MinFilter    = TextureMinFilter.Linear;
            renderTexture.WrapMode     = TextureWrapMode.MirroredRepeat;
            renderTexture.ColorFormat0 = MMW.Configuration.DefaultPixelFormat;
            renderTexture.Load();

            dofShader = (BokehDoFShader)MMW.GetAsset <Shader>("Bokeh DoF");
            if (dofShader == null)
            {
                dofShader = new BokehDoFShader();
                MMW.RegistAsset(dofShader);
            }

            if (GameObject != null)
            {
                Camera        = GameObject.GetComponent <Camera>();
                RenderTexture = Camera.TargetTexture;
            }

            orthoMatrix = Matrix4.CreateOrthographicOffCenter(-1, 1, -1, 1, -1, 1);
        }
        public DeferredPhysicalSkinShader(string name = "Deferred Physical Skin") : base(name)
        {
            VertexCode   = Resources.DeferredPhysicalSkin_vert;
            FragmentCode = Resources.DeferredPhysical_frag;

            RegistShaderParam <Matrix4>("M", "Model");
            RegistShaderParam <Matrix4>("MIT", "ModelInverseTranspose");
            RegistShaderParam <Matrix4>("MVP", "ModelViewProjection");
            RegistShaderParam <Matrix4>("OldMVP", "OldModelViewProjection");
            RegistShaderParam <Matrix4>("shadowMV1", "ShadowModelView1");
            RegistShaderParam <Matrix4>("shadowMV2", "ShadowModelView2");
            RegistShaderParam <Matrix4>("shadowMV3", "ShadowModelView3");

            RegistShaderParam <Color4>("albedo", "Albedo");
            RegistShaderParam <float>("metallic", "Metallic");
            RegistShaderParam <float>("roughness", "Roughness");
            RegistShaderParam <Color4>("f0", "F0");
            RegistShaderParam <Color4>("uniqueColor", "UniqueColor");

            RegistShaderParam <Vector3>("wCamDir", "WorldCameraDir");
            RegistShaderParam <Vector3>("wCamPos", "WorldCameraPosition");
            RegistShaderParam <Vector2>("resolutionInverse", "ResolutionInverse");
            RegistShaderParam <float>("deltaTime", "DeltaTime");

            RegistShaderParam("albedoMap", "AlbedoMap", TextureUnit.Texture0);
            RegistShaderParam("normalMap", "NormalMap", TextureUnit.Texture1);

            RegistShaderParam("shadowMap1", "ShadowMap1", TextureUnit.Texture3);
            RegistShaderParam("shadowMap2", "ShadowMap2", TextureUnit.Texture4);
            RegistShaderParam("shadowMap3", "ShadowMap3", TextureUnit.Texture5);

            whiteMap         = MMW.GetAsset <Texture2D>("WhiteMap");
            defaultNormalMap = MMW.GetAsset <Texture2D>("DefaultNormalMap");
        }
Exemplo n.º 7
0
        protected override void OnLoad()
        {
            base.OnLoad();

            Layer = LayerUI;

            userData = MMW.GetAsset <UserData>();

            coin = userData.Coin;

            tex = new Texture2D(Resources.number);
            tex.Load();

            texCoin           = new Texture2D(Resources.mmw_icon_coin);
            texCoin.MagFilter = OpenTK.Graphics.OpenGL4.TextureMagFilter.Linear;
            texCoin.Load();

            texBack = new Texture2D(Resources.shadowline);
            texBack.Load();

            lerp = new Lerper(-100.0f);
            Show();

            sound = MMW.GetAsset <Sound>("coin");

            player = MMW.FindGameObject(g => g.Tags.Contains("player"));
        }
Exemplo n.º 8
0
        public ToonShader() : base("Toon")
        {
            VertexCode   = Resources.Toon_vert;
            FragmentCode = Resources.Toon_frag;

            RegistShaderParam <Matrix4>("M", "Model");
            RegistShaderParam <Matrix4>("MIT", "ModelInverseTranspose");
            RegistShaderParam <Matrix4>("MVP", "ModelViewProjection");

            RegistShaderParam <Color4>("diffuse", "Diffuse");
            RegistShaderParam <Color4>("specular", "Specular");
            RegistShaderParam <float>("shininess", "Shininess");

            RegistShaderParam <Vector3>("wCamDir", "WorldCameraDir");
            RegistShaderParam <Vector3>("wCamPos", "WorldCameraPosition");

            RegistShaderParam <Vector3>("wDirLight.dir", "DirectionalLightDir");
            RegistShaderParam <Vector3>("wDirLight.color", "DirectionalLightColor");
            RegistShaderParam <Vector3>("wDirLight.intensity", "DirectionalLightIntensity");

            RegistShaderParam <Color4>("gAmbient", "GlobalAmbient");


            RegistShaderParam("albedoMap", "AlbedoMap", TextureUnit.Texture0);
            RegistShaderParam("toonMap", "ToonMap", TextureUnit.Texture1);

            whiteMap = MMW.GetAsset <Texture2D>("WhiteMap");
            //toonMap = MMW.GetAsset<Texture2D>("ToonMap");
            toonMap = new Texture2D(Resources.toon2);
            toonMap.Load();
        }
Exemplo n.º 9
0
        protected internal override void OnLoad()
        {
            base.OnLoad();

            renderTexture              = new RenderTexture(MMW.RenderResolution);
            renderTexture.MagFilter    = TextureMagFilter.Linear;
            renderTexture.MinFilter    = TextureMinFilter.Linear;
            renderTexture.ColorFormat0 = PixelFormat;
            renderTexture.Load();

            fxaaShader = (FXAAShader)MMW.GetAsset <Shader>("FXAA");
            if (fxaaShader == null)
            {
                fxaaShader = new FXAAShader();
                MMW.RegistAsset(fxaaShader);
            }

            if (GameObject != null)
            {
                Camera           = GameObject.GetComponent <Camera>();
                DstRenderTexture = Camera.TargetTexture;
            }

            orthoMatrix = Matrix4.CreateOrthographicOffCenter(-1, 1, -1, 1, -1, 1);
        }
Exemplo n.º 10
0
        protected override void Update(double deltaTime)
        {
            transition += (trans ? -1.0f : 1.0f) * (float)deltaTime * 5.0f;
            transition  = MMWMath.Saturate(transition);

            transit.Update(deltaTime);

            if (AcceptInput && !trans)
            {
                input.Update(deltaTime);
                controls.ForEach(c => c.Update(null, deltaTime));

                if (input.IsBack)
                {
                    MMW.GetAsset <Sound>("back").Play();
                    trans          = true;
                    transit.Target = new Vector2(-MMW.ClientSize.Width * 2.0f, 0.0f);
                    GameObject.AddComponent <TitleScript>();
                }
            }

            if (trans && transition < 0.01f)
            {
                Destroy();
            }
        }
Exemplo n.º 11
0
 public HotbarItemFrame(Control parent, Vector2 pos, int itemIndex)
 {
     Size          = new Vector2(48.0f, 48.0f);
     Parent        = parent;
     LocalLocation = pos;
     ItemIndex     = itemIndex;
     userData      = MMW.GetAsset <UserData>();
     resources     = MMW.GetAsset <WorldResources>();
 }
 public WalkerGameObjectScript(GameObject go, GameObjectScript script, byte[] status)
 {
     script.GameObject = go;
     script.Server     = MMW.GetAsset <Server>();
     script.WorldData  = MMW.GetAsset <WorldData>();
     script.MasterData = MMW.MasterData;
     Status            = status;
     Script            = script;
 }
Exemplo n.º 13
0
        protected override void OnLoad()
        {
            base.OnLoad();

            Layer = LayerUI;

            MMW.FindGameComponent <BackgroundScript>().Trans(new OpenTK.Graphics.Color4(148, 212, 222, 255), 0.25);

            transit = new TransitControl();
            transit.LocalLocation = new Vector2(MMW.ClientSize.Width * 2.0f, 0);
            transit.Size          = new Vector2(MMW.ClientSize.Width, MMW.ClientSize.Height);
            transit.Target        = Vector2.Zero;

            input = new MenuInputResolver();

            var label = new Label()
            {
                Parent        = transit,
                Alignment     = ContentAlignment.TopCenter,
                Text          = "OPTION",
                Font          = new Font("Yu Gothic UI Light", 40.0f),
                LocalLocation = new Vector2(0.0f, 32.0f),
            };

            controls.Add(label);

            userData = MMW.GetAsset <UserData>();

            var labelName = new Label(transit, "User Name", new Vector2(200.0f, 160.0f));

            labelName.Font = Control.DefaultFontB;
            controls.Add(labelName);
            var textBoxName = new TextBox2(labelName, userData.UserName, new Vector2(200.0f, 0.0f), new Vector2(300.0f, 32.0f));

            textBoxName.MaxLength    = 16;
            textBoxName.TextChanged += (s, e) => { userData.UserName = textBoxName.Text; };
            controls.Add(textBoxName);

            var labelArchive = new Label(transit, "Display Achivement", new Vector2(200.0f, 200.0f));

            labelArchive.Font = Control.DefaultFontB;
            controls.Add(labelArchive);
            var comboArchive = new ComboBox(labelArchive, new Vector2(200.0f, 0.0f), new Vector2(300.0f, 32.0f));

            if (userData.Achivements.Count > 0)
            {
                comboArchive.Items                 = userData.Achivements.ToArray();
                comboArchive.SelectedIndex         = userData.ArchiveIndex;
                comboArchive.DisplayMember         = "Name";
                comboArchive.SelectedIndexChanged += (s, e) => { userData.ArchiveIndex = e; };
            }
            else
            {
                comboArchive.Enabled = false;
            }
            controls.Add(comboArchive);
        }
Exemplo n.º 14
0
        public TestShader() : base("Test")
        {
            VertexCode   = Resources.Test_vert;
            FragmentCode = Resources.Test_frag;

            RegistShaderParam <Matrix4>("MVP", "ModelViewProjection");
            RegistShaderParam <Matrix4>("MIT", "ModelInverseTranspose");
            RegistShaderParam <Vector3>("lightDir", "DirectionalLightDir");
            RegistShaderParam <Color4>("diffuse", "Diffuse");
            RegistShaderParam <Color4>("ambient", "Ambient");
            RegistShaderParam("albedoMap", "AlbedoMap", TextureUnit.Texture0);

            whiteMap = MMW.GetAsset <Texture2D>("WhiteMap");
        }
Exemplo n.º 15
0
        protected internal override void OnLoad()
        {
            base.OnLoad();

            CreateShadowMap();

            whiteMap    = MMW.GetAsset <Texture2D>("WhiteMap");
            depthShader = (DepthShader)MMW.GetAsset <Shader>("Depth");
            colorShader = (ColorShader)MMW.GetAsset <Shader>("Color");

            depthRT = new RenderTexture(MMW.RenderResolution);
            depthRT.ColorFormat0 = PixelInternalFormat.Rgba16f;
            depthRT.Load();

            colorRT = new RenderTexture(MMW.RenderResolution);
            colorRT.ColorFormat0 = MMW.Configuration.DefaultPixelFormat;
            colorRT.Load();
            randColors = new Color4[ushort.MaxValue + 1];
            for (var i = 0; i < randColors.Length; i++)
            {
                randColors[i] = new Color4(
                    RandomHelper.NextFloat() * 0.5f + 0.5f,
                    RandomHelper.NextFloat() * 0.5f + 0.5f,
                    RandomHelper.NextFloat() * 0.5f + 0.5f,
                    1.0f);
            }

            shadowDepthBias = Matrix4.CreateScale(0.5f) * Matrix4.CreateTranslation(0.5f, 0.5f, 0.5f);

            velocityShader          = (VelocityShader)MMW.GetAsset <Shader>("Velocity");
            velocityRT              = new RenderTexture(MMW.RenderResolution);
            velocityRT.ColorFormat0 = PixelInternalFormat.Rgba16f;
            velocityRT.Load();

            sp = new ShaderUniqueParameter()
            {
                camera = this,
            };

            getter.Add("Orthographic", obj => Orthographic);
            getter.Add("Up", obj => Up);
            getter.Add("Width", obj => Width);
            getter.Add("Height", obj => Height);
            getter.Add("Aspect", obj => Aspect);
            getter.Add("FoV", obj => FoV);
            getter.Add("Near", obj => Near);
            getter.Add("Far", obj => Far);
            getter.Add("Depth", obj => Depth);
            getter.Add("ClearColor", obj => ClearColor);
        }
Exemplo n.º 16
0
 public SelectRect(Control parent, Vector2 location, Vector2 size)
 {
     Parent        = parent;
     LocalLocation = location;
     Size          = size;
     Clicked      += (s, e) =>
     {
         if (Focused != this)
         {
             MMW.GetAsset <Sound>("select").Play();
         }
         Focused = this;
     };
 }
Exemplo n.º 17
0
        protected internal override void OnLoad()
        {
            base.OnLoad();

            var size = MMW.RenderResolution.Mul(1.0f / Reduct);

            if (RenderTexture != null)
            {
                size = RenderTexture.Size.Mul(1.0f / Reduct);
            }

            glareRT              = new RenderTexture(size);
            glareRT.MagFilter    = TextureMagFilter.Linear;
            glareRT.MinFilter    = TextureMinFilter.Linear;
            glareRT.WrapMode     = TextureWrapMode.ClampToEdge;
            glareRT.ColorFormat0 = MMW.Configuration.DefaultPixelFormat;
            glareRT.Load();

            glareLineShader = (GlareLineShader)MMW.GetAsset <Shader>("Glare Line");
            if (glareLineShader == null)
            {
                glareLineShader = new GlareLineShader();
                MMW.RegistAsset(glareLineShader);
            }

            glarePlusShader = (GlarePlusShader)MMW.GetAsset <Shader>("Glare Plus");
            if (glarePlusShader == null)
            {
                glarePlusShader = new GlarePlusShader();
                MMW.RegistAsset(glarePlusShader);
            }

            glareStarShader = (GlareStarShader)MMW.GetAsset <Shader>("Glare Star");
            if (glareStarShader == null)
            {
                glareStarShader = new GlareStarShader();
                MMW.RegistAsset(glareStarShader);
            }

            if (GameObject != null)
            {
                Camera        = GameObject.GetComponent <Camera>();
                RenderTexture = Camera.TargetTexture;
            }

            orthoMatrix = Matrix4.CreateOrthographicOffCenter(-1, 1, -1, 1, -1, 1);
        }
Exemplo n.º 18
0
        protected internal override void OnLoad()
        {
            base.OnLoad();

            var size = MMW.RenderResolution.Mul(1.0f / Reduct);

            if (RenderTexture != null)
            {
                size = RenderTexture.Size.Mul(1.0f / Reduct);
            }

            renderTextureV              = new RenderTexture(size);
            renderTextureV.MagFilter    = TextureMagFilter.Linear;
            renderTextureV.MinFilter    = TextureMinFilter.Linear;
            renderTextureV.WrapMode     = TextureWrapMode.Repeat;
            renderTextureV.ColorFormat0 = PixelFormat;
            renderTextureV.Load();

            renderTextureH              = new RenderTexture(size);
            renderTextureH.MagFilter    = TextureMagFilter.Linear;
            renderTextureH.MinFilter    = TextureMinFilter.Linear;
            renderTextureH.WrapMode     = TextureWrapMode.Repeat;
            renderTextureH.ColorFormat0 = PixelFormat;
            renderTextureH.Load();

            blurVShader = (BlurVShader)MMW.GetAsset <Shader>("Blur Vertical");
            if (blurVShader == null)
            {
                blurVShader = new BlurVShader();
                MMW.RegistAsset(blurVShader);
            }

            blurHShader = (BlurHShader)MMW.GetAsset <Shader>("Blur Horizontal");
            if (blurHShader == null)
            {
                blurHShader = new BlurHShader();
                MMW.RegistAsset(blurHShader);
            }

            if (GameObject != null)
            {
                Camera        = GameObject.GetComponent <Camera>();
                RenderTexture = Camera.TargetTexture;
            }

            orthoMatrix = Matrix4.CreateOrthographicOffCenter(-1, 1, -1, 1, -1, 1);
        }
Exemplo n.º 19
0
        public BloomShader() : base("Bloom")
        {
            VertexCode   = Resources.ImageEffect_vert;
            FragmentCode = Resources.Bloom_frag;

            RegistShaderParam("samplerSrc", TextureUnit.Texture0);
            RegistShaderParam("samplerBlur1", TextureUnit.Texture1);
            RegistShaderParam("samplerBlur2", TextureUnit.Texture2);
            RegistShaderParam("samplerBlur3", TextureUnit.Texture3);
            RegistShaderParam("samplerBlur4", TextureUnit.Texture4);
            RegistShaderParam("samplerBlur5", TextureUnit.Texture5);
            RegistShaderParam <Vector2>("resolutionInverse", "ResolutionInverse");
            RegistShaderParam <float>("intensity");
            RegistShaderParam <Matrix4>("MVP", "ModelViewProjection");

            black = MMW.GetAsset <Texture2D>("BlackMap");
        }
Exemplo n.º 20
0
        protected override void OnLoad()
        {
            var decomp = Util.Decompress(Resources.coin_cupper);
            var data   = Util.DeserializeJson <NwObject>(Encoding.UTF8.GetString(decomp));

            cupperCoin             = AssetConverter.FromNwObject(data);
            cupperCoin.Purchasable = false;
            cupperCoin.Hash        = Util.ComputeHash(Resources.coin_cupper, 12);
            cupperCoin.Load();

            decomp                 = Util.Decompress(Resources.coin_silver);
            data                   = Util.DeserializeJson <NwObject>(Encoding.UTF8.GetString(decomp));
            silverCoin             = AssetConverter.FromNwObject(data);
            silverCoin.Purchasable = false;
            silverCoin.Hash        = Util.ComputeHash(Resources.coin_silver, 12);
            silverCoin.Load();

            decomp               = Util.Decompress(Resources.coin_gold);
            data                 = Util.DeserializeJson <NwObject>(Encoding.UTF8.GetString(decomp));
            goldCoin             = AssetConverter.FromNwObject(data);
            goldCoin.Purchasable = false;
            goldCoin.Hash        = Util.ComputeHash(Resources.coin_gold, 12);
            goldCoin.Load();

            var wr = MMW.GetAsset <WorldResources>();

            wr.Objects.Add(cupperCoin.Hash, cupperCoin);
            wr.Objects.Add(silverCoin.Hash, silverCoin);
            wr.Objects.Add(goldCoin.Hash, goldCoin);

            var mr = GameObject.GetComponent <MeshRenderer>();

            bounds = mr.Mesh.Bounds;

            var size = bounds.Size.X * bounds.Size.Z;

            if (size > 400.0f)
            {
                maxCoin = (int)Math.Log10(size);
            }

            userData = MMW.GetAsset <UserData>();
            time     = userData.CoinSpownTime;
        }
Exemplo n.º 21
0
        public static GameObject CreateGameObject(Character ch, string name, string shader = "Deferred Physical Skin")
        {
            if (!ch.Loaded)
            {
                ch.Load();
            }

            var sh = MMW.GetAsset <Shader>(shader);

            foreach (var mat in ch.Materials)
            {
                mat.Shader = sh;
            }

            var go = new GameObject(name);

            var mr = go.AddComponent <MeshRenderer>();

            mr.ForceRendering = true;
            mr.Mesh           = ch.Mesh;
            mr.Bones          = ch.Bones;
            for (var m = 0; m < mr.Mesh.SubMeshCount; m++)
            {
                var matIndex = mr.Mesh.GetMaterialIndex(m);
                mr.SetMaterial(matIndex, ch.Materials[matIndex], false);
            }

            if (ch.Morphs != null)
            {
                var morpher = go.AddComponent <Morpher>();

                foreach (var m in ch.Morphs)
                {
                    if (m == null)
                    {
                        continue;
                    }
                    morpher.AddMorph(m.Name, m);
                }
            }

            return(go);
        }
Exemplo n.º 22
0
        public ToonShadowShader() : base("Toon Shadow")
        {
            VertexCode   = Resources.ToonShadow_vert;
            FragmentCode = Resources.ToonShadow_frag;

            RegistShaderParam <Matrix4>("M", "Model");
            RegistShaderParam <Matrix4>("MIT", "ModelInverseTranspose");
            RegistShaderParam <Matrix4>("MVP", "ModelViewProjection");
            RegistShaderParam <Matrix4>("shadowMV1", "ShadowModelView1");
            RegistShaderParam <Matrix4>("shadowMV2", "ShadowModelView2");
            RegistShaderParam <Matrix4>("shadowMV3", "ShadowModelView3");

            RegistShaderParam <Color4>("diffuse", "Diffuse");
            RegistShaderParam <Color4>("specular", "Specular");
            RegistShaderParam <float>("shininess", "Shininess");
            RegistShaderParam <Color4>("uniqueColor", "UniqueColor");

            RegistShaderParam <Vector3>("wCamDir", "WorldCameraDir");
            RegistShaderParam <Vector3>("wCamPos", "WorldCameraPosition");

            RegistShaderParam <Vector3>("wDirLight.dir", "DirectionalLightDir");
            RegistShaderParam <Vector3>("wDirLight.color", "DirectionalLightColor");
            RegistShaderParam <Vector3>("wDirLight.intensity", "DirectionalLightIntensity");

            RegistShaderParam <Color4>("gAmbient", "GlobalAmbient");
            RegistShaderParam <float>("limCoeff", "LimLightCoefficient");

            RegistShaderParam <float>("contrast", "Contrast");
            RegistShaderParam <float>("saturation", "Saturation");
            RegistShaderParam <float>("brightness", "Brightness");

            RegistShaderParam("albedoMap", "AlbedoMap", TextureUnit.Texture0);
            RegistShaderParam("toonMap", "ToonMap", TextureUnit.Texture1);
            RegistShaderParam("shadowMap1", "ShadowMap1", TextureUnit.Texture2);
            RegistShaderParam("shadowMap2", "ShadowMap2", TextureUnit.Texture3);
            RegistShaderParam("shadowMap3", "ShadowMap3", TextureUnit.Texture4);

            whiteMap = MMW.GetAsset <Texture2D>("WhiteMap");
            //toonMap = MMW.GetAsset<Texture2D>("ToonMap");
            toonMap = new Texture2D(Resources.toon2);
            toonMap.Load();
        }
Exemplo n.º 23
0
        public Button(Control parent, string text, Vector2 location, Vector2 size, string sound)
        {
            Parent        = parent;
            Text          = text;
            LocalLocation = location;
            Size          = size;
            Sound         = sound;

            Clicked += (s, e) =>
            {
                if (Enabled)
                {
                    MMW.GetAsset <Sound>(Sound).Play();
                }
                else
                {
                    MMW.GetAsset <Sound>("back").Play();
                }
            };
        }
Exemplo n.º 24
0
        public ShadowShader() : base("Shadow")
        {
            VertexCode   = Resources.Shadow_vert;
            FragmentCode = Resources.Shadow_frag;

            RegistShaderParam <Matrix4>("M", "Model");
            RegistShaderParam <Matrix4>("MVP", "ModelViewProjection");
            RegistShaderParam <Matrix4>("shadowMV1", "ShadowModelView1");
            RegistShaderParam <Matrix4>("shadowMV2", "ShadowModelView2");
            RegistShaderParam <Matrix4>("shadowMV3", "ShadowModelView3");

            RegistShaderParam <Vector3>("wCamPos", "WorldCameraPosition");

            RegistShaderParam("shadowMap1", "ShadowMap1", TextureUnit.Texture0);
            RegistShaderParam("shadowMap2", "ShadowMap2", TextureUnit.Texture1);
            RegistShaderParam("shadowMap3", "ShadowMap3", TextureUnit.Texture2);

            RegistShaderParam <float>("shadowAtten", "ShadowAttenuation");

            whiteMap = MMW.GetAsset <Texture2D>("WhiteMap");
        }
Exemplo n.º 25
0
        protected internal override void OnLoad()
        {
            base.OnLoad();

            renderTexture = new RenderTexture(MMW.RenderResolution);
            renderTexture.ColorFormat0 = MMW.Configuration.DefaultPixelFormat;
            renderTexture.Load();

            ssaoShader = (SSAOUE4Shader)MMW.GetAsset <Shader>("SSAO UE4");
            if (ssaoShader == null)
            {
                ssaoShader = new SSAOUE4Shader();
                MMW.RegistAsset(ssaoShader);
            }

            if (GameObject != null)
            {
                Camera        = GameObject.GetComponent <Camera>();
                RenderTexture = Camera.TargetTexture;
            }

            orthoMatrix = Matrix4.CreateOrthographicOffCenter(-1, 1, -1, 1, -1, 1);
        }
Exemplo n.º 26
0
        public FastPhysicalShader() : base("Fast Physical")
        {
            VertexCode   = Resources.FastPhysical_vert;
            FragmentCode = Resources.FastPhysical_frag;

            RegistShaderParam <Matrix4>("M", "Model");
            RegistShaderParam <Matrix4>("MIT", "ModelInverseTranspose");
            RegistShaderParam <Matrix4>("MVP", "ModelViewProjection");

            RegistShaderParam <Color4>("diffuse", "Diffuse");
            RegistShaderParam <float>("metallic", "Metallic");
            RegistShaderParam <float>("roughness", "Roughness");
            RegistShaderParam <Vector3>("f0", "F0");

            RegistShaderParam <Vector3>("wCamDir", "WorldCameraDir");
            RegistShaderParam <Vector3>("wCamPos", "WorldCameraPosition");

            RegistShaderParam <Vector3>("wDirLight.dir", "DirectionalLightDir");
            RegistShaderParam <Vector3>("wDirLight.color", "DirectionalLightColor");
            RegistShaderParam <Vector3>("wDirLight.intensity", "DirectionalLightIntensity");

            RegistShaderParam <Color4>("gAmbient", "GlobalAmbient");

            RegistShaderParam("albedoMap", "AlbedoMap", TextureUnit.Texture0);
            RegistShaderParam("normalMap", "NormalMap", TextureUnit.Texture1);
            RegistShaderParam("environmentMap", "EnvironmentMap", TextureUnit.Texture2);
            RegistShaderParam("environmentMapDiffuse", "EnvironmentMapDiffuse", TextureUnit.Texture3);

            whiteMap         = MMW.GetAsset <Texture2D>("WhiteMap");
            defaultNormalMap = MMW.GetAsset <Texture2D>("DefaultNormalMap");
            //environmentMap = new Texture2D(Resources.ibltest) { UseMipmap = true };
            //environmentMap.Load();
            //var blur = BitmapHelper.ResizeBitmap(Resources.ibltest, 16, 8).Blur(2);
            //environmentMapDiffuse = new Texture2D(blur);
            //environmentMapDiffuse.Load();
        }
Exemplo n.º 27
0
        protected override void Update(double deltaTime)
        {
            if (!Input.Ctrl && Input.Alt && !Input.Shift && Input.IsKeyPressed(OpenTK.Input.Key.Enter))
            {
                if (form == null)
                {
                    form = new PictChatForm(MMW.GetAsset <UserData>());
                    form.Show(System.Windows.Forms.NativeWindow.FromHandle(MMW.Window.WindowInfo.Handle));
                    form.TopLevel = true;
                    form.Show();

                    form.SendClicked += (s, e) =>
                    {
                        SendPicture(e);
                    };

                    form.FormClosed += (s, e) => form = null;
                }
                else
                {
                    form.TopMost = true;
                }
            }
        }
Exemplo n.º 28
0
 protected override void OnLoad()
 {
     rb       = GameObject.GetComponent <RigidBody>();
     userData = MMW.GetAsset <UserData>();
 }
Exemplo n.º 29
0
 protected override void OnLoad()
 {
     player = MMW.FindGameObject(o => o.Tags.Contains("player"));
     server = MMW.GetAsset <Server>();
 }
Exemplo n.º 30
0
        protected internal override void OnLoad()
        {
            base.OnLoad();

            // 書き出しRT
            glareRT              = new RenderTexture(MMW.RenderResolution);
            glareRT.MagFilter    = TextureMagFilter.Linear;
            glareRT.MinFilter    = TextureMinFilter.Linear;
            glareRT.ColorFormat0 = MMW.Configuration.DefaultPixelFormat;
            glareRT.Load();

            // HDR抽出RT
            hdrRT              = new RenderTexture(MMW.RenderResolution);
            hdrRT.MagFilter    = TextureMagFilter.Linear;
            hdrRT.MinFilter    = TextureMinFilter.Linear;
            hdrRT.ColorFormat0 = MMW.Configuration.DefaultPixelFormat;
            hdrRT.Load();

            // Blur適用RT
            blurRT1s = new RenderTexture[BlurNum];
            blurRT2s = new RenderTexture[BlurNum];
            blurRT3s = new RenderTexture[BlurNum];
            blurs    = new GlareBlur[BlurNum];
            var blurSizes = new Size[]
            {
                new Size(MMW.RenderResolution.Width / 4, MMW.RenderResolution.Height / 4),
                new Size(MMW.RenderResolution.Width / 8, MMW.RenderResolution.Height / 8),
                new Size(MMW.RenderResolution.Width / 16, MMW.RenderResolution.Height / 16),
            };
            var reduct = 1.0f;

            for (var i = 0; i < BlurNum; i++)
            {
                var size = blurSizes[i];
                if (size.Width < 128)
                {
                    size.Width = 128;
                }
                if (size.Height < 128)
                {
                    size.Height = 128;
                }

                blurRT1s[i]              = new RenderTexture(size);
                blurRT1s[i].MagFilter    = TextureMagFilter.Linear;
                blurRT1s[i].MinFilter    = TextureMinFilter.Linear;
                blurRT1s[i].WrapMode     = TextureWrapMode.ClampToEdge;
                blurRT1s[i].ColorFormat0 = MMW.Configuration.DefaultPixelFormat;
                blurRT1s[i].Load();

                blurRT2s[i]              = new RenderTexture(size);
                blurRT2s[i].MagFilter    = TextureMagFilter.Linear;
                blurRT2s[i].MinFilter    = TextureMinFilter.Linear;
                blurRT2s[i].WrapMode     = TextureWrapMode.ClampToEdge;
                blurRT2s[i].ColorFormat0 = MMW.Configuration.DefaultPixelFormat;
                blurRT2s[i].Load();

                blurRT3s[i]              = new RenderTexture(size);
                blurRT3s[i].MagFilter    = TextureMagFilter.Linear;
                blurRT3s[i].MinFilter    = TextureMinFilter.Linear;
                blurRT3s[i].WrapMode     = TextureWrapMode.ClampToEdge;
                blurRT3s[i].ColorFormat0 = MMW.Configuration.DefaultPixelFormat;
                blurRT3s[i].Load();

                blurs[i] = new GlareBlur(3.0f * reduct, Direction, GlareBlur.GlareType.Line);
                blurs[i].RenderTexture = blurRT1s[i];
                blurs[i].OnLoad();
                reduct *= 2.0f;
            }

            // HDR抽出シェーダ
            hdrShader = (ExtractHDRShader)MMW.GetAsset <Shader>("Extract HDR");
            if (hdrShader == null)
            {
                hdrShader = new ExtractHDRShader();
                MMW.RegistAsset(hdrShader);
            }

            // Bloomシェーダ
            glareShader = (GlareShader)MMW.GetAsset <Shader>("Glare");
            if (glareShader == null)
            {
                glareShader = new GlareShader();
                MMW.RegistAsset(glareShader);
            }

            if (GameObject != null)
            {
                Camera        = GameObject.GetComponent <Camera>();
                RenderTexture = Camera.TargetTexture;
            }

            orthoMatrix = Matrix4.CreateOrthographicOffCenter(-1, 1, -1, 1, -1, 1);
        }