Beispiel #1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            // play offline
            // play online

            WindowBorder  = WindowBorder.Fixed;
            CursorVisible = false;

            MMW.MainCamera.GameObject.Transform.Position = new Vector3(0.0f, 1.45f, -3.0f);
            MMW.MainCamera.GameObject.AddComponent <AroundViewTest>();
            MMW.MainCamera.GameObject.AddComponent <CameraMoveTest>();
            var cc = MMW.MainCamera.GameObject.AddComponent <ColorCollecter>();

            cc.Saturation = 1.4f;

            MMW.IBLIntensity = 1.0f;

            pmdImporter = new PmdImporter();
            pmxImporter = new PmxImporter();
            mqoImporter = new MqoImporter();

            var miku = CreatePmdObject(@"C:\Users\yoship\Downloads\mmd\Models\vocaloid\初音ミク.pmd");

            miku.AddComponent <ParamChangeTest>();
            MMW.RegistGameObject(miku);

            var rin = CreatePmdObject(@"C:\Users\yoship\Downloads\mmd\Models\vocaloid\鏡音リン.pmd");

            rin.AddComponent <ParamChangeTest>();
            rin.Transform.Position.X = 1.0f;
            MMW.RegistGameObject(rin);

            var meiko = CreatePmdObject(@"C:\Users\yoship\Downloads\mmd\MikuMikuDance_v926x64\UserFile\Model\MEIKO.pmd");

            meiko.AddComponent <ParamChangeTest>();
            meiko.Transform.Position.X = 2.0f;
            MMW.RegistGameObject(meiko);

            var atama = CreatePmxObject(@"C:\Users\yoship\Downloads\mmd\Models\頭の悪い人\頭の悪い人.pmx");

            atama.AddComponent <ParamChangeTest>();
            atama.Transform.Position.X = 3.0f;
            MMW.RegistGameObject(atama);

            //var stage = CreatePmdObject(@"C:\Users\yoship\Downloads\mmd\Models\ドイツ邸001\ドイツ邸セット.pmd");

            var files = new string[]
            {
                @"C:\Users\yoship\Downloads\mmd\Models\kelorin3_forMMD\block_a.pmx",
                @"C:\Users\yoship\Downloads\mmd\Models\kelorin3_forMMD\block_b.pmx",
                @"C:\Users\yoship\Downloads\mmd\Models\kelorin3_forMMD\block_b_k.pmx",
                @"C:\Users\yoship\Downloads\mmd\Models\kelorin3_forMMD\block_c.pmx",
                @"C:\Users\yoship\Downloads\mmd\Models\kelorin3_forMMD\block_canal.pmx",
                @"C:\Users\yoship\Downloads\mmd\Models\kelorin3_forMMD\block_d.pmx",
                @"C:\Users\yoship\Downloads\mmd\Models\kelorin3_forMMD\block_out01.pmx",
                //@"C:\Users\yoship\Downloads\mmd\Models\kelorin3_forMMD\block_out02-1.pmx",
                //@"C:\Users\yoship\Downloads\mmd\Models\kelorin3_forMMD\block_out02-2.pmx",
                @"C:\Users\yoship\Downloads\mmd\Models\kelorin3_forMMD\block_outer.pmx",
            };

            foreach (var file in files)
            {
                var stage = CreatePmxObject(file);
                var mr    = stage.GetComponent <MeshRenderer>();
                stage.AddComponent <MeshCollider>(mr.Mesh);
                //stage.AddComponent<ParamChangeTest>();
                MMW.RegistGameObject(stage);
            }

            var probj = new GameObject("Property Renderer");

            probj.AddComponent <PropertyRenderer>();
            MMW.RegistGameObject(probj);

            GC.Collect();
        }
Beispiel #2
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            // play offline
            // play online

            WindowBorder  = WindowBorder.Fixed;
            CursorVisible = false;

            MMW.MainCamera.GameObject.Transform.Position = new Vector3(0.0f, 1.5f, -4.0f);
            MMW.MainCamera.GameObject.Transform.Rotate   = new Vector3(0.2f, 0.0f, 0.0f);
            MMW.MainCamera.GameObject.AddComponent <GlobalParamChange>();
            MMW.MainCamera.ClearSkyBox = MMW.GetAsset <TextureCube>("DefaultSkyBox");

            MMW.DirectionalLight.Intensity           = 1.0f;
            MMW.DirectionalLight.Transform.Rotate.X *= -1.0f;
            MMW.DirectionalLight.Color = Color4.White;

            mqoImporter = new MqoImporter();
            pmdImporter = new PmdImporter();
            pmxImporter = new PmxImporter();

            var sphere = Mesh.CreateSimpleSphereMesh(0.36f, 24, 20);
            var mat    = new Material("pbr", MMW.GetAsset <Shader>("Physical"));

            mat.AddParam("diffuse", Color4.White);
            mat.AddParam("roughness", 0.5f);
            mat.AddParam("metallic", 0.0f);
            mat.AddParam("f0", new Color4(0.8f, 0.8f, 0.8f, 1.0f));

            var roughnesses = new float[]
            {
                0.9f,
                0.6f,
                0.4f,
                0.25f,
                0.1f
            };

            var metallics = new float[]
            {
                0.0f,
                0.0f,
                1.0f,
                1.0f,
                1.0f,
            };

            var diffuses = new Color4[]
            {
                new Color4(1.0f, 1.0f, 0.9f, 1.0f),
                Material.IronColor,
                Material.CopperColor,
                Material.SilverColor,
                Material.GoldColor,
            };

            var f0s = new Color4[]
            {
                Material.WaterF0Color,
                Material.PlasticF0Color,
                Material.CopperF0Color,
                Material.SilverF0Color,
                Material.GoldF0Color,
            };

            for (var x = 0; x < 5; x++)
            {
                var obj = new GameObject("Sphere", Matrix4.CreateTranslation(new Vector3(x - 2, 0, 0)));
                var mr  = obj.AddComponent <MeshRenderer>(sphere);
                mat.SetParam("roughness", roughnesses[x]);
                mat.SetParam("metallic", metallics[x]);
                mat.SetParam("diffuse", diffuses[x]);
                mat.SetParam("f0", f0s[x]);

                mr.SetMaterial(0, mat, false);
                MMW.RegistGameObject(obj);
            }

            var plane = new GameObject("plane", Matrix4.CreateTranslation(new Vector3(0.0f, -0.36f, 0.0f)));
            var pmr   = plane.AddComponent <MeshRenderer>(Mesh.CreateSimplePlaneMesh(5.0f, 5.0f));

            pmr.SetMaterial(0, mat, false);
            MMW.RegistGameObject(plane);

            var pl = new GameObject();

            pl.AddComponent <PointLight>();
            pl.UpdateAction += (s, ev) =>
            {
                pl.Transform.Position = new Vector3((float)Math.Sin(MMW.TotalElapsedTime) * 2.0f, 2.0f, 0.0f);
            };
            MMW.RegistGameObject(pl);

            //var miku = CreatePmxObject(@"C:\Users\yoship\Downloads\mmd\Models\MikuV4X_Digitrevx\MikuV4X.pmx");
            //var miku = CreatePmdObject(@"C:\Users\yoship\Downloads\mmd\Models\vocaloid\頭の悪い人.pmd");
            //var miku = CreatePmdObject(@"C:\Users\yoship\Downloads\mmd\Models\ドイツ邸001\ドイツ邸セット.pmd");
            //miku.AddComponent<ParamChangeTest>();
            //MMW.RegistGameObject(miku);


            var probj = new GameObject("Property Renderer")
            {
                Layer = GameObject.LayerUI
            };
            var pr = probj.AddComponent <PropertyRenderer>();

            //pr.pct = miku.GetComponent<ParamChangeTest>();
            //pr.light = point.GetComponent<PointLight>();
            MMW.RegistGameObject(probj);
        }